query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
We initialize the class passing in the 3 attributes. | def initialize(name, phone_number, email)
@name = name
@phone_number = phone_number
@email = email
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(args)\n @attributes = args\n end",
"def initialize(*args)\n @args = args\n assign_attributes\n end",
"def initialize(*attrs)\n set_attributes(attrs.extract_options!)\n end",
"def initialize(*attrs)\n # Sets all attributes as instance variables from the params (note this could also be done easily by using an OpenStruct)\n ATTRS.each do |key|\n instance_variable_set(\"@#{key}\", attrs.first[key])\n end\n end",
"def initialize(data) # will accept the attribute data. \r\n\r\n @data = data # store the attribute data, and allows it to be used each time. \r\n\r\n end",
"def initialize(params={})super(params)\n # Define accessor and query methods for each attribute.\n attrs.each do |attribute|\n self.class.send :attr_accessor, attribute\n define_attr_query attribute\n end\n\n # Set instance variables and initialize @attributes with any\n # attribute values that were passed in the params hash.\n @attributes = {}\n params.each do |k,v|\n if attrs.include? k.to_s\n send(\"#{k}=\", v)\n @attributes[k] = v\n end\n end\n end",
"def initialize(attributes={})\n\t\t\t@attributes = attributes\n\t\tend",
"def initialize(attrs={})\n @attrs = attrs\n end",
"def initialize(attrs={})\n @attrs = attrs\n end",
"def initialize\n \n end",
"def initialize(attributes)\n super\n end",
"def initialize(params = {})\n self.attributes = params\n end",
"def initialize(attributes={}) #can set instance variables when creating the instance\n @name = attributes[:name]\n @major = attributes[:major]\n @course = attributes[:course]\n @grade = attributes[:grade]\n end",
"def initialize(*rest) end",
"def initialize(name, age, hometown) #attributes are determined here\n @name = name\n @age = age\n @hometown = hometown\n end",
"def initialize(*_)\n super\n end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(attrs = {})\n @attrs = attrs\n end",
"def initialize(attributes = {})\n self.class.set_attrb_accessors\n\n #cheeto = Student.new(name: \"cheeto\", grade: 6)\n attributes.each do |property, value|\n #interpolation converts symbol to string\n self.send(\"#{property}=\", value)\n end\n end",
"def initialize(attrs={})\n load_attributes!(attrs)\n end",
"def initialize(**attributes)\n @attr = {}\n attributes\n end",
"def initialize attr={}\n super\n self.attributes = attr\n end",
"def initialize(hash={})\n self.init_attrs_from_hash(hash)\n end",
"def initialize_attributes(attributes); end",
"def initialize(attributes)\n super\n end",
"def initialize() end",
"def initialize (attributes)\n attributes.each do |key, value|\n self.send((\"#{key}=\"), value)\n end\n end",
"def initialize\n\t\t\n\tend",
"def initialize(attributes)\n super(attributes)\n end",
"def initialize(attributes={})\n super\n end",
"def initialize(attributes={})\n super\n end",
"def initialize(attributes={})\n super\n end",
"def initialize(attributes)\n attributes.each {|key, value| self.send(\"#{key}=\", value)}\n end",
"def initialize(args = {})\n @attributes = {}\n args.each do |k, v|\n self.send :\"#{k.to_s}=\", v\n end\n\n end",
"def initialize(*args)\n end",
"def initialize(attributes = {})\n super\n end",
"def initialize(attrs = {})\n attrs.each_pair do |attr, value|\n self.instance_variable_set(\"@#{attr}\", value)\n end\n end",
"def initialize(attrs={})\n @attrs = attrs || {}\n end",
"def initialize(attrs = {})\n @attributes = attrs\n\n # Set values where we have defined a reader, probably\n @attributes.each do |key, val|\n if respond_to?(key.to_sym)\n instance_variable_set(\"@#{key}\", val)\n end\n end\n end",
"def initialize(attributes={})\n attributes.each {|key, value| self.send(\"#{key}=\", value)}\n end",
"def initialize(attributes={})\n attributes.each do |key, value|\n self.send(\"#{key}=\", value)\n end\n @attributes = attributes\n end",
"def initialize\r\n\r\n end",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def initialize(*args)\n set_instance_variables args\n end",
"def initialize(params={})\n \n params.each do |attr, value|\n self.public_send(\"#{attr}=\", value)\n end if params\n \n end",
"def initialize(attributes)\n attributes.each {|key, value| self.send((\"#{key}=\"), value)}\n end",
"def initialize(attrs = {})\n @attrs = attrs || {}\n end",
"def initialize(args={})\n super(ATTR_DEFAULTS.merge(args))\n end",
"def initialize(attributes)\n\t\t\tsuper\n\n\t\t\t# The wrapper to the API does not judge original values, so I initialize them here\n\t\t\t@max_weight ||= 100000000000\n\t\t\t@min_weight ||= 0\n\t\t\t@max_depth ||= 100000000000\n\t\t\t@min_depth \t||= 0\n\t\t\t@max_height ||= 100000000000\n\t\t\t@min_height ||= 0\n\t\t\t@max_width \t||= 100000000000\n\t\t\t@min_width \t||= 0\n\t\t\t@max_value \t||= 100000000000\n\t\t\t@min_value \t||= 0\n\n\t\tend",
"def initialize( * )\n super\n end",
"def initialize(*args)\n\t\t\t\t\tself.track_changed_attributes = true\n\t\t\t\t\tself.changed_attributes_aado = []\n\n\t\t\t\t\tsuper(*args)\n\t\t\t\t\t\n\t\t\t\t\trequire \"obdb/AR_DatabaseObject\"\t# its here because of a circular reference problem\n\t\t\t\t\tself.database_object = DatabaseObject.create_do(self.class, self.id, self)\n\t\t\t\tend",
"def initialize(*args)\n params = args[0]\n attribute_keys.each { |k| self.__send__(\"#{k}=\", params[k]) if params.key?(k) } if params\n end",
"def initialize(attributes={})\n @attributes = attributes\n end",
"def initialize(attributes={})\n @attributes = attributes\n end",
"def initialize(attributes={})\n @attributes = attributes\n end",
"def initialize(attributes={})\n @attributes = attributes\n end",
"def initialize(attributes={})\n @attributes = attributes\n end",
"def initialize(*args); end",
"def initialize(a,b,c)\n @a, @b, @c = a, b, c\n end",
"def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end",
"def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end",
"def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end",
"def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end",
"def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end",
"def initialize(args = {})\n super(ATTR_DEFAULTS.merge(args))\n end",
"def initialize(attributes = {})\n self.attributes = attributes\n end",
"def initialize(attributes = {})\n self.attributes = attributes\n end",
"def initialize (attrs = {})\n @attributes = {}\n @json_attributes = {}\n self.attributes = attrs\n end",
"def initialize *args\n @attributes = {}\n opts = args.last.is_a?(Hash) ? args.pop : {}\n each_with_index { |(name, _), i| send \"#{name}=\", args[i] } unless args.empty?\n opts.each { |name, value| send \"#{name}=\", value }\n end",
"def initialize(attr={})\n super\n end",
"def constructor; end",
"def initialize(args = {})\n # We must set flags before the other values\n @flags = [false, false, false, false]\n update_attributes(ATTR_DEFAULTS.merge(args))\n end",
"def initialize(attributes = {})\n# puts attributes\n attributes = attributes.reduce({}){ |hash, (k, v)|\n key = k.to_s.underscore\n hash = hash.merge( key => v ) if @@fields.find_index(key.to_sym)\n hash\n }\n HashWithIndifferentAccess.new(attributes)\n attributes.each do |k,v|\n self.send (k + '=').to_sym, v # grazie, DM\n end\n super\n raise ArgumentError.new(\"Citation ID can't be nil\") if self.citation_id.nil?\n raise ArgumentError.new(\"Citation type can't be nil. CitationID: #{self.citation_id}\") if self.citation_type.nil?\n raise ArgumentError.new(\"Citation type must be JOURNAL or NON JOURNAL. CitationID: #{self.citation_id}\") if self.citation_type != \"JOURNAL\" && self.citation_type != \"NON_JOURNAL\"\n raise ArgumentError.new(\"Citation must have a title. CitationID: #{self.citation_id}\") if self.title.nil?\n end",
"def initialize(atts = nil)\n initialize_attributes\n self.update_attributes(atts || {})\n end",
"def initialize(attributes)\n @attributes = attributes\n end",
"def initialize(attributes)\n @attributes = attributes\n end",
"def initialize(attributes)\n @attributes = attributes\n end",
"def initialize(attributes)\n @attributes = attributes\n end",
"def initialize(attributes)\n @attributes = attributes\n end",
"def initialize(attributes = {})\n\t\t\tload(attributes)\n\t\tend",
"def initialize(attributes = {})\n attributes.each do |name, value|\n public_send(\"#{name}=\", value)\n end\n end",
"def initialize(attributes = {})\n attributes.each do |name, value|\n public_send(\"#{name}=\", value)\n end\n end",
"def initialize(*args)\n set_instance_variables args if args.size > 0\n end",
"def initialize(*args)\n super\n end",
"def initialize\n end",
"def initialize(attributes = nil)\n assign_attributes(attributes)\n super()\n end",
"def initialize(*args)\n #This is a stub, used for indexing\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end"
] | [
"0.7795555",
"0.77747923",
"0.76916087",
"0.76550806",
"0.7607321",
"0.75914043",
"0.75573444",
"0.7554523",
"0.7554523",
"0.7467844",
"0.74667555",
"0.74656606",
"0.7460676",
"0.744712",
"0.7444691",
"0.74433666",
"0.74408185",
"0.74408185",
"0.74408185",
"0.74408185",
"0.74408185",
"0.7434769",
"0.7433728",
"0.74333036",
"0.74111927",
"0.74081475",
"0.73895705",
"0.7373796",
"0.73674774",
"0.734183",
"0.73112524",
"0.7311229",
"0.7310088",
"0.73035526",
"0.73035526",
"0.73035526",
"0.7301509",
"0.7299554",
"0.72830003",
"0.7282944",
"0.7278466",
"0.72737354",
"0.7272946",
"0.72632337",
"0.72566676",
"0.72546536",
"0.7253384",
"0.7253384",
"0.7251575",
"0.7250626",
"0.72411776",
"0.72406584",
"0.7231303",
"0.7227019",
"0.72253704",
"0.72200745",
"0.7218922",
"0.7215041",
"0.7215041",
"0.7215041",
"0.7215041",
"0.7215041",
"0.72148097",
"0.7201593",
"0.7196585",
"0.7196585",
"0.7196585",
"0.7196585",
"0.7196585",
"0.7196585",
"0.7193122",
"0.7193122",
"0.71917933",
"0.7191145",
"0.7184611",
"0.7183722",
"0.7183285",
"0.7173791",
"0.7169266",
"0.71632093",
"0.71632093",
"0.71632093",
"0.71632093",
"0.71632093",
"0.7162923",
"0.716291",
"0.716291",
"0.7157361",
"0.7157071",
"0.71519667",
"0.71508753",
"0.7144245",
"0.71401787",
"0.71401787",
"0.71401787",
"0.71401787",
"0.71401787",
"0.71401787",
"0.71401787",
"0.71401787",
"0.71401787"
] | 0.0 | -1 |
the following are the Activity Goals Calculations any changes here should also be made in activity_goals_calculator.js.coffee | def referrals_needed_per_month
5 * monthly_transaction_goal
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def points_algorithm\n\tif current_user[:input] = \"Calories\"\n\tcurrent_user[:points] = (@daily_activity['goals']['steps'] * 0.1)\n\telsif current_user[:input] = \"Distance\"\n\tcurrent_user[:points] = (@daily_activity['goals']['distance'] * 10)\n\telsif current_user[:input] = \"Steps\"\n\tcurrent_user[:points] = (@daily_activity['goals']['caloriesOut'] * 0.1)\n\tend\n end",
"def goals_for()\n\t self.as_regular_contestants.select{|c| c.score}.collect{|c| c.score}.inject{|gf, c| gf + c} || 0\n\tend",
"def give_goals_to_user\n self.goals.create(category: \"Use my own bags at the store\", point_value: 12, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Carpool instead of use my car\", point_value: 100, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Air dry a load of laundry\", point_value: 70, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Adjust the thermostat up 1 degree in summer\", point_value: 40, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Install a compact fluorescent light bulb\", point_value: 60, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Ride a bike instead of car 1 mile\", point_value: 20, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Take a shorter shower (5 min or less)\", point_value: 4, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Turn off my engine instead of idleing\", point_value: 15, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Buy or eat local\", point_value: 15, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n\n\n end",
"def add_goals\n end",
"def calculate_calories_burned\n type = activity.activity_type\n user_weight = user.recent_most_weight.value\n user_weight = user_weight < 1 || user_weight.nil? ? 0 : user_weight\n # Our global intensity multipler\n intensity = 1 + (activity.intensity / 10)\n\n case type\n\n when 0 # Weight lifting\n self.calories = 0 and return true if work == 0\n # Calculate the joules expended\n joules = (self.work / 1000) * 9.81 * 0.75\n # Calories per rep\n per_rep = (joules * 0.000239006) * 5 # Times 5 here because 5 * 20 = 100; Muscles are roughly 20% efficient\n # Multiplier for heart rate elevation and work intensity. Default is 1.5\n # if we don't know their weight\n multiplier = user_weight == 0 ? 1.5 : 3.5 * (self.work / user_weight)\n # The full formula\n calories_burned = per_rep * reps * multiplier * intensity\n self.calories = calories_burned.round(2)\n\n when 1 # Timed things\n # Altering our intensity to work in the formula at\n # http://ask.metafilter.com/48652/Walking-formula\n intensity = intensity / 100\n intensity = intensity < 0.015 ? 0.015 : intensity\n # Convert user_weight to pounds from grams\n user_weight = user_weight * 0.00220462\n # Work here will be time in seconds\n self.calories = (intensity * user_weight * (work / 60)).round(2)\n\n when 2 # Distance\n # Credit: NET calories burned per miles as listed at\n # https://www.checkyourmath.com/convert/length/miles_mm.php\n #\n # Find our intensity. Basic running is .65, walking is .3, sprinting is\n # all the way at .8\n intensity = intensity - 1\n intensity = intensity < 0.2 ? 0.2 : intensity\n intensity = intensity > 0.8 ? 0.8 : intensity\n # Convert their weight to pounds\n user_weight = user_weight * 0.00220462\n # Convert the unit of work from mm to miles\n work_in_miles = self.work * 0.00000062\n # And finally\n self.calories = (intensity * user_weight * work_in_miles).round(2)\n\n when 3 # Repetitions\n # A VERY simple and dirty calculation here. Basically, any of these reps\n # are going to be bodyweight, ranging from ridiculously easy for even the\n # most out of shape people (like a simple crunch), to something difficult\n # for even professional athletes (dragon flags). So we'll have a baseline\n # of 1 calorie, and range up to 6 per repetition depending on the exercise's\n # intensity\n intensity = (activity.intensity / 2).round\n intensity = intensity < 1 ? 1 : intensity\n self.calories = intensity * self.reps\n else\n\n self.calories = 0\n end\n end",
"def goals_against()\n\t self.as_regular_contestants.select{|c| c.opponent.score}.collect{|c| c.opponent.score}.inject{|gf, c| gf + c} || 0\n\tend",
"def daily_goals\n goals\n end",
"def goals_by_hoa_id_suite\n goals_by_away_id\n goals_by_home_id\n average_score_per_away_game_by_team_id\n average_score_per_home_game_by_team_id\n end",
"def goals_by_hoa_id_suite\n goals_by_away_id\n goals_by_home_id\n average_score_per_away_game_by_team_id\n average_score_per_home_game_by_team_id\n end",
"def actions(rental)\n # Main :\n tot_com = price(rental) * 30 / 100\n start_date = DateTime.parse(rental[\"start_date\"])\n end_date = DateTime.parse(rental[\"end_date\"])\n duration = (end_date - start_date).to_i + 1\n insurance_fee = tot_com / 2 .to_i\n assistance_fee = duration * 100\n drivy_fee = tot_com - insurance_fee - assistance_fee\n\n # Options :\n gps = 0\n if options(rental).include?(\"gps\") then gps += 500 * duration end\n baby_seat = 0\n if options(rental).include?(\"baby_seat\") then baby_seat += 200 * duration end\n additional_insurance = 0\n if options(rental).include?(\"additional_insurance\") then additional_insurance += 1000 * duration end\n\n debit_driver = {\"who\": \"driver\", \"type\": \"debit\", \"amount\": price(rental) + gps + baby_seat + additional_insurance}\n credit_owner = {\"who\": \"owner\", \"type\": \"credit\", \"amount\": price(rental) - tot_com + gps + baby_seat}\n credit_insurance = {\"who\": \"insurance\", \"type\": \"credit\", \"amount\": insurance_fee}\n credit_assistance = {\"who\": \"assistance\", \"type\": \"credit\", \"amount\": assistance_fee}\n credit_drivy = {\"who\": \"drivy\", \"type\": \"credit\", \"amount\": drivy_fee + additional_insurance}\n\n actions = [debit_driver, credit_owner, credit_insurance, credit_assistance, credit_drivy]\nend",
"def goal_diff()\n\t self.goals_for() - self.goals_against()\n\tend",
"def goal\n 28\n end",
"def calc_achievements\n\n #TODO: Use a list of achievements in db with conditions stored in db, iterate and award as necessary. \n if (self.games_won_as_pacman == 10)\n self.user.achievements << Achievement.create(:name => \"The Elusive Pacman\", :desc => \"Win 10 games as Pacman\");\n elsif (self.games_won_as_pacman == 100)\n self.user.achievements << Achievement.create(:name => \"Pacman Supreme\", :desc => \"Win 100 games as Pacman\");\n elsif (self.games_won_as_ghost == 10)\n self.user.achievements << Achievement.create(:name => \"Pacman Killer\", :desc => \"Win 10 games as a Ghost\");\n elsif (self.games_won_as_ghost == 100)\n self.user.achievements << Achievement.create(:name => \"Guardian of all the dots in the world\", :desc => \"Win 100 games as a Ghost\");\n elsif (self.total_ghosts_eaten == 50)\n self.user.achievements << Achievement.create(:name => \"Om nom nom!\", :desc => \"Eat 50 ghosts.\");\n elsif (self.total_pacman_eaten == 50)\n self.user.achievements << Achievement.create(:name => \"He never saw it coming.\", :desc => \"Eat 50 Pacman\");\n end \n end",
"def index\n @goals = current_user.goals\n \n @goals.each do |g|\n completed_milestone=0\n @milestones=g.milestones \n if(@milestones.count>0)\n @milestones.each do |m|\n if(m.completed)\n completed_milestone=completed_milestone+1\n end\n \n\n end\n g.percentage=(completed_milestone/@milestones.count)*100\n else\n g.percentage=0\n end\n \n end\n\n end",
"def evaluate\n load_activities\n @ta_delivery_methods = TaDeliveryMethod.all\n @intensity_levels = IntensityLevel.all\n @ta_categories = TaCategory.all\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def calculate_step_completion(live_step, actual_confirmation, level_object, lang_attribute_value, hours_per_workday)\n\t\tduration_days = self.duration_days\n\t\tduration_minutes = self.duration_minutes\n\t\tduration_multiplier = self.duration_multiplier\n\t\tcomp = 1\n\t\tlang = 1\n\n\t\tif level_object.present?\n\t\t\trework_components = 0\n\t\t if level_object.class.name == 'L3'\n\t\t if level_object.num_component.to_i > 0\n\t\t \tcomp = level_object.num_component.to_i - level_object.num_component_in_rework.to_i\n\t\t end\n\t\t\telse\n\t\t\t\tcomp = level_object.num_component.present? ? level_object.num_component : 1\n end\n\n if comp.to_i <= 0\n comp = 1\n end\n\n\t\tend\n\n\t\tif lang_attribute_value.present?\n\t\t\tlang = lang_attribute_value.value.present? ? lang_attribute_value.value : 1\n\t\t\tlang = lang.to_i\n\t\tend\n\t\t\n\t\tnumberDays = duration_days.present? ? duration_days : 0\n\t\tnumberMinute = duration_minutes.present? ? duration_minutes : 0\n\n\t\t\t\t\t\t# Duration Multiplier\n\t\tif duration_multiplier == 'C'\n\t\t\tnumber_days = numberDays*comp\n\t\t\tnumber_minutes = numberMinute*comp\n\t\telsif duration_multiplier == 'L'\n\t\t\tnumber_days = (numberDays*comp)/lang\n\t\t\tnumber_minutes = (numberMinute*comp)/lang\n\t\telse\n\t\t\tnumber_days = numberDays\n\t\t\tnumber_minutes = numberMinute\n\t\tend\n\n\t\tif !live_step.is_active?\n\t\t\tnumber_days = 0\n\t\t\tnumber_minutes = 0\n\t\tend\n\n\t\t\t\t\t\t# Covnert minutes to hours and minutes\n\t\thours_frm_minutes, reminaing_minutes = number_minutes.divmod(60)\n\t\tdays_frm_hours, remaining_hours = hours_frm_minutes.divmod(hours_per_workday)\n\t\tnumber_days = number_days + days_frm_hours\n\n\t\tactual_confirmation = actual_confirmation.to_datetime.strftime('%Y-%m-%d %H:%M')\n\t\tactual_confirmationTime = Time.parse(actual_confirmation)\n\t\tactual_confirmation_time = remaining_hours.business_hours.after(actual_confirmationTime)\n\t\t\n\t\tif number_days > 0\n\t\t\tactual_confirmation_time = number_days.business_days.after(actual_confirmation_time)\n\t\tend\n\t\t\n\t\treturn actual_confirmation_time + reminaing_minutes.minutes\n\n\t\t# end_of_day = workflow.end_of_day.to_time.strftime( \"%I %M %p\" )\n\t\t# calculated_end_of_day = actual_confirmation_time + reminaing_minutes.minutes\n\t\t# if calculated_end_of_day > end_of_day\n\t\t# \textra_seconds = calculated_end_of_day.to_time.strftime( \"%I %M %p\" ) - end_of_day.to_time.strftime( \"%I %M %p\" ))\n\t\t# \textra_minutes = extra_seconds/3600\n\t\t# \tactual_confirmation = actual_confirmation_time + reminaing_minutes.minutes\n\t\t# \tactual_confirmation = actual_confirmation.to_time.strftime('%Y-%m-%d %H:%M')\n\t\t# \tactual_confirmationTime = Time.parse(actual_confirmation)\n\t\t# \tactual_confirmation_time = 0.business_hours.after(actual_confirmationTime)\n\t\t# \treturn actual_confirmation_time + extra_minutes\n\t\t# else\n\t\t# \treturn calculated_end_of_day\n\t\t# end\n\tend",
"def do_calculate_eta(wls, hours_per_workday,workflow,current_user,currentWorkflowLiveStepConfirm)\n\t pred_max_completion = ''\n\t max_step_completion = ''\n\t if wls.predecessors.present? && !wls.actual_confirmation.present? # && wls.is_active?\n\t comp_attribute_value = wls.object\n\t lang_attribute_value = wls.object.attribute_values.joins(:label_attribute).where(\"label_attributes.short_label='#Lang'\").first\n\t #check successor---------------------\n\t predecessors_steps = wls.predecessors.split(\",\")\n\t predecessors_step_ojbets = WorkflowLiveStep.where(id: predecessors_steps)\n\t predecessors_step_ojbets.each_with_index do |pso, indx|\n\t if indx == 0 and pso.step_completion.present?\n\t pred_max_completion = pso.step_completion\n\t elsif pso.step_completion.present?\n\t \tif pred_max_completion.present?\n\t\t \tif DateTime.parse(pso.step_completion.to_s) > DateTime.parse(pred_max_completion.to_s)\n\t\t \t\tpred_max_completion = pso.step_completion\n\t\t \t\tend\n\t\t \telse\n\t\t \t\tpred_max_completion = pso.step_completion\n\t\t \tend\t\n\t end\n\t end\n\t \n\t predecessors_step_ojbets.each_with_index do |pso, indx|\n\t if indx == 0 and pso.step_completion.present?\n\t station_step = wls.station_step\n\t max_step_completion = station_step.calculate_step_completion(wls, pso.step_completion, comp_attribute_value, lang_attribute_value, hours_per_workday)\n\t elsif pso.step_completion.present?\n\t station_step = wls.station_step\n\t step_completion_other = station_step.calculate_step_completion(wls, pso.step_completion, comp_attribute_value, lang_attribute_value, hours_per_workday)\n\t if step_completion_other.present? and max_step_completion.present?\n\t\t if DateTime.parse(step_completion_other.to_s) > DateTime.parse(max_step_completion.to_s)\n\t\t max_step_completion = step_completion_other \n\t\t end\n\t \telse\n\t \t\tmax_step_completion = step_completion_other \n\t \tend\n\t end\n\t end\n\n\t\t\t current_eta = wls.eta\n\t wls.eta = pred_max_completion\n\t wls.step_completion = max_step_completion\n\t wls.save!\n\t elsif wls.predecessors.present? && wls.actual_confirmation.present?\n\t comp_attribute_value = wls.object\n\t lang_attribute_value = wls.object.attribute_values.joins(:label_attribute).where(\"label_attributes.short_label='#Lang'\").first\n\t\t\t \t\tstation_step = wls.station_step\n\t\t \tstep_completion = station_step.calculate_step_completion(wls, wls.actual_confirmation, comp_attribute_value, lang_attribute_value, hours_per_workday)\n\t\t \twls.step_completion = step_completion\n \t\t wls.save!\n\t end\n\t end",
"def actions(rental)\n tot_com = price(rental) * 30 / 100\n start_date = DateTime.parse(rental[\"start_date\"])\n end_date = DateTime.parse(rental[\"end_date\"])\n duration = (end_date - start_date).to_i + 1\n insurance_fee = tot_com / 2 .to_i\n assistance_fee = duration * 100\n drivy_fee = tot_com - insurance_fee - assistance_fee\n\n debit_driver = {\"who\": \"driver\", \"type\": \"debit\", \"amount\": price(rental)}\n credit_owner = {\"who\": \"owner\", \"type\": \"credit\", \"amount\": (price(rental) - tot_com)}\n credit_insurance = {\"who\": \"insurance\", \"type\": \"credit\", \"amount\": insurance_fee}\n credit_assistance = {\"who\": \"assistance\", \"type\": \"credit\", \"amount\": assistance_fee}\n credit_drivy = {\"who\": \"drivy\", \"type\": \"credit\", \"amount\": drivy_fee}\n\n actions = [debit_driver, credit_owner, credit_insurance, credit_assistance, credit_drivy]\nend",
"def pri_tdef\n team_stats.opp_goals_per_game / team_stats.opp_avg_goals_against_per_game\n end",
"def get_current_overall_scaled_goal_amount\n total_days = (self.goal_date - self.created_at.to_date).to_i\n days_so_far = (Date.current - self.created_at.to_date).to_i\n (self.amount * (days_so_far / total_days.to_f)).round\n end",
"def goal_difference\n total_diff = 0\n\n wattball_matches_as_team1.each do |match|\n total_diff += match.goal_difference[0]\n end\n\n wattball_matches_as_team2.each do |match|\n total_diff += match.goal_difference[1]\n end\n \n total_diff\n end",
"def create\n @goal = current_user.goals.build(goal_params)\n\n # iterate throught dates\n puts goal_params[:start_date]\n puts goal_params[:duration]\n\n if goal_params[:start_date] != \"\" && goal_params[:duration] != \"\"\n start_date = Date.parse(goal_params[:start_date])\n end_date = start_date + goal_params[:duration].to_i - 1\n\n start_date.upto(end_date) do |date|\n @goal.activities.build({done: false, due_date: date})\n end\n end\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to goals_path, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def goals\n assessment_type = params[:assessment_type]\n country_name = params[:country_name]\n technical_area_ids = params[:areas].to_s.split(\"-\")\n @disease_ids = params[:diseases]\n country = Country.find_by_name country_name\n @publication = AssessmentPublication.find_by_named_id assessment_type\n if country.present? && @publication.present?\n @assessment =\n Assessment.deep_load(country.try(:alpha3), @publication.try(:id))\n end\n if @assessment.blank?\n render \"assessment_not_found\"\n return\n end\n @plan =\n Plan.new_from_assessment(\n assessment: @assessment,\n technical_area_ids: technical_area_ids,\n is_5_year_plan: params[:plan_term]&.start_with?(\"5\")\n )\n end",
"def create\n @goal = @user.goals.new(params[:goal])\n=begin \n if params[:goal_amount].blank?\n @goal.errors[:base] << \"Select score or duration for setting goal.\"\n elsif params[:goal_amount] == \"score\"\n if @goal.goal_amount_score.blank?\n @goal.errors[:goal_amount_score] << \"should be set.\"\n end\n \n if [email protected]_amount_duration.blank?\n @goal.goal_amount_duration = nil\n end\n elsif params[:goal_amount] == \"duration\"\n if @goal.goal_amount_duration.blank?\n @goal.errors[:goal_amount_duration] << \"should be set.\"\n end\n \n if [email protected]_amount_score.blank?\n @goal.goal_amount_score = nil\n end\n end\n=end \n if @goal.goal_type == 'recurring'\n case params[:goal_frequency]\n when \"daily\"\n @goal.goal_frequency = 1\n @goal.goal_frequency_unit = \"day\"\n when \"weekly\"\n @goal.goal_frequency = 1\n @goal.goal_frequency_unit = \"week\"\n when \"bi-monthly\"\n @goal.goal_frequency = 2\n @goal.goal_frequency_unit = \"week\"\n when \"monthly\"\n @goal.goal_frequency = 1\n @goal.goal_frequency_unit = \"month\"\n when \"other\"\n @goal.goal_frequency = params[:goal_frequency].to_i\n @goal.goal_frequency_unit = params[:frequency][:other_frequency_unit]\n end\n \n end\n \n if [email protected]?\n render action: \"new\"\n else\n respond_to do |format|\n if @goal.save\n format.html { redirect_to [@user,@goal], notice: 'Goal was successfully created.' }\n format.json { render json: @goal, status: :created, location: @goal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def calculated; end",
"def calculation\n end",
"def goals_against(club)\n if finished?\n if club == local\n return guest_goals\n end\n\n if club == guest\n return local_goals\n end\n end\n\n 0\n end",
"def update_actual_cost\n cost = BigDecimal(0.00, 10)\n self.activities.each do |activity|\n cost += activity.actualCost\n end\n self.actual_cost = cost\n end",
"def index\n\n # default show activities starting two months ago\n from_date = Time.now - 2.months\n to_date = Time.now + 2.months\n\n if(params.has_key?(:start_date))\n from_date = Time.parse(params[:start_date]) - 3.months\n to_date = Time.parse(params[:start_date]) + 3.months\n end\n\n @activities = Activity.includes(:activity_type).where(\"user_id=? and start>=? and start<=?\", current_user.id, from_date, to_date)\n\n total_duration = Activity.where(\"user_id=?\", current_user.id).group(:user_id).sum(:duration)[1]\n \n @total_hours = 0\n @total_minutes = 0\n if !total_duration.nil?\n @total_hours = total_duration / 60\n @total_minutes = total_duration % 60\n end\n\n #total calories\n sql = <<-SQL\n SELECT\n activities.user_id,\n SUM(activities.duration*activity_types.calories_factor) as calories\n FROM activities\n JOIN activity_types ON\n activities.activity_type_id = activity_types.id\n WHERE activities.user_id=#{ActiveRecord::Base.connection.quote(current_user.id)}\n GROUP BY activities.user_id\n SQL\n first = Activity.find_by_sql(sql).first\n @total_calories = first.nil? ? 0 : first.calories\n\n # favorite activity calculated as activity type with longest duration\n favorite = ActivityType.select('activity_types.id, activity_types.name')\n .left_joins(:activities)\n .where(\"activities.user_id=?\", current_user.id)\n .group('activity_types.id')\n .sum('activities.duration')\n\n sql = <<-SQL\n SELECT\n activity_types.id,\n activity_types.name,\n SUM(activities.duration) as duration\n FROM activity_types\n JOIN activities ON\n activities.activity_type_id = activity_types.id\n WHERE activities.user_id=#{ActiveRecord::Base.connection.quote(current_user.id)}\n GROUP BY activity_types.id\n ORDER BY duration DESC\n SQL\n first = ActivityType.find_by_sql(sql).first\n @favorite_activity_type = first.nil? ? \"-\" : first.name\n\n\n\n\n # duration per day for last 30 days\n if Rails.env.production?\n sql = <<-SQL\n SELECT\n date_trunc('day', start) \"start_date\",\n SUM(duration) as duration\n FROM activities\n WHERE user_id=#{ActiveRecord::Base.connection.quote(current_user.id)} \n AND start<=#{ActiveRecord::Base.connection.quote(Time.now)}\n AND start>=#{ActiveRecord::Base.connection.quote(Time.now - 31.days)}\n GROUP BY 1\n SQL\n data = Activity.find_by_sql(sql).map{ |i| {start: i[:start_date].strftime(\"%F\"), duration: i[:duration]} }\n .each_with_object({}) { |k, h| h[k[:start]] = {:duration => k[:duration] } }\n else\n sql = <<-SQL\n SELECT\n SUM(duration) as duration,\n date(start) as start_date\n FROM activities\n WHERE user_id=#{ActiveRecord::Base.connection.quote(current_user.id)}\n AND start<=#{ActiveRecord::Base.connection.quote(Time.now)}\n AND start>=#{ActiveRecord::Base.connection.quote(Time.now - 31.days)}\n GROUP BY date(start)\n SQL\n data = Activity.find_by_sql(sql).index_by { |t| t.start_date }\n end\n\n @minutes_data = {}\n (0..30).each { |i|\n i = 30 - i\n day = (Time.now - i.days).to_date\n count = 0\n if !data[day.strftime(\"%F\")].nil?\n count = data[day.strftime(\"%F\")][:duration]\n end\n @minutes_data[day.strftime(\"%b %d\")] = count\n }\n\n # calories per day for last 30 days\n if Rails.env.production?\n sql = <<-SQL\n SELECT\n date_trunc('day', start) \"start_date\",\n SUM(activities.duration*activity_types.calories_factor) as calories\n FROM activities\n JOIN activity_types ON\n activities.activity_type_id = activity_types.id\n WHERE user_id=#{ActiveRecord::Base.connection.quote(current_user.id)}\n AND start<=#{ActiveRecord::Base.connection.quote(Time.now)}\n AND start>=#{ActiveRecord::Base.connection.quote(Time.now - 31.days)}\n GROUP BY 1\n SQL\n data = Activity.find_by_sql(sql).map{ |i| {start: i[:start_date].strftime(\"%F\"), calories: i[:calories]} }\n .each_with_object({}) { |k, h| h[k[:start]] = {:calories => k[:calories] } }\n else\n sql = <<-SQL\n SELECT\n SUM(activities.duration*activity_types.calories_factor) as calories,\n date(start) as start_date\n FROM activities\n JOIN activity_types ON\n activities.activity_type_id = activity_types.id\n WHERE activities.user_id=#{ActiveRecord::Base.connection.quote(current_user.id)}\n AND start<=#{ActiveRecord::Base.connection.quote(Time.now)}\n AND start>=#{ActiveRecord::Base.connection.quote(Time.now - 31.days)}\n GROUP BY date(activities.start)\n SQL\n data = Activity.find_by_sql(sql).index_by { |t| t.start_date }\n end\n\n @calories_data = {}\n (0..30).each { |i|\n i = 30 - i\n day = (Time.now - i.days).to_date\n count = 0\n if !data[day.strftime(\"%F\")].nil?\n count = data[day.strftime(\"%F\")][:calories]\n end\n @calories_data[day.strftime(\"%b %d\")] = count\n }\n\n end",
"def index\n @name = current_user.name\n\tuser = current_user.id\n\t\n\tgoalInfo = Goal.get_goals(user)\n\t@stepGoal = goalInfo[:step]\n\t@calorieGoal = goalInfo[:calorie]\n\t@distanceGoal = goalInfo[:distance]\n\t\n\ttimeInfo = Goal.get_times(user)\n\t@stepTime = timeInfo[:step]\n\t@calorieTime = timeInfo[:calorie]\n\t@distanceTime = timeInfo[:distance]\n\t\n @goal = Goal.new\n end",
"def create\n @show_sales_overlay = false\n\n\n if current_user and params[:first_name]\n\t current_user.first_name = params[:first_name]\n \n ### having periods in the first name kills the attempts to email that person, so remove periods\n current_user.first_name = current_user.first_name.gsub(\".\", \"\")\n current_user.save\n end \n\n @goal = Goal.new(params[:goal])\n\n if @goal.template_owner_is_a_template\n @goal.status = \"hold\"\n end\n\n\n\n ### remove question marks because:\n ### people keep incorrectly adding their own question marks to the end of their question\n ### which messes up phrasings in the rest of the program and never is needed\n @goal.response_question = @goal.response_question.gsub(\"?\", \"\")\n\n @goal.title = @goal.response_question\n\n if [email protected]_allowed_per_day\n @goal.pushes_allowed_per_day = 1\n end \n\n\n\n\n ################################\n #Status Creation Business Rules\n ################################\n #start (create the goal starting today stopping after goal.days_to_form_a_habit days)\n #monitor (create the goal starting today stopping after goal.days_to_form_a_habit days)\n #hold (just create the goal and a default dummy date of 1/1/1900 for start and stop)\n \n respond_to do |format|\n\n tracker_data_missing_error = false\n if @goal.tracker\n\n\n\n missing = false\n if [email protected]_question or @goal.tracker_question == \"\"\n missing = true\n logger.debug(\"sgj:goals_controller:1\")\n end\n if [email protected]_units or @goal.tracker_units == \"\"\n missing = true\n logger.debug(\"sgj:goals_controller:2\")\n end\n\n\n ### these will never be null b/c they're in forced pulldowns\n ### plus these checks were not working right\n # if [email protected]_type_starts_at_zero_daily\n # missing = true\n # logger.debug(\"sgj:goals_controller:3\")\n # end\n # if [email protected]_target_higher_value_is_better\n # missing = true\n # logger.debug(\"sgj:goals_controller:4\")\n # end\n\n # if [email protected]_standard_deviation_from_last_measurement\n # missing = true\n # logger.debug(\"sgj:goals_controller:5\")\n # end\n # if [email protected]_target_threshold_bad1\n # missing = true\n # logger.debug(\"sgj:goals_controller:6\")\n # end\n # if [email protected]_target_threshold_bad2\n # missing = true\n # logger.debug(\"sgj:goals_controller:7\")\n # end\n # if [email protected]_target_threshold_bad3\n # missing = true\n # logger.debug(\"sgj:goals_controller:8\")\n # end\n # if [email protected]_target_threshold_good1\n # missing = true\n # logger.debug(\"sgj:goals_controller:9\")\n # end\n # if [email protected]_target_threshold_good2\n # missing = true\n # logger.debug(\"sgj:goals_controller:10\")\n # end\n # if [email protected]_target_threshold_good3\n # missing = true\n # logger.debug(\"sgj:goals_controller:11\")\n # end\n\n if missing\n tracker_data_missing_error = true\n @goal.errors.add(:base, \"All 'Tracker' fields are required if the 'Tracker' is enabled.\")\n end ### end if missing\n\n end ### end if @goal.tracker\n\n\n\n if !tracker_data_missing_error and @goal.save\n\n\n pmo = false\n\n if @goal.title.include? \"fapping\"\n pmo = true\n end\n\n if @goal.title.include? \"porn\"\n pmo = true\n end\n\n if @goal.title.include? \"masturb\"\n pmo = true\n end\n if @goal.title.include? \"pmo\"\n pmo = true\n end\n if @goal.title.include? \"jerking off\"\n pmo = true\n end\n if @goal.title.include? \"jerk off\"\n pmo = true\n end\n if @goal.title.include? \"touching myself\"\n pmo = true\n end\n if @goal.title.include? \"touching yourself\"\n pmo = true\n end\n if @goal.title.include? \"XXX\"\n pmo = true\n end\n if @goal.title.include? \"xxx\"\n pmo = true\n end\n\n\n if pmo\n @goal.category = \"PMO\"\n end\n\n if @goal.template_owner_is_a_template\n flash[:notice] = 'Template was successfully created.'\n\n ### if this new template was created to be part of an existing program\n if params[:program_id]\n program = Program.find(params[:program_id])\n\n program_template = ProgramTemplate.new()\n program_template.program_id = program.id\n program_template.template_goal_id = @goal.id\n\n ### you can't do this anymore now that 'next_listing_position' depends on the track\n ### because right now we don't know which track this will be in\n #program_template.listing_position = program.get_next_listing_position\n\n program_template.save\n end\n\n else\n flash[:notice] = 'Goal was successfully created.'\n\n ### show my PMO homies\n if @goal.category == \"PMO\"\n @goal.user.feed_filter_hide_pmo = false\n end\n\n ### if this is my first ever goal, record it in user for marketing\n if [email protected]_first\n @goal.user.category_first = @goal.category\n @goal.user.goal_first = @goal.title\n end\n if [email protected]_goals\n @goal.user.categories_goals = \"\"\n end\n\n if [email protected]\n @goal.category = \"Other\"\n end\n\n if [email protected]\n @goal.title = \"none\"\n end\n @goal.user.categories_goals += @goal.category + \"_:_\" + @goal.title + \"::\"\n\n\n if params[:sign_up_for_lyphted] and params[:sign_up_for_lyphted] == \"1\"\n @goal.user.lyphted_subscribe = @goal.user.dtoday\n\n\n # ####https://labs.aweber.com/snippets/subscribers\n # oauth = AWeber::OAuth.new('Ak1WLosRSScHQL6Z3X3WfV3F', 'utsxWW2PuCrWWGdUpGy1nLlFkXr1Hr2pRL7TomdR')\n\n # auth_url = oauth.request_token.authorize_url\n # logger.info(\"sgj:aweber: \" + auth_url)\n\n ### got all of the accesstoken info by following the account verifications instructions\n ### while using irb (require 'rubygems' and require 'aweber')\n ### based on: https://github.com/aweber/AWeber-API-Ruby-Library\n\n #<OAuth::AccessToken:0xb76fea70 @params={}, @consumer=#<OAuth::Consumer:0xb72e00d8 @http_method=:post, @secret=\"utsxWW2PuCrWWGdUpGy1nLlFkXr1Hr2pRL7TomdR\", @options={:access_token_path=>\"/1.0/oauth/access_token\", :oauth_version=>\"1.0\", :scheme=>:query_string, :signature_method=>\"HMAC-SHA1\", :proxy=>nil, :http_method=>:post, :request_token_path=>\"/1.0/oauth/request_token\", :authorize_path=>\"/1.0/oauth/authorize\", :site=>\"https://auth.aweber.com\"}, @key=\"Ak1WLosRSScHQL6Z3X3WfV3F\", @http=#<Net::HTTP auth.aweber.com:443 open=false>>, @secret=\"DmCMwlQWL4a2NHCrCTGaAu5u5EwaH06P5e4MLcYp\", @token=\"AgeEEz2LxKSd8zNpr602Bfyd\"> \n \n # App Name; HabitForge\n # App ID: 8765b416 \n # Consumer Key: Ak1WLosRSScHQL6Z3X3WfV3F\n # Consumer Secret: utsxWW2PuCrWWGdUpGy1nLlFkXr1Hr2pRL7TomdR\n\n ####https://labs.aweber.com/snippets/subscribers\n oauth = AWeber::OAuth.new('Ak1WLosRSScHQL6Z3X3WfV3F', 'utsxWW2PuCrWWGdUpGy1nLlFkXr1Hr2pRL7TomdR')\n oauth.authorize_with_access('AgeEEz2LxKSd8zNpr602Bfyd', 'DmCMwlQWL4a2NHCrCTGaAu5u5EwaH06P5e4MLcYp')\n aweber = AWeber::Base.new(oauth)\n new_subscriber = {}\n new_subscriber[\"email\"] = @goal.user.email\n new_subscriber[\"name\"] = @goal.user.name\n\n #### again, this one is custom and was not able to figure out how to update it\n # new_subscriber[\"YOB\"] = \"1976\"\n\n\n ##### was not able to get the updating of these custom fields to work after several different method tries\n ##### but that's OK we're now just using the built-in \"misc_notes\" \n # new_subscriber[\"custom_fields\"][\"first_category\"] = \"exercise\"\n # new_subscriber[\"custom_fields\"][\"first_goal\"] = \"run for 20 minutes\"\n # new_subscriber[\"custom_fields\"][\"categories_goals\"] = \"exercise:.:run for 20 minutes;\"\n\n begin\n new_subscriber[\"misc_notes\"] = \"first_category=\" + @goal.user.category_first\n rescue\n logger.error(\"sgj:could not add subscriber misc_note to aweber\")\n end\n\n # new_subscriber[\"misc_notes\"] = \"first_category=\" + @goal.user.category_first + \";first_goal='\" + @goal.user.goal_first + \"'\"\n\n ## The Lyphted list_id is = 3702705\n ## The Lyphted list_name is = awlist3702705\n list = aweber.account.lists.find_by_id(3702705)\n\n begin\n list.subscribers.create(new_subscriber)\n rescue\n logger.error(\"sgj:could not add subscriber to aweber (perhaps they have a role-based email address like admin@something\")\n ###https://help.aweber.com/entries/97662366\n end\n\n # aweber.account.lists.each do |list|\n # logger.info(\"sgj:aweber:\" + list.name)\n # end\n # logger.info(\"sgj:aweber:\" + aweber.account.lists.to_s)\n # logger.info(\"sgj:aweber:\" + aweber.account.lists[0].name.to_s)\n #aweber.account.lists.find_by_id(3702705).subscribers.create(new_subscriber)\n\n\n end\n\n\n\n ### update last activity date\n @goal.user.last_activity_date = @goal.user.dtoday\n @goal.user.deletion_warning = nil\n @goal.user.save\n \n ###############################################\n ###### START IF SFM_VIRGIN\n if session[:sfm_virgin] and session[:sfm_virgin] == true\n session[:sfm_virgin] = false\n @show_sales_overlay = true\n\n @user = current_user\n\n ### existing_user will be true if coming from an infusionsoft email invite\n ### in that case, do not send them another welcome email\n if !session[:existing_user]\n #### now that we have their first name, we can send the email \n the_subject = \"Confirm your HabitForge Subscription\"\n begin\n #if Rails.env.production?\n logger.error(\"sgj:goals_controller:about to send user confirmation to user \" + @user.email)\n Notifier.deliver_user_confirm(@user, the_subject) # sends the email\n #end\n rescue\n logger.error(\"sgj:email confirmation for user creation did not send\")\n end\n end\n\n\n # begin\n # #####################################################\n # #####################################################\n # #### UPDATE THE CONTACT FOR THEM IN INFUSIONSOFT ######\n # ### SANDBOX GROUP/TAG IDS\n # #112: hf new signup funnel v2 free no goal yet\n # #120: hf new signup funnel v2 free created goal\n # #\n # ### PRODUCTION GROUP/TAG IDS\n # #400: hf new signup funnel v2 free no goal yet\n # #398: hf new signup funnel v2 free created goal\n # if Rails.env.production?\n # Infusionsoft.contact_update(session[:infusionsoft_contact_id].to_i, {:FirstName => current_user.first_name, :LastName => current_user.last_name})\n # Infusionsoft.contact_add_to_group(session[:infusionsoft_contact_id].to_i, 398)\n # Infusionsoft.contact_remove_from_group(session[:infusionsoft_contact_id].to_i, 400)\n # end\n # #### END INFUSIONSOFT CONTACT ####\n # #####################################################\n # #####################################################\n # rescue\n # logger.error(\"sgj:error updating contact in infusionsoft\")\n # end\n end ### END IF SFM_VIRGIN\n ###### END IF SFM_VIRGIN\n ###############################################\n\n\n current_user.goal_temp = \"\"\n current_user.save\n end ### end if goal != a template\n\n \n if @goal.usersendhour == nil\n\t @goal.usersendhour = 20 ### 8pm\n end\n\n Time.zone = @goal.user.time_zone\n utcoffset = Time.zone.formatted_offset(false)\n offset_seconds = Time.zone.now.gmt_offset \n send_time = Time.utc(2000, \"jan\", 1, @goal.usersendhour, 0, 0) #2000-01-01 01:00:00 UTC\n central_time_offset = 21600 #add this in since we're doing UTC\n server_time = send_time - offset_seconds - central_time_offset\n puts \"User lives in #{@goal.user.time_zone} timezone, UTC offset of #{utcoffset} (#{offset_seconds} seconds).\" #Save this value in each goal, and use that to do checkpoint searches w/ cronjob\n puts \"For them to get an email at #{send_time.strftime('%k')} their time, the server would have to send it at #{server_time.strftime('%k')} Central time\"\n @goal.serversendhour = server_time.strftime('%k')\n @goal.gmtoffset = utcoffset \n #############\n \n \n\n if @goal.daym == nil \n @goal.daym = true\n end\n if @goal.dayt == nil \n @goal.dayt = true\n end\n if @goal.dayw == nil \n @goal.dayw = true\n end\n if @goal.dayr == nil \n @goal.dayr = true\n end\n if @goal.dayf == nil \n @goal.dayf = true\n end\n if @goal.days == nil \n @goal.days = true\n end\n if @goal.dayn == nil \n @goal.dayn = true\n end\n\n if [email protected]_owner_is_a_template\n if @goal.status != \"hold\" and @goal.daym and @goal.dayt and @goal.dayw and @goal.dayr and @goal.dayf and @goal.days and @goal.dayn and (@goal.goal_days_per_week == nil or @goal.goal_days_per_week == 7)\n @goal.status = \"start\"\n else\n @goal.status = \"monitor\"\n end\n end\n\n\n #########\n ### Once the goal is saved, set the start and stop dates\n\n \n dnow = get_dnow\n\n if @goal.status == \"hold\"\n @goal.start = Date.new(1900, 1, 1)\n @goal.stop = @goal.start \n end\n @goal.established_on = Date.new(1900, 1, 1)\n if (@goal.status == \"start\" or @goal.status == \"monitor\")\n start_day_offset = 1\n if params[:delay_start_for_this_many_days] \n start_day_offset = params[:delay_start_for_this_many_days].to_i\n end\n ### Set the standard dates\n @goal.start = dnow + start_day_offset\n @goal.stop = @goal.start + @goal.days_to_form_a_habit\n \t @goal.first_start_date = @goal.start \n @goal.save\n end\n\n ### save date changes\n @goal.save\n\n\n ####################################################################\n ####################################################################\n ##### ACCEPT AN INVITE\n ####################################################################\n ### if we are responding to an invitation to join a team\n if params[:invitation_id]\n begin\n attempt_to_join_team = false\n\n invite = Invite.find(params[:invitation_id].to_i)\n if invite and invite.purpose_join_team_id\n\n team = Team.find(invite.purpose_join_team_id)\n if team\n\n ### what kind of team?\n if team.goal_template_parent_id\n\n ### template based team\n if @goal.template_user_parent_goal_id and (@goal.template_user_parent_goal_id == team.goal_template_parent_id)\n attempt_to_join_team = true\n end\n\n else\n\n ### category-based team\n if team.category_name and @goal.category and (team.category_name == @goal.category)\n attempt_to_join_team = true\n end\n\n end\n\n if attempt_to_join_team\n if @goal.join_goal_to_a_team(team.id)\n logger.info(\"sgj:goals_controller.rb:success adding goal to team when responding to invitation\")\n\n\n ### we actually want to delete the invite, not save it\n ### that way if the new team member removes their goal and then\n ### changes their mind later, we can send them another invite\n #invite.accepted_on = current_user.dtoday\n #invite.save\n invite.destroy\n\n\n #### SEND INVITE ACCEPTANCE TO OWNER\n begin\n if Notifier.deliver_to_team_owner_invite_accepted(@goal, team.owner) # sends the email \n logger.info(\"sgj:goals_controller.rb:create:SUCCESS SENDING INVITE ACCEPTANCE EMAIL\") \n else\n logger.error(\"sgj:goals_controller.rb:create:FAILURE SENDING INVITE ACCEPTANCE EMAIL:goal_id = \" + @goal.id.to_s)\n end\n rescue\n logger.error(\"sgj:goals_controller.rb:create:(rescue)FAILURE SENDING INVITE ACCEPTANCE EMAIL:goal_id = \" + @goal.id.to_s)\n end\n #### END SEND INVITE ACCEPTANCE TO OWNER\n\n\n else\n logger.error(\"sgj:goals_controller.rb:failed to add goal to team when responding to invitation\")\n end\n else\n logger.error(\"sgj:goals_controller.rb:the team invite was a mis-match for either this goal category or this goal parent template .. not trying to join team\") \n end\n\n end ### if team\n\n end ### if invite and invite.purpose_join_team_id\n\n rescue\n logger.error(\"sgj:goals_controller.rb:error trying to add goal to team when responding to invitation\")\n end\n\n end ### if session[:accepting_invitation_id]\n ####################################################################\n ##### END ACCEPT AN INVITE\n ####################################################################\n ####################################################################\n\n\n\n ####################################################################\n ####################################################################\n ##### PROGRAM ENROLLMENT\n ####################################################################\n\n ### create a program enrollment record if a program is involved\n ### goal and program are linked via goal.goal_added_through_template_from_program_id\n if @goal.program\n\n ### check to see if an enrollment exists... if not, create one\n enrollment = ProgramEnrollment.find(:first, :conditions => \"program_id = '#{@goal.program.id}' and user_id = '#{@goal.user.id}'\")\n if !enrollment\n enrollment = ProgramEnrollment.new()\n # t.integer \"program_id\"\n # t.integer \"user_id\"\n # t.boolean \"active\"\n # t.boolean \"ongoing\"\n # t.integer \"program_session_id\"\n # t.date \"personal_start_date\"\n # t.date \"personal_end_date\"\n enrollment.program_id = @goal.program.id\n enrollment.user_id = @goal.user.id\n enrollment.active = true\n enrollment.ongoing = true\n\n enrollment.save\n\n end ### end if !enrollment\n end ### end if @goal.program\n\n ####################################################################\n ##### END PROGRAM ENROLLMENT\n ####################################################################\n ####################################################################\n\n\n\n ### we don't need/want these anymore\n ### destroy them so that they don't mess up a future new goal\n session[:goal_added_through_template_from_program_id] = nil\n session[:template_user_parent_goal_id] = nil\n session[:goal_template_text] = nil\n session[:category] = nil\n session[:accepting_invitation_id] = nil\n\n \n if @goal.status == \"hold\"\n ### don't send an email if it's on hold\n else\n begin \n if session[:sponsor] == \"clearworth\"\n #Notifier.deliver_goal_creation_notification_clearworth(@goal) # sends the email\n elsif session[:sponsor] == \"forittobe\"\n #Notifier.deliver_goal_creation_notification_forittobe(@goal) # sends the email\n elsif session[:sponsor] == \"marriagereminders\"\n #Notifier.deliver_goal_creation_notification_marriagereminders(@goal) # sends the email\n else\n #Notifier.deliver_goal_creation_notification(@goal) # sends the email\n end\n rescue\n puts \"Error while sending goal notification email from Goal.create action.\"\n end\n end\n\n\n\n ### if this new template was created to be part of an existing program\n if params[:program_id] or params[:return_to_program_view]\n if params[:return_to_program_view]\n format.html {redirect_to(\"/programs/#{params[:return_to_program_view]}/view\")}\n else\n\n ### if the program is a \"structured program\" you're going to want to go directly to edit mode\n p = Program.find(params[:program_id].to_i)\n if p and p.structured\n\n pt = ProgramTemplate.find(:first, :conditions => \"program_id = '#{p.id}' and template_goal_id = '#{@goal.id}'\")\n format.html {redirect_to(\"/program_templates/#{pt.id.to_s}/edit\")}\n\n else\n format.html {redirect_to(\"/programs/#{params[:program_id]}#action_items\")}\n end\n\n\n end\n\n else\n\n begin \n ### attempt to add to encourage_items\n\n\n # when a goal is created,\n # if username != unknown,\n # if the goal is public,\n # then enter it into encourage_items\n\n # --- encourage_item ---\n # encourage_type_new_checkpoint_bool (index)\n # encourage_type_new_goal_bool (index)\n # checkpoint_id\n # checkpoint_status\n # checkpoint_date (index)\n # checkpoint_updated_at_datetime\n # goal_id (index)\n # goal_name\n # goal_category\n # goal_created_at_datetime\n # goal_publish\n # goal_first_start_date (index)\n # goal_daysstraight\n # goal_days_into_it\n # goal_success_rate_percentage\n # user_id (index)\n # user_name\n # user_email\n\n logger.debug \"sgj:goals_controller.rb:consider adding to encourage_items\"\n if @goal.user.first_name != \"unknown\"\n if @goal.is_public\n logger.debug \"sgj:goals_controller.rb:candidate for encourage_items\"\n\n encourage_item = EncourageItem.new\n logger.debug \"sgj:goals_controller.rb:new encourage_items instantiated\"\n\n encourage_item.encourage_type_new_checkpoint_bool = false\n encourage_item.encourage_type_new_goal_bool = true\n\n #encourage_item.checkpoint_id = nil\n encourage_item.checkpoint_id = @goal.id ### a workaround to the validation that checkpoint_id is unique\n\n encourage_item.checkpoint_status = nil\n encourage_item.checkpoint_date = nil\n encourage_item.checkpoint_updated_at_datetime = nil\n encourage_item.goal_id = @goal.id\n encourage_item.goal_name = @goal.title\n encourage_item.goal_category = @goal.category\n encourage_item.goal_created_at_datetime = @goal.created_at\n encourage_item.goal_publish = @goal.publish\n encourage_item.goal_first_start_date = @goal.first_start_date\n encourage_item.goal_daysstraight = @goal.daysstraight\n encourage_item.goal_days_into_it = @goal.days_into_it\n encourage_item.goal_success_rate_percentage = @goal.success_rate_percentage\n encourage_item.user_id = @goal.user.id\n encourage_item.user_name = @goal.user.first_name\n encourage_item.user_email = @goal.user.email\n\n logger.debug \"sgj:goals_controller.rb:about to save encourage_items\"\n\n if encourage_item.save\n logger.info(\"sgj:goals_controller.rb:success saving encourage_item\")\n else\n logger.error(\"sgj:goals_controller.rb:error saving encourage_item\")\n end\n logger.debug \"sgj:goals_controller.rb:new encourage_item.id = \" + encourage_item.id.to_s\n\n end\n end\n\n rescue\n logger.error \"sgj:error adding to encourage_items\"\n end\n\n\n if @show_sales_overlay\n ### format.html { render :action => \"edit\" }\n\n if Rails.env.production?\n\n ### show the sales page and eventually kick back to optimize when they cancel\n #format.html {redirect_to(\"https://www.securepublications.com/habit-gse3.php?ref=#{current_user.id.to_s}&email=#{current_user.email}\")}\n\n ### do not show the sales page first, just kick to optimize\n format.html {redirect_to(\"/goals?optimize_my_first_goal=1&email=#{current_user.email}&single_login=1\")}\n\n else\n session[:dev_mode_just_returned_from_sales_page] = true\n format.html {redirect_to(\"/goals?optimize_my_first_goal=1&email=#{current_user.email}&single_login=1\")}\n end\n\n format.xml { render :xml => @goals }\n else\n\n\n ##### SUCCESSFULLY SAVED A NEW GOAL ... REDIRECT TO ???\n\n # if session[:sfm_virgin]\n # format.html { redirect_to(\"/goals/#{@goal.id}/edit?just_created_new_habit=1&just_created_first_habit=1\")}\n # else \n # format.html { redirect_to(\"/goals/#{@goal.id}/edit?just_created_new_habit=1\")}\n # end\n\n\n # if !current_user.is_habitforge_supporting_member\n # format.html {redirect_to(\"/goals?too_many_active_habits=1&just_created_new_habit=1\")} \n # else\n # format.html { render :action => \"index\" } # index.html.erb\n # end\n \n # if !current_user.is_habitforge_supporting_member\n # format.html { redirect_to(\"https://habitforge.com/widget/upgrade\")}\n # else\n format.html { redirect_to(\"/goals/#{@goal.id}/edit?just_created_new_habit=1\")}\n # end\n\n\n\n format.xml { render :xml => @goals }\n end\n\n end \n\n\n\n \n\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @goal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def missions_run_default\r\n {\r\n goal_date: 1.month.from_now,\r\n is_enabled: true,\r\n is_complete: false,\r\n goal_amount: rand_goal_amount,\r\n charity: Charity.find_by_name(\"Bearing Precious Seed\"),\r\n groupgrant_category: GroupgrantCategory.find_by_name(\"Missions\"),\r\n partner_id: 0\r\n }\r\nend",
"def actions\n @actions = []\n price = compute_price('level2')\n commission = (price * 0.3).to_i\n insurance_fee = (commission / 2).to_i\n assistance_fee = duration * 100\n owner_fee = price - (price * 0.3).to_i\n drivy_fee = commission - insurance_fee - assistance_fee\n @options.each do |option|\n case option.type\n when 'gps'\n price += option_price_per_day('gps') * duration * 100\n owner_fee += option_price_per_day('gps') * duration * 100\n when 'baby_seat'\n price += option_price_per_day('baby_seat') * duration * 100\n owner_fee += option_price_per_day('baby_seat') * duration * 100\n when 'additional_insurance'\n price += option_price_per_day('additional_insurance') * duration * 100\n drivy_fee += option_price_per_day('additional_insurance') * duration * 100\n end\n end\n if price != 0\n @actions << Action.new(who: 'driver', type: 'debit', amount: price)\n @actions << Action.new(who: 'owner', type: 'credit', amount: owner_fee)\n @actions << Action.new(who: 'insurance', type: 'credit', amount: insurance_fee)\n @actions << Action.new(who: 'assistance', type: 'credit', amount: assistance_fee)\n @actions << Action.new(who: 'drivy', type: 'credit', amount: drivy_fee)\n end\n @actions.collect { |action| action.convert_to_hash }\n end",
"def strategy\n temp = {}\n #format temp[L1:L2:L3] = index\n current_user.reports.each do |report|\n l1 = (report.l1_attended.to_f/(report.l1_total.to_f.nonzero? || 1 ))*100\n l2 = (report.l2_attended.to_f/(report.l2_total.to_f.nonzero? || 1 ))*100\n l3 = (report.l3_attended.to_f/(report.l3_total.to_f.nonzero? || 1 ))*100\n temp[\"#{l1}:#{l2}:#{l3}\"] = (report.l1_attended.to_f/report.l1_total.to_f)*100 + (report.l2_attended.to_f/report.l2_total.to_f)*10 + (report.l3_attended.to_f/report.l3_total.to_f)\n end\n best = temp.max[0]\n @personal_best = \"L1 : \" + best.split(\":\")[0].to_s + \"% \" + \"L2 : \" + best.split(\":\")[1].to_s + \"% \" + \"L3 : \" + best.split(\":\")[2].to_s + \"% \"\n learning_curve_strategy\n data_presenter_new 'attended'\n end",
"def calc_calories!\n gender = user.sex\n age = ( (Date.today - user.birthdate).to_i / 365.25).floor\n\n # FORMULA WITHOUT V02 MAX \n # if gender && age && user.weight(self.start_time) && duration && hr\n # if gender == \"male\" \n # cal = (-55.0969 + (hr * 0.6309) + (user.weight(self.start_time) * 0.1988) + (age * 0.2017) ) / 4.184\n # totalcal = (cal * duration/60).to_i\n # return totalcal\n # elsif gender == \"female\"\n # cal = ( -20.4022 + (hr * 0.4472) + (user.weight(self.start_time) * 0.1263) + (age * 0.074) ) / 4.184\n # totalcal = (cal * duration/60).to_i\n # return totalcal\n # end\n\n # FORMULA WITH V02 MAX\n if gender && age && user.weight(self.start_time) && duration && hr && hr > 0\n if gender == \"male\" \n cal = ( -59.3954 - 36.3781 + (hr * 0.634) + (user.weight(self.start_time) * 0.394) + (age * 0.271) + (user.vo2(start_time) * 0.404) ) / 4.184\n totalcal = (cal * duration/60).to_i\n self.update_attributes(:calories => totalcal)\n elsif gender == \"female\"\n cal = ( -59.3954 + (hr * 0.450) + (user.weight(self.start_time) * 0.103) + (age * 0.274) + (user.vo2(start_time) * 0.380) ) / 4.184\n totalcal = (cal * duration/60).to_i\n self.update_attributes(:calories => totalcal)\n end\n else\n self.update_attributes(:calories => nil)\n end\n end",
"def getallpendinggoals\n\n\t\tif(params[:timespan] == \"All\")\n\n\t#\t@usersallpendinggoals = Goal.where(:userid => current_user.id).where.not(:status => \"Done\").select([:id, :goal, :status, :remarks, :created_at])\n\n\t\t@usersallpendinggoals = Goal.where(\"userid = :userid and Date(DoToday) != :todaydate\", { userid: current_user.id, todaydate: Date.today }).where.not(:status => \"Done\").select([:id, :goal, :status, :remarks, :created_at])\n\n\t\trender :layout => false\n\n\n\t\telse if(params[:timespan] == \"Yesterday\")\n\n\t\t@usersallpendinggoals = Goal.where(\"userid = :userid and Date(created_at) = :date and Date(DoToday) != :todaydate\", { userid: current_user.id, date: Date.today - 1.day, todaydate: Date.today }).where.not(:status => \"Done\").select([:id, :goal, :status, :remarks, :created_at])\n\n\t\trender :layout => false\n\n\t\telse if(params[:timespan] == \"Last week\")\n\n\t\t@usersallpendinggoals = Goal.where(\"userid = :userid and Date(DoToday) != :todaydate and Date(created_at) BETWEEN :fromdate AND :todate\", { userid: current_user.id, todaydate: Date.today, fromdate: Date.today - 7.days, todate: Date.today - 1.day}).where.not(:status => \"Done\").select([:id, :goal, :status, :remarks, :created_at])\n\n\t\trender :layout => false\n\n\t\telse if(params[:timespan] == \"Last One Month\")\n\n\t\t@usersallpendinggoals = Goal.where(\"userid = :userid and Date(DoToday) != :todaydate and Date(created_at) BETWEEN :fromdate AND :todate\", { userid: current_user.id, todaydate: Date.today, fromdate: Date.today - 1.month, todate: Date.today - 1.day}).where.not(:status => \"Done\").select([:id, :goal, :status, :remarks, :created_at])\n\n\t\trender :layout => false\n\n\t\telse if(params[:timespan] == \"Last Three Months\")\n\n\t\t@usersallpendinggoals = Goal.where(\"userid = :userid and Date(DoToday) != :todaydate and Date(created_at) BETWEEN :fromdate AND :todate\", { userid: current_user.id, todaydate: Date.today, fromdate: Date.today - 3.months, todate: Date.today - 1.day}).where.not(:status => \"Done\").select([:id, :goal, :status, :remarks, :created_at])\n\n\t\trender :layout => false\n\n\t\telse if(params[:timespan] == \"Last Six Months\")\n\n\t\t@usersallpendinggoals = Goal.where(\"userid = :userid and Date(DoToday) != :todaydate and Date(created_at) BETWEEN :fromdate AND :todate\", { userid: current_user.id, todaydate: Date.today, fromdate: Date.today - 6.months, todate: Date.today - 1.day}).where.not(:status => \"Done\").select([:id, :goal, :status, :remarks, :created_at])\n\n\t\trender :layout => false\n\n\t\tend\n\n\t\tend\n\n\t\tend\n\n\t\tend\n\n\t\tend\n\n\t\tend\n\n\t#\trespond_to do |format|\n\t# \tformat.html\n\t# \tformat.json {render :json => @usersallpendinggoals}\n\t#\tend\n\n\t#\tredirect_to action: 'main', :id => current_user.id\n\n \tend",
"def compute_actual\n line[1] = @ho_form.line['sqft']\n line[2] = @ho_form.line['total_sqft']\n line[3] = (line[1] * 100.0 / line[2]).round(2)\n\n line['4/gross_inc'] = gross_income\n\n # We make a simplifying assumption that (1) every Home Office Expense\n # applies to every Home Office form, and (2) all expenses are indirect.\n categorize_records('Home Office Expense')\n #\n # We assume that the home office using the actual method is being rented and\n # thus there are no mortgage payments or such on it.\n #\n #fill_for_categories(self, '5b', 'Casualty_Losses')\n #fill_for_categories(self, '6b', 'Mortgage_Interest')\n #fill_for_categories(self, '7b', 'Real_Estate_Taxes')\n\n line['8b'] = sum_lines('5b', '6b', '7b')\n line[9] = (line['8b'] * line[3] / 100.0).round\n line[10] = line[9]\n\n line[11] = other_business_expenses\n\n line[12] = sum_lines(10, 11)\n line['13/ho_max_ded'] = line[4] - line[12]\n\n fill_for_categories(self, '16b', 'Insurance')\n fill_for_categories(self, '17b', 'Rent')\n fill_for_categories(self, '18b', 'Repairs')\n fill_for_categories(self, '19b', 'Utilities')\n fill_other_categories(\n self, '20b', continuation: 'Other Home Office Expenses'\n )\n line['21b'] = sum_lines(*%w(14b 15b 16b 17b 18b 19b 20b))\n line[22] = (line['21b'] * line[3] / 100.0).round\n\n # Assume no carryover for line 23\n line['24/ho_ded'] = sum_lines('21a', 22, 23)\n line[25] = [ line[13], line[24] ].min\n line[26] = line[13] - line[25]\n\n # Assume no casualty losses or depreciation for lines 27-29 and 33\n line[30] = sum_lines(27, 28, 29)\n line[31] = [ line[26], line[30] ].min\n line[32] = sum_lines(10, 25, 31)\n\n line[33] = BlankZero\n line['34/ho_expenses'] = line[32] - line[33]\n\n end",
"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: \"[email protected], [email protected], [email protected]\", 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 actions\n result = []\n\n ACTORS.each do |actor|\n case actor\n when 'driver'\n amount = price\n if @features.include? \"gps\"\n amount += days * FEATURE_TYPES['gps']\n end\n if @features.include? \"baby_seat\"\n amount += days * FEATURE_TYPES['baby_seat']\n end\n if @features.include? \"additional_insurance\"\n amount += days * FEATURE_TYPES['additional_insurance']\n end\n\n when 'owner'\n amount = price - @commission.total\n if @features.include? \"gps\"\n amount += days * FEATURE_TYPES['gps']\n end\n if @features.include? \"baby_seat\"\n amount += days * FEATURE_TYPES['baby_seat']\n end\n\n when 'insurance'\n amount = @commission.insurance_fee.to_i\n\n when 'assistance'\n amount = @commission.assistance_fee.to_i\n\n else # \"drivy\"\n amount = @commission.drivy_fee.to_i\n if @features.include? \"additional_insurance\"\n amount += days * FEATURE_TYPES['additional_insurance']\n end\n\n end\n\n result << {\n who: actor,\n type: (actor == \"driver\") ? \"debit\" : \"credit\",\n amount: amount.to_i\n }\n end\n result\n end",
"def update\n @goal = @user.goals.find(params[:id])\n \n if params[:activity]\n if params[:untrack]\n @goal.untrack_activity(params[:activity][:id])\n else\n @goal.track_activity(params[:activity][:id])\n end\n end\n \n if params[:goal_amount] == \"score\"\n if @goal.goal_amount_score.blank?\n @goal.errors[:goal_amount_score] << \"should be set.\"\n end\n \n if [email protected]_amount_duration.blank?\n @goal.goal_amount_duration = \"\"\n end\n end\n \n if params[:goal_amount] == \"duration\"\n if @goal.goal_amount_duration.blank?\n @goal.errors[:goal_amount_duration] << \"should be set.\"\n end\n \n if [email protected]_amount_score.blank?\n @goal.goal_amount_score = \"\"\n end\n end\n \n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to [@user, @goal], notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def goals(player_id)\n Stat.where(player_id: player_id).sum(:goals)\n end",
"def weekly_goals\n get(\"/user/#{@user_id}/activities/goals/weekly.json\")\n end",
"def score\n total = 0\n achievements.each do |a|\n total += a.task.score\n end\n total\n end",
"def index\n @gpa = GpaCalculator.new(current_user)\n\n start_date = Date.today.beginning_of_week\n @goals = Goal.where(user_id: current_user.id).to_a\n @week_goals = Goal.where(user_id: current_user.id).where(starts_at: start_date..start_date+6.days).order('starts_at ASC').to_a\n\n @misc_tasks = MiscTask.where(user_id: current_user.id).where(disabled: false).to_a\n @task_categories = get_categories\n\n @tasks = @misc_tasks + @week_goals\n end",
"def create_goal(p_name, p_matchAttribute, p_pattern, p_patternType, metrics_site_id)\n set_param(:idSite, metrics_site_id)\n set_param(:method, 'Goals.addGoal')\n set_param(:name, p_name)\n set_param(:matchAttribute, p_matchAttribute)\n set_param(:pattern, p_pattern)\n set_param(:patternType, p_patternType)\n url_string = @metrics_admin_url + @metrics_params.slice(:module, :method, :idSite, :name, :matchAttribute,\n :pattern, :patternType, :token_auth).to_query\n response_string = api_call(url_string)\n metrics_goal_id = response_string.xpath('//result/text()').map(&:text)[0]\n metrics_goal_id.to_i\n end",
"def calculate_meals\n \n t1 = self.starts_on.to_time.to_i\n t2 = self.ends_on.to_time.to_i\n\n seconds = t2-t1\n days = seconds / 86400\n\n self.meals = days * 3\n\n end",
"def change_goals\n User.find_by(id: session[:user_id])\n @client = current_user.fitbit\n\[email protected]_or_update_daily_goal(@opts)\n\trender 'goals'\n end",
"def the_goal\n UserGroup::PAYMENT_GOALS[goal.to_sym] if goal\n end",
"def index\n @reached_goal_floats = ReachedGoalFloat.all\n end",
"def gameflow\n \n end",
"def sleep_goals\n get_json(path_user_version('/sleep/goal'))\n end",
"def step_one_points\n\t\tpoints = 0\n\t\tpoints+=50 if !link.blank?\n\t\tpoints+=25 if !title.blank?\n\t\tpoints+=25 if !company.blank?\n\t\tpoints\n\tend",
"def math_goals(this_term = nil)\r\n this_term = term if !this_term\r\n if term_open?(this_term) || term_closed?(this_term)\r\n return k6_progress.field_bystudentid(\"math_goals\", student_id, this_term)\r\n else\r\n return false\r\n end\r\n end",
"def index\n @goals = current_user.goals\n occs = current_user.occurrences.includes(habit: :goal)\n .where('scheduled_at >= ?', DateTime.now.beginning_of_week(start_day=:monday))\n .where('scheduled_at <= ?', DateTime.now.end_of_week).order(:scheduled_at)\n\n # group by weekday\n @schedule = occs.group_by { |occ| occ.scheduled_at.strftime('%A').downcase.to_sym }\n\n # calculate streaks\n occs = current_user.occurrences.includes(:habit).where('scheduled_at <= ?', DateTime.now).order(:scheduled_at).limit(100)\n @streaks = occs.group_by{ |occ| occ.habit.goal_id }\n\n # get all metrics\n configs = current_user.experience_sample_configs\n\n # get this weeks metrics\n current_week_metrics = current_user.samplings.includes(:experience_sample_config)\n .where('scheduled_at >= ?', DateTime.now.beginning_of_week(start_day=:monday))\n .where('scheduled_at <= ?', DateTime.now.end_of_week)\n .group(:experience_sample_config_id).average(:value)\n\n # get last weeks metrics\n last_week_metrics = current_user.samplings.includes(:experience_sample_config)\n .where('scheduled_at >= ?', DateTime.now.beginning_of_week(start_day=:monday) - 7.days)\n .where('scheduled_at <= ?', DateTime.now.end_of_week - 7.days)\n .group(:experience_sample_config_id).average(:value)\n\n @metrics = configs.map { |config| {\n config: config,\n current_week: current_week_metrics[config.id]&.round(2),\n last_week: last_week_metrics[config.id]&.round(2),\n difference: percentage_difference(current_week_metrics[config.id], last_week_metrics[config.id])\n }}\n end",
"def calculate_eta(live_steps_qry_result, hours_per_workday,workflow,current_user,currentWorkflowLiveStepConfirm)\n\t live_steps_qry_result.each do |lsr|\n\t \twls = WorkflowLiveStep.find_by_id(lsr[\"id\"])\n\t \tif wls.object.present? and !wls.is_manual\n\t\t \tif wls.object_type == 'L3'\n\t\t \t\tif wls.object.is_closed?\n\t\t \t\telse\n\t\t \t\t\tdo_calculate_eta(wls, hours_per_workday,workflow,current_user,currentWorkflowLiveStepConfirm)\n\t\t \t\tend\n\t\t \telse\n\t \t\t\tdo_calculate_eta(wls, hours_per_workday,workflow,current_user,currentWorkflowLiveStepConfirm)\n\t\t \tend\t\n\t\t elsif wls.is_manual and !wls.actual_confirmation.present?\n\t \t\tdo_calculate_manual_eta(wls, hours_per_workday,workflow,current_user,currentWorkflowLiveStepConfirm)\n\t\t end \t\n\t end\n \tend",
"def suggest_weekly_xp_target\n todo_xp = self.goals.where(\"recurrence_id = ? AND completed = ?\", 1, false).sum(:xp_value)\n ongo_goals = self.goals.where(\"recurrence_id = ?\", 2)\n ongo_sum = 0\n ongo_goals.each do |goal|\n ongo_sum += (goal.xp_value * goal.frequency)\n end\n return (todo_xp + ongo_sum)\n end",
"def calculate_goal_value_for(assessment_indicator:)\n return 0 if assessment.clean_slate?\n\n score = score_value_for(assessment_indicator: assessment_indicator)\n return score <= 3 ? 4 : 5 if is_5_year?\n return score if score == 5\n return score + 1\n end",
"def z_score_all_goals(alternative) \n goals = alternative.goals + [nil]\n control = alternative.experiment.control\n\n return 'N/A' if control.name == alternative.name\n\n p_a = goals.inject(0) { |sum, g| sum + alternative.conversion_rate(g) }\n p_c = goals.inject(0) { |sum, g| sum + control.conversion_rate(g) }\n\n n_a = alternative.participant_count\n n_c = control.participant_count\n\n z_score = Split::Zscore.calculate(p_a, n_a, p_c, n_c)\n end",
"def calculation(duration, loan, apr)\n loan * (apr / (1 - (1 + apr)**(-duration)))\nend",
"def plan_next_step(used_strategy)\n options = {}\n case used_strategy\n when :agressive\n\n # attack a company if success rate is high enough\n attackable_companies = Company.all.delete_if { |c| chance_of_success_against(c, :hack) < 50.0 }\n if attackable_companies.present?\n company_with_highest_success_rate = attackable_companies.sort_by! { |c| chance_of_success_against(c, :hack) }.first\n options = {\n user_id: id,\n target_id: company_with_highest_success_rate.id,\n target_type: \"Company\",\n type_id: Action::TYPE_ATTACK_COMPANY,\n completed_at: time_to_attack(company_with_highest_success_rate, :hack)\n }\n\n # counter-attack last attacker (if his attack is still unavenged)\n elsif successful_attacks_in_last_24_hours > 0 && !counterattack_successful?\n last_attacker = Action.where([\"type_id = ? OR type_id = ?\", Action::TYPE_ATTACK_USER, Action::TYPE_ATTACK_USER_DDOS]).where(target_id: id, target_type: \"User\", completed: true, success: true).where(\"completed_at >= ?\", DateTime.now-24.hours).order(\"completed_at DESC\").first.try(:user)\n if last_attacker.present? && \n (can_attack?(last_attacker, :hack) || can_attack?(last_attacker, :ddos)) && \n (chance_of_success_against(last_attacker, :hack) >= 50.0 || chance_of_success_against(last_attacker, :ddos) >= 50.0)\n\n # determine attack type based on success rate and possible reward\n options = {\n user_id: id,\n target_id: last_attacker.id,\n target_type: \"User\"\n }\n\n # assume that last attacker is rich if he controls a company\n if last_attacker.companies.present?\n options[:type_id] = Action::TYPE_ATTACK_USER\n options[:completed_at] = DateTime.now + time_to_attack(last_attacker, :hack).seconds\n\n elsif chance_of_success_against(last_attacker, :hack) > chance_of_success_against(last_attacker, :ddos)\n options[:type_id] = Action::TYPE_ATTACK_USER\n options[:completed_at] = DateTime.now + time_to_attack(last_attacker, :hack).seconds\n\n elsif chance_of_success_against(last_attacker, :hack) <= chance_of_success_against(last_attacker, :ddos)\n options[:type_id] = Action::TYPE_ATTACK_USER_DDOS\n options[:completed_at] = DateTime.now + time_to_attack(last_attacker, :ddos).seconds\n end\n\n # buy or evolve attack skills\n else\n options = buy_or_evolve_attack\n end\n else\n options = buy_or_evolve_attack\n end\n when :defensive\n options = buy_or_evolve_defense\n\n when :moderate\n options = if (hacking_ratio <= botnet_ratio && hacking_ratio <= defense_ratio) ||\n (botnet_ratio <= hacking_ratio && botnet_ratio <= defense_ratio)\n buy_or_evolve_attack\n elsif defense_ratio <= botnet_ratio && defense_ratio <= hacking_ratio\n buy_or_evolve_defense\n end\n end\n\n if options.present?\n if options[:accept_job_id].present? && Job.acceptable.where(id: options[:accept_job_id]).first.present?\nRails.logger.info(\"---> AI: i accept job# #{options[:accept_job_id]}\")\n Job.acceptable.where(id: options[:accept_job_id]).first.accept_by(self)\n else\n result = Action.create(options)\nRails.logger.info(\"---> AI: i perform #{result.readable_type}\")\n result\n end\n end\n end",
"def goals_for(team)\n valid = ((team == self.home_team or team == self.away_team) and self.final)\n\n if (valid)\n if (self.home_team == team)\n return self.homeScore\n else\n return self.awayScore\n end\n else\n return 0\n end\n end",
"def getF326FlowRates( elements )\n locationText = \"HouseFile/House/Ventilation/Rooms\"\n roomLabels = [ \"living\", \"bedrooms\", \"bathrooms\", \"utility\", \"otherHabitable\" ]\n ventRequired = 0\n roomLabels.each do |roommName|\n if(roommName == \"living\" || roommName == \"bathrooms\" || roommName == \"utility\" || roommName == \"otherHabitable\")\n numRooms = elements[locationText].attributes[roommName].to_i\n ventRequired += (numRooms*5)\n #print \"Room is \",roommName, \" and number is \",numRooms, \". Total vent required is \", ventRequired, \"\\n\"\n elsif(roommName == \"bedrooms\")\n numRooms = elements[locationText].attributes[roommName].to_i\n if(numRooms >= 1)\n ventRequired += 10\n if(numRooms > 1)\n ventRequired += ((numRooms-1)*5)\n end\n end\n #print \"Room is \",roommName, \" and number is \",numRooms, \". Total vent required is \", ventRequired, \"\\n\"\n end\n end\n\n # If there is a basement, add another 10 L/s\n if(elements[\"HouseFile/House/Components/Basement\"] != nil)\n ventRequired += 10\n #print \"Room is basement. Total vent required is \", ventRequired, \"\\n\"\n end\n #print \"Final total vent required is \", ventRequired, \"\\n\"\n return ventRequired\nend",
"def exams_statistics\n end",
"def auto_calories \n cals_per_hour = $calories_per_hour.fetch(activity,42)\n cals_per_hour\n end",
"def goal_points\n self[:goal]\n end",
"def recalculate_activity\n activity = Task.recent_count(self.id)\n activity += ClientRequest.recent_count(self.milestones)\n activity += Message.recent_count(self)\n # TODO Count recent timesheet entries\n return activity\n end",
"def calculation\n wizard_step(nil) { { next_step: :calculate_next_step, cache_index: LbttController } }\n end",
"def create\n @goal = current_user.goals.new(goal_params)\n if @goal.category_id == 1 \n @goal.recurring_rules = \"{\\\"interval\\\":1,\\\"until\\\":null,\\\"count\\\":null,\\\"validations\\\":null,\\\"rule_type\\\":\\\"IceCube::DailyRule\\\"}\"\n @goal.due_date = Date.tomorrow \n elsif @goal.category_id == 2\n @goal.recurring_rules = nil\n @goal.assigned_date = @goal.due_date\n elsif @goal.category_id == nil\n @goal.recurring_rules = \"{\\\"interval\\\":1,\\\"until\\\":null,\\\"count\\\":null,\\\"validations\\\":null,\\\"rule_type\\\":\\\"IceCube::DailyRule\\\"}\"\n @goal.due_date = Date.tomorrow \n\n\n\n\n end\n\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to action: \"index\" }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n client = user_client\n\n\t #todays information\n\t user = current_user.id\n\t user_activities = client.activities_on_date 'today'\n\t step = Step.step_data(user_activities[\"summary\"], user)\n\t Step.refresh(user, client)\n\n\t @name = current_user.name\n\t @stepsDaily = step.stepAmount\n\t @stepsHistory = Step.where(user_id: user).order(stepDate: :desc)\n\t data = Step.goal_data(user)\n\t @stepGoal = data[\"goalAmount\"].to_f\n end",
"def update\n ### Scoped properly\n\n @goal = Goal.find(params[:id])\n\n \n\n if [email protected]_allowed_per_day\n @goal.pushes_allowed_per_day = 1\n end\n \n \n if current_user.id != @goal.user.id\n redirect_to(server_root_url) \n else \n ################################\n #Status Change Business Rules\n ################################\n\n # Theory: keep past data that's relevant for later analysis\n\n ##start --> hold \n ##monitor --> hold\n # 1) (keep any past/non-default checkpoints for future stats)\n\n #start --> monitor \n #hold --> monitor\n #monitor --> start\n #hold --> start\n # 1) (remove all existing checkpoints (as of 20110913))\n # 2) (set goal.start to today, stopping after goal.days_to_form_a_habit days)\n\n old_status = @goal.status\n\n old_publish = @goal.publish\n \n \n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n\n\n\n ### if we just created this goal and then want to say\n ### start today instead of tomorrow\n if params[:delay_start_for_this_many_days] \n start_day_offset = params[:delay_start_for_this_many_days].to_i\n ### Set the standard dates\n @goal.start = @goal.start + start_day_offset\n @goal.stop = @goal.start + @goal.days_to_form_a_habit\n @goal.first_start_date == @goal.start\n end\n\n\n \n ### update last activity date\n @goal.user.last_activity_date = @goal.user.dtoday\n @goal.user.save\n \n @goal.title = @goal.response_question\n\n \n ##### SET THE HOUR THAT THE REMINDERS SHOULD GO OUT FOR THIS GOAL #############\n if @goal.usersendhour == nil\n\t @goal.usersendhour = 20 ### 8pm\n end\n\n Time.zone = @goal.user.time_zone\n utcoffset = Time.zone.formatted_offset(false)\n offset_seconds = Time.zone.now.gmt_offset \n send_time = Time.utc(2000, \"jan\", 1, @goal.usersendhour, 0, 0) #2000-01-01 01:00:00 UTC\n central_time_offset = 21600 #add this in since we're doing UTC\n server_time = send_time - offset_seconds - central_time_offset\n puts \"User lives in #{@goal.user.time_zone} timezone, UTC offset of #{utcoffset} (#{offset_seconds} seconds).\" #Save this value in each goal, and use that to do checkpoint searches w/ cronjob\n puts \"For them to get an email at #{send_time.strftime('%k')} their time, the server would have to send it at #{server_time.strftime('%k')} Central time\" \n @goal.serversendhour = server_time.strftime('%k')\n @goal.gmtoffset = utcoffset\n\n #############\n\n\n if @goal.daym == nil \n @goal.daym = true\n end\n if @goal.dayt == nil \n @goal.dayt = true\n end\n if @goal.dayw == nil \n @goal.dayw = true\n end\n if @goal.dayr == nil \n @goal.dayr = true\n end\n if @goal.dayf == nil \n @goal.dayf = true\n end\n if @goal.days == nil \n @goal.days = true\n end\n if @goal.dayn == nil \n @goal.dayn = true\n end\n\n if @goal.template_owner_is_a_template\n @goal.save \n flash[:notice] = 'Template was successfully updated.'\n logger.info 'SGJ Template was successfully updated.'\n else\n if @goal.status != \"hold\" and @goal.daym and @goal.dayt and @goal.dayw and @goal.dayr and @goal.dayf and @goal.days and @goal.dayn and (@goal.goal_days_per_week == nil or @goal.goal_days_per_week == 7)\n @goal.status = \"start\"\n else\n @goal.status = \"monitor\"\n end\n @goal.save \n flash[:notice] = 'Goal was successfully updated.'\n logger.info 'SGJ Goal was successfully updated.'\n end\n\n\n\n\n\n dnow = get_dnow\n \n logger.debug 'old_status =' + old_status\n logger.debug 'new status =' + @goal.status\n ##If status was changed to start or monitor, delete and re-create future checkpoints\n if old_status != @goal.status\n if (@goal.status == \"start\" or @goal.status == \"monitor\") \n #set_start_date(@goal.id, dnow)\n #set_stop_date(@goal.id, 0)\n @goal.start = dnow\n @goal.stop = @goal.start + @goal.days_to_form_a_habit\n\n ################################################################################################\n #### If someone is switching a goal from a \"monitor\" goal over to a \"start\" goal,\n #### then make sure all days-of-the week get saved as \"checked\", \n #### otherwise it won't create their checkpoints, and it will end their start date prematurely.\n if @goal.status == \"start\"\n @goal.daym = true\n @goal.dayt = true\n @goal.dayw = true\n @goal.dayr = true\n @goal.dayf = true\n @goal.days = true\n @goal.dayn = true\n end\n ################################################################################################\n ################################################################################################ \n \n ############################\n ### If someone is going from \"hold\" to \"re-activate\"\n ### delete the old checkpoints because keeping them messes up the success rate\n ### they have been warned of this happening already\n #if old_status == \"hold\"\n # ### Re-set days straight to 0\n # @goal.daysstraight = 0\n # \n # ### Destroy any associated Checkpoints\n # @checkpoints = Checkpoint.find(:all, :conditions => \"goal_id = '#{@goal.id}'\")\n # for checkpoint in @checkpoints\n # checkpoint.destroy\n # end \n #end \n ############################\n ############################\n\n end\n if @goal.status == \"hold\"\n @goal.start = Date.new(1900, 1, 1)\n @goal.stop = @goal.start \n end\n ### save date changes\n @goal.save\n\n\n #format.html { render :action => \"index\" } # index.html.erb\n #format.xml { render :xml => @goals }\n end\n\n\n ### when a goal is saved by user, if it's \"private\", remove any entries from \"encourage_items\"\n if @goal.publish == false and old_publish == true\n logger.info(\"sgj:goals_controller.rb:about to remove entries because publish status changing\")\n encourage_items = EncourageItem.find(:all, :conditions => \"goal_id = '#{@goal.id}'\")\n encourage_items.each do |e|\n e.destroy\n end\n end\n\n\n if @goal.template_owner_is_a_template\n flash[:notice] = 'Template was successfully updated.' + flash[:notice]\n else\n flash[:notice] = 'Goal was successfully updated.' + flash[:notice]\n end\n\n\n ### if this template is for a program, redirect to the program\n if @goal.template_owner_is_a_template and params[:program_id]\n format.html {redirect_to(\"/programs/#{params[:program_id]}#action_items\")}\n else\n\n if @goal.user.is_premium\n format.html { render :action => \"index\" } # index.html.erb\n format.xml { render :xml => @goal.errors, :status => :unprocessable_entity } \n else\n format.html {redirect_to(\"/widget/upgrade\")}\n end\n end\n\n\n\n\n end\n end\n end\n end",
"def goals(period)\n unless period && [:daily, :weekly].include?(period)\n raise FitgemOauth2::InvalidArgumentError, \"Goal period should either be 'daily' or 'weekly'\"\n end\n end",
"def marathon\n\n\t\tdef km_to_mi (km)\n\t\t\tmiles = km * 0.621371\n\t\tend\n\n\t\tdef percent_complete_training (total_miles, goal_miles)\n\t\t\t@percent_complete = total_miles / 667\n\t\tend\n\n\t\t#@greeting = greetings.shuffle[0]\n\t\t#@firstname = params[:firstname]\n\t\t#@phonenumber = params[:phonenumber]\n\n\t\t#start_date_string = params[:start_date]\n\t\tstart_date_string = \"2015-05-04\"\n\t\t#puts \"START DATE STRING: #{start_date_string}\"\n\t\t@start_date = Date.parse(\"#{start_date_string}\")\n\n\t\t@todays_date = Date.today\n\n\n\t\tdef plan_position_calculator todays_date, plan_start_date\n\t\t\tdays_elapsed = todays_date - plan_start_date #calculate span in days\n\t\t\t@overall_position = days_elapsed.to_i + 1 #difference in days\n\t\t\t@week_position = (days_elapsed.to_i / 7) + 1\n\t\t\t@day_position = ((days_elapsed.to_i) % 7)\n\n\t\t\tputs \"THIS IS THE position on the chart: #{@overall_position}\"\n\t\t\tputs \"THIS IS THE week: #{@week_position}\"\n\t\t\tputs \"THIS IS THE day: #{@day_position}\"\n\n\t\t\t@todays_run = BEGINNER[@week_position][@day_position]\n\t\tend\n\n\t\tplan_position_calculator @todays_date, @start_date\n\n\n\t\t@time_now = Time.now\n\t\t@race_date = Time.new(2015,10,11)\n\n\t\tdef time_until_race todays_date, race_date\n\t\t\tdays_until_race = race_date - todays_date\n\t\t\t@days_until_longint = days_until_race / (60*60*24)\n\t\t\t@total_days_until_race = (@days_until_longint.to_f).ceil\n\t\t\t@weeks_until_race = @total_days_until_race / 7\n\t\t\t@remainder_days_until_race = @total_days_until_race % 7\n\t\tend\n\n\t\ttime_until_race(@time_now, @race_date)\n\n\t\t# Build URL for GET request\n\n\t\t# current_date = Time.now.utc.iso8601[0..9]\n\t\tcurrent_date = @todays_date.to_s\n\t\t# current_date_string = current_date.to_s\n\t\tresults = \"200\"\n\t\tbase = \"https://api.nike.com/me/sport/activities?\"\n\t\taccess_token = \"access_token=lJTUBeEeSeeLBncuWWYWKT03BRG2\"\n\t\tstart_date_param = \"&startDate=#{@start_date}\"\n\t\tend_date_param = \"endDate=#{current_date}\"\n\t\tcount = \"&count=#{results}\"\n\n\t\turl = \"#{base}#{end_date_param}#{start_date_param}&#{access_token}#{count}\"\n\t\tputs url\n\t\tdata = Nokogiri::HTML(open(url))\n\n\t\tparsed = JSON.parse(data)\n\n\t\thash = parsed[\"data\"]\n\n\t\t## Write file with current data\n\n\t\t# newFile = File.write('./dummydata.txt', hash)\n\t\t# puts \"FILE SAVED AS dummydata.txt\"\n\n\t\t@number_of_runs = 0\n\t\t@total_kilos = 0\n\t\t@total_time = 0\n\t\t@average_pace = 0\n\t\t@total_duration = 0\n\n\t\n\t\t#chronic duration\n\t\tdef cd time\n\t\t\tChronicDuration.parse(time)\t\t\t\n\t\tend\n\n\t\t# Loop through hash to get all distances\n\n\t\thash.each do |activity|\n\t\t\tif activity[\"activityType\"] == \"RUN\"\n\t\t\t\t@number_of_runs += 1\n\t\t\t\t@total_kilos += activity[\"metricSummary\"][\"distance\"]\n\t\t\t\t@total_duration += cd(activity[\"metricSummary\"][\"duration\"])\n\t\t\tend\n\t\t\t# @total_time += activity[\"metricSummary\"][\"duration\"]\n\t\t\t# puts \"#{activity[\"metricSummary\"][\"distance\"]} + DATE: #{activity[\"startTime\"]}\"\n\t\t\t# puts \"#{activity[\"metricSummary\"][\"duration\"]}\"\n\t\tend\n\n\t\t#time spent running\n\n\t\t@total_duration = @total_duration.floor\n\t\t@total_hours = (@total_duration / 3600).floor\n\t\t@total_minutes = ((@total_duration % 3600) / 60).floor\n\t\t@total_seconds = @total_duration % 60\n\n\t\t@total_miles = km_to_mi(@total_kilos)\n\n\t\t# Average pace \n\t\t@average_pace = @total_duration / @total_miles\n\t\t@average_pace_minutes = (@average_pace / 60).floor\n\t\t@average_pace_seconds = (@average_pace % 60).floor\n\n\t\tputs \"TOTAL DURATION: #{@total_duration}\"\n\t\t#predicted marathon time\n\t\t@marathon_time = @average_pace * 26.2\n\t\t@marathon_pace_seconds = (@marathon_time % 60).floor\n\t\t@marathon_pace_minutes = ((@marathon_time / 60) % 60).ceil\n\t\t@marathon_pace_hours = (@marathon_time / 3600).floor\n\t\t\n\n\t\t# LAST RUN\n\t\t# Reasoning: usually the last activity will be a run. If not, the second to last one will be.\n\n\n\t\tif hash[0][\"activityType\"] == \"RUN\"\n\t\t\t@last_run_distance_km = hash[0][\"metricSummary\"][\"distance\"]\n\t\t\t@last_run_time = hash[0][\"metricSummary\"][\"duration\"]\n\t\t\t@last_run_start_time = hash[0][\"startTime\"][0...-10]\n\t\telse\n\t\t\t@last_run_distance_km = hash[1][\"metricSummary\"][\"distance\"]\n\t\t\t@last_run_time = hash[1][\"metricSummary\"][\"duration\"]\n\t\t\t@last_run_start_time = hash[0][\"startTime\"][0...-10]\n\t\tend\n\n\t\t@last_run_distance = km_to_mi @last_run_distance_km\n\n\t\tputs @last_run_time\n\t\t@last_run_time = cd @last_run_time\n\n\t\t@last_run_pace_seconds = @last_run_time / @last_run_distance\n\t\tpace_seconds = @last_run_pace_seconds % 60\n\t\tpace_minutes = (@last_run_pace_seconds / 60) % 60\n\n\t\t@last_run_pace_formatted = format(\"%02d:%02d\", pace_minutes, pace_seconds)\n\n\t\tseconds = @last_run_time % 60\n\t\tminutes = (@last_run_time / 60) % 60\n\t\thours = @last_run_time / (60 * 60)\n\n\t\t@last_run_time_formatted = format(\"%02d:%02d:%02d\", hours, minutes, seconds) #=> \"01:00:00\"\n\n\t\t#puts \"LAST RUN? #{@last_run_distance_km}, duration: #{@last_run_time}\"\n\n\t\t#LAST 7 Days of Runs\n\n\t\tgon.pace = []\n\t\tgon.runs = []\n\t\tgon.days = []\n\n\t\thash.each do |activity|\n\t\t\tif activity[\"activityType\"] == \"RUN\"\n\t\t\t\tdistance = ((activity[\"metricSummary\"][\"distance\"])*0.621371192).round(2)\n\t\t\t\tgon.runs.push(distance)\n\t\t\t\tduration = (cd(activity[\"metricSummary\"][\"duration\"]).round(2) / distance) / 60\n\t\t\t\tgon.pace.push(duration.round(2))\n\t\t\t\tdate = activity[\"startTime\"][0...-10]\n\t\t\t\tgon.days.push(date)\n\t\t\telse\n\t\t\t\tnext\n\t\t\tend\n\t\tend\n\t\t\n\t\tgon.runs = gon.runs.reverse\n\t\tgon.days = gon.days.reverse\n\t\tgon.pace = gon.pace.reverse\n\n\t\t#convert from kilometers to miles\n\n\t\t\n\n\t\tpercent_complete_training(@total_miles, BEGINNER)\n\n\t\t# Public Shaming section\n\t\t@last_run_parsed = Date.parse(@last_run_start_time)\n\n\t\tputs \"LAST RUN START TIME ======================>>>>> #{@last_run_parsed}\"\n\n\n\t\t# Do I need to run today?\n\n\t\tif @todays_run > 0\n\t\t\trunning_required = true\n\t\t\tputs \"today is a running day\"\n\t\t\tif @last_run_parsed == Date.today\n\t\t\t\tputs \"You ran today, good job\"\n\t\t\t\t@ran_yet = true\n\t\t\t\t@miles_ran_today = @last_run_distance.round(2)\n\t\t\telse\n\t\t\t\tputs \"Paul hasn't ran yet\"\n\t\t\t\t@ran_yet = false\n\t\t\t\t@miles_ran_today = 0\n\t\t\tend\n\t\telse\n\t\t\trunning_required = false\n\t\t\tputs \"today is not a running day\"\n\t\tend\n\n\tif @miles_ran_today == 0\n\t\t@miles_ran_today = \"0\"\n\tend\n\n\t\tputs \"miles ran today: #{@miles_ran_today}\"\n\tend",
"def hitting_total\n self.rating_19 +\n self.rating_20 +\n self.rating_21 +\n self.rating_22 +\n self.rating_23 +\n self.rating_24 +\n self.rating_25 +\n self.rating_26 +\n self.rating_27\n end",
"def commitment_score commitment\n \n commitment_score = {}\n activity_count = commitment.activities.count\n \"-------------- #{activity_count} ---------------\"\n commitment.activities.each do |activity|\n @activity = activity.as_json\n @attendance = get_members_attendance(@activity)\n\n @attendance.each do |member, attendance| \n if commitment_score[member] && attendance == true\n commitment_score[member] += 100\n elsif commitment_score[member] && attendance == false\n commitment_score[member] += 0\n elsif !commitment_score[member] && attendance == false\n commitment_score[member] = 0\n else \n commitment_score[member] = 100\n end\n end\n end\n\n commitment_score.each do |member, attendance|\n commitment_score[member] = attendance / activity_count\n end\n\n return commitment_score\n\n end",
"def total_score\n @all_games.map do |games|\n games[\"home_goals\"].to_i + games[\"away_goals\"].to_i\n end\n end",
"def calculate_scores(goal,l_obj,m_obj,h_obj,s_obj)\n serial = CarreerSerializer.new(goal)\n unless goal.weighing?\n return {scores:nil,carreer:serial.as_json}\n end\n scores = {language:stats(get_essays(1)), math:stats(get_essays(2)),history:stats(get_essays(3)),science:stats(get_essays(4))}\n l_essays = scores[:language].nil?\n m_essays = scores[:math].nil?\n s_essays = scores[:science].nil?\n h_essays = scores[:history].nil?\n if goal.weighing.science && goal.weighing.history\n if !(l_essays || m_essays)\n if !s_essays\n max_score_science = (goal.weighing.NEM * current_user.nem + goal.weighing.ranking*current_user.ranking +\n goal.weighing.language * scores[:language][:max] + goal.weighing.math * scores[:math][:max] +\n goal.weighing.science * scores[:science][:max]) /100\n avg_score_science = (goal.weighing.NEM * current_user.nem + goal.weighing.ranking*current_user.ranking +\n goal.weighing.language * scores[:language][:expectation] + goal.weighing.math * scores[:math][:expectation] +\n goal.weighing.science * scores[:science][:expectation]) /100\n else\n max_score_science = nil\n avg_score_science = nil\n end\n if !h_essays\n avg_score_history = (goal.weighing.NEM * current_user.nem + goal.weighing.ranking*current_user.ranking +\n goal.weighing.language * scores[:language][:expectation] + goal.weighing.math * scores[:math][:expectation] +\n goal.weighing.history * scores[:history][:expectation]) /100\n max_score_history = (goal.weighing.NEM * current_user.nem + goal.weighing.ranking*current_user.ranking +\n goal.weighing.language * scores[:language][:max] + goal.weighing.math * scores[:math][:max] +\n goal.weighing.history * scores[:history][:max]) /100\n else\n avg_score_history = nil\n max_score_history = nil\n end\n else\n max_score_science = nil\n avg_score_science = nil\n max_score_history = nil\n avg_score_history = nil\n end\n if !(h_obj.nil? || m_obj.nil? || l_obj.nil?)\n obj_score_history= ((goal.weighing.NEM * current_user.nem + goal.weighing.ranking*current_user.ranking +\n goal.weighing.language * l_obj.score + goal.weighing.math * m_obj.score +\n goal.weighing.history * h_obj.score) /100).to_i\n else\n obj_score_history = nil\n end\n if !(s_obj.nil? || m_obj.nil? || l_obj.nil?)\n obj_score_science = ((goal.weighing.NEM * current_user.nem + goal.weighing.ranking*current_user.ranking +\n goal.weighing.language * l_obj.score + goal.weighing.math * m_obj.score +\n goal.weighing.science * s_obj.score) /100).to_i\n else\n obj_score_science = nil\n end\n return {scores:{science:{max: max_score_science, avg: avg_score_science, obj:obj_score_science},history:{max: max_score_history, avg:avg_score_history, obj:obj_score_history},last_cut:goal.last_cut},carreer:serial.as_json}\n elsif goal.weighing.science\n if !(l_essays || m_essays || s_essays)\n max_score_science = ((goal.weighing.NEM * current_user.nem + goal.weighing.ranking*current_user.ranking +\n goal.weighing.language * scores[:language][:max] + goal.weighing.math * scores[:math][:max] +\n goal.weighing.science * scores[:science][:max]) /100).to_i\n avg_score_science = ((goal.weighing.NEM * current_user.nem + goal.weighing.ranking*current_user.ranking +\n goal.weighing.language * scores[:language][:expectation] + goal.weighing.math * scores[:math][:expectation] +\n goal.weighing.science * scores[:science][:expectation]) /100).to_i\n else\n max_score_science = nil\n avg_score_science = nil\n end\n if !(s_obj.nil? || m_obj.nil? || l_obj.nil?)\n obj_score_science = ((goal.weighing.NEM * current_user.nem + goal.weighing.ranking*current_user.ranking +\n goal.weighing.language * l_obj.score + goal.weighing.math * m_obj.score +\n goal.weighing.science * s_obj.score) /100).to_i\n else\n obj_score_science = nil\n end\n return {scores:{science:{max: max_score_science, avg: avg_score_science,obj:obj_score_science},history:nil,last_cut:goal.last_cut},carreer:serial.as_json}\n else\n if !(l_essays || m_essays || h_essays)\n avg_score_history = ((goal.weighing.NEM * current_user.nem + goal.weighing.ranking*current_user.ranking +\n goal.weighing.language * scores[:language][:expectation] + goal.weighing.math * scores[:math][:expectation] +\n goal.weighing.history * scores[:history][:expectation]) /100).to_i\n max_score_history = ((goal.weighing.NEM * current_user.nem + goal.weighing.ranking*current_user.ranking +\n goal.weighing.language * scores[:language][:max] + goal.weighing.math * scores[:math][:max] +\n goal.weighing.history * scores[:history][:max]) /100).to_i\n else\n avg_score_history = nil\n max_score_history = nil\n end\n if !(h_obj.nil? || m_obj.nil? || l_obj.nil?)\n obj_score_history= ((goal.weighing.NEM * current_user.nem + goal.weighing.ranking*current_user.ranking +\n goal.weighing.language * l_obj.score + goal.weighing.math * m_obj.score +\n goal.weighing.history * h_obj.score) /100).to_i\n else\n obj_score_history = nil\n end\n return {scores:{history:{max: max_score_history, avg:avg_score_history,obj:obj_score_history},science:nil,last_cut:goal.last_cut},carreer:serial.as_json}\n end\n end",
"def update_target_cost\n cost = BigDecimal(0.00, 10)\n self.activities.each do |activity|\n cost += activity.targetCost\n end\n self.target_cost = cost\n end",
"def checaMeta\n\t\t@goals = self.goals\n\t\[email protected] do |g|\n\t\t\tself.categories.each do |c|\n\t\t\t\tsaldo = c.valor_receita_efetivado - c.valor_despesa_efetivado\n\t\t\t\tif ((g.fim < Date.today) && (saldo < g.valor))\n\t\t\t\t\tg.estado = -1\t\t\t\t\t\n\t\t\t\telsif ((g.fim < Date.today) && (saldo >= g.valor)) \n\t\t\t\t\tg.estado = 1\t\t\t\t\t\n\t\t\t\tend\n\t\t\tend\n\t\t\tg.save\n\t\tend\n\tend",
"def total_payments\n\t\tammortization * 12\n\tend",
"def goals_favor(club)\n if finished?\n\n if club == local\n return local_goals\n end\n\n if club == guest\n return guest_goals\n end\n end\n\n 0\n end",
"def create\n @report = Report.new(report_params)\n @report.owner_id = current_user.id\n @report.creation_date = Date.today\n @report.diference = (@report.consumedCalories - @report.burnedCalories) \n if @report.diference > 0\n @report.diference_value = 'Caloric Surplus'\n elsif @report.diference <0\n @report.diference_value = 'Caloric Deficit'\n else\n @report.diference_value = 'Balance'\n end\n \n progress = Progress.where('user_id = ?', current_user.id).where('expires_at = ?', @report.creation_date)\n if progress != nil\n \n progress.each do |goal|\n puts \"Informacion de mi goal #{goal.consumedCalories} #{goal.burnedCalories} #{goal.consumedObjetive} #{goal.burnedObjetive} \"\n goal.burnedObjetive = goal.burnedObjetive + @report.burnedCalories\n goal.consumedObjetive = goal.consumedObjetive + @report.consumedCalories\n goal.porcent = (((goal.burnedObjetive+goal.consumedObjetive) * 100)/(goal.consumedCalories+goal.burnedCalories)).to_i\n if goal.porcent > 100\n goal.porcent = 100\n end\n puts \"Informacion de mi goal2 #{goal.consumedCalories} #{goal.burnedCalories} #{goal.consumedObjetive} #{goal.burnedObjetive} \"\n if goal.save\n puts \"guarda\"\n else\n puts \"algo paso\"\n end\n end\n end\n \n \n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: \"Report was successfully created.\" }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fitness_count\n find_user.activities.where(category: \"Health & Fitness\").where(accomplished: true).count\n end",
"def calculate_calories\n\t\tselected_food = params['food']['search']\n\t\tfoodName = selected_food.split('cals').first\n\t\t@name = foodName\n\t\tfoodCal = selected_food.split('cals').last\n\t\t@calories = foodCal\n\n\t\t###distinguish between female/male###\n\t\tif current_user.gender = 'male'\n\t\t@time_running = foodCal.to_f * 4.184 / ( (current_user.age * 0.2017) - (current_user.weight * 0.09036) + (148 * 0.6309) - 55.0969 )\n\t\t\n\t\t@time_walking = foodCal.to_f / 5 / (current_user.weight * 0.45392) * 60\n\t\t\n\t\t@time_swimming = foodCal.to_f / 9.8 / (current_user.weight * 0.45392) * 60\n\n\t\t@time_programming = foodCal.to_f / 1.8 / (current_user.weight * 0.45392) * 60\n\t\t\n\t\t\telsif current_user.gender ='female'\n\t\t\t\t@time_running = foodCal.to_f * 4.184 / ( (current_user.age * 0.074) - (current_user.weight * 0.05741) + (148 * 0.4472) - 20.4022 )\n\t\t\t\t\n\t\t\t\t@time_walking = foodCal.to_f / 5 / (current_user.weight * 0.45392) * 60\n\t\t\t\t\n\t\t\t\t@time_swimming = foodCal.to_f / 9.8 / (current_user.weight * 0.45392) * 60\n\n\t\t\t\t@time_programming = foodCal.to_f / 1.8 / (current_user.weight * 0.45392) * 60\n\t\t\tend\n\t\trender :exercise\n\tend",
"def quota()\n (@quota) + (@experience / 2)\nend",
"def ali_action\n\n # for most actions re-render the whole project planner (TODO: improve this for other actions but move ALI)\n @status = 'render_all'\n\n @activity_line_item = ActivityLineItem.find_by(:object_key => params[:ali])\n action = params[:invoke]\n\n case action\n when ALI_MOVE_YEAR_ACTION\n\n new_fy_year = params[:year]\n if @activity_line_item.assets.count > 25\n @status = 'job'\n Delayed::Job.enqueue MoveAliYearJob.new(@activity_line_item, new_fy_year, current_user, params[:early_replacement_reason]), :priority => 0\n notify_user :notice, \"Moving ali #{@activity_line_item} to new #{get_fy_label} #{new_fy_year}. You will be notified when the process is complete.\"\n else\n # update project planner by JS for just the single ALI moved\n @status = 'js_update'\n @capital_project = @activity_line_item.capital_project\n @ali_cost = @activity_line_item.cost\n @old_ali_fy = @activity_line_item.fy_year\n\n Rails.logger.debug \"Moving ali #{@activity_line_item} to new FY #{new_fy_year}\"\n proj_and_alis = CapitalProjectBuilder.new.move_ali_to_planning_year(@activity_line_item, new_fy_year, params[:early_replacement_reason])\n @new_alis = proj_and_alis[:touched_alis].map{|x| x[1]}\n @deleted_alis = proj_and_alis[:deleted_alis]\n\n notify_user :notice, \"ALI was successfully moved to #{new_fy_year}.\"\n\n end\n when ALI_UPDATE_COST_ACTION\n @activity_line_item.anticipated_cost = params[:activity_line_item][:anticipated_cost]\n Rails.logger.debug \"Updating anticipated cost for ali #{@activity_line_item} to #{params[:activity_line_item][:anticipated_cost]}\"\n if @activity_line_item.save\n notify_user :notice, \"The ALI was successfully updated.\"\n else\n notify_user :alert, \"An error occurred while updating the ALI.\"\n end\n\n when ALI_REMOVE_ACTION\n @project = @activity_line_item.capital_project\n @activity_line_item.destroy\n Rails.logger.debug \"Removing ali #{@activity_line_item} from project #{@project}\"\n notify_user :notice, \"The ALI was successfully removed from project #{@project.project_number}.\"\n end\n\n\n if action == ALI_MOVE_YEAR_ACTION\n get_planning_years\n @new_alis = @new_alis.select{|x| x.fy_year <= @years.last} if @new_alis\n else\n prepare_projects_display\n end\n\n respond_to do |format|\n format.js\n end\n end",
"def calc\n calc_spawn_zombie\n calc_move_zombies\n calc_player\n calc_kill_zombie\n end",
"def score\n goals = self.match_events.select { |e| e.event_type == MatchEvent::EventType::GOAL }\n goals.reduce({away: 0, home: 0}) do |score, e|\n if e.event_author == MatchEvent::EventAuthor::HOME\n score[:home] += 1\n elsif e.event_author == MatchEvent::EventAuthor::AWAY\n score[:away] += 1\n end\n score\n end\n end",
"def strategy\n\n attacks_in_last_24_hours = Action.where([\"type_id = ? OR type_id = ?\", Action::TYPE_ATTACK_USER, Action::TYPE_ATTACK_USER_DDOS]).where(target_id: id, target_type: \"User\", completed: true).where(\"completed_at >= ?\", DateTime.now-24.hours).count\n\n # how often was the player succesfully attacked in the last 24 hours?\n if successful_attacks_in_last_24_hours > 0 && !counterattack_successful?\n agressiveness = (successful_attacks_in_last_24_hours.to_f/attacks_in_last_24_hours.to_f*100).to_i\n else\n agressiveness = 50\n end\n\n # how many other players can be attacked by this player?\n other_players = User.where([\"id != ?\", id])\n attack_opportunities = 0\n stronger_opportunities = 0\n weaker_opportunities = 0\n total_opportunities = other_players.count*2\n other_players.each do |player|\n [:hack, :ddos].each do |type|\n attack_opportunities += 1 if can_attack?(player, type)\n weaker_opportunities += 1 if to_strong_for(player, type)\n stronger_opportunities += 1 if to_weak_for(player, type)\n end\n end\n\n # assume that own defense is too low if defense is less than 33% of all attributes and more than 25% of other players are stronger\n if (hacking_ratio+defense_ratio+botnet_ratio) > 0 && \n ((defense_ratio.to_f/(hacking_ratio.to_f+defense_ratio.to_f+botnet_ratio.to_f)*100).round(0) < 33) &&\n (stronger_opportunities.to_f/total_opportunities.to_f*100).round(0) > 25\n defensiveness = 100\n else\n defensiveness = 50\n end\n\n # determine strategy according to relation between agressiveness and defensiveness\n if agressiveness > defensiveness\nRails.logger.info(\"---> AI: my strategy is agressive\")\n :agressive\n elsif agressiveness < defensiveness\nRails.logger.info(\"---> AI: my strategy is defensive\")\n :defensive\n else\nRails.logger.info(\"---> AI: my strategy is moderate\")\n :moderate\n end\n end",
"def set_goals\n # doing simple: give the goal \"kill this ant\" for each ant\n $map = @map # FIXME\n x = nil\n @map.ennemies_each { |e|\n x = e\n break\n }\n raise \"oops\" if x == nil\n i = 0\n @map.allies_each{ |a|\n a.goal = [KILL, x]\n i += 1\n break if i == 4\n }\n return\n\n # get state of the game\n #calculate each top goals weight\n @top_goals.each { |g|\n get_weight(g)\n }\n end",
"def taskcalc(tasks)\n days_per_task = @sum_of_days / tasks\n days_gone = @sum_of_days - @eta\n @accomplished = days_gone / days_per_task\n end",
"def display_goal\n puts \"\\nYOUR CURRENT GOAL IS: #{self.description}\".light_white\n if self.target_date\n puts \"\\nTARGET DATE TO REACH YOUR GOAL: #{self.target_date.strftime('%-d %B %Y')}\".light_white\n end\n if self.attainable\n puts \"\\nWHY I CAN ACHIEVE THIS GOAL: #{self.attainable}\".light_white\n end\n if self.relevant\n puts \"\\nWHY THIS GOAL MATTERS: #{self.relevant}\".light_white\n end\n end",
"def pri_toff\n team_stats.goals_per_game / team_stats.opp_avg_goals_per_game\n end",
"def run\n if current_user\n plot = plot_time\n\n # returns an array of hashes each with two keys,\n # one for date and a value for distance\n run_points = plot[\"activities-tracker-distance\"]\n \n # adds previous points to each subsequent point\n progress = 0\n run_points.map do |point|\n progress += point['value'].to_f\n point['value'] = progress.round(2)\n end \n \n # the high point of the graph, which corresponds to the \n # total distance of the goal\n max_val = current_user.goal.distance \n @results = {\n points: run_points,\n max_val: max_val,\n }\n\n # sends out our @result hash to a /users/run.json query\n end\n respond_to do |f|\n f.json { render :json => @results }\n end\n end",
"def timesheet_total_price(paied_actions = [])\n paied_actions.reject!(&:blank?)\n total_price = 0\n paied_actions.each do |paied_action|\n if paied_action.is_a? Numeric\n total_price += paied_action\n else\n paied_action.each do |act|\n total_price += price_sum(act)\n end\n end\n end\n total_price\n end",
"def aggregate(choice)\n \n self.total_social_tag_cheers = self.social_tag.total_cheers\n self.total_story_tag_cheers = self.story_tag.total_cheers\n self.total_story_cheers = self.story.total_cheers\n \n self.total_social_tag_jeers = self.social_tag.total_jeers\n self.total_story_tag_jeers = self.story_tag.total_jeers\n self.total_story_jeers = self.story.total_jeers\n \n if choice == \"cheer\"\n self.cheer\n elsif choice == \"jeer\" \n self.jeer\n end \n self.activity\n \n end",
"def main_goal()\n # TODO: replace naive implementation\n return goals.values.first\n end",
"def chocolate_goal\n chocolate_per_day = 2\n days_in_life = 80 * 365\n\n chocolate_per_day * days_in_life\n end",
"def dashboard_actions\n @actions = Action.where('closed_flag = ?', false)\n @users = User.all\n \n @over = @actions.where('date_target < ?', Time.now).count\n @due = @actions.where('date_target >= ?', Time.now).count\n @year_count = Action.where('date_time_created >= ?', Time.now - 1.year).count\n \n @typeA_num = @actions.where('type_ABC = ?', \"A\").count\n @typeB_num = @actions.where('type_ABC = ?', \"B\").count\n @typeC_num = @actions.where('type_ABC = ?', \"C\").count\n \n # data series for the pie-chart\n\n @series1 = @actions.where('date_target >= ?', Time.now).group(:type_ABC).count\n @series2 = @actions.where('date_target < ?', Time.now).group(:type_ABC).count\n\n # data series for the stacked column\n # If statement allows for filtering by team, available to line managers and above...\n\n\n @series3 = @actions.where('date_target >= ?', Time.now).group(:owner).count\n @series4 = @actions.where('date_target < ?', Time.now).group(:owner).count\n\n action_ids = []\n k = 0\n team_count = User.where('team = ?', \"SHEQ\").count\n team_hash = User.where('team = ?', \"SHEQ\")\n (0..team_count-1).each do |i|\n team_member_actions_arr = @actions.where('user_id = ?', team_hash[i].id).index_by(&:id).to_a\n (0..team_member_actions_arr.length-1).each do |j|\n action_ids[k] = team_member_actions_arr[j][0]\n k += 1\n end\n \n end\n \n gon.SHEQ_team_actions = @actions.where('id IN(?)', action_ids)\n \n end"
] | [
"0.66066605",
"0.65971065",
"0.65451396",
"0.6507256",
"0.6199064",
"0.6180355",
"0.6143281",
"0.60982186",
"0.60982186",
"0.60568535",
"0.605497",
"0.60079026",
"0.5992744",
"0.59904087",
"0.598466",
"0.5948578",
"0.5947906",
"0.59306955",
"0.5801519",
"0.5757387",
"0.57546026",
"0.5751804",
"0.5739306",
"0.5714984",
"0.57137287",
"0.5686398",
"0.56786513",
"0.56782",
"0.5672117",
"0.5641333",
"0.5634995",
"0.5628597",
"0.56239927",
"0.5623594",
"0.5607818",
"0.5595666",
"0.5585179",
"0.5584771",
"0.55802125",
"0.5555077",
"0.5543123",
"0.5539912",
"0.55240464",
"0.5517813",
"0.55144435",
"0.55051315",
"0.54993224",
"0.5487927",
"0.54809314",
"0.546121",
"0.54530126",
"0.5452608",
"0.5451296",
"0.54451084",
"0.54433966",
"0.54432076",
"0.5422981",
"0.5421754",
"0.5408573",
"0.53958714",
"0.5389945",
"0.53688323",
"0.5368169",
"0.5356731",
"0.5356526",
"0.53562194",
"0.53424716",
"0.5340604",
"0.5337979",
"0.53359807",
"0.53240854",
"0.53222775",
"0.5310844",
"0.5310285",
"0.53082585",
"0.53037983",
"0.53035206",
"0.5299779",
"0.5298244",
"0.52977663",
"0.52953875",
"0.5295071",
"0.52910215",
"0.5279467",
"0.52726215",
"0.52686566",
"0.5261155",
"0.5251711",
"0.5243645",
"0.52383476",
"0.52363086",
"0.52345216",
"0.52309525",
"0.5225979",
"0.5216318",
"0.52149606",
"0.52109855",
"0.5202417",
"0.51927817",
"0.51853657"
] | 0.5264551 | 86 |
Newlinedelimited list of actions | def encode(serialized_actions = [])
serialized_actions.join("\n")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_actions\n\n actions = []\n\n unless self.actions.nil? or self.actions.empty?\n actions = self.actions.split(\"\\n\").collect {|entry| entry.split('-') }\n end\n return actions\n end",
"def actions!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = ACTIONS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 142:11: 'actions'\n match( \"actions\" )\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__, 11 )\n\n end",
"def actions\n @actions ||= enabled_actions.split(',')\n end",
"def append(action); end",
"def append(action); end",
"def append(action); end",
"def action(a)\n @actions << a\n puts a.msg\n end",
"def include_actions(*actions)\n self.actions ||= []\n self.actions.push(*actions)\n end",
"def add_actions(*args)\n @actions.concat(args)\n end",
"def add_actions; end",
"def action_list(args = {})\n name = args[:name]\n\n # Generate and perform necessary Actions for the\n # selected, referenced additional resources.\n @@markerselector = ApexMarkerSelector.new if @@markerselector.nil?\n args[:selector] = @@markerselector\n alist = super(args)\n\n # Apex put marker callouts in normal paragraphs.\n # <p><Vidoe02></p>\n # Captured all paragraphs and now needed to\n # look at the contents to see if match.\n new_alist = []\n alist.each do |marker_action|\n content = marker_action.fragment.node.text\n new_alist << marker_action if content.match?(/\\<insert[ ]+[^\\>]+\\>/)\n end\n return new_alist\n end",
"def actions\n @actions ||= []\n end",
"def actions\n @actions ||= []\n end",
"def actions\n []\n end",
"def actions() ; info[:actions] ; end",
"def actions() ; info[:actions] ; end",
"def printable_commands(*)\n item = []\n item << banner\n item << (desc ? \"# #{desc.gsub(/\\s+/m, ' ')}\" : \"\")\n [item]\n end",
"def actions\n @actions || []\n end",
"def all(action)\n command \"ALL,#{action.to_s.upcase}\"\n end",
"def actions\n actions = []\n @model.with_each_action_for(self) do |action|\n actions << action\n end\n actions\n end",
"def show_actions(what)\n return \" \".html_safe unless current_user\n\n common_actions(what) +\n owner_actions(what) +\n scientific_committee_actions(what) +\n organizer_committee_actions(what)\n end",
"def action_steps(ordered: true)\n steps(ordered: ordered).map do |step|\n matches = step.match(/^((.*?)[.?!])\\s+(.+)/)\n [matches[1], matches[3]]\n end\n end",
"def action_strs\n @action_strs ||= user_data_as_array('action')\n @action_strs\n end",
"def actions *actions\n options = actions.extract_options!\n return if actions.blank?\n actions = [:show, :edit, :destroy] if actions == [:all]\n actions.each do |action|\n action_link(action.to_sym, options)\n end\n nil\n end",
"def category_actions\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n array = nil\n act = nil\n next_act = nil\n # - - - - @init action - - - -\n array = Array.new\n\n begin\n # at line 84:10: ';' ( WS )? 'actions' '=' '\\\"' act= action_location ( ( WS )? next_act= action_location )* '\\\"'\n match(T__11, TOKENS_FOLLOWING_T__11_IN_category_actions_441)\n # at line 84:14: ( WS )?\n alt_16 = 2\n look_16_0 = @input.peek(1)\n\n if (look_16_0 == WS)\n alt_16 = 1\n end\n case alt_16\n when 1\n # at line 84:14: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_category_actions_443)\n\n end\n match(T__20, TOKENS_FOLLOWING_T__20_IN_category_actions_446)\n match(T__13, TOKENS_FOLLOWING_T__13_IN_category_actions_448)\n match(T__14, TOKENS_FOLLOWING_T__14_IN_category_actions_450)\n @state.following.push(TOKENS_FOLLOWING_action_location_IN_category_actions_454)\n act = action_location\n @state.following.pop\n # --> action\n array << (act && @input.to_s(act.start, act.stop))\n # <-- action\n # at line 85:10: ( ( WS )? next_act= action_location )*\n while true # decision 18\n alt_18 = 2\n look_18_0 = @input.peek(1)\n\n if (look_18_0.between?(WS, DIGIT) || look_18_0 == T__10 || look_18_0 == T__13 || look_18_0.between?(T__28, T__42))\n alt_18 = 1\n\n end\n case alt_18\n when 1\n # at line 85:12: ( WS )? next_act= action_location\n # at line 85:12: ( WS )?\n alt_17 = 2\n look_17_0 = @input.peek(1)\n\n if (look_17_0 == WS)\n alt_17 = 1\n end\n case alt_17\n when 1\n # at line 85:12: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_category_actions_470)\n\n end\n @state.following.push(TOKENS_FOLLOWING_action_location_IN_category_actions_475)\n next_act = action_location\n @state.following.pop\n # --> action\n array << (next_act && @input.to_s(next_act.start, next_act.stop))\n # <-- action\n\n else\n break # out of loop for decision 18\n end\n end # loop for decision 18\n match(T__14, TOKENS_FOLLOWING_T__14_IN_category_actions_482)\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 10 )\n\n end\n\n return array\n end",
"def add_actions(actions)\n # Remove the empty action (dead pokemon)\n actions.delete_if(&:empty?)\n # Merge the actions\n @actions.concat(actions)\n end",
"def category_actions\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n array = nil\n act = nil\n next_act = nil\n # - - - - @init action - - - -\n array = Array.new\n\n begin\n # at line 57:10: SEMICOLON ( WS )? ACTIONS EQUALS QUOTE act= uri ( WS next_act= uri )* QUOTE\n match( SEMICOLON, TOKENS_FOLLOWING_SEMICOLON_IN_category_actions_437 )\n # at line 57:20: ( WS )?\n alt_15 = 2\n look_15_0 = @input.peek( 1 )\n\n if ( look_15_0 == WS )\n alt_15 = 1\n end\n case alt_15\n when 1\n # at line 57:20: WS\n match( WS, TOKENS_FOLLOWING_WS_IN_category_actions_439 )\n\n end\n match( ACTIONS, TOKENS_FOLLOWING_ACTIONS_IN_category_actions_442 )\n match( EQUALS, TOKENS_FOLLOWING_EQUALS_IN_category_actions_444 )\n match( QUOTE, TOKENS_FOLLOWING_QUOTE_IN_category_actions_446 )\n @state.following.push( TOKENS_FOLLOWING_uri_IN_category_actions_450 )\n act = uri\n @state.following.pop\n # --> action\n array << ( act && @input.to_s( act.start, act.stop ) ) \n # <-- action\n # at line 58:10: ( WS next_act= uri )*\n while true # decision 16\n alt_16 = 2\n look_16_0 = @input.peek( 1 )\n\n if ( look_16_0 == WS )\n alt_16 = 1\n\n end\n case alt_16\n when 1\n # at line 58:12: WS next_act= uri\n match( WS, TOKENS_FOLLOWING_WS_IN_category_actions_466 )\n @state.following.push( TOKENS_FOLLOWING_uri_IN_category_actions_470 )\n next_act = uri\n @state.following.pop\n # --> action\n array << ( next_act && @input.to_s( next_act.start, next_act.stop ) ) \n # <-- action\n\n else\n break # out of loop for decision 16\n end\n end # loop for decision 16\n match( QUOTE, TOKENS_FOLLOWING_QUOTE_IN_category_actions_477 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 10 )\n\n end\n \n return array\n end",
"def opening_lines \n puts \"What would you like to do?\"\n puts \"(C)reate, (L)ist, (U)pdate, (D)elete, (Q)uit\"\n end",
"def actions\n %w[credit]\n end",
"def actions\n @actions\n end",
"def action_strs=(actions)\n @action_strs = actions\n if !@action_strs.is_a?(Array)\n @action_strs = [@action_strs]\n end\n end",
"def lines_above_method\n added_lines = []\n lines_to_add = []\n block_level = 0\n ensure_line_breaks(controller_content.lines).first(action_line).reverse_each do |line|\n if line =~ /\\s*\\bend\\b\\s*/\n block_level += 1\n end\n if block_level > 0\n lines_to_add << line\n else\n added_lines << line\n end\n if line =~ /\\s*\\b(module|class|def)\\b /\n break\n end\n next unless line =~ /do\\s*(\\|.*?\\|)?\\s*$/\n block_level -= 1\n if block_level == 0\n added_lines.concat(lines_to_add)\n lines_to_add = []\n end\n end\n return added_lines.reverse.join\n end",
"def th_actions(*args)\n return '' if args.empty?\n th_header = <<-END\n<span class=\"actions\">\n #{args.each_slice(2).map do |text,js|\n %Q{<a onclick=\"#{ERB::Util.h js}\">#{ERB::Util.h text}</a>}\n end.join(' - ')}\n</span>\nEND\n return th_header.html_safe\n end",
"def list\n List.from_response client.get(\"/actions/#{action_id}/list\")\n end",
"def _lex_actions; end",
"def action(text)\n reply(\"\\001ACTION #{text}\\001\")\n end",
"def next_actions!\n actions = migrate_actions :mapper\n actions += migrate_actions :reducer\n actions += reduce_actions\n actions += map_actions\n actions += finalize_actions\n actions\n end",
"def action_cells(actions, prefix = nil)\n return if actions.blank?\n actions = [actions] if !actions.respond_to?(:each)\n actions = [:show, :edit, :destroy] if actions == [:all]\n actions.each_with_index do |action,index|\n if prefix.is_a?(Array)\n prefix_element = prefix[index]\n unless prefix_element\n prefix_element = prefix[0]\n end\n else\n prefix_element = prefix\n end\n action_link(action.to_sym, prefix_element)\n end\n end",
"def add_actions(count)\n update_attributes(actions: actions + count)\n end",
"def make_command_list\n add_command(\"Start\", :new_game)\n add_command(\"Continue\", :continue, continue_enabled)\n add_command(\"Quit\", :shutdown)\n end",
"def content_action_list(&block)\n concat tag(:ul, :class => \"contentActionNavi\"), block.binding \n concat capture(&block), block.binding\n concat \"</ul>\", block.binding\n concat probono_clear_class, block.binding\n end",
"def default_actions\n @actions = []\n @actions << 'add_trace' if logged_in?\n @actions << 'search' if logged_in?\n end",
"def list_commands\n puts UI_ARROW.light_yellow + \" \" + \"'fight', 'f', or 'battle' to view enemies and fight.\"\n puts UI_ARROW.light_yellow + \" \" + \"'armoury' or 'a' to go to the armoury.\"\n puts UI_ARROW.light_yellow + \" \" + \"'stats' to view your current status.\"\n puts UI_ARROW.light_yellow + \" \" + \"'clear' or 'cls' to clear the screen.\"\n puts UI_ARROW.light_yellow + \" \" + \"'quit', 'q', or 'exit' to abandon your journey.\"\nend",
"def actions; end",
"def expand_actions(actions)\n actions.map do |action|\n aliased_actions[action] ? [action, *expand_actions(aliased_actions[action])] : action\n end.flatten\n end",
"def print_menu\n puts \"Which action [list|add|delete|mark|idea|quit]?\"\nend",
"def actions\r\n return @actions\r\n end",
"def interaction_actions\n actions = []\n actions << Action.new(label: \"Leave\", key: :leave)\n actions |= interaction_processor.available_actions\n actions\n end",
"def actions=(action)\n @actions << action \n end",
"def translate\n @actions.each do |a|\n self.send(:\"parse_#{a['type'].gsub('-','_')}\", a)\n end\n @output = @output.split(\"\\n\").collect {|l| l.strip}.join(\"\\n\")\n end",
"def make_command_list\n add_command(NEW_ICON, :new)\n add_command(ITEM_ICON, :item)\n add_command(WEAPON_ICON, :weapon)\n add_command(ARMOR_ICON, :armor)\n add_command(HEAD_ICON, :head)\n add_command(ARM_ICON, :arm)\n add_command(ACCESSORY_ICON, :accessory)\n add_command(FOOD_ICON, :food)\n add_command(MATERIAL_ICON, :material)\n add_command(KEY_ITEM_ICON, :key_item)\n end",
"def display_possible_actions\n available_actions = \"\"\n Action.where({ state_id: session['state_id'] }).find_each do |trigger|\n if trigger.trigger[0] != '.'\n available_actions += trigger.trigger + \" \"\n end\n end\n actions_list = available_actions.strip.split.join(\", \")\n action = \"Maybe try one of: #{actions_list}\"\n update_state_log('system', action)\n action\n end",
"def list_commands\n puts UI_ARROW.light_yellow + \" \" + \"'fight', 'f', or 'battle' to view enemies and fight.\"\n puts UI_ARROW.light_yellow + \" \" + \"'armoury' or 'a' to go to the armoury.\"\n puts UI_ARROW.light_yellow + \" \" + \"'stats' to view your current status.\"\n puts UI_ARROW.light_yellow + \" \" + \"'clear' or 'cls' to clear the screen.\"\n puts UI_ARROW.light_yellow + \" \" + \"'quit', 'q', or 'exit' to abandon your journey.\"\n puts\nend",
"def actions\n if @title == 'Action Items'\n @actions\n else\n Agenda.find('Action-Items').actions[@title]\n end\n end",
"def upmin_actions(*actions)\n if actions.any?\n # set the actions\n @upmin_actions = actions.map{|a| a.to_sym}\n end\n @upmin_actions ||= []\n return @upmin_actions\n end",
"def commands(list)\n @commands = list.chars\n end",
"def handle_line_action()\n if line_action_handler.class == Proc\n # Custom handler\n line_action_handler.call(lpos)\n else\n # Generic default action\n cur_nonwhitespace_word_action()\n end\n end",
"def do_stuff more_actions=[], num_actions=5\n actions = []\n num_actions.times do\n actions.push ((['move', 'eat', 'nap'] + more_actions).sample)\n end\n actions.each do |action|\n m = method action\n m.call\n end\n puts \"#{@name} is done doing stuff!\"\n end",
"def log(action, *args)\n say format('%15s %s', action, args.join(' '))\n end",
"def make_command_list\n add_command(Vocab::SKILLS, :skills, main_commands_enabled)\n add_command(Vocab::CAPACITIES, :capacities, main_commands_enabled)\n add_command(Vocab::EQUIP, :equip, main_commands_enabled)\n add_command(Vocab::LEARNING, :learning, main_commands_enabled)\n add_command(Vocab::LIBRAIRIES, :librairies, main_commands_enabled)\n add_command(Vocab::ITEM, :item, main_commands_enabled)\n add_command(Vocab::CRAFTING, :crafting, main_commands_enabled)\n add_command(Vocab::STRATEGY, :strategy, main_commands_enabled)\n add_command(Vocab::COOKING, :cooking, main_commands_enabled)\n add_command(Vocab::SYSTEM, :system, main_commands_enabled)\n end",
"def actions\n client.actions\n end",
"def function(action1, action2, action3)\n puts \"To '#{action1}', '#{action2}', or '#{action3}' a function all mean the same thing.\"\nend",
"def actions(enemy)\n puts \"What will #{@name} do? They may:\"\n @actions.each_with_index{|a, i| puts \"#{i+1}) #{a.unCamelize}\"}\n #maybe instead of this, look at all the defined action method names and list them?\n userMethod = Rules.userInput\n (userMethod.to_i.to_s == userMethod) ? userMethod = @actions[userMethod.to_i-1] : userMethod = userMethod.camelize\n (@actions.include? userMethod) ? Actions.method(userMethod).call(self, enemy) : (puts \"#{@name} attempts to #{userMethod.unCamelize}... Nothing happens.\") \n end",
"def actions\n act = []\n act << 'capture' if can_capture? payment\n act << 'void' if can_void? payment\n act\n end",
"def accept_list_end list\n @res << \"\\n\"\n\n super\n end",
"def actions\n html_str = ''\n if object.status.to_sym == :pending\n html_str << \"#{context.approve_redemption_button(object)}\"\n html_str << \"#{context.deny_redemption_button(object)}\"\n elsif object.status.to_sym != :denied\n if object.reward.provider_reward?\n html_str << \"#{context.redemption_view_details_link(object)}\"\n else\n if object.additional_instructions.present?\n html_str << \"<div>#{context.redemption_view_additional_instructions_link(object)}</div>\"\n end\n end\n end\n html_str\n end",
"def batch_actions_to_display\n @batch_actions.select do |batch_action|\n call_method_or_proc_on(self, batch_action.display_if_block)\n end\n end",
"def actions\n return @actions\n end",
"def build_actions(path, polls = read_polls_data)\n permissions = get_permissions(path, polls)\n vote_link = \"<a href = \\\"/polls/#{path}/vote\\\">Vote</a>\"\n\n delete_button = get_delete_button(path)\n reset_button = get_reset_button(path)\n\n actions = ''\n actions += \" #{vote_link}\" if permissions.include?('vote')\n actions += \" #{delete_button}\" if permissions.include?('delete')\n actions += \" #{reset_button}\" if permissions.include?('reset')\n\n actions\n end",
"def parse_actions(action_list)\n @actions = {}\n\n if action_list == nil\n return\n end\n action_list.css('action').each do |action|\n name = action.at('name').text.strip\n\n raise Error, \"insecure action name #{name}\" unless name =~ /\\A\\w*\\z/\n\n\n @actions[name] = parse_action_arguments action.at('argumentList')\n end\n end",
"def define_methods_from_actions(action_list)\n log \"<#{self.class}> Defining methods; action list: #{action_list}\"\n\n if action_list.is_a? Hash\n @action_list << action_list\n define_method_from_action(action_list[:name].to_sym,\n action_list[:argumentList][:argument])\n elsif action_list.is_a? Array\n action_list.each do |action|\n=begin\n in_args_count = action[:argumentList][:argument].find_all do |arg|\n arg[:direction] == 'in'\n end.size\n=end\n @action_list << action\n args = action[:argumentList] ? action[:argumentList][:argument] : {}\n define_method_from_action(action[:name].to_sym, args)\n end\n else\n log \"<#{self.class}> Got actionList that's not an Array or Hash.\"\n end\n end",
"def append_action actions\n params = {}\n instance_variables.each do | each |\n params[ each.to_s.sub( '@', '' ).to_sym ] = instance_variable_get( each )\n end\n method = \"append_#{ self.class.name.demodulize.underscore }\"\n __send__ method, actions, params\n end",
"def do_action(action)\n\t\tcase action\n\t\twhen 'list'\n\t\t\tlist()\n\t\twhen 'find'\n\t\t\tputs 'Finding...'\n\t\t\tfind()\n\t\twhen 'sort'\n\t\t\tsort()\n\t\twhen 'add'\n\t\t\tadd()\n\t\twhen 'quit'\n\t\t\treturn :quit\n\t\telse\n\t\t\tputs \"\\nI don't understand that command.\\n\"\n\t\tend\n\tend",
"def make_command(action, args = [])\n command = @commands[action.to_sym]\n command += \" '\" + args.join(' ') + \"'\" unless args.empty?\n\n command\n end",
"def join\n @history.map { |command| command.join(' ') }.join(' && ')\n end",
"def parse_action_txt(action_txt, index)\n begin\n reset_parse_action_txt\n set_action_txt(action_txt)\n set_action_txt_index(index)\n set_action_txt_player_name\n set_whole_action_txt\n set_stripped_action\n set_amount\n set_action_txt_player\n create_action\n reset_parse_action_txt\n rescue RuntimeError => error\n puts error\n reset_parse_action_txt\n end\n puts \"------------------------------\"\n end",
"def to_s\n ACTIONS.keys.map do |action|\n send(action.to_sym)\n end.join('')\n end",
"def list_attractions\n RhodyAttractions::Attraction.all.each do |attraction|\n attraction.print_description(\"short\")\n puts \"\"\n end\n end",
"def make_command_list\n add_command(Vocab.reg_username_cmd, :name)\n add_command(Vocab.reg_avatar_cmd, :avatar)\n add_command(Vocab.change_title, :title)\n add_command(Vocab.reg_submit_cmd, :register, @registration_ok)\n end",
"def actions=(value)\n @actions = value\n end",
"def fancy_newline\n @results += '|'\n newline\n end",
"def command_list m\n get_list escape m.channel.to_s #logic/pug\n end",
"def make_command_list\n @categories.each { |cat| \n add_command(\"\", cat, false, QuestData::ICONS[cat]) }\n end",
"def run_actions; end",
"def action(dests, text)\n msg = \"PRIVMSG #{comma_join(dests)} :\\001ACTION #{text}\"\n msg = truncate(msg, 1)\n send_msg(msg << \"\\001\")\n end",
"def defaultrule(&action)\n @open_states.each do |o|\n @state_rules[o][\".\\n\"] = action\n end\n end",
"def newline!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 100 )\n\n type = NEWLINE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 914:5: ( '\\\\n' | '\\\\r' )+\n # at file 914:5: ( '\\\\n' | '\\\\r' )+\n match_count_29 = 0\n while true\n alt_29 = 2\n look_29_0 = @input.peek( 1 )\n\n if ( look_29_0 == 0xa || look_29_0 == 0xd )\n alt_29 = 1\n\n end\n case alt_29\n when 1\n # at line \n if @input.peek(1) == 0xa || @input.peek(1) == 0xd\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n match_count_29 > 0 and break\n eee = EarlyExit(29)\n\n\n raise eee\n end\n match_count_29 += 1\n end\n\n # --> action\n channel = HIDDEN \n # <-- action\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__, 100 )\n\n end",
"def actions\n res = []\n res << :capture if payment.pending?\n res << :void if payment.completed?\n res\n end",
"def actions\n res = []\n res << :capture if payment.pending?\n res << :void if payment.completed?\n res\n end",
"def make_command_list\n add_command(Vocab::MANUAL, :manual, manual_enabled?)\n add_command(Vocab::SEMI_AUTO, :semi_auto)\n add_command(Vocab::AUTO, :auto)\n end",
"def action(&block)\n @actions << block\n end",
"def add_action(action)\n if [email protected]?(action)\n @actions << action\n @actions.flatten!\n end\n end",
"def join_with_indent_or_spaces(args)\n if args.count >= 5\n joined = args.join(\",\\n \")\n \"\\n #{joined}\"\n else\n args.join(', ')\n end\n end",
"def write_commands(list)\n raise 'list must be an array!' unless list.kind_of?(Array)\n\n File.open(nagios_command_file, 'a') do |fh|\n fh.write(list.join(\"\\n\"))\n end\n end",
"def actionName _args\n \"actionName _args;\" \n end",
"def file_action_list(section)\n logger.info 'Section is: ' + section\n case section\n when 'Delete'\n %w[Delete]\n when '', nil\n %w[Add Update]\n else\n %w[Add Update Delete]\n end\n end",
"def action_list\n case\n when no_servers_or_positive_balance? then clear_notifications\n when before_shutdown_warnings? then before_shutdown_actions\n when perform_shutdown? then shutdown_servers_actions\n when before_destroy_warnings? then before_destroy_actions\n when perform_destroy? then destroy_servers_actions\n else no_actions\n end\n end",
"def actionlist_safe(list)\n return list unless (prompt? or skip?)\n return list if list.empty?\n safe = []\n dups = []\n list.each do |action, loc, tname, fname, opts|\n dups << [action, loc, tname, fname, opts, (output + fname).file?]\n end\n puts \"Select (y/n) which files to overwrite:\\n\" if prompt? unless quiet?\n dups.each do |action, loc, tname, fname, opts, check|\n if check\n if skip?\n safe << [:skip, loc, tname, fname, opts]\n else\n f = relative_to_output(fname)\n case ans = ask(\" #{f}? \").downcase.strip\n when 'y', 'yes'\n safe << [action, loc, tname, fname, opts]\n else\n safe << [:skip, loc, tname, fname, opts]\n end\n end\n else\n safe << [action, loc, tname, fname, opts]\n end\n end\n puts\n return safe\n end",
"def default_context_menu\n [\n :row_counter.action,\n \"-\",\n :ctrl_manage.action,\n :show_details.action, # The custom action defined below via JS\n \"-\", # Adds a separator\n *super # Inherit all other commands\n ]\n end",
"def print_formatted_action(msg, opts={})\n m = [self.timestamp] + msg\n\n unless opts[:no_truncate]\n if m.map(&:first).join(' ').length > self.term_width\n fixed_length = m[0,2].map(&:first).join(' ').length\n m[2][0] = m[2][0][0,(term_width - fixed_length - 4)] + ' … '\n end\n end\n\n o = []\n m.each_with_index do |e,i|\n val, colors = e\n colors.each do |c|\n val = val.send c\n end\n o << val\n end\n\n puts o.join ' '\n end"
] | [
"0.6600519",
"0.60031545",
"0.59979725",
"0.59924996",
"0.59924996",
"0.59924996",
"0.5932228",
"0.58856696",
"0.5872141",
"0.5813266",
"0.57589763",
"0.5752623",
"0.57341725",
"0.5712437",
"0.5682996",
"0.5682996",
"0.56825763",
"0.5673276",
"0.5631639",
"0.5614074",
"0.56135184",
"0.5606048",
"0.5585051",
"0.5570026",
"0.5556237",
"0.55118865",
"0.54772043",
"0.54520863",
"0.5421582",
"0.54213506",
"0.539904",
"0.5397216",
"0.5390432",
"0.5384773",
"0.53774893",
"0.5372246",
"0.5364558",
"0.5351051",
"0.5350147",
"0.532585",
"0.5314959",
"0.5304281",
"0.5299792",
"0.52947825",
"0.5277818",
"0.52743983",
"0.52681994",
"0.52671933",
"0.52631474",
"0.5259311",
"0.52544034",
"0.52522147",
"0.52508783",
"0.5228781",
"0.5227015",
"0.5216704",
"0.52096903",
"0.5209247",
"0.5208968",
"0.520532",
"0.518517",
"0.51846325",
"0.5184121",
"0.5178099",
"0.517597",
"0.51568556",
"0.51519614",
"0.5137277",
"0.5137073",
"0.5136064",
"0.5131746",
"0.5131267",
"0.5127892",
"0.5124892",
"0.51198626",
"0.51151764",
"0.51102906",
"0.51077753",
"0.5100548",
"0.50898904",
"0.5089438",
"0.5084665",
"0.508254",
"0.506231",
"0.50602114",
"0.5055117",
"0.5051139",
"0.5046497",
"0.5046497",
"0.5045753",
"0.5044537",
"0.5037562",
"0.5034597",
"0.50327617",
"0.50286406",
"0.5027992",
"0.50273186",
"0.50272256",
"0.50264096",
"0.5023418"
] | 0.60092807 | 1 |
Apply filters to optimally format content for display on Twitter. | def filter(str)
FILTERS.each do |f|
str = f.filter(str)
end
str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_twitter(options)\n $client_stream.filter(options) do |tweet|\n if tweet.is_a?(Twitter::Tweet)\n puts tweet.text\n spam(tweet)\n end\n end\n end",
"def sanitize(body)\n # If a tweet contains a long string of non breaking letters it breaks the layout of the widget.\n # Using CSS doesn't seem to work so this is a quick & dirty hack to force words to wrap.\n body = body.split.map do |word| \n word.size > 30 ? word.chars.each_slice(30).to_a.map { |arr| arr.push('-').join }.join[0..-2] : word\n end\n body.join(\" \").gsub(/[@#]?(coffee|xero)/i) { |match| \"<span class='twitter-#{match.downcase.gsub(/[#@]/,'')}'>#{match}</span>\" }\nend",
"def filter_twitter(options)\n $client_stream.filter(options) do |tweet|\n if tweet.is_a?(Twitter::Tweet)\n puts tweet.text\n #spam(tweet)\n end\n end\n end",
"def default_text_filter\n # blog.text_filter.to_text_filter\n end",
"def apply_filter\n end",
"def filter(text, *filters)\n filters.inject(text) do |text,method_name|\n send(method_name, text)\n end\n rescue => boom\n \"<p><strong>Boom!</strong></p><pre>#{escape_html(boom.to_s)}</pre>\"\n end",
"def filter(text, *filters)\n filters.inject(text) do |text,method_name|\n send(method_name, text)\n end\n rescue => boom\n \"<p><strong>Boom!</strong></p><pre>#{escape_html(boom.to_s)}</pre>\"\n end",
"def ts_apply_filters\n # TODO: Make filters for Thinking Sphinx\n end",
"def entry_body(entry=@entry)\n filter(entry.body, entry.filter)\n end",
"def entry_body(entry=@entry)\n filter(entry.body, entry.filter)\n end",
"def trailer_filter(text)\n text.gsub(FILTER_REGEXP) do |author_match|\n label = $~[:label]\n \"#{label} #{parse_user($~[:author_name], $~[:author_email], label)}\"\n end\n end",
"def filter \n sex_filter = LanguageFilter::Filter.new(matchlist: :sex, exceptionlist: [], replacement: :vowels) \n hate_filter = LanguageFilter::Filter.new(matchlist: :hate, exceptionlist: [], replacement: :vowels) \n profanity_filter = LanguageFilter::Filter.new(matchlist: :profanity, exceptionlist: [], replacement: :vowels) \n violence_filter = LanguageFilter::Filter.new(matchlist: :violence, exceptionlist: [], replacement: :vowels) \n if profanity_filter.match?(@rating.description) \n flash[:warning] = \"Your post has been sanitized for the following profane language: #{profanity_filter.matched(@rating.description)}.\"\n @rating.description = profanity_filter.sanitize(@rating.description)\n @rating.save \n elsif hate_filter.match?(@rating.description) \n flash[:warning] = \"Your post has been sanitized for the following hate language: #{hate_filter.matched(@rating.description)}.\"\n @rating.description = hate_filter.sanitize(@rating.description)\n @rating.save \n elsif sex_filter.match?(@rating.description) \n flash[:warning] = \"Your post has been sanitized for the following sex language: #{sex_filter.matched(@rating.description)}.\"\n @rating.description = sex_filter.sanitize(@rating.description)\n @rating.save \n elsif violence_filter.match?(@rating.description)\n flash[:warning] = \"Your post has been sanitized for the following violent language: #{violence_filter.matched(@rating.description)}.\"\n @rating.description = violence_filter.sanitize(@rating.description)\n @rating.save \n else\n end\n end",
"def filters; end",
"def filters; end",
"def process_text text\n @filter.process(Blogitr.expand_macros(@filter, text))\n end",
"def clean_tweets(results)\n results.first($number_of_tweets).map(&:text).join.gsub(URLS,\"\").gsub(HANDLES_AND_ADV_TWITTER,\"\").squeeze(\" \")\nend",
"def filter_content( content ) \n\t \n\t # we do not want to touch the reference\n\t filtered_content = content.dup\n\t \n\t # replaces [[File:file.jpg]] or [[File:file.png]] or [[File:file.gif]] \n # with \n # <img src=\"upload/images/file.ext height=300px border=\"0\" ALIGN=RIGHT />\n \n url_image_root_path = url_for :controller=>\"upload/images\"\n img_link_prefix = '<img src=\"' + url_image_root_path + '/'\n img_link_postfix = '\" height=300px border=\"0\" ALIGN=RIGHT />'\n filtered_content.gsub!(/(\\[\\[)([Ff]ile:)([\\w\\.]+)(\\.png|\\.jpg|\\.jpeg|\\.gif)(\\]\\])/, img_link_prefix + '\\3\\4' + img_link_postfix)\n \n \n # replaces [[File:file.wav]] or [[File:file.mp3]] \n # <embed src=\"/audio/file.ext\" width=\"140\" height=\"60\" loop=false autostart=false>\n\n url_audio_root_path = url_for :controller=>\"upload/audio\"\n audio_link_prefix = '<embed src=\"' + url_audio_root_path + '/'\n audio_link_postfix = '\" width=\"140\" height=\"60\" loop=false autostart=false>'\n filtered_content.gsub!(/(\\[\\[)([Ff]ile:)([\\w\\.]+)(\\.wav|\\.mp3)(\\]\\])/, audio_link_prefix + '\\3\\4' + audio_link_postfix)\n\n \n filtered_content\n end",
"def filter_content \n\t\tself.title = ActionView::Base.full_sanitizer.sanitize(self.title)\n\t\tself.slug = ActionView::Base.full_sanitizer.sanitize(self.slug)\n\t\tself.meta_title = ActionView::Base.full_sanitizer.sanitize(self.meta_title)\n\t\tself.meta_keyword = ActionView::Base.full_sanitizer.sanitize(self.meta_keyword)\n\t\tself.meta_description = ActionView::Base.full_sanitizer.sanitize(self.meta_description)\n\t\tself.page_class = ActionView::Base.full_sanitizer.sanitize(self.page_class)\n\tend",
"def unfiltered_content; end",
"def unfiltered_content; end",
"def unfiltered_content; end",
"def twitter_format(text)\n auto_link(text.dup).html_safe\n end",
"def index\n flash[:notice] = \"Only twitter feeds are supported for now.\"\n clean_select_multiple_params\n @filterrific = Filterrific.new(\n Tweet,\n params[:filterrific] || session[:filterrific_tweets]\n )\n \n @tweets = Tweet.includes(:keyword).where(:client=>current_client).filterrific_find(@filterrific).page(params[:page])\n @gtweets = @tweets.group_by {|t| t.keyword}\n session[:filterrific_students] = @filterrific.to_hash\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def embedding_tweet(content)\n embedded_content = content\n content.scan(/(https?:\\/\\/twitter\\.com\\/[a-zA-Z0-9_]+\\/status\\/([0-9]+)\\/?)/).each do |url, id|\n tweet_json = open(\"https://api.twitter.com/1/statuses/oembed.json?id=#{id}\").read\n tweet_html = JSON.parse(tweet_json, { :symbolize_names => true })[:html]\n embedded_content = embedded_content.gsub(/#{url}/, tweet_html)\n end\n embedded_content\nend",
"def embedding_tweet(content)\n embedded_content = content\n content.scan(/(https?:\\/\\/twitter\\.com\\/[a-zA-Z0-9_]+\\/status\\/([0-9]+)\\/?)/).each do |url, id|\n tweet_json = open(\"https://api.twitter.com/1/statuses/oembed.json?id=#{id}\").read\n tweet_html = JSON.parse(tweet_json, { :symbolize_names => true })[:html]\n embedded_content = embedded_content.gsub(/#{url}/, tweet_html)\n end\n embedded_content\nend",
"def getTwitters(searchTerm)\n # url encoding the searchterm\n searchTerm = CGI::escape(searchTerm)\n \n # grabbing the search results for the given searchTerm from summize as a REXML document\n doc = REXML::Document.new open(\"http://summize.com/search.atom?lang=en&rpp=100&q=#{searchTerm}\").read\n \n # this part swaps the current @content stack with the search result\n @content.clear {\n doc.elements.each(\"feed/entry\") do |element|\n stack(:width => 500, :height => 80) do\n fill \"#282828\"..\"#141414\", :angle => 180\n rect 0, 0, 500, 80, 5\n flow(:margin_left => 5, :margin_top => 5) do\n flow(:width => 50) do\n #clicking on avatar => visit the person's twitter profile in a webbrowser\n click do\n visit(element.elements['author'].elements['uri'].text)\n end\n \n element.each_element_with_attribute('rel', 'image', 1) do |pic|\n image pic.attributes['href'] # downloads and displays avatar\n end\n end\n flow(:width => 440) do\n # clicking on message => visit the message on twitter in a webbrowser\n click do\n element.each_element_with_attribute('rel', 'alternate', 1) do |profile|\n visit(profile.attributes['href'])\n end\n end\n \n inscription getFormattedTime(element.elements[\"published\"].text), :stroke => orange\n para element.elements[\"title\"].text, :stroke => white\n end\n end\n end\n end\n }\n end",
"def add_term_filters\n body.filter(:term, posted: true)\n body.filter(:term, hidden_by_admin: false)\n body.filter(:term, restricted: false) unless include_restricted?\n body.filter(:term, unrevealed: false) unless include_unrevealed?\n body.filter(:term, anonymous: false) unless include_anon?\n body.filter(:term, chapter_count: 1) if options[:single_chapter]\n\n %i(complete language crossover).map do |field|\n value = options[field]\n body.filter(:term, field => value) unless value.nil?\n end\n add_tag_filters\n end",
"def twitt\n if PLANETOID_CONF[:twitter][:entries][:send_twitts] && self.published > self.feed.created_at\n twit=Twitter::Base.new(Twitter::HTTPAuth.new(PLANETOID_CONF[:twitter][:user], PLANETOID_CONF[:twitter][:password]))\n twit.update \"#{PLANETOID_CONF[:twitter][:entries][:prefix]} #{self.title[0..150]} #{self.url}\"\n end\n end",
"def crosspost toot\n content = Decoder.decode(toot.content\n .gsub(/(<\\/p><p>|<br\\s*\\/?>)/, \"\\n\")\n .gsub(/<(\"[^\"]*\"|'[^']*'|[^'\">])*>/, '')\n .gsub('*', '*'))\n \n # replaces any mention in the post with the account's URL\n unless toot.mentions.size.zero?\n toot.mentions.each do |ment|\n content.gsub!(\"@#{ment.acct.split('@').first}\", ment.url)\n end\n end\n \n return if not @filter.nil? and content =~ @filter\n return if content.empty? and toot.media_attachments.size.zero?\n\n parent_toot = @masto_rest.status(toot.in_reply_to_id) unless toot.in_reply_to_id.nil?\n\n old_cw = parent_toot.spoiler_text unless parent_toot.nil?\n cw = toot.spoiler_text unless toot.spoiler_text.empty? or toot.spoiler_text == old_cw\n \n content = \"cw: #{cw}\\n\\n#{content}\" unless cw.nil?\n \n uploaded_media = false\n \n @retries = 0\n thread_ids = []\n while not content.empty? or\n (not toot.media_attachments.size.zero? and not uploaded_media)\n trimmed, content = trim_post(content)\n trimmed += \"…\" unless content.empty?\n tweet = nil\n reply_id = thread_ids.last || @ids[toot.in_reply_to_id]\n \n puts \"attempting to tweet \" + trimmed.length.to_s + \" chars\"\n\n while @retries < MaxRetries and tweet.nil?\n begin\n if toot.media_attachments.size.zero? or uploaded_media\n tweet = @twitter.update(trimmed,\n in_reply_to_status_id: reply_id)\n else\n media = download_media(toot).collect do |file|\n file.end_with?('.mp4') ?\n File.open(file, 'r') :\n file\n end\n tweet = @twitter.update_with_media(trimmed,\n media,\n in_reply_to_status_id: reply_id)\n\n uploaded_media = true\n end\n rescue Twitter::Error::UnprocessableEntity,\n Twitter::Error::RequestEntityTooLarge,\n Twitter::Error::BadRequest => err\n # if we're at the last try to upload media\n # we see if we have room to add the link to the\n # media, otherwise we tack the links onto the end\n # of 'content' so it'll get threaded onto the op\n # if we're not on the last try we just add 1 and\n # print the error out like normal\n if @retries + 1 >= MaxRetries\n toot.media_attachments.each do |media|\n if trimmed.length + media.url.length <= MaxTweetLength\n trimmed << \" #{media.url}\"\n else\n content << media.url\n end\n end\n \n # this skips trying to upload the media anymore\n uploaded_media = true\n else\n @retries += 1\n pp err\n end\n rescue Twitter::Error => err\n @retries += 1\n pp err\n rescue StandardError => err\n pp err\n ensure\n # make sure we clean up any downloaded files\n unless media.nil? or media.empty?\n media.each do |file|\n file.close if File.basename(file).end_with? '.mp4'\n File.delete(file)\n end\n end\n end\n end\n \n break if @retries >= MaxRetries or tweet.nil?\n\n thread_ids << tweet.id\n @ids[toot.id] = tweet.id \n cull_old_ids\n save_ids\n end\n end",
"def parse_tweet_content (t)\n\t\tbegin\n\t\ttweet_id = t.xpath(\"@data-item-id\").text().to_s.strip\n\t\txpath = '//*[@id=\"stream-item-tweet-'+tweet_id+'\"]/div/div/div[1]/a/strong/text()'\n\t\tposter_name = t.xpath(xpath)\n\t\t#poster_name = t.xpath('//*[@id=\"stream-item-tweet-371766472051138560\"]/div/div/div[1]/a/strong/text()')\n\t\t#check if the poster is the current user!!\n\t\t#test_name = poster_name.partition(\" \").first\n\t\t#puts \"is of page owner real name:#{@real_name} poster name: #{poster_name}\"\n\t\tif @real_name.include?(poster_name.to_s)\t\t\n\t\t\t@is_of_page_owner = true\n\t\tend\n\t\t@max_tweet_id = tweet_id\n\t\tset_id(tweet_id)\n\t\t#puts tweet_id\n\t\ttweet_content = t.xpath(\"./div/div/p/text()\").to_s.strip\n\t\t#puts tweet_content\n\t\tset_content(tweet_content)\n\t\t#fetching retweets and favourites gets complicated\n\t\tif @is_of_page_owner\n\t\t\tfetch_retweet_favourites(t)\t\n\t\tend\n\trescue Exception => e\n\t\tLogWriter.error(e)\n\t\treturn self\n\tend\n\tend",
"def selective_tweet_shortener(tweet)\n # tweets.each do |tweet|\n new_tweet = \"\"\n if tweet.length > 140\n new_tweet = word_substituter(tweet)\n else\n new_tweet= tweet\n end\n # end\n new_tweet\nend",
"def render_for_twitter(black_card, white_cards)\n text = black_card.text.dup\n white_card_words = white_cards.map { |x| x.text }\n\n pattern = /<blank\\/>/\n\n # insert the words inline\n while (!text.index(pattern).nil?)\n text.sub!(/<blank\\/>/, \"‹#{white_card_words.shift}›\")\n end\n\n # Stick anything left over at the end.\n if (white_card_words.count > 0)\n text = text + \" \" + english_print(white_card_words) + \".\"\n end\n\n # One card uses <em> that we can't represent on Twitter.\n text.gsub!(/<em>/, \"\")\n text.gsub!(/<\\/em>/, \"\")\n\n # Some cards have forced linebreaks.\n text.gsub!(/<br\\/>/, \"\\n\")\n\n # Fix up HTML entities.\n text.gsub!(/“/, codepoint('\\u201c'))\n text.gsub!(/”/, codepoint('\\u201d'))\n text.gsub!(/®/, codepoint('\\u00ae'))\n text.gsub!(/‹/, codepoint('\\u2039'))\n text.gsub!(/›/, codepoint('\\u203a'))\n text.gsub!(/í/, codepoint('\\u00ed'))\n text.gsub!(/&/, '&')\n\n return text\n end",
"def twitter\n @user = User.find(session[:user_id])\n t = @user.twitter\n unless t.present?\n redirect_to @user, :notice => \"Please add your twitter account!\"\n return\n end\n @tweets = t.home_timeline\n @posts = []\n @tweets.each do |tweet|\n if Post.exists?(:tweet_id => tweet[:id])\n @posts.push(Post.find_by_tweet_id(tweet[:id]))\n else\n p = Post.new\n p.tweet_id = tweet[:id]\n p.tweeter_twitter_id = tweet[:user][:id]\n if User.exists?(:twitter_id => tweet[:user][:id])\n p.user_id = User.find_by_twitter_id(tweet[:user][:id]).id\n else\n p.user_id = -1\n end\n p.post_type = 3\n p.created_at = tweet[:created_at].to_datetime\n url = \"https://api.twitter.com/1/statuses/oembed.json?id=#{tweet[:id]}&omit_script=true\"\n begin\n tweet_page = open(URI.parse(url))\n p.body = JSON.parse(tweet_page.read)['html']\n if p.save!\n @posts.push(p)\n end\n rescue\n # Tried to access a protected tweet, just skip it\n end\n end\n end\n\n @body_class = 'twitter-background'\n respond_to do |format|\n format.html # twitter.html.erb\n format.json { render json: @posts }\n end\n end",
"def clean_entries(feed)\n full_sanitizer = Rails::Html::FullSanitizer.new\n feed.entries.map do |entry|\n clean_summary = full_sanitizer.sanitize(entry.summary)\n clean_sentences(clean_summary)\n end\n end",
"def add_filters(filters); end",
"def tweet_list(options)\n content_for :javascripts do\n %Q[ <script type=\"text/javascript\">\n $(function(){function e(e){output=\"\";\n $.each(e,function(e,n){output+='<li class=\"refinery-tweets-list-item-'+e+\"\\\\\">\";\n output+=t(n.text);output+=\"</li>\"});\n $(\".refinery-tweets-list\").append(output)}\n function t(e){var t=/(\\\\b(https?|ftp|file):\\\\/\\\\/[-A-Z0-9+&@#\\\\/%?=~_|!:,.;]*[-A-Z0-9+&@#\\\\/%=~_|])/ig;\n return e.replace(t,\"<a href='$1'>$1</a>\")}$.ajax({\n url:\"https://api.twitter.com/1/statuses/user_timeline/#{account_settings[\"username\"]}.json?count=#{account_settings[\"tweet_count\"]}\",\n dataType:\"jsonp\",success:#{options[:callback] || \"function(t){e(t)}\"},error:function(e){console.log(e)}})})\n </script>].squish.html_safe\n end\n\n %Q[<ul class=\"refinery-tweets-list\">\n <h3>#{tweets_header}</h3>\n </ul>].html_safe\n end",
"def add_tag_filters\n return if options[:filter_ids].blank?\n options[:filter_ids].each do |filter_id|\n body.filter(:term, filter_ids: filter_id)\n end\n end",
"def parse_filters(topics, filters)\n unless filters[:sort]\n topics = topics.asc(:slug)\n end\n\n if filters[:limit] && filters[:limit].to_i < 100\n topics = topics.limit(filters[:limit])\n else\n topics = topics.limit(100)\n end\n\n if filters[:page]\n topics = topics.skip(filters[:limit].to_i * (filters[:page].to_i-1))\n end\n\n if filters[:type]\n if filters[:type] == 'category'\n topics = topics.where(:is_category => true)\n end\n end\n\n if filters[:sort] && filters[:sort] == 'popularity'\n topics = topics.map do |t|\n topic_ids = Neo4j.pull_from_ids(t.neo4j_id).to_a\n shares = PostMedia.where(:topic_ids => {\"$in\" => topic_ids << t.id})\n {\n :topic => t.as_json(:properties => :public),\n :count => shares.length\n }\n end\n topics.sort_by!{|t| t[:count] * -1}\n else\n topics = topics.map {|t| {:topic => t.as_json(:properties => :public)}}\n end\n\n topics\n end",
"def index\n friends = Friend.where(\"user_id=?\" , current_user&.id)\n \n #obtengo los amigos del usuario\n aux2 = friends.pluck :friend_id\n #saco los twitter de los amigos\n if params[:content].present?\n aux = TweetPost.where(user_id: aux2)\n aux2 = aux.where(\"post LIKE ?\", \"%#{params[:content]}%\")\n \n @tweet_posts = aux2.order(\"created_at DESC\").page(params[:page]).per_page(50)\n else\n aux = TweetPost.where(user_id: aux2)\n @tweet_posts = aux.order(\"created_at DESC\").page(params[:page]).per_page(50)\n end\n \n # @tweet_posts = TweetPost.order(\"created_at DESC\").page(params[:page]).per_page(5)\n end",
"def profanity_filter(time, profanity_filter)\n\t\tcensored_words = IO.read(profanity_filter).split(\"\\n\").each { |w| w.gsub!(\"\\n\",\"\") }\n\n\t\tsubtitles_object_list = get_subtitle_objects_in_file\n\n\t\tmodified_subtitles = modify_subtitles(time, censored_words, subtitles_object_list)\n\t\t\n\t\t#print modified subtitles in a file\n\t\tfile_content = get_text_from_subtitles(modified_subtitles)\n\t\tIO.write(@file, file_content)\n\tend",
"def bulk_tweet_shortener(tweets)\n tweets.each { |x| puts word_substituter(x)}\nend",
"def tweet_format message\n\n # We begin the hunt for links. The good news is that Slack marks them out for us!\n # Links look like:\n # <http://google.com>\n # or\n # <http://google.com|Google!>\n # We want to ignore the label, and just get the URL\n\n links = []\n message['text'].scan(/<(https?:\\/\\/.+?)>/).each do |m|\n url = m[0].split('|')[0]\n links.append url #URI.encode url\n end\n\n return nil if links.length == 0 #return nil if no links found\n\n # Just take the first link.\n\n response = Faraday.get links[0]\n\n # We are now in our own thread, operating asynchronously. We can take our time here.\n\n # First, we use Nokogiri to extract the page title.\n page = Nokogiri::HTML(response.body)\n page.css('script, link, style').each {|node| node.remove}\n title = page.css('title').text\n\n # Now craft a tweet message; remember max is 140 chars!\n\n # First, check the current max length of a t.co link wrapper\n # TODO\n t_co = 20\n length = title.length + t_co + 1 # 1 for the space.\n delta = length - 140\n if delta > 0\n title = title[0..-delta-2] + '…'\n end\n\n title + ' ' + links[0]\n end",
"def bulk_tweet_shortener (tweets)\n if(tweets.size > 0)\n tweets.each do |tweet_each|\n puts word_substituter(tweet_each)\n end\n end\nend",
"def default_tweets\n tweets = [\n { name: \"@xero\", body: sanitize(\"Coffee + Code = Beautiful Accounting #xero #coffee\"), avatar: \"https://pbs.twimg.com/profile_images/490207413933309952/_LiT6IcT_bigger.png\" },\n { name: \"@patnz\", body: sanitize(\"RT @Xero - Coffee + Code = Beautiful Accounting #xero #coffee\"), avatar: \"https://pbs.twimg.com/profile_images/124955173/avatar_bigger.jpg\" }\n ]\nend",
"def filter(data)\n data.delete_if { |key, value| value.nil? }\n %w(plot tagline overview).each do |key|\n if data[key].respond_to?('first')\n data[key] = data[key].first\n end\n data[key] = data[key].gsub(FILTER_HTML, '') unless data[key].blank?\n end\n data\n end",
"def bulk_tweet_shortener(tweets)\n tweets.each do |tweet|\n puts word_substituter(tweet)\n end\nend",
"def bulk_tweet_shortener(tweets)\n tweets.each do |tweet|\n puts word_substituter(tweet)\n end\nend",
"def html_clean_filters( src_key, tree_key = nil )\n\n tree_key = \"#{src_key}_tree\".to_sym unless tree_key\n src_key, tree_key = src_key.to_k, tree_key.to_k\n\n filters = []\n filters << html_parse_filter( src_key, tree_key )\n\n #FIXME: PAGE: filters << TitleExtractor.new, or after?\n\n # FIXME: if src is text, last filter\n # filters << TextCtrlWSFilter.new( ContentKeys::TITLE )\n\n tfc = TreeFilterChain.new( html_tree_filters )\n\n filters << HTMLTreeFilter.new( tree_key, tfc,\n HTMLTreeFilter::Order::DEPTH_FIRST )\n\n #FIXME: First block extractor back to text key?\n\n filters\n end",
"def filters\n end",
"def extract\n @tweets.each do |tweet|\n sw_filter(tweet.lang)\n .filter(tweet.attrs[:full_text].split.map { |w| w.downcase } )\n .each do |token|\n next unless is_word? token\n @working_space[token] << tweet.user.id\n end\n end\n end",
"def bulk_tweet_shortener(tweets)\n # puts tweets\n tweets.each {|tweet| puts word_substituter(tweet)}\nend",
"def bulk_tweet_shortener(tweets)\n tweets.each { |tweet|\n puts word_substituter(tweet)\n }\nend",
"def tweet_content(index)\n raise Exceptions::InvalidTweet if index > tweet_count - 1 || index.negative?\n\n prepend(index) + format(content[index * tweet_size, tweet_size]) + pager(index)\n end",
"def selective_tweet_shortener(tweet)\nif tweet.length > 140\nword_substituter(tweet)\nelse tweet\nend\nend",
"def bulk_tweet_shortener(tweets)\n tweets.each do |tweet|\n output = word_substituter(tweet)\n puts output\n end\nend",
"def apply_filter(filters, content)\n # anything in the rule arrau form position 2 onwards is a Filter\n filtered = content\n \n # apply each filter in the rules\n filters.each do |filter_name|\n filter = FilterStore.get(filter_name)\n filtered = filter.call(filtered)\n end\n \n filtered\n end",
"def bulk_tweet_shortener(tweets)\n tweets.collect do |tweet|\n puts word_substituter(tweet)\n end\nend",
"def filter_by_extension\n if item[:extension] == \"haml\"\n filter :haml\n else\n filter :erb\n filter :kramdown, coderay_line_numbers: :table\n end\nend",
"def selective_tweet_shortener (tweet)\n if(tweet.length > 140)\n word_substituter(tweet)\n else\n tweet\n end\n\nend",
"def add_range_filters\n %i(word_count hit_count kudos_count comments_count bookmarks_count revised_at).each do |countable|\n next unless options[countable]\n range = Search::RangeParser.string_to_range(options[countable])\n body.filter(:range, countable => range) unless range.blank?\n end\n add_date_range_filter\n add_word_count_filter\n end",
"def bulk_tweet_shortener(tweets) \n tweets.each do |phrase|\n puts word_substituter(phrase)\n end\nend",
"def prepare_text\n feed_url = FeedUrl.where(:language_id => language_id).order(\"RANDOM()\").limit(1).first.try(:url)\n if feed_url && (feed = FeedNormalizer::FeedNormalizer.parse(feed_url))\n feed_text = feed.entries[0..3].map(&:content)\n self.text = ''\n feed_text.each do |ft|\n self.text += content_tag(:p, sanitize(HTMLEntities.new.decode(ft), :tags => \"\", :attributes => \"\"))\n end\n end\n end",
"def filter_tweets_with_urls tweets_array\n tweets_with_urls = []\n tweets_array.each do |tweets|\n tweets.each do |tweet|\n # TODO remove this, just for debugging\n# tweet.urls.each do |url|\n# p url.display_url\n# end\n tweets_with_urls << tweet unless tweet.urls.empty?\n end\n end\n tweets_with_urls\n end",
"def apply_filter(filter)\n return if !filter\n\n # It can be the artist id or an array of ids\n @artist_id = filter[:artistid] if filter[:artistid]\n @artist_id = @artist_id.is_a?(Array) ? @artist_id.map { |x| x.to_i } : @artist_id.to_i\n\n set_song_ids( filter[:songid] )\n set_play_list_song_ids( filter[:play_list_song_ids] )\n\n @album_id = filter[:album_id].to_i if filter[:album_id]\n @album_name = filter[:album_name] if filter[:album_name]\n @text = filter[:text] if filter[:text]\n end",
"def filter\n end",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n bulk_tweet_shortener(tweets)\n else\n tweet\n end\nend",
"def filter(query_params = {})\n [:follow, :track, :locations].each do |param|\n if query_params[param].is_a?(Array)\n query_params[param] = query_params[param].flatten.collect{|q| q.to_s}.join(',')\n elsif query_params[param]\n query_params[param] = query_params[param].to_s\n end\n end\n start('statuses/filter', query_params.merge(:method => :post))\n end",
"def selective_tweet_shortener(tweet)\n tweet.length > 140 ? word_substituter(tweet) : tweet\nend",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend",
"def parse_tweet(t)\n URI.extract(t, %w[ http https ftp ]).each do |url|\n t.gsub!(url, \"<a href=\\\"#{url}\\\">#{url}</a>\")\n end\n \t# auto-link @usernames\n \tt = linkup_mentions_and_hashtags(t)\n end",
"def index\n @filter = [params[:gothic], params[:flowers], params[:animals], params[:butterflies], params[:body_parts]]\n\n @style_array = [\"Gothic\", \"Flowers\", \"Animals\", \"Butterflies\"]\n @style_list = []\n @filter.each_with_index do |style, index|\n if style == \"on\"\n @style_list << @style_array[index]\n end\n end\n @tattoo_array_style = Tattoo.joins(:styles).where(styles: { name: @style_list })\n\n @body_part_list = @filter.last.split(',')\n @tattoo_array_body_part = Tattoo.joins(:body_parts).where(body_parts: { name: @body_part_list })\n\n @unfiltered_tattoo_array = @tattoo_array_body_part + @tattoo_array_style\n @filter_tattoos = @unfiltered_tattoo_array.select { |e| @unfiltered_tattoo_array.count(e) > 1 }.uniq\n\n end",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend",
"def selective_tweet_shortener(tweet)\n\tif tweet.size > 140\n\t\tword_substituter(tweet)\n\telse\n\t\ttweet\n\tend\nend",
"def prepare_feed_content(body)\n # Expand any relative URLs for links or images.\n body.gsub!(%r{(src|href)=([\"'])/}, '\\1=\\2https://ashfurrow.com/') unless body.nil?\n\n # Embed any YouTube videos\n require('lib/embed.rb')\n body.embed_items!\n\n # Remove width modifiers\n require('lib/modify_widths.rb')\n body.replace_width_modifiers_with! ''\n\n body\n end",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140 \n tweet = word_substituter(tweet)\n end\n tweet\nend",
"def filter_content_type\n case record.filter_id\n when '', 'WymEditor'\n return \"text/html\"\n when 'Textile', 'Markdown'\n return \"text/plain\"\n end\n end",
"def tweet\n \"<blockquote class='twitter-tweet' lang='en'><p lang='en' dir='ltr'>\" + tweet_text + \n \"</p>—\" + twitter_user + \"<a href='\" + twitter_url + \"'>\" + tweet_date + \n \"</a></blockquote><script async src='//platform.twitter.com/widgets.js' charset='utf-8'></script>\"\n end",
"def index\n #@tags = Entry.author_counts\n\t@filter = params[:filter]\n\t@sort_by = params[:sort_by]\n\t\n\tif (@filter)\n\t\t@entries = Entry.tagged_with(params[:filter], :order => @sort_by)\n\telse\n\t\t@entries = Entry.find(:all, :order => @sort_by)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n\t format.rss { render :rss => @entries }\n end\n end",
"def filter_tweets(screen_names)\n full_timeline(screen_names).each_with_object([]) do |tweet, memo|\n next if tweet.created_at > up_to_time\n memo << tweet if age_of_tweet_in_days(tweet) <= range\n end\n end",
"def filter\n @tweets_per_page = params[:number_of_results].to_i\n page_number = params[:page_number].to_i\n @total_tweets = Tweet.all.count\n\n @tweets = []\n\n # if we are on a page that isn't the first, we offset the tweets\n if page_number != 0\n @tweets = Tweet.limit(@tweets_per_page).offset(@tweets_per_page * (page_number - 1))\n else\n # otherwise we set page number to 1 so we don't display page 0\n @tweets = Tweet.first(@tweets_per_page)\n page_number = 1\n end\n\n @page_number = page_number\n\n render 'show_table'\n end",
"def apply_formatting(value, format = @place.content_format)\n case (format || :raw).to_sym\n when :html\n wiki_as_html(value)\n when :text\n wiki_as_text(value)\n else\n value\n end\n end",
"def fetch_tweets(criteria)\n @client.filter(track: criteria.theme) do |object|\n puts object.text if object.is_a?(Twitter::Tweet)\n end\n end",
"def parse_chat_for(post)\n post.body.gsub(/^.*$/i) { |line|\n content_tag :li do\n raw(line.gsub(/^\\w+:/i) { |author|\n content_tag :span, :class => \"author\" do\n author\n end\n })\n end\n }\n end",
"def erubis_filter(text)\n return text if text.nil?\n \n t = text.dup\n t.gsub!('<%', '<%')\n t.gsub!('%>', '%&rt;')\n t\n end",
"def parse_by_feednormalizer(feed_text)\n feed_data = FeedNormalizer::FeedNormalizer.parse feed_text\n feed_data.entries.map do|e|\n metadata = {:author => e.author} if e.author\n {:did=>(e.id || e.urls.join(\" \")), :title=>e.title,:content=>e.content,:basetime=>e.date_published, \n :metadata=>metadata, :uri=>e.urls.join(\" \"), :tag_list=>e.categories.join(\",\")}\n end\n end",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140 \n word_substituter(tweet)\n #\"...\"\n else\n tweet\n end\nend",
"def filters\n [\n GoHiring::SlackMarkdown::Filters::MergeMethodFilter,\n GoHiring::SlackMarkdown::Filters::HeaderFilter,\n GoHiring::SlackMarkdown::Filters::EmptyBlockFilter,\n GoHiring::SlackMarkdown::Filters::BlockBreakerFilter\n ]\n end",
"def filter; end",
"def filter; end",
"def filter; end",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n return tweet\n end\nend",
"def get_tweets(screen_name, num_tweets)\n\t\n\tresult = \"\"\n #Query num_tweets tweets from screen_name and create the HTML\n Twitter.user_timeline(screen_name, {\"count\" => num_tweets}).each do |tweet|\n \tlinkified = linkifyTweet(tweet.text)\n \tresult = result + \"<li class=\\\"tweet\\\">\n <span class=\\\"gentle\\\">#{linkified}</span>\n </li>\"\n end\n return result\nend",
"def tweets\n\t\tif session[:filtro] && !params[:filtro]\n\t\t\tparams[:filtro] = session[:filtro]\n\t\tend\n\t\t@filtro = ''\n\t\tif params[:filtro] && params[:filtro] != ''\n\t\t\t@tweets = Tweet.paginate(:conditions => ['bot_id = ? and estado = ?', @bot.id, params[:filtro]], :order => 'created_at DESC', :per_page => 20, :page => params[:page])\n\t\t\t@filtro = params[:filtro]\n\t\t\tsession[:filtro] = params[:filtro]\n\t\telse\n\t\t\tsession[:filtro] = nil\n\t\t\t@tweets = Tweet.paginate(:conditions => ['bot_id = ?', @bot.id], :order => 'created_at DESC', :per_page => 20, :page => params[:page])\n\t\tend\n\tend",
"def index\n @project = Project.find(params[:project_id])\n \n #depending if I am showing all entries or only the persons entries.\n @count = 0\n if params[:person_id] == nil\n @show_all = true\n @feed_entries = []\n @grouped_entries = []\n @grouped_by_hashtags = {}\n @grouped_by_replies = {}\n @grouped_urls = {}\n @feed_entries_count = @project.feed_entries_count\n @feed_entries = @project.feed_entries(1000).paginate :page => params[:page]\n \n \n #Get a distribution of collected tweets per person.\n @feed_entries_pp = {}\n @project.persons.each do |person|\n key = (FeedEntry.count(:conditions => \"person_id = #{person.id}\") / 100).to_i*100\n begin\n @feed_entries_pp[key] += 1\n rescue\n @feed_entries_pp[key] = 1\n end \n end\n @feed_entries_pp = @feed_entries_pp.sort{|a,b| a <=> b}\n\n @retweets_distr = {}\n @project.persons.each do |person| \n person.feed_entries.each do |f| \n key = f.retweet_count.to_i \n if key > 0\n begin\n @retweets_distr[key] += 1\n rescue\n @retweets_distr[key] = 1\n end\n end\n end\n end\n @retweets_distr = @retweets_distr.sort{|a,b| a <=> b}\n\n else \n @person = Person.find(params[:person_id])\n @feed_entries_count = @person.feed_entries.count\n @feed_entries = @person.feed_entries.paginate :page => params[:page], :order => 'updated_at DESC' \n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feed_entries }\n end\n end",
"def process \n \n #a = Account.oldest_used\n accounts = Account.order(:updated_at).all\n a = accounts.first\n\n tweets, data, self.temp_usernames = [],[],[]\n \n config = {:count => 100, :result_type => \"recent\" }\n config[:since_id] = self.last_tweet_id.to_i unless self.last_tweet_id.nil? \n \n while true\n r = a.tc.search(self.search + \" -rt -http -#ff\", config)\n break if r.results.empty? || tweets.count > MAX_RESULTS_PER_REQUEST\n \n config[:max_id] = r.results.last.id - 1\n tweets += r.results\n puts \"Found... #{tweets.count} tweets in total\"\n end\n \n # raise tweets.map{|t| \"@\" + t.from_user + \": \" + t.text }.to_yaml \n if !tweets.empty? \n\n replies = File.readlines \"vendor/replies/\" + self.responses\n\n our_accounts_list = Account.all.map{|x| x.username}\n blocked_keywords = Keyword.all.map{|x| x.name}\n\n tweets\n .reject { |t| t.text.include? 'http' } \n .reject { |t| our_accounts_list.include? t.from_user } # Reject if are our own accounts\n .reject { |t| t.text.downcase.split(' ').any? {|i| blocked_keywords.include? i } } # Reject blocked keywords\n .reject { |t| self.repeat_user(t.from_user) }\n .each_with_index do |t,i|\n puts \"#{i}. Tweet de @\" + t.from_user\n reply = \"@#{t.from_user} \" + replies[rand(replies.count)]\n\n #check encoding and length\n\n #apply filters\n\n data << SearchesResult.new({\n :account_id => accounts.sample.id, \n :username => t.from_user, \n :tweet => t.text, \n :reply => reply,\n :tweeted_at => t.created_at\n })\n end\n\n self.last_tweet_id = tweets.first.id\n self.save\n\n if !data.empty?\n SearchesResult.import data.reverse\n end\n end\n \n self.save_log tweets.count, data.count, 1\n \n \n data.map{|t| \"@\" + t.username + \": \" + t.tweet}.to_yaml\n end",
"def article_render_content(article = nil)\n if @article \n process_with_filter(@article) \n elsif article\n process_with_filter(article) \n end\n end",
"def entry_filter; end",
"def tweet!\n TWITTER.update(\"#{title.truncate(75)} - #{tweet_users}\\n\\nhttp://beta.briefideas.org/ideas/#{sha}\")\n self.update_columns(:tweeted => true)\n end"
] | [
"0.64762914",
"0.64508176",
"0.6335795",
"0.5819919",
"0.57615936",
"0.5723406",
"0.5723406",
"0.56930393",
"0.56094176",
"0.56094176",
"0.56048524",
"0.5574385",
"0.556204",
"0.556204",
"0.5558341",
"0.5557162",
"0.55535",
"0.5541055",
"0.55307114",
"0.55307114",
"0.55307114",
"0.55126053",
"0.55024284",
"0.549218",
"0.549218",
"0.5488219",
"0.5482972",
"0.54586285",
"0.5397155",
"0.5393056",
"0.5387966",
"0.5366918",
"0.53440076",
"0.5338906",
"0.5330011",
"0.5325534",
"0.5325138",
"0.5312057",
"0.5303107",
"0.530269",
"0.5289386",
"0.52795696",
"0.5264582",
"0.52543473",
"0.52222335",
"0.52182716",
"0.52182716",
"0.5215503",
"0.52089643",
"0.5203341",
"0.5200745",
"0.52006465",
"0.5198135",
"0.51724595",
"0.5172109",
"0.51702034",
"0.5168438",
"0.51668906",
"0.5165582",
"0.5160948",
"0.5156889",
"0.51562405",
"0.5138818",
"0.5133025",
"0.51296246",
"0.5124298",
"0.5110438",
"0.5099074",
"0.50881284",
"0.5085767",
"0.50816065",
"0.5081256",
"0.5081256",
"0.5081256",
"0.5081256",
"0.5078905",
"0.5075487",
"0.5066261",
"0.50659096",
"0.5055218",
"0.50533533",
"0.50466853",
"0.504635",
"0.5043748",
"0.5042371",
"0.5039723",
"0.50386405",
"0.5035275",
"0.5034181",
"0.5025278",
"0.5024235",
"0.5024235",
"0.5024235",
"0.50097424",
"0.50069994",
"0.5003853",
"0.50011665",
"0.49999237",
"0.49994066",
"0.49919075",
"0.4990648"
] | 0.0 | -1 |
Maximum content length before a URL, this is 140 (maximum length of a Twitter message) minus 21 (space plus 20 characters for a t.co URL) or 22 with the https protocol | def max_content_length
@@max_content_length ||= Config.web =~ /^https/ ? 118 : 119
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def too_long? content\n content.length > MaxTweetLength\n end",
"def for_web_urls\n self.fixed_length\n end",
"def length\n [default&.length, max_content_length].compact.max\n end",
"def content_length; end",
"def content_length; end",
"def content_length; end",
"def max_length\n MAX_LENGTH\n end",
"def trunc_em\n self.the_url = self.the_url.truncate 200\n end",
"def render_length_limit; end",
"def content_length\n @content_length ||= ((s = self[HttpClient::CONTENT_LENGTH]) &&\n (s =~ /^(\\d+)$/)) ? $1.to_i : nil\n end",
"def truncate(text, url)\n return text if text.bytesize <= TEXT_BYTESIZE_MAX\n tail = \"...\\n<#{url}|Read more at Qiita:Team...>\"\n text.byteslice(0, TEXT_BYTESIZE_MAX - tail.bytesize).scrub(\"\") + tail\n end",
"def max_size()\n AUTHENTICATION_REPLY_MAX_SIZE\n end",
"def tag_content_max_length\n limits_yaml = YAML.load_data!(\"#{ECON_DATA_PATH}/limits.yml\")\n return limits_yaml['tag_content_max_length']\n end",
"def comment_length\n\t120\nend",
"def max_length(max_size=0, options={}, &block)\n return length_between(0, max_size, options, &block)\n rescue Exception => e\n validation_error(\"#{e.message}\")\n end",
"def max_size()\n ACCOUNTING_REPLY_MAX_SIZE\n end",
"def size\n @heads['content-length'] || @size.to_s\n end",
"def max_length\n return @max_length\n end",
"def custom_command_content_max_length\n limits_yaml = YAML.load_data!(\"#{ECON_DATA_PATH}/limits.yml\")\n return limits_yaml['custom_command_content_max_length']\n end",
"def limit_text_length (string_to_put_limitation, max_length)\n\n if string_to_put_limitation.length > max_length\n\n limited_string = string_to_put_limitation[0..max_length].gsub(/\\s\\w+\\s*$/,'...')\n\n return limited_string\n\n else\n\n return string_to_put_limitation\n\n end#string size check\n\n end",
"def content_length\r\nsuper.to_i\r\nend",
"def description_length\n \tif description.length > 80\n \t\terrors.add(:description, \"La descripción no puede ser mayor a 80 caracteres\")\n \tend\n end",
"def message_size_is_within_limit\n if message && message.bytesize > 50_000\n errors.add(:message, I18n.t('activerecord.errors.models.recognition.message_too_long'))\n end\n end",
"def max_command_length; end",
"def long_url_is_an_url\n errors.add(:long_url, \"This is not a valid url\") unless is_valid_url?(self.long_url_with_protocol)\n end",
"def safe_len(maxLen, reqLen)\n #handle stings and garbage\n maxLen = (maxLen||reqLen).to_i\n [maxLen, reqLen].min\n end",
"def redirection_limit; end",
"def redirection_limit; end",
"def biography_limit\n if biography.present?\n errors.add(:biography, 'is limited to 150 words.') if biography.split.length > 150\n end\n end",
"def min_size()\n AUTHENTICATION_REPLY_MIN_SIZE\n end",
"def desc_char_limit\n 300\n end",
"def max_size()\n AUTHENTICATION_START_MAX_SIZE\n end",
"def max_talk_time_length\n 240\n end",
"def limit_size(str, max)\n if str.length > max\n return str[0...max]\n end\n str\n end",
"def limit_size(str, max)\n if str.length > max\n return str[0...max]\n end\n str\n end",
"def content_summary(max)\n if self.content.length >= max\n self.content.slice(0..max) + \"...\"\n else\n self.content\n end\n end",
"def length\n (lines.max_by(&:length) || '').size\n end",
"def length\n @content.length\n end",
"def shorten\n result = url\n \n begin \n if url.size > 18 && !/http:\\/\\/snipr.com.*/.match(url)\n using(rdr = StreamReader.new(request.get_response.get_response_stream)) { \n result = rdr.read_to_end.to_s\n } \n end\n rescue Exception => e\n #catch all errors and just return the regular url\n end\n \n res = ((result.size >= url.size || result.empty?) ? url.ensure_http : result).to_s\n logger.debug(\"*** SniprUrl: Shortened url from: #{url} to #{res}\")\n res\n end",
"def content_length\n @resource.content_length\n end",
"def maximal_length\n if !self.value.blank? && self.maxLength\n errors.add(:value, 'is too long!') if self.value.length > self.maxLength\n end\n end",
"def user_website(website)\n unless website.blank?\n if website.size > 20 \n return website.slice(0,18)+\"...\" \nelse\n return website\n end \n\n \n end\nend",
"def length\n (headers[\"content-length\"] || -1).to_i\n end",
"def post_title_length\n # max number of characters in posts titles to display\n 14\n end",
"def exceeds_max_length?\n input.match(Patterns::ALPHABETICAL_PATTERN) && input.length > 15\n end",
"def max_size; end",
"def message_length; complete_message.length; end",
"def render_length_limit=(_arg0); end",
"def link_check\n\t\tif self.message.include? \"https://\"\n\t\t\tarr = self.message.split\n\t\t\t# find me the index where the curly bracket area is equal to true, and set that index equal to indx\n\t\t\tindx = arr.map { |x| x.include? \"https://\"}.index(true)\n\t\t\t# take what is in the array at index # and assign it as a link attribute to the curent instance of tweet (self) \n\t\t\tself.link= arr[indx]\n\n\t\t\t# check and see if the item at array indx length is greater than 23? if so , we havfe to shorten it.\n\t\t\tif arr[indx].length > 23\n\t\t\t\tarr[indx]=\"#{arr[indx][0..20]}...\"\n\t\t\tend\n\n\t\t\tself.message= arr.join(\" \")\n\t\tend\t\n\tend",
"def check_body\n return true if body.blank?\n\n limit = 1_500_000\n current_length = body.length\n return true if body.length <= limit\n\n raise Exceptions::UnprocessableEntity, \"body of article is too large, #{current_length} chars - only #{limit} allowed\" if !ApplicationHandleInfo.postmaster?\n\n logger.warn \"WARNING: cut string because of database length #{self.class}.body(#{limit} but is #{current_length})\"\n self.body = body[0, limit]\n end",
"def limit_value\n length\n end",
"def score_for_body_links\n link_count = self.message.to_s.scan(/http:/).size\n link_count > 2 ? -link_count : 2\n end",
"def max_size()\n ACCOUNTING_REQUEST_MAX_SIZE\n end",
"def min_size()\n ACCOUNTING_REPLY_MIN_SIZE\n end",
"def get_content_string(content)\n\t\tif (content.length > 200) then\n\t\t\treturn content[0, 200] + \"...\"\n\t\telse\n\t\t\treturn content\n\t\tend\n\tend",
"def max_line_length\n @max_line_length ||= ProxPage.max_line_length\nend",
"def max_redirects; end",
"def content_length\n raise NotImplementedError\n end",
"def shortened_tweet_truncator(tweet_string)\n if tweet_string.length > 140\n tweet_string[0..136] + \"...\"\n else\n tweet_string\n end\nend",
"def long_url_with_protocol\n if self.long_url[0..7]=='https://' or self.long_url[0..6]=='http://'\n return self.long_url\n else\n return 'https://'+ self.long_url\n end\n end",
"def max=(length)\n @string_rule.max = length\n end",
"def content_length\n raise NotImplemented\n end",
"def content_length\n raise NotImplemented\n end",
"def max_size()\n AUTHENTICATION_CONTINUE_MAX_SIZE\n end",
"def excerpt\n return content if content.length <= 120\n content[0..116] + '...'\n end",
"def fix_length response\r\n size = 0\r\n response.body.each {|str| size += str.scan(/\\n/).size}\r\n size += response.headers['Content-Length'].to_i\r\n response.headers['Content-Length'] = size.to_s\r\n return response\r\n end",
"def max_length=(value)\n @max_length = value\n end",
"def preview_body(max_length=400)\n max_length -= 3 # Account for three dots\n body[0..max_length].gsub(/\\s\\w+\\s*$/,'...')\n end",
"def getcontentlength\n 0\n end",
"def maxStringLength\n\t\tweight = @dictionaries.inject(1) { |x, d| x * d.length }\n\t\tbits = (Math.log(weight)/Math.log(2)).floor\n\t\tchars = bits/4\n\tend",
"def content_length\n @content_length ||= @response_impl.entity.content_length\n end",
"def URLify(string, len)\n string.strip!.gsub!(/\\s\\s+/, \"%20\")\nend",
"def ws_message_size_limit\n\t\t\tGRHttp.ws_message_size_limit\n\t\tend",
"def max_action_length\n @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}\n end",
"def max_action_length\n @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}\n end",
"def content_size; @message_impl.getContentSize; end",
"def calculate_min_read \n self.min_read = (content.length / 1375.0).ceil\n end",
"def max_identifier_length\n 63\n end",
"def max_action_length\n @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}\n end",
"def urlify(str, len)\n\nend",
"def remote_size\n return @remote_size if defined?(@remote_size)\n @remote_size = http_head['Content-Length'].to_i\n end",
"def max_length=(new_max_length)\n @max_length = new_max_length\n chars = @text.scan(/./m)\n @text = chars[0, @max_length].join if chars.size > @max_length\n self.cursor_move_to_end if @cursor_position > chars.size\n end",
"def content_length\n stat.size\n end",
"def max_sites\n @sites.map { |s| s.length }.max\n end",
"def extract_content_length(headers)\n value = headers[CONTENT_LENGTH]\n return '-' unless value\n value.to_s == '0' ? '-' : value\n end",
"def remote_maximum_packet_size; end",
"def valid_length? \n !invalid_uri_error? && (@source_uri.length <= @valid_length)\n end",
"def restrict_msg_size\n if message.length > restriction\n message = message[0...restriction]\n end\n return message \n end",
"def max_word_length(words)\n max_length = 0\n words.each do |word|\n word_length = word.entry.length\n max_length = word_length if max_length < word_length\n end\n max_length\nend",
"def maximum_limit\n 100\n end",
"def display_link\n link.sub(SCHEME_PATTERN, '').truncate(48) if link\n end",
"def content_length\n\t\treturn 0 unless self.header.member?( :content_length )\n\t\treturn Integer( self.header.content_length )\n\tend",
"def max_history=(length); end",
"def max_history=(length); end",
"def picture_size\n if photo_url.size > 5.megabytes\n errors.add(:photo_url, \"should be less than 5MB\")\n end\n end",
"def max_text_width(text)\n text.split(/\\r\\n/).map {|t| t.length}.max\n end",
"def redirection_limit=(limit); end",
"def max_lines\n (contents.width / line_height) - 1\n end",
"def longest_string_length\n longest_string.size\n end",
"def length\n return unless headers['Content-Length']\n\n headers['Content-Length'].to_i\n end"
] | [
"0.7034747",
"0.6990235",
"0.67459667",
"0.6643421",
"0.6643421",
"0.6643421",
"0.650526",
"0.6440131",
"0.63746667",
"0.63328135",
"0.62714547",
"0.6236814",
"0.6193767",
"0.6193416",
"0.60863227",
"0.60849625",
"0.6076017",
"0.60754406",
"0.60221374",
"0.6010283",
"0.59409875",
"0.5938171",
"0.5928488",
"0.5922692",
"0.5913627",
"0.58802456",
"0.58785164",
"0.58785164",
"0.5856367",
"0.5840185",
"0.5815054",
"0.5814715",
"0.58122635",
"0.58032966",
"0.58032966",
"0.5797345",
"0.5796301",
"0.57893485",
"0.5788478",
"0.57831264",
"0.5773937",
"0.5772375",
"0.5764367",
"0.57640606",
"0.57622474",
"0.57564324",
"0.5755953",
"0.57277936",
"0.5696635",
"0.56941885",
"0.5693851",
"0.5691625",
"0.56908506",
"0.5690516",
"0.5688328",
"0.5679857",
"0.56710297",
"0.56508964",
"0.5649319",
"0.5630693",
"0.56295997",
"0.56238645",
"0.56238645",
"0.55917823",
"0.55880994",
"0.5587547",
"0.55859053",
"0.5584793",
"0.5584018",
"0.5575256",
"0.55505157",
"0.5547188",
"0.5546415",
"0.5539077",
"0.5539077",
"0.5532499",
"0.5524171",
"0.55216813",
"0.55188274",
"0.55129623",
"0.5505257",
"0.5501185",
"0.55006397",
"0.5493796",
"0.54826504",
"0.54770166",
"0.5457035",
"0.54554164",
"0.5452367",
"0.54369164",
"0.54203075",
"0.54176736",
"0.5413443",
"0.5413443",
"0.5405593",
"0.5399665",
"0.53975606",
"0.53939086",
"0.538109",
"0.5377133"
] | 0.7638888 | 0 |
wraper for the brand method ActiveMerchant returns master or american_express Banwire requires mastercard and amex | def get_brand(brand)
case brand
when "master"
return "mastercard"
when "american_express"
return "amex"
else
return brand
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def brand\n cc_type\n end",
"def brand\n cc_type\n end",
"def is_brand? brand\n Handset.is_brand? request.user_agent, brand\n end",
"def brand_name\n maintenance_record_hub.try(:brand) || car.try(:brand_name)\n end",
"def brand_name\n product.brand_name\n end",
"def brand_name\n product.brand_name\n end",
"def company_brand_code\n self.dig_for_string(\"agentSummary\", \"office\", \"brandCode\")\n end",
"def brand_with_model; end",
"def credit_card_brand_options\n SUPPORTED_CARDTYPES.map { |brand| [I18n.t(brand, scope: 'activemerchant.credit_card.brand'), brand] }\n end",
"def brand()\n sql = \"SELECT * FROM manufacturers WHERE id = $1\"\n values = [@manuf_id]\n brand = SqlRunner.run(sql, values)\n return brand.map{|manuf| Manufacturer.new(manuf)}[0]\n end",
"def organisation_brand(organisation)\n return unless organisation\n\n brand = organisation[\"details\"][\"brand\"]\n brand = \"executive-office\" if executive_order_crest?(organisation)\n brand\n end",
"def brand_name\n brand_id ? brand.name : ''\n end",
"def brand_name\n brand_id ? brand.name : ''\n end",
"def brand_string(str)\n @brand = str\n end",
"def brands\n beers.collect{ |b| b.brand }\n end",
"def require_company?\n !!(self.brand && self.brand.name.to_s.match(/studer/i))\n end",
"def get_brand request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_brand_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Iap::V1::Brand.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def full_name\n \"#{bike_brand.name} #{model}\"\n end",
"def manufacturer; end",
"def credit_card(params = {})\n brand = params[:brand].to_sym\n params.delete(:brand)\n\n exp_month = sprintf(\"%.2i\", Integer(params[:expiry_month], 10))\n exp_year = sprintf(\"%.4i\", Integer(params[:expiry_year], 10))\n params.delete(:expiry_month)\n params.delete(:expiry_year)\n\n method_missing(:credit_card, params)\n\n # The expiration data needs to be combined together\n exp = \"#{exp_year[-2..-1]}#{exp_month}\"\n add_field(mappings[:credit_card][:expiry_month], exp)\n\n # Map the card type to what Migs is expecting\n if params[:number] =~ ELECTRON\n brand_name = 'VisaDebit'\n else\n brand_name = {\n :visa => 'Visa',\n :master => 'Mastercard',\n :american_express => 'Amex',\n :diners_club => 'Dinersclub',\n :jcb => 'JCB',\n :solo => 'Solo'\n }[brand]\n end\n\n add_field(mappings[:credit_card][:brand], brand_name)\n end",
"def set_brand\n @brand = Brand.friendly.find(params[:id])\n end",
"def set_brand\n @brand = Brand.friendly.find(params[:id])\n end",
"def wrt_brand_info(brands, nam_flg = true, stk_flg = true, avg_prc_flg = true, tot_sales_flg = true, options = {})\n brands.each { |item|\n if nam_flg\n wrt_brand_name(item[:title])\n separator(29)\n end\n if stk_flg\n wrt_brand_stk(item[:stock], options[:stk_format])\n end\n if avg_prc_flg\n wrt_brand_avg_prc(item[:brand_avg_prc], options[:brand_avg_prc_format])\n end\n if tot_sales_flg\n wrt_brand_tot_sales(item[:total_sales], options[:brand_tot_sales_format])\n end\n separator(29)\n $report_file.puts\n }\nend",
"def get_bank_name()\n return @RESPONSE_HASH['BANK_NAME']\n end",
"def initialize(brand)\n @brand = brand\n end",
"def initialize(brand)\n @brand = brand\n end",
"def brand\n @brand ||= Brand.find(brand_pid)\n end",
"def car(brand, model)\n brand + ' ' + model\nend",
"def support(ibel)\n return ibel.payment_mode unless ibel.payment_mode =~ /(bank|cash)_\\d+/\n vals = ibel.payment_mode.split('_')\n case vals[0]\n when 'bank' then BankAccount.find(vals[1]).nickname\n when 'cash' then 'Caisse ' + Cash.find(vals[1]).nickname\n else \n ''\n end\n end",
"def build_merchant\n assign_wares\n # assign_merchant_image\n merchant_sayings\n end",
"def default_bank; end",
"def federation_brand_name\n return @federation_brand_name\n end",
"def merchant?\n merchant.present?\n end",
"def set_brand\n @brand = @current_user.brands.find(params[:id])\n end",
"def create_brand request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_brand_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Iap::V1::Brand.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def add_brand_info(brands, title = \"\", stock = 0, full_prc = 0.0, total_sales = 0.0, options = {})\n brands.each { |item|\n if item[:title] == title\n add_brand_stk(item, stock)\n add_brand_tot_prc(item, full_prc, precision: options[:full_prc_precision] || 2)\n add_brand_tot_sales(item, total_sales, precision: options[:tot_sales_precision] || 2)\n add_brand_avg_prc(item, precision: options[:avg_prc_precision] || 2)\n end\n }\n\nend",
"def make_brands_section\n\tbrands = $products_hash[\"items\"].map {|toy| toy[\"brand\"]}.uniq\n\tbrands.each do |brand|\n\t\t$same_brand = $products_hash[\"items\"].select {|toy| toy[\"brand\"] == brand}\n\t print_brand_name brand\n\t brand_toy_stock brand\n\t\tprint_brand_toy_stock\n\t average_price_brand brand\n\t\tprint_average_price_brand\n\t total_sales_brand brand\n\t\tprint_total_sales_brand\n\tend\nend",
"def set_brand_filter\n # return true if @products.nil?\n # return true if generic_results?\n # \n # @brands = @products.map(&:brand).compact.uniq.sort_by(&:name)\n # true\n end",
"def set_brand_card\n @brand_card = current_user.brand_cards.find(params[:id])\n end",
"def brand_link_to field, text, amount\n\n prefix = if field == :brand || @brand\n sanitized_brand = (@brand ? @brand : text).parameterize('_')\n \"/marcas/#{sanitized_brand}?\"\n else\n \"/search/show?\"\n end\n path = prefix + create_query_string(field => text)\n link_to \"#{text} (#{amount})\", path\n end",
"def play_like_a_master\r\n card = nil\r\n #TODO\r\n return card\r\n end",
"def bark \n return \"Generic bark\"\n end",
"def brand(text, options = {})\n options = canonicalize_options(options)\n options = ensure_class(options, 'brand')\n\n with_environment = options.delete(:with_environment)\n if with_environment && Rails.env != 'production'\n text = \"#{text} - #{Rails.env}\"\n options = ensure_class(options, \"rails-#{Rails.env}\") \n end\n\n url = options.delete(:url)\n \n if url.present?\n link_to(text, url, options)\n else\n content_tag(:span, text, options)\n end\n end",
"def brands\n\t\t\tErp::Products::Brand.where(id: self.get_products_for_categories({}).select(:brand_id).where.not(brand_id: nil)).order(:name)\n\t\tend",
"def brand_params\n params[:brand]\n end",
"def merchant\n merchants = engine.merchant_repository.parse\n merchants.detect {|merchant| merchant.id == merchant_id}\n end",
"def name\n object.merchant.name\n end",
"def set_admin_brand\n @admin_brand = Admin::Brand.friendly.find(params[:id])\n end",
"def show\n @sale = Sale.find(params[:id])\n gateway = ActiveMerchant::Billing::LitleGateway.new\n \n amount = @sale.amount\n \n\n options = { \n\t\t:billToAddress => {\n\t\t\t \t :name => [@sale.firstname, @sale.lastname].compact.join(' '),\n\t\t\t\t :address1 => @sale.address1,\n\t\t\t\t :city => @sale.city,\n\t\t\t\t :state => @sale.state,\n\t\t\t\t :country => ('US' or @sale.country),\n\t\t\t\t :zip => @sale.zip,\n\t\t\t\t :email => @sale.email}\t\n\t\t}\n credit_card = ActiveMerchant::Billing::CreditCard.new(\n :first_name => @sale.firstname,\n :last_name => @sale.lastname,\n :number => @sale.cardnumber,\n :month => @sale.cardmonth,\n :year => @sale.cardyear,\n :verification_value => @sale.cvv)\n\n \nif credit_card.valid?\n response = gateway.purchase(amount,credit_card,options)\n\n if response.success?\n @post = \"Successfully charged an amount of $#{sprintf(\"%.2f\", amount.to_f / 100)} to the credit card #{credit_card.display_number}\"\n @litletxnid = response.params['litleOnlineResponse'].saleResponse.litleTxnId \n else\n @message=response.message\n render :action => 'error2'\n end\nelse\nrender :action => 'error1' \nend\nend",
"def show\n @token = Token.find(params[:id])\n gateway = ActiveMerchant::Billing::LitleGateway.new\n \n credit_card = ActiveMerchant::Billing::CreditCard.new(\n :first_name => @token.firstname,\n :last_name => @token.lastname,\n :number => @token.cardnumber,\n :month => @token.cardmonth,\n :year => @token.cardyear,\n :verification_value => @token.cvv)\n \n options = { \n :billToAddress => {\n :name => [@token.firstname, @token.lastname].compact.join(' '),\n :address1 => @token.address1,\n :city => @token.city,\n :state => @token.state,\n :country => ('US' or @token.country),\n :zip => @token.zip,\n :email => @token.email} \n }\n if credit_card.valid?\n response = gateway.store(credit_card,options)\n \n if response.success?\n @post = \"Successfully stored token:\" \n @tokenid = response.params['litleOnlineResponse'].registerTokenResponse.litleToken \n \n else\n @message = response.message\n render :action => 'error2' \n end\n \n else\n render :action =>'error1' \n end\n \n end",
"def buyer\n starter\n end",
"def credit_card_type\n Faker::Business.credit_card_type\n end",
"def provider_class\n ActiveMerchant::Billing::Integrations::Europabank\n end",
"def worldpay_merchant_code isMoto=nil\n if use_moto? isMoto\n Rails.configuration.worldpay_moto_merchantcode\n else\n Rails.configuration.worldpay_ecom_merchantcode\n end\n end",
"def act_smart\n return \"I have all the brains\" #this IS NOT returning, because the act_smart method from Smart_module #has been prepended!\n end",
"def brands\n options = {\n content_type: 'brand',\n include: 1,\n order: 'sys.createdAt'\n }\n\n objects('Brand', options)\n end",
"def brand\n object.brand.id\n end",
"def to_brand\n domain = to_domain\n domain ? Wgit::Url.new(domain.split('.').first) : nil\n end",
"def to_brand\n domain = to_domain\n domain ? Wgit::Url.new(domain.split('.').first) : nil\n end",
"def brand(text, options = {})\n options = canonicalize_options(options)\n options = ensure_class(options, 'brand')\n url = options.delete(:url)\n \n if url.present?\n # link_to(text, url, options)\n else\n content_tag(:span, text, options)\n end\n end",
"def getCreditCard(payload)\n # VISA\n matchList = payload.scan(/(4\\d{3}(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4})\\D/) \n if matchList.length > 0\n return matchList[0][0]\n end\n\n # MASTER CARD\n #form with dashes\n matchList = payload.scan(/(5\\d{3}(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4})\\D/) \n if matchList.length > 0\n return matchList[0][0]\n end\n\n # DISCOVER\n #form with dashes\n matchList = payload.scan(/(6011(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4})\\D/) \n if matchList.length > 0\n return matchList[0][0]\n end\n\n # AMERICAN EXPRESS\n #form with dashes\n matchList = payload.scan(/(3\\d{3}(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4})\\D/) \n if matchList.length > 0\n return matchList[0][0]\n end\n\n return nil\n\nend",
"def bark\n\t\treturn \"Generic Bark\"\n\tend",
"def index\n @bread_menu = {m1: '品牌管理', m2: '品牌管理', m2_url: '/auction/brands', m3: '品牌列表', add: '/auction/brands/new', s: 'brands_search'}\n @q = Auction::Brand.ransack(params[:q])\n @manage_brands = @q.result.page(params[:page]).per(15)\n end",
"def full_name\n \"#{brand.name} #{name} (#{vehicle_type.name})\"\n \n end",
"def is_merchant?\n role = self.role\n\n if(role == 'merchant')\n return true\n else\n return false\n end\n end",
"def initialize_active_merchant\n require 'active_merchant'\n\n ::ActiveMerchant::Billing::Gateway.logger = @@logger\n\n am_config = @@glob_config[@@gateway_name.to_sym]\n if am_config.is_a?(Array)\n default_gateway_config = {}\n am_config.each_with_index do |gateway_config, idx|\n gateway_account_id = gateway_config[:account_id]\n if gateway_account_id.nil?\n @@logger.warn \"Skipping config #{gateway_config} -- missing :account_id\"\n else\n default_gateway_config = gateway_config if idx == 0 || gateway_account_id == :default\n end\n end\n am_config = default_gateway_config\n end\n am_config ||= {\n # Sane defaults\n :test => true\n }\n\n if am_config[:test]\n ::ActiveMerchant::Billing::Base.mode = :test\n end\n\n if am_config[:log_file]\n ::ActiveMerchant::Billing::Gateway.wiredump_device = File.open(am_config[:log_file], 'w')\n else\n log_method = am_config[:quiet] ? :debug : :info\n ::ActiveMerchant::Billing::Gateway.wiredump_device = ::Killbill::Plugin::ActiveMerchant::Utils::KBWiredumpDevice.new(@@logger, log_method)\n end\n ::ActiveMerchant::Billing::Gateway.wiredump_device.sync = true\n\n ::ActiveMerchant::Billing::Gateway.open_timeout = am_config[:open_timeout] unless am_config[:open_timeout].nil?\n ::ActiveMerchant::Billing::Gateway.read_timeout = am_config[:read_timeout] unless am_config[:read_timeout].nil?\n ::ActiveMerchant::Billing::Gateway.retry_safe = am_config[:retry_safe] unless am_config[:retry_safe].nil?\n ::ActiveMerchant::Billing::Gateway.ssl_strict = am_config[:ssl_strict] unless am_config[:ssl_strict].nil?\n ::ActiveMerchant::Billing::Gateway.ssl_version = am_config[:ssl_version] unless am_config[:ssl_version].nil?\n ::ActiveMerchant::Billing::Gateway.max_retries = am_config[:max_retries] unless am_config[:max_retries].nil?\n ::ActiveMerchant::Billing::Gateway.proxy_address = am_config[:proxy_address] unless am_config[:proxy_address].nil?\n ::ActiveMerchant::Billing::Gateway.proxy_port = am_config[:proxy_port] unless am_config[:proxy_port].nil?\n\n # Configure the ActiveMerchant HTTP backend\n connection_type = (@@glob_config[:active_merchant] || am_config)[:connection_type]\n if connection_type == :typhoeus\n require 'killbill/ext/active_merchant/typhoeus_connection'\n end\n end",
"def credit_card_type; end",
"def default_bbar\n bbar = [ :search ]\n bbar.concat [ :apply ] if can? :update, BikeBrand\n bbar.concat [ :add_in_form ] if can? :create, BikeBrand\n bbar\n end",
"def set_brand\n set_category\n @brand = @category.brands.find(params[:id]) if params[:id]\n end",
"def brand_params\n params.require(:brand).permit(:brand_name, :website_url, :email, :address1, :address2, :city, :primary_country_id, :brand_country_id, :state_province_id, :pincode, :phone_number, :default, :brand).merge(:user_id => current_user.id)\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 car(brand, model)\n puts \"#{brand} #{model}\"\nend",
"def get_revenue_brand(brands_hash)\n\ttotal_revenue_brand = 0\n\tbrands_hash.each do |item|\n\t\titem['purchases'].each do |purchase|\n\t\t\ttotal_revenue_brand += purchase['price']\n\t\tend\n\tend\n\treturn total_revenue_brand.round(2)\nend",
"def show\r\n\t\tdata = {}\r\n\t\tmeta = {}\r\n\t\tvendor_countries = {}\r\n\t\tvendor_id = nil\r\n\t\t\r\n\t\tif(!@seller_brand.global_brand_id.nil? && @seller_brand.global_brand_id > 0)\r\n\t\t\tgen_brand = GenBrand.where(id: @seller_brand.global_brand_id).first\r\n\t\t\tif(gen_brand.present?)\r\n\t\t\t\tdata[:brand_name] = gen_brand.name\r\n\t\t\t\tvendor_id = gen_brand.vendor_id\r\n\t\t\tend\r\n\t\tend\r\n\t\t\r\n\t\tdata[:brand_name] = @seller_brand.name if(data[:brand_name].blank?)\r\n\t\tvendor_id = @seller_brand.vendor_id if(vendor_id.nil?)\r\n\t\t\r\n\t\tif(!vendor_id.nil?)\r\n\t\t\tSellerBrand.vendor_info(Vendor.where(id: vendor_id).first, vendor_countries, data)\r\n\t\t\t\r\n\t\t\tif(!vendor_countries.empty?)\r\n\t\t\t\tmeta[:data_names] = ['countries']\r\n\t\t\t\tmeta[:countries] = AddrCountry.select('id, updated_at, country_code, name_full_eng, name_full_rus, iso_code_2, iso_code_3').where(country_code: vendor_countries.keys).find_all\r\n\t\t\tend\r\n\t\tend\r\n\t\t\r\n\t\trender_result(\r\n\t\t\tdata: data,\r\n\t\t\tmeta: meta\r\n\t\t)\r\n\tend",
"def set_brand\n @brand = Brand.find(params[:id])\n end",
"def brand_params\n params.fetch(:brand, {}).permit(:is_main, :image_url, :name, :description)\n end",
"def create_branding(params)\n request :post, \"/v3/brandings.json\", params\n end",
"def getmerchantname()\r\n return getvalue(SVTags::MERCHANT_NAME)\r\n end",
"def set_brand\n @brand = Brand.find(params[:id])\n end",
"def set_brand\n @brand = Brand.find(params[:id])\n end",
"def set_brand\n @brand = Brand.find(params[:id])\n end",
"def set_brand\n @brand = Brand.find(params[:id])\n end",
"def set_brand\n @brand = Brand.find(params[:id])\n end",
"def set_brand\n @brand = Brand.find(params[:id])\n end",
"def set_backoffice_brand\n @backoffice_brand = Brand.find(params[:id])\n end",
"def set_brand\n @brand = Brand.find_by(name: params[:id])\n end",
"def login\n @brands = Brand.for_service_site\n end",
"def set_marketshare_brand_type\n @brand_types = Marketshare::BrandType.all\n end",
"def add_brands_with_http_info(brand, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: BrandsApi.add_brands ...\"\n end\n # verify the required parameter 'brand' is set\n if @api_client.config.client_side_validation && brand.nil?\n fail ArgumentError, \"Missing the required parameter 'brand' when calling BrandsApi.add_brands\"\n end\n # resource path\n local_var_path = \"/brands\"\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(brand)\n auth_names = ['APIKeyHeader']\n data, status_code, headers = @api_client.call_api(:POST, 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 => 'InlineResponse201')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BrandsApi#add_brands\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n if params[:brand].blank?\n @custom_camo_hats = CustomCamoHat.all\n @order_item = current_order.order_items.new\n else\n @brand_id =Brand.find_by(name: params[:brand]).id\n @custom_camo_hats = CustomCamoHat.where(:brand_id => @brand_id)\n end\n end",
"def test_merchant_description\n merchant_options = {\n merchantInformation: {\n merchantDescriptor: {\n name: 'Test Name',\n address1: '123 Main Dr',\n locality: 'Durham'\n }\n }\n }\n\n assert response = @gateway.purchase(@amount, @credit_card, @options.merge(merchant_options))\n assert_successful_response(response)\n end",
"def show\n @bread_menu = {m1: '品牌管理', m2: '品牌管理', m2_url: '/auction/brands', m3: '品牌详情'}\n end",
"def set_supplement_brand\n @supplement_brand = SupplementBrand.find(params[:id])\n end",
"def brand(klass)\n\t\tklass = klass.dup\n\t\tklass.client = self.client\n\t\treturn klass\n\tend",
"def brand(klass)\n\t\tklass = klass.dup\n\t\tklass.client = self.client\n\t\treturn klass\n\tend",
"def initialize(brand)\n @brand = brand\n if !(BRANDS.include? (@brand))\n BRANDS << brand\n end \n end",
"def brand_group_name\n\t\t\t\tbrand_group.present? ? brand_group.name : ''\n\t\t\tend",
"def car(brand, make)\n puts \"#{brand} #{make}\"\nend",
"def canon_products items\n\titems.select do |item|\n\t\titem['product']['brand'].downcase == 'canon'\n\tend\nend",
"def brand_name\n\tproducts_brand = ($products_hash[\"items\"].map {|each_brand| each_brand[\"brand\"]}).uniq\nend"
] | [
"0.6565322",
"0.65630853",
"0.647237",
"0.6302554",
"0.6068399",
"0.59349877",
"0.59022504",
"0.58542854",
"0.5850447",
"0.5816948",
"0.58104074",
"0.57395095",
"0.57395095",
"0.5686578",
"0.56758773",
"0.5652856",
"0.5618775",
"0.5617302",
"0.5580419",
"0.54561615",
"0.54204035",
"0.54204035",
"0.5406864",
"0.5363856",
"0.5361603",
"0.5361603",
"0.53416705",
"0.53358006",
"0.53312385",
"0.5315657",
"0.53102857",
"0.5282777",
"0.5275588",
"0.526081",
"0.52575505",
"0.5256872",
"0.5249439",
"0.52389866",
"0.523316",
"0.5219617",
"0.5217031",
"0.5178074",
"0.5162768",
"0.51553786",
"0.5152588",
"0.5135679",
"0.5133199",
"0.5125105",
"0.5114249",
"0.51125467",
"0.51100516",
"0.5109982",
"0.5080983",
"0.50700027",
"0.5051106",
"0.50491893",
"0.5043948",
"0.50333315",
"0.50333315",
"0.5031096",
"0.5025807",
"0.50249225",
"0.5021759",
"0.50155765",
"0.501283",
"0.500999",
"0.5005318",
"0.50050986",
"0.4999834",
"0.49953595",
"0.49937132",
"0.49911132",
"0.4987255",
"0.49735445",
"0.49642485",
"0.49640948",
"0.4954978",
"0.495471",
"0.49535316",
"0.49535316",
"0.49535316",
"0.49535316",
"0.49535316",
"0.49535316",
"0.4948993",
"0.49451512",
"0.49408412",
"0.49387327",
"0.49370694",
"0.49317956",
"0.4929976",
"0.49247432",
"0.49240714",
"0.49225342",
"0.49225342",
"0.49178097",
"0.49099183",
"0.4908685",
"0.4906383",
"0.48939586"
] | 0.7343426 | 0 |
GET /farms GET /farms.json | def index
@farms = Farm.all
respond_with(@users,@farms)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def farms\n user = User.find(params[:id])\n\n @farms = []\n # Find which farms this user is authorized to access\n if (user.is_hog_owner?)\n @farms = user.owner.farms\n elsif user.is_barn_manager?\n @farms << user.owner.barn.location.farm\n elsif user.is_site_manager?\n @farms << user.owner.location.farm\n elsif user.is_farm_owner?\n @farms << user.owner.farm\n elsif user.is_admin?\n @farms = Farm.all\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @farms }\n end\n end",
"def index\n @farms = Farm.all\n end",
"def index\n @farms = Farm.all\n end",
"def index\n @farms = current_user.farms\n set_page_title\n\n @barn = []\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @farms }\n end\n end",
"def show\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @farm }\n end\n end",
"def show\n @farm = Farm.find(params[:id])\n @herds = Herd.where(:farm_id => @farm.id)\n respond_to do |format|\n format.html # index.html.erbb\n format.json { render :json => @farm }\n end\n end",
"def list_farms\n\treturn if authorise_for_web(program_name?,'read') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:farms_page] = params['page']\n\n\t\t render_list_farms\n\n\t\t return \n\telse\n\t\tsession[:farms_page] = nil\n\tend\n\n\tlist_query = \"@farm_pages = Paginator.new self, Farm.count, @@page_size,@current_page\n\t @farms = Farm.find(:all,\n :select => \\\"farms.*, parties.party_name as farm_owner_code\\\",\n :joins => \\\"LEFT OUTER JOIN parties_roles ON parties_roles.id=farms.farm_owner LEFT OUTER JOIN parties on parties.id=parties_roles.party_id\\\" ,\n\t\t\t\t :limit => @farm_pages.items_per_page,\n :order => \\\" farms.farm_code,farms.farm_description ASC \\\",\n\t\t\t\t :offset => @farm_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_farms\nend",
"def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end",
"def index\n @community_farms = CommunityFarm.all\n end",
"def new\n @farmer = Farmer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farmer }\n end\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farm }\n end\n end",
"def show\n @foam = Foam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foam }\n end\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @farm }\n end\n end",
"def index\n @favorite_routes = FavoriteRoute.all\n render json: @favorite_routes\n end",
"def index \n fans = Fan.all \n render json: fans \n end",
"def InfoFarmacia\n \tid = params[:id]\n @farmacias = Farmacium.find_by_sql(\"SELECT nombre, correo, direccion, latitud, longitud, telefono1, telefono2 FROM farmacia where id = #{id}\")\n render json: @farmacias\n end",
"def show\n @farmer = Farmer.find(params[:id])\n\t\t@dispensals = @farmer.dispensals.all.paginate(:page => params[:page], :order => 'updated_at DESC', :per_page => 5)\n\t\t@donations = @farmer.donations.all.paginate(:page => params[:page], :order => 'updated_at DESC', :per_page => 5)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @farmer }\n end\n end",
"def show\n @farm = Farm.find(params[:id])\n @hash = Gmaps4rails.build_markers(@farm) do |farm, marker|\n marker.lat farm.latitude\n marker.lng farm.longitude\n marker.infowindow farm.address\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @farm }\n end\n end",
"def show\n @flight = Flight.find(params[:id])\n render json: @flight\n end",
"def index\n @farms = Farm.all.select { |farm| current_user.has_role?(:admin, farm)}\n\n respond_to do |format|\n if(@farms.size == 1)\n format.html {redirect_to(@farms.first)}\n else\n format.html # index.html.erb\n end\n end\n end",
"def index\n @farmers = Farmer.search(params[:search]).sort_by_name.paginate(:page => params[:page], :order => 'name ASC', :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n\t\t\tformat.js\n format.json { render json: @farmers }\n end\n end",
"def show\n @films_box = FilmsBox.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @films_box }\n end\n end",
"def show\n @farm = Farm.find(params[:id])\n \tif request.path != (farm_path(@farm) )\n\t\t\tredirect_to @farm, status: :moved_permanently\n\t\tend\n respond_with(@farm)\n end",
"def index\n @flights = Flight.all\n render json: @flights\n end",
"def show\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @farm }\n end\n end",
"def index\n @foams = Foam.order(\"lower(name) ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foams }\n end\n end",
"def index\n @sewage_farms = SewageFarm.all\n end",
"def index\n # return restaurants in nearby area\n # needs to be implemented later--for now just return all globally available restaurants\n # max_distance = params[:maxDistance]\n # location = { latitude: params[:latitude], longitude: params[:longitude] }\n\n # Restaurant.all.select do |restaurant|\n # restaurant.distance_to(location) <= max_distance\n # end\n\n @restaurants = Restaurant.all\n\n render json: @restaurants\n end",
"def show \n @route = Route.find(params[:id])\n \n respond_to do |format|\n format.html \n format.json { render json: @route }\n end\n end",
"def index\n\t @fares = Fare.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @fares }\n\t end\n\tend",
"def index\n @farmings = Farming.all\n end",
"def show\n @flaw = Flaw.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flaw }\n end\n end",
"def show\n render json: @favorite_route\n end",
"def show\n @faction = Faction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faction }\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.json { render json: @route }\n end\n end",
"def show\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flight }\n end\n end",
"def show\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flight }\n end\n end",
"def show\n @magzine = Magzine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @magzine }\n end\n end",
"def show\n @route = Route.find(params[:id])\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @route }\n end\n end",
"def show\n @artists = Artist.find(params[:id])\n puts @artists\n render json:@artists, status: :ok\n end",
"def index\n @farmer_types = FarmerType.all\n end",
"def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end",
"def show\n require 'net/http'\n require 'json'\n\n response = Net::HTTP.get_response( URI.parse( \"http://freeshit.firebaseio.com/items/%s.json\" % [ params[:id] ] ) );\n\n begin\n @fb_item = JSON.parse(response.body)\n rescue\n render :status => 404, :text => 'Item not found.'\n return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fb_item }\n end\n end",
"def flights\n result = Search.search_flights(params)\n if result\n # The search gave us something so we can return it\n render json: result\n else\n # Something went wrong, return a 500 error with no body\n render status: 500, json: nil\n end\n end",
"def show\n @forest = Forest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forest }\n end\n end",
"def new\n @farm = Farm.new\n set_page_title\n @hog_owners = HogOwner.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farm }\n end\n end",
"def index\n @farmer_families = @farmer.farmer_families\n end",
"def show\n\t\trespond_to do |format|\n\t\t\tformat.html { }\n\t\t\tformat.json { render :json => {:fallacyfolder => @fallacyfolder}.to_json }\n\t\tend\n\tend",
"def create\n @farm = Farm.new(farm_params)\n\n if @farm.save\n render :show, status: :created, location: api_farm_url(@farm)\n else\n render json: @farm.errors, status: :unprocessable_entity\n end\n end",
"def show\n\t\t@flight = Flight.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @flight }\n\t\tend\n\tend",
"def show\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fabric }\n end\n end",
"def show\n @plan = Plan.find(params[:id])\n @invites = @plan.invites.all\n @microposts = @plan.microposts.all\n @suggestions = @plan.suggestions.all.sort_by { |obj| - obj.pointcount }\n\n @venues = Venue.all.sort_by{ |obj| obj['name'] }\n\n @graph = Koala::Facebook::API.new(session[:access_token])\n # Get public details of current application\n #@app = @graph.get_object(ENV[\"FACEBOOK_APP_ID\"])\n\n @friends = @graph.get_connections('me', 'friends').sort_by { |obj| obj['name'] }\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plan }\n end\n end",
"def index\n @routes = Route.where(:verified => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @routes }\n end\n end",
"def show\n json_response(@restaurant)\n end",
"def index\n\t\t@flights = Flight.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @flights }\n\t\tend\n\tend",
"def show\n @fan_out = FanOut.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fan_out }\n end\n end",
"def locations\n farm = Farm.find(params[:id])\n\n @locations = []\n # Find which locations this user is authorized to access\n if (current_user.is_hog_owner? || current_user.is_farm_owner? || current_user.is_admin?)\n @locations = farm.locations\n elsif current_user.is_barn_manager?\n @locations << current_user.owner.barn.location\n elsif current_user.is_site_manager?\n @locations << current_user.owner.location\n end\n\n @page_title = \"Sites\"\n @header_icon_class = \"icon-road\"\n @page_subtitle = \"\"\n \n respond_to do |format|\n format.html { render '/locations/index' }\n format.json { render json: @locations }\n end\n end",
"def show\n @flsa_result = FlsaResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flsa_result }\n end\n end",
"def index\n #byebug\n #CHECK AUTHORIZATION HERE NOT JUST JUST AUTHENTICATION\n \n render json: {farmers: Farmer.all, customers: CustomerUser.all} #User.all #CustomerUser.all #{users: User.all, customers: Customer_User.all}\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def index\n @farmers = Farmer.order('email ASC').paginate(page: params[:page], per_page: 10)\n end",
"def show\n render json: @light\n end",
"def show\n json_response(@fav)\n end",
"def show\n @get_restaurant_list = GetRestaurantList.find(params[:id])\n\n render json: @get_restaurant_list\n end",
"def routes\n routes = get('/gtfs/routes')\n routes.map do |route|\n Route.from_json(route)\n end\n end",
"def show\n\t\t@hall = Hall.find(params[:id])\n\t\trender json: @hall\n\tend",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :no_content }\n end\n end",
"def show\n @admin_route = Admin::Route.find(params[:id])\n\t\t@route_markers = @admin_route.route_markers\n\t\t@markers = @admin_route.route_markers.to_gmaps4rails do |object, marker|\n\t\t\tmarker.infowindow \"<h4>#{object.name}</h4><p>#{object.city}#{' - ' unless object.quarter.blank?}#{object.quarter}</p>\"\n\t\t\t#marker.picture({:picture => view_context.image_path(\"shared/#{object.kind.parameterize}.png\"), :width => 40, :height => 40})\n\t\t\tmarker.title object.name\n\t\t\tmarker.json({:id => \"#{object.id}\"})\n\t\tend\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_route }\n end\n end",
"def show\n @feed = FlexibleFeeds::Feed.find(params[:id])\n\n render json: @feed\n end",
"def show\n\t @fare = Fare.find(params[:id])\n\n\t respond_to do |format|\n\t\tformat.html # show.html.erb\n\t\tformat.json { render json: @fare }\n\t end\n\tend",
"def show\n render json: [*@zone]\n end",
"def index\n render json: @fiestas\n end",
"def FarmaciasCercanas\n @farmacias = Farmacium.find_by_sql(\"SELECT id, nombre,latitud, longitud FROM farmacia where correo <> 'ADMIN'\")\n render json: @farmacias\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :ok }\n end\n end",
"def get_favourite_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.favourites\n\n render status: 200, json: @restaurants\n end",
"def index\n @faves_arr = []\n @favourites = current_user.favourites.map do |fave|\n @faves_arr << Location.find_by_id(fave.location_id)\n end\n\n render json: @faves_arr.map(&:transform_json), status: 201\n end",
"def show\n @fam = Fam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fam }\n end\n end",
"def show\n @smurf = Smurf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smurf }\n end\n end",
"def menu\n foods = current_user.restaurant.meals.where(meal_type: 0)\n drinks = current_user.restaurant.meals.where(meal_type: 1)\n render json: {foods: foods, drinks: drinks, is_success: true}, status: :ok\n end",
"def show\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @golfer }\n end\n end",
"def show\n route_id = params.require(:route_id)\n\n route = Disraptor::RouteStore.get_route(route_id)\n\n if route.nil?\n error_message = \"Couldn’t find route for the ID '#{route_id}'.\"\n Rails.logger.error('❌ Disraptor: Error: ' + error_message)\n\n return render json: { error: error_message }, status: 404\n end\n\n render json: { 'disraptor/route': route }\n end",
"def show\n respond_to do |format|\n format.json { render json: @uri, status: 200 }\n end\n end",
"def index\n @zones = Zone.all\n\n render json: @zones\n end",
"def show\n @flights = Flight.find(params[:id])\n \n respond_to do |format|\n format.html \n format.json { render json: @flights, :include => :airplane} \n end\n end",
"def show\n @mood = Mood.find(params[:id])\n respond_to do |format|\n format.any { render :json => @mood }\n end\n end",
"def show\n json_response(@flight.decorate.as_json(flight_details: true), :ok)\n end",
"def show\n @favorite_flyer = FavoriteFlyer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favorite_flyer }\n end\n end",
"def index\n @lights = Light.all\n\n render json: @lights\n end",
"def listRestaurants\n _restaurants = Restaurant.all\n render json: _restaurants\n end",
"def show\n @fleet = Fleet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fleet }\n end\n end",
"def index\n @spoofers = Spoofer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spoofers }\n end\n end",
"def show\n\n respond_to do |format|\n format.html { # show.html.erb\n @flyer_info = FlyerInfo.find(params[:id])\n }\n format.json {\n render json: getflyer(params[:id])\n }\n end\n\n end",
"def show\n @fragment = MadmpFragment.find(params[:id])\n # check if the user has permissions to use the API\n unless Api::V1::Madmp::MadmpFragmentsPolicy.new(client, @fragment).show?\n render_error(errors: 'Unauthorized to access plan', status: :unauthorized)\n return\n end\n\n fragment_data = if query_params[:mode].eql?('fat')\n @fragment.get_full_fragment(with_ids: true)\n else\n @fragment.data\n end\n fragment_data = select_property(fragment_data, query_params[:property])\n\n render json: {\n 'data' => fragment_data,\n 'dmp_id' => @fragment.dmp_id,\n 'schema' => @fragment.madmp_schema.schema\n }\n end",
"def show\n @flight_schedule = FlightSchedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flight_schedule }\n end\n end",
"def show\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mall }\n end\n end",
"def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end",
"def show\n @arrest = Arrest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arrest }\n end\n end",
"def index\n @friends = Friend.all\n render json: @friends\n end"
] | [
"0.7742577",
"0.7169997",
"0.7169997",
"0.70576215",
"0.67901725",
"0.66245574",
"0.658241",
"0.635273",
"0.6294622",
"0.62944347",
"0.62555987",
"0.62397563",
"0.6227292",
"0.6200471",
"0.6131185",
"0.60921496",
"0.60811955",
"0.6057075",
"0.60558754",
"0.6051409",
"0.6049404",
"0.60293937",
"0.6014398",
"0.5977297",
"0.5965475",
"0.5956571",
"0.59501874",
"0.59426785",
"0.5926568",
"0.59231555",
"0.5915915",
"0.59027576",
"0.5879035",
"0.5877396",
"0.5850851",
"0.5847296",
"0.5846963",
"0.5831545",
"0.582487",
"0.5823214",
"0.5817332",
"0.5815843",
"0.58047104",
"0.57932657",
"0.57897526",
"0.5788187",
"0.578378",
"0.577463",
"0.5756788",
"0.575635",
"0.5749235",
"0.5747647",
"0.57121086",
"0.5694208",
"0.5691343",
"0.5685919",
"0.5684821",
"0.5681177",
"0.5670182",
"0.5661721",
"0.56493914",
"0.5644402",
"0.56434727",
"0.5638512",
"0.56381226",
"0.5632875",
"0.5617348",
"0.5617348",
"0.5617348",
"0.56138486",
"0.56133306",
"0.5602896",
"0.55987495",
"0.5597363",
"0.55967844",
"0.55957925",
"0.5586832",
"0.5582277",
"0.55813104",
"0.55799896",
"0.55751264",
"0.55726016",
"0.5571866",
"0.5570251",
"0.5561338",
"0.5561113",
"0.55604863",
"0.5558988",
"0.55579495",
"0.5551849",
"0.5549156",
"0.5546587",
"0.5544737",
"0.5542683",
"0.55354375",
"0.55346155",
"0.55291206",
"0.5525417",
"0.55233586",
"0.5522748"
] | 0.7302946 | 1 |
GET /farms/1 GET /farms/1.json | def show
@farm = Farm.find(params[:id])
if request.path != (farm_path(@farm) )
redirect_to @farm, status: :moved_permanently
end
respond_with(@farm)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def farms\n user = User.find(params[:id])\n\n @farms = []\n # Find which farms this user is authorized to access\n if (user.is_hog_owner?)\n @farms = user.owner.farms\n elsif user.is_barn_manager?\n @farms << user.owner.barn.location.farm\n elsif user.is_site_manager?\n @farms << user.owner.location.farm\n elsif user.is_farm_owner?\n @farms << user.owner.farm\n elsif user.is_admin?\n @farms = Farm.all\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @farms }\n end\n end",
"def index\n @farms = Farm.all\n end",
"def index\n @farms = Farm.all\n end",
"def show\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @farm }\n end\n end",
"def index\n @farms = Farm.all\n\t\trespond_with(@users,@farms)\n end",
"def index\n @farms = current_user.farms\n set_page_title\n\n @barn = []\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @farms }\n end\n end",
"def show\n @farm = Farm.find(params[:id])\n @herds = Herd.where(:farm_id => @farm.id)\n respond_to do |format|\n format.html # index.html.erbb\n format.json { render :json => @farm }\n end\n end",
"def show\n @foam = Foam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foam }\n end\n end",
"def new\n @farmer = Farmer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farmer }\n end\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farm }\n end\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @farm }\n end\n end",
"def show\n @flight = Flight.find(params[:id])\n render json: @flight\n end",
"def show\n @forest = Forest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forest }\n end\n end",
"def show\n @flaw = Flaw.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flaw }\n end\n end",
"def InfoFarmacia\n \tid = params[:id]\n @farmacias = Farmacium.find_by_sql(\"SELECT nombre, correo, direccion, latitud, longitud, telefono1, telefono2 FROM farmacia where id = #{id}\")\n render json: @farmacias\n end",
"def show\n @farmer = Farmer.find(params[:id])\n\t\t@dispensals = @farmer.dispensals.all.paginate(:page => params[:page], :order => 'updated_at DESC', :per_page => 5)\n\t\t@donations = @farmer.donations.all.paginate(:page => params[:page], :order => 'updated_at DESC', :per_page => 5)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @farmer }\n end\n end",
"def show\n @faction = Faction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faction }\n end\n end",
"def show \n @route = Route.find(params[:id])\n \n respond_to do |format|\n format.html \n format.json { render json: @route }\n end\n end",
"def show\n @magzine = Magzine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @magzine }\n end\n end",
"def show\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flight }\n end\n end",
"def show\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flight }\n end\n end",
"def show\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fabric }\n end\n end",
"def show\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @farm }\n end\n end",
"def index\n\t @fares = Fare.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @fares }\n\t end\n\tend",
"def show\n render json: Festival.build_for(params[:id]).to_json\n end",
"def show\n\t @fare = Fare.find(params[:id])\n\n\t respond_to do |format|\n\t\tformat.html # show.html.erb\n\t\tformat.json { render json: @fare }\n\t end\n\tend",
"def show\n @route = Route.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @route }\n end\n end",
"def show\n @flsa_result = FlsaResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flsa_result }\n end\n end",
"def show\n @route = Route.find(params[:id])\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @route }\n end\n end",
"def show\n\t\t@flight = Flight.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @flight }\n\t\tend\n\tend",
"def show\n @farm = Farm.find(params[:id])\n @hash = Gmaps4rails.build_markers(@farm) do |farm, marker|\n marker.lat farm.latitude\n marker.lng farm.longitude\n marker.infowindow farm.address\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @farm }\n end\n end",
"def show\n require 'net/http'\n require 'json'\n\n response = Net::HTTP.get_response( URI.parse( \"http://freeshit.firebaseio.com/items/%s.json\" % [ params[:id] ] ) );\n\n begin\n @fb_item = JSON.parse(response.body)\n rescue\n render :status => 404, :text => 'Item not found.'\n return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fb_item }\n end\n end",
"def index \n fans = Fan.all \n render json: fans \n end",
"def show\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @golfer }\n end\n end",
"def index\n @community_farms = CommunityFarm.all\n end",
"def show\n @fam = Fam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fam }\n end\n end",
"def new\n @foam = Foam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foam }\n end\n end",
"def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end",
"def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end",
"def index\n @flights = Flight.all\n render json: @flights\n end",
"def index\n @favorite_routes = FavoriteRoute.all\n render json: @favorite_routes\n end",
"def show\n @fueltype = Fueltype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fueltype }\n end\n end",
"def show\n\n respond_to do |format|\n format.html { # show.html.erb\n @flyer_info = FlyerInfo.find(params[:id])\n }\n format.json {\n render json: getflyer(params[:id])\n }\n end\n\n end",
"def show\n @films_box = FilmsBox.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @films_box }\n end\n end",
"def show\n @fleet = Fleet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fleet }\n end\n end",
"def show\n render json: @favorite_route\n end",
"def index\n @farms = Farm.all.select { |farm| current_user.has_role?(:admin, farm)}\n\n respond_to do |format|\n if(@farms.size == 1)\n format.html {redirect_to(@farms.first)}\n else\n format.html # index.html.erb\n end\n end\n end",
"def show\n @frete = Frete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @frete }\n end\n end",
"def show\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spoofer }\n end\n end",
"def index\n @farmers = Farmer.search(params[:search]).sort_by_name.paginate(:page => params[:page], :order => 'name ASC', :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n\t\t\tformat.js\n format.json { render json: @farmers }\n end\n end",
"def show\n respond_to do |format|\n format.json { render json: @uri, status: 200 }\n end\n end",
"def new\n @farm = Farm.new\n set_page_title\n @hog_owners = HogOwner.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farm }\n end\n end",
"def show\n @frais_hebergement = FraisHebergement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @frais_hebergement }\n end\n end",
"def show\n @smurf = Smurf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smurf }\n end\n end",
"def show\n @futbolada = Futbolada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @futbolada }\n end\n end",
"def index\n @foams = Foam.order(\"lower(name) ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foams }\n end\n end",
"def show\n @fishing_method = FishingMethod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fishing_method }\n end\n end",
"def show\n @foiltype = Foiltype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foiltype }\n end\n end",
"def show\n @fund = Fund.friendly.find(params[:id])\n\n render json: @fund\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rayon }\n end\n end",
"def show\n @favorite_flyer = FavoriteFlyer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favorite_flyer }\n end\n end",
"def show\n @military_battle_faction_result = Military::BattleFactionResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @military_battle_faction_result }\n end\n end",
"def show\n begin\n @fucker = Fucker.find(params[:id])\n respond_to do |format|\n format.json { render json: @fucker }\n end\n rescue => err\n $log.warn(err)\n respond_to do |format|\n format.json { render json: err, status: :internal_server_error }\n end\n end\n end",
"def new\n @flight = Flight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flight }\n end\n end",
"def show\n @fred = Fred.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fred }\n end\n end",
"def show\n @artists = Artist.find(params[:id])\n puts @artists\n render json:@artists, status: :ok\n end",
"def show\n @ftype = Ftype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ftype }\n end\n end",
"def show \n @franchise_set = FranchiseSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @franchise_set }\n end\n end",
"def new\n @faction = Faction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faction }\n end\n end",
"def show\n @firearm = Firearm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @firearm }\n end\n end",
"def show\n @mostsmallroad = Mostsmallroad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallroad }\n end\n end",
"def list_farms\n\treturn if authorise_for_web(program_name?,'read') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:farms_page] = params['page']\n\n\t\t render_list_farms\n\n\t\t return \n\telse\n\t\tsession[:farms_page] = nil\n\tend\n\n\tlist_query = \"@farm_pages = Paginator.new self, Farm.count, @@page_size,@current_page\n\t @farms = Farm.find(:all,\n :select => \\\"farms.*, parties.party_name as farm_owner_code\\\",\n :joins => \\\"LEFT OUTER JOIN parties_roles ON parties_roles.id=farms.farm_owner LEFT OUTER JOIN parties on parties.id=parties_roles.party_id\\\" ,\n\t\t\t\t :limit => @farm_pages.items_per_page,\n :order => \\\" farms.farm_code,farms.farm_description ASC \\\",\n\t\t\t\t :offset => @farm_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_farms\nend",
"def show\n @floormaster = Floormaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @floormaster }\n end\n end",
"def index\n @fretes = Frete.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fretes }\n end\n end",
"def show\n @materia = Materia.find(params[:id])\n\n render json: @materia\n end",
"def show\n @finder = Finder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finder }\n end\n end",
"def show\n @filial = Filial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filial }\n end\n end",
"def show\n @flights = Flight.find(params[:id])\n \n respond_to do |format|\n format.html \n format.json { render json: @flights, :include => :airplane} \n end\n end",
"def new\n @favorite_flyer = FavoriteFlyer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @favorite_flyer }\n end\n end",
"def show\n @fire = Fire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fire }\n end\n end",
"def index\n render json: @fiestas\n end",
"def show\n @familium = Familium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @familium }\n end\n end",
"def show\n @family = get_family(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def show\n render json: @light\n end",
"def show\n\t\trespond_to do |format|\n\t\t\tformat.html { }\n\t\t\tformat.json { render :json => {:fallacyfolder => @fallacyfolder}.to_json }\n\t\tend\n\tend",
"def show\n @foro = Foro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foro }\n end\n end",
"def show\n @fortune = Fortune.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fortune }\n end\n end",
"def show\n fatura = Fatura.find(params[:id])\n render json: {status: 'SUCCESS', message:'Fatura loaded', data:fatura}, status: :ok\n end",
"def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end",
"def show\n @plane = Plane.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plane }\n end\n end",
"def show\n @flat = Flat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flat }\n end\n end",
"def show\n @flat = Flat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flat }\n end\n end",
"def show\n render json: Alien.find(params[\"id\"])\n end",
"def show\n @fan_out = FanOut.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fan_out }\n end\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @farm }\n end\n end",
"def show\n @bus_route = BusRoute.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bus_route }\n end\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @farm }\n end\n end",
"def create\n @farm = Farm.new(farm_params)\n\n if @farm.save\n render :show, status: :created, location: api_farm_url(@farm)\n else\n render json: @farm.errors, status: :unprocessable_entity\n end\n end",
"def index\n @farmer_types = FarmerType.all\n end"
] | [
"0.70541817",
"0.6974336",
"0.6974336",
"0.6901509",
"0.6893884",
"0.6825972",
"0.6701643",
"0.6669254",
"0.66371167",
"0.6447422",
"0.6429127",
"0.64071226",
"0.62730056",
"0.62407124",
"0.6234928",
"0.6228568",
"0.62281644",
"0.620606",
"0.61874175",
"0.61850303",
"0.61848867",
"0.61798894",
"0.6137627",
"0.612509",
"0.61222756",
"0.6108555",
"0.61049825",
"0.6102858",
"0.60771805",
"0.6076585",
"0.60502476",
"0.6039174",
"0.60327345",
"0.6023803",
"0.6020859",
"0.6010062",
"0.5993961",
"0.599232",
"0.5988769",
"0.59846157",
"0.5984048",
"0.59733844",
"0.59725934",
"0.59684575",
"0.59222823",
"0.59191686",
"0.59112704",
"0.5905836",
"0.5905543",
"0.59047467",
"0.5895517",
"0.58888215",
"0.5881035",
"0.58790094",
"0.5870832",
"0.5862682",
"0.5862571",
"0.58612424",
"0.5859211",
"0.5859083",
"0.58569044",
"0.5855176",
"0.5838851",
"0.5837067",
"0.5830159",
"0.5826278",
"0.5819597",
"0.5817521",
"0.58109665",
"0.58079976",
"0.58036065",
"0.5799019",
"0.5797787",
"0.579612",
"0.57871413",
"0.57869",
"0.57866544",
"0.57866204",
"0.5782403",
"0.57818204",
"0.57801926",
"0.5779311",
"0.57787997",
"0.57764083",
"0.5772743",
"0.5770268",
"0.5767369",
"0.57659423",
"0.5765598",
"0.5760248",
"0.5759014",
"0.57584476",
"0.57584476",
"0.57563925",
"0.5752989",
"0.57499784",
"0.5749259",
"0.5749032",
"0.5747018",
"0.57463294"
] | 0.6181077 | 21 |
GET /farms/new GET /farms/new.json | def new
@farm = Farm.new(:user_id => @user.id)
respond_with(@user,@farm)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farm }\n end\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @farm }\n end\n end",
"def new\n @foam = Foam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foam }\n end\n end",
"def new\n @farmer = Farmer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farmer }\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 @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 @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 new\n @flight = Flight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flight }\n end\n end",
"def new\n @flaw = Flaw.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flaw }\n end\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @farm }\n end\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @farm }\n end\n end",
"def new\n @faction = Faction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faction }\n end\n end",
"def new\n\t @fare = Fare.new\n\n\t respond_to do |format|\n\t\tformat.html # new.html.erb\n\t\tformat.json { render json: @fare }\n\t end\n\tend",
"def new #GIRO: POST /foals(.:format) foals#create\n@foal = Foal.new #GIRO: http://localhost:3000/foals/new\nend",
"def new\n @ftype = Ftype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ftype }\n end\n end",
"def new\n @fam = Fam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fam }\n end\n end",
"def new\n @foiltype = Foiltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foiltype }\n end\n end",
"def new\n @title = t('view.firms.new_title')\n @firm = Firm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @firm }\n end\n end",
"def new\n @farm = Farm.new\n set_page_title\n @hog_owners = HogOwner.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farm }\n end\n end",
"def new\n @fav = Fav.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fav }\n end\n end",
"def new\n @fabric = Fabric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fabric }\n end\n end",
"def new\n @fishing_method = FishingMethod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fishing_method }\n end\n end",
"def new\n @finder = Finder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finder }\n end\n end",
"def new\n @fleet = Fleet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fleet }\n end\n end",
"def new\n @fueltype = Fueltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fueltype }\n end\n end",
"def new\n @father = Father.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @father }\n end\n end",
"def new\n @flower = Flower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flower }\n end\n end",
"def new\n @fish_type = FishType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fish_type }\n end\n end",
"def new\n @flight_schedule = FlightSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flight_schedule }\n end\n end",
"def new\n @spawner = Spawner.new\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spawner }\n end\n end",
"def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end",
"def new\n @star_fact = Star::Fact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @star_fact }\n end\n end",
"def new\n @mall = Mall.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mall }\n end\n end",
"def new\n @zone = Zone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zone }\n end\n end",
"def new\n @foil = Foil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foil }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\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 (kick and return) if not is_god?\n @team = Team.new\n @mode = :new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @favorite_flyer = FavoriteFlyer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @favorite_flyer }\n end\n end",
"def new\n @taf = Taf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taf }\n end\n end",
"def new\n @title = t('view.flows.new_title')\n @flow = Flow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flow }\n end\n end",
"def new\n @food = Food.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @food }\n end\n end",
"def new\n @barn = Barn.new\n set_page_title\n if current_user.is_admin?\n @farms = Farm.all\n @locations = []\n @barns = []\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @barn }\n end\n end",
"def create\n @farm = Farm.new(params[:farm])\n\n respond_to do |format|\n if @farm.save\n format.html { redirect_to @farm, notice: 'Farm was successfully created.' }\n format.json { render json: @farm, status: :created, location: @farm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @farm = Farm.new(params[:farm])\n\n respond_to do |format|\n if @farm.save\n format.html { redirect_to @farm, notice: 'Farm was successfully created.' }\n format.json { render json: @farm, status: :created, location: @farm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @transport_route = TransportRoute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transport_route }\n end\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 @family_crest = FamilyCrest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_crest }\n end\n end",
"def new\n @firm = Firm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @firm }\n end\n end",
"def new\n @railway = Railway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @railway }\n end\n end",
"def new\n @frete = Frete.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @frete }\n end\n end",
"def new\n @fridge = Fridge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fridge }\n end\n end",
"def new\n @restaurant = Restaurant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def new\n @restaurant = Restaurant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def new\n @restaurant = Restaurant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def new\n @restaurant = Restaurant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def new\n @restaurant = Restaurant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def new\n @foodhamper = Foodhamper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foodhamper }\n end\n end",
"def new\n @fortune = Fortune.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fortune }\n end\n end",
"def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n respond_to do |format|\n format.html { # new.html.erb\n @flyer_info = FlyerInfo.new\n }\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 @smurf = Smurf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @smurf }\n end\n end",
"def new\n place = Place.new\n\n render json: place\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 @golfer = Golfer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @golfer }\n end\n end",
"def new\n @magzine = Magzine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @magzine }\n end\n end",
"def new\r\n @restaurant = Restaurant.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @restaurant }\r\n end\r\n end",
"def new\n @fwlist = Fwlist.new\n \t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fwlist }\n end\n end",
"def new\n @moose = Moose.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moose }\n end\n end",
"def new\n @pattern = Pattern.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pattern }\n end\n end",
"def create\n @farm = Farm.new(farm_params)\n\n if @farm.save\n render :show, status: :created, location: api_farm_url(@farm)\n else\n render json: @farm.errors, status: :unprocessable_entity\n end\n end",
"def new\n @slam = Slam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slam }\n end\n end",
"def new\n @reltramovano = Reltramovano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reltramovano }\n end\n end",
"def new\n @flavor = Flavor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @flavor }\n end\n end",
"def new\n @flsa_result = FlsaResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flsa_result }\n end\n end",
"def new\n @arrival = Arrival.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival }\n end\n end",
"def new\n @arrival = Arrival.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival }\n end\n end",
"def new\n @fixture = Fixture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fixture }\n end\n end",
"def new\n @resource = Resource.new\n respond_to do |format|\n format.html {render action: :new} # new.html.erb\n format.json { render json: @resource }\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 @manga = Manga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manga }\n end\n end",
"def new\n @have = Have.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @have }\n end\n end",
"def new\n @entity = Entity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n @where_to_stay = WhereToStay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @where_to_stay }\n end\n end",
"def new\n @favourite_food = FavouriteFood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @favourite_food }\n end\n end",
"def new\n @floormaster = Floormaster.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @floormaster }\n end\n end",
"def new\n @fact = fact_type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fact }\n end\n end",
"def new\n @forest = Forest.new\n @forest.trees.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @forest }\n end\n end",
"def new\n @mostsmallroad = Mostsmallroad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mostsmallroad }\n end\n end",
"def new\n @form = Form.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @form }\n end\n end",
"def new\n @form = Form.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @form }\n end\n end",
"def new\n @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\n end\n end",
"def new\n @mtype = Mtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mtype }\n end\n end"
] | [
"0.7700876",
"0.7658627",
"0.75480705",
"0.7426537",
"0.7354313",
"0.73320216",
"0.73320216",
"0.73320216",
"0.72737706",
"0.7213169",
"0.71769404",
"0.71762913",
"0.7174545",
"0.71429086",
"0.7031144",
"0.70288855",
"0.6980324",
"0.6979269",
"0.69719297",
"0.69646156",
"0.6962489",
"0.6928536",
"0.6926023",
"0.69137937",
"0.6900387",
"0.6900293",
"0.68954355",
"0.68922377",
"0.68858457",
"0.6863886",
"0.6860169",
"0.68528014",
"0.6851221",
"0.6847296",
"0.68321955",
"0.6828157",
"0.68262523",
"0.681508",
"0.6808526",
"0.6803071",
"0.680218",
"0.6801387",
"0.67966473",
"0.6796561",
"0.67883253",
"0.6782911",
"0.6782911",
"0.6781739",
"0.6780873",
"0.6779166",
"0.6778489",
"0.67727774",
"0.6772674",
"0.6769697",
"0.67686236",
"0.67686236",
"0.67686236",
"0.67686236",
"0.67686236",
"0.6764161",
"0.6761178",
"0.6758046",
"0.6742521",
"0.6742521",
"0.6742521",
"0.67405176",
"0.67382973",
"0.672884",
"0.67274153",
"0.6715307",
"0.6715307",
"0.671466",
"0.67141455",
"0.67096174",
"0.67091596",
"0.67076725",
"0.6707073",
"0.6705778",
"0.66992545",
"0.6697991",
"0.669666",
"0.66904247",
"0.66878974",
"0.66878974",
"0.6686837",
"0.6682201",
"0.6678028",
"0.6678028",
"0.66726446",
"0.66715497",
"0.6670428",
"0.66687334",
"0.66634786",
"0.66607994",
"0.6660736",
"0.66581327",
"0.6658061",
"0.6647896",
"0.6647896",
"0.664517",
"0.6642432"
] | 0.0 | -1 |
POST /farms POST /farms.json | def create
@farm = Farm.new(params[:farm])
@farm.save
respond_with(@farm)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @farm = Farm.new(farm_params)\n\n if @farm.save\n render :show, status: :created, location: api_farm_url(@farm)\n else\n render json: @farm.errors, status: :unprocessable_entity\n end\n end",
"def create\n @farm = Farm.new(params[:farm])\n\n respond_to do |format|\n if @farm.save\n format.html { redirect_to @farm, notice: 'Farm was successfully created.' }\n format.json { render json: @farm, status: :created, location: @farm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @farm = Farm.new(params[:farm])\n\n respond_to do |format|\n if @farm.save\n format.html { redirect_to @farm, notice: 'Farm was successfully created.' }\n format.json { render json: @farm, status: :created, location: @farm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @farm = Farm.new(farm_params)\n\n respond_to do |format|\n if @farm.save\n format.html { redirect_to @farm, notice: '農家登録が完了しました。' }\n format.json { render :show, status: :created, location: @farm }\n else\n format.html { render :new }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @farmer = Farmer.new(params[:farmer])\n\n respond_to do |format|\n if @farmer.save\n format.html { redirect_to @farmer, notice: 'Farmer was successfully created.' }\n format.json { render json: @farmer, status: :created, location: @farmer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @farmer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def farms\n user = User.find(params[:id])\n\n @farms = []\n # Find which farms this user is authorized to access\n if (user.is_hog_owner?)\n @farms = user.owner.farms\n elsif user.is_barn_manager?\n @farms << user.owner.barn.location.farm\n elsif user.is_site_manager?\n @farms << user.owner.location.farm\n elsif user.is_farm_owner?\n @farms << user.owner.farm\n elsif user.is_admin?\n @farms = Farm.all\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @farms }\n end\n end",
"def create\n @farm = Farm.new(params[:farm])\n @farm.user = @logged_user;\n respond_to do |format|\n if @farm.save\n format.html { redirect_to @farm, :notice => 'Farm was successfully created.' }\n format.json { render :json => @farm, :status => :created, :location => @farm }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @farm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @farm = Farm.new(params[:farm])\n\n respond_to do |format|\n if @farm.save\n flash[:notice] = 'Farm was successfully created.'\n format.html { redirect_to(@farm) }\n format.xml { render :xml => @farm, :status => :created, :location => @farm }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @farm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farm }\n end\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @farm }\n end\n end",
"def create\n @farming = Farming.new(farming_params)\n\n respond_to do |format|\n if @farming.save\n format.html { redirect_to @farming, notice: 'Farming was successfully created.' }\n format.json { render :show, status: :created, location: @farming }\n else\n format.html { render :new }\n format.json { render json: @farming.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @farms = Farm.all\n\t\trespond_with(@users,@farms)\n end",
"def create\n @farm_field = FarmField.new(farm_field_params)\n\n if @farm_field.save\n render :show, status: :created, location: api_farm_field_url(@farm_field)\n else\n render json: @farm_field.errors, status: :unprocessable_entity\n end\n end",
"def index\n @farms = Farm.all\n end",
"def index\n @farms = Farm.all\n end",
"def index\n @farms = current_user.farms\n set_page_title\n\n @barn = []\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @farms }\n end\n end",
"def new\n @farmer = Farmer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farmer }\n end\n end",
"def create\n @favorite_route = FavoriteRoute.new(favorite_route_params)\n if @favorite_route.save\n render json: @favorite_route, status: :created, location: @favorite_route\n else\n render json: @favorite_route.errors, status: :unprocessable_entity\n end \n end",
"def create\n @farmer_type = FarmerType.new(farmer_type_params)\n\n respond_to do |format|\n if @farmer_type.save\n format.html { redirect_to @farmer_type, notice: 'Farmer type was successfully created.' }\n format.json { render :show, status: :created, location: @farmer_type }\n else\n format.html { render :new }\n format.json { render json: @farmer_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sewage_farm = SewageFarm.new(sewage_farm_params)\n\n respond_to do |format|\n if @sewage_farm.save\n format.html { redirect_to @sewage_farm, notice: 'Sewage farm was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sewage_farm }\n else\n format.html { render action: 'new' }\n format.json { render json: @sewage_farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @foam = Foam.new(params[:foam])\n\n respond_to do |format|\n if @foam.save\n format.html { redirect_to @foam, notice: 'Foam was successfully created.' }\n format.json { render json: @foam, status: :created, location: @foam }\n else\n format.html { render action: \"new\" }\n format.json { render json: @foam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(params[:flight])\n\n if @flight.save\n render json: @flight, status: :created, location: @flight\n else\n render json: @flight.errors, status: :unprocessable_entity\n end\n end",
"def create\n @panier = @farm.paniers.new(panier_params)\n\n respond_to do |format|\n if @panier.save\n format.html { redirect_to farm_paniers_path(@farm.slug), notice: 'Vous avez bien créé un nouveau panier.' }\n format.json { render :show, status: :created, location: @farm.slug }\n else\n format.html { render :new }\n format.json { render json: @panier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mfarmkziz = Mfarmkziz.new(mfarmkziz_params)\n\n respond_to do |format|\n if @mfarmkziz.save\n format.html { redirect_to @mfarmkziz, notice: 'Mfarmkziz was successfully created.' }\n format.json { render :show, status: :created, location: @mfarmkziz }\n else\n format.html { render :new }\n format.json { render json: @mfarmkziz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @farm = Farm.new(:user_id => @user.id)\n respond_with(@user,@farm) \n end",
"def new\n @farm = Farm.new\n set_page_title\n @hog_owners = HogOwner.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farm }\n end\n end",
"def create\n @fam = Fam.new(params[:fam])\n\n respond_to do |format|\n if @fam.save\n flash[:notice] = 'Fam was successfully created.'\n format.html { redirect_to(@fam) }\n format.xml { render :xml => @fam, :status => :created, :location => @fam }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @fam.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @mslane = Mslane.new(mslane_params)\n\n respond_to do |format|\n if @mslane.save\n format.html { redirect_to @mslane, notice: 'Mslane was successfully created.' }\n format.json { render :show, status: :created, location: @mslane }\n else\n format.html { render :new }\n format.json { render json: @mslane.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @farmer = Farmer.new(farmer_params)\n\n respond_to do |format|\n if @farmer.save\n sign_in @farmer\n format.html { redirect_to @farmer, notice: 'Welcome to Wolfbane. May your sheep live long and prosper.' } #sheep_index_path\n format.json { render action: 'show', status: :created, location: @farmer }\n else\n format.html { render action: 'new' }\n format.json { render json: @farmer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :ok }\n end\n end",
"def create\n @federation = Federation.new(federation_params)\n\n respond_to do |format|\n if @federation.save\n format.html { redirect_to @federation, notice: 'Federation was successfully created.' }\n format.json { render :show, status: :created, location: @federation }\n format.xml { render :xml => @federation, :status => :created, :location => @federation }\n else\n format.html { render :new }\n format.json { render json: @federation.errors, status: :unprocessable_entity }\n format.xml { render :xml => @federation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @farm.destroy\n respond_to do |format|\n format.html { redirect_to farms_url, notice: 'データを消去しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :no_content }\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 create\n megam_rest.post_appdefn(to_hash)\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @farm }\n end\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @farm }\n end\n end",
"def create\n @mamal = Mamal.new(mamal_params)\n\n respond_to do |format|\n if @mamal.save\n format.html { redirect_to @mamal, notice: 'Mamal was successfully created.' }\n format.json { render :show, status: :created, location: @mamal }\n else\n format.html { render :new }\n format.json { render json: @mamal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @artsfest_detail = ArtsfestDetail.new(artsfest_detail_params)\n\n respond_to do |format|\n if @artsfest_detail.save\n format.html { redirect_to @artsfest_detail, notice: 'Artsfest detail was successfully created.' }\n format.json { render :show, status: :created, location: @artsfest_detail }\n else\n format.html { render :new }\n format.json { render json: @artsfest_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def farm_params\n params.require(:farm).permit(:farmname, :farm_url, :area, :image_url, :message, :farmtype, { :crop_ids => [] })\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 create\n @community_farm = @raid.community_farms.new(community_farm_params)\n @community_farm.submited_by = current_user.id\n respond_to do |format|\n if @community_farm.save\n format.html { redirect_to dashboard_index_path, notice: COMMUNITY_ASSIGN }\n format.json { render :show, status: :created, location: @community_farm }\n else\n format.html { render :new }\n format.json { render json: @community_farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @firearm = Firearm.new(params[:firearm])\n\n respond_to do |format|\n if @firearm.save\n format.html { redirect_to(@firearm, :notice => 'Firearm was successfully created.') }\n format.xml { render :xml => @firearm, :status => :created, :location => @firearm }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @firearm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @forest = Forest.new(forest_params)\n\n respond_to do |format|\n if @forest.save\n format.html { redirect_to @forest, notice: 'Forest was successfully created.' }\n format.json { render action: 'show', status: :created, location: @forest }\n else\n format.html { render action: 'new' }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @farm = Farm.new(params[:farm])\n @farm.user_id = session[:s_user_id]\n\n respond_to do |format|\n if @farm.save\n session[:s_farm_id] = @farm.id\n flash[:notice] = 'Farm was successfully created. You can now add and manage expenses.'\n format.html { redirect_to(:controller => :farms, :action => :edit, :id => @farm.id, \t:notice => 'Farm was successfully created. You can now add expenses.') }\n format.xml { render :xml => @farm, :status => :created, :location => @farm }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @farm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @forest = Forest.new(params[:forest])\n\n respond_to do |format|\n if @forest.save\n format.html { redirect_to @forest, notice: 'Forest was successfully created.' }\n format.json { render json: @forest, status: :created, location: @forest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fostered = Fostered.new(fostered_params)\n\n respond_to do |format|\n if @fostered.save\n format.html { redirect_to @fostered, notice: 'Fostered was successfully created.' }\n format.json { render action: 'show', status: :created, location: @fostered }\n else\n format.html { render action: 'new' }\n format.json { render json: @fostered.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @flight = Flight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flight }\n end\n end",
"def destroy\n @farmer.destroy\n respond_to do |format|\n format.html { redirect_to farmers_url }\n format.json { head :no_content }\n end\n end",
"def create\n @farmexpense = Farmexpense.new(params[:farmexpense])\n @farmexpense.user_id = session[:s_user_id]\n @farmexpense.farm_id = session[:s_farm_id]\n respond_to do |format|\n if @farmexpense.save\n format.html { redirect_to(:controller => \"farms\", :action => \"edit\", :id => session[:s_farm_id], :notice => 'farm expense was successfully updated.') }\n format.xml { render :xml => @farmexpense, :status => :created, :location => @farmexpense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @farmexpense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @farmer = Farmer.find(params[:id])\n @farmer.destroy\n\n respond_to do |format|\n format.html { redirect_to farmers_url }\n format.json { head :no_content }\n end\n end",
"def create\n @todoroute = Todoroute.new(todoroute_params)\n\n respond_to do |format|\n if @todoroute.save\n format.html { redirect_to @todoroute, notice: 'Todoroute was successfully created.' }\n format.json { render :show, status: :created, location: @todoroute }\n else\n format.html { render :new }\n format.json { render json: @todoroute.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(params[:flight])\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render json: @flight, status: :created, location: @flight }\n else\n format.html { render action: \"new\" }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plantation = @farm.plantations.new(plantation_params)\n\n respond_to do |format|\n if @plantation.save\n format.html { redirect_to farm_plantations_path(@farm), notice: 'Vous avez bien planté ce légume.' }\n format.json { render :show, status: :created, location: @plantation }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: @plantation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fan_out = FanOut.new(params[:fan_out])\n\n respond_to do |format|\n if @fan_out.save\n format.html { redirect_to @fan_out, notice: 'Fan out was successfully created.' }\n format.json { render json: @fan_out, status: :created, location: @fan_out }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fan_out.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(flight_params)\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render action: 'show', status: :created, location: @flight }\n else\n format.html { render action: 'new' }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @farm }\n end\n end",
"def create\n @flight = Flight.new(flight_params)\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render :show, status: :created, location: @flight }\n else\n format.html { render :new }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(flight_params)\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render :show, status: :created, location: @flight }\n else\n format.html { render :new }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(flight_params)\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render :show, status: :created, location: @flight }\n else\n format.html { render :new }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(flight_params)\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render :show, status: :created, location: @flight }\n else\n format.html { render :new }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(flight_params)\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render :show, status: :created, location: @flight }\n else\n format.html { render :new }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, params)\n time(\"POST #{path}\") { Cloudflarer.new.post(path, params) }\n end",
"def create\n @flight = Flight.new(flight_params)\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render :show, status: :created, location: @flight }\n else\n format.html { render :new }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @floormaster = Floormaster.new(params[:floormaster])\n\n respond_to do |format|\n if @floormaster.save\n format.html { redirect_to(@floormaster, :notice => 'Floormaster was successfully created.') }\n format.xml { render :xml => @floormaster, :status => :created, :location => @floormaster }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @floormaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n plant = Plant.create(plant_params)\n render json: plant, status: :created\n end",
"def create\n @departamento = Departamento.new(departamento_params)\n\n if @departamento.save\n render json: @departamento, status: :created, location: @departamento\n else\n render json: @departamento.errors, status: :unprocessable_entity\n end\n end",
"def create\n @flight_schedule = FlightSchedule.new(params[:flight_schedule])\n\n respond_to do |format|\n if @flight_schedule.save\n format.html { redirect_to @flight_schedule, notice: 'Flight schedule was successfully created.' }\n format.json { render json: @flight_schedule, status: :created, location: @flight_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @flight_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @foam = Foam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foam }\n end\n end",
"def create\n @admin_fan = Fan.new(admin_fan_params)\n\n respond_to do |format|\n if @admin_fan.save\n format.html { redirect_to @admin_fan, notice: 'Fan was successfully created.' }\n format.json { render :show, status: :created, location: @admin_fan }\n else\n format.html { render :new }\n format.json { render json: @admin_fan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @falta = Falta.new(falta_params)\n\n respond_to do |format|\n if @falta.save\n format.html { redirect_to @falta, notice: \"Falta was successfully created.\" }\n format.json { render :show, status: :created, location: @falta }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @falta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @smurf = Smurf.new(params[:smurf])\n\n respond_to do |format|\n if @smurf.save\n format.html { redirect_to @smurf, notice: 'Smurf was successfully created.' }\n format.json { render json: @smurf, status: :created, location: @smurf }\n else\n format.html { render action: \"new\" }\n format.json { render json: @smurf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fm = Fm.new(fm_params)\n\n respond_to do |format|\n if @fm.save\n format.html { redirect_to @fm, notice: 'Fm was successfully created.' }\n format.json { render :show, status: :created, location: @fm }\n else\n format.html { render :new }\n format.json { render json: @fm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @muestra = Muestra.new(muestra_params)\n\n respond_to do |format|\n if @muestra.save\n format.html { redirect_to @muestra, notice: 'Muestra was successfully created.' }\n format.json { render :show, status: :created, location: @muestra }\n else\n format.html { render :new }\n format.json { render json: @muestra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @frat = Frat.new(frat_params)\n\n respond_to do |format|\n if @frat.save\n format.html { redirect_to @frat, notice: 'Frat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @frat }\n else\n format.html { render action: 'new' }\n format.json { render json: @frat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @franchise = @location.franchises.new(franchise_params)\n\n respond_to do |format|\n if @franchise.save\n format.html { redirect_to [@client, @location, @franchise], notice: 'Franchise was successfully created.' }\n format.json { render action: 'show', status: :created, location: @franchise }\n else\n format.html { render action: 'new' }\n format.json { render json: @franchise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @farming_student = FarmingStudent.new(farming_student_params)\n\n respond_to do |format|\n if @farming_student.save\n format.html { redirect_to @farming_student, notice: 'Farming student was successfully created.' }\n format.json { render :show, status: :created, location: @farming_student }\n else\n format.html { render :new }\n format.json { render json: @farming_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flightplan = Flightplan.new(flightplan_params)\n\n respond_to do |format|\n if @flightplan.save\n format.html { redirect_to @flightplan, notice: 'Flightplan was successfully created.' }\n format.json { render :show, status: :created, location: @flightplan }\n else\n format.html { render :new }\n format.json { render json: @flightplan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_route = Admin::Route.new(admin_route_params)\n\n respond_to do |format|\n if @admin_route.save\n format.html { redirect_to @admin_route, notice: 'Route was successfully created.' }\n format.json { render json: @admin_route, status: :created, location: @admin_route }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @magzine = Magzine.new(params[:magzine])\n\n respond_to do |format|\n if @magzine.save\n format.html { redirect_to @magzine, notice: 'Magzine was successfully created.' }\n format.json { render json: @magzine, status: :created, location: @magzine }\n else\n format.html { render action: \"new\" }\n format.json { render json: @magzine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicletypes = Vehicletype.all\n @destination_fare = DestinationFare.new(destination_fare_params)\n\n respond_to do |format|\n if @destination_fare.save\n format.html { redirect_to @destination_fare, notice: 'Destination fare was successfully created.' }\n format.json { render action: 'show', status: :created, location: @destination_fare }\n else\n format.html { render action: 'new' }\n format.json { render json: @destination_fare.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(farm_order_params)\n respond_to do |format|\n if @farm_order.save\n format.html { redirect_to @farm_order, notice: 'Farm order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @farm_order }\n else\n format.html { render action: 'new' }\n format.json { render json: @farm_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @famille = Famille.new(famille_params)\n\n respond_to do |format|\n if @famille.save\n format.html { redirect_to @famille, notice: 'Famille was successfully created.' }\n format.json { render :show, status: :created, location: @famille }\n\t else\n format.html { render :new }\n end\n end\n end",
"def create\n @food = @fridge.foods.create(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end",
"def create\n @films_box = FilmsBox.new(params[:films_box])\n\n respond_to do |format|\n if @films_box.save\n format.html { redirect_to @films_box, notice: 'Films box was successfully created.' }\n format.json { render json: @films_box, status: :created, location: @films_box }\n else\n format.html { render action: \"new\" }\n format.json { render json: @films_box.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @farmaceutico = Farmaceutico.new(farmaceutico_params)\n\n respond_to do |format|\n if @farmaceutico.save\n format.html { redirect_to @farmaceutico, notice: 'Farmaceutico was successfully created.' }\n format.json { render :show, status: :created, location: @farmaceutico }\n else\n format.html { render :new }\n format.json { render json: @farmaceutico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restaurant_floor_plan = RestaurantFloorPlan.new(restaurant_floor_plan_params)\n\n respond_to do |format|\n if @restaurant_floor_plan.save\n format.html { redirect_to @restaurant_floor_plan, notice: 'Restaurant floor plan was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant_floor_plan }\n else\n format.html { render :new }\n format.json { render json: @restaurant_floor_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @community_farms = CommunityFarm.all\n end",
"def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end",
"def create\n @admin_craftsman = Admin::Craftsman.new(admin_craftsman_params)\n\n respond_to do |format|\n if @admin_craftsman.save\n format.html { redirect_to @admin_craftsman, notice: 'Craftsman was successfully created.' }\n format.json { render :show, status: :created, location: @admin_craftsman }\n else\n format.html { render :new }\n format.json { render json: @admin_craftsman.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 create \n @franchise_set = FranchiseSet.new(params[:franchise_set])\n\n respond_to do |format|\n if @franchise_set.save\n format.html { redirect_to \"/franchise_sets/\", notice: 'Franchise set was successfully created.' }\n format.json { render json: @franchise_set, status: :created, location: @franchise_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @franchise_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @spoofer = Spoofer.new\n\n\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spoofer }\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 create\n @flightstat = Flightstat.new(flightstat_params)\n\n respond_to do |format|\n if @flightstat.save\n format.html { redirect_to @flightstat, notice: 'Flightstat was successfully created.' }\n format.json { render :show, status: :created, location: @flightstat }\n else\n format.html { render :new }\n format.json { render json: @flightstat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restaurant = Restaurant.new(restaurant_params)\n\n if @restaurant.save\n render :show, status: :created, location: @restaurant\n else\n render json: @restaurant.errors, status: :unprocessable_entity\n end\n end",
"def new\n @faction = Faction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faction }\n end\n end",
"def create\n @zone = Zone.new(zone_params)\n\n if @zone.save\n render json: @zone, status: :created, location: @zone\n else\n render json: @zone.errors, status: :unprocessable_entity\n end\n end"
] | [
"0.6864054",
"0.66907626",
"0.66907626",
"0.65416205",
"0.6459743",
"0.6384204",
"0.6291221",
"0.6266345",
"0.62352663",
"0.6190006",
"0.61686873",
"0.61450535",
"0.61290795",
"0.61204994",
"0.61204994",
"0.611606",
"0.60479647",
"0.5997131",
"0.5930209",
"0.5914418",
"0.5814631",
"0.57556176",
"0.56940377",
"0.5685633",
"0.5672428",
"0.5649493",
"0.56300914",
"0.5623145",
"0.56205195",
"0.56147707",
"0.5603221",
"0.55992806",
"0.55911016",
"0.55911016",
"0.55911016",
"0.55810267",
"0.5574825",
"0.5536279",
"0.5535227",
"0.5521523",
"0.5515456",
"0.549349",
"0.54925334",
"0.54906625",
"0.5489289",
"0.54789716",
"0.5471021",
"0.5469248",
"0.5467529",
"0.54531205",
"0.5446033",
"0.54440016",
"0.5438642",
"0.5431295",
"0.5423461",
"0.5416088",
"0.54045063",
"0.54027957",
"0.5396358",
"0.5395153",
"0.5395153",
"0.5395153",
"0.5395153",
"0.5395153",
"0.5392819",
"0.53912514",
"0.53897053",
"0.538916",
"0.5379529",
"0.5374209",
"0.5369276",
"0.53678197",
"0.53626275",
"0.5361516",
"0.53610927",
"0.53585696",
"0.53584075",
"0.53578705",
"0.53536254",
"0.5351018",
"0.53501683",
"0.5346949",
"0.53462464",
"0.5334784",
"0.53319335",
"0.5330766",
"0.53262305",
"0.53249216",
"0.532449",
"0.5315161",
"0.530899",
"0.5306384",
"0.5304378",
"0.5295846",
"0.5292438",
"0.52847445",
"0.52822423",
"0.52752674",
"0.5271114",
"0.52704453"
] | 0.64554 | 5 |
PUT /farms/1 PUT /farms/1.json | def update
@farm = Farm.find(params[:id])
respond_to do |format|
if @farm.update_attributes(params[:farm])
format.html { redirect_to @farm, notice: 'Farm was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @farm.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @farm.update(farm_params)\n render :show, status: :ok, location: api_farm_url(@farm)\n else\n render json: @farm.errors, status: :unprocessable_entity\n end\n end",
"def update\n @farmer = Farmer.find(params[:id])\n\n respond_to do |format|\n if @farmer.update_attributes(params[:farmer])\n format.html { redirect_to @farmer, notice: 'Farmer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @farmer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @foam = Foam.find(params[:id])\n\n respond_to do |format|\n if @foam.update_attributes(params[:foam])\n format.html { redirect_to @foam, notice: 'Foam was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n if @farm.update_attributes(params[:farm])\n flash[:notice] = 'Farm was successfully updated.'\n format.html { redirect_to(@farm) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @farm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n if @farm.update_attributes(params[:farm])\n format.html { redirect_to(\"/farmview\", :notice => 'Farm was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @farm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_farm\n @farm = Farm.find(params[:id])\n end",
"def set_farm\n @farm = Farm.find(params[:id])\n end",
"def create\n @farm = Farm.new(farm_params)\n\n if @farm.save\n render :show, status: :created, location: api_farm_url(@farm)\n else\n render json: @farm.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @farm.update(farm_params)\n format.html { redirect_to @farm, notice: '編集が完了しました。' }\n format.json { render :show, status: :ok, location: @farm }\n else\n format.html { render :edit }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @farm = Farm.find(params[:id])\n @farm.user = @logged_user;\n respond_to do |format|\n if @farm.update_attributes(params[:farm])\n format.html { redirect_to @farm, :notice => 'Farm was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @farm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @farm = Farm.new(params[:farm])\n\n respond_to do |format|\n if @farm.save\n format.html { redirect_to @farm, notice: 'Farm was successfully created.' }\n format.json { render json: @farm, status: :created, location: @farm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @farm = Farm.new(params[:farm])\n\n respond_to do |format|\n if @farm.save\n format.html { redirect_to @farm, notice: 'Farm was successfully created.' }\n format.json { render json: @farm, status: :created, location: @farm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @farm_field.update(farm_field_params)\n render :show, status: :ok, location: api_farm_field_url(@farm_field)\n else\n render json: @farm_field.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @farmer.update(farmer_params)\n format.html { redirect_to @farmer, notice: 'Farmer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @farmer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :ok }\n end\n end",
"def show\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @farm }\n end\n end",
"def update\n @fam = Fam.find(params[:id])\n\n respond_to do |format|\n if @fam.update_attributes(params[:fam])\n flash[:notice] = 'Fam was successfully updated.'\n format.html { redirect_to(@fam) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fam.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @farm = Farm.new(params[:farm])\n @farm.save\n respond_with(@farm)\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farm }\n end\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @farm }\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :no_content }\n end\n end",
"def set_fry_farm\n @fry_farm = FryFarm.find(params[:id])\n end",
"def index\n @farms = Farm.all\n end",
"def index\n @farms = Farm.all\n end",
"def update\n @flight = Flight.find(params[:id])\n\n if @flight.update(params[:flight])\n head :no_content\n else\n render json: @flight.errors, status: :unprocessable_entity\n end\n end",
"def set_farmer\n @farmer = Farmer.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @farming.update(farming_params)\n format.html { redirect_to @farming, notice: 'Farming was successfully updated.' }\n format.json { render :show, status: :ok, location: @farming }\n else\n format.html { render :edit }\n format.json { render json: @farming.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :manage, @flock\n\n respond_to do |format|\n if @flock.update(flock_params)\n format.html { redirect_to @flock, notice: \"Flock was successfully updated.\" }\n format.json { render :show, status: :ok, location: @flock }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @flock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_farming\n @farming = Farming.find(params[:id])\n end",
"def create\n @farm = Farm.new(farm_params)\n\n respond_to do |format|\n if @farm.save\n format.html { redirect_to @farm, notice: '農家登録が完了しました。' }\n format.json { render :show, status: :created, location: @farm }\n else\n format.html { render :new }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @farmer = Farmer.find(params[:id])\n @farmer.destroy\n\n respond_to do |format|\n format.html { redirect_to farmers_url }\n format.json { head :no_content }\n end\n end",
"def set_farm_field\n @farm_field = FarmField.find(params[:id])\n end",
"def update\n if @favorite_route.update(favorite_route_params)\n render json: @favorite_route, status: :ok, location: @favorite_route\n else\n render json: @favorite_route.errors, status: :unprocessable_entity\n end\n end",
"def update\n @community_farm = @raid.community_farms.find(params[:id])\n respond_to do |format|\n if @community_farm.update(community_farm_params)\n format.html { redirect_to dashboard_index_path, notice: COMMUNITY_ASSIGN }\n format.json { render :show, status: :ok, location: @community_farm }\n else\n format.html { render :edit }\n format.json { render json: @community_farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @farmer = Farmer.new(params[:farmer])\n\n respond_to do |format|\n if @farmer.save\n format.html { redirect_to @farmer, notice: 'Farmer was successfully created.' }\n format.json { render json: @farmer, status: :created, location: @farmer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @farmer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @firearm = Firearm.find(params[:id])\n\n respond_to do |format|\n if @firearm.update_attributes(params[:firearm])\n format.html { redirect_to(@firearm, :notice => 'Firearm was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @firearm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@restaurant = Restaurant.find(params[:id])\n\t\tif params[:foursquare_id] != \"\"\n\t\t\thttpbot = HTTPClient.new\n\t\t\thttp = httpbot.get(\"https://api.foursquare.com/v2/venues/#{restaurant_params[:foursquare_id]}?client_id=JKIGWG2CJUOHAJ1BHL11YFIGVD3MLQW2WGNEK35EZLWAWHGM\n&client_secret=ZNW4OWFODXJ50MBN1SPEKUODXMKWCH5DIWBCM3RMXNXYOCBS&v=20140806\")\n\t\t\tdata = JSON.parse(http.content)\n\t\t\trestaurant_params_with_4sq = {\n\t\t\t\tname: data[\"response\"][\"venue\"][\"name\"],\n\t\t\t\tcapacity: restaurant_params[:capacity],\n\t\t\t\tfoursquare_id: restaurant_params[:foursquare_id],\n\t\t\t\taddress_line_1: data[\"response\"][\"venue\"][\"location\"][\"address\"],\n\t\t\t\tcity: data[\"response\"][\"venue\"][\"location\"][\"city\"],\n\t\t\t\tprovince: data[\"response\"][\"venue\"][\"location\"][\"state\"],\n\t\t\t\tdescription: data[\"response\"][\"venue\"][\"photos\"][\"groups\"][0][\"items\"][0][\"prefix\"] + \"240x240\" + data[\"response\"][\"venue\"][\"photos\"][\"groups\"][0][\"items\"][0][\"suffix\"]\n\t\t\t}\n\t\tend\n\t\[email protected] (restaurant_params_with_4sq)\n\t\tredirect_to action: \"index\"\n\tend",
"def create\n @foam = Foam.new(params[:foam])\n\n respond_to do |format|\n if @foam.save\n format.html { redirect_to @foam, notice: 'Foam was successfully created.' }\n format.json { render json: @foam, status: :created, location: @foam }\n else\n format.html { render action: \"new\" }\n format.json { render json: @foam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @farm = Farm.find(params[:id])\n \tif request.path != (farm_path(@farm) )\n\t\t\tredirect_to @farm, status: :moved_permanently\n\t\tend\n respond_with(@farm)\n end",
"def update\n respond_to do |format|\n if @fabricsofaset.update(fabricsofaset_params)\n format.html { redirect_to @fabricsofaset, notice: 'Fabricsofaset was successfully updated.' }\n format.json { render :show, status: :ok, location: @fabricsofaset }\n else\n format.html { render :edit }\n format.json { render json: @fabricsofaset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_foaf\n @foaf = Foaf.friendly.find(params[:id])\n end",
"def set_foaf\n @foaf = Foaf.friendly.find(params[:id])\n end",
"def update\n @floormaster = Floormaster.find(params[:id])\n\n respond_to do |format|\n if @floormaster.update_attributes(params[:floormaster])\n format.html { redirect_to(@floormaster, :notice => 'Floormaster was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @floormaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end",
"def new\n @farmer = Farmer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farmer }\n end\n end",
"def update\n @farmexpense = Farmexpense.find(params[:id])\n\n respond_to do |format|\n if @farmexpense.update_attributes(params[:farmexpense])\n format.html { redirect_to(:controller => \"farms\", :action => \"edit\", :id => session[:s_farm_id], :notice => 'farm expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @farmexpense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @farms = Farm.all\n\t\trespond_with(@users,@farms)\n end",
"def create\n @farm = Farm.new(params[:farm])\n @farm.user = @logged_user;\n respond_to do |format|\n if @farm.save\n format.html { redirect_to @farm, :notice => 'Farm was successfully created.' }\n format.json { render :json => @farm, :status => :created, :location => @farm }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @farm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @farm = Farm.new(params[:farm])\n\n respond_to do |format|\n if @farm.save\n flash[:notice] = 'Farm was successfully created.'\n format.html { redirect_to(@farm) }\n format.xml { render :xml => @farm, :status => :created, :location => @farm }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @farm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @magzine = Magzine.find(params[:id])\n\n respond_to do |format|\n if @magzine.update_attributes(params[:magzine])\n format.html { redirect_to @magzine, notice: 'Magzine was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @magzine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @farmer_type.update(farmer_type_params)\n format.html { redirect_to @farmer_type, notice: 'Farmer type was successfully updated.' }\n format.json { render :show, status: :ok, location: @farmer_type }\n else\n format.html { render :edit }\n format.json { render json: @farmer_type.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 set_api_v1_flightmanifest\n @api_v1_flightmanifest = Flightmanifest.where(flightofferings_id: params[:flightofferings_id])\n end",
"def update\n @forest = Forest.find(params[:id])\n\n respond_to do |format|\n if @forest.update_attributes(params[:forest])\n format.html { redirect_to @forest, notice: 'Forest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to(farms_url) }\n format.xml { head :ok }\n end\n end",
"def update \n @franchise = @franchise_set.franchises.find(params[:id])\n\n respond_to do |format|\n franchise_set = FranchiseSet.find(params[:franchise_set_id])\n if @franchise.update_attributes(params[:franchise])\n format.html { redirect_to \"/franchise_sets/#{franchise_set.id}/edit\" , notice: 'Franchise was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @franchise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @frosting_flavor.update(frosting_flavor_params)\n format.html { redirect_to @frosting_flavor, notice: 'Frosting flavor was successfully updated.' }\n format.json { render :show, status: :ok, location: @frosting_flavor }\n else\n format.html { render :edit }\n format.json { render json: @frosting_flavor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def farms\n user = User.find(params[:id])\n\n @farms = []\n # Find which farms this user is authorized to access\n if (user.is_hog_owner?)\n @farms = user.owner.farms\n elsif user.is_barn_manager?\n @farms << user.owner.barn.location.farm\n elsif user.is_site_manager?\n @farms << user.owner.location.farm\n elsif user.is_farm_owner?\n @farms << user.owner.farm\n elsif user.is_admin?\n @farms = Farm.all\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @farms }\n end\n end",
"def update\n respond_to do |format|\n if @sewage_farm.update(sewage_farm_params)\n format.html { redirect_to @sewage_farm, notice: 'Sewage farm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sewage_farm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @farm = Farm.new(:user_id => @user.id)\n respond_with(@user,@farm) \n end",
"def update\n respond_to do |format|\n if @fat.update(fat_params)\n format.html { redirect_to @fat, notice: 'Fat was successfully updated.' }\n format.json { render :show, status: :ok, location: @fat }\n else\n format.html { render :edit }\n format.json { render json: @fat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_farmer_family\n @farmer_family = FarmerFamily.find(params[:id])\n end",
"def create\n @farm_field = FarmField.new(farm_field_params)\n\n if @farm_field.save\n render :show, status: :created, location: api_farm_field_url(@farm_field)\n else\n render json: @farm_field.errors, status: :unprocessable_entity\n end\n end",
"def show\n @foam = Foam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foam }\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 destroy\n @farmer.destroy\n respond_to do |format|\n format.html { redirect_to farmers_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @magzine.update(magzine_params)\n format.html { redirect_to @magzine, notice: 'Magzine was successfully updated.' }\n format.json { render :show, status: :ok, location: @magzine }\n else\n format.html { render :edit }\n format.json { render json: @magzine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @farm.destroy\n respond_to do |format|\n format.html { redirect_to farms_url, notice: 'データを消去しました。' }\n format.json { head :no_content }\n end\n end",
"def update\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n if @flight.update_attributes(params[:flight])\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fm.update(fm_params)\n format.html { redirect_to @fm, notice: 'Fm was successfully updated.' }\n format.json { render :show, status: :ok, location: @fm }\n else\n format.html { render :edit }\n format.json { render json: @fm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sphere = Sphere.find(params[:id])\n\n respond_to do |format|\n if @sphere.update_attributes(params[:sphere])\n format.html { redirect_to @sphere, notice: 'Sphere a été édité avec succès.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sphere.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n if @flight.update_attributes(params[:flight])\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @flight = Flight.find(params[:id])\n render json: @flight\n end",
"def put(path, &block)\n route 'PUT', path, &block\n end",
"def update\n respond_to do |format|\n if @falta.update(falta_params)\n format.html { redirect_to @falta, notice: \"Falta was successfully updated.\" }\n format.json { render :show, status: :ok, location: @falta }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @falta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @faction = Faction.find(params[:id])\n\n respond_to do |format|\n if @faction.update_attributes(params[:faction])\n format.html { redirect_to admin_factions_url, notice: 'Faction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @faction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @festival = Festival.find(params[:id])\n\n respond_to do |format|\n if @festival.update_attributes(params[:festival])\n format.html { redirect_to @festival, notice: 'Festival was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @festival.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fbo.update(fbo_params)\n format.html { redirect_to @fbo, notice: 'Fbo was successfully updated.' }\n format.json { render :show, status: :ok, location: @fbo }\n else\n format.html { render :edit }\n format.json { render json: @fbo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n if @fabric.update_attributes(params[:fabric])\n format.html { redirect_to @fabric, notice: 'Fabric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fabric.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @add_fuel.update(add_fuel_params)\n format.html { redirect_to @add_fuel, notice: (t 'add_fuels.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @add_fuel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n @franchise_set = FranchiseSet.find(params[:id])\n\n respond_to do |format|\n if @franchise_set.update_attributes(params[:franchise_set])\n format.html { redirect_to \"/franchise_sets/\", notice: 'Franchise set was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @franchise_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fostered.update(fostered_params)\n format.html { redirect_to @fostered, notice: 'Fostered was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fostered.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wing.update(wing_params)\n @wing.floors.each { |f| f.touch }\n format.html { redirect_to @wing, notice: t('.update_ok', item: @wing.name) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n respond_to do |format|\n if @order.update(farm_order_params)\n format.html { redirect_to edit_farm_order_path, notice: 'Farm 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 @forest.update(forest_params)\n format.html { redirect_to @forest, notice: 'Forest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @farmacium.update(farmacium_params)\n format.html { redirect_to \"/lab_fars\", notice: 'Farmacia actualizada con éxito.' }\n format.json { render :show, status: :ok, location: @laboratorio }\n else\n format.html { render :edit }\n format.json { render json: @laboratorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @star_fact = Star::Fact.find(params[:id])\n\n respond_to do |format|\n if @star_fact.update_attributes(params[:star_fact])\n format.html { redirect_to @star_fact, notice: 'Fact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @star_fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_farm_task\n @farm_task = FarmTask.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @farmer_family.update(farmer_family_params)\n SystemLog.create(description: \"Atualizou as informações do membro da família do agricultor #{@farmer.name}(#{@farmer.farmer_code}) chamado #{@farmer_family.name}\", author: name_and_type_of_logged_user)\n format.html { redirect_to [@group, @farmer_family.farmer, @farmer_family], notice: 'Integrante da familia atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @farmer_family }\n else\n format.html { render :edit }\n format.json { render json: @farmer_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_farmacium\n @farmacium = Farmacium.find(params[:id])\n end",
"def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\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"
] | [
"0.6582223",
"0.62707245",
"0.61878616",
"0.60990083",
"0.607067",
"0.60659105",
"0.60659105",
"0.60402524",
"0.60367805",
"0.5959026",
"0.58987385",
"0.58987385",
"0.58757645",
"0.58727986",
"0.5758789",
"0.57448274",
"0.57407284",
"0.57397836",
"0.57330656",
"0.5732136",
"0.571014",
"0.57024455",
"0.57024455",
"0.57024455",
"0.56951743",
"0.5677811",
"0.5677811",
"0.5620081",
"0.56076515",
"0.55967927",
"0.5590675",
"0.5565841",
"0.55559826",
"0.5549012",
"0.55314976",
"0.5530886",
"0.5528748",
"0.5525627",
"0.5506629",
"0.5506097",
"0.550418",
"0.5492386",
"0.5471044",
"0.5465804",
"0.5465748",
"0.5465513",
"0.5461214",
"0.5452043",
"0.54446185",
"0.54269874",
"0.5420327",
"0.5412851",
"0.538919",
"0.53882504",
"0.5385512",
"0.5384709",
"0.53687334",
"0.53551435",
"0.5329829",
"0.5316146",
"0.53072304",
"0.53070617",
"0.5290298",
"0.52869385",
"0.5275909",
"0.5275621",
"0.5275574",
"0.5269976",
"0.52686715",
"0.52686715",
"0.52557504",
"0.5253005",
"0.52496535",
"0.52410525",
"0.52327156",
"0.52308804",
"0.52247715",
"0.52217054",
"0.5215153",
"0.5213652",
"0.52079034",
"0.52058935",
"0.52050483",
"0.52047145",
"0.52027404",
"0.5198128",
"0.5194582",
"0.5194342",
"0.5192939",
"0.5182912",
"0.5179045",
"0.5165645",
"0.5160067",
"0.5159329",
"0.5158909",
"0.51566917",
"0.5155913",
"0.5155913"
] | 0.6400539 | 3 |
DELETE /farms/1 DELETE /farms/1.json | def destroy
@farm = Farm.find(params[:id])
@farm.destroy
respond_to do |format|
format.html { redirect_to farms_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @farm.destroy\n respond_to do |format|\n format.html { redirect_to farms_url, notice: 'データを消去しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to(farms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @farmer = Farmer.find(params[:id])\n @farmer.destroy\n\n respond_to do |format|\n format.html { redirect_to farmers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foam = Foam.find(params[:id])\n @foam.destroy\n\n respond_to do |format|\n format.html { redirect_to foams_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @farmer.destroy\n respond_to do |format|\n format.html { redirect_to farmers_url }\n format.json { head :no_content }\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def destroy\n @fabric = Fabric.find(params[:id])\n @fabric.destroy\n\n respond_to do |format|\n format.html { redirect_to fabrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farmacium.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end",
"def destroy\n @firearm = Firearm.find(params[:id])\n @firearm.destroy\n\n respond_to do |format|\n format.html { redirect_to(firearms_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @sewage_farm.destroy\n respond_to do |format|\n format.html { redirect_to sewage_farms_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @foaf.destroy\n\n respond_to do |format|\n format.html { redirect_to foafs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foaf.destroy\n\n respond_to do |format|\n format.html { redirect_to foafs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fam = Fam.find(params[:id])\n @fam.destroy\n\n respond_to do |format|\n format.html { redirect_to(fams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @forest = Forest.find(params[:id])\n @forest.destroy\n\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @community_farm.destroy\n respond_to do |format|\n format.html { redirect_to community_farms_url, notice: 'Community farm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :manage, @flock\n\n @flock.destroy\n respond_to do |format|\n format.html { redirect_to flocks_url, notice: \"Flock was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @magzine = Magzine.find(params[:id])\n @magzine.destroy\n\n respond_to do |format|\n format.html { redirect_to magzines_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @fabricsofaset.destroy\n respond_to do |format|\n format.html { redirect_to fabricsofasets_url, notice: 'Fabricsofaset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @frat.destroy\n respond_to do |format|\n format.html { redirect_to frats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @four.destroy\n respond_to do |format|\n format.html { redirect_to fours_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @spoofer = Spoofer.find(params[:id])\n @spoofer.destroy\n\n respond_to do |format|\n format.html { redirect_to spoofers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @fostered.destroy\n respond_to do |format|\n format.html { redirect_to fostereds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @floormaster = Floormaster.find(params[:id])\n @floormaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(floormasters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @flight = Flight.find(params[:id])\n @flight.destroy\n\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fast.destroy\n respond_to do |format|\n format.html { redirect_to fasts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flight = Flight.find(params[:id])\n @flight.destroy\n\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @forest.destroy\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flight.destroy\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flight.destroy\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flight.destroy\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fbo.destroy\n respond_to do |format|\n format.html { redirect_to fbos_url, notice: 'Fbo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy \n @franchise = @franchise_set.franchises.find(params[:id])\n @franchise.destroy\n\n # respond_to do |format| \n # format.html { redirect_to \"/franchise_sets/#{franchise_set.id}/edit\" }\n # format.json { head :ok }\n # end\n \n respond_to do |format|\n format.json {head :ok}\n end\n \n end",
"def destroy\n @farming.destroy\n respond_to do |format|\n format.html { redirect_to farmings_url, notice: 'Farming was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fabrica.destroy\n respond_to do |format|\n format.html { redirect_to fabricas_url }\n format.json { head :no_content }\n end\n end",
"def deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end",
"def destroy\n @faction = Faction.find(params[:id])\n @faction.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_factions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat.destroy\n respond_to do |format|\n format.html { redirect_to flats_url, notice: 'Flat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat.destroy\n respond_to do |format|\n format.html { redirect_to flats_url, notice: \"Flat was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fueltype = Fueltype.find(params[:id])\n @fueltype.destroy\n\n respond_to do |format|\n format.html { redirect_to fueltypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @festival = Festival.find(params[:id])\n @festival.destroy\n\n respond_to do |format|\n format.html { redirect_to festivals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farmer_type.destroy\n respond_to do |format|\n format.html { redirect_to farmer_types_url, notice: 'Farmer type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmallroad = Mostsmallroad.find(params[:id])\n @mostsmallroad.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallroads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roadblock.destroy\n respond_to do |format|\n format.html { redirect_to \"/roadblocks-dash\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @golfer = Golfer.find(params[:id])\n @golfer.destroy\n\n respond_to do |format|\n format.html { redirect_to golfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fridge = Fridge.find(params[:id])\n @fridge.destroy\n\n respond_to do |format|\n format.html { redirect_to fridges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @futbolada = Futbolada.find(params[:id])\n @futbolada.destroy\n\n respond_to do |format|\n format.html { redirect_to gestion_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @add_fuel.destroy\n respond_to do |format|\n format.html { redirect_to add_fuels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fire = Fire.find(params[:id])\n @fire.destroy\n\n respond_to do |format|\n format.html { redirect_to fires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @depot_fuel.destroy\n respond_to do |format|\n format.html { redirect_to depot_fuels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @smurf = Smurf.find(params[:id])\n @smurf.destroy\n\n respond_to do |format|\n format.html { redirect_to smurves_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 @fish.destroy\n respond_to do |format|\n format.html { redirect_to fish_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @father = Father.find(params[:id])\n @father.destroy\n\n respond_to do |format|\n format.html { redirect_to fathers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @magzine.destroy\n respond_to do |format|\n format.html { redirect_to magzines_url, notice: 'Magzine was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Location.delete(params[\"id\"])\n end",
"def destroy\n @flight = Flight.find(params[:id])\n @flight.destroy\n\n head :no_content\n end",
"def destroy\n @flower = Flower.find(params[:id])\n @flower.destroy\n\n respond_to do |format|\n format.html { redirect_to flowers_url }\n format.json { head :ok }\n end\n end",
"def destroy \n @franchise_set = FranchiseSet.find(params[:id])\n @franchise_set.destroy\n\n respond_to do |format|\n format.html { redirect_to franchise_sets_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @furdo.destroy\n respond_to do |format|\n format.html { redirect_to furdos_url, notice: 'Furdo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rayon = Rayon.find(params[:id])\n @rayon.destroy\n\n respond_to do |format|\n format.html { redirect_to rayons_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @mall = Mall.find(params[:id])\n @mall.destroy\n\n respond_to do |format|\n format.html { redirect_to malls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @frind.destroy\n respond_to do |format|\n format.html { redirect_to frinds_url, notice: 'Frind was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def borrar \n\n fiesta.destroy\n render json: fiesta \n end",
"def destroy\n @fat.destroy\n respond_to do |format|\n format.html { redirect_to fats_url, notice: 'Fat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medium_road = MediumRoad.find(params[:id])\n @medium_road.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_roads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mamal.destroy\n respond_to do |format|\n format.html { redirect_to mamals_url, notice: 'Mamal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ambit.destroy\n respond_to do |format|\n format.html { redirect_to ambits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fm.destroy\n respond_to do |format|\n format.html { redirect_to fms_url, notice: 'Fm was successfully destroyed.' }\n format.json { head :no_content }\n end\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 @firm = Firm.find(params[:id])\n @firm.destroy\n\n respond_to do |format|\n format.html { redirect_to firms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gameroom = Gameroom.find(params[:id])\n if @gameroom.destroy\n render json: @gameroom, status: :accepted\n else\n render json: {errors: @gameroom.errors.full_messages}, status: :unprocessable_entity\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @flaw = Flaw.find(params[:id])\n @flaw.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_flaws_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route.destroy\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.destroy\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.destroy\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 @bus_route = BusRoute.find(params[:id])\n @bus_route.destroy\n\n respond_to do |format|\n format.html { redirect_to bus_routes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @firm = Firm.find(params[:id])\n @firm.destroy\n\n respond_to do |format|\n format.html { redirect_to firms_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @frete = Frete.find(params[:id])\n @frete.destroy\n\n respond_to do |format|\n format.html { redirect_to fretes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @franchise.destroy\n respond_to do |format|\n format.html { redirect_to client_location_franchises_path(@client, @location) }\n format.json { head :no_content }\n end\n end",
"def destroy\n franchise.destroy\n\n respond_to do |format|\n format.html { redirect_to franchises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @familium = Familium.find(params[:id])\n @familium.destroy\n\n respond_to do |format|\n format.html { redirect_to familia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mslane.destroy\n respond_to do |format|\n format.html { redirect_to mslanes_url, notice: 'Mslane was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ftype = Ftype.find(params[:id])\n @ftype.destroy\n\n respond_to do |format|\n format.html { redirect_to ftypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foodhamper = Foodhamper.find(params[:id])\n @foodhamper.destroy\n\n respond_to do |format|\n format.html { redirect_to foodhampers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mall_type = MallType.find(params[:id])\n @mall_type.destroy\n\n respond_to do |format|\n format.html { redirect_to mall_types_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.74285626",
"0.7226602",
"0.722136",
"0.7202098",
"0.70863503",
"0.70715886",
"0.69521165",
"0.6886304",
"0.685428",
"0.68450624",
"0.6755933",
"0.6755328",
"0.67205185",
"0.6698712",
"0.6698712",
"0.66958845",
"0.6686744",
"0.6686744",
"0.6678107",
"0.6664311",
"0.66556114",
"0.66514456",
"0.6627061",
"0.66223437",
"0.6617864",
"0.6603736",
"0.6580009",
"0.65797305",
"0.6569825",
"0.65586233",
"0.6557976",
"0.655496",
"0.6540662",
"0.65326196",
"0.65272534",
"0.6520395",
"0.6520395",
"0.6520395",
"0.6513542",
"0.6511431",
"0.649792",
"0.6484777",
"0.6476321",
"0.64739746",
"0.64648825",
"0.6464149",
"0.64541715",
"0.645181",
"0.6451603",
"0.64480007",
"0.64420843",
"0.64349765",
"0.6431498",
"0.6429873",
"0.6427307",
"0.64259",
"0.64231896",
"0.6420683",
"0.6417854",
"0.6417854",
"0.6417854",
"0.6417854",
"0.64126426",
"0.6402612",
"0.64022917",
"0.64004856",
"0.6398384",
"0.6397803",
"0.6397469",
"0.6386901",
"0.638348",
"0.6376748",
"0.63765985",
"0.63732386",
"0.6372058",
"0.63693315",
"0.6369183",
"0.6366427",
"0.6357231",
"0.635505",
"0.6354702",
"0.6345374",
"0.6340626",
"0.63362676",
"0.63347703",
"0.63320965",
"0.63320965",
"0.63320965",
"0.6328252",
"0.6323038",
"0.6322078",
"0.632099",
"0.6318595",
"0.6318111",
"0.6318026",
"0.6317358",
"0.6317053",
"0.63115114"
] | 0.7434962 | 2 |
This is where the logic for our index page lives | def index
# Build the ledgers if the user is logged in. Otherwise, initialize a dummy one.
if current_user
@ledger = current_user.ledgers.first
@place = Place.new
else
@ledger = Ledger.new
@place = Place.new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n # Insert ruby code...\n redirect_to home_path if current_user\n end",
"def index\n puts \"\\n******* index *******\"\n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\r\n end",
"def index\n \t\n end",
"def index\n \t\n end",
"def index\r\n end",
"def index\r\n end",
"def index\r\n end",
"def index\n initiate()\n end",
"def index?; end",
"def index \n end",
"def index\n \n end",
"def index \n end",
"def index\n\n\n\tend",
"def index\n\n\n\tend",
"def index\n\t\t\n\tend",
"def index\n\t\t\n\tend",
"def index\n\t\t\n\tend",
"def index\n\t\t\n\tend",
"def index\n\t\t\n\tend",
"def index\n end",
"def index\n end",
"def index\n end",
"def index\n end",
"def index\n end",
"def index\n end",
"def index\n end",
"def index\n end",
"def load_index_page\n @page ||= Language.current_root_page\n render template: \"alchemy/welcome\", layout: false if signup_required?\n end",
"def index\n \n \n end",
"def index \n \n end",
"def index \n end",
"def index\n render\n end",
"def index\n end",
"def index\n end",
"def index\n end",
"def index\n end",
"def index\n\t\trender 'home'\n\tend",
"def index\r\n \r\n end"
] | [
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.77928257",
"0.7639975",
"0.7639975",
"0.7639975",
"0.75022113",
"0.74727917",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.74723566",
"0.7466639",
"0.743793",
"0.743793",
"0.74344844",
"0.74344844",
"0.74344844",
"0.74312675",
"0.7425144",
"0.7341812",
"0.7335952",
"0.7329296",
"0.7319782",
"0.7319782",
"0.7302802",
"0.7302802",
"0.7302802",
"0.7302802",
"0.7302802",
"0.7268122",
"0.7268122",
"0.7268122",
"0.7268122",
"0.7268122",
"0.7268122",
"0.7268122",
"0.7268122",
"0.72578686",
"0.72379094",
"0.72344124",
"0.7232379",
"0.72242457",
"0.7222643",
"0.7222643",
"0.7222643",
"0.7222643",
"0.72126037",
"0.71972024"
] | 0.0 | -1 |
def cache(path, original_filename, output_filename, data=nil) | def cache(input_path, output_path, data=nil)
path = input_path
@new_hashes[input_path] = hash(@input_directory, input_path)
if data
@data[path] = data if data
@wildcard_dependencies[path] = data[:wildcard_dependencies] if data[:wildcard_dependencies]
@dependencies[path] = data[:dependencies] if data[:dependencies]
end
FileUtils.mkdir_p(File.dirname(cached_path_for(path)))
if File.exist? File.join(@output_directory, output_path)
FileUtils.cp(File.join(@output_directory, output_path), cached_path_for(path))
else
FileUtils.cp(File.join(@input_directory, input_path), cached_path_for(input_path))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache(data); end",
"def cache(gist, file, data)\n cache_file = get_cache_file_for gist, file\n File.open(cache_file, \"w\") do |io|\n io.write data\n end\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def cache!(new_file)\n super\n @old_tmp_file = new_file\n end",
"def cache!(new_file)\n super\n @old_tmp_file = new_file\n end",
"def cache!( new_file )\n super\n @old_tmp_file = new_file\n end",
"def cache(file_obj, data_result, url, username, password)\n data_result[:uuid] = UUID.generate\n key = generate_key url, username, password\n\n begin\n data_result[:data_tmp_path] = store_data_to_tmp file_obj, data_result[:uuid]\n data_result[:time_stored] = Time.now\n @@file_cache[key] = data_result\n rescue Exception => e\n @@file_cache[key] = nil\n end\n end",
"def store_cachefile(cache_filename, template)\n s = template.script\n s = \"\\#@ARGS #{template.args.join(',')}\\n#{s}\" if template.args\n tmp_filename = \"#{cache_filename}.#{rand()}\"\n File.open(tmp_filename, 'w') {|f| f.write(s) }\n File.rename(tmp_filename, cache_filename)\n end",
"def cache(filename, max_age, options=nil)\r\n\t\tdata = self.from_cache(filename, max_age, options)\r\n\t\t\r\n\t\tif(data != nil)\r\n\t\t\treturn data\r\n\t\telse\r\n\t\t\tdata = yield\r\n\t\t\tself.to_cache filename, data, options\r\n\t\t\treturn data\r\n\t\tend\r\n\r\n\tend",
"def cache_file(input)\n key = Digest.hexencode(Digest::SHA2.digest(input.to_yaml))\n return @directory + \"/\" + key + \".yaml\"\n end",
"def cache_file(file)\n FileUtils.cp(file, path)\n end",
"def cache_dir=(_arg0); end",
"def cache(uri, obj)\n filename=cacheFileName(uri)\n print(\"Creating #{filename}\\n\")\n File.open(filename, 'w') {|f| f.write(obj) }\nend",
"def cache_at_client(filename,s)\n s.puts(\"CACHE:\\n\")\n s.puts(filename)\n s.puts(\"\\n\")\n data = s.read\n\tdest_file = File.open(filename, 'wb')\n\tdest_file.print(data)\n\tdest_file.close\nend",
"def file(path, *args)\n return file_via_connection(path, *args) unless cache_enabled?(:file)\n\n @cache[:file][path] ||= file_via_connection(path, *args)\n end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def data_cache(fpath)\n (@data_caches ||= []) << fpath\n return fpath\n end",
"def cache(filepath, &block)\n\t\t# c3) data was already generated, load it from the disk\n\t\t# c4) data was generated, but is out of date\n\t\tif filepath.exist?\n\t\t\tputs \"Checkpoint #{self.object_id}: data loaded!\"\n\t\t\treturn YAML.load_file(filepath)\n\t\t\t\n\t\t\t# NOTE: If you use Pathname with YAML loading, the type will protect you.\n\t\t\t# YAML.load() is for strings\n\t\t\t# YAML.load_file() is for files, but the argument can still be a string\n\t\t\t# but, Pathname is a vaild type *only* for load_file()\n\t\t\t\t# thus, even if you forget what the name of the method is, at least you don't get something weird and unexpected?\n\t\t\t\t# (would be even better to have a YAML method that did the expected thing based on the type of the argument, imo)\n\t\t\t\t# \n\t\t\t\t# Also, this still doesn't help you remember the correct name...\n\t\telse\n\t\t\t# If callback needs to be run, then run it...\n\t\t\tdata = block.call()\n\t\t\t# ... save data to file for next time,\n\t\t\tdump_yaml(data => filepath)\n\t\t\t# ... and return the data from memory\n\t\t\treturn data\n\t\tend\n\tend",
"def save_cached_data\n # open file for writing\n @file_handle = File.open(file_path, 'w')\n \n # write data string into file\n @file_handle << (@file_data_to_write.respond_to?(:read) ? @file_data_to_write.read : @file_data_to_write)\n \n # close file\n close_file\n \n end",
"def save_cached_data\n # open file for writing\n @file_handle = File.open(file_path, 'w')\n \n # write data string into file\n @file_handle << (@file_data_to_write.respond_to?(:read) ? @file_data_to_write.read : @file_data_to_write)\n \n # close file\n close_file\n \n end",
"def cache_file_path\n raise IOError.new 'Write permission is required for cache directory' unless File.writable?(@args[:cache_directory])\n \"#{@args[:cache_directory]}/#{Digest::SHA1.hexdigest((@args[:cache_ref] || @path).to_s + size.to_s + last_modified.to_s)}.cache\"\n end",
"def file_cache(token, caching_time_in_minutes=30, &payload)\n file = file_name token\n if FileHelper.not_cached_or_to_old? file, caching_time_in_minutes\n load_from_file_cache file\n else\n write_to_file_cache file, (yield payload)\n end\n end",
"def cache_path\n File.join @path, 'cache.ri'\n end",
"def cache_resource( path )\n resource_hash = compute_hash(path)\n return true if find_resource(resource_hash)\n\n copy_resource(resource_hash, path)\n end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def write_cache(cache, path)\n if @use_cache then\n File.open path, \"wb\" do |cache_file|\n Marshal.dump cache, cache_file\n end\n end\n\n cache\n rescue Errno::EISDIR # HACK toplevel, replace with main\n cache\n end",
"def writable_file\n @cache_file\n end",
"def cache!(io, phase:)\n cache.upload(io, context.merge(phase: phase))\n end",
"def update_cache\n Rails.logger.debug \"Updating cache for... #{@@cache_file}\"\n fp = File.new(@@cache_file, 'w')\n if fp\n # acquire an exclusive lock (writer)\n if fp.flock(File::LOCK_EX)\n content = open(@@file_path).read\n \n if content\n #logger.debug \"Generate cache file: #{@@cache_file}\"\n fp.write(content) # writes to the file\n end\n \n fp.flock(File::LOCK_UN) # release a lock\n end\n fp.close\n end\n end",
"def cache_dir; end",
"def cache_dir; end",
"def cache\n DataCache\n end",
"def cache_file\n @cache_file ||= File.join cache_dir, \"#{full_name}.gem\"\n end",
"def cacheFileName(ni)\n @directory_name + \"/\" + ni.path\nend",
"def cache_store=(_arg0); end",
"def cache_store=(_arg0); end",
"def memoize(name, file=nil)\n cache = File.open(file, 'rb'){ |io| Marshal.load(io) } rescue {}\n\n (class<<self; self; end).send(:define_method, name) do |*args|\n unless cache.has_key?(args)\n cache[args] = super(*args)\n File.open(file, 'wb'){ |f| Marshal.dump(cache, f) } if file\n end\n cache[args]\n end\n cache\n end",
"def write_cache\n data = cache_data\n open(writable_file, \"wb\") do |f|\n\tf.puts Marshal.dump(data)\n end\n end",
"def write_cache\n File.write(CACHE_PATH, @data.to_json)\n end",
"def cache(content, options={})\n return content unless Sinatra.options.cache_enabled\n \n unless content.nil?\n path = cache_page_path(request.path_info)\n FileUtils.makedirs(File.dirname(path))\n open(path, 'wb+') { |f| f << content } \n content\n end\n end",
"def write_cache_file key, content\n f = File.open( cache_file(key), \"w+\" )\n f.flock(File::LOCK_EX)\n f.write( content )\n f.close\n return content\n end",
"def write_cache(url, data, json: true)\n filename = cache_filename(url, json)\n logger.debug(\"Writing cache #{filename}\")\n FileUtils.mkdir_p(File.dirname(filename))\n if json\n IO.write(filename, JSON.dump(data))\n else\n IO.binwrite(filename, data)\n end\n end",
"def cache(content, revision_number)\n File.open(self.cache_file_name(revision_number), \"wb\") { |f| f.write(content) }\n print(\"[MODEL_FILE] Wrote #{self.cache_file_name(revision_number)} to cache\")\n end",
"def cache!(document) \n if document.is_a?(Hash) && document.has_key?(\"base64\") && document.has_key?(\"filename\")\n raise ArgumentError unless document[\"base64\"].present?\n file = FilelessIO.new(Base64.decode64(document[\"base64\"]))\n file.original_filename = document[\"filename\"]\n file.content_type = document[\"filetype\"] \n super(file)\n else\n super(document)\n end\n end",
"def cache(key, options = {}, &block)\n name = cache_name(key)\n tags = options.delete(:tags) || []\n check_tags_existance(name, tags)\n if ActionController::Base.perform_caching\n cache = read(name, options)\n if cache && cache.is_a?(Hash) && cache[:data] && is_cache_actual?(cache) \n # Overwriting the cache with the same data for avoiding its expiration\n # when 'freeze cache' option is enabled.\n write(name, cache, options) if AstroConfig.freeze_cache?\n data = modify_cache_by_personalized_data(cache[:data], options)\n data.is_a?(String) ? data.html_safe : data\n else\n self.class.do_not_cache_block = false\n output = execute_block(&block)\n unless self.class.do_not_cache_block\n tags_hash = generate_tags_hash(tags)\n write(name, { :data => output, :tags => tags_hash }, options)\n end\n self.class.do_not_cache_block = false\n output.is_a?(String) ? output.html_safe : output\n end\n else\n execute_block(&block)\n end\n end",
"def cache!(document)\n if document.is_a?(Hash) && document.has_key?(\"base64\") && document.has_key?(\"filename\")\n raise ArgumentError unless document[\"base64\"].present?\n file = FilelessIO.new(Base64.decode64(document[\"base64\"]))\n file.original_filename = document[\"filename\"]\n file.content_type = document[\"filetype\"] \n super(file)\n else\n super(document)\n end\n end",
"def cache_file_path\n File.join @homepath, 'cache'\n end",
"def cache_file_for(klassname)\n File.join cache_file_path, klassname.gsub(/:+/, \"-\")\n end",
"def create_cache(dir, hostname, cache)\n # Let's create the cache directory if it does exists.\n Dir.mkdir(dir) unless File.exist?(dir)\n\n # Create the file and fill it with the cache\n cachefilename = File.join(dir, \"#{hostname}.yml\")\n cachefile = File.new(cachefilename, 'w+')\n cachefile.write(cache)\n cachefile.close\nend",
"def cache=(input)\n case\n when input && !cached?\n cache = io_index.to_a\n io_index.close\n @io_index = cache\n \n when !input && cached?\n io_index << {:format => 'II'}\n @io_index = ExternalIndex[*io_index]\n \n end\n end",
"def cache_store; end",
"def cache_store; end",
"def cache(name, &block)\n data = nil\n begin\n cache_data = nil\n begin\n cache_data = read(name)\n rescue\n cache_data = { :data => data, :time => Time.at(0) } # no cache\n end\n if ! cache_data[:data] ||\n cache_data[:data] == nil ||\n cache_data[:data] == '' ||\n cache_data[:data].to_sym == :undefined || (Time.now - cache_data[:time]) > @config[:ttl]\n begin\n data = block.call\n write(name, data)\n ::Puppet.debug \"wrote cache for #{name} => #{data}\" if @config[:debug]\n rescue Exception => e\n ::Puppet.warn \"failed to get facter value for cache, #{e}\"\n end\n else\n data = cache_data[:data]\n ::Puppet.debug \"using cache for #{name} => #{data}\" if @config[:debug]\n end\n rescue Exception => e\n ::Puppet.warn \"failed to cache data for cache\" if @config[:debug]\n end\n return data\n end",
"def cache(key, opts = {}, &block)\n return yield if opts[:disable] || !Config.production?\n if exist?(key) && !opts[:update]\n content = read(key)\n return opts[:marshal] ? Marshal.restore(content) : content\n end\n content = yield\n write(key, opts[:marshal] ? Marshal.dump(content) : content)\n content\n end",
"def cache_file key\n File.join( store, key+\".cache\" )\n end",
"def cached_computation(input)\n file = cache_file(input)\n return YAML.load_file(file) if File.exists?(file) and not @force_recompute\n result = @computation.call(input)\n File.open(file, \"w\") { |file| file.write(result.to_yaml) }\n return result\n end",
"def disable_caching=(_arg0); end",
"def put(key = '', data = '')\n if key != '' && data != ''\n puts \"Writing into cache with key: #{key}\" if ENV['DEBUG']\n return ::File.write(@cache_dir+key, data)\n end\n\n return false\n end",
"def cache\n if self.cache_store\n self.cache_store\n else\n self.cache_store = :file_store, root.join(\"tmp\").to_s\n self.cache_store\n end\n end",
"def getContentCache(theContent)\n\n\ttheChecksum = Digest::SHA256.hexdigest(theContent).insert(2, '/');\n\ttheCache = \"#{PATH_FORMAT_CACHE}/#{theChecksum}\";\n\t\n\treturn theCache;\n\nend",
"def save\n Chef::FileCache.store(\"remote_file/#{sanitized_cache_file_basename}\", json_data)\n end",
"def update_cache(source=@url, destination=@local_path, options={})\n unless destination\n raise ArgumentError, \"Must specify destination directory when updatng resource\", caller\n end\n file_exists = File.exists?(destination)\n if file_exists && @signature_verified == nil\n verify_signature\n end\n unless file_exists && @signature_verified\n FileUtils.mkdir_p(File.dirname(destination))\n puts \"reading: #{source}\" if options[:verbose]\n tried_to_read = 0\n begin\n jarfile = open(source)\n rescue OpenURI::HTTPError => e\n puts e\n if tried_to_read < 1\n tried_to_read += 1\n retry\n end\n end\n if jarfile.class == Tempfile\n FileUtils.cp(jarfile.path, destination)\n puts \"copying to: #{destination}\" if options[:verbose]\n else\n File.open(destination, 'w') {|f| f.write jarfile.read }\n puts \"writing to: #{destination}\" if options[:verbose]\n end\n puts \"#{jarfile.size} bytes written\" if options[:verbose]\n verify_signature ? jarfile.size : false\n else\n File.size(destination)\n end\n end",
"def cache(key, value, source = nil)\n if key.nil? || value.nil?\n raise ArgumentError, 'Missing key or value to store'\n end\n mycache = find_cache(key, source)\n make_cache_path(mycache[:dir]) unless mycache[:dir].nil?\n # don't use the Rubyist standard pattern so we can test with rspec\n begin\n out = File.open(mycache[:file], 'w')\n YAML.dump({ key.to_s => value }, out)\n out.close\n rescue StandardError => e\n Facter.debug(\"Unable to write to cache #{mycache[:file]}: #{e.backtrace[0]}: #{$ERROR_INFO}.\")\n end\n end",
"def write_cache(resource, content)\n expanded_path = cache_path_for(resource)\n return false unless expanded_path\n FileUtils.mkdir_p(File.dirname(expanded_path))\n @logger.info(self.class) { \"Caching #{content.length} B for #{resource}\" }\n File.write(expanded_path, content)\n end",
"def create_cache_file(controller=:_all,action=:_all)\n files = paths_for(controller,action).uniq\n path_name = cache_path_name(controller,action)\n \n # if we already have the file, we can just skip this step\n if File.exists?(path_name)\n puts \"Skipped creating/updating #{controller}::#{action} (Nothing changed)\" if RAILS_ENV == \"development\"\n return path_name\n end\n \n cache_content = \"\"\n # otherwise, we create the file\n files.each do |f|\n if File.exists?(f)\n cache_content += File.new(f).read\n else\n # TODO: add some debug info for when an included file doesn't exist\n end\n end\n # write out the content\n File.open(path_name,\"w\") do |f|\n f.write(cache_content)\n end\n \n # if we have a minifier, use it\n @minifier.minify!(path_name) if @minifier\n \n puts \"\\nCreated #{path_name} \"\n puts \"with \\n\\t #{files.join(\"\\n\\t\")}\\n\" if RAILS_ENV == \"development\"\n path_name\n end",
"def assign_cached(value)\n uploaded_file = uploaded_file(value)\n set(uploaded_file) if cache.uploaded?(uploaded_file)\n end",
"def update_file(file_data)\n sha = file_data['sha256']\n file_dir = create_cache_dir(file_data['sha256'])\n file_path = File.join(file_dir, File.basename(file_data['filename']))\n if check_file(file_path, sha)\n @logger.debug(\"Using prexisting file: #{file_path}\")\n return file_path\n end\n\n @logger.debug(\"Queueing download for: #{file_path}\")\n serial_execute { download_file(file_path, sha, file_data['uri']) }\n end",
"def cached_wget(url, override_cache=false)\n\tputs \" Fetching #{url}\"\n\tcache_file_name = File.join CACHE_DIR, Digest::MD5.hexdigest(url)\n\tif override_cache or not File.exists? cache_file_name\n\t\tFile.open(cache_file_name, 'w') do |cache_file| \n\t\t\topen(url) do |remote_file|\n\t\t\t\tremote_file.each_line do |remote_line| \n\t\t\t\t\tcache_file.puts remote_line\n\t\t\t\tend\n\t\t\tend\n\t\tend \n\t\tputs \" (downloaded fresh copy to #{cache_file_name})\"\n\telse\n\t\tputs \" (loaded from cache #{cache_file_name})\"\n\tend\n\tcache_file_name\nend",
"def []=(key, content)\n temp_file = File.join(root, ['tmp', $$, Thread.current.object_id].join('-'))\n File.open(temp_file, 'wb') do |dest|\n if content.respond_to? :to_str\n dest.write(content.to_str)\n else\n content.each {|s| dest.write(s) }\n end\n end\n\n path = cache_path(key)\n File.unlink path if File.exist?(path)\n FileUtils.mkdir_p File.dirname(path), :mode => 0755\n FileUtils.mv temp_file, path\n rescue\n File.unlink temp_file rescue nil\n ensure\n content\n end",
"def cache_content(type, data)\n return nil unless type.present?\n\n Rails.cache.write(type, data, expires_in: 60.minutes)\n rescue StandardError => e\n logger.error(\"Unable to add #{type} to the Rails cache: #{e}.\")\n end",
"def cache\n store = Moneta.new :File, dir: 'moneta'\n Cachy.cache_store = store\n Cachy\n end",
"def cache!\n @@cache\n end",
"def cache_path\n @cache_path ||= File.join(\"\", \"gko\", \"cache\", \"#{self.host}\")\n end",
"def set_cache(value); end",
"def set_cache(value); end",
"def copy_over_cache_files\n FileUtils.cp_r \"#{@cache}/.\", @path\n end",
"def cache_response!(response)\n cache.write(escape_path_for_cache_key(request_options[:path]), response)\n end",
"def cache_file\n File.join(Rscons.application.build_dir, \".rsconscache\")\n end",
"def cache_content(uri, content)\n clear_cache(uri)\n\n time = Time.now.to_i\n\n cache_store.write(cache_key(uri), time)\n cache_store.write(cache_key([uri, time]), content)\n \n content\n end",
"def cache_resource(dest_dir=@local_cache_dir, options={})\n unless dest_dir\n raise ArgumentError, \"Must specify destination directory when creating resource\", caller\n end\n self.local_cache_dir=dest_dir\n @size = update_cache(@url, @local_path, options)\n if options[:include_pack_gz]\n @relative_local_path_pack_gz = \"#{@relative_local_path}.pack.gz\"\n @local_path_pack_gz = \"#{dest_dir}/#{@relative_local_path_pack_gz}\"\n @size_pack_gz = update_cache(@url_pack_gz, @local_path_pack_gz, options)\n end\n @signature_verified ? @size : @signature_verified\n end",
"def cached_file(source, checksum = nil)\n if source =~ %r{^(file|ftp|http|https):\\/\\/}\n uri = as_uri(source)\n cache_file_path = \"#{Chef::Config[:file_cache_path]}/#{::File.basename(::CGI.unescape(uri.path))}\"\n Chef::Log.debug(\"Caching a copy of file #{source} at #{cache_file_path}\")\n\n remote_file cache_file_path do\n source source\n backup false\n checksum checksum unless checksum.nil?\n end\n else\n cache_file_path = source\n end\n\n Chef::Util::PathHelper.cleanpath(cache_file_path)\n end",
"def downloaded_file\n filename = source[:cached_name] if source[:cached_name]\n filename ||= File.basename(source[:url], \"?*\")\n File.join(Config.cache_dir, filename)\n end",
"def cache_write(key, data)\n @mutex.synchronize do\n @cache[key] = data\n end\n end",
"def fetch_cache(file, url)\n @path = \"tmp/\" + file + \".html\";\n @temp = @path + \".fetch\"\n @doFetch = !(FileTest.exists?(@path) && (Time.new - File.mtime(@path) < (5 * 60)))\n\n if @doFetch and download_page(@temp,url) then\n File.delete(@path) if File.exists?(@path)\n File.rename(@temp, @path)\n end\n\n if File.exists?(@path) then\n return @path\n else\n @useOnce = @path + \".\" + rand(100000).to_s + \".once\"\n download_page(@useOnce, url)\n return @useOnce\n end\n end",
"def write_cache_file()\n @logger.debug @cache.inspect\n File.open(options[:cache_file], \"w\") {|f| f.write(@cache.to_yaml)}\n end",
"def cache(new_cache = nil)\n @cache = new_cache if new_cache\n @cache\n end",
"def process\n # Do nothing if caching is off\n return nil unless data[:options][:cache]\n # There is nothing to cache if we stream things\n return nil if data[:response][:instance].is_io?\n\n cache_patterns = data[:options][:cache_patterns] || []\n opts = { :relative_path => data[:request][:relative_path],\n :request => data[:request][:instance],\n :response => data[:response][:instance],\n :verb => data[:request][:verb],\n :params => data[:request][:orig_params].dup }\n\n # Walk through all the cache patterns and find the first that matches\n cache_patterns.each do |pattern|\n # Try on the next pattern unless the current one matches.\n next unless Utils::pattern_matches?(pattern, opts)\n # Process the matching pattern.\n log(\"Request matches to cache pattern: #{pattern.inspect}\")\n # Build a cache key and get a text to be signed\n cache_key, text_to_sign = build_cache_key(pattern, opts)\n cache_record = {\n :timestamp => Time::now.utc,\n :md5 => Digest::MD5::hexdigest(text_to_sign).to_s,\n :hits => 0\n }\n log(\"Processing cache record: #{cache_key} => #{cache_record.inspect}\")\n # Save current cache key for later use (by other Routines)\n data[:vars][:cache] ||= {}\n data[:vars][:cache][:key] = cache_key\n data[:vars][:cache][:record] = cache_record\n # Get the cache storage\n storage = (data[:vars][:system][:storage][:cache] ||= {} )\n unless storage[cache_key]\n # Create a new record unless exists.\n storage[cache_key] = cache_record\n log(\"New cache record created\")\n else\n # If the record is already there but the response changed the replace the old record.\n unless storage[cache_key][:md5] == cache_record[:md5]\n storage[cache_key] = cache_record\n log(\"Missed. Record is replaced\")\n else\n # Raise if cache hits.\n storage[cache_key][:hits] += 1\n message = \"Cache hit: #{cache_key.inspect} has not changed since \" +\n \"#{storage[cache_key][:timestamp].strftime('%Y-%m-%d %H:%M:%S')}, \"+\n \"hits: #{storage[cache_key][:hits]}.\"\n log(message)\n fail CacheHit::new(\"CacheValidator: #{message}\")\n end\n end\n break\n end\n true\n end",
"def cache_for(expires, *args, &blk)\n @cache_data ||= CacheData.new\n @cache_data.value caller_locations(1,1)[0].label.to_sym, expires, args, &blk\n end"
] | [
"0.7448695",
"0.74201995",
"0.7315937",
"0.7315937",
"0.7315937",
"0.7315937",
"0.73099744",
"0.73099744",
"0.72626126",
"0.7227641",
"0.7171443",
"0.70319706",
"0.69553924",
"0.6954398",
"0.69367135",
"0.6930686",
"0.6914109",
"0.68401515",
"0.6818943",
"0.6818943",
"0.6818943",
"0.6818943",
"0.6818943",
"0.6818943",
"0.6818943",
"0.6807465",
"0.68054044",
"0.67563254",
"0.67563254",
"0.67309237",
"0.6722871",
"0.67222005",
"0.6711181",
"0.6701363",
"0.6701363",
"0.6701363",
"0.6701363",
"0.669515",
"0.666457",
"0.66548157",
"0.6651973",
"0.66466945",
"0.66466945",
"0.66054845",
"0.6582645",
"0.6566248",
"0.6555943",
"0.6555943",
"0.6545057",
"0.6507215",
"0.64999884",
"0.6482327",
"0.64643174",
"0.6455663",
"0.64287454",
"0.6419614",
"0.6371896",
"0.63692486",
"0.63636726",
"0.6361127",
"0.63570344",
"0.6351765",
"0.63508105",
"0.63508105",
"0.6343923",
"0.6329355",
"0.6320037",
"0.63166875",
"0.6312961",
"0.6306997",
"0.6286451",
"0.62837094",
"0.6269721",
"0.6259736",
"0.6259503",
"0.6253128",
"0.62481755",
"0.62322325",
"0.6199619",
"0.61814225",
"0.61735773",
"0.6157938",
"0.61498284",
"0.6144069",
"0.61341405",
"0.61324316",
"0.61324316",
"0.6128639",
"0.6114106",
"0.6112032",
"0.61039597",
"0.6100492",
"0.61001956",
"0.6092163",
"0.6087242",
"0.6085067",
"0.60751134",
"0.6064771",
"0.60624075",
"0.6061508"
] | 0.7517386 | 0 |
Yes if the file is modified. | def dependencies_changed?(path)
if dependencies = @dependencies[path]
dependencies.each do |dependency|
return true if file_changed?(dependency)
end
end
if wildcard_dependencies = @wildcard_dependencies[path]
wildcard_dependencies.each do |query, results|
o = Hammer::HTMLParser.new(:path => path, :directory => @input_directory)
return true if o.find_files(*query) != results
end
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_modified?\n modified = false\n\n if @name\n begin\n mtime = File.mtime( @name )\n\n if mtime > @last_modification_check\n modified = true\n @last_modification_check = mtime\n end\n rescue Errno::ENOENT\n # Ignore if file doesn't exist\n end\n end\n\n modified\n end",
"def modified?(file)\n @mutex.synchronize do\n @data[file.to_s].modified?(file)\n end\n end",
"def modified?\n return File.mtime(@filename).to_i > @load_time\n end",
"def modified?(path)\n @headers[IF_MODIFIED] != mtime(path)\n end",
"def file_changed?(file)\n file_new?(file) || File.mtime(file) > MTIMES[file]\n end",
"def modified?\n @modified\n end",
"def modified?\n @modified\n end",
"def modified?\r\n @modified\r\n end",
"def modified?(path); end",
"def modified?(file)\n @modified.any?(file) || @untracked.any?(file)\n end",
"def added_or_modified?(file)\n added?(file) || modified?(file)\n end",
"def modified?\n @modified\n end",
"def file_modified?(path, last_event)\n if File.ctime(path).to_i == last_event.to_i\n file_content_modified?(path, sha1_checksum(path))\n elsif File.mtime(path).to_i > last_event.to_i\n set_sha1_checksums_hash(path, sha1_checksum(path))\n true\n else\n false\n end\n rescue\n false\n end",
"def changed?(file_stats)\n not (file_stats.size == size and file_stats.mtime.utc == modification_time.utc)\n end",
"def modified?\n\t\treturn self.status == 'M'\n\tend",
"def changed?(file_stats)\n !((file_stats.size == @size) &&\n (file_stats.mtime.to_i == @modification_time))\n end",
"def updated?\n !ignore? && !removed? && mtime != File.mtime(path)\n end",
"def modified?\n\t\t@modified\n\tend",
"def changed?(file)\n if !stored?(file)\n return true\n end\n ok_file = get_ok_file_for(file)\n fail_file = get_fail_file_for(file)\n f = File.new(file) \n if ( \n ( File.exists?(ok_file) && f.stat.mtime > File.new(ok_file).stat.mtime ) or\n ( File.exists?(fail_file) && f.stat.mtime > File.new(fail_file).stat.mtime )\n )\n return true\n end \n return false \n end",
"def file_changed(f)\n if !MrBucket.exists?(f)\n return true\n end\n local_time = open(f).mtime\n live_time = Time.parse(MrBucket.find(f).about[:\"last-modified\"])\n return local_time > live_time\nend",
"def modified?\n\t\treturn @dirty ? true : false\n\tend",
"def updated?(file_handle)\n c_stat = File.stat @file\n if (c_stat.size == @size) && (c_stat.mtime.to_i == @mtime.to_i) && (! @init_stat)\n Snoopit.logger.debug 'FileTracker.updated? file has not changed: ' + @file\n updated = false\n elsif c_stat.size < @size\n Snoopit.logger.debug 'FileTracker.updated? file size is smaller it is a new new file: ' + @file\n updated = new_file? file_handle, c_stat\n elsif (c_stat.size == @size) && (! @mtime.nil?) && (c_stat.mtime.to_i > @mtime.to_i)\n Snoopit.logger.debug 'FileTracker.updated? file size is same but file time is newer it is a new file: ' + @file\n updated = new_file? file_handle, c_stat\n else\n Snoopit.logger.debug 'FileTracker.updated? reading from last read location: ' + @file\n updated = read_from_last? file_handle, c_stat\n end\n @init_stat = false\n updated\n end",
"def modified?; end",
"def dirty?\n return true unless test(?e, destination)\n @mtime > ::File.mtime(destination)\n end",
"def meta_file_changed?(opts = {})\n contains_a_dsl_filename?(self[:files_modified], opts) ||\n contains_a_dsl_filename?(self[:files_added], opts)\n end",
"def changed?\n @changed ||= sorted_file != IO.read(file)\n end",
"def is_modified?\n !editor.nil?\n end",
"def need_update?\n return true unless @lastread\n @lastread < File::stat(@path).mtime\n end",
"def modified?(path)\n return true if disabled?\n\n # objects that don't have a path are always regenerated\n return true if path.nil?\n\n # Check for path in cache\n return cache[path] if cache.key? path\n\n if metadata[path]\n # If we have seen this file before,\n # check if it or one of its dependencies has been modified\n existing_file_modified?(path)\n else\n # If we have not seen this file before, add it to the metadata and regenerate it\n add(path)\n end\n end",
"def has_module_file_changed?(file)\n\t\tbegin\n\t\t\treturn (module_history_mtime[file] != File::Stat.new(file).mtime.to_i)\n\t\trescue Errno::ENOENT\n\t\t\treturn true\n\t\tend\n\tend",
"def updated?\n @changed_files.clear()\n start_size = @file_cache.size\n listen_for_changes\n end_size = @file_cache.size\n start_size != end_size || !@changed_files.empty?\n end",
"def file_modified?(file, opts={})\n vf_old, vf_new = opts[:node1][file], opts[:node2][file]\n\n tests = [vf_old.flags != vf_new.flags,\n vf_old.file_node != vf_new.file_node &&\n (vf_new.changeset.include?(file) || vf_old === vf_new)]\n tests.any?\n end",
"def file_changed?(file, last_time)\n\t\t# Rake uses File.mtime(path_to_file) to figure out if files are out of date or not. \n\t\t\t# It also has a constant called Rake::LATE, but I can't figure out how that works.\n\t\t\t# \n\t\t\t# sources:\n\t\t\t\t# https://github.com/ruby/rake/blob/master/MIT-LICENSE\n\t\t\t\t# https://github.com/ruby/rake/blob/master/lib/rake/file_task.rb\n\t\t\n\t\t\n\t\t# Can't figure out how Rake::LATE works, but this works fine.\n\t\t\n\t\tlast_time.nil? or file.mtime > last_time\n\tend",
"def new_file?(name, mtime)\n # unknown file\n return true unless @table.has_key?(name)\n # updated file\n return mtime > @table[name]\n end",
"def modified?\n\t\t\t# Directories are never modified\n\t\t\tfalse\n\t\tend",
"def should_update?(file, since_date=nil)\n if since_date.nil?\n # if there is no specified date, then update everything\n return true\n else\n # if a file has been updated since a time specified by user\n file_date = File.mtime(file)\n return file_date > since_date\n end\nend",
"def change?(file)\n @file != file\n end",
"def modified?\n new?\n end",
"def new_file?(file_handle, stat)\n # seek to 0\n Snoopit.logger.debug 'FileTracker.updated? file new read from start of file: ' + @file\n @offset = 0\n @size = stat.size\n @mtime = stat.mtime\n @last_line = nil\n file_handle.seek 0, IO::SEEK_SET\n true\n end",
"def changed?\n render unless result\n if exist?\n File.read(output) != result\n else\n true\n end\n end",
"def changed?\n rotation do |file|\n break true if file_changed?(file)\n end\n end",
"def can_modify\n write_file( @output, read_file(@message).gsub(/[ ]/, \" modified text \") )\n end",
"def modified_files; end",
"def modified_existing?\n false\n end",
"def modified?\n new? || @content\n end",
"def brewfile_has_been_modified\n \n modified = git.modified_files.include?(\"Brewfile\")\n return modified\n \nend",
"def modified; status[:modified]; end",
"def check_change (conf, curDir)\n Dir.chdir curDir\n return true unless File.exist?(FileStats)\n arr = IO.read(FileStats).split(\",\")\n return true if arr[0].to_i != conf[:fsize]\n return true if conf[:modTS ].to_i > Time.parse(arr[1]).to_i \n false\nend",
"def is_new?\n !File.exists? @filename\n end",
"def changelog_has_been_modified\n\n modified = git.modified_files.include?(\"CHANGELOG.md\")\n return modified\n\nend",
"def handle_silent_modification_failure?\n false\n end",
"def changelog_changes?\n git.modified_files.include?(filename) || git.added_files.include?(filename)\n end",
"def have_you_updated_changelog?\n if changelog_changes?\n true\n elsif file_changes?\n warn_update_changelog\n false\n else\n true\n end\n end",
"def info_plist_has_been_modified\n\n modified = git.modified_files.include?(\"SteinsKit/Info.plist\")\n return modified\n\nend",
"def modified_since?( time )\n mtime > time\n end",
"def modified?\n\t\t\t@dirty || @hash.values.find do |obj|\n\t\t\t\tobj.is_a?( ConfigStruct ) && obj.modified?\n\t\t\tend\n\t\tend",
"def redis_master_file_changed?\n @last_time_master_file_changed != File.mtime(@config.redis_server)\n end",
"def new_file?\n @new_file\n end",
"def is_not_modified?\n @code == 304\n end",
"def has_changes?\r\n @source_files.size > 0\r\n end",
"def changed?\n # Allow the timeout to be disabled entirely.\n return true if Puppet[:filetimeout] < 0\n current_stamp = current_timestamp\n\n # We use a different internal variable than the stamp method\n # because it doesn't keep historical state and we do -- that is,\n # we will always be comparing two timestamps, whereas\n # stamp just always wants the latest one.\n if current_stamp == @previous_timestamp\n false\n else\n @previous_timestamp = current_stamp\n true\n end\n end",
"def file_modified_since?( filename, timestamp )\n modified_timestamp = File.mtime( filename )\n return (modified_timestamp > timestamp)\nend",
"def file_new?(file)\n MTIMES[file].nil?\n end",
"def is_not_modified\n @status == Status::NOT_MODIFIED\n end",
"def changed?\n true\n end",
"def check_files\n updated = []\n files.each do |filename, mtime| \n begin\n current_mtime = File.stat(filename).mtime\n rescue Errno::ENOENT\n # file was not found and was probably deleted\n # remove the file from the file list \n files.delete(filename)\n next\n end\n if current_mtime != mtime \n updated << filename\n # update the mtime in file registry so we it's only send once\n files[filename] = current_mtime\n puts \"quick_serve: spotted change in #{filename}\"\n end\n end\n QuickServe::Rails::Snapshot.reset if updated != []\n false\n end",
"def updated_file_only=(flag)\r\n @conf[:update] = flag\r\n end",
"def dirty?\n return _meta_data['dirty'] if _meta_data.has_key? 'dirty'\n\n # if the destination file does not exist, then we are dirty\n return true unless test(?e, destination)\n\n # if this file's mtime is larger than the destination file's\n # mtime, then we are dirty\n dirty = @mtime > ::File.mtime(destination)\n return dirty if dirty\n\n # check to see if the layout is dirty, and if it is then we\n # are dirty, too\n if _meta_data.has_key? 'layout'\n lyt = ::Webby::Resources.find_layout(_meta_data['layout'])\n unless lyt.nil?\n return true if lyt.dirty?\n end\n end\n\n # if we got here, then we are not dirty\n false\n end",
"def file?\n repos.stat(fs_path, revision).file?\n end",
"def test_stat_modifications\n @client.write(@file, '')\n\n [0745, 0600, 0443].each do |mode|\n @client.chmod(@file, mode)\n assert_equal mode, @client.stat(@file, refresh: true).mode\n end\n end",
"def changed?\n if update_type == :no_change\n false\n else\n true\n end\n end",
"def changed?(path)\n # FIXME: Implement properly once changed detection is available.\n exists?(path)\n end",
"def file_changes?\n all_files = git.modified_files + git.added_files\n Danger::Changelog::Config.ignore_files.each do |f|\n all_files.reject! { |modified_file| f.is_a?(Regexp) ? f.match?(modified_file) : f == modified_file }\n break if all_files.empty?\n end\n all_files.any?\n end",
"def mod_time\n File.mtime(@filepath)\n end",
"def changed?\n raw?\n end",
"def mark_modified\n @modified = true\n nil\n end",
"def being_modified?(item)\n state_group(item) == :edit\n end",
"def changed? \n @changed == true\n end",
"def didModify(files_array)\n\tdid_modify_files = false\n\tfiles_array.each do |file_name|\n\t\tif git.modified_files.include?(file_name) || git.deleted_files.include?(file_name)\n\t\t\tdid_modify_files = true\n\t\tend\n\tend\n\treturn did_modify_files\nend",
"def changed?\r\n @changed\r\n end",
"def modified_files\n file_stats.count { |file| file.status == :modified }\n end",
"def image_file_changed?\n raise 'please override image_file_changed?'\n end",
"def saved?\n return [email protected]?\n end",
"def uptodate?(path)\n fileutils.uptodate?(path, to_a)\n end",
"def content_modified?\n self.content_hash.nil? || self.content_hash != calculate_content_hash\n end",
"def http_if_modified_since?(path)\n if since = request.env['HTTP_IF_MODIFIED_SINCE']\n begin\n require 'time'\n since = Time.httpdate(since) rescue Time.parse(since)\n return since < File.mtime(path)\n rescue Exception\n end\n end\n return true\n end",
"def save_version?\n\t\t\t \t\tchanged?\n\t\t\t \tend",
"def is_modified?\n !self.default_layout.nil? || !self.presenter_share_only.nil? || !self.auto_start_audio.nil? ||\n !self.auto_start_video.nil?\n end",
"def check_file_for_changes(filepath)\n last_modified = File.mtime(filepath)\n\n if @file_cache[filepath] != last_modified && @start_time <= last_modified\n change_type = (@file_cache[filepath] ? :modified : :added)\n push_changes(filepath, change_type)\n end\n\n @file_cache[filepath] = last_modified\n end",
"def save_version?\n version_condition_met? && altered?\n end",
"def modified\n raise NotLoadedError.new(:metadata) unless metadata_loaded?\n self.mtime\n end",
"def new_file?\n\t\t@filelineno == 1\n\tend",
"def watched_file?(filename)\n false\n end",
"def changed?\n @changed\n end",
"def last_modified\n @file_stat ? file_stat.mtime : nil\n end",
"def changed?\n\t\treturn self.changed_reason ? true : false\n\tend",
"def has_been_modified()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.Run_has_been_modified(@handle.ptr)\n result\n end",
"def updated?\n command.success?\n end",
"def changed?\n @changed\n end",
"def dirty?\n flags & 0x1 == 0x1\n end",
"def file?\n original_filename.present?\n end"
] | [
"0.800393",
"0.79374504",
"0.7707993",
"0.76921386",
"0.76868856",
"0.7617682",
"0.7617682",
"0.7596972",
"0.7565416",
"0.75458217",
"0.75378674",
"0.75231284",
"0.738882",
"0.7353235",
"0.73527396",
"0.7344089",
"0.7333359",
"0.731654",
"0.7299752",
"0.7164382",
"0.7135235",
"0.7128019",
"0.71067685",
"0.7072206",
"0.70412564",
"0.7001677",
"0.6938672",
"0.6822475",
"0.68153435",
"0.67981315",
"0.6783955",
"0.67586315",
"0.6746446",
"0.67464226",
"0.6692323",
"0.6689532",
"0.6660194",
"0.6655392",
"0.66551304",
"0.6634569",
"0.662562",
"0.6624758",
"0.6623068",
"0.6596823",
"0.657651",
"0.65760964",
"0.6572238",
"0.65583616",
"0.6542256",
"0.65379274",
"0.6526167",
"0.6509671",
"0.6486666",
"0.64738804",
"0.64066315",
"0.63913155",
"0.638542",
"0.6372279",
"0.6349557",
"0.63093966",
"0.63065726",
"0.6272281",
"0.62715995",
"0.62509567",
"0.6235599",
"0.6223015",
"0.6212118",
"0.6202758",
"0.61967766",
"0.6196471",
"0.6192493",
"0.6183693",
"0.61792994",
"0.616016",
"0.6159866",
"0.61562335",
"0.6144872",
"0.61329716",
"0.6119135",
"0.6115114",
"0.6114846",
"0.61078906",
"0.61054945",
"0.6094383",
"0.609127",
"0.608663",
"0.60844725",
"0.60787404",
"0.6077582",
"0.6061649",
"0.60571027",
"0.60488015",
"0.60456187",
"0.60384655",
"0.60372955",
"0.6036349",
"0.60304683",
"0.6020214",
"0.6013436",
"0.60089654",
"0.60069484"
] | 0.0 | -1 |
Defines a mock method. It raises an exception if a given method name does not exist. This helps you realize quickly that your test is outdated when an interface of target class is changed in future. | def fake(method_name)
if [email protected]?(method_name.to_sym)
raise ArgumentError, "#{@class_name} does not have a method '#{method_name}'"
end
@args_array_by_method[method_name] = args_array = []
define_singleton_method(method_name) do |*args|
args_array << args
yield(*args)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def define_proxy_method(method_name)\n if method_name.to_s =~ /=$/\n eval_line = __LINE__ + 1\n target_class_eval %{\n def #{method_name}(*args, &block)\n instance_variable_get('@flexmock_proxy').\n mock.__send__(:#{method_name}, *args, &block)\n end\n }, __FILE__, eval_line\n else\n eval_line = __LINE__ + 1\n target_class_eval %{\n def #{method_name}(*args, &block)\n instance_variable_get('@flexmock_proxy').\n mock.#{method_name}(*args, &block)\n end\n }, __FILE__, eval_line\n _ = true # make rcov recognize the above eval is covered\n end\n end",
"def stub_for method_name\n @stubs[method_name] ||= new_stub_for(method_name)\n end",
"def define_proxy_method(method_name)\n if method_name.to_s =~ /=$/\n eval_line = __LINE__ + 1\n sclass.class_eval %{\n def #{method_name}(*args, &block)\n @flexmock_proxy.mock.__send__(:#{method_name}, *args, &block) \n end\n }, __FILE__, eval_line\n else\n eval_line = __LINE__ + 1\n sclass.class_eval %{\n def #{method_name}(*args, &block)\n @flexmock_proxy.mock.#{method_name}(*args, &block) \n end\n }, __FILE__, eval_line\n make_rcov_recognize_the_above_eval_is_covered = true\n end\n end",
"def mock_methods_for_testing! #:nodoc:\n request.headers['mock_methods'].each do |method_name, return_value|\n (class << self; self; end).instance_eval do\n define_method(method_name) { |*not_used| return_value }\n end\n end\n end",
"def stub_for method_name\n @stubs ||= {}\n @stubs[method_name] ||= new_stub_for(method_name)\n end",
"def stubbing(object, method_name)\n @stubs[object.object_id][method_name]\n end",
"def flexmock_expectations_for(method_name)\n @mock.flexmock_expectations_for(method_name)\n end",
"def flexmock_expectations_for(method_name)\n @mock.flexmock_expectations_for(method_name)\n end",
"def implement(method_name)\n method = @klass.instance_method(method_name)\n end",
"def define_method(name, &block)\n name = name.to_sym\n super(name, &block)\n @methods_defined[name] = true\n end",
"def define_method(name, &block)\n name = name.to_sym\n super(name, &block)\n @methods_defined[name] = true\n end",
"def class_call(method_name)\n Scenario::Orchestrator.new(self, @mock_class_double, :class, method_name)\n end",
"def existing_method clazz, method_name, meta, &block\n return if redefined? clazz, method_name, &block\n\n old_method = validate_existing_definition clazz, method_name\n validate_method_arity clazz, method_name, old_method, &block\n validate_decoration_meta clazz, method_name, old_method, meta\n\n old_method\n end",
"def have_received(expected_method_name)\n HaveReceived.new(expected_method_name)\n end",
"def add_method(method_name, &definition)\n new_patch AddMethodPatch.send(:new, method_name, &definition)\n end",
"def create_alias_for_existing_method(method_name)\n begin\n new_alias = new_name(method_name)\n unless @obj.respond_to?(new_alias)\n sclass.class_eval do\n alias_method(new_alias, method_name)\n end\n end\n new_alias\n rescue NameError => ex\n # Alias attempt failed\n nil\n end\n end",
"def stubs(method_name_or_hash, backtrace = nil)\n iterator = ArgumentIterator.new(method_name_or_hash)\n iterator.each { |*args|\n method_name = args.shift\n ensure_method_not_already_defined(method_name)\n expectation = Expectation.new(self, method_name, backtrace)\n expectation.at_least(0)\n expectation.returns(args.shift) if args.length > 0\n @expectations.add(expectation)\n }\n end",
"def safe_define_method(name, &block)\n if method_defined? name then\n debug \"Method #{self}.#{name} exists, return!\"\n return\n end\n define_method name, &block\n debug \"Define method #{self}.#{name}\"\n end",
"def hide_existing_method(method_name)\n stow_existing_definition(method_name)\n define_proxy_method(method_name)\n end",
"def hide_existing_method(method_name)\n stow_existing_definition(method_name)\n define_proxy_method(method_name)\n end",
"def mock(name, options={})\n Spec::Mocks::Mock.new(name, options)\n end",
"def generate_method(method_name, &block)\n define_method(method_name, &block)\n method = instance_method method_name\n remove_method method_name\n method\n end",
"def create_alias_for_existing_method(method_name)\n new_alias = new_name(method_name)\n unless @obj.respond_to?(new_alias)\n safe_alias_method(new_alias, method_name)\n end\n new_alias\n end",
"def instance_call(method_name)\n Scenario::Orchestrator.new(self, @mock_instance_double, :instance, method_name)\n end",
"def method_missing(methName, arg, &block)\n methods[methName] = arg\n self\n end",
"def mediate(method_name)\n raise Errors::ReservedMethodName if RESERVED_METHOD_NAMES.include?(method_name)\n\n Registration.repositories[self].methods << method_name\n end",
"def method(method_name)\n \n @_method = method_name.to_s\n \n end",
"def stub_instance_method(klass, name, val_or_callable, &block)\n if defined?(::Minitest::Moar::Stubbing)\n instance_stub klass, name, val_or_callable, &block\n elsif defined?(::Minitest::StubAnyInstance)\n klass.stub_any_instance(name, val_or_callable, &block)\n else\n begin\n new_name = \"__minitest_stub_instance_method__#{name}\"\n owns_method = instance_method(name).owner == klass\n klass.class_eval do\n alias_method new_name, name if owns_method\n\n define_method(name) do |*args|\n if val_or_callable.respond_to?(:call)\n instance_exec(*args, &val_or_callable)\n else\n val_or_callable\n end\n end\n end\n\n yield\n ensure\n klass.class_eval do\n remove_method name\n if owns_method\n alias_method name, new_name\n remove_method new_name\n end\n end\n end\n end\n end",
"def new_stub_for method_name\n response = Response.new(Http::Request.new, Http::Response.new)\n response.request_type = method_name\n response.request_options = {}\n send(\"simulate_#{method_name}_response\", response)\n response.signal_success\n response\n end",
"def new_stub_for method_name\n response = Response.new(Http::Request.new, Http::Response.new)\n response.request_type = method_name\n response.request_options = {}\n send(\"simulate_#{method_name}_response\", response)\n response.signal_success\n response\n end",
"def stub_method(object, method, &block) #:nodoc:\n unless @stubbed_methods.include?([object, method])\n @stubbed_methods << [object, method]\n add_hook(object, method, &block)\n end\n end",
"def replace_method(method_name, &definition)\n new_patch ReplaceMethodPatch.send(:new, method_name, &definition)\n end",
"def role_implementing(object, method_name)\n assigned_roles(object).find { |role| role.method_defined?(method_name) } || raise(NoMethodError, \"unknown method '#{method_name}' expected for #{object}\")\n end",
"def expected_method; end",
"def test_Method_InstanceMethods_meth\n\t\t# Define a method\n\t\tdef fred()\n\t\t\tputs \"Hello\"\n\t\tend\n\t\talias bert fred\n\t\t\n\t\tm1 = method(:fred)\n\t\tm2 = method(:bert)\n\t\tassert_equal(m1, m2)\n\tend",
"def assert_called_on_instance_of(klass, method_name, message = nil, times: 1, returns: nil)\n times_called = 0\n\n klass.define_method(\"stubbed_#{method_name}\") do |*|\n times_called += 1\n\n returns\n end\n\n klass.alias_method(\"original_#{method_name}\", method_name)\n klass.alias_method(method_name, \"stubbed_#{method_name}\")\n\n yield\n\n error = \"Expected #{method_name} to be called #{times} times, but was called #{times_called} times\"\n error = \"#{message}.\\n#{error}\" if message\n\n assert_equal times, times_called, error\n ensure\n klass.alias_method(method_name, \"original_#{method_name}\")\n klass.undef_method(\"original_#{method_name}\")\n klass.undef_method(\"stubbed_#{method_name}\")\n end",
"def ensure_method(name, &block)\n define_singleton_method(name, &block) unless respond_to?(name)\n end",
"def method(name=nil) # :nodoc:\n return name ? super : @meth\n end",
"def method_under_test(key)\n method_arg = self.class.metadata[key]\n\n return unless method_arg\n\n # Return here if you were nice and declared\n # your method under test using\n # `method: :method_name`.\n return method_arg if method_arg.is_a?(Symbol)\n\n # Otherwise, we have to search for the described\n # name string somewhere in our ancestor chain.\n\n # If we are inside a nested example group,\n # recursively search ascendants' metadata\n # for the correct method under testing.\n method_name = search_method_name(self.class.metadata, key)\n method_name.sub('#', '').sub('.', '').to_sym\n end",
"def method(name = nil)\n name.nil? ? @method : super(name)\n end",
"def mah_method!(method_param)\nend",
"def around_method name, &block\n original_method = instance_method name\n _redefine_method name do |*args|\n instance_exec original_method, *args, &block\n end \n end",
"def mock_facade_method(object, message, ret_val: nil)\n expect(object).to receive(message).and_return(ret_val)\n end",
"def method_call_for(name, module_name, method_name)\n unless method = @methods[name]\n @methods[name] = method = MethodCall.new(name, module_name, method_name, self)\n end\n\n method\n end",
"def matches? actual\n super\n\n raise ArgumentError.new('must specify a new method name') if new_method_name.nil?\n\n responds_to_methods? && aliases_method?\n end",
"def record_expected_return_values_on(method_name)\n (@original_methods ||= []) << method_name\n \n class_eval do\n alias_method \"intercepted_#{method_name}\", method_name\n \n define_method(method_name) do |*values|\n mock_expectation = send(\"intercepted_#{method_name}\", *values)\n synthesis_expectation.add_return_values(*values) if synthesis_expectation\n mock_expectation\n end\n end\n end",
"def method_missing(meth_name, *args, &block)\n raise \"Cannot call '#{meth_name}' on an undef'd method.\" if method(:name).respond_to?(meth_name)\n Object.instance_method(:method_missing).bind(self).call(meth_name, *args, &block)\n end",
"def meta_def( name, &blk )\n meta_eval { define_method name, &blk }\n end",
"def meta_def( name, &blk )\r\n meta_eval { define_method name, &blk }\r\n end",
"def safe_alias_method(new_alias, method_name)\n target_class_eval do\n begin\n alias_method(new_alias, method_name)\n rescue NameError\n nil\n end\n end\n end",
"def implement!(method_name)\n method = @klass.instance_method(method_name)\n my_method = self.instance_method(method_name)\n unless method.arity == my_method.arity\n additional_info = if method.arity == -1\n MESSAGE_ABOUT_NEGATIVE_ARITY\n else\n \"\"\n end\n raise \"#{@klass}'s version of #{method_name} takes #{method.arity} arguments - yours takes #{my_method.arity}#{additional_info}\"\n end\n end",
"def method_missing(method_name, *args, &block)\n possible_method_names = ['all', 'notify', 'flog', 'flay', 'dcov', 'rcov', 'reek', 'roodi', 'saikuro', 'tests', 'zentests']\n raise \"You must specify a method name within [#{possible_method_names.join(', ')}] in order to configure your project, you specified #{method_name} #{(\"with #{args.join(\", \")} arguments\" if args.length > 0)}\" unless possible_method_names.include?(method_name)\n end",
"def implement_instance_method(method_name, &block)\n implementations[:instance][method_name] = Implementation.new(self, @mock_instance_double, :instance, method_name, &block)\n end",
"def calls_by_method_name; end",
"def method_missing msg, *args, &block\n defi = Definition.new(msg, args, block)\n if injected = __mock_injected[defi.msg]\n defi.original_method = injected.original_method\n else\n __mock_inject_method(defi)\n end\n __mock_defis_push(defi)\n Modifier.new(self, defi)\n end",
"def method_definition(name)\n bind_call(:instance_method, name)\n end",
"def meta_def(name, &blk)\n meta_eval { define_method name, &blk }\n end",
"def method_missing(meth, *args, &block)\n # Check to see if it can be evaluated\n if(matches? meth)\n #Defines the method and caches it to the class\n self.class.send(:define_method, meth) do\n if element_id_exists_method?(meth)\n if respond_to?(meth.to_s.chop)\n begin\n send meth.to_s.chop\n rescue Selenium::WebDriver::Error::NoSuchElementError => e\n return false\n end\n return true\n end\n elsif wait_method?(meth)\n send :wait_for, meth.to_s.sub('wait_for_','').to_sym\n elsif navigate_method?(meth)\n send :navigate_to, instance_variable_get(\"@#{meth.to_s.sub('navigate_to_','')}\")\n elsif element_id_method?(meth)\n @driver.find_element(:id, meth)\n end\n end\n # calls the method\n send meth, *args, &block\n else\n super\n end\n end"
] | [
"0.69107914",
"0.6910658",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6759748",
"0.6693149",
"0.6662824",
"0.6522238",
"0.6486224",
"0.6465431",
"0.6289991",
"0.62896776",
"0.62611043",
"0.62560344",
"0.6216699",
"0.6156356",
"0.6120165",
"0.60855174",
"0.6050427",
"0.6008881",
"0.5990267",
"0.59655666",
"0.59520614",
"0.59520614",
"0.59429944",
"0.59171355",
"0.58931327",
"0.589162",
"0.5887642",
"0.5885609",
"0.58847797",
"0.5866077",
"0.5860043",
"0.5860043",
"0.5842339",
"0.58413655",
"0.58247894",
"0.58090955",
"0.5782991",
"0.5775435",
"0.5774467",
"0.57561964",
"0.5742311",
"0.5739125",
"0.57255876",
"0.57139945",
"0.5710635",
"0.57080585",
"0.5707598",
"0.57021856",
"0.5695587",
"0.5684197",
"0.5671805",
"0.5668248",
"0.56620204",
"0.56561303",
"0.5655867",
"0.56552345",
"0.564369",
"0.5641903",
"0.56392604",
"0.56322956"
] | 0.0 | -1 |
def transaction(&block) super end | def commit
@handle.commit
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transaction(&block); end",
"def transaction(&block)\n yield\n end",
"def transaction(&block)\n yield\n end",
"def transaction; end",
"def transaction; end",
"def transaction; end",
"def transaction(&block)\n block.call\n end",
"def transaction(&block)\n yield\n commit\n end",
"def within_transaction; end",
"def within_transaction; end",
"def with_transaction(&block)\n base_model.transaction(&block)\n end",
"def transaction(&block)\n ActiveRecord::Base.transaction(&block)\n end",
"def transaction(&blk)\n tap(&blk)\n end",
"def transaction\n start_transaction\n\n yield\n ensure\n end_transaction if transaction_started?\n end",
"def transaction\n @database.transaction { yield self }\n end",
"def transaction(&block)\n self['AutoCommit'] = false\n self.do_transaction(&block)\n self['AutoCommit'] = true\n end",
"def begin_db_transaction() end",
"def begin_db_transaction() end",
"def use_transactions; end",
"def use_transactions; end",
"def begin\n db.transaction do\n yield\n end\n end",
"def transaction(start_db_transaction=true)\n yield\n end",
"def within_transaction(object); end",
"def transaction(model_class)\n raise \"you must override #transaction in an adapter subclass, it must yield\"\n end",
"def with_transaction\n ActiveRecord::Base.transaction { yield }\n end",
"def scaffold_transaction(&block)\n transaction(&block)\n end",
"def transaction(options={}, &block)\n connection.transaction(options.update(:requires_new => true), &block)\n end",
"def transaction(&block)\n @in_transaction += 1\n begin\n yield self\n self.commit if @in_transaction > 0\n rescue => e\n self.rollback\n raise e\n ensure\n @in_transaction -= 1 unless @in_transaction == 0\n end\n end",
"def commit_db_transaction() end",
"def commit_db_transaction() end",
"def transaction(&block)\n @fb_txns << Rubyfb::Transaction.new(@fb_cxn)\n super &block\n end",
"def transaction(&block)\n begin\n @store.transaction\n block.call(@store)\n @store.commit\n rescue SQLite3::Exception => exception\n raise \"SQLite exception: #{exception}\"\n end\n end",
"def transaction\n begin\n if block_given?\n begin_db_transaction\n result = yield\n commit_db_transaction\n result\n end\n rescue Exception => database_transaction_rollback\n rollback_db_transaction\n raise\n end\n end",
"def transaction\n sanity_check\n raise InterfaceError, \"No block given\" unless block_given?\n\n commit\n begin\n yield self\n commit\n rescue Exception\n rollback\n raise\n end\n end",
"def in_transaction(opts = {})\n yield\n end",
"def transaction\n start\n yield self\n rescue Object => ex\n rollback\n debug \"#{ex.class}: #{ex.message}\"\n ex.backtrace.each { |line| debug line }\n else\n commit\n end",
"def transaction\n start_transaction!\n\n result = yield\n\n query 'COMMIT'\n\n result\n rescue\n query 'ROLLBACK'\n raise\n\n ensure\n end_transaction!\n end",
"def transaction(mode = :deferred, &block)\n @db.transaction(mode, &block)\n end",
"def transaction(opts={}, &blk)\n Toshi.db.transaction(opts, &blk)\n end",
"def transaction(&block)\n db\n persister\n\n result = nil\n start_time = Time.now\n begin\n db.transaction(:rollback => :reraise, :isolation => :repeatable,\n :retry_on => @retry_on_error, :num_retries => 3) do\n result = yield block\n end\n total = Time.now.to_ms - start_time.to_ms\n debug \"Transaction committed (#{total} ms)\"\n result\n rescue StandardError => e\n total = Time.now.to_ms - start_time.to_ms\n warn \"Transaction failed (#{total} ms)\"\n raise e\n ensure\n GC.start\n end\n end",
"def transaction(object)\n object.db.transaction {raise ::Sequel::Error::Rollback unless yield}\n end",
"def on_prepare_transaction_commit(unit, transaction); end",
"def transaction(&block)\n raise ArgumentError, 'no block given' unless block\n\n `#@native.transaction(#{->(t) { block.call(Transaction.new(self, t)) }})`\n end",
"def transaction\n use do |connection|\n connection.transaction do |conn|\n begin\n yield conn\n rescue Rollback\n return\n end\n end\n end\n end",
"def begin_transaction\n return System.begin_transaction\n end",
"def ar_default_transaction_handler\n ar_model.transaction do\n yield\n end\n end",
"def transaction(&block)\n @@semaphore.synchronize{\n block.call\n }\n end",
"def transaction(message, &block)\n store.transaction(message, &block)\n end",
"def transactions_to_db\n\n end",
"def commit; end",
"def commit; end",
"def commit; end",
"def transaction( &block )\n connect do | conn |\n conn.transaction do | conn |\n yield SqlRunner.new(SingleConnectionPool.new( conn ))\n end\n end\n end",
"def transaction(options = {}, &block)\n @klass.connection.run_queries_on_shard(@shard) do\n @klass = @klass.connection.transaction(options, &block)\n end\n end",
"def commit( transaction )\n fail NotImplementedError\n end",
"def commit()\n #This is a stub, used for indexing\n end",
"def transaction\n raise Mysql2::Error, 2002 if @my.nil?\n\n if block_given?\n begin\n @my.query('START TRANSACTION WITH CONSISTENT SNAPSHOT')\n yield # Start executing the query black.\n @my.query('COMMIT')\n rescue Mysql2::Error => e\n @my.query('ROLLBACK')\n raise e\n end\n end\n end",
"def transaction(options = {}, &block)\n run_on_shard { @klass = klass.transaction(options, &block) }\n end",
"def transaction\n raise Mysql::Error, 'Not Connected' if @my.nil?\n\n if block_given?\n begin\n @my.query('START TRANSACTION WITH CONSISTENT SNAPSHOT')\n yield # Start executing the query black.\n @my.query('COMMIT')\n rescue Mysql::Error => e\n @my.query('ROLLBACK')\n raise e\n end\n end\n end",
"def transaction(&block)\n @cache.transaction do\n yield(@cache)\n end\n end",
"def rollback_db_transaction() end",
"def rollback_db_transaction() end",
"def transaction(options = {}, &block)\n if connection = (options.delete(:on) || Postamt.transaction_connection)\n Postamt.on(connection) { super }\n else\n super\n end\n end",
"def begin_db_transaction\n @transaction = @connection.transaction('READ COMMITTED')\n end",
"def run(*args, &block)\n Sequel::Model.db.transaction(rollback: :always, auto_savepoint: true) { super }\n end",
"def commit(transaction)\n raise NotImplementedError\n end",
"def transaction\n raise ArgumentError, 'No block was given' unless block_given?\n\n with_client do |client|\n begin\n client.query('BEGIN')\n yield client\n client.query('COMMIT')\n rescue StandardError => e\n client.query('ROLLBACK')\n raise e\n end\n end\n end",
"def commit!() raise NotImplementedError end",
"def perform( &block )\r\n @transaction_strategy.perform( &block )\r\n end",
"def transaction\n connect do |c|\n t = Txn.new(c, @log)\n yield t\n end\n end",
"def checked_transaction(opts=OPTS)\n use_transaction?(opts) ? db.transaction({:server=>this_server}.merge!(opts)){yield} : yield\n end",
"def checked_transaction(opts=OPTS)\n use_transaction?(opts) ? db.transaction({:server=>this_server}.merge!(opts)){yield} : yield\n end",
"def commit_transaction\n\t super\n\n\t arguments.dup.each do |key, value|\n if value.respond_to?(:transaction_proxy?) && value.transaction_proxy?\n\t\t arguments.update!(key, value.__getobj__)\n\t\tend\n\t end\n\tend",
"def begin_db_transaction\n @connection.autocommit = false\n end",
"def transactions\n\t\[email protected]\n\tend",
"def invoke(source, &block)\n if source.parent\n block.()\n else\n ActiveRecord::Base.transaction(&block)\n end\n end",
"def transaction(&block)\n raise InvalidDbError if @stale\n\n return transaction_in_staging(true, &block) if self.staging?\n\n begin\n transaction_in_staging(false, &block)\n ensure\n self.unstage\n end\n end",
"def begin_db_transaction\n execute(\"BEGIN\")\n end",
"def begin_db_transaction\n execute(\"BEGIN\")\n end",
"def commiter() end",
"def begin_transaction(conn, opts={})\n set_transaction_isolation(conn, opts)\n super\n end",
"def to_transaction\n Client::Transaction.new(self).tap do |t|\n t.response = yield if block_given?\n end\n end",
"def begin\n @timestamp = Time.now\n # NOTE: yield self is a bit of a smell to me, but I am okay with this\n # as the block is evaluated in the context of the caller and not of\n # the Transaction object.\n yield self if block_given?\n ensure\n finished\n end",
"def begin\n self.transaction_count += 1\n end",
"def transactions\n @connection.savepoint\n end",
"def transaction_disabled=(_arg0); end",
"def commit\n # Nothing to do for an in memory database\n end",
"def with_optional_transaction(bool, &block)\n bool ? transaction { yield } : yield\n end",
"def commit\n query 'commit'\n self\n end",
"def transaction(start_db_transaction = true)\n transaction_open = false\n begin\n if block_given?\n if start_db_transaction\n begin_db_transaction\n transaction_open = true\n end\n yield\n end\n rescue Exception => database_transaction_rollback\n if transaction_open\n transaction_open = false\n rollback_db_transaction\n end\n raise unless database_transaction_rollback.is_a? ActiveRecord::Rollback\n end\n ensure\n if transaction_open\n begin\n commit_db_transaction\n rescue Exception => database_transaction_rollback\n rollback_db_transaction\n raise\n end\n end\n end",
"def after_commit(unit); end",
"def transact; end",
"def transaction\n @transaction ||= PerseveringTransaction.new(connection)\n end",
"def receive_transaction\n end",
"def receive_transaction\n end",
"def within_transaction\n if use_transaction\n first.within_transaction do\n yield\n success?\n end\n else\n yield\n end\n end",
"def call\n db.transaction do\n _call_in_transaction\n end\n end",
"def trans\n\t\tbegin\n\t app = Aas::Application\n\t doc = app.DocumentManager.MdiActiveDocument\n\t db = doc.Database\n\t tr = doc.TransactionManager.StartTransaction\n\t yield tr, db\n\t\n\t tr.Commit\n\t tr.Dispose\n\t rescue Exception => e\n\t puts_ex e\n\t ensure\n\t tr.Dispose \n\t end\t\n\tend",
"def start(&block)\n transaction.start do\n run_callbacks(:transaction, &block)\n end\n end",
"def save\n\t\[email protected]\n\tend",
"def begin\n new_transaction = Transaction.new(@data)\n\n # Record nested transactions in teh parent transactions buffer\n if current_transaction\n current_transaction.add_nested_transaction(new_transaction)\n end\n\n @all_transactions << new_transaction\n end"
] | [
"0.9166085",
"0.88309205",
"0.88309205",
"0.8813152",
"0.8813152",
"0.8813152",
"0.87166363",
"0.85941994",
"0.846339",
"0.846339",
"0.8392532",
"0.8300115",
"0.82924736",
"0.81922555",
"0.817089",
"0.8134129",
"0.8117979",
"0.8117979",
"0.8067657",
"0.8067657",
"0.7981954",
"0.7922048",
"0.78972566",
"0.7894597",
"0.78809047",
"0.78529924",
"0.78245825",
"0.7772559",
"0.77122027",
"0.77122027",
"0.76904976",
"0.76585233",
"0.7647835",
"0.7623152",
"0.76185656",
"0.7590214",
"0.75562173",
"0.7538981",
"0.7480998",
"0.745637",
"0.74282116",
"0.7379985",
"0.7371039",
"0.73627526",
"0.7360364",
"0.7357561",
"0.7334401",
"0.72782737",
"0.724768",
"0.7246037",
"0.7246037",
"0.7246037",
"0.72370476",
"0.72345376",
"0.7216618",
"0.72153294",
"0.72088873",
"0.7195945",
"0.71891314",
"0.71758384",
"0.7168924",
"0.7168924",
"0.71666807",
"0.71371067",
"0.7102884",
"0.7102628",
"0.7097661",
"0.6998514",
"0.6966867",
"0.6962812",
"0.6941015",
"0.6941015",
"0.6921262",
"0.69116443",
"0.68874574",
"0.6868719",
"0.68642175",
"0.68632853",
"0.68632853",
"0.682658",
"0.67942685",
"0.6769275",
"0.6759255",
"0.6739725",
"0.6738366",
"0.6718717",
"0.6714975",
"0.6693577",
"0.6687419",
"0.66855985",
"0.6669905",
"0.6667975",
"0.66571146",
"0.66536266",
"0.66536266",
"0.66328925",
"0.6631754",
"0.6616635",
"0.66086566",
"0.6608217",
"0.66062635"
] | 0.0 | -1 |
NOTE: Shopify appears to only consider the first (eh... ~3036) characters of the filename when determining whether or not they think it's a duplicate (and should get the name mangled with a GUID), so we need to put the unique parts of the name near the beginning. | def live_name
[
transformed_part('product'),
middle_name(standalone: false), # Will have word dividers on either side
idx,
maybe_upto,
'-',
parts['sku'] =~ /editorial/ && bang? ? 'square-' : nil,
[name_base, ext_name].join
].compact.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_file_name file_name\n count = 0\n name = file_name\n current_user = User.find(self.user_id)\n while Userfile.find_all_accessible_by_user(current_user).exists?(:name => name)\n count += 1\n extname = File.extname(name)\n name = \"#{File.basename(name,extname)}-#{count}#{extname}\"\n end\n return name\n end",
"def get_unique_file_name fname\n 100.times do |i|\n suffix = \"%03d\" % i\n extn = File.extname(fname)\n base = File.basename(fname, extn)\n # f = fname + '.' + suffix\n f = base + suffix + extn\n return f unless File.exist?(f)\n end\n\n timestamp = Time.now.strftime('%Y%m%d-%H%M%S')\n return fname + '.' + timestamp\nend",
"def original_file_name\r\n file_name_parts = initial_image_name.split('_')\r\n if file_name_parts.length > 0\r\n last_occurrence = nil\r\n first_element = file_name_parts[0]\r\n if Output835.element_duplicates?(first_element, file_name_parts)\r\n last_occurrence = file_name_parts.rindex(first_element)\r\n end\r\n last_occurrence ||= file_name_parts.length\r\n # Fetch the first n ( where n = last_occurrence ) elements of the array, until the first element duplicates.\r\n normalized_file_name_parts = file_name_parts.first(last_occurrence)\r\n normalized_file_name = normalized_file_name_parts.join('_')\r\n if Output835.element_duplicates?(first_element, file_name_parts)\r\n # Only for the duplicating file names, the extension of the file is appended to the normalized_file_name.\r\n # For others, the normalized_file_name itself has the extension.\r\n image_format_extension = batch.facility.image_file_format\r\n normalized_file_name << '.' << image_format_extension.downcase\r\n end\r\n normalized_file_name\r\n else\r\n initial_image_name\r\n end\r\n end",
"def valid_new_filename(file)\n new_file = file\n counter = 0\n while File.exist?(new_file) do\n counter += 1\n ext = File.extname(file)\n basename = file.split(ext).first\n new_file = \"#{basename}_#{counter}#{ext}\"\n end\n new_file\n end",
"def generate_unique_filename\n name = options[:file_name] || wrapper.name\n # TODO: Sanitize the file name\n\n filename = \"#{name}.swatches\"\n\n related_files = related_file_indexes(filename)\n\n filename = if related_files.present?\n \"#{name}-#{related_files.max + 1}#{SWATCHES_EXTENSION}\"\n else\n \"#{name}#{SWATCHES_EXTENSION}\"\n end\n\n @swatches_path = File.join(options[:export_directory], filename)\n end",
"def collisionless_filename source, extension\n base_name = \"#{source}_scrape_#{Date.today.strftime('%Y-%m-%d')}.#{extension}\"\n unused_filename = base_name\n n = 1\n while File.file?(unused_filename) do\n unused_filename = \"#{base_name}_v#{n}.#{extension}\"\n n += 1\n end\n unused_filename\n end",
"def filename\n @name ||= ActiveSupport::SecureRandom.hex\n\t\"#{@name}#{File.extname(original_filename).downcase}\" if original_filename\n end",
"def generate_new_filename(original_filename)\n s = Time.now.to_i.to_s + rand(999).to_s\n hash = Digest::MD5.hexdigest(s) \n original_filename = original_filename.gsub('#', '').gsub(/\\s+/, ' ')\n hash += ('-' + original_filename.sub(/\\A[a-z0-9]{32}-/, ''))\n hash.downcase \n end",
"def filename\n @name ||= \"#{timestamp}-#{secure_token(8)}.#{file.extension}\" if original_filename.present?\n end",
"def file_name(name)\n name.to_s.gsub(/-/, \"_\").underscore\n end",
"def filename\n [Digest::SHA1.hexdigest(file.read),file.extension].join('.') if original_filename\n end",
"def file_name\n \"#{name.downcase.gsub(/\\s/, '')}.jpg\"\n end",
"def get_correct_name(file_name, user_address)\n ext = File.extname(file_name) # get file extension\n base_name = File.basename(file_name, ext) # get file name without extension\n name = base_name + ext.downcase # get full file name\n index = 1\n\n while File.exist?(storage_path(name, user_address)) # if the file with such a name already exists in this directory\n name = base_name + ' (' + index.to_s + ')' + ext.downcase # add an index after its base name\n index = index + 1\n end\n\n name\n end",
"def filename\n \"#{secure_token(10)}.#{file.extension}\" if original_filename.present?\n end",
"def filename\n if original_filename\n uuid = UUIDTools::UUID.md5_create(UUIDTools::UUID_DNS_NAMESPACE, original_filename)\n extname = File.extname(original_filename)\n return \"#{uuid}#{extname}\"\n end\n end",
"def rename_once?(filename)\n basename = File.basename(filename, File.extname(filename))\n basename.match(/^(.*)_(\\d+)_(\\d+)_\\2_\\3$/)\n end",
"def generate_file_name\n file_name = attachment.instance_read(:file_name).slugged_filename\n attachment.instance_write :file_name, file_name\n end",
"def next_uniq_child_name(item)\n taken_names = contents_names(item).map(&:downcase)\n name_generator = FileName.new(item.name, path: :relative, add: :always,\n format: '(%d)', delimiter: ' ')\n new_name = item.name\n new_name = name_generator.create while taken_names.include?(new_name.downcase)\n new_name\n end",
"def randomize_filename\n extension = File.extname(asset_file_name).downcase\n self.asset.instance_write(:file_name, \"#{SecureRandom.hex.first(16)}#{extension}\")\n end",
"def find_filename(name)\n return name if not File.exists?(name)\n\n new_name = name\n count = 0\n until not File.exists?(new_name)\n count += 1\n new_name = \"#{name}_#{count}\"\n end\n\n new_name\n end",
"def filename\n \"#{Digest::SHA1.file(file.file).hexdigest}.png\" if original_filename\n end",
"def filename\n @name ||= \"#{md5}.#{file.extension}\" if original_filename.present?\n end",
"def original_filename(filename)\n /\\d+_\\d+_(.+)?/.match(filename.to_s)&.captures&.first\n end",
"def original_filename(filename)\n /\\d+_\\d+_(.+)?/.match(filename.to_s)&.captures&.first\n end",
"def proper_filename(file)\n file.gsub(/[^\\w]/,'_')\n end",
"def file_name\n name.underscore\n end",
"def create_file_name(ext = nil)\n ext ||= self.ext\n return name unless ext\n \"#{unique_key}.#{ext}\"\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present? \n end",
"def safe_backup_name( filename )\n file = filename\n orig_file = filename\n index = 1\n while File.exists?(file)\n index = index + 1\n file = \"#{File.basename(orig_file, '.*')}-#{index}#{File.extname(orig_file)}\"\n end\n file\n end",
"def bundle_resouce_file_name\n self.title.gsub(/\\s/,\"_\")\n end",
"def unique_path\n unique_name.split(\"/\") rescue [unique_name]\n end",
"def normalized_profile_file_name\n \"#{self.id}-#{self.profilephoto_file_name.gsub( /[^a-zA-Z0-9_\\.]/, '_')}\"\n end",
"def name\n file.partition(base).last.gsub(/[_\\/]/, \" \").strip\n end",
"def create_file_name(name)\r\n if name.match(/(.*)\\.([^\\.]*)/)\r\n fname, fext = $1, $2\r\n else\r\n fname, fext = name, \"dat\"\r\n end\r\n fname = fname.slugerize\r\n fext = fext.slugerize\r\n hash = Time.now.usec % 814949\r\n return \"#{hash.to_s(16)}_#{fname}.#{fext}\"\r\n end",
"def filename\n \"#{secure_token(10)+File.extname(original_filename)}\" if original_filename.present?\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename\n end",
"def unique_name(name)\n \"pedant_#{name}_#{pedant_suffix}\"\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present?\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present?\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present?\n end",
"def name\n @name ||= filename.split(\".\").first.sub(/^_/, \"\")\n end",
"def filename\n \"#{original_filename}+#{secure_token}.#{file.extension}\" if original_filename.present?\n end",
"def generate_filename(filename)\n\t\t# Just some entropy to prevent collisions... not trying\n\t\t# to protect any information.\n\t\tfilename = \"#{filename}:#{SecureRandom.hex(10)}:#{Time.now}\"\n\n\t\tdigest = Digest::SHA256.new\n\t\treturn digest.hexdigest filename\n\tend",
"def filename\n @filename = \"#{secure_token}_#{split_extension(original_filename)}.#{file.extension}\" if original_filename.present?\n end",
"def file_name_uuid(opts)\n validate_uuid(opts)\n validate_original_format(opts)\n\n uuid = opts[:uuid].to_s.downcase\n extension = opts[:original_format].trim('.', '').to_s.downcase\n\n uuid + @extension_indicator + extension\n end",
"def sanitize_filename(file_name)\r\n\t\tjust_filename = File.basename(file_name)\r\n\t\tjust_filename.sub(/[^\\w\\.\\-]/, '_')\r\n\tend",
"def file_name(title)\n name = title.gsub(/[\\r\\n]/, \" \")\n .gsub(/[^a-zA-Z\\d\\s]/, \"\")\n .gsub(/ /, \"_\")\n\n name.length > 31 ? name[0..30] : name\n end",
"def filename\n Time.now.to_i.to_s + [*('A'..'Z')].sample(8).join + \".\" + file.extension if original_filename\n end",
"def calculate_file_name(file_path,file_name)\n file_sha = Digest::SHA256.file(file_path)\n \"#{file_sha}_#{file_name}\"\n end",
"def filename\n DateTime.now.strftime('%Q') + Digest::MD5.hexdigest(original_filename) + original_filename if original_filename\n end",
"def randomize_file_name\n extension = File.extname(passport_file_name).downcase\n passport.instance_write(:file_name, \"deep-space#{extension}\")\n end",
"def filename(record, file)\n original = \"#{file.basename}.#{file.extension}\"\n write_attribute(:original_filename, original)\n ext = file.suffix.nil? || file.suffix == :original ? file.extension : file.suffix\n \"#{application_for_offering.id.to_s}-#{title.gsub(/[\\s,\\.\\\\\\/\\*\\?\\%\\:\\|\\\"\\'\\<\\>]?/,'')}.#{ext}\"\n end",
"def file_name(title)\n name = title.gsub(/[\\r\\n]/, ' ')\n .gsub(/[^a-zA-Z\\d\\s]/, '')\n .tr(' ', '_')\n\n name.length > 31 ? name[0..30] : name\n end",
"def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end",
"def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end",
"def get_valid_file_name(iFileName)\n if (defined?(prohibited_file_names_chars) != nil)\n return iFileName.gsub(/[#{Regexp.escape(prohibited_file_names_chars)}]/, '_')\n else\n return iFileName\n end\n end",
"def fix_filename\n unless self.filename.blank?\n self.filename.sub!(/^.*\\/([^\\/]*)$/, '\\1')\n self.filename += '.torrent' unless self.filename =~ /\\.torrent$/\n end\n end",
"def normalize_name\n lower = @name.downcase\n non_word = lower.gsub(/\\W/,'_').gsub(/_+/,'_')\n normalized = non_word.split('_').compact.join('_')\n [normalized, Digest::SHA1.hexdigest(@name)[0..10]].join('_')\n end",
"def full_filename_fu(filename)\n version_prefix = \"#{version_name}_\"\n filename = filename.gsub(version_prefix, \"\")\n ext = nil\n basename = filename.gsub /\\.\\w+$/ do |s|\n ext = s; ''\n end\n \"#{basename}_#{version_name}#{ext}\"\n end",
"def safe_file_name(filename)\n basename = File.basename(filename)\n all_ascii = true\n basename.each_byte do |c|\n if c>=128\n all_ascii = false\n break\n end\n end\n\n\n if(all_ascii)\n yield(filename)\n else\n new_file_name = File.dirname(filename) + '/' + (0...8).map{ ('a'..'z').to_a[rand(26)] }.join + File.extname(filename)\n FileUtils.cp(filename,new_file_name)\n yield(new_file_name)\n FileUtils.rm(new_file_name)\n end\n end",
"def filename\n #\"#{original_filename.split('.').first}.png\" if original_filename\n \"img.#{original_filename.split('.').last}\" if original_filename\n #original_filename if original_filename\n end",
"def formatted_filename(name, version, suffix, extension)\n name.gsub(\"#{version}_\", \"\").chomp(File.extname(name)) + \"_#{suffix}.#{extension}\"\n end",
"def file_name(s)\n s.gsub(/[\\s\\\\\\/]/, '_')\n end",
"def unique_track_name(name)\n i = 2\n name_key = name\n while @tracks.has_key? name_key\n name_key = \"#{name}#{i.to_s}\"\n i += 1\n end\n \n return name_key\n end",
"def tmpnam(filename)\n m = filename.match(/(X*)$/)\n \n retnam = filename.dup\n \n if m[1]\n mask = \"\"\n m[1].length.times { mask += VALID_TMPNAM_CHARS[rand(52)].chr }\n retnam.sub!(/(X*)$/, mask) \n end\n\n return retnam\n end",
"def find_free_name filename\n base_filename = filename ||= @filename\n\n number = 1\n\n while File.exist? filename do\n filename = \"#{base_filename}.#{number}\"\n number += 1\n end\n\n filename\n end",
"def generate_name\n self.name = \"#{album.name}-#{self.image_file_file_name}\"\n end",
"def full_filename(filename)\n if filename.include? '.pdf'\n filename.gsub! '.pdf' '.jpg' \n end\n \"thumb_#{filename}\"\n end",
"def filename\n if original_filename\n md5 = Digest::MD5.hexdigest(\"#{model.imagenable.friendly_id}_#{Time.now}\")\n \"#{md5}.#{file.extension}\"\n end\n end",
"def filename\n if super.present?\n @name ||=\"#{SecureRandom.hex}.#{file.extension.downcase}\" if original_filename\n Rails.logger.debug(\"(BaseUploader.filename) #{@name}\")\n @name\n end\n end",
"def unique_track_name(name)\n i = 2\n name_key = name\n while @tracks.has_key? name_key\n name_key = \"#{name}#{i.to_s}\"\n i += 1\n end\n\n name_key\n end",
"def unique_name\n unique_name = @name\n unique_name += \" (#{@disambiguation})\" if @disambiguation\n return unique_name\n end",
"def generate_uniq_filename_from(data)\n if data.respond_to?(:path)\n Digest::MD5.hexdigest(data.path)\n elsif data.respond_to?(:read)\n chunk = data.read(1024)\n data.rewind\n Digest::MD5.hexdigest(chunk)\n else\n Digest::MD5.hexdigest(data)\n end\n end",
"def generate_uniq_filename_from(data)\n if data.respond_to?(:path)\n Digest::MD5.hexdigest(data.path)\n elsif data.respond_to?(:read)\n chunk = data.read(1024)\n data.rewind\n Digest::MD5.hexdigest(chunk)\n else\n Digest::MD5.hexdigest(data)\n end\n end",
"def safe_filename(id, suffix = \"\")\n filename = \"#{id}_#{Time.now.getutc}_#{suffix}\"\n filename.gsub(/\\s+/, '_').gsub(/[^0-9A-Za-z_\\.]/, '')\n end",
"def sanitize_file_name_as_name\n sanitized_name_array = name.split('.')\n sanitized_name_array.pop if sanitized_name_array.length > 1\n self.name = sanitized_name_array.join('.').tr('-_', ' ').split.map(&:capitalize)*' '\n end",
"def filename\n # byebug\n \"#{secure_token}.jpg\" if original_filename.present?\n end",
"def sanitize_filename\n name = self.strip\n #--- get only the filename, not the whole path\n name.gsub! /^.*(\\\\|\\/)/, ''\n\n #--- Finally, replace all non alphanumeric, underscore or periods with underscore\n name.gsub! /[^\\w\\.\\-]/, '_'\n return name\n end",
"def possible_sample_name(filename)\n filename.split('/').last.split('.').first\n end",
"def filename\n \"#{original_filename_without_extension.parameterize}_#{model.filename_token}#{original_extension}\" if original_filename\n end",
"def validate_name_uniqueness\n existing_files = ProjectFile.where(directory_id: directory_id, \n project_id: project_id, name: name)\n unless existing_files.empty? or (existing_files.size == 1 and \n existing_files.first == self)\n errors.add(:name, \"must be unique within a folder; please \"+\n \"change #{project.name}:#{path} to something different.\")\n end\n end",
"def possible_sample_name(filename)\n\t\tfilename.split('/').last.split('.').first\n\tend",
"def reserve_name\n if self[:namer]\n filename\n self[:namer].next\n end\n self[:filename]\n end",
"def clean_filename\n if filename.present?\n cleaned_filename = cleaned_basename = basename.gsub(/[^a-z0-9\\-_]/i, '-')\n cleaned_filename = \"#{cleaned_basename}.#{extension.downcase}\" if extension\n self.filename = cleaned_filename\n end\n end",
"def generate_basename(chunk)\n salt = nil\n while true\n filename = Digest::MD5.hexdigest(\"#{chunk.range_start}#{salt}\") + CHUNK_EXT\n return filename unless chunks_by_basename[filename]\n salt = (salt||0) + 1\n end\n end",
"def set_unique_name\n salt = rand 1000000\n salt2 = rand 100\n if self.title.blank?\n self.unique_name = \"#{salt}_#{salt2}\" \n else\n self.unique_name = \"#{self.title.gsub(/[^\\w\\.\\-]/,'_').downcase}_#{salt}\"\n end\n end",
"def filename\n if original_filename.present?\n \"#{model.story.slug}-#{secure_token}.#{file.extension}\"\n end\n end",
"def filename(file)\n if @filenames.key?(file.name)\n @filenames[file.name] += 1\n file.name.sub(/\\.(\\w+)\\z/, \"-#{@filenames[file.name]}.\\\\1\")\n else\n @filenames[file.name] = 0\n file.name\n end\n end",
"def filename\n if original_filename\n \"#{model.name.parameterize}-#{secure_token(8)}.#{file.extension}\"\n end\n end",
"def rename_out fileName\r\n name = fileName.split('/')[-1]\r\n name = name.split('\\\\')[-1]\r\n return \"Code_From_#{name.gsub(/\\./,'_')}.html\"\r\n end",
"def find_free_name(filename); end",
"def short_filename\n return $1 if @filename =~ %r{.*/(.*/[^/]+)$}\n return @filename\n end",
"def short_filename\n return $1 if @filename =~ %r{.*/(.*/[^/]+)$}\n return @filename\n end",
"def create_unique_filename( text_value, suffix = DateTime.now.strftime(\"_%Y%m%d_%H%M\") )\n text_value.gsub(/[òàèùçé\\^\\!\\\"\\'£\\$%&?\\.\\,;:§°<>]/,'').gsub(/[\\s|]/,'_').gsub(/[\\\\\\/=]/,'-') + suffix\n end",
"def asset_id(file)\n File.basename file, '.*'\n end",
"def scrubbed_name\n extension = @fileName.split(\".\")[@fileName.split(\".\").length-1]\n \n if @season.to_i < 10\n season_string = \"S0{#@season}\"\n else\n season_string = \"S#{@season}\"\n end\n \n if @episode.to_i < 10\n episode_string = \"E0#{@episode}\"\n else\n episode_string = \"E#{@episode}\"\n end \n \n [@name.gsub(\" \",\".\"),[season_string,episode_string].join(\"\"),extension].join(\".\")\n end",
"def extract_file_name(diff_file_name)\n file_name = diff_file_name.to_s.split(\"/\")\n # Remove the first part of \"--- a\"\n file_name.shift\n # Re-join the remaining parts\n file_name = file_name.join('/')\n return file_name\n end",
"def filename\n original_filename.try(:gsub, '+', '-')\n end",
"def filename\n filename = (model.name + '_' + model.artist.name + '_' + model.release.name).downcase.gsub(/\\s/, '-')\n \"#{filename}\" if original_filename \n end",
"def file_name\n \"#{@file_name}.#{extension}\"\n end",
"def file_name\n if file.original_name.starts_with?('http')\n file.original_name.match(/[^\\/]+$/)[0]\n else\n file.original_name\n end\n end"
] | [
"0.7650481",
"0.73489976",
"0.7346674",
"0.726912",
"0.71614987",
"0.7121346",
"0.70793927",
"0.70430183",
"0.7011258",
"0.69781375",
"0.69501245",
"0.69290847",
"0.6909401",
"0.6887918",
"0.6881601",
"0.68653244",
"0.6827264",
"0.6823465",
"0.6819645",
"0.67983854",
"0.6781568",
"0.67548364",
"0.6727882",
"0.6727882",
"0.6695164",
"0.66814095",
"0.6675533",
"0.66487366",
"0.66459197",
"0.66374046",
"0.6627479",
"0.66252625",
"0.66250896",
"0.6606148",
"0.65996736",
"0.6598026",
"0.65977603",
"0.65960765",
"0.65960765",
"0.65960765",
"0.6584124",
"0.65622026",
"0.6561765",
"0.6558956",
"0.6558035",
"0.65539014",
"0.6553336",
"0.6535753",
"0.6529144",
"0.65259",
"0.65249133",
"0.6520915",
"0.6482374",
"0.6474434",
"0.6474434",
"0.6462481",
"0.6445948",
"0.6440784",
"0.6440334",
"0.64350533",
"0.6425698",
"0.6413622",
"0.64129055",
"0.64067805",
"0.63986826",
"0.6397939",
"0.6391036",
"0.6386818",
"0.6379154",
"0.63770354",
"0.6373209",
"0.6368896",
"0.63682616",
"0.63682616",
"0.6367734",
"0.6366637",
"0.6361302",
"0.636022",
"0.6358093",
"0.6349718",
"0.63462204",
"0.63434964",
"0.63360196",
"0.63254964",
"0.63237524",
"0.63228583",
"0.63185716",
"0.6314644",
"0.63050765",
"0.63034433",
"0.6291317",
"0.62852913",
"0.62852913",
"0.6279968",
"0.62755674",
"0.62651706",
"0.62550807",
"0.6252508",
"0.6248629",
"0.6248104",
"0.6243554"
] | 0.0 | -1 |
Take off the size, e.g. for Traveler | def transformed_sku(sku)
sku.sub(/-(s|l)$/i, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size!\n @size = nil\n self.size\n end",
"def size\n super\n end",
"def size\n super\n end",
"def set_size!(size) \n @transforms << SIZES[size]\n self \n end",
"def interpret_size(size); end",
"def size=(size)\n end",
"def default_tire_size\n raise NotImplementedError, \"This #{self.class} cannot respond to:\"\n end",
"def remove_size(size)\n @size.delete(size)\n end",
"def decSize\n if @size > 2\n call erase\n let @size = @size - 2\n call draw\n end\n end",
"def resize\n # TODO\n # if aray is 75% full, double the array and copy all items over\n end",
"def size\n\t\t7500\n\tend",
"def shrink_ship\n @length -= 1\n end",
"def lift\r\n show_blank(size)\r\n @contents.pop\r\n end",
"def settings\n size 400, 300\nend",
"def reduce_max_size\n @max_size /= 2\n end",
"def large\n @chart_size = 'large'\n self\n end",
"def initialize\n @size = 0\n clear\n end",
"def size=(dimension); end",
"def small\n @request[:size] = 'small'\n self\n end",
"def initialize(args={})\n @size = args[:size] # <- promoted from RoadBike\n end",
"def size= length\n #This is a stub, used for indexing\n end",
"def add_size!\n input_html_options[:size] ||= nil\n end",
"def size\n @sizes ||= strip(:size)\n end",
"def initialize(size)\n @size = size\n end",
"def water\n @size += 1\n end",
"def size; '' end",
"def my_size\n 1\n end",
"def resize!\n end",
"def fit_width; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size=(_); end",
"def size=(_); end",
"def setarrowsize(*)\n super\n end",
"def initialize \n\t\tsuper(SIZE)\n\tend",
"def adjust_overhead\n false\n end",
"def normalize_size_to(integer)\n until size >= integer\n unshift 0\n end\n self\n end",
"def incSize\n if ((@y + @size) < 254) & ((@x + @size) < 510)\n call erase\n let @size = @size + 2\n call draw\n end\n end",
"def with_round_off_size (size, &block)\n Thread.current[:gb_round_of_size] = size\n yield block\n ensure\n Thread.current[:gb_round_of_size] = nil\n end",
"def default_tire_size\n '23'\n end",
"def size\n 4\n end",
"def max_size=(_arg0); end",
"def set_playground_size(size)\n @playground.size = size\n end",
"def size size = nil\n @size = size.to_i if size\n @size\n end",
"def setSize _obj, _args\n \"_obj setSize _args;\" \n end",
"def size=(size)\n self.width = self.height = @size = size\n end",
"def size=(size)\n @size = size\n resize\n end",
"def piece_size=(v)\n return unless v\n @piece_count = nil\n @piece_size = [v, 1024].max\n end",
"def size; @size end",
"def size=(size)\n dif = size - @size\n dif < 0 ? @weights.pop(-dif) : @weights.push(Array.new(dif, 0)).flatten!\n dif < 0 ? @inputs.pop(-dif) : @inputs.push(Array.new(dif, 0)).flatten!\n @size = size\n end",
"def small\n @chart_size = 'small'\n self\n end",
"def size\r\n\t\t@size\r\n\t\t#el tamaño\r\n\tend",
"def check_for_resize; end",
"def size\nend",
"def width=(_); end",
"def width=(_); end",
"def size\n @size \n end",
"def size\n @size \n end",
"def size(x, y=nil)\n settings.size = [x, y || x]\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def default_tire_size\n '2.1'\n end",
"def default_size\n @total_memory ? @total_memory * @weighting : nil\n end",
"def size(new_size = nil)\n new_size.nil? ? @size : @size = new_size\n end",
"def resize(size)\n @size = size\n new_slots = Array.new(@size).map { 0 }\n new_slots.each_with_index do |slot, i|\n new_slots[i] = @slots[i]\n end\n @slots = new_slots\n end",
"def request_size\n super || 0\n end",
"def size= (x)\n change_options({\"size\" => x})\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size(*) end",
"def size(*) end",
"def on_size_exceeded\n tracer.trace('operation.parent') do\n # Fill the trace over the capacity of the context\n max_size.times do |i|\n tracer.trace('operation.sibling') do |span|\n yield(span) if i + 1 == max_size\n end\n end\n end\n end",
"def size(size)\n @value[:size] = size\n self\n end",
"def size\n\t\t#puts \"size of #{name}: #{super()}\"\n\t\t103\n\tend",
"def size=(value)\n @size = value\n end",
"def size=(value)\n @size = value\n end"
] | [
"0.6649727",
"0.6579533",
"0.6579533",
"0.6571167",
"0.6456822",
"0.6342154",
"0.6277296",
"0.62623686",
"0.6230446",
"0.6225058",
"0.6204238",
"0.61581993",
"0.61367416",
"0.61076915",
"0.6063664",
"0.6013116",
"0.6007533",
"0.60046715",
"0.5989419",
"0.5986845",
"0.59850115",
"0.5981673",
"0.5978413",
"0.59756577",
"0.5974669",
"0.5966035",
"0.5952432",
"0.59490263",
"0.59386146",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5931281",
"0.5927747",
"0.5927747",
"0.59225076",
"0.5919791",
"0.5910565",
"0.5908821",
"0.59027946",
"0.58926123",
"0.5886313",
"0.585364",
"0.5849543",
"0.5846716",
"0.58343595",
"0.5828376",
"0.5818979",
"0.58105606",
"0.58082384",
"0.5800488",
"0.5795651",
"0.57896453",
"0.578316",
"0.57818615",
"0.57599944",
"0.57583874",
"0.57583874",
"0.5755334",
"0.5755334",
"0.575366",
"0.5746894",
"0.5746894",
"0.5746894",
"0.5746894",
"0.5746894",
"0.5746894",
"0.5746894",
"0.5740749",
"0.57375294",
"0.5735369",
"0.5728022",
"0.5718312",
"0.5708832",
"0.57061905",
"0.57061905",
"0.57061905",
"0.57058334",
"0.57058334",
"0.5704454",
"0.56913483",
"0.568246",
"0.56768423",
"0.56768423"
] | 0.0 | -1 |
def capturemail(ville_entree)capture l'adresse email de la commune d'Avernes url=" doc = Nokogiri::HTML(open(url)) adresse = doc.css(".txtprimary")[3].text.split(" ")[2] puts adresse end capturemail | def captureurlmail #capture url des villes du 95
url2 = "http://www.annuaire-des-mairies.com/val-d-oise.html"
doc2 = Nokogiri::HTML(open(url2))
adresse2 = doc2.css('.lientxt')
noms = []
villes = []
emails = []
adresse2.each do |link|
#noms.push(url2 + (link['href'][1..-1]))
p="http://www.annuaire-des-mairies.com"
#puts link['href'][1..-1]
p+=link['href'][1..-1]
noms << p
q=link['href'][1..-1]
r=q.split('/')
s=r[2]
t=s.split('.')
ville=t[0]
villes << ville
end
noms.each do |adresse|
doc3 = Nokogiri::HTML(open(adresse))
adresse3 = doc3.css(".txt-primary")[3].text.split(" ")[2]
if ['@'].include?(adresse3) == true
emails << adresse3.to_s
else
emails << nil
end
end
Hash[villes.zip(emails)].each do |ville,email|
puts ville+" => "+email
#my_hash=Hash[villes.zip(emails)]
#return my_hash(ville_entree)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_townhall_email\n\tcity_95 = Nokogiri::HTML(open(\"https://www.annuaire-des-mairies.com/95/avernes.html\"))\n\tp city_95.css(\"/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]\").text\n#trouve l’adresse mail de la ville avernes:\n#clic droit sur le mail puis inspecter\n#puis dans l’inspecteur, click droit : copy Xpath\nend",
"def get_the_email_of_a_townhal_from_its_webpage(page , lien, n_ville)\n\tv_lien = \"\"\n\tpage.css('a[class = lientxt]').each{|y| v_lien = lien.slice(0..30) + y['href'].slice(1..(y['href'].to_s.length)) if y.text == n_ville}\n\tpage_2 = Nokogiri::HTML(open(v_lien))\n \tpage_2.css('td')[7].text\nend",
"def get_the_email_of_a_townhal_from_its_webpage\n emails = \"\"\n tab_url = Nokogiri::HTML(open('http://annuaire-des-mairies.com/95/vaureal.html'))\n tab_url.each do |url_commune|\n pages = Nokogiri::HTML(open(url_commune))\n email = pages.css(\".txt-primary\")[3].text.split(\" \")\n email = email[2]\n emails += email\n end\n return emails\nend",
"def get_email(x)\n lien = x.css('td[1]/a/@href').text\n page = Nokogiri::HTML(URI.open(\"http://www2.assemblee-nationale.fr#{lien}\"))\n email = page.css('.deputes-liste-attributs > dd:nth-child(8) > ul:nth-child(1) > li:nth-child(2) > a:nth-child(1)').text\nend",
"def get_the_email_of_a_townhal_from_its_webpage(page_url)\n doc = Nokogiri::HTML(open(page_url)) # Acceder à la page\n email = doc.css(\".tr-last\")[3].text.split(\" \")[2] # Scraping des données\n email\nend",
"def getemail (adresse)\n\tpage = Nokogiri::HTML(open(adresse))\n\treturn page.css('td.style27 p.Style22 font')[6].text\nend",
"def get_the_email_of_a_townhal_from_its_webpage\ndoc = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/95/vaureal.html\"))\n\temail = doc.xpath('/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]')\n\tputs email\nend",
"def get_the_email_of_a_townhal_from_its_webpage\n regexcontact = /[\\w.-]+@[\\w-]+\\.\\w*/\n page = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/95/cergy.html\"))\n page.xpath('//tr/td/p').each do |node|\n result = node.text\n mails = result.match regexcontact \n if result.match regexcontact\n puts mails\n else nil \n end\n end \nend",
"def get_the_email_of_a_townhall_from_its_webpage(mailcheck) #def de la methode\ndoc = Nokogiri::HTML(open(mailcheck))\ndoc.xpath('//p[@class=\"Style22\"]').each do |email| #ciblé l'email dans la class et appliquer un each do\n if email.text.include? \"@\" #si l'email contient un @, ecrire email\n email.text\n puts email.text\n end\n end\nend",
"def get_the_email_of_a_townhal_from_its_webpage(lien)\n doc = Nokogiri::HTML(open(\"#{lien}\"))\n email = doc.css('html body tr[4] td.style27 p.Style22 font')[1]\nend",
"def get_the_email_of_a_townhal_from_all_webpage\n emails = []\n url_commune = get_all_the_urls_of_val_doise_townhalls(\"http://annuaire-des-mairies.com/val-d-oise.html\")\n url_commune.each do |url|\n pages = Nokogiri::HTML(open(url))\n email = pages.css(\".txt-primary\")[3].text.split(\" \")\n email = email[2]\n emails << email\n end\n return emails\nend",
"def get_townhall_email(url_mairie)\n page = Nokogiri::HTML(open(url_mairie))\n emplacement_email = '/html[1]/body[1]/div[1]/main[1]/section[2]/div[1]/table[1]/tbody[1]/tr[4]/td[2]' \n return page.xpath(emplacement_email).text\nend",
"def get_the_email_of_a_townhal_from_its_webpage(url_page)\n doc = Nokogiri::HTML(open(url_page))\n email = doc.css(\".txt-primary\")[3].text.split(\" \")\n email[2]\nend",
"def get_email(deputy_page_url)\n email = ''\n\n page = Nokogiri::HTML(open(deputy_page_url))\n\n page.css('a[@href ^=\"mailto:\"]').each do |element|\n email << element.text\n break\n end\n\n email\nend",
"def open_link\n\n scrapped = []\n\n mail = []\n\n landing_page = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n\n links = []\n landing_page.css('a[class = lientxt]').each do |link|\n\tlink_end = link[\"href\"].sub!(\".\",\"http://annuaire-des-mairies.com\")\n\tlinks << link_end\n end\n\n\nlinks.each do |ville|\n page = Nokogiri::HTML(open(\"#{ville}\"))\n\n error = [] # on doit vider le tableau à chaque boucle\n text_array = page.css('td[class = style27]').text.split\n\n text_array.each do |element|\n adress = element if element.include?(\"@\")\n mail << adress\n scrapped << adress\n error << adress # dqsdsqd\n end\n\n if error.size == 0 # rezrezrez\n scrapped << \"Unavailable\" # fdscsdd\n end\n puts scrapped\n\nend\nend",
"def get_the_email_of_a_townhal_from_its_webpage(url)\n doc = Nokogiri::HTML(open(url))\n email_adress = ''\n\t doc.xpath('/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]').each do |node|\n \t return node.text\n \tend\nend",
"def get_the_email_of_a_townhal_from_its_webpage(url)\n doc = Nokogiri::HTML(URI.open(url))\n email_adress = ''\n\t doc.xpath('/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]').each do |node|\n \t return node.text\n \tend\nend",
"def get_townhall_email(url)\n #gestion des cas où les urls ne seraient pas valides => on envoie N/A\n begin\n page = Nokogiri::HTML(open(url))\n email = page.xpath('//html[1]/body[1]/div[1]/main[1]/section[2]/div[1]/table[1]/tbody[1]/tr[4]/td[2]').text\n if email == \"\"\n email = \"non renseigné\"\n end \n rescue => e\n email = \"N/A\"\n end \n return email \nend",
"def get_townhall_email\r\n @citys_list.each do |city|\r\n city_page = Nokogiri::HTML(URI.open(\"http://annuaire-des-mairies.com/95/#{city}.html\"))\r\n email = city_page.css('td')[7].text\r\n @citys_mail << email\r\n end\r\nend",
"def get_all_the_urls_of_val_doise_townhalls (web_list)\npage = Nokogiri::HTML(RestClient.get(web_list))#recupere le code html du site\npage.css(\"a.lientxt\").each do |note|\nnote['href'] = note['href'][1..-1]#donne les urls de chaque commune en retirant le premier caractaire c-a-d \".\"\nweb_page = \"http://annuaire-des-mairies.com\" + note['href']\nputs web_page\nget_the_email_of_a_townhal_from_its_webpage(web_page)#rappel la fonction get_the_email_of_a_townhal_from_its_webpage pour recuperer les adresses emails grace aux liens (fonctions recurssive)\nend\nend",
"def get_the_email_of_a_townhal_from_its_webpage(page_url)\n doc = Nokogiri::HTML(open(page_url))\n email = doc.css(\".tr-last\")[3].text.split(\" \")[2]\n email\nend",
"def get_mail(get_url)\n page = open(get_url).read\n nokogiri_object = Nokogiri::HTML(page)\n mail_depute = nokogiri_object.xpath(\"//*[@id='b1']/ul[2]/li[1]/ul/li[1]/a\")\n return mail_depute.text\nend",
"def get_the_email_of_a_townhal_from_its_webpage(url)\n\t page = Nokogiri::HTML(open(url))\n\t page.xpath('//body/div/main/section[2]/div/table/tbody/tr[4]/td[2]').text\n\t end",
"def get_townhall_email(townhall_url)\n # Retourne l’e-mail d'une mairie à partir de l'URL de la page particulière de cette mairie, si cet e-mail a pu être trouvé,\n # renvoie nil sinon\n townhall_email = nil\n page = PageOfHtmlDocument.new(townhall_url).page # Ouvre et parse la page HTML dont on donne l'URL et la stocke dans la variable locale page\n if !page.nil? && page.instance_of?(Nokogiri::HTML::Document)\n #title = page.xpath('/html/head/title').text\n #puts \"Je vais scrapper la page intitulée \\\"#{title}\\\" (\\\"#{townhall_url}\\\").\"\n townhall_email = page.xpath(\"/html/body/div[1]/main/section[2]/div/table/tbody/tr[4]/td[2]\").text\n end\n townhall_email\n end",
"def get_townhall_email(townhall_url)\n Nokogiri::HTML(URI.open(\"#{townhall_url}\")).xpath('//html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]').each do |email|\n return email.text\n\nend\nend",
"def get_townhall_email(townhall_url)\n\tpage = Nokogiri::HTML(open(townhall_url)) \n\temail_array = []\n\n\temail = page.xpath('//*[contains(text(), \"@\")]').text\n town = page.xpath('//*[contains(text(), \"Adresse mairie de\")]').text.split \n# On divise la string pour pouvoir récupérer uniquement le nom de la ville\n\n email_array << {town[3] => email} \n# On indique la position du nom de la ville dans la string pour la récupérer\n\tputs email_array\n\treturn email_array\nend",
"def get_the_email_of_a_townhal_from_its_webpage(x)\n doc = Nokogiri::HTML(open(x))\n doc.css('.tr-last')[3].text.split(\" \")[2]\nend",
"def get_the_email_of_a_townhal_from_its_webpage(page_url)\n email = ''\n\n element_xpath = '/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]'\n\n page = Nokogiri::HTML(open(page_url))\n page.xpath(element_xpath).each do |node|\n email = node.text\n end\n\n email\nend",
"def get_townhall_email(html)\n mail = []\n get_townhall_urls(html).map do |url|\n mail << Nokogiri::HTML(URI.open(url)).search(\"/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]\").text\n end \n return mail\n end",
"def get_townhall_email(url)\n doc = Nokogiri::HTML(URI.open(url))\n email = doc.xpath('/html/body/div[1]/main/section[2]/div/table/tbody/tr[4]/td[2]').text\n return email\nend",
"def get_deputy_email(deputy_url)\n doc = Nokogiri::HTML(URI.open(deputy_url))\n deputy_email = doc.xpath('//*[@id=\"b1\"]/ul[2]/li[1]/ul/li[1]/a').text # attention certains ont deux mails li[1]/a ou li[2]/a\n return deputy_email\nend",
"def get_townhall_email\n array1 = []\n get_townhall_urls.each do |i|\n url = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/#{i}\"))\n n = url.xpath('/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]')\n array1 << n.text.to_s\n end\n return array1\nend",
"def emails_from_webpage (townhall_URL)\n\tpage = Nokogiri::HTML(open(townhall_URL)) # We get the city name unsing element inspector\n\tname_town = page.xpath(\"/html/body/div[1]/main/section[1]/div/div/div/h1\").text # We get the email using element inspector\n\tmail_adress = page.xpath(\"/html/body/div[1]/main/section[2]/div/table/tbody/tr[4]/td[2]\").text\n\treturn name_town, mail_adress\nend",
"def get_all_the_urls_of_val_doise_townhalls\n\n\tdoc = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n\tdoc.xpath('//a[@class = \"lientxt\"]').each do |link|\n\t puts @mairie_url = link['href']\n\n\t get_the_email_of_a_townhal_from_its_webpage \n\tend\nend",
"def get_townhall_email(townhall_url)\n\n page = Nokogiri::HTML(URI.open(townhall_url)) \n email = page.xpath('//html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]/text()')\n return email\n\nend",
"def get_the_email_of_a_townhal_from_its_webpage(url)\n doc = Nokogiri::HTML(open(url))\n doc.xpath('/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]').each do |element| return element.text end\n end",
"def get_townhall_email\n oui = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/83/toulon.html\"))\n email = oui.xpath ('//*[contains(text(), \"@\")]')\n email_array = []\n email.each do |index_email|\n email_array << index_email.text\n end\n puts email_array\nend",
"def get_email (ville_names)\n\n # Loop on each cities in the array to get the email\n for n in 0...ville_names.length\n\n # get each link to the depute\n page_url_ville = \"https://www.annuaire-des-mairies.com/95/#{ville_names[n]}.html\"\n\n ville_page = Nokogiri::HTML(open(page_url_ville))\n\n # If any bug when trying to get any email\n begin\n\n # Put each email in an array \"ville_email_array\"\n @ville_email_array << ville_page.xpath(\"//html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]/text()\").to_s\n rescue => e\n\n @ville_email_array << \" \"\n end\n end\n\n # This value as to be returned.\n # If not this not show email in the json file for the function save_as_json\n return @ville_email_array\n end",
"def mairie (lien_mairie)\n mairie = Nokogiri::HTML(open(lien_mairie))\n mairie_h1 = mairie.css(\"div[1]/main/section[1]/div/div/div/h1\").text.split(\" - \") #On cherche le H1 et on split pour séparer le nom et le Zip Code\n mairie_name = mairie_h1[0]\n mairie_postal_code = mairie_h1[1]\n mairie_email = mairie.css(\"div[1]/main/section[2]/div/table/tbody/tr[4]/td[2]\").text\n h = Hash[:name => mairie_name,:zip_code => mairie_postal_code, :email => mairie_email, :source => lien_mairie]\n return h\nend",
"def town_mail\n\turl_array = get_townhall_urls \n\t url_array.each do |townhall_url| #/ pour chaque URL d'une ville du Val d'Oise, on associe l'adresse mail de la mairie\n\tget_townhall_email(townhall_url)\n\tend\nend",
"def get_the_email_html(ville)\n\treturn \"Bonjour,\nJe m'appelle Adrien, je suis élève à une formation de code gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau. La formation s'appelle The Hacking Project (http://thehackingproject.org/). Nous apprenons l'informatique via la méthode du peer-learning : nous faisons des projets concrets qui nous sont assignés tous les jours, sur lesquel nous planchons en petites équipes autonomes. Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite.\n\nNous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à #{ville}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes, ou confirmées. Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves), donc nous serions ravis de travailler avec #{ville} !\n\nCharles, co-fondateur de The Hacking Project pourra répondre à toutes vos questions : 06.95.46.60.80\"\nend",
"def get_townhall_email(townhall_url)\n townhall_emails = []\n liens_villes = get_link\n for lien in townhall_url do \n townhall_emails << Nokogiri::HTML(open(lien)).xpath('/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]').text \n end\n return townhall_emails\n end",
"def get_email(dpt, url)\n mairies = []\n tab_link = get_all_the_urls_of_mairie(url)# appel de la methode pour les urls\n i = 0\n tab_link.each do \n |link|\n mairie = Nokogiri::HTML(open(link)).css('main h1')[0].text.split(\" \")[0] # On scrap le nom\n # On push le tout dans mairies\n mairies.push({\n :name => mairie,\n :email => get_the_email_of_a_townhal_from_its_webpage(link),\n :departement => dpt\n })\n \n puts mairies\n end\n puts \"#################################################################################################\"\n puts \" RESULTAT\"\n puts \"#################################################################################################\"\n mairies\nend",
"def get_townhall_email(townhall_url)\r\n page = get_page(townhall_url)\r\n email = page.xpath('//*[contains(text(), \"@\")]').text\r\n town_name = page.xpath('//*[contains(text(), \"Adresse mairie de\")]').text.split #nom de ville\r\n email_array_one_hash = [{town_name[3] => email}] #nom\r\n return email_array_one_hash\r\nend",
"def get_depute_infos(url)\n doc = Nokogiri::HTML(open(url))\n\n email = doc.xpath('/html/body/div/div[3]/div/div/div/section[1]/div/article/div[3]/div/dl/dd[4]/ul/li[2]/a').text\n full_name = doc.xpath('/html/body/div/div[3]/div/div/div/section[1]/div/article/div[2]/h1').text.split(\" \")\n first_name = full_name[1]\n last_name = full_name[2..-1].join(\" \") \n\n return {\n \"first_name\" => first_name,\n \"last_name\" => last_name,\n \"email\" => email\n }\nend",
"def scrap\n\t\tdef get_townhall_email(townhall_url)\n\t\t\tpage = Nokogiri::HTML(open(townhall_url))\n\t\t\temail = page.xpath('/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]').text\n\n\t\t\tif email.size < 1\n\t\t\t\temail = \"nill\"\n\t\t\tend\n\t\t\treturn email\n\t\tend\n\n\t\tdef get_townhall_urls\n\t\t\ti = 0\n\t\t\tpage = Nokogiri::HTML(open('http://annuaire-des-mairies.com/val-d-oise.html'))\n\t\t\tarray_ville = []\n\t\t\tarray_mail = []\n\t\t\thachier = {}\n\t\t\tarray = []\n\t\t\tville = page.xpath('//a[@class=\"lientxt\"]')\n\n\t\t\tville.each do |a|\n\t\t \tarray_ville[i] = a['href'][1..-1]\n\t\t \tarray_mail = get_townhall_email(\"http://annuaire-des-mairies.com#{array_ville[i].downcase}\")\n\t\t \thachier = {}\n\t\t \thachier[a.text] = array_mail\n\t\t \tarray[i] = hachier\n\t\t \ti = i + 1\n\t\t \tputs hachier\n\t\t end\n\t\t return array\n\t\tend\n\t\treturn get_townhall_urls\n\tend",
"def perform(url)\n doc = Nokogiri::HTML(open(url))\n hash = {}\n doc.xpath('//p/a').each do |node|\n html = node[\"href\"]\n html = \"http://annuaire-des-mairies.com\" + html[1..-1]\n hash[node.text]=get_the_email_of_a_townhal_from_its_webpage(html)\n end\n return hash\nend",
"def route_de_la_mairie\n page = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\")) \n puts \"nata\"\n #page.xpath('/html/body/table/tbody/tr[3]/td/table/tbody/tr/td[2]/p[2]/object/table/tbody/tr[2]/td/table/tbody/tr/td[2]/p/a').each do |link|\n page.css('html body table tbody tr td table tbody tr td p object#voyance-par-telephone table tbody tr td table.Style20 tbody tr td p a.lientxt').each do |link|\n #page.css('html body table tbody').css('tr')[2].css('td table tbody tr').css('td')[1].css('p')[1].css('object table tbody').css('tr')[1].css('td table tbody tr').css('td')[2].css('p a').each do |link| \n puts link['href']\n puts link.text\n end\nend",
"def get_the_email_html(nline)\n\trecipient = @ws[nline, 1].to_s\n\t$mailsubject = \"A l'attention de la mairie de #{recipient}\"\n\t$html_content = \"<p> <b> A l'attention de la mairie de #{recipient} </b> </p>\n<p>Bonjour, </p>\n<p>Je m'appelle Thomas, je suis élève à une formation de code gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau. La formation s'appelle The Hacking Project (http://thehackingproject.org/). Nous apprenons l'informatique via la méthode du peer-learning : nous faisons des projets concrets qui nous sont assignés tous les jours, sur lesquel nous planchons en petites équipes autonomes. Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite.\nNous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à #{recipient}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes, ou confirmées. Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves), donc nous serions ravis de travailler avec #{recipient} ! </p>\n<p> Yann, Moussaillon de The Hacking Project</p>\" \n\nend",
"def scrape_addresses (links)\n\temails = []\n\tlinks.each do |url|\n\tpage_url = \"http://annuaire-des-mairies.com/#{url}\"\n\tpage = Nokogiri::HTML(URI.open(page_url))\n\temails << page.xpath('/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]').text\n\tend\n\treturn emails\nend",
"def get_townhall_email(townhall_url)\n doc = Nokogiri::HTML(open(townhall_url))\n doc.css('tbody').css('tr')[3].css('td')[1].to_s.match(/>(.*)</).to_s.delete('><')\n end",
"def get_the_deputy_contact(url)\n doc = Nokogiri::HTML(URI.open(url))\n hash = {}\n\n doc.xpath('//*[@id=\"deputes-list\"]//li/a').each do |node|\n html = \"http://www2.assemblee-nationale.fr\" + node[\"href\"] \n hash[node.text]=get_the_deputy_email(html)\n end\n puts hash\nend",
"def getwebsite()\n\tpage = Nokogiri::HTML(open(\"https://annuaire-des-mairies.com/val-d-oise.html\"))\n\tsession = GoogleDrive::Session.from_config(\"config.json\")\n\tws = session.spreadsheet_by_key(\"1v7XEnpGDtgjgRom3bp7OwzaK99zlUQIfKuW3QdawXBc\").worksheets[0]\n\tcities = \"\"\n\ti = 1\n\t#define a loop for list of emails\n\tpage.css('a.lientxt').each do |town|\n\t\tsite = \"https://annuaire-des-mairies.com\" + town['href'][1..-1]\n\t\tcities = town.text\n\t\tws[(i), 1] = cities\n\t\tws[(i), 2] = getemail(site)\n\t\ti += 1\n\tend\n\tws.save\nend",
"def get_the_email_html(name_city)\n \"<p>Bonjour,<br><br> Je m'appelle Nicolas, je suis élève à une formation de code gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau. La formation s'appelle <strong>The Hacking Project</strong> (http://thehackingproject.org/).<br> Nous apprenons l'informatique via la méthode du peer-learning : nous faisons des projets concrets qui nous sont assignés tous les jours, sur lesquel nous planchons en petites équipes autonomes. Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite.<br> Nous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à #{name_city}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes ou confirmées. Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves) donc nous serions ravis de travailler avec #{name_city} !<br><br> Charles, co-fondateur de The Hacking Project pourra répondre à toutes vos questions : 06.95.46.60.80<br><br> Bien à vous<br><br> Nicolas</p>\"\nend",
"def get_townhall_email(townhall_url)\n page = Nokogiri::HTML(URI.open(townhall_url))\n return page.xpath('//tbody/tr[4]/td[2]').slice(0).text\nend",
"def get_url\n page = Nokogiri::HTML(open(\"http://www2.assemblee-nationale.fr/deputes/liste/alphabetique\"))\n url_deputy = page.css(\"ul.col3 a\")\nend",
"def get_townhall_email(townhall_url)\r\n\tpage = Nokogiri::HTML(URI.open(townhall_url)) # on indique une variable renvoyant aux URLs qui sera utilisée dans la méthode finale\r\n\temail_array = []\r\n\r\n\temail = page.xpath('//*[contains(text(), \"@\")]').text\r\n\temail_array << email\r\n\t\r\n p email_array.join(',') # https://stackoverflow.com/questions/15784503/ruby-method-to-print-and-neat-an-array\r\n\treturn email_array\r\nend",
"def scrap_data\n\turl_array = get_townhall_urls \n url_array.each do |townhall_url| \n# -> Pour chaque URL d'une ville du Val d'Oise, on associe l'adresse mail de la mairie\n\t\tget_townhall_email(townhall_url)\n\tend\nend",
"def get_deputes_email (deputes_names)\n\n deputes_email_array = []\n\n for n in 0...10\n\n # get each link to the depute\n page_url_deputes = \"http://www2.assemblee-nationale.fr/#{deputes_names[n]}\"\n\n # Connect to the page\n depute_page = Nokogiri::HTML(open(page_url_deputes))\n\n # If bug\n begin\n\n # Put each email in an array \"ville_email_array\"\n deputes_email_array << depute_page.xpath(\"//*[contains(@class, 'deputes-liste-attributs')]/dd[4]/ul/li[2]/a/text()\").to_s\n rescue => e\n\n deputes_email_array << \" \"\n end\n end\n\n # return the array of deputes emails\n return deputes_email_array\nend",
"def get_all_the_urls_of_val_doise_townhalls(url)\n doc = Nokogiri::HTML(URI.open(url))\n hash = {}\n doc.css('//p/a').each do |node|\n html = node[\"href\"]\n html = \"http://annuaire-des-mairies.com\" + html[1..-1] # => permet d'enlever le . devant le lien <a class=\"lientxt\" href=\"./95/ableiges.html\">ABLEIGES</a>\n hash[node.text]=get_the_email_of_a_townhal_from_its_webpage(html)\n end\n puts hash\nend",
"def get_nom(url)\n tab = []\n doc = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/\"))\n tab_lien = doc.css(\"a\").select{|link| link['class']==\"lientxt\"}\n tab_lien.each{|link| tab.push(link.text)}\n tab\n end",
"def recolte_monnaie\npage = Nokogiri::HTML(open(\"https://coinmarketcap.com/all/views/all/\")) \n#puts page.class # => Nokogiri::HTML::Document\n#téléchargement de l'ensemble des symboles\nmonnaie_temp = page.xpath('//*[@id]/td[3]')\n# conservation du texte\nmonnaie_final = monnaie_temp.map { |string| string.text }\nend",
"def get_townhall_urls\n h = {}\n page = 'http://annuaire-des-mairies.com'\n doc = Nokogiri::HTML(open(page + '/val-d-oise.html'))\n doc.xpath('//a[@class=\"lientxt\"]').each do |node|\n h[node.text.capitalize.to_sym] = get_townhall_email(page +\n node.xpath('@href').text.gsub!(/^\\./, '').to_s)\n end\n return h\n end",
"def get_city\n page = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n villes =[]\n page.xpath('//*[@class=\"lientxt\"]').each do |ville|\n villes << ville.text\n end\n return villes\n end",
"def get_the_name_of_val_doise_townhalls(url)\n page = Nokogiri::HTML(open(url))\n commune = []\n news_links = page.css(\"a\").select{|link| link['class'] == \"lientxt\"}\n news_links.each do |communes|\n commune << communes.text\n end\n return commune\nend",
"def get_townhall_mail(full_url, name, array_final)\n general_townhall = Nokogiri::HTML(open(full_url))\n townhall_mail = general_townhall.at('td:contains(\"@\")').text.strip\n array_final << {name => townhall_mail}\nend",
"def get_townhall_email(townhalls_urls_and_cities)\n\n return nil if townhalls_urls_and_cities.nil? || townhalls_urls_and_cities.empty?\n # return nil if list_townhall_urls.nil? || list_townhall_urls.empty? || list_cities.empty? || list_cities.nil?\n\n # Pour une meilleur compréhension\n list_townhall_urls = townhalls_urls_and_cities[0]\n list_cities = townhalls_urls_and_cities[1]\n\n\n #2/Liste des emails--------------------je fais une recherche sur tout... qui contient du text et @ (email ;o)! ) \n list_townhall_email=Array.new\n\n list_townhall_email = list_townhall_urls.each{ |url_hall|\n\n # Lecture d'une page html url_hall (de la ville) pour chaque mairie\n Nokogiri::HTML(URI.open(url_hall)).xpath('//*[contains(text(), \"@\")]').text\n }\n \n # -=-=-=- Init d'un Array (tableau de hash, conformément au format demandé) -=-=-=-\n # -=-=-=- MISE EN FORME -=-=-=-\n townhall_and_email_tab = Array.new\n\n # for i in 0..cities.length-1 do \n (0..list_cities.length-1).each do | i |\n townhall_and_email_tab[i] = Hash.new\n townhall_and_email_tab[i][list_cities[i]] = list_townhall_email[i]\n end\n \n return townhall_and_email_tab\nend",
"def get_address(tds)\n clean_whitespace(tds[2].at('div').inner_text)\nend",
"def get_address(tds)\n clean_whitespace(tds[2].at('div').inner_text)\nend",
"def val_doise_website\n page = Nokogiri::HTML(open('https://www.annuaire-des-mairies.com/val-d-oise.html'))\n return page\nend",
"def get_townhall_email(townhall_url)\n stream = URI.open(townhall_url)\n doc = Nokogiri::HTML(stream.read)\n a = doc.css('tbody tr')\n arr = a[3].text.split\n return arr[2]\n end",
"def get_name(url)\n page = open(url).read\n nokogiri_object = Nokogiri::HTML(page)\n name_depute = nokogiri_object.css(\"span.list_nom\")\n array = name_depute.to_a\n array.map! {|name| name.text.strip} #enleve les espaces avant & apres string\n return array[0..20] #ne montre que les 20 premiers elements\nend",
"def name_and_email_val_doise\n\tresult = []\n\tlist_url = urls_of_val_doise_townhalls # city pages urls\n\tlist_url.each { |town_url| name, mail = emails_from_webpage(town_url); result.push({:name => name.to_s, :email => mail}) } # name & email from each city\n\tputs result; # un tableau avec le nom et le mail des mairies\nend",
"def get_all_the_urls_of_val_doise_townhalls(url)\n page = Nokogiri::HTML(open(url))\n urls = []\n source = \"http://annuaire-des-mairies.com/\"\n news_links = page.css(\"a\").select{|link| link['class'] == \"lientxt\"}\n news_links.each do |link|\n lien = link['href']\n nv_link = lien.byteslice(2,lien.length)\n nv_link = source + nv_link\n urls << nv_link\n end\n return urls\nend",
"def get_url_cities_array(page)\r\n url_cities_array = []\r\n urls = page.xpath('//*[@class=\"lientxt\"]/@href') \r\n urls.each do |url|\r\n url_cities_array << (\"https://www.annuaire-des-mairies.com\" + url.text[1..-1]) # rajout à partir du deuxième caractère pour éviter d'ajouter le point \r\n print \".\" # affichage pour simuler le chargement\r\n end\r\n return url_cities_array\r\nend",
"def get_all_the_urls_of_val_doise_townhalls(page_url)\n doc = Nokogiri::HTML(open(page_url))\n urls = []\n#on recupere le css a[class=lientxt]\n get_urls = doc.css(\"a[class=lientxt]\")\n get_urls.each{|link| urls.push(\"http://annuaire-des-mairies.com\"+link['href'][1...link['href'].length])}\n urls\nend",
"def lien_pret\n\n\tlien_pret=get_townhall_urls(oise_town_urls,ville)\n\tmail_pret=[]\n\tmyash=Hash.new\n\tt=0\n\tfor i in lien_pret\n\t\t\n\t\tu = \"\"\n\t\tbegin\n\t\t\tu = get_townhall_email(i)\n\n\t\trescue => e\n\n\t\t\tputs \"il y a erreur\"\n\n\t\tend\n\n\t\tif u !=\"\"\n\t\t\tprint \"#{get_townhall_email(i)} \"\n\n\t\t\tmyash.store(nom_pret[t],u)\n\t\t\toptions = { :address => \"smtp.gmail.com\",\n\t\t\t\t:port => 587,\n\t\t\t\t:user_name => '',\n\t\t\t\t:password => '',\n\t\t\t\t:authentication => 'plain',\n\t\t\t\t:enable_starttls_auto => true }\n\n\t\t\t\tMail.defaults do\n\t\t\t\t\tdelivery_method :smtp, options\n\t\t\t\tend\n\n\t\t\t\tMail.deliver do\n\t\t\t\t\tto '#{get_townhall_email(i)} '\n\t\t\t\t\tfrom 'jose'\n\t\t\t\t\tsubject 'Test programmation ruby'\n\t\t\t\t\tbody \"Bonjour,\nJe m'appelle [PRÉNOM] et je permets de contacter la mairie de [CITY_NAME] à propos du remarquable travail que font Les Restos du Coeur. Cette association répand le bien dans la France et aide les plus démunis à s'en tirer.\n\nAvez-vous pensé à travailler avec eux ? Soutenir Les Restos du Coeur, c'est important pour notre cohésion sociale : rejoignez le mouvement !\n\nMerci à vous\"\n\t\t\t\tend\n\t\t\tend\n\t\t\tt=t+1\n\t #puts t\n\n\t\t#if t==10\n\t\t# \tbreak\n\t\t# end=end\n\t\t\n\tend\nend",
"def get_city_list\r\n url = \r\n page = Nokogiri::HTML(URI.open('http://annuaire-des-mairies.com/val-d-oise.html'))\r\n citys = page.css('a.lientxt[href]').each {|city| @citys_list << city.text.downcase.gsub(' ', '-')}\r\nend",
"def get_all_the_urls_of_manche\n#On créer deux tableau, 1 pour stocker les noms des maries, l'autre pour stocker les e-mails\n @town_names = []\n @town_emails = []\n urls = %w[http://www.annuaire-des-mairies.com/manche.html]\n\n urls.each do |url|\n doc = Nokogiri::HTML(open(url))\n \tdoc.css(\".lientxt\").each do |link|\n \t\turl = \"http://annuaire-des-mairies.com\" + link[\"href\"][1..-1].to_s\n \t\ttown_name = link.text\n \t\ttown_email = get_the_email_of_a_townhal_from_its_webpage(url)\n @town_names << town_name\n @town_emails << town_email\n end\n end\n\n urls = %w[http://www.annuaire-des-mairies.com/manche-2.html]\n\n urls.each do |url|\n doc = Nokogiri::HTML(open(url))\n \tdoc.css(\".lientxt\").each do |link|\n \t\turl = \"http://annuaire-des-mairies.com\" + link[\"href\"][1..-1].to_s\n \t\ttown_name = link.text\n \t\ttown_email = get_the_email_of_a_townhal_from_its_webpage(url)\n @town_names << town_name\n @town_emails << town_email\n end\n end\n\n urls = %w[http://www.annuaire-des-mairies.com/manche-3.html]\n\n urls.each do |url|\n doc = Nokogiri::HTML(open(url))\n \tdoc.css(\".lientxt\").each do |link|\n \t\turl = \"http://annuaire-des-mairies.com\" + link[\"href\"][1..-1].to_s\n \t\ttown_name = link.text\n \t\ttown_email = get_the_email_of_a_townhal_from_its_webpage(url)\n @town_names << town_name\n @town_emails << town_email\n end\n end\n envoie_mail #Cette méthode ce trouve dans townhalls_mailer.rb\n pro_twitter #Cette méthode ce trouve dans townhalls_follower.rb\n end",
"def send_email_text(cities)\n#text a return\n return\"<h2>Bonjour</h2>\n <p>Je m'appelle Charles Dacquay, je suis co-fondateur de lorganisme The Hacking Project qui propose une formation de dévelopeur web gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau.<br> Voici le lien de la formation s'appelle The Hacking Project (http://thehackingproject.org/).<br> la foramtion des baser sur la méthode du peer-learning : les étudiants sont répartie en petit groupes ou nous leur proposons la réaliation de projets concrets qui leur sont assignés chaque jours, sur lesquel ils travaillent et cherches des solution . Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite.</p>\n <p>Nous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à #{cities}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes, ou confirmées.<br> Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves), donc nous serions ravis de travailler avec #{cities} !</p>\n <p>Charles, co-fondateur de The Hacking Project pourra répondre à toutes vos questions : 06.95.46.60.80</p>\"\nend",
"def get_link\n page = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n faux_liens_villes =[]\n page.xpath('//*[@class=\"lientxt\"]').each do |lien|\n faux_liens_villes << lien.values[1]\n end\n liens_villes = faux_liens_villes.map{ |el| \"http://annuaire-des-mairies.com\" + el[1..-1]}\n return liens_villes\n end",
"def get_all_the_urls_of_val_doise_townhalls\n mairie_val_d_oise = Array.new\n page = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n links = page.css('a.lientxt')\n links.each do |mairie|\n mairie_val_d_oise << mairie['href']\n end\n return mairie_val_d_oise\nend",
"def debuty\n pages = Nokogiri::HTML(URI.open('http://www2.assemblee-nationale.fr/deputes/liste/tableau'))\n tmp = pages.css('//table/tbody/tr')\n debutyname = tmp[0..10].map { |x| { \"first_name\" => get_first(x), \"last_name\" => get_last(x), \"email\" => get_email(x) } }\nend",
"def page_valdoise\n main_page = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n return main_page\nend",
"def get_deputes_name\n\n deputes_name_array = []\n # Régister URL of the needed website\n page_url_deputes = \"http://www2.assemblee-nationale.fr/deputes/liste/alphabetique\"\n\n depute_page = Nokogiri::HTML(open(page_url_deputes))\n\n # From the website, get an array of the city name, convert it to string, put in downcase and replace \" \" to \"-\" if any space\n return deputes_name_array = depute_page.xpath(\"//*[contains(@id, 'deputes-list')]/div/ul/li/a/text()\").map {|x| x.to_s }\nend",
"def go\nputs \" Scrapping en cours, veuillez patienter...\"\n url_array = get_urls\n url_array.each do |get_url| #link chaque ville à son url\nget_email(get_url) #recherche l'adresse mail par rapport à l'adresse de la ville\nend\nend",
"def get_address(tds)\n return clean_whitespace(tds[2].at('span').inner_text + \", NSW\")\nend",
"def get_address(tds)\n return clean_whitespace(tds[2].at('span').inner_text + \", NSW\")\nend",
"def get_townhall_emails\n n = get_townhall_urls.count\n i = 0\n @emails = []\n while i <= 4\n doc = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com#{get_townhall_urls[i].to_s}\"))\n result = doc.xpath('//section[2]/div/table/tbody/tr[4]/td[2]').map do |node|\n @emails.push(node.text)\n end\n p @emails[i]\n i += 1\n end\n @result_scrap = Hash[@names_of_town.zip(@emails)]\n return @result_scrap\n end",
"def scraper(url2)\n dataUrl = Nokogiri::HTML(open(url2))\n linksUrl = dataUrl.css('div#leftContainer')\n \n linksUrl.each do |review|\n arr = []\n # name\n arr << review.css('span.fn').text.strip\n # neighborhood\n #arr << review.css('span.neighborhood').text.strip\n # street-address\n arr << review.css('div.h5').first.text.strip.split(\"Send\").first\n # street-address\n #arr << review.css('span.locality').text.strip\n # price rating\n arr << review.css('span.pricerange').text.strip\n # rating\n arr << review.css('span.value').text.strip\n #blurb\n arr << review.css('span#blurb').text.strip\n\n return arr\n end \nend",
"def get_all_the_urls_townhalls_cot_d_or\n doc = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/cote-d-or.html\"))\n doc2 = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/cote-d-or-2.html\"))\n doc3 = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/cote-d-or-3.html\"))\n doc4 = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/cote-d-or-4.html\"))\n urlend = []\n tabname = []\n doc.css('.lientxt').each do |i| tabname << i.content end\n doc.css('a.lientxt @href').each do |i| urlend << i.content end\n doc2.css('.lientxt').each do |i| tabname << i.content end\n doc2.css('a.lientxt @href').each do |i| urlend << i.content end\n doc3.css('.lientxt').each do |i| tabname << i.content end\n doc3.css('a.lientxt @href').each do |i| urlend << i.content end\n doc4.css('.lientxt').each do |i| tabname << i.content end\n doc4.css('a.lientxt @href').each do |i| urlend << i.content end\n i = 0\n while i < urlend.size\n begin\n urlend[i] = get_the_email_of_a_townhal_from_its_webpage(\"http://annuaire-des-mairies.com#{urlend[i]}\")\n i += 1\n rescue => exception\n p urlend[i] = (\"L'url de la mairie de #{tabname[i]} est indisponible\")\n i += 1\n ensure\n end\n end \n return myhash = Hash[tabname.zip(urlend)]\n end",
"def get_townhall_urls(url)\n urls_department = []\n \n doc = Nokogiri::HTML(open(url))\n \n # Extraire le texte et mettre ça dans un hash \n \n doc.xpath(\"//a[@class=\\\"lientxt\\\"]\").each do |node|\n urls_department << { name: node.text, url: \"http://annuaire-des-mairies.com\" + node[:href][1, node[:href].size - 1]}\n end\n urls_department\n end",
"def address_parts\n texts = @page.css('.claAngebot .claRight p').map(&:text)\n found_address = address_part(CITY_REGEXP, texts) || address_part(WEBSITE_REGEXP, texts) || ''\n found_address.split(\"\\n\").map { |line| clean_up_spaces(line) }\n end",
"def townhall_and_email(html)\n \n contact = get_townhall_city(html).zip(get_townhall_email(html)).map{ |x| [x].to_h}\n puts contact\n\n end",
"def get_townhall_urls(url)\n urls_department = []\n\n doc = Nokogiri::HTML(open(url))\n\n# Extraire le texte et mettre ça dans un hash \n\n doc.xpath(\"//a[@class=\\\"lientxt\\\"]\").each do |node|\n urls_department << { name: node.text, url: \"http://annuaire-des-mairies.com\" + node[:href][1, node[:href].size - 1]}\n end\n\n urls_department\nend",
"def send_one_email_to(name, mail)\n email = @gmail.compose do\n to mail\n subject \"Apprentissage entre pairs + gratuité + code = The Hacking Project\"\n html_part do\n content_type 'text/html; charset=UTF-8'\n body get_the_email_html(name) #TODO faire pour toutes les villes du tableau -> suppose de lire les colonnes du tableau dans une boucle (ajouter un délai)\n end\n end\nemail.deliver!\nend",
"def inn\n raw = @html.split('<strong>ИНН организации:</strong>')[1].split('<br>')[0]\n end",
"def get_all_the_urls_of_val_doise_townhalls(x)\n doc = Nokogiri::HTML(open(x))\n doc.css('.lientxt').each do |url|\n Tab_url.push(\"http://annuaire-des-mairies.com\" + (url[\"href\"][1..-1]))\n end\n Tab_url\nend",
"def perform\n urls = get_townhall_urls(\"https://annuaire-des-mairies.com/val-d-oise.html\")\n puts array = get_townhall_email_city_name(urls)\n #puts getHash(name_array, mail_array)\n end",
"def go\nputs \" Scrapping en cours, veuillez patienter...\"\n\turl_array = get_urls \n\turl_array.each do |get_url| #link chaque ville à son url\n get_email(get_url) #recherche l'adresse mail par rapport à l'adresse de la ville\nend\nend"
] | [
"0.8169125",
"0.7946845",
"0.7788663",
"0.77168167",
"0.77087414",
"0.7549809",
"0.74866503",
"0.7421064",
"0.7414073",
"0.74064136",
"0.72507405",
"0.7238277",
"0.721227",
"0.71670496",
"0.7142452",
"0.7127348",
"0.7117786",
"0.7041935",
"0.6966523",
"0.69531614",
"0.6852647",
"0.6830876",
"0.6822189",
"0.68216974",
"0.67869097",
"0.67822254",
"0.67226887",
"0.6692377",
"0.6683722",
"0.6680456",
"0.666571",
"0.66506624",
"0.6647972",
"0.66398066",
"0.66264975",
"0.6614839",
"0.656838",
"0.65180564",
"0.6417749",
"0.6407386",
"0.63980174",
"0.6385263",
"0.6376667",
"0.6368457",
"0.6325297",
"0.6295527",
"0.6286217",
"0.62506413",
"0.62113506",
"0.6206206",
"0.6194941",
"0.6175669",
"0.61597973",
"0.6147779",
"0.6112456",
"0.61080295",
"0.60835767",
"0.6061326",
"0.6060172",
"0.6044298",
"0.60438186",
"0.6018581",
"0.60113543",
"0.59770596",
"0.5955133",
"0.5943625",
"0.58887655",
"0.588576",
"0.588576",
"0.5857209",
"0.58346885",
"0.5804921",
"0.5776328",
"0.5771614",
"0.5755815",
"0.57440704",
"0.5737207",
"0.57321745",
"0.5720251",
"0.57076097",
"0.57049364",
"0.5693868",
"0.56877464",
"0.5679534",
"0.5661188",
"0.5657405",
"0.56557566",
"0.56557566",
"0.5633813",
"0.56332666",
"0.56311554",
"0.5627274",
"0.562484",
"0.56190246",
"0.56104237",
"0.5608609",
"0.55942357",
"0.5589117",
"0.5583139",
"0.5573496"
] | 0.78749436 | 2 |
handle 2 tensor math operations | def vector_op(vector, vector2, switch = false, safe = true, &block)
if get_rank(vector) < get_rank(vector2) # upgrade rank of A
duplicated = Array.new(vector2.size) {
vector
}
return vector_op(duplicated, vector2, switch, &block)
end
return yield(vector, vector2) unless vector.is_a?(Array)
vector.each_with_index.collect { |input, index|
next vector_op(input, vector2, switch, &block) if input.is_a?(Array) && get_rank(vector) > get_rank(vector2)
if safe && vector2.is_a?(Array)
next nil if vector2.size != 1 && index >= vector2.size
end
z = if vector2.is_a?(Array)
if index < vector2.size
vector2[index]
else
raise "incompatible tensor shapes used during op" if vector2.size != 1
vector2[0]
end
else
vector2
end
if input.is_a?(Array)
vector_op(input, z, switch, &block)
else
switch ? yield(z, input) : yield(input, z)
end
}.compact
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tensor_product_of_two_matrices(mat1, mat2)\n\n\tresult_rows = []\n\tmat1.values.each { |mat1_row| \n\t\tmat2.values.each { |mat2_row| \n\t\t\t\n\t\t\tresult_row = []\n\t\t\tmat1_row.each { |mat1_elem|\n\n\t\t\t\tmat2_row.each { |mat2_elem|\n\t\t\t\t\tcase [mat1_elem, mat2_elem]\n\t\t\t\t\tin [Term, Term]\n\t\t\t\t\t\tproduct = multiply_two_terms(mat1_elem, mat2_elem)\n\t\t\t\t\tin [Term, TermList]\n\t\t\t\t\t\tproduct = multiply_term_and_term_list(mat1_elem, mat2_elem)\n\t\t\t\t\tin [TermList, Term]\n\t\t\t\t\t\tproduct = multiply_term_and_term_list(mat2_elem, mat1_elem)\n\t\t\t\t\tin [TermList, TermList]\n\t\t\t\t\t\tproduct = multiply_term_list_and_term_list(mat1_elem, mat2_elem)\n\t\t\t\t\tin [Fraction, Term]\n\t\t\t\t\t\tproduct = multiply_fraction_and_term(mat1_elem, mat2_elem)\n\t\t\t\t\tin [Fraction, TermList]\n\t\t\t\t\t\tproduct = multiply_fraction_and_term_list(mat1_elem, mat2_elem)\n\t\t\t\t\tin [Term, Fraction]\n\t\t\t\t\t\tproduct = multiply_fraction_and_term(mat2_elem, mat1_elem)\n\t\t\t\t\tin [TermList, Fraction]\n\t\t\t\t\t\tproduct = multiply_fraction_and_term_list(mat2_elem, mat1_elem)\n\t\t\t\t\tin [Fraction, Fraction]\n\t\t\t\t\t\tproduct = multiply_fraction_and_fraction(mat1_elem, mat2_elem)\n\t\t\t\t\telse\n\t\t\t\t\t\tthrow_error(\"Matrix tensor products with matrices that don't contain only Terms, TermLists, and Fractions.\", mat1, []) # TODO: Add stack trace (make a global)\n\t\t\t\t\tend\n\n\t\t\t\t\tresult_row.append(product)\n\t\t\t\t}\n\t\t\t}\n\t\t\tresult_rows.append(result_row)\n\t\t}\n\t}\n\treturn Matrix.new(mat1.line, mat2.col, result_rows)\nend",
"def mathy(n1, n2, operation)\n answer = n1.send(operation, n2).round(4)\n return answer\nend",
"def compose(operation2)\n operation1 = self\n if operation1.target_length != operation2.base_length\n fail 'The base length of the second operation has to be the target length of the first operation'\n end\n\n operation = TextOperation.new; # the combined operation\n\n # for fast access\n ops1 = operation1.ops\n ops2 = operation2.ops\n\n # current index into ops1 respectively ops2\n i1 = 0\n i2 = 0\n\n # current ops\n op1 = ops1[i1]\n op2 = ops2[i2]\n\n loop do\n # Dispatch on the type of op1 and op2\n if op1.nil? && op2.nil?\n # end condition: both ops1 and ops2 have been processed\n break\n end\n\n if delete_op?(op1)\n operation.delete(op1)\n\n op1 = ops1[i1 += 1]\n next\n end\n\n if insert_op?(op2)\n operation.insert(op2)\n\n op2 = ops2[i2 += 1]\n next\n end\n\n if op1.nil?\n fail 'Cannot compose operations: first operation is too short.'\n end\n if op2.nil?\n fail 'Cannot compose operations: first operation is too long.'\n end\n\n if retain_op?(op1) && retain_op?(op2)\n if op1 > op2\n operation.retain(op2)\n op1 -= op2\n\n op2 = ops2[i2 += 1]\n elsif (op1 == op2)\n operation.retain(op1)\n\n op1 = ops1[i1 += 1]\n op2 = ops2[i2 += 1]\n else\n operation.retain(op1)\n op2 -= op1\n\n op1 = ops1[i1 += 1]\n end\n elsif insert_op?(op1) && delete_op?(op2)\n if op1.length > -op2\n op1 = op1.slice(-op2, op1.length)\n op2 = ops2[i2 += 1]\n elsif (op1.length == -op2)\n op1 = ops1[i1 += 1]\n op2 = ops2[i2 += 1]\n else\n op2 += op1.length\n op1 = ops1[i1 += 1]\n end\n elsif insert_op?(op1) && retain_op?(op2)\n if op1.length > op2\n operation.insert(op1.slice(0, op2))\n op1 = op1.slice(op2, op1.length - op2)\n op2 = ops2[i2 += 1]\n elsif (op1.length == op2)\n operation.insert(op1)\n op1 = ops1[i1 += 1]\n op2 = ops2[i2 += 1]\n else\n operation.insert(op1)\n op2 -= op1.length\n op1 = ops1[i1 += 1]\n end\n elsif retain_op?(op1) && delete_op?(op2)\n if op1 > -op2\n operation.delete(op2)\n op1 += op2\n op2 = ops2[i2 += 1]\n elsif (op1 == -op2)\n operation.delete(op2)\n op1 = ops1[i1 += 1]\n op2 = ops2[i2 += 1]\n else\n operation.delete(op1)\n op2 += op1\n op1 = ops1[i1 += 1]\n end\n else\n fail \"This shouldn't happen: op1: \" +\n JSON.stringify(op1) + ', op2: ' +\n JSON.stringify(op2)\n end\n end\n\n return operation\n end",
"def mat_add_or_subtract(mat1, mat2, operation='+')\n n = mat1.size\n result = n.times.map{ |x| [] }\n (0..n-1).each do |i|\n (0..n-1).each do |j|\n result[i] << (operation == '+' ? (mat1[i][j] + mat2[i][j]) : (mat1[i][j] - mat2[i][j]))\n end\n end\n result\nend",
"def eval_operation(node, env, stack_trace)\n\n\t# Evaluate both sides of operation (discard returned environment)\n\tleft, _ = eval_node_under(node.left, env, stack_trace)\n\tright, _ = eval_node_under(node.right, env, stack_trace)\n\n\tif left == nil or right == nil\n\t\treturn nil, env\n\tend\n\n\t# TODO: Add more operations.\n\tcase node.operator.value\n\twhen \"+\"\n\t\tcase [left, right]\n\t\tin [Term, Term]\n\t\t\treturn add_two_terms(left, right), env\n\t\tin [Term, TermList]\n\t\t\treturn add_term_and_term_list(left, right), env\n\t\tin [TermList, Term]\n\t\t\treturn add_term_and_term_list(left, right), env\n\t\tin [TermList, TermList]\n\t\t\treturn add_term_list_and_term_list(left, right), env\n\t\tin [Fraction, Term]\n\t\t\treturn add_fraction_and_term(left, right), env\n\t\tin [Term, Fraction]\n\t\t\treturn add_fraction_and_term(right, left), env\n\t\tin [Fraction, TermList]\n\t\t\treturn add_fraction_and_term_list(left, right), env\n\t\tin [TermList, Fraction]\n\t\t\treturn add_fraction_and_term_list(right, left), env\n\t\tin [Fraction, Fraction]\n\t\t\treturn add_fraction_and_fraction(left, right), env\t\n\t\tin [Matrix, Matrix]\n\t\t\treturn add_two_matrices(left, right), env\n\t\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented for left: #{left.type}, right: #{right.type}.\", node, stack_trace) \n\t\tend\n\twhen \"-\"\n\t\tputs \"inter l: #{__LINE__} -- IMPORTANT NOTE: Using a subtraction.\" # TODO: Does this ever get used now that I've inverted a - b to a + (-b)?\n\t\tcase [left, right]\n\t\tin [Term, Term]\n\t\t\treturn subtract_two_terms(left, right), env\n\t\tin [Term, TermList]\n\t\t\treturn subtract_term_list_from_term(right, left), env\n\t\tin [TermList, Term]\n\t\t\treturn subtract_term_from_term_list(right, left), env\n\t\tin [TermList, TermList]\n\t\t\treturn subtract_term_list_from_term_list(left, right), env\n\t\tin [Matrix, Matrix]\n\t\t\treturn subtract_matrix_minus_matrix(left, right), env\n\t\telse\n\t\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented for left: #{left.type}, right: #{right.type}.\", node, stack_trace) \n\t\tend\n\twhen \"*\"\n\t\tcase [left, right]\n\t\tin [Term, Term]\n\t\t\treturn multiply_two_terms(left, right), env\n\t\tin [Term, TermList]\n\t\t\treturn multiply_term_and_term_list(left, right), env\n\t\tin [TermList, Term]\n\t\t\treturn multiply_term_and_term_list(left, right), env\n\t\tin [TermList, TermList]\n\t\t\treturn multiply_term_list_and_term_list(left, right), env\n\t\tin [Fraction, Term]\n\t\t\treturn multiply_fraction_and_term(left, right), env\n\t\tin [Term, Fraction]\n\t\t\treturn multiply_fraction_and_term(right, left), env\n\t\tin [Fraction, TermList]\n\t\t\treturn multiply_fraction_and_term_list(left, right), env\n\t\tin [TermList, Fraction]\n\t\t\treturn multiply_fraction_and_term_list(right, left), env\n\t\tin [Fraction, Fraction]\n\t\t\treturn multiply_fraction_and_fraction(left, right), env\t\n\t\tin [Matrix, Matrix]\n\t\t\treturn multiply_two_matrices(left, right), env\n\t\tin [Matrix, Term]\n\t\t\treturn multiply_matrix_and_term(left, right), env\n\t\tin [Term, Matrix]\n\t\t\treturn multiply_matrix_and_term(right, left), env\n\t\tin [Matrix, TermList]\n\t\t\treturn multiply_matrix_and_term_list(left, right), env\n\t\tin [TermList, Matrix]\n\t\t\treturn multiply_matrix_and_term_list(right, left), env\n\t\tin [Matrix, Fraction]\n\t\t\treturn multiply_matrix_and_fraction(left, right), env\n\t\tin [Fraction, Matrix]\n\t\t\treturn multiply_matrix_and_fraction(right, left), env\n\t\telse\n\t\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented for left: #{left.type}, right: #{right.type}.\", node, stack_trace) \n\t\tend\n\twhen \"/\"\n\t\tcase [left, right]\n\t\tin [Term, Term]\n\t\t\treturn divide_two_terms(left, right), env\n\t\tin [Term, TermList]\n\t\t\treturn divide_term_by_term_list(left, right), env\n\t\tin [TermList, Term]\n\t\t\treturn divide_term_list_by_term(left, right), env\n\t\tin [TermList, TermList]\n\t\t\treturn divide_term_list_by_term_list(left, right), env\n\t\tin [Fraction, Term]\n\t\t\treturn divide_fraction_by_term(left, right), env\n\t\tin [Term, Fraction]\n\t\t\treturn divide_term_by_fraction(right, left), env\n\t\tin [Fraction, TermList]\n\t\t\treturn divide_fraction_by_term_list(left, right), env\n\t\tin [TermList, Fraction]\n\t\t\treturn divide_term_list_by_fraction(right, left), env\n\t\tin [Fraction, Fraction]\n\t\t\treturn divide_fraction_by_fraction(left, right), env\t\n\t\telse\n\t\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented for left: #{left.type}, right: #{right.type}.\", node, stack_trace) \n\t\tend\n\twhen \"*!\"\n\t\tcase [left, right]\n\t\tin [Matrix, Matrix]\n\t\t\treturn tensor_product_of_two_matrices(left, right), env\n\t\telse\n\t\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented for left: #{left.type}, right: #{right.type}.\", node, stack_trace) \n\t\t\treturn nil, env\n\t\tend\n\telse\n\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented.\", node, stack_trace) \n\tend\nend",
"def ops!\n @ops\n end",
"def transmogrifier (a,b,c)\n (a*b)^c\n end",
"def mult(x, op, y)\n x.send(op, y)\nend",
"def mat_add_or_subtract(mat1, mat2, operation='+')\n n = mat1.size\n result = n.times.map{ |x| [] }\n (0..n-1).each do |i|\n (0..n-1).each do |j|\n result[i] << (operation == '+' ? (mat1[i][j] + mat2[i][j]) : (mat1[i][j] - mat2[i][j]))\n end\n end\n result\n end",
"def arithmetic2(a, b)\nend",
"def op; end",
"def expressions_over(op1, op2)\n expressions_over_lists( asArray(op1), asArray(op2))\nend",
"def evaluate\n @output_value = Math.tanh(@input_value - @bias)\n #p \"output value #{@output_value}\"\n @forward_nodes.each do |node, weight|\n #p \"weight #{weight} old input #{node.input_value}\"\n node.input_value += @output_value * weight\n #p \"new input #{node.input_value}\"\n end\n @input_value = 0\n end",
"def calculate( op, a1, a2 = nil )\n case op\n when :abs; a2\n when :rel; a2\n when :mul; a1 * a2\n when :add; a1 + a2\n when :sub; a1 - a2\n when :inv; a1 * -1\n else 0\n end\n end",
"def operation(num)\n\treturn num*num, num**3\nend",
"def operations; end",
"def operations; end",
"def calculation(a,b, operation)\n operation.call(a,b)\n end",
"def multiply_two_matrices(left, right)\n\t\n\tif left.cols != right.rows\n\t\tthrow_error(\"Matrix dimensions don't match when multiplying two matrices (left.cols must == right.rows).\", left, []) # TODO: Add stack trace (make a global)\n\tend\n\tright_as_cols = right.values.transpose\n\n\tnew_rows = []\n\tfor row_index in (0..left.rows - 1)\n\t\tnew_row = []\n\t\tfor col_index in (0..right.cols - 1)\n\t\t\trow = left.values[row_index]\n\t\t\tcol = right_as_cols[col_index]\n\n\t\t\tnew_elem = Term.new(-1,-1, magnitude: 0)\n\t\t\tfor position in (0..row.length-1)\n\t\t\t\trow_elem = row[position]\n\t\t\t\tcol_elem = col[position]\n\t\t\t\tcase [row_elem, col_elem]\n\t\t\t\tin [Term, Term]\n\t\t\t\t\tproduct = multiply_two_terms(row_elem, col_elem)\n\t\t\t\tin [Term, TermList]\n\t\t\t\t\tproduct = multiply_term_and_term_list(row_elem, col_elem)\n\t\t\t\tin [TermList, Term]\n\t\t\t\t\tproduct = multiply_term_and_term_list(col_elem, row_elem)\n\t\t\t\tin [TermList, TermList]\n\t\t\t\t\tproduct = multiply_term_list_and_term_list(row_elem, col_elem)\n\t\t\t\tin [Fraction, Term]\n\t\t\t\t\tproduct = multiply_fraction_and_term(row_elem, col_elem)\n\t\t\t\tin [Fraction, TermList]\n\t\t\t\t\tproduct = multiply_fraction_and_term_list(row_elem, col_elem)\n\t\t\t\tin [Term, Fraction]\n\t\t\t\t\tproduct = multiply_fraction_and_term(col_elem, row_elem)\n\t\t\t\tin [TermList, Fraction]\n\t\t\t\t\tproduct = multiply_fraction_and_term_list(col_elem, row_elem)\n\t\t\t\tin [Fraction, Fraction]\n\t\t\t\t\tproduct = multiply_fraction_and_fraction(row_elem, col_elem)\n\t\t\t\telse\n\t\t\t\t\tthrow_error(\"Matrix addition with matrices that don't contain only Terms, TermLists, and Fractions.\", left, []) # TODO: Add stack trace (make a global)\n\t\t\t\tend\n\t\t\t\t# Add product to new elem\n\t\t\t\tcase [product, new_elem]\n\t\t\t\tin [Term, Term]\n\t\t\t\t\tnew_elem = add_two_terms(product, new_elem)\n\t\t\t\tin [Term, TermList]\n\t\t\t\t\tnew_elem = add_term_and_term_list(product, new_elem)\n\t\t\t\tin [TermList, Term]\n\t\t\t\t\tnew_elem = add_term_and_term_list(new_elem, product)\n\t\t\t\tin [TermList, TermList]\n\t\t\t\t\tnew_elem = add_term_list_and_term_list(product, new_elem)\n\t\t\t\tin [Fraction, Term]\n\t\t\t\t\tnew_elem = add_fraction_and_term(product, new_elem)\n\t\t\t\tin [Fraction, TermList]\n\t\t\t\t\tnew_elem = add_fraction_and_term_list(product, new_elem)\n\t\t\t\tin [Term, Fraction]\n\t\t\t\t\tnew_elem = add_fraction_and_term(new_elem, product)\n\t\t\t\tin [TermList, Fraction]\n\t\t\t\t\tnew_elem = add_fraction_and_term_list(new_elem, product)\n\t\t\t\tin [Fraction, Fraction]\n\t\t\t\t\tnew_elem = add_fraction_and_fraction(product, new_elem)\n\t\t\t\telse\n\t\t\t\t\tthrow_error(\"Matrix addition with matrices that don't contain only Terms, TermLists, and Fractions.\", left, []) # TODO: Add stack trace (make a global)\n\t\t\t\tend\n\t\t\tend\n\t\t\tnew_row.append(new_elem)\n\t\tend\n\t\tnew_rows.append(new_row)\n\tend\n\treturn Matrix.new(left.line, left.col, new_rows)\n\nend",
"def sum(x, op, y)\n x.send(op, y)\nend",
"def optimize\n operation.class.call(left, right)\n end",
"def operation(operator, num1, num2)\n case operator \n when 1 \n puts \"The operational result is: #{num1.to_f + num2.to_f}\"\n puts \"==> #{num1.to_s} + #{num2.to_s} = #{num1.to_f + num2.to_f}\"\n when 2 \n puts \"The operational result is: #{num1.to_f - num2.to_f}\"\n puts \"==> #{num1.to_s} - #{num2.to_s} = #{num1.to_f - num2.to_f}\"\n when 3\n puts \"The operational result is: #{num1.to_f * num2.to_f}\"\n puts \"==> #{num1.to_s} * #{num2.to_s} = #{num1.to_f * num2.to_f}\"\n else\n puts \"The operational result is: #{num1.to_f / num2.to_f}\"\n puts \"==> #{num1.to_s} / #{num2.to_s} = #{num1.to_f / num2.to_f}\"\n end\nend",
"def operation; end",
"def operando(other)\n \n\t\t \n if(@mat1 == nil)\n @mat1 = other\n else\n @mat2 = other\n end\n \n\t\t# Realizamos la operación\n if @mat1 != nil and @mat2 != nil\n\t ejecucion\n\t\tend\n \n end",
"def compute(*inputs)\n if inputs.length != number_of_inputs\n raise WrongNumberOfInputsError, \"Expected #{number_of_inputs} inputs, got #{inputs.length}\"\n end\n\n # Stash these in instance variables so we can use them for training later\n @medin = []\n @medout = []\n\n outputs = []\n\n number_of_medial_neurons.times do |i|\n @medin[i] = 0\n number_of_inputs.times do |j|\n @medin[i] += @synone[j][i] * inputs[j]\n end\n @medout[i] = Math.tanh(@medin[i])\n end\n\n number_of_outputs.times do |i|\n outputs[i] = 0\n number_of_medial_neurons.times do |j|\n outputs[i] += @syntwo[j][i] * @medout[j]\n end\n end\n\n outputs\n end",
"def multiply_two_terms(left, right)\n\n\t# Get new list of the literal varibles (with exponents added together as needed).\n\tcombined_lit_var_list = left.literal_variables.clone + right.literal_variables.clone\n\tnew_lit_var_list = []\n\n\tindex = 0\n\twhile combined_lit_var_list[index] != nil\n\t\tif combined_lit_var_list[index + 1] and combined_lit_var_list[index][0] == combined_lit_var_list[index + 1][0]\n\n\t\t\tnew_lit_var_list.append([combined_lit_var_list[index][0], add_two_terms(combined_lit_var_list[index][1], combined_lit_var_list[index + 1][1])])\n\t\t\tindex += 1\n\t\t\t# TODO: I think this would break with more than 2 terms with the same literal_variables. Not sure how that would happen though.\n\t\telse\n\t\t\tnew_lit_var_list.append(combined_lit_var_list[index])\n\t\tend\n\t\tindex += 1\n\tend\n\n\t# Merge the real and imaginary components.\n\tif left.imaginary == right.imaginary\n\t\tif left.imaginary # Both terms are imaginary\n\t\t\treturn Term.new(left.line, left.col, magnitude: left.magnitude * right.magnitude * -1, lit_var_list: new_lit_var_list)\n\t\telse # Neither are imaginary\n\t\t\treturn Term.new(left.line, left.col, magnitude: left.magnitude * right.magnitude, lit_var_list: new_lit_var_list)\n\t\tend\n\telse # One term is imaginary\n\t\treturn Term.new(left.line, left.col, magnitude: left.magnitude * right.magnitude, imaginary: true, lit_var_list: new_lit_var_list)\n\tend\nend",
"def calculate(op, x, y)\n case op\n when 'plus'\n x.to_f + y.to_f\n when 'minus'\n x.to_f - y.to_f\n when 'divide'\n x.to_f / y.to_f\n when 'multiple'\n x.to_f * y.to_f\n end\nend",
"def transmogrifier(a, b, c)\n p (a * b) ** c\nend",
"def transmogrifier (a, b, c)\n ((a * b) ** c)\nend",
"def applyOperator(num1, num2, operator)\n return num1.send(operator, num2)\n end",
"def matrix_addition(m1, m2)\n matrix_addition_reloaded(m1, m2)\nend",
"def elementwise_op(op,left_val,right_val)\n\n end",
"def add_two_terms(left, right)\n\t# If both imaginary or both real, with the same literal variables, then simply add together.\n\tif left.literal_variables == right.literal_variables and left.imaginary == right.imaginary \n\t\t\treturn Term.new(left.line, left.col, magnitude: left.magnitude + right.magnitude, imaginary: left.imaginary, lit_var_list: left.literal_variables.clone)\n\tend\n\treturn TermList.new(left.line, left.col, [left, right]) # Else, create a TermList.\nend",
"def operation meth, n_operator_sticks, operator, x\n\tToothNumber.new @value.send(meth, x.value),\n\t \t @num + x.num + n_operator_sticks,\n\t\t\t@pic + operator + x.pic\n end",
"def basic_op(operator, value1, value2)\n case operator\n when '+'\n value1 + value2\n when '-'\n value1 - value2\n when '*'\n value1 * value2\n when '/'\n value1 / value2\n end\nend",
"def wrapper(tape1, tape2, operation)\n\tm = SubMachine.stub \"wrapper\"\n\n\tm2 = pos(tape1)\n\tm2.simpleMergeAfter push(:rd)\n\tm2.mergeTrue writeConstant(:rd, 0)\n\tm2.mergeFalse writeConstant(:rd, 1)\n\tm2.mergeFalse invert(tape1)\n\tm.simpleMerge m2.join\n\n\tm3 = pos(tape2)\n\tm3.simpleMergeAfter push(:rd)\n\tm3.mergeTrue writeConstant(:rd, 0)\n\tm3.mergeFalse writeConstant(:rd, 1)\n\tm3.mergeFalse invert(tape2)\n\tm.simpleMerge m3.join\n\n\tif(operation == :mult)\n\t\tm.simpleMerge mult(tape1, tape2)\n\telse\n\t\tm.simpleMerge div(tape1, tape2)\n\tend\n\n\n\tm.simpleMerge writeConstant(:rb, 1)\n\n\tm4 = eq(:rd, :rb)\n\tm4.mergeTrue invert(:acc)\n\tif tape2 != :acc\n\t\tm4.mergeTrue invert(tape2)\n\tend\n\tm.simpleMerge m4.join\n\tm.simpleMerge pop(:rd)\n\n\n\tm5 = eq(:rd, :rb)\n\tm5.mergeTrue invert(:acc)\n\tif tape1 != :acc\n\t\tm8.mergeTrue invert(tape1)\n\tend\n\tm.simpleMerge m5.join\n\tm.simpleMerge pop(:rd)\n\n\tm\nend",
"def tan _args\n \"tan _args;\" \n end",
"def basic_op(operator, value1, value2)\n case operator\n when \"+\"\n value1 + value2\n when \"-\"\n value1 - value2\n when \"*\"\n value1 * value2\n when \"/\"\n value1 / value2\n end\nend",
"def multiply(first_matrix, second_matrix)\n x = first_matrix[0][0] * second_matrix[0][0] + first_matrix[0][1] * second_matrix[1][0]; \n y = first_matrix[0][0] * second_matrix[0][1] + first_matrix[0][1] * second_matrix[1][1]; \n z = first_matrix[1][0] * second_matrix[0][0] + first_matrix[1][1] * second_matrix[1][0]; \n w = first_matrix[1][0] * second_matrix[0][1] + first_matrix[1][1] * second_matrix[1][1]; \n \n first_matrix[0][0] = x; \n first_matrix[0][1] = y; \n first_matrix[1][0] = z; \n first_matrix[1][1] = w; \n end",
"def refute_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end",
"def operation(x)\n Math.sqrt(x.abs) + 5 * x ** 3\nend",
"def run(inputs, outputs, targets)\n \tinputNames = Tensorflow::String_Vector.new\n \tinputValues = Tensorflow::Tensor_Vector.new\n if inputs != nil\n \t inputs.each do |key, value|\n \t\t inputValues.push(value)\n \t\t inputNames.push(key)\n \t end\n end\n\n \toutputNames = Tensorflow::String_Vector.new\n \toutputs.each do |name|\n \t\toutputNames.push(name)\n \tend\n\n \ttargetNames = Tensorflow::String_Vector.new\n if targets != nil\n \t targets.each do |name|\n \t\t targetNames.push(name)\n \t end\n end\n\n \toutputValues = Tensorflow::Tensor_Vector.new\n \tstatus = Tensorflow::TF_NewStatus()\n\t Tensorflow::TF_Run_wrapper(self.session , inputNames, inputValues, outputNames, outputValues, targetNames, self.status)\n raise (\"Incorrect specifications passed.\") if Tensorflow::TF_GetCode(status) != Tensorflow::TF_OK\n output_array = []\n (0..outputValues.size - 1).each do |i|\n size = Tensorflow::tensor_size(outputValues[i])\n type = Tensorflow::TF_TensorType(outputValues[i])\n\n case type\n when Tensorflow::TF_DOUBLE\n c_array = Tensorflow::Double.new(size)\n Tensorflow::double_reader(outputValues[i], c_array, size)\n when Tensorflow::TF_INT64\n c_array = Tensorflow::Long_long.new(size)\n Tensorflow::long_long_reader(outputValues[i], c_array, size)\n when Tensorflow::TF_INT32\n c_array = Tensorflow::Int.new(size)\n Tensorflow::int_reader(outputValues[i], c_array, size)\n when Tensorflow::TF_COMPLEX128\n c_array = Tensorflow::complex_reader(outputValues[i])\n else\n raise \"Data type not supported.\"\n end\n\n num_dimensions = Tensorflow::TF_NumDims(outputValues[i])\n out_dimension = []\n (0..num_dimensions - 1).each do |j|\n out_dimension.push(Tensorflow::TF_Dim(outputValues[i], j))\n end\n output = []\n (0..size - 1).each do |j|\n output.push(c_array[j])\n end\n out_dimension.reverse!\n (0..out_dimension.length - 2).each do |k|\n total_dim = output.length\n dim_array = []\n temp_array = []\n (0..total_dim - 1).each do |ind|\n temp_array.push(output[ind])\n dim_array.push(temp_array) if (temp_array.length == out_dimension[k])\n temp_array = [] if (temp_array.length == out_dimension[k])\n end\n output = dim_array\n end\n output_array.push(output)\n end\n output_array\n end",
"def evaluate(env)\n left = self.left.evaluate(env) \n right =self.right.evaluate(env)\n if (left.is_a? Numeric or left.is_a? String) && (right.is_a? Numeric or right.is_a? String) then\n return left - right\n else\n raise \" Math Error: cannot multiply #{left.class} with #{right.class}\\nFrom line: #{self.line}\"\n end\n end",
"def transmogrifier(num1, num2, num3)\n\t(num1 * num2) ** num3\nend",
"def do_math(num1, num2, operation)\n case operation\n when '+'\n num1.to_i + num2.to_i\n when '-'\n num1.to_i - num2.to_i\n when '*'\n num1.to_i * num2.to_i\n when '/'\n num1.to_f / num2.to_f\n end\nend",
"def transmogrifier(num1, num2, num3)\n transmogrified = ((num1*num2) * num3)\n return transmogrified \nend",
"def calculate(operation, n1, n2)\n if operation == \"add\" || operation == \"+\"\n return \"#{n1} + #{n2} = #{n1+n2}\"\n elsif operation == \"subtract\" || operation == \"-\"\n return \"#{n1} - #{n2} = #{n1-n2}\"\n elsif operation == \"multiply\" || operation == \"*\"\n return \"#{n1} * #{n2} = #{n1*n2}\"\n elsif operation == \"divide\" || operation == \"/\"\n if n2 == 0\n return \"undefined\"\n else\n return \"#{n1} / #{n2} = #{n1/n2}\"\n end\n elsif operation == \"exponent\" || operation == \"^\"\n return \"#{n1} ^ #{n2} = #{n1**n2}\"\n elsif operation == \"modulo\" || operation == \"%\"\n return \"#{n1} % #{n2} = #{n1%n2}\"\n end\nend",
"def *(other)\n # invariants and pre-conditions\n _invariants\n if other.respond_to? :getDelegate\n assert_equal(other.row_size,self.column_size,\"pre-condition\")\n elsif other.is_a? Numeric\n # no preconditions\n else\n raise \"not a sparse matrix object or scalar\"\n end\n\n if other.respond_to? :getDelegate\n result = SparseMatrix.create(self.row_size,other.column_size)\n self.each_with_index {|index,val|\n (0..other.column_size-1).each {|i|\n result.put([index[0],i], result[index[0],i] + val*other[index[1],i])\n }\n }\n elsif other.is_a? Numeric\n newDelegate = @delegate * other\n result = SparseMatrix.new(newDelegate)\n end\n\n\n # post-conditions and invariants\n _invariants\n if other.respond_to? :getDelegate\n assert_equal(result.row_size,self.row_size,\"post-condition\")\n assert_equal(result.column_size,other.column_size,\"post-condition\")\n assert_equal(result.toBaseMatrix,self.toBaseMatrix*other.toBaseMatrix,\"post-condition\")\n elsif other.is_a? Numeric\n assert_equal(result.row_size,self.row_size,\"post-condition\")\n assert_equal(result.column_size,self.column_size,\"post-condition\")\n assert_equal(result.toBaseMatrix,self.toBaseMatrix*other,\"post-conditions\")\n end\n\n return result\n\n end",
"def * other\n other.is_a?(Vips::Image) ?\n multiply(other) : linear(other, 0)\n end",
"def transmogrifier (num1,num2,num3)\n (num1 * num2)**num3\nend",
"def arithmetic(a, b, operator)\n $oper = operator\n case $oper\n when 'add'\n return a + b\n\n when 'subtract'\n return a - b\n\n when 'multiply'\n return a * b\n\n when 'divide'\n return a / b\n \n end\nend",
"def interpret\r\n return @leftExpression.interpret - @rightExpression.interpret\r\n end",
"def transmogrifier num1,num2,num3\n\t(num1 * num2) ** num3\nend",
"def apply_math(fn, a, b)\n a.send(fn, b)\nend",
"def operation(o, x, y)\n case o\n when '+'\n x + y\n when '-'\n x - y\n when 'x'\n x * y\n when '/'\n x / y\n else\n raise \"invalid operation #{o}\"\n end\nend",
"def tr(p0, p1) end",
"def matrix_multiplication_gpu_transposed_b(a, b, size)\n # Matrix B is transposed\n\n return PArray.new(size * size) do |index|\n x = index % size\n y = index / size\n\n # TODO(5): Implement\n # Try with GPU_T_B 150\n # If correct, run with GPU_T_B 3000 and compare runtime with GPU 3000\n\n 123.4\n end\nend",
"def operation_of(a, b, op)\n if op == \"add\"\n return a + b\n elsif op == \"subtract\"\n return a - b\n elsif op == \"multiply\"\n return a * b\n elsif op == \"divide\"\n if b == 0\n return \"undefined\"\n else\n return a / b\n end\n end\nend",
"def kernel(samples, koef, v_n_1, v_n_2)\r\n samples.each { |x|\r\n v_n_1, v_n_2 = koef*v_n_1 - v_n_2 + x, v_n_1\r\n }\r\n return v_n_1, v_n_2\r\n end",
"def sum_difference_product\n # your code goes here\nend",
"def operation_of(a, b, op)\n if op == \"add\"\n return a + b\n elsif op == \"subtract\"\n return a - b \n elsif op == \"multiply\"\n return a * b \n elsif op == \"divide\"\n if b == 0\n return \"undefined\"\n else\n return a / b\n end\n end\nend",
"def evaluate(env)\n left = self.left.evaluate(env) \n right =self.right.evaluate(env)\n if left.is_a? Numeric and right.is_a? Numeric then\n return left + right\n else\n raise \" Math Error: cannot sum #{left.class} with #{right.class}\\nFrom line: #{self.line}\"\n end\n end",
"def evaluate(op, left_arg, right_arg)\n case\n when op == '+' then return left_arg + right_arg\n when op == '-' then return left_arg - right_arg\n when op == '*' then return left_arg * right_arg\n when op == '/' then return left_arg / right_arg\n when op == '%' then return left_arg % right_arg\n end\nend",
"def unit_arithmetic(operator,second_operand)\n raise ArgumentError, \"operator has to be '+' or '-'\" unless [\"+\",\"-\"].include? operator\n unless self.compatible? second_operand\n raise ArgumentError, \"first operand (#{self}) must be compatible with second operand (#{second_operand}) in order to perform #{operator}.\"\n end\n \n first_value = self.convert_to(\"base\").value\n second_value = second_operand.convert_to(self.unit)\n result = first_value.send(operator,second_value)\n return self.class.new(result,self.unit)\n end",
"def multiply!(rhs)\n case rhs\n when ::Snow::Vec3 then multiply(rhs, rhs)\n else multiply(rhs, self)\n end\n end",
"def cops; end",
"def cops; end",
"def cops; end",
"def matrix_multiplication_gpu_transposed_a(a, b, size)\n # Matrix A is transposed\n\n return PArray.new(size * size) do |index|\n x = index % size\n y = index / size\n\n # TODO(4): Implement\n # Try with GPU_T_A 150\n # If correct, run with GPU_T_A 3000 and compare runtime with GPU 3000\n\n 123.4\n end\nend",
"def trans_mul(other)\n mulm_full(:trans, :no_trans, other)\n end",
"def math(operator, first_num, second_num)\n if operator ==\"*\"\n first_num*second_num\n elsif operator == \"/\"\n first_num/second_num\n elsif operator == \"+\"\n first_num+second_num\n else\n first_num-second_num\n end\nend",
"def result \n return @left_operand + @right_operand\n end",
"def applyOperator(num1, num2, operator)\n #eval((num1.to_s + operator + num2.to_s).gsub(\"^\", \"**\"))\n @operators[operator][:action].call(num1.to_i, num2.to_i)\n end",
"def process_operator_token(token, operand_a, operand_b)\n if token == '+'\n operand_a + operand_b\n elsif token == '-'\n operand_a - operand_b\n elsif token == '*'\n operand_a * operand_b\n elsif token == '/'\n raise 'Tried to divide by zero!' if operand_b == 0\n\n operand_a / operand_b\n else\n raise \"Invalid Operator: #{token}\"\n end\nend",
"def optimize_right\n Function.optimize_operand(operation.right)\n end",
"def transmogrifier(num1, num2, num3)\n return (num1*num2)**num3\nend",
"def do_math(operand, val1, val2)\n case operand\n when \"+\"\n val1 + val2\n when \"-\"\n val1 - val2\n when \"*\"\n val1 * val2\n when \"/\"\n val1 / val2\n end\nend",
"def optimize\n operation.class.new(left, right)\n end",
"def do_math(a, b, &operation)\n math(a, b, &operation)\nend",
"def do_math(a, b, &operation)\n math(a, b, &operation)\nend",
"def mathoper4argum(n, y, a, b)\n\n\tn + y - a / b\n\nend",
"def merge_final_ops(seq1, seq2, res = [])\n ops1, ops2 = [], []\n ops1 << seq1.pop while seq1.last.is_a?(String)\n ops2 << seq2.pop while seq2.last.is_a?(String)\n\n # Not worth the headache of trying to preserve newlines here. The most\n # important use of newlines is at the beginning of the selector to wrap\n # across lines anyway.\n ops1.reject! {|o| o == \"\\n\"}\n ops2.reject! {|o| o == \"\\n\"}\n\n return res if ops1.empty? && ops2.empty?\n if ops1.size > 1 || ops2.size > 1\n # If there are multiple operators, something hacky's going on. If one\n # is a supersequence of the other, use that, otherwise give up.\n lcs = Sass::Util.lcs(ops1, ops2)\n return unless lcs == ops1 || lcs == ops2\n res.unshift(*(ops1.size > ops2.size ? ops1 : ops2).reverse)\n return res\n end\n\n # This code looks complicated, but it's actually just a bunch of special\n # cases for interactions between different combinators.\n op1, op2 = ops1.first, ops2.first\n if op1 && op2\n sel1 = seq1.pop\n sel2 = seq2.pop\n if op1 == '~' && op2 == '~'\n if sel1.superselector?(sel2)\n res.unshift sel2, '~'\n elsif sel2.superselector?(sel1)\n res.unshift sel1, '~'\n else\n merged = sel1.unify(sel2)\n res.unshift [\n [sel1, '~', sel2, '~'],\n [sel2, '~', sel1, '~'],\n ([merged, '~'] if merged)\n ].compact\n end\n elsif (op1 == '~' && op2 == '+') || (op1 == '+' && op2 == '~')\n if op1 == '~'\n tilde_sel, plus_sel = sel1, sel2\n else\n tilde_sel, plus_sel = sel2, sel1\n end\n\n if tilde_sel.superselector?(plus_sel)\n res.unshift plus_sel, '+'\n else\n merged = plus_sel.unify(tilde_sel)\n res.unshift [\n [tilde_sel, '~', plus_sel, '+'],\n ([merged, '+'] if merged)\n ].compact\n end\n elsif op1 == '>' && %w(~ +).include?(op2)\n res.unshift sel2, op2\n seq1.push sel1, op1\n elsif op2 == '>' && %w(~ +).include?(op1)\n res.unshift sel1, op1\n seq2.push sel2, op2\n elsif op1 == op2\n merged = sel1.unify(sel2)\n return unless merged\n res.unshift merged, op1\n else\n # Unknown selector combinators can't be unified\n return\n end\n return merge_final_ops(seq1, seq2, res)\n elsif op1\n seq2.pop if op1 == '>' && seq2.last && seq2.last.superselector?(seq1.last)\n res.unshift seq1.pop, op1\n return merge_final_ops(seq1, seq2, res)\n else # op2\n seq1.pop if op2 == '>' && seq1.last && seq1.last.superselector?(seq2.last)\n res.unshift seq2.pop, op2\n return merge_final_ops(seq1, seq2, res)\n end\n end",
"def -(vector2)\n end",
"def dot(a, b)\n a = NArray.asarray(a)\n b = NArray.asarray(b)\n case a.ndim\n when 1\n case b.ndim\n when 1\n func = blas_char(a, b) =~ /c|z/ ? :dotu : :dot\n Blas.call(func, a, b)\n else\n if b.contiguous?\n trans = 't'\n else\n if b.fortran_contiguous?\n trans = 'n'\n b = b.transpose\n else\n trans = 't'\n b = b.dup\n end\n end\n Blas.call(:gemv, b, a, trans:trans)\n end\n else\n case b.ndim\n when 1\n if a.contiguous?\n trans = 'n'\n else\n if a.fortran_contiguous?\n trans = 't'\n a = a.transpose\n else\n trans = 'n'\n a = a.dup\n end\n end\n Blas.call(:gemv, a, b, trans:trans)\n else\n if a.contiguous?\n transa = 'n'\n else\n if a.fortran_contiguous?\n transa = 't'\n a = a.transpose\n else\n transa = 'n'\n a = a.dup\n end\n end\n if b.contiguous?\n transb = 'n'\n else\n if b.fortran_contiguous?\n transb='t'\n b = b.transpose\n else\n transb='n'\n b = b.dup\n end\n end\n Blas.call(:gemm, a, b, transa:transa, transb:transb)\n end\n end\n end",
"def operator; end",
"def trans_mul_trans(other)\n mulm_full(:trans, :trans, other)\n end",
"def basic_op(operator, value1, value2)\n value1.send(operator, value2)\nend",
"def matrix_addition(matrix_1, matrix_2)\n height = matrix_1.length\n width = matrix_1.first.length\n (0...height).map do |col|\n (0...width).map do |row|\n matrix_1[col][row] + matrix_2[col][row]\n end\n end\nend",
"def calc(a, op, b)\n diff = (index(a).send(op, index(b))) % size\n at(diff)\n end",
"def multiply(left, right, result) #method\n left = get_dir(left)\n right = get_dir(right)\n @current_context[result] = get_value(left) * get_value(right)\n end",
"def transmogrifier(a, b, c)\n # (a * b).pow(c)\n (a * b) ** c\nend",
"def mul\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n\n\n value = nil\n\n\n a = nil\n b = nil\n\n\n begin\n # at line 14:21: a= single ( MUL b= single | DIV b= single )*\n @state.following.push( TOKENS_FOLLOWING_single_IN_mul_88 )\n a = single\n @state.following.pop\n # at line 14:29: ( MUL b= single | DIV b= single )*\n while true # decision 2\n alt_2 = 3\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0 == MUL )\n alt_2 = 1\n elsif ( look_2_0 == DIV )\n alt_2 = 2\n\n end\n case alt_2\n when 1\n # at line 15:5: MUL b= single\n match( MUL, TOKENS_FOLLOWING_MUL_IN_mul_95 )\n @state.following.push( TOKENS_FOLLOWING_single_IN_mul_99 )\n b = single\n @state.following.pop\n\n # --> action\n a *= b \n # <-- action\n\n\n when 2\n # at line 16:5: DIV b= single\n match( DIV, TOKENS_FOLLOWING_DIV_IN_mul_107 )\n @state.following.push( TOKENS_FOLLOWING_single_IN_mul_111 )\n b = single\n @state.following.pop\n\n # --> action\n a /= b \n # <-- action\n\n\n else\n break # out of loop for decision 2\n end\n end # loop for decision 2\n\n\n # --> action\n value = a \n # <-- action\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 3 )\n\n\n end\n\n return value\n end",
"def evaluate(env)\n left = self.left.evaluate(env) \n right =self.right.evaluate(env)\n if left.is_a? Numeric and right.is_a? Numeric then\n return left - right\n else\n raise \" Math Error: cannot subtract #{right.class} to #{left.class}\\nFrom line: #{self.line}\"\n end\n end",
"def dot_product(a,b)\n # matrix_a = Vector[*a]\n # matrix_b = Vector[*b]\n return false if a.length != b.length\n matrix_a = Vector.elements(a, copy = true)\n matrix_b = Vector.elements(b, copy = true)\n p matrix_a.inner_product(matrix_b)\nend",
"def transform! *ms\n m = [*ms].flatten.reverse.inject(:*)\n @vbuffer.each_triple_with_index do |t,i|\n q = m * NMatrix[[t[0]],[t[1]],[t[2]],[1]]\n @vbuffer[i] = [q[0]/q[3], q[1]/q[3], q[2]/q[3]]\n end\n self\n end",
"def basic_op(operator, value1, value2)\nvalue1.send(operator,value2)\nend",
"def arithmetic_op(op,ins_1,ins_2,do_sanitizing=true)\n begin\n amount = ''\n if do_sanitizing\n ins_2 = Money::InputSanitizer.sanitize_money_live_converter(ins_2)\n if ( ins_1.currency == ins_2.currency )\n amount = ins_1.amount.to_f.public_send(op,ins_2.amount.to_f)\n else\n amount = ins_1.amount.to_f.public_send(op,ins_2.convert_to(ins_1.currency).amount.to_f)\n end\n else\n amount = ins_1.amount.to_f.public_send(op,ins_2.to_f)\n end\n if (['==','<','>'].include?(op))\n return amount\n else\n Money::LiveConverter.new(amount,ins_1.currency)\n end\n rescue RuntimeError => e\n puts \"#{e.message}\"\n end\n end",
"def GF_product_t_i(a, b)\n t = GF_tables()\n t[:exponential][(t[:logarithmic][a] + t[:logarithmic][b]) % 255]\nend",
"def test(i,j,k)\nreturn @A[i]*$x + @B[j]*$y + @C[k]*$z\nend",
"def cf_or ( a, b )\r\n# Combine for 'A or B'\r\n if a>0 and b>0\r\n a + b - a*b\r\n elsif a<0 and b<0\r\n a + b + a*b\r\n else\r\n (a + b) / ( 1 - [a.abs, b.abs].min )\r\n end\r\nend"
] | [
"0.60477465",
"0.5645467",
"0.55475837",
"0.54053766",
"0.54021853",
"0.53748095",
"0.5368515",
"0.53651124",
"0.5310847",
"0.53074855",
"0.5300187",
"0.52763027",
"0.52760446",
"0.52559054",
"0.5253071",
"0.5239404",
"0.5239404",
"0.5236789",
"0.5208744",
"0.51777947",
"0.5174979",
"0.51729846",
"0.51613784",
"0.5142792",
"0.5142313",
"0.5114063",
"0.5105928",
"0.50999314",
"0.5089774",
"0.50869393",
"0.5077902",
"0.5060805",
"0.50580126",
"0.50541836",
"0.5052056",
"0.50501055",
"0.50443786",
"0.50079906",
"0.5005443",
"0.50011337",
"0.49939555",
"0.4991566",
"0.4976844",
"0.4955915",
"0.49556544",
"0.49514827",
"0.49497908",
"0.49448204",
"0.49410594",
"0.49305722",
"0.492692",
"0.49244547",
"0.49167633",
"0.49140683",
"0.49083692",
"0.4906041",
"0.49055815",
"0.49055237",
"0.49038455",
"0.49015674",
"0.4892548",
"0.48925292",
"0.48829028",
"0.4880371",
"0.4874348",
"0.48720834",
"0.48720834",
"0.48720834",
"0.4871662",
"0.4871152",
"0.48683518",
"0.486728",
"0.48652187",
"0.48595363",
"0.48472145",
"0.48443604",
"0.48372406",
"0.48323634",
"0.4831342",
"0.4831342",
"0.4828458",
"0.48224035",
"0.4821794",
"0.48208082",
"0.48187482",
"0.48181325",
"0.48173556",
"0.48126704",
"0.48051038",
"0.48026088",
"0.47931182",
"0.47925475",
"0.4789497",
"0.4788726",
"0.47846082",
"0.47834605",
"0.47767228",
"0.47731125",
"0.47696894",
"0.476125"
] | 0.5021209 | 37 |
general case transposition with flat arrays | def transpose_with_perm(arr, new_arr, shape, new_shape, perm)
arr_size = shape.reduce(:*)
divisors = shape.dup.drop(1).reverse.inject([1]) { |a, s|
a << s * a.last
}.reverse
multipliers = new_shape.dup.drop(1).reverse.inject([1]) { |a, s|
a << s * a.last
}.reverse
arr_size.times do |p|
ptr = p
index = []
divisors.each_with_object(index) do |div, a|
a << (ptr / div.to_f).floor
ptr = ptr % div
end
# remap based on perm
remaped = perm.map { |x| index[x] }
ptr2 = 0
multipliers.each_with_index do |m, idx|
ptr2 += remaped[idx] * m
end
new_arr[ptr2] = arr[p]
end
[new_arr, new_shape]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transpose() end",
"def my_transpose(trans_arr)\n i, j = 0, 1\n array_copy = trans_arr.dup\n (i...trans_arr.length-1).each do |index_one|\n (j...trans_arr.length).each do |index_two|\n array_copy[index_one][index_two], array_copy[index_two][index_one] =\n array_copy[index_two][index_one], array_copy[index_one][index_two]\n end\n end\n array_copy\n end",
"def transpose; end",
"def transpose\n gather { [] }.\n map(element_type: :array) { |a| a.transpose }.\n scatter(element_type: :array)\n end",
"def transpose\n gather { [] }.\n map(element_type: :array) { |a| a.transpose }.\n scatter(element_type: :array)\n end",
"def transpose(arr)\n transposed = Array.new([[], [], []])\n arr.each_index do |outer_i|\n arr.each_index do |inner_i|\n transposed[inner_i][outer_i] = arr[outer_i][inner_i]\n end\n end\n transposed\nend",
"def my_transpose(arr) \n new_arr = []\n (0...arr.length).each do |outer_el| # the second dimension of a matrix\n outer_arr = []\n (0...arr.length).each do |inner_el| \n outer_arr << arr[inner_el][outer_el] # flip everything inside the array and place in the outer_arr\n end\n new_arr << outer_arr # nest that outer_arr inside the new_arr\n end\n new_arr\nend",
"def my_transpose\n row_length = length\n col_length = first.length\n transposed = Array.new(col_length) { Array.new(row_length) }\n\n (0...row_length).each do |row|\n (0...col_length).each do |col|\n transposed[col][row] = self[row][col]\n end\n end\n transposed\n end",
"def transpose(array)\n return [] if array.empty?\n result = []\n array.first.length.times do |i|\n array.each_with_index do |inner, inner_index|\n result[i] ||= []\n result[i] << array[inner_index][i]\n end\n end\n result\nend",
"def transpose(array)\n result = []\n number = array.count\n if array.empty?\n single_array = array\n else\n single_array = [array[0]]\n end\n single_array.each do |val|\n val.each do |v|\n new_array = []\n number.times do\n new_array << v\n end\n result << new_array\n end\n end\n result\nend",
"def transpose\n # So. Pointless. Blerg.\n IterableArray.new(@array.transpose.map do |x|\n IterableArray.new x\n end)\n end",
"def my_transpose\n transposed = []\n\n i = 0\n until transposed.length == length\n current = []\n self.each do |arr|\n current << arr[i]\n end\n i += 1\n transposed << current\n end\n\n transposed\n end",
"def transpose(before)\n after = [[],[]]\n\n before.each_with_index do |n1, i|\n n1.each_with_index do |n2, j|\n after[i][j] = before[j][i]\n end\n end\n\n after\nend",
"def transpose\n t = super()\n t.flip!\n end",
"def my_transpose\n ret = []\n i=0\n while i < self.length\n j=0\n ret2 = []\n while j < self[i].length\n ret2 << self[j][i]\n j += 1\n end\n ret << ret2\n i += 1\n end\n ret\n end",
"def transpose(arr)\n columns = arr.max.length-1\n\n (0..columns).map do |column|\n (0..arr.length-1).map do |row|\n arr[row][column]\n end\n\n end\nend",
"def transpose(mtrx)\n new_mtrx = Array.new(3) { Array.new(3) }\n new_mtrx.each_with_index do |sub_arr, idx|\n sub_arr.each_with_index do |element, inner_idx|\n new_mtrx[idx][inner_idx] = mtrx[inner_idx][idx]\n end\n end\n new_mtrx\nend",
"def my_transpose\n transpose_arr = Array.new(self.length){Array.new(self.length)}\n self.each_with_index do |arr, idx1|\n arr.each_with_index do |ele, idx2|\n transpose_arr[idx2][idx1] = ele\n end\n end\n transpose_arr\n end",
"def transpose(arr)\n col_size = arr.size # the number of rows in the original array\n row_size = arr[0].size # the number of cols in the original array\n new_arr = Array.new(row_size) { Array.new(col_size) } # create a nil-filled row_size-by-col_size array\n arr.each_with_index do |sub_arr, row|\n sub_arr.each_with_index { |elem, col| new_arr[col][row] = elem }\n end\n new_arr\nend",
"def my_transpose\n output = Array.new(self.length) {Array.new(self.length)}\n\n self.each_with_index do |row, row_i|\n row.each_with_index do |col, col_i|\n output[col_i][row_i] = self[row_i][col_i]\n end\n end\n output\n end",
"def transpose(arr) # transpose matrix\n column1, column2, column3 = [arr[0][0], arr[1][0], arr[2][0]],\n [arr[0][1], arr[1][1], arr[2][1]],\n [arr[0][2], arr[1][2], arr[2][2]]\n [column1, column2, column3]\nend",
"def transpose!\n raise NotImplementedError\n end",
"def transpose(matrix)\n size = matrix.first.size\n matrix.each_with_index.with_object(Array.new(size) {[]}) do |(arr, idx), trans_arr|\n arr.each_with_index do |el, i|\n trans_arr[i] << el\n end\n end\nend",
"def my_transpose\n result = Array.new(length) { Array.new(length) }\n self.each_with_index do |row, r|\n row.each_with_index do |num, c|\n result[r][c] = self[c][r]\n end\n end\n result\n end",
"def my_transpose\n\n end",
"def transpose(matrix)\n first_array = [matrix[0][0], matrix[1][0], matrix[2][0]]\n second_array = [matrix[0][1], matrix[1][1], matrix[2][1]]\n third_array = [matrix[0][2], matrix[1][2], matrix[2][2]]\n final_array = [first_array, second_array, third_array]\nend",
"def jagged_transpose(arrays)\n max_length = arrays.map{ |a| a.length }.max\n arrays.map{ |a| a.fill(0, a.length, max_length - a.length) }.transpose\n end",
"def my_transpose\n raise 'needs to be a square matrix' unless length == self[0].length\n\n transposed = []\n col = []\n\n each_index do |row_idx|\n temp_arr = []\n each do |sub_arr|\n temp_arr << sub_arr[row_idx]\n end\n transposed << temp_arr\n end\n\n transposed\n end",
"def transpose!\n super()\n self.flip!\n end",
"def transpose(array)\n\ttransposed = []\n\n\tfor item in array\n\t\tif item.kind_of?(Array)\n\t\t\tfor i in (0... item.count)\n\t\t\t\tif i < transposed.count\n\t\t\t\t\ttransposed[i].push(item[i]) \n\t\t\t\telse \n\t\t\t\t\ttransposed.push([item[i]])\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\ttransposed.push([item])\n\t\tend\n\tend\n\n\treturn transposed\nend",
"def my_transpose(matrix)\n raise \"Not a two dimensional array\" unless matrix.length > 1 && matrix[0].is_a?(Array)\n result = Array.new(matrix.length) {Array.new(matrix.length)}\n\n result.each_index do |row|\n result[row].each_index do |col|\n result[row][col] = matrix[col][row]\n end\n end\n\n result\nend",
"def transpose\n Matrix[self.to_a]\n end",
"def transpose!(matrix)\n (0..2).each do |i1|\n (i1..2).each do |i2|\n matrix[i1][i2], matrix[i2][i1] = matrix[i2][i1], matrix[i1][i2]\n end\n end\n matrix\nend",
"def transpose(matrix)\n new_matrix = Array.new(3) { Array.new }\n matrix.each_with_index do |row, row_index|\n row.each_with_index do |element, element_index|\n # binding.pry\n new_matrix[element_index][row_index] = element\n end\n end\n new_matrix\nend",
"def my_transpose\n new_array = []\n\n (0...self.length).each do |row|\n new_row = []\n\n (0...self.length).each do |col|\n new_row << self[col][row]\n \n end\n new_array << new_row\n end\n new_array\n end",
"def transpose(permute = nil)\n if permute.nil?\n if self.dim == 1\n return self.clone\n elsif self.dim == 2\n new_shape = [self.shape[1], self.shape[0]]\n else\n raise(ArgumentError, \"need permutation array of size #{self.dim}\")\n end\n elsif !permute.is_a?(Array) || permute.sort.uniq != (0...self.dim).to_a\n raise(ArgumentError, \"invalid permutation array\")\n else\n # Figure out the new shape based on the permutation given as an argument.\n new_shape = permute.map { |p| self.shape[p] }\n end\n\n if self.dim > 2 # FIXME: For dense, several of these are basically equivalent to reshape.\n\n # Make the new data structure.\n t = self.reshape_clone_structure(new_shape)\n\n self.each_stored_with_indices do |v,*indices|\n p_indices = permute.map { |p| indices[p] }\n t[*p_indices] = v\n end\n t\n elsif self.list? # TODO: Need a C list transposition algorithm.\n # Make the new data structure.\n t = self.reshape_clone_structure(new_shape)\n\n self.each_column.with_index do |col,j|\n t[j,:*] = col.to_flat_array\n end\n t\n else\n # Call C versions of Yale and List transpose, which do their own copies\n if jruby?\n nmatrix = NMatrix.new :copy\n nmatrix.shape = [@shape[1],@shape[0]]\n twoDMat = self.twoDMat.transpose\n nmatrix.s = ArrayRealVector.new(ArrayGenerator.getArrayDouble(twoDMat.getData(), shape[1],shape[0]))\n return nmatrix\n else\n self.clone_transpose\n end\n end\n end",
"def transpose(matrix)\n new_matrix = []\n matrix[0].size.times { |_| new_matrix.push(Array.new) }\n matrix.each do |array|\n # while iterating through array,\n # the next spot in each item in new_matrix gets successive items from array.\n array.size.times do |i|\n new_matrix[i] << array[i]\n end\n end\n new_matrix\nend",
"def transposed(matrix, size)\n # TODO (Step 2): Implement on CPU\n return [1.0, 2.0, 3.0, 4.0]\nend",
"def transpose(a)\n # get the number of rows and columns\n # create empty matrix where # of rows = # of columns, and vice versa\n rows = a.length\n cols = a[0].length\n newA = Array.new(cols) {Array.new(rows)}\n\n i = j = 0\n while i < rows\n while j < cols\n # swap them\n newA[j][i] = a[i][j]\n j += 1\n end\n i += 1\n # don't forget to reset j after every column\n j = 0\n end\n\n newA\nend",
"def transpose(dim_a, dim_b)\r\n FlexArray.new_from_array(self).transpose!(dim_a, dim_b)\r\n end",
"def transpose(matrix)\n row = matrix.length\n col = matrix[0].length\n res = Array.new(col) { Array.new(row)}\n (0...col).each do |i|\n (0...row).each do |j|\n res[i][j] = matrix[j][i]\n end\n end\n return res\nend",
"def transpose!(matrix)\n (0...matrix.size).each do |i|\n (i...matrix.size).each do |j|\n matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j]\n end\n end\nend",
"def transpose(matrix)\narray1 = []\narray2 = []\narray3 = []\nretrun_matrix = []\n\nmatrix.each do |element_1, element_2, element_3|\n array1 << element_1\n array2 << element_2\n array3 << element_3\n end \n retrun_matrix << array1 \n retrun_matrix << array2\n retrun_matrix << array3 \n return retrun_matrix\nend",
"def transpose(matrix)\n new_matrix = [[], [], []]\n matrix.each do |array|\n 3.times do |i|\n new_matrix[i] << array[i]\n end\n end\n new_matrix\nend",
"def transpose\n Matrix.columns(@rows)\n end",
"def transpose(matrix)\n results = Array.new(3){Array.new(3)}\n\n m = 0\n n = 0\n\n 3.times do \n results[m][n], results[m + 1][n], results[m + 2][n] = matrix[n]\n n += 1\n end\n\n results\nend",
"def transpose(matrix)\n matrix[0][0], matrix[1][0], matrix[2][0], matrix[0][1], matrix[1][1], \n matrix[2][1], matrix[0][2], matrix[1][2], matrix[2][2] = \n matrix[0][0], matrix[0][1], matrix[0][2], matrix[1][0], \n matrix[1][1], matrix[1][2], matrix[2][0], matrix[2][1], matrix[2][2] \nend",
"def transpose!(matrix)\n copy_matrix = []\n matrix.each_with_index { |row, ind| copy_matrix[ind] = row }\n matrix[0].length.times { matrix.unshift([]) }\n copy_matrix.length.times { matrix.pop }\n matrix.each_with_index do |_, n_ind|\n copy_matrix.each_with_index do |_, ind|\n matrix[ind] << copy_matrix[n_ind][ind]\n end\n end\nend",
"def my_transpose(matrix)\n transposed = []\n matrix.each_with_index do |row, i|\n new_row = []\n row.each_with_index do |ele, j|\n new_row << matrix[j][i]\n end\n transposed << new_row\n end\n transposed\nend",
"def trans(input)\n\trows, columns = input.count, input.first.count\n\tx, y = [], []\n\ti = j = 0\n\twhile j < columns do\n\t\twhile i <= rows - 1 do\n\t\t\tx.push(input[i][j])\n\t\t\ti += 1\n\t\tend\n\t\tj += 1 #go to next column\n\t\ti = 0 #reset the inner counter to go back to 1st array\n\tend\n\tx.each_slice(rows).each.map{|e| y.push(e)}\n\treturn y\nend",
"def transpositions word\n n = word.length\n (0...n-1).collect {|i| word[0...i]+word[i+1,1]+word[i,1]+word[i+2..-1] }\n end",
"def transpose(matrix)\n new_matrix = []\n (0...matrix.size).each { |index| new_matrix << column(matrix, index) }\n new_matrix\nend",
"def transpose(matrix)\n if matrix.empty? || matrix.first.empty?\n raise ArgumentError\n end\n result = Array.new(matrix.first.length) { Array.new(matrix.length, 0) }\n matrix.each_with_index do |row, x|\n row.each_with_index do |val, y|\n result[y][x] = val\n end\n end\n result\nend",
"def challenge137(input)\n # Using the built-in transpose method.\n # Could have used the 'safe transpose' method found in http://www.matthewbass.com/2009/05/02/how-to-safely-transpose-ruby-arrays/\n # but I figured I'd go the padding route to learn something (I'm new to ruby).\n transposed_array = normalize_array(input.lines).transpose\n transposed_array.each { |line| p line }\nend",
"def my_transpose(matrix)\n #algorithm\n for i in 0...matrix[0].length\n for j in (i + 1)...matrix[0].length\n temp = matrix[i][j]\n matrix[i][j] = matrix[j][i]\n matrix[j][i] = temp\n end\n end\n\n #printer\n for k in (0..(matrix[0].length-1))\n puts matrix[k].join(\" \")\n end\n matrix\nend",
"def transpose(transformation)\n a = transformation.to_a\n\n Geom::Transformation.new([\n a[0], a[4], a[8], 0,\n a[1], a[5], a[9], 0,\n a[2], a[6], a[10], 0,\n 0, 0, 0, a[15]\n ])\n end",
"def transpose\n return Matrix.new @rows.transpose\n end",
"def My_Transpose(nums) \n transposed_matrix=[]\n givens_0=nums[0]\n givens_1=nums[1]\n givens_2=nums[2]\n \n transposed_matrix[0]=[givens_0[0],givens_1[0],givens_2[0]]\n transposed_matrix[1]=[givens_0[1],givens_1[1],givens_2[1]]\n transposed_matrix[2]=[givens_0[2],givens_1[2],givens_2[2]]\n \n puts(\"the first row of the transposed_matrix[0] is #{transposed_matrix[0]}\")\nend",
"def transposition\n (0...length-1).map { |i|\n string[0...i] +\n string[i+1, 1] +\n string[i,1] +\n string[i+2..-1]\n }.uniq\n end",
"def matrix_transpose(matrix)\r\n m_row = 0\r\n t_col = 0\r\n result = []\r\n while matrix[m_row]\r\n m_col = 0\r\n t_row = 0\r\n while matrix[m_row][m_col]\r\n result.push([])\r\n result[t_row][t_col] = matrix[m_row][m_col]\r\n m_col += 1\r\n t_row += 1\r\n end\r\n m_row += 1\r\n t_col += 1\r\n end\r\n return result\r\nend",
"def transpose\n FMatrix.new(@cols, @rows) do |matrix, row, col|\n matrix.set!(row, col, self.get(col, row))\n end\n end",
"def transpose(matrix)\n result = Array.new(matrix[0].length, []) #HARD - PASS BY REFERENCE ISSUE\n matrix.each do |row|\n row.each_with_index do |el, col_idx|\n result[col_idx] << el\n end\n end\n result\nend",
"def normalized_transpose(pad='')\n sizes = row_sizes\n min_size = sizes.min\n max_size = sizes.max\n source = if min_size != max_size # Multiple row sizes\n map{|row| row + [pad]*(max_size - row.size)}\n else\n source = self\n end\n source.transpose\n end",
"def transpose\n result = self.class.new(cols, rows)\n _transpose_memcpy(result.gsl, self.gsl)\n result\n end",
"def transpose(matrix)\n\t#\n\t# your code goes here\n result = [] #empty arr as accumulator\n i = 0\n while i < matrix.length #iterates trhough matrix\n array = []\n matrix.each do |sub_matrix| #iterates through sub_matrix\n array << sub_matrix[i] #sends elements to array\n end\n result << array #sends new sub-array to result\n i += 1\n end\n\n result\nend",
"def transpose(matrix)\n new_row_0 = []\n new_row_1 = []\n new_row_2 = []\n\n matrix.each do |row|\n new_row_0 << row[0] \n new_row_1 << row[1]\n new_row_2 << row[2]\n end\n p [new_row_0, new_row_1, new_row_2]\nend",
"def transpose!(matrix)\n (0...matrix.size).each do |row|\n (0...matrix.size).each do |col|\n matrix[row][col], matrix[col][row] =\n matrix[col][row], matrix[row][col] if row < col\n end\n end\nend",
"def transpose(ciphertexts)\n max = ciphertexts.max_by(&:size).size # The maximum (and necessarily common) column size is that of the lengthiest ciphertext.\n ciphertexts.map { |c| c.chars.values_at(0...max) }.transpose.map(&:join)\nend",
"def transpose(matrix)\n result = []\n (0..2).each do |column_index|\n new_row = (0..2).map { |row_index| matrix[row_index][column_index] }\n result << new_row\n end\n result\nend",
"def transpose_of_matrix matrix\n\treturn Matrix.new(matrix.line, matrix.col, matrix.values.transpose)\nend",
"def transpose(matrix)\n new_matrix = []\n\n new_matrix_size = matrix[0].size\n\n new_matrix_size.times do |old_column|\n new_row = []\n\n matrix.size.times do |old_row|\n new_row << matrix[old_row][old_column]\n end\n\n new_matrix << new_row\n end\n\n new_matrix\nend",
"def transpositions\n new_words = []\n @words.each do |word|\n @word = word || '' \n new_words += (0..length-1).map { |i| \"#{@word[0...i]}#{@word[i+1, 1]}#{@word[i,1]}#{@word[i+2..-1]}\" }\n end\n new_words\n end",
"def transpose(matrix)\n transpose_matrix = []\n matrix.each_with_index do |row, row_index|\n row.each_with_index do |item, col_index|\n if transpose_matrix[col_index] == nil\n transpose_matrix[col_index] = [] # cannot use a[index] << [] as it will raise error as a[index] return nil which do not have << method\n end\n transpose_matrix[col_index][row_index] = item\n end\n end\n \n transpose_matrix\nend",
"def transpose\n first_row = @list[0]\n other_rows = @list[1..-1]\n @list = first_row.zip(*other_rows)\n self\n end",
"def transpose(matrix)\n transposed = []\n num_columns = matrix.first.length\n num_rows = matrix.length\n\n (0...num_columns).each do |col|\n row_to_add = []\n (0...num_rows).each do |row|\n row_to_add << matrix[row][col]\n end\n transposed << row_to_add\n end\n\n # another version:\n # (0...num_columns).each do |column_index|\n # new_row = (0...num_rows).map do |row_index|\n # matrix[row_index][column_index]\n # end\n # result << new_row\n # end\n\n transposed\nend",
"def get_transpose()\n transpose_graph = Graph.new(26)\n\n for i in 0..@number_of_vertices -1 do\n @adjacent_list[i].each do |x|\n transpose_graph.add_edge(x, i)\n end\n end\n\n transpose_graph\n end",
"def transpose\n\n # pre-conditions and invariants\n _invariants\n\n newDelegate = @delegate.clone\n newDelegate.transpose\n\n newMatrix = SparseMatrix.new(newDelegate)\n\n # post-conditions and invariants\n _invariants\n assert_equal(self.row_size,newMatrix.column_size,\"post-condition\")\n assert_equal(self.column_size,newMatrix.row_size,\"post-condition\")\n (0..self.row_size-1).each { |i|\n (0..self.column_size-1).each { |j|\n assert_equal(self[i,j],newMatrix[j,i],\"post-condition\")\n }\n }\n\n return newMatrix\n end",
"def do_transpose(character_matrix)\n replace_nil_with_space = ->(char) { char || ' ' }\n\n character_matrix\n .each_with_index\n .each_with_object([]) { |row_pair, arr| transpose_row_to_column(row_pair, arr) }\n .map { |row| row.map(&replace_nil_with_space) }\n end",
"def two_d_translate(array)\n new_arr = []\n array.each do |arr|\n arr[1].times {new_arr << arr[0]}\n end\n new_arr\nend",
"def transpose(matrix)\n new_matrix = []\n\n column = 0\n while column < matrix.size\n new_row = []\n\n row = 0\n while row < matrix.size\n new_row << matrix[row][column]\n row += 1\n end\n\n new_matrix << new_row\n column += 1\n end\n\n new_matrix\nend",
"def rotate_90(array)\n a = copy array\n a.transpose.map { |e| e.reverse }\nend",
"def flip_horizontally(array)\n\tif array[1].kind_of?(Array)\n\t\tfor item in array\n\t\t\titem.reverse!\n\t\tend\n\telse \n\t\tarray.reverse!\n\tend\n\treturn array\nend",
"def converted_arrays; end",
"def flip_horizontal(matrix)\n matrix.map(&:reverse)\n end",
"def transpose(tensor, perm = nil, name: \"transpose\")\n _op(:transpose, tensor, perm, name: name)\n end",
"def transpose\n \n load_parent_state\n \n return super\n\n end",
"def transpose(matrix)\n #\n # your code goes here\n #\n i = 0\n while i < matrix.length\n j = i\n while j < matrix.length\n if i != j\n temp_value = matrix[i][j]\n matrix[i][j] = matrix[j][i]\n matrix[j][i] = temp_value\n end\n j += 1\n end\n i += 1\n end\n matrix\nend",
"def ltranspose()\n Enumerator.new do |out|\n catch(:nothing_to_do) do\n # If any Enumerable is empty, then yield nothing\n enums = self.lmap{|e| e.ensure_enum}.\n touch{|e| throw :nothing_to_do if e.empty?}.\n to_a\n \n loop do\n out.yield enums.map{|e| e.next}\n end\n end\n end\n end",
"def two_d_translate(arr)\n result = []\n\tarr.each do |subArray|\n subArray[1].times do \n result.push(subArray[0])\n end\n end\n return result\nend",
"def transpose(tensor, perm: nil, name: 'transpose')\n _op(:transpose, tensor, nil, perm: perm, name: name)\n end",
"def conjugate_transpose\n self.transpose.complex_conjugate!\n end",
"def column_stack(arrays)\n arys = arrays.map do |a|\n a = cast(a)\n case a.ndim\n when 0; a[:new,:new]\n when 1; a[true,:new]\n else; a\n end\n end\n concatenate(arys,axis:1)\n end",
"def rotate_matrix(array)\n\n\nend",
"def transpose!\n _transpose(self.gsl)\n @size = [@gsl[:rows], @gsl[:cols]]\n self\n end",
"def row; reshape(1, length); end",
"def cross_array(*enumerables)\n # return to_a.product(*enumerables.map{|e| e.to_a})\n enumerables.unshift self\n result = [[]]\n while !enumerables.empty?\n t, result = result, []\n b, *enumerables = enumerables\n t.each do |a|\n b.each do |n|\n result << a + [n]\n end\n end\n end\n result\n end",
"def flatten\n\t\tmake_flat(@array)\n\tend",
"def vstack(arrays)\n arys = arrays.map do |a|\n _atleast_2d(cast(a))\n end\n concatenate(arys,axis:0)\n end",
"def vconcat(*matrices)\n concat(*matrices, :row)\n end",
"def rotate_ninety_degs(array,direction='clockwise')\n if direction == 'clockwise'\n return array.transpose.reverse\n else\n return array.transpose.each{|x| x.reverse!}\n end\nend"
] | [
"0.8092258",
"0.79717743",
"0.7724703",
"0.75800276",
"0.75800276",
"0.7423364",
"0.73696876",
"0.73085773",
"0.7300054",
"0.7278257",
"0.72656065",
"0.723977",
"0.72277904",
"0.7211921",
"0.71967477",
"0.7188553",
"0.7178558",
"0.7175899",
"0.7144891",
"0.7133072",
"0.7066796",
"0.7057596",
"0.70473003",
"0.69939953",
"0.6942301",
"0.6940821",
"0.6918196",
"0.6858422",
"0.68057513",
"0.6767353",
"0.6765368",
"0.6747117",
"0.6730489",
"0.67282313",
"0.6684018",
"0.6682817",
"0.6678238",
"0.6650961",
"0.664554",
"0.66446346",
"0.66140264",
"0.65944034",
"0.6574316",
"0.65681964",
"0.651919",
"0.64977473",
"0.649561",
"0.6490075",
"0.6489248",
"0.6445897",
"0.6438244",
"0.6435934",
"0.6414617",
"0.6392904",
"0.63766146",
"0.6376585",
"0.6346606",
"0.63273865",
"0.6323746",
"0.6303527",
"0.62428606",
"0.6231982",
"0.6183819",
"0.6182272",
"0.6171097",
"0.6170176",
"0.61234325",
"0.6116617",
"0.61094296",
"0.6072375",
"0.60703075",
"0.606351",
"0.6038683",
"0.6032356",
"0.5928364",
"0.58931553",
"0.5872819",
"0.5827914",
"0.58070546",
"0.57741493",
"0.5737202",
"0.5733307",
"0.5714538",
"0.569347",
"0.5649091",
"0.5642489",
"0.5634176",
"0.560674",
"0.5598509",
"0.5597845",
"0.5589308",
"0.5582067",
"0.5580795",
"0.5572279",
"0.5567701",
"0.5538373",
"0.55372125",
"0.55326796",
"0.5526172",
"0.5498996"
] | 0.63133085 | 59 |
number as an arg 1 2 4 8 16 32 64 ... 2n | def power_of_two?(number)
(0..number).each do|num|
# 2**num == 16
if 2**num == number
return true
end
if 2**num > number
return false
end
end
return "problem"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def numbers(n)\n\nend",
"def next_number(n)\n\t\t(n).map{|n|n+2}\n\tend",
"def getNumber _args\n \"getNumber _args;\" \n end",
"def range_number(n,t)\n\t\t(n).step(t){|n|n+2}\n\tend",
"def number=(_arg0); end",
"def parseNumber _args\n \"parseNumber _args;\" \n end",
"def slippery_numbers(n)\nend",
"def double_digit_value(n)\n n *= 2\n # if a digit in the id sequence has to be doubled then\n # it may have 2 digits\n # if that is the case, we need to add the 2 digits separately\n if n >= 10\n # the first digit of n*2 is always one since 0 <= n <= 9\n # the second digit of n*2 is (n*2) % 10\n 1 + (n % 10)\n else\n n\n end\n end",
"def on_numeric(n)\n n\n end",
"def on_numeric(n)\n n\n end",
"def x(n)\n end",
"def magic_numbers(count)\nend",
"def single_number(nums)\n\nend",
"def number_counting_seq(n)\r\n\r\nend",
"def n(num)\n num.to_s.reverse.gsub(/...(?=.)/,'\\&,').reverse\n end",
"def double(n)\n n.to_i * 2\n end",
"def numbers_mand(n1,n2,n3)\n\t\t@num1 = n1\n\t\t@num2 = n2\n\t\t@num3 = n3\n\tend",
"def number_in_a_can(number = 10)\n number.times { |n| puts \"The number is #{n}\" }\nend",
"def do_this_with_parameter(a_number)\n # Do something with that number\n end",
"def super_digit(n)\n super_digit_helper({}, n)\n \nend",
"def number(nth)\n if nth <= 0\n 0\n elsif nth == 1\n 1\n else\n number(nth - 1) + number(nth - 2)\n end\n end",
"def format_int(n)\n return - 2**31 if n < -2**31\n return 2**31 - 1 if n > 2**31 - 1\n n\nend",
"def int_n! n\n value = 0\n [\n [8, 'Q>'],\n [4, 'N'],\n [2, 'n'],\n [1, 'C'],\n ].each do |nbytes, fmt|\n shift = nbytes * 8\n while n > nbytes\n value = (value << shift) | unpack_one!(fmt)\n n -= nbytes\n end\n end\n value\n end",
"def captiveNum _args\n \"captiveNum _args;\" \n end",
"def mod11(number); end",
"def s(n)\n n.to_s.gsub(/\\d/) { |d| d.to_i**2 }.to_i\nend",
"def write_bignum(*n); end",
"def f(n)\n sum = (\"1\"*n).to_i # the last number of the sequence is n 1's\n # start with single digit if possible\n sum += n if n.to_s.length == 1\n # 2 digits next\n x = 2\n puts terms_of_n_with_length_x(n,x).inspect\n puts \"got here\"\n puts n-1\n (1..(n-1)).to_a.reverse.each do |x|\n puts x\n puts eat_2s(x)\n end\n return sum\nend",
"def f n\n a 0,n\nend",
"def to_i4(n)\n head, num, *tail = n\n num.nil?? head : to_i4([head*10+num, *tail])\nend",
"def numbers\n %w[1 2 3 4 5 6 7 8 9 0\n tenth ninth eighth seventh sixth fifth fourth third second first\n ten nine eight seven six five four three two one ]\n end",
"def blair_nums(n)\n local_cache = build_blair_cache(n)\n local_cache[n]\n end",
"def big_numbers(array_of_integers)\n # TODO\nend",
"def short_number(prenumber,n) \n @str = prenumber.to_s + to_n(Time.now.sec.to_s,2).to_s\n return to_n(@str,n)\n end",
"def persistence(n)\n count = 0\n while n > 9 do\n n = n.digits.inject(:*)\n count += 1\n end\n count\nend",
"def extraNumber(a, b, c)\n \nend",
"def consume_number; end",
"def lucas_numbers(n)\n if n === 0\n return 2\n elsif n === 1\n return 1\n elsif n < 0\n #we call this hacking ;)\n return 7\n else\n series = [2, 1]\n for index in 2..n\n series << (series[index-2] + series[index-1])\n end\n return series.last\n end\nend",
"def last_n_digits(num, n)\r\n # your code goes here\r\n num % 10**n\r\nend",
"def number; end",
"def number; end",
"def next_number(num)\n num + 1\n end",
"def digitize(n)\n split_array_numbers = n.to_s.split(//).map { |x| x.to_i}.reverse\nend",
"def dateToNumber _args\n \"dateToNumber _args;\" \n end",
"def decent_number(n)\n\tleft = 0\n\tright = 0\n\t(n+1).times do |i|\n\t\tleft = n - i \n\t\tright = n - left\n\t#\tputs \"#{left}%3 = #{left%3} | #{right}%5 = #{right%5}\"\n\t\tbreak if left % 3 == 0 && right % 5 == 0\n\tend\n\t#puts \"**l = #{left} r = #{right}\"\n\n\tif left % 3 == 0 && right % 5 == 0\n\t\tfives = \"5\"*left\n\t\tthrees = \"3\"*right\n\t\tputs fives+threes\n\telse\n\t\tputs -1\n\tend\nend",
"def integer_break(n)\nend",
"def next_number(n)\n n.even? ? n/2 : 3*n+1\nend",
"def persistence(n, count = 0)\n return count if n < 10\n i = 0\n arr = n.to_s.split('')\n if arr.length > 1\n tot = arr.map(&:to_i).inject(:*)\n i += 1\n count += 1\n tot.to_i >= 10 ? persistence(tot.to_i, count) : count\n end\nend",
"def s1 number\n number % 2\nend",
"def s1 num\n\tnum % 2\nend",
"def sum(n=16) end",
"def number(num)\n\ta = 8\n\tputs \"method #{a}\"\nend",
"def primes(num)\n \nend",
"def primes(num)\n \nend",
"def primes(num)\n \nend",
"def primes(num)\n \nend",
"def powers_of_two(n)\n (0..n).map{ |number| 2**number }\nend",
"def persistence(n)\n n < 10 ? 0 : 1 + persistence(n.digits.reduce(&:*))\nend",
"def number(N)\r\n N =gets.strip.to_i\r\n if\r\n ( N%2==1 || N>5 && N <= 20)\r\n puts \"Weird\"\r\n else\r\n puts \"Not Weird\"\r\n end\r\nend",
"def Integer(p0) end",
"def exponent(b, n)\n\nend",
"def exponent(b, n)\n\nend",
"def exponent(b, n)\n\nend",
"def to_param\n number.to_s\n end",
"def primes(n)\nend",
"def num; end",
"def num; end",
"def s(n)\n ((9*n-1)*(10**n)+1)/9\nend",
"def nthPrime(nth)\n # TODO\nend",
"def reversed_number(num)\n\nend",
"def digit_match(n, m)\n\nend",
"def converter(n, decimals=0, base=$pi)\r\n #your code here\r\nend",
"def digitize(n)\n n.digits\nend",
"def ceil _args\n \"ceil _args;\" \n end",
"def num_of_num(number)\n\tnumber_of_num=1\n\tnumber_size=number.to_s.size\n while number_size > 1 do\n number_of_num = number_of_num * \tnumber_size\n number_size = number_size - 1 \n end\n return number_of_num\nend",
"def number2\n self.number('number2','key2')\n end",
"def number1\n number[0...Phonie.configuration.n1_length]\n end",
"def exercise_119 (number)\n end",
"def initialize(number)\r\n @number = number.to_i #.to_i to perform the math as an integer so there are no discrepancies\r\n end",
"def number_joy(n)\na = n.to_s.chars.map(&:to_i).reduce(:+)\nb = a.to_s.reverse.to_i\n(a * b) == n\nend",
"def digit; end",
"def twice_as_big(num)\n num + num\nend",
"def square(n)\r\n n * n\r\n end",
"def digitize(n)\n n.to_s.chars.map(&:to_i)\nend",
"def digitize(n)\n n.to_s.chars.map(&:to_i)\nend",
"def persistence(n)\n multiples = []\n until n.to_s.chars.count < 2 do\n n = n.to_s.chars.map(&:to_i).inject(:*)\n multiples << n\n end\n multiples.count\nend",
"def next_number(number)\n\n return number + 1\n\nend",
"def next_number(number)\n return number +1\nend",
"def integer(i, n)\n limit = 2**n - 1\n return [i].pack('C') if (i < limit)\n\n bytes = []\n bytes.push limit if !n.zero?\n\n i -= limit\n q = 1\n\n while (q > 0) do\n q, r = i.divmod(128)\n r += 128 if (q > 0)\n i = q\n\n bytes.push(r)\n end\n\n bytes.pack('C*')\n end",
"def nth_prime(n)\n\nend",
"def number2\n n2_length = number.size - Phonie.configuration.n1_length\n number[-n2_length, n2_length]\n end",
"def two_digit_format(n)\n\n arr = n.to_s.split(//)\n \n if arr.length == 0\n return '0' + arr[0]\n elsif arr.length >=3\n return\n else\n return n.to_i\n end\n\nend",
"def initialize(number)\n @num = number\n end",
"def next_number(number)\n if number.even?\n number / 2\n else\n 3 * number + 1\n end\nend",
"def quo(n) end",
"def many_results(n)\r\n\treturn 1, n /2, n\r\nend",
"def base_converter(num, b)\n\nend",
"def l(x)\n 2 * ( x + 1 ) - @n\n end",
"def bunny(n)\n raise ArgumentError if n < 0\n if n == 0 # base case\n return 0\n else\n return bunny(n - 1) + 2\n end\nend",
"def call1(n)\n p n # => 0\n 1 + n\nend",
"def multiply_by_five(n)\n n.to_i * 5\nend"
] | [
"0.71995646",
"0.7008653",
"0.6834752",
"0.67906225",
"0.6764885",
"0.66145533",
"0.65578246",
"0.6538081",
"0.6496248",
"0.6496248",
"0.64493865",
"0.6446884",
"0.64048046",
"0.632517",
"0.6312935",
"0.6264367",
"0.6232891",
"0.6226489",
"0.61818165",
"0.6179881",
"0.61283976",
"0.61192536",
"0.6099274",
"0.609477",
"0.60779256",
"0.6075383",
"0.6056593",
"0.6054748",
"0.6028804",
"0.60250986",
"0.6021618",
"0.59869367",
"0.598362",
"0.59829915",
"0.59818476",
"0.5958514",
"0.59563434",
"0.5947484",
"0.59469885",
"0.59326226",
"0.59326226",
"0.5921946",
"0.5909491",
"0.58921653",
"0.58815885",
"0.587347",
"0.586703",
"0.58550674",
"0.58503866",
"0.5846348",
"0.58446145",
"0.5843074",
"0.58364165",
"0.58364165",
"0.58364165",
"0.58364165",
"0.58290625",
"0.5828206",
"0.5814221",
"0.58119196",
"0.57941663",
"0.57941663",
"0.57941663",
"0.57939756",
"0.57927424",
"0.5790741",
"0.5790741",
"0.57895595",
"0.57866997",
"0.5784636",
"0.5782606",
"0.5782061",
"0.57788837",
"0.5777645",
"0.5766674",
"0.5759141",
"0.5758881",
"0.57550657",
"0.5750561",
"0.57436526",
"0.5738978",
"0.5738459",
"0.57365096",
"0.57331675",
"0.57331675",
"0.572643",
"0.5721171",
"0.5720107",
"0.5719635",
"0.57188195",
"0.5713509",
"0.5708425",
"0.56983685",
"0.5693674",
"0.5691569",
"0.5685162",
"0.5684831",
"0.56778514",
"0.56651175",
"0.5664468",
"0.5661976"
] | 0.0 | -1 |
TODO: needs to check all the way up a given tree. | def no_circular_reference
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_tree(tree)\n\nend",
"def test_recursive_methods\n assert_equal 0, find_node(1).ancestors_r.size\n assert_equal 8, find_node(1).descendants_r.size\n assert_equal 4, find_node('1_1_2_1_1').ancestors_r.size\n end",
"def valid_tree?\n true\n end",
"def valid_tree?\n true\n end",
"def parsed_tree; end",
"def leaf?; false end",
"def valid_tree?\n false\n end",
"def item_check(tree)\n if tree[0] == nil\n tree[1]\n else\n tree[1] + item_check(tree[0]) - item_check(tree[2])\n end\nend",
"def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend",
"def recursive => nil",
"def explore_upwards(node)\n node = node.parent until node.parent.nil? || node.parent.left == node\n node.parent.nil? ? nil : node.parent.data\nend",
"def is_subtree(root)\n\nend",
"def see_tree(tree)\n tree.each do |i|\n puts \"---------------\"\n puts \"Node: #{i.value}\"\n puts \"Parent: \" + i.find_parent[0].value.to_s if i.find_parent.count > 0\n puts \"Left Child: \" + i.find_left_child[0].value.to_s if i.find_left_child.count > 0\n puts \"Right Child: \" + i.find_right_child[0].value.to_s if i.find_right_child.count > 0\n end\nend",
"def test_depth_two_levels\n @tree.insert(\"a\")\n @tree.insert(\"b\")\n assert_equal 1, @tree.depth_of?(\"b\")\n end",
"def test_depth_value_not_exist\n @tree.insert(\"c\")\n refute_equal 0, @tree.depth_of?(\"a\")\n end",
"def test_depth_three_levels\n @tree.insert(\"c\")\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n assert_equal 2, @tree.depth_of?(\"a\")\n end",
"def tree_checker(map,right,down)\n horz = 0\n counter = 0\n vert = down\n map.each_with_index do |val, _i|\n break if vert > map.length - 1\n\n row_size = val.length\n horz = (horz + right) % row_size\n counter += 1 if map[vert][horz] == \"#\"\n vert += down\n end\n counter\nend",
"def valid_tree?\n true\n end",
"def recursiveTreeTraversal(element)\n begin\n requirementsTree = findRequirementsTree(element)\n unless requirementsTree == nil\n checkForDuplicateRoots(requirementsTree)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\n rescue SystemStackError\n $logger.log(\"Recursive Issue1: \" + element.getName())\n end\nend",
"def leaf?; @leaf; end",
"def bottoms_up_method\n\t\t# 1. take the nodes that went the farthest (i.e.: max tree level)\n\t\tmax_level = @tree.tree_bottom.collect(&:level).max\n\t\t# 2. Of those, use the one with the minimum sum value\n\t\twinner = @tree.tree_bottom.select{|t|t.level==max_level}.min_by(&:sum)\n\t\t# binding.pry \n\t\tbottoms_up_dir(winner).dir\n\tend",
"def test_return_method_falsey\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n refute_equal true, @tree.includes?(\"c\")\n end",
"def tree_search(problem, fringe)\n # \"\"\"Search through the successors of a problem to find a goal.\n # The argument fringe should be an empty queue.\n # Don't worry about repeated paths to a state. [Fig. 3.8]\"\"\"\n # Since we dont worry about repeated paths this can lead to infinite loops\n fringe.append(Node.new(problem.initial))\n while fringe.len > 0\n node = fringe.pop()\n return node if problem.goal_test(node.state) if node\n fringe.extend(node.expand(problem)) if node\n end\n return nil\nend",
"def recursiveTreeTraversal(element)\n if StereotypesHelper.hasStereotype(element, $veStereotype)\n findRefinedParameters(element)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\nend",
"def check_integrity(list)\n complete = list.to_a\n 1.upto(list.level) do |l|\n #if anything in the higher layer wasn't in layer 0\n difference = list.to_a(nil,nil,nil,l) - complete\n puts \"stray node found in level: #{l} which is #{list.to_a(nil,nil,nil,l)}\" if !difference.empty? \n expect(difference).to match_array([])\n end\nend",
"def test_return_method_truthy\n @tree.insert(\"a\")\n @tree.insert(\"c\")\n assert_equal true, @tree.includes?(\"c\")\n end",
"def check(node); end",
"def test_sort_by_ancestry_missing_parent_middle_of_tree\n AncestryTestDatabase.with_model do |model|\n n1, _, _, n4, n5, _ = build_tree(model)\n\n records = model.sort_by_ancestry([n5, n4, n1])\n if CORRECT\n assert_equal [n1, n4, n5].map(&:id), records.map(&:id)\n else\n assert_equal [n1, n5, n4].map(&:id), records.map(&:id)\n end\n end\n end",
"def dfs_object(root_node, target)\n #two base cases\n return root_node if root_node.value == target\n # return nil if root_node.parent.nil? #when there are no parents, we know we're back at the actual root of the tree\n\n root_node.children.each do |child_node|\n result = dfs(child_node, target)\n\n #returning nil at this point would cut short\n if result #is not nil\n return result\n end\n end\n\n nil\nend",
"def is_leaf\n true\n end",
"def is_leaf\n true\n end",
"def test_depth_of_value_returns_depth_1_node\n @tree.insert(\"a\")\n assert_equal 0, @tree.depth_of?(\"a\")\n end",
"def test(list)\n complete = list.to_a\n 1.upto(list.level) do |l|\n #if anything in the higher layer wasn't in layer 0\n difference = list.to_a(nil,nil,nil,l) - complete\n puts \"test failed level #{l} ,inconsistent node(s) #{difference}\" if (difference.count != 0)\n end\n puts \"test complete\"\nend",
"def tree(name, finder, partial = T.unsafe(nil), seen = T.unsafe(nil)); end",
"def leaf?\n true\n end",
"def recursiveTreeTraversal(element)\n if StereotypesHelper.hasStereotype(element, $veStereotype)\n findOrCreateRefinedParameters(element)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\nend",
"def validate_bst(tree)\n\n return validate_bst_helper(tree, - 1.0 / 0, 1.0 / 0)\n\nend",
"def dfs_recursive(query, node=@tree) \n return nil if node.nil?\n return node if query == node.value\n\n# left search equals if the left child is not nil then call the method with target & left child node parameters, otherwise is nil\n left_search = node.left_child != nil ? dfs_recursive(query, node.left_child) : nil\n\n# return if left search does not result in nil\n return left_search if left_search != nil\n right_search = node.right_child != nil ? dfs_recursive(query, node.right_child) : nil\n return right_search if right_search != nil \n end",
"def test_tree_representation\n e =\n'ROOT (0.94)\n outlook => rainy (0.694)\n windy => TRUE (0.0)\n play => no (0.0)\n windy => FALSE (0.0)\n play => yes (0.0)\n outlook => overcast (0.694)\n play => yes (0.0)\n outlook => sunny (0.694)\n humidity => normal (0.0)\n play => yes (0.0)\n humidity => high (0.0)\n play => no (0.0)\n'\n assert_equal e, @tree.to_s\n end",
"def DFS(root, target)\n ## base case: \n return nil if root.nil?\n return root if root.value == target\n ##indecutive step: \n ## DFS on the left side then DFS on the right side \n root.children.each do |child|\n search_result = DFS(child, target) ## better to save the actual value then check the value then return nil\n return search_result unless search_result.nil?\n end \n return nil\nend",
"def test_depth_of_method_returns_nil\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n tree.insert(45, \"movie b\")\n assert_nil tree.depth_of(35)\n end",
"def traverse; end",
"def test_should_block_recursion_in_tree\n group = Group.find @greeks_group.id\n\n assert_raises(RecursionInTree) { group.parent = Group.find @cretes_group.id }\n end",
"def depth; end",
"def tree\n @tree ||= build_tree\n end",
"def tes_gettree\n tree = []\n Accounts.matches_by_account_id(0).to_a.each { |a|\n a.get_tree { |b| tree.push b.rev_index }\n }\n tree_d = []\n Accounts.matches_by_account_id(0).to_a.each { |a|\n a.get_tree_debug { |b| tree_d.push b.rev_index }\n }\n\n assert_equal 389, tree.count\n assert_equal 389, tree_d.count\n end",
"def dfs_rec(tree, value)\n return nil if tree.nil?\n\n left = dfs_rec(tree.left, value)\n return left if left && left.value == value\n\n\n right = dfs_rec(tree.right, value)\n return right if right && right.value == value\n\n p tree.value\n return tree if tree.value == value\n\nend",
"def scanned_node?(node); end",
"def depth_of(score)\n if include?(score) #This is calling the method on line 44\n 1 + @root_node.depth_of(score) \n else \n nil\n end \nend",
"def validate\n if (depth != parent.depth+1)\n no(\"#{short} has bad depth\")\n end\n ui.puts \"#{indent}ok (depth: #{depth})#{short}\"\n end",
"def size(tree)\n if isEmpty?(tree)\n 0\n else\n 1 + size(tree.left) + size(tree.right)\n end\nend",
"def sum_of_left_leaves(root)\nend",
"def test_insert_returns_depth_0_if_just_root\n return_value = @tree.insert(\"a\")\n assert_equal 0, return_value\n end",
"def print_tree(tree)\n return \"-\" if tree.nil?\n puts \"#{tree.value}: \"\n print \"Left: \"\n puts \"#{print_tree(tree.children[0])}\"\n print \"Right: \"\n puts \"#{print_tree(tree.children[1])}\"\nend",
"def delete_tree(tree) # ruby里无效\n return if tree.nil?\n delete_tree(tree.left)\n delete_tree(tree.right)\n tree = nil\nend",
"def dfs_rec(tree, value)\n return nil if tree.nil?\n\n p tree.value\n return tree if tree.value == value\n\n left = dfs_rec(tree.left, value)\n return left if left && left.value == value\n\n\n right = dfs_rec(tree.right, value)\n return right if right && right.value == value\n\nend",
"def traverse(map, right, down)\n bottom = map.count\n x, y, level, trees = 0, 0, 1, 0\n\n while level < bottom do\n x += right\n y += down\n trees += 1 if map[y][x.remainder(map[0].size)] == \"#\"\n level += down\n end\n trees\nend",
"def checkForDuplicateRoots(reqTree)\n reqTreeRootName = reqTree.root.name\n if reqTree.size == 1\n # $logger.log(reqTreeRootName + \" has no derived objects\")\n return\n end\n counter = 0\n for leaf in reqTree.each_leaf\n ancestry = leaf.parentage\n ancestry.unshift(leaf)\n ancestry.delete_at(-1)\n duplicates = ancestry.each_index.select { |i| ancestry[i].name == reqTreeRootName }\n for duplicate in duplicates\n $logger.log(ancestry[duplicate + 1].name + \" refers to \" + reqTreeRootName)\n counter += 1\n end\n if $printTree\n $logger.log(\"L: \" + leaf.name)\n for node in ancestry\n $logger.log(node.name)\n end\n end\n end\n # if counter == 0\n # $logger.log(reqTreeRootName + \" has no cyclical requirements\")\n # end\nend",
"def traverse_tree?(positions, letters, game)\n return true if letters == []\n next_positions = indexes_of_letter(letters.shift, game)\n positions.each do |position|\n neighbours = adjacent_from_array(position, next_positions)\n return traverse_tree?(neighbours, letters, game) if neighbours.any?\n end\n return false\nend",
"def test_depth_of_method\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n tree.insert(45, \"movie b\")\n tree.insert(40, \"movie c\")\n tree.insert(35, \"movie d\")\n assert_equal 3, tree.depth_of(35)\n end",
"def collect_tree_up_from (foliage,\n parents,\n except_homepage,\n except_page,\n except_with_children)\n ancestry_string = parents.collect {|x| x.id.to_s }.join(\"/\")\n name_prefix = parents.collect {|x| x.title }.join(\" / \")\n name_prefix += \" / \" if name_prefix.present?\n\n our_mans_indexes = []\n foliage.each_index do |indx|\n if foliage[indx].ancestry.to_s == ancestry_string\n our_mans_indexes << indx\n end\n end\n\n leaves = []\n\n our_mans_indexes.reverse!\n our_mans_indexes.each do |indx|\n leaves << foliage.delete_at(indx)\n end\n\n leaves.sort! {|a,b| (a.prior == b.prior) ? a.id <=> b.id : a.prior <=> b.prior }\n result = []\n\n leaves.each do |leaf|\n do_writing = true\n if (except_page && leaf == except_page) || (except_homepage && leaf.home?)\n do_writing = false\n end\n result << [ name_prefix + leaf.title, leaf.id ] if do_writing\n unless do_writing == false && except_with_children\n result += collect_tree_up_from foliage,\n (parents + [ leaf ]),\n except_homepage,\n except_page,\n except_with_children\n end\n end\n\n result\n end",
"def verify\n 1.upto(@leaf_count - 1) do |node|\n next if @nodes[node] ==\n HashTree.node_hash(node, @nodes[HashTree.left_child(node)],\n @nodes[HashTree.right_child(node)])\n raise \"Tree integrity verification failed\" \n end\n self\n end",
"def test_node_1_has_0_ancestors_after_building_ancestors_ids_attribute\n id=1\n assert_equal 0, find_node(id).ancestors.size\n assert find_node(id).update_ancestor_ids\n assert_equal 0, find_node(id).ancestors.size\n end",
"def build_tree( n , d )\n \n if d.key?('v')\n n < d['v'] ? build_tree(n , d['l']) : build_tree(n, d['r'])\n else\n d['l'] = {}\n d['v'] = n\n d['r'] = {}\n end\n \nend",
"def test_total_depth\n @t1 = @trees[\"((A,B),(C,D));\"]\n foo = parse_tree(@t1) # gets the root @node\n\n assert_equal 3, total_depth(foo, 0)\n\n @t2 = @trees[\"((raccoon:19.19959,bear:6.80041):0.84600,\n ((sea_lion:11.99700, seal:12.00300):7.52973, \n ((monkey:100.85930,cat:47.14069):20.59201,weasel:18.87953):2.09460):3.87382,dog:25.46154);\"]\n bar = parse_tree(@t2)\n\n assert_equal 6, total_depth(bar, 0)\n\n blorf = parse_tree(\"(A,B,C)\")\n assert_equal 1, total_depth(blorf,0)\n\n blorf2 = parse_tree(\"((A,B),(C,D),(E,F))\")\n assert_equal 4, total_depth(blorf2,0) \n end",
"def transform(tree); end",
"def main7()\n t = Tree.new()\n arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n t.createBinarySearchTree(arr)\n t.printInOrder()\n t.printInRange(4, 7)\n t.trimOutsideRange(4, 7)\n t.printInOrder()\nend",
"def build_tree(arr)\n\tend",
"def tree\n root = Node.new(1)\n root.left = Node.new(2)\n root.right = Node.new(3)\n root.left.left = Node.new(4)\n root.left.right = Node.new(5)\n root.right.left = Node.new(6)\n root.right.right = Node.new(7)\n root.right.right.right = Node.new(8)\n root\nend",
"def test_nested_quote3\n t = build_tree_on('t022-3.txt')\n assert_equal 3, t.array.size\n assert_equal 1, t.array[2].array.size\n end",
"def test_sort_by_ancestry_no_parents_same_level\n AncestryTestDatabase.with_model do |model|\n _, _, n3, n4, n5, _ = build_tree(model)\n\n records = [n5, n4, n3]\n # records = model.sort_by_ancestry(model.all.ordered_by_ancestry_and(:id => :desc).offset(3).take(3))\n assert_equal [n5, n4, n3].map(&:id), records.map(&:id)\n end\n end",
"def left_side_of_tree(root, current_level)\n return if root.nil?\n if (current_level > @max_level)\n puts root.val\n @max_level = current_level\n end\n left_side_of_tree(root.left, current_level + 1)\n left_side_of_tree(root.right, current_level + 1)\nend",
"def unit_test_binary_tree\n node_a = Node.new('A', nil, nil, nil)\n node_b = Node.new('B', nil, nil, nil)\n node_c = Node.new('C', nil, nil, nil)\n node_d = Node.new('D', nil, nil, nil)\n node_e = Node.new('E', nil, nil, nil)\n node_f = Node.new('F', nil, nil, nil)\n node_g = Node.new('G', nil, nil, nil)\n node_h = Node.new('H', nil, nil, nil)\n node_i = Node.new('I', nil, nil, nil)\n node_j = Node.new('J', nil, nil, nil)\n\n tree = Tree.new(nil)\n\n p \"-------------------- BEGIN CONSTRUCTING TREE -------------------- \"\n p \" F \"\n p \" // \\\\ \"\n p \" B G \"\n p \" // \\\\ \\\\ \"\n p \" A D I \"\n p \" // \\\\ // \"\n p \" C E H \"\n\n p \"-------------------- END CONSTRUCTING TREE -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN INRODER TREE WALK -------------------- \"\n p inorder_tree_walk(tree.root)\n p \"-------------------- END INRODER TREE WALK -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN PREORDER TREE WALK -------------------- \"\n p preoder_tree_walk(tree.root)\n p \"-------------------- END PREORDER TREE WALK -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN POSTORDER TREE WALK -------------------- \"\n p postorder_tree_walk(tree.root)\n p \"-------------------- END PREORDER TREE WALK -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN RECURSIVE TREE SEARCH -------------------- \"\n p tree_search(tree.root, 'I')\n p \"-------------------- END RECURSIVE TREE SEARCH -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN ITERATIVE TREE SEARCH -------------------- \"\n p iterative_tree_search(tree.root, 'I')\n p \"-------------------- END ITERATIVETREE SEARCH -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN SEARCHING FOR TREE MIN -------------------- \"\n p tree_minimum(tree.root)\n p \"-------------------- END SEARCHING FOR TREE MIN -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN SEARCHING TREE MAX -------------------- \"\n p tree_maximum(tree.root)\n p \"-------------------- END SEARCHING TREE MAX -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN SEARCHING FOR SUCCESSOR -------------------- \"\n p tree_successor(node_g)\n p \"-------------------- END SEARCHING FOR SUCCESSOR -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN SEARCHING FOR PREDECESSOR -------------------- \"\n p tree_predecessor(node_g)\n p \"-------------------- END SEARCHING FOR PREDECESSOR -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN NODE INSERTION -------------------- \"\n tree_insert(tree, node_j)\n p \" F \"\n p \" // \\\\ \"\n p \" B G \"\n p \" // \\\\ \\\\ \"\n p \" A D I \"\n p \" // \\\\ // \\\\ \"\n p \" C E H J \"\n p \"-------------------- END NODE INSERTION -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN NODE DELETION (SUCCESSOR) -------------------- \"\n tree_delete(tree, node_d)\n p \" F \"\n p \" // \\\\ \"\n p \" B G \"\n p \" // \\\\ \\\\ \"\n p \" A E I \"\n p \" // // \\\\ \"\n p \" C H J \"\n p \"-------------------- END NODE DELETION (SUCCESSOR) -------------------- \"\n preoder_tree_walk(tree.root)\n\n print \"\\n\"\n\n p \"-------------------- BEGIN NODE DELETION (PREDECESSOR) -------------------- \"\n tree_delete_predecessor(tree, node_b)\n p \" F \"\n p \" // \\\\ \"\n p \" A G \"\n p \" \\\\ \\\\ \"\n p \" E I \"\n p \" // // \\\\ \"\n p \" C H J \"\n p \"-------------------- END NODE DELETION (PREDECESSOR) -------------------- \"\n preoder_tree_walk(tree.root)\n end",
"def check_subtree(tree1, tree2)\n # due to the depth of T1 being much larger than T2 a BFS seems more logical\n bfs(tree1.head, tree2,head)\nend",
"def deepest(cause); end",
"def bfs(target_pos) #this is called on the root node \n tar_x, tar_y = target_pos \n\n arr = [self]\n\n until arr.empty?\n current_check = arr.shift \n return current_check if current_check.root_node == target_pos\n arr.concat(current_check.children)\n end\n nil\n end",
"def enforce_root(root); end",
"def test_node_starts_with_empty_branches\n node = Node.new(50, \"movie a\")\n refute node.left_node\n refute node.right_node\n end",
"def pre_order_traverse(tree, array)\n if !tree.nil?\n array.append(tree.value)\n pre_order_traverse(tree.left, array)\n pre_order_traverse(tree.right, array)\n end\n \n return array\n\nend",
"def is_same_tree(p, q)\n\tif (p == nil) ^ (q == nil) \n\t\treturn false\n\tend\n\tq1 = []\n\tq2 = []\n\tq1.push p\n\tq2.push q\n\twhile q1 != [] and q2 != []\n\t\tc1 = q1.shift\n\t\tc2 = q2.shift\n\t\tif c1 == nil and c2 == nil\n\t\telsif (c1 == nil) ^ (c2 == nil)\n\t\t\treturn false\n\t\telsif c1.val != c2.val\n\t\t\treturn false\n\t\telse\n\t\t\tq1.push c1.left\n\t\t\tq1.push c1.right\n\t\t\tq2.push c2.left\n\t\t\tq2.push c2.right\n\t\tend\n\tend\n\tif q1 != [] or q2 != []\n\t\treturn false\n\tend\n\treturn true\n \nend",
"def super_balanced(tree)\n if !tree\n return true\n end\n \n depths = []\n nodes = []\n nodes.push([tree, 0])\n \n while !nodes.empty?\n node, depth = nodes.pop\n \n if !node.left && !node.right\n if !depths.include? depth\n depths.push(depth)\n \n if (depths.length > 2) || (depths.length == 2 && (depths[0] - depths[1]).abs > 1)\n return false\n end\n \n end\n else\n if node.left\n nodes.push([node.left, depth+1])\n end\n if node.right\n nodes.push([node.right, depth+1])\n end\n end\n end\n \n return true \nend",
"def find_up(node, names)\n names = Array(names)\n\n for parent in node.ancestors\n return parent if names.include?(parent.name)\n end\n\n nil\n end",
"def in_order_traverse(tree, array)\n if !tree.nil?\n in_order_traverse(tree.left, array)\n array.append(tree.value)\n in_order_traverse(tree.right, array)\n end\n return array\n\n\nend",
"def inorder(root)\n inorder(root.left) if root.left\n puts root.value\n inorder(root.right) if root.right\nend",
"def test_insert_adds_node_left_of_left_of_root\n @tree.insert(\"c\")\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n refute_equal nil, @tree.root.left.left\n end",
"def produce_tree(ary); end",
"def dfs(root, target)\n return root if root.value == target\n root.children.each do |child|\n search_result = dfs(child, target)\n return search_result unless search_result.nil?\n end\n\n nil\nend",
"def build_tree_unsorted(array)\n array.each_index{ |index|\n\n }\nend",
"def explore_downwards(node)\n node = node.left until node.left.nil?\n node.data\nend",
"def test_class_from_parent\n code = CodeTree.determine_code_from_path([\n \"Wiki.menu('hey')\",\n \".pages\"])\n assert_equal(\"Wiki.pages()\", code)\n end",
"def build_tree_unsorted(arr)\n root = nil\n arr.each do |item|\n root = insert_tree(item, root)\n end\n\n root\nend",
"def trim_tree\n\t\t@corridor_seeds.each { |seed| check_branch(corridor_map[seed]) }\n\tend",
"def find(root, data) #like a stack\n if data === nil #if data is nil\n return nil\n elsif root.title === data #if root matches data\n return root\n elsif root.title != data && root.left === nil #if root is dif from data and left is empty\n if root.right === data\n return root.right\n elsif root.right === nil\n return nil\n else\n find(root.right, data)\n end\n elsif root.title != data && root.left != nil #if root is dif from data and left is not empty\n if root.left === data\n return root.left\n else\n find(root.left, data)\n end\n end\n end",
"def valid_tree(current_node)\n return true if current_node.nil?\n\n return false if current_node.left != nil && current_node.left.key > current_node.key\n\n return false if current_node.right != nil && current_node.right.key < current_node.key\n\n return valid_tree(current_node.right) && valid_tree(current_node.left)\n end",
"def tree2path_helper(tree, current, path)\n path << '/' << current\n if !tree.children.empty?\n set = []\n # use reverse to be consistent with the sample in the problem\n tree.children.reverse_each do |child|\n set << child.data unless child.data.include?('-')\n end\n acc = set.inject('') {|acc, e| acc + e + '|'}[0..-2]\n tree2path_helper(tree.children[0], acc, path)\n end\n end",
"def find_lca_with_parents(node1, node2)\n one = depth(node1)\n two = depth(node2)\n\n diff = (one - two).abs\n\n if one > two\n diff.times do |i|\n two = two.parent\n end\n else\n diff.times do |i|\n one = one.parent\n end\n end\n\n\n until one == two\n one = one.parent\n two = two.parent\n end\n\n two\nend",
"def depth=(_arg0); end",
"def generate_class_tree_level(parent='')\n $all.map { |klass|\n if parent == klass['parentname']\n [\n klass['name'],\n \"classes/#{klass['fullname']}.html\", # klass.path, \n '',\n generate_class_tree_level(klass['fullname'])\n ]\n else\n nil\n end\n }.compact\nend",
"def walk(fexp, tree)\n\n ftree = Ruote.compact_tree(@ps.current_tree(fexp))\n\n if ftree[0] != tree[0] || ftree[1] != tree[1]\n #\n # if there is anything different between the current tree and the\n # desired tree, let's force a re-apply\n\n register(MutationPoint.new(fexp.fei, tree, :re_apply))\n\n elsif ftree[2] == tree[2]\n #\n # else, if the tree children are the same, exit, there is nothing to do\n\n return\n\n else\n\n register(MutationPoint.new(fexp.fei, tree, :update))\n #\n # NOTE: maybe a switch for this mutation not to be added would\n # be necessary...\n\n if fexp.is_concurrent?\n #\n # concurrent expressions follow a different heuristic\n\n walk_concurrence(fexp, ftree, tree)\n\n else\n #\n # all other expressions are considered sequence-like\n\n walk_sequence(fexp, ftree, tree)\n end\n end\n end",
"def main8()\n t = Tree.new()\n arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n t.createBinarySearchTree(arr)\n print(t.ancestor(1, 10).value,\"\\n\")\n # 5\n print(t.ceilBST(5.5),\"\\n\")\n\t# 6\n print(t.floorBST(5.5),\"\\n\")\n\t# 5\n arr1 = [5, 2, 4, 6, 9, 10]\n arr2 = [5, 2, 6, 4, 7, 9, 10]\n print(t.isBSTArray(arr1),\"\\n\")\n print(t.isBSTArray(arr2),\"\\n\")\n # true\n # false\nend",
"def total_node_number(tree)\n if tree.root == nil\n 0\n else\n left_tree = MyBinaryTree.new\n left_tree.root = tree.root.left_child\n right_tree = MyBinaryTree.new\n right_tree.root = tree.root.right_child\n 1+total_node_number(left_tree)+total_node_number(right_tree)\n end\nend"
] | [
"0.7282106",
"0.6589286",
"0.6570763",
"0.6570763",
"0.6545202",
"0.6507942",
"0.649494",
"0.64915293",
"0.64816314",
"0.6435132",
"0.64148796",
"0.6394745",
"0.6384812",
"0.62271696",
"0.6218531",
"0.62144905",
"0.61863184",
"0.61497414",
"0.61021626",
"0.60977215",
"0.6074798",
"0.6064385",
"0.6054888",
"0.604729",
"0.6046346",
"0.603786",
"0.6037518",
"0.6036304",
"0.6035096",
"0.60133684",
"0.60133684",
"0.59895235",
"0.5988828",
"0.59551954",
"0.59511495",
"0.5951066",
"0.59500927",
"0.5945824",
"0.59295195",
"0.5913266",
"0.59065413",
"0.58999777",
"0.5895033",
"0.58885044",
"0.58776563",
"0.58696645",
"0.5869007",
"0.58583367",
"0.58450705",
"0.58415496",
"0.58370334",
"0.5824314",
"0.5812276",
"0.58062804",
"0.5803904",
"0.5801736",
"0.5800248",
"0.57938176",
"0.57872075",
"0.5777479",
"0.5776221",
"0.57666534",
"0.57626885",
"0.57522535",
"0.57496583",
"0.5744516",
"0.5742388",
"0.5723521",
"0.5717812",
"0.5713614",
"0.5711869",
"0.57115895",
"0.571123",
"0.5706341",
"0.569419",
"0.56907135",
"0.56906193",
"0.56904495",
"0.5685175",
"0.5682287",
"0.56637686",
"0.5662239",
"0.56600064",
"0.565478",
"0.5650903",
"0.5650749",
"0.56450874",
"0.5636114",
"0.56359667",
"0.5635471",
"0.5631701",
"0.56283975",
"0.56265116",
"0.5623896",
"0.5621543",
"0.5617756",
"0.56155676",
"0.5615254",
"0.5612537",
"0.5611298",
"0.5606141"
] | 0.0 | -1 |
Create L2VPN session Create L2VPN session and bind to a L2VPNService | def create_l2_vpn_session(l2_vpn_session, opts = {})
data, _status_code, _headers = create_l2_vpn_session_with_http_info(l2_vpn_session, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_l2_vpn_session_with_http_info(l2_vpn_session, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session ...'\n end\n # verify the required parameter 'l2_vpn_session' is set\n if @api_client.config.client_side_validation && l2_vpn_session.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_session' when calling ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions'\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_session)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, 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 => 'L2VpnSession')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#create_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_or_patch_l2_vpn(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n create_or_patch_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts)\n nil\n end",
"def create_or_replace_l2_vpn(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n data, _status_code, _headers = create_or_replace_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts)\n data\n end",
"def create_or_patch_l2_vpn_0(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n create_or_patch_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts)\n nil\n end",
"def create_or_replace_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn\"\n end\n # verify the required parameter 'l2_vpn' is set\n if @api_client.config.client_side_validation && l2_vpn.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2Vpn')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_replace_l2_vpn\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_or_replace_l2_vpn_0(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n data, _status_code, _headers = create_or_replace_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts)\n data\n end",
"def get_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSession')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#get_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_openvpn_client\n\n\t\treturn if self.status == \"Online\"\n\n\t\tvpn_server=Server.find(:first, :conditions => [\"server_group_id = ? AND openvpn_server = ?\", self.server_group_id, true])\n\n\t\tbegin\n\t\t\tloop_until_server_online\n\n\t\t\t# server is online but can't ping OpenVPN servers .10 IP\n\t\t\tif not ping_test(vpn_server.internal_ip_addr) then\n\t\t\t\tcs_conn=self.cloud_server_init\n\t\t\t\tcs_conn.reboot_server(self.cloud_server_id_number)\n\t\t\t\tself.add_error_message(\"Server failed ping test.\")\n\t\t\t\tself.retry_count += 1\n\t\t\t\tself.save\n\t\t\t\tsleep 20\n Server.create_vpn_client_for_type(self)\n\t\t\t\treturn\n\t\t\tend\n\n\t\trescue Exception => e\n\t\t\tif self.retry_count <= 3 then\n\t\t\t\tself.retry_count += 1\n\t\t\t\tself.status = \"Pending\" # keep status set to pending\n\t\t\t\tsave!\n\t\t\t\t# delete the existing cloud server instance\n\t\t\t\tif not self.cloud_server_id_number.nil? then\n\t\t\t\t\tdelete_cloud_server(self.cloud_server_id_number)\n\t\t\t\t\tself.cloud_server_id_number=nil\n\t\t\t\t\tsave!\n\t\t\t\tend\n\t\t\t\tsleep 10\n\t\t\t\tAsyncExec.run_job(CreateCloudServer, self.id, true)\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\n\t\tvpn_server_config=OpenvpnConfig::Server.new(vpn_server.external_ip_addr, vpn_server.internal_ip_addr, self.server_group.domain_name, vpn_server.server_group.vpn_network, vpn_server.server_group.vpn_subnet, vpn_server.server_group.vpn_device, vpn_server.server_group.vpn_proto, \"root\", self.server_group.ssh_key_basepath)\n\n\t\tclient=OpenvpnConfig::LinuxClient.new(vpn_server_config, self.external_ip_addr, \"root\", self.server_group.ssh_key_basepath)\n\t\tclient.logger=Rails.logger\n\t\tclient.install_openvpn\n\t\tself.vpn_network_interfaces.each_with_index do |vni, index|\n\t\t\tclient_name = (index == 0) ? self.name : \"#{self.name}-#{index.to_s}\"\n\t\t\tif not client.configure_client_vpn(client_name, vni.vpn_ip_addr, vni.ptp_ip_addr) then\n\t\t\t\tfail_and_raise \"Failed to configure OpenVPN on the client.\"\n\t\t\tend\n\t\tend\n\n\t\tif self.server_command then\n\t\t\tif not Util::Ssh.run_cmd(self.external_ip_addr, self.server_command.command, \"root\", self.server_group.ssh_key_basepath)\n\t\t\t\tfail_and_raise \"Failed to run post install command.\"\n\t\t\tend\n\t\tend\n\n\t\tif not client.start_openvpn then\n\t\t\tfail_and_raise \"Failed to configure OpenVPN on the client.\"\n\t\tend\n\n\t\t# mark the client as online\n\t\tself.status = \"Online\"\n\t\tsave\n\t\t\n\tend",
"def initialize(options)\n pass = nil\n \n # Parsing Options - Set to default values if missing\n if !options.has_key?(\"Host\")\n options[\"Host\"] = \"localhost\"\n end\n \n if !options.has_key?(\"Port\")\n options[\"Port\"] = 1234\n end\n \n if !options.has_key?(\"Timeout\")\n options[\"Timeout\"] = 10 \n end\n \n if options.has_key?(\"Password\")\n pass = options[\"Password\"]\n options.delete(\"Password\")\n end\n \n # Add Prompt to options\n options[\"Prompt\"] = />INFO:OpenVPN.*\\n/\n \n # Create Socket Telnet Connection\n @sock = Net::Telnet::new(options)\n\n # Password Management\n # ----------------------\n # This is just a little trick. \n # The openvpn telnet server for management requests just password without username. \n # The Net::Telnet client wait first for username prompt indeed, so we have to deceive it\n # that there is a user without pass, and this is made inverting the prompt values and \n # sending just pass prompt and pass value :)\n \n\t if !pass.nil?\n \t @sock.login(\"LoginPrompt\" => /ENTER PASSWORD:/, \"Name\" => pass) \n end\n end",
"def create_or_patch_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn\"\n end\n # verify the required parameter 'l2_vpn' is set\n if @api_client.config.client_side_validation && l2_vpn.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, 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: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_patch_l2_vpn\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_l2_vpn_session_with_http_info(l2vpn_session_id, l2_vpn_session, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session\"\n end\n # verify the required parameter 'l2_vpn_session' is set\n if @api_client.config.client_side_validation && l2_vpn_session.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_session' when calling ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_session)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2VpnSession')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#update_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_or_replace_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn_0\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn_0\"\n end\n # verify the required parameter 'l2_vpn' is set\n if @api_client.config.client_side_validation && l2_vpn.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2Vpn')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_replace_l2_vpn_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_ssh_session\n return Net::SSH.start(JUMPSRV_NMC, JUMPSRV_NMC_USER, password: JUMPSRV_NMC_PW, timeout: 40) # verbose: :info,\n end",
"def start_tls(host, ssl_socket_class, ssl_context); end",
"def create_ssl_socket\n ctx = OpenSSL::SSL::SSLContext.new\n ctx.set_params ssl_version: :TLSv1_2\n\n socket = TCPSocket.new(@uri.host, @port)\n OpenSSL::SSL::SSLSocket.new(socket, ctx)\n end",
"def read_l2_vpn(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n data, _status_code, _headers = read_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts)\n data\n end",
"def list_l2_vpn_sessions(opts = {})\n data, _status_code, _headers = list_l2_vpn_sessions_with_http_info(opts)\n data\n end",
"def create_or_patch_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_0\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_0\"\n end\n # verify the required parameter 'l2_vpn' is set\n if @api_client.config.client_side_validation && l2_vpn.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, 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: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_patch_l2_vpn_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def read_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2Vpn')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#read_l2_vpn\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_l2_vpn_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/vpn/l2vpn/sessions'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'l2vpn_service_id'] = opts[:'l2vpn_service_id'] if !opts[:'l2vpn_service_id'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSessionListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#list_l2_vpn_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new_session\n @logger.info(\"Attempting to connect to WinRM (patched)...\")\n @logger.info(\" - Host: #{@host}\")\n @logger.info(\" - Port: #{@port}\")\n @logger.info(\" - Username: #{@username}\")\n\n client = ::WinRM::WinRMWebService.new(endpoint, :ssl, endpoint_options)\n client.set_timeout(@timeout_in_seconds)\n client.toggle_nori_type_casting(:off) #we don't want coersion of types\n client\n end",
"def config_lv_define_box2(vm, conf)\n vm.define conf['hostname_box2'] do |box2|\n box2.vm.hostname = conf['hostname_box2']\n box2.vm.box = conf['imagename_box2']\n box2.vm.network :private_network,\n :libvirt__network_name => \"mgmt\",\n :mac => conf['libvirt_mgmt_mac_box2'],\n :ip => conf['libvirt_mgmt_ip_box2'],\n :libvirt__netmask => conf['libvirt_mgmt_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.network :public_network,\n :network_name => \"ext\",\n :ip => conf['libvirt_ext_ip_box2'],\n :netmask => conf['libvirt_ext_netmask_box2'],\n :gateway => conf['libvirt_ext_gateway_box2'],\n :mac => conf['libvirt_ext_mac_box2'],\n :dev => conf['libvirt_dev'],\n :type => conf['libvirt_type'],\n :mode => conf['libvirt_mode']\n box2.vm.network :private_network,\n :libvirt__network_name => \"ceph\",\n :mac => conf['libvirt_ceph_mac_box2'],\n :ip => conf['libvirt_ceph_ip_box2'],\n :libvirt__netmask => conf['libvirt_ceph_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.network :private_network,\n :libvirt__network_name => \"vm_tunnel\",\n :mac => conf['libvirt_tunnel_mac_box2'],\n :ip => conf['libvirt_tunnel_ip_box2'],\n :libvirt__netmask => conf['libvirt_tunnel_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.provider :libvirt do |domain|\n domain.memory = conf['memory_box2']\n domain.cpus = conf['cpus_box2']\n domain.management_network_name = 'vagrantmgmt'\n domain.management_network_address = conf['libvirt_vagrantmgmt_ip_box2']\n domain.management_network_mode = conf['libvirt_mgmt_mode']\n end\n config_provision(box2.vm, conf)\n end\nend",
"def create_session\n Puppet::HTTP::Session.new(self, build_resolvers)\n end",
"def create_tunnel_listener(listen_port, control_connection, &creation_block)\n if old_control = @tunnel_controls[listen_port]\n D \"Closing old listener on port #{listen_port}\"\n EventMachine.stop_server old_control.listener\n end\n \n EventMachine.next_tick do\n next unless yield\n \n @tunnel_controls[listen_port] = control_connection\n redirect_tunnel_connections old_control, control_connection if old_control\n on_remote_listen\n end\n end",
"def anonymous_vpn?; end",
"def anonymous_vpn?; end",
"def connect\n # Configure the connection to vCenter\n lookup_service_helper = LookupServiceHelper.new(lookup_service_host)\n vapi_urls = lookup_service_helper.find_vapi_urls\n debug(\"Found vAPI endpoints: [\" + vapi_urls.to_s + \"]\")\n\n vim_urls = lookup_service_helper.find_vim_urls\n debug(\"Found VIM endpoints: [\" + vim_urls.to_s + \"]\")\n\n node_id = vim_urls.select { |id, url| url.include? vcenter_host }.keys.first\n debug(\"NodeID of vCenter \" + config[:vcenter_host] + \" is \" + node_id.to_s)\n\n vapi_url = lookup_service_helper.find_vapi_url(node_id)\n debug(\"vAPI Endpoint for vCenter is \" + vapi_url)\n\n # Create the VAPI config object\n ssl_options = {}\n ssl_options[:verify] = config[:vcenter_disable_ssl_verify] ? :none : :peer\n @vapi_config = VAPI::Bindings::VapiConfig.new(vapi_url, ssl_options)\n\n # get the SSO url\n sso_url = lookup_service_helper.find_sso_url\n sso = SSO::Connection.new(sso_url).login(config[:vcenter_username], config[:vcenter_password])\n token = sso.request_bearer_token\n vapi_config.set_security_context(\n VAPI::Security.create_saml_bearer_security_context(token.to_s)\n )\n\n # Login and get the session information\n @session_svc = Com::Vmware::Cis::Session.new(vapi_config)\n @session_id = session_svc.create\n vapi_config.set_security_context(\n VAPI::Security.create_session_security_context(session_id)\n )\n end",
"def call_create_lbvserver(ipaddress=\"0.0.0.0\", args = {})\n print \"adding lb vserver...\"\n @lbvserver_name = \"vs-#{@servicename}-usa-qa-wh\"\n # hard coded for testing\n ipaddress = \"10.126.255.53\"\n # hard coded for testing\n port = \"80\"\n # hard coded for testing\n http_or_ssl = \"HTTP\"\n @uri.path = \"/nitro/v1/config/lbvserver/\"\n @request = Net::HTTP::Post.new(@uri)\n @request.basic_auth \"#{@username}\", \"#{@password}\"\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.lbvserver+json')\n @request.body = { :lbvserver => { :name => \"#{@lbvserver_name}\", :servicetype => \"#{http_or_ssl}\", :ipv46 => \"#{ipaddress}\", :port => \"#{port}\", :persistencetype => \"COOKIEINSERT\", :timeout => \"15\", :lbmethod => \"LRTM\", :cltTimeout => \"1800\", :appflowlog => \"DISABLED\" } }.to_json \n\n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n if response.code == \"201\"\n print \"success!\\n\"\n @status_hash[:lbvserver] = \"@lbvserver_name\"\n else\n print \"fail!\\n\"\n print \"code: \", response.code.to_i, \"\\n\"\n print \"body: \", response.body, \"\\n\"\n end\n }\n end",
"def list_l2_vpns_with_http_info(tier_0_id, locale_service_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#list_l2_vpns\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier1_l2_vpn_session_remote_macs_for_ls\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_or_patch_l2_vpn_service(tier_0_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n create_or_patch_l2_vpn_service_with_http_info(tier_0_id, locale_service_id, service_id, l2_vpn_service, opts)\n nil\n end",
"def create_vnc_proxy\n port = VirtualMachine.next_vnc_port\n timeout = 30\n \n if @host_ip == IPSocket.getaddress(Socket.gethostname)\n prefix = ''\n else\n prefix = \"#{PveHelper::CMD_SSH_BATCH} #{@host_ip} \" \n end\n \n if port\n @vnc_port = port\n \n # generate random password\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n @vnc_password = \"\"\n # password length is 8 as vnc server only accept 8 chars in maxium\n 1.upto(8) { |i| @vnc_password << chars[rand(chars.size-1)] } \n \n qmstr = \"/usr/sbin/qm vncproxy #{@id} #{@vnc_password}\"\n cmdstr = \"/bin/nc -l -p #{@vnc_port} -w #{timeout} -c \\\"#{prefix} #{qmstr}\\\" 2>/dev/null &\"\n puts \"cmd: #{cmdstr}\"\n return system(cmdstr)\n end\n end",
"def start_service\n create_certificate\n\n DRb.start_service 'drbssl://:0', nil, ssl_config\n end",
"def starttls?; end",
"def start_tls(req, options); end",
"def initialize(connection_to_socket, args = {})\n @connection = connection_to_socket\n @user = args[:user]\n @password = args[:password]\n\n srv = connection.protocol::Connect.new(\n protocol: 19,\n user: args[:user],\n password: args[:password]\n ).process(connection)\n\n @session = srv[:session] || OrientdbBinary::OperationTypes::NEW_SESSION\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier1_l2_vpn_session_remote_macs_for_ls_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def establish_connection(options={})\n\t\tconnection.ensure_tunnel(options)\n\tend",
"def read_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_0\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2Vpn')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#read_l2_vpn_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def start_tls(plain_socket)\n ssl_socket_class.new(plain_socket, ssl_context).tap do |ssl_socket|\n ssl_socket.sync_close = true\n ssl_socket.connect\n end\n end",
"def create_or_patch_tier1_l2_vpn_service_0(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n create_or_patch_tier1_l2_vpn_service_0_with_http_info(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts)\n nil\n end",
"def get_l2_vpn_session_peer_codes_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}/peer-codes'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSessionPeerCodes')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#get_l2_vpn_session_peer_codes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_ssl_context\n ctx = OpenSSL::SSL::SSLContext.new\n ctx.ca_file = @tls[:ca_file] if @tls[:ca_file]\n ctx.ca_path = @tls[:ca_path] if @tls[:ca_path]\n ctx.ciphers = @tls[:ciphers] || OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:ciphers]\n ctx.options = @tls[:options] || OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options]\n ctx.ssl_version = :TLSv1_2\n ctx.verify_mode = @tls[:verify_mode] || ( OpenSSL::SSL::VERIFY_PEER |\n OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT )\n\n # https://github.com/jruby/jruby-openssl/issues/99\n set_ssl_context_protocols ctx unless H2.jruby?\n\n ctx\n end",
"def create_ssl_context\n ctx = OpenSSL::SSL::SSLContext.new\n ctx.ca_file = @tls[:ca_file] if @tls[:ca_file]\n ctx.ca_path = @tls[:ca_path] if @tls[:ca_path]\n ctx.ciphers = @tls[:ciphers] || OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:ciphers]\n ctx.options = @tls[:options] || OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options]\n ctx.ssl_version = :TLSv1_2\n ctx.verify_mode = @tls[:verify_mode] || ( OpenSSL::SSL::VERIFY_PEER |\n OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT )\n\n # https://github.com/jruby/jruby-openssl/issues/99\n set_ssl_context_protocols ctx unless H2.jruby?\n\n ctx\n end",
"def open_session\n s = Session.wrap(Cproton.pn_session(@impl))\n s.open\n return s\n end",
"def delete_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.delete_l2_vpn ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.delete_l2_vpn\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.delete_l2_vpn\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.delete_l2_vpn\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, 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: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#delete_l2_vpn\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_or_patch_tier1_l2_vpn_service(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n create_or_patch_tier1_l2_vpn_service_with_http_info(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts)\n nil\n end",
"def connect(global = true, opts={})\r\n\r\n self.sock = super(global, opts)\r\n\r\n if datastore['NRPESSL'] or @force_ssl\r\n ctx = OpenSSL::SSL::SSLContext.new(\"TLSv1\")\r\n ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n ctx.ciphers = \"ADH\"\r\n\r\n @ssl_socket = OpenSSL::SSL::SSLSocket.new(self.sock, ctx)\r\n\r\n @ssl_socket.connect\r\n\r\n self.sock.extend(Rex::Socket::SslTcp)\r\n self.sock.sslsock = @ssl_socket\r\n self.sock.sslctx = ctx\r\n end\r\n\r\n return self.sock\r\n end",
"def tunnel_peer\n\tend",
"def tunnel_peer\n\tend",
"def connect\n configuration = VSphereAutomation::Configuration.new.tap do |c|\n c.host = config[:vcenter_host]\n c.username = config[:vcenter_username]\n c.password = config[:vcenter_password]\n c.scheme = \"https\"\n c.verify_ssl = config[:vcenter_disable_ssl_verify] ? false : true\n c.verify_ssl_host = config[:vcenter_disable_ssl_verify] ? false : true\n end\n\n @api_client = VSphereAutomation::ApiClient.new(configuration)\n api_client.default_headers[\"Authorization\"] = configuration.basic_auth_token\n\n session_api = VSphereAutomation::CIS::SessionApi.new(api_client)\n session_id = session_api.create(\"\").value\n\n api_client.default_headers[\"vmware-api-session-id\"] = session_id\n end",
"def create_or_patch_l2_vpn_service_0(tier_0_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n create_or_patch_l2_vpn_service_0_with_http_info(tier_0_id, locale_service_id, service_id, l2_vpn_service, opts)\n nil\n end",
"def get_tier0_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_0_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier0_l2_vpn_session_remote_macs_for_ls\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def establish_socket_server\n @socket_server = Uninterruptible::Binder.new(server_configuration.bind).bind_to_socket\n\n if server_configuration.tls_enabled?\n @socket_server = Uninterruptible::TLSServerFactory.new(server_configuration).wrap_with_tls(@socket_server)\n end\n @socket_server\n end",
"def create_or_update_l2_vpn_service_with_http_info(tier_0_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service\"\n end\n # verify the required parameter 'l2_vpn_service' is set\n if @api_client.config.client_side_validation && l2_vpn_service.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_service' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_service)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2VPNService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_update_l2_vpn_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_or_create_peer_session(session, rip=SipperConfigurator[:DefaultRIP], \n rp=SipperConfigurator[:DefaultRP] )\n peer = get_peer_session(session)\n peer = create_peer_session(session, rip, rp) unless peer\n session.offer_answer = nil\n peer.offer_answer = nil\n peer\n end",
"def starttls_auto?; end",
"def create_or_update_tier1_l2_vpn_service_with_http_info(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service\"\n end\n # verify the required parameter 'l2_vpn_service' is set\n if @api_client.config.client_side_validation && l2_vpn_service.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_service' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_service)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2VPNService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_update_tier1_l2_vpn_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_vm(vm_name, storage_acct, subnet, public_ip)\n location = WEST_EU\n\n puts \"Creating security group...\"\n params_nsg = NetworkModels::NetworkSecurityGroup.new.tap do |sg|\n sr = NetworkModels::SecurityRule.new.tap do |rule|\n rule.name = 'main'\n rule.description = 'default rule'\n rule.protocol = '*'\n rule.source_address_prefix = '*'\n rule.destination_address_prefix = '*'\n rule.source_port_range = '*'\n rule.access = 'Allow'\n rule.priority = 100\n rule.direction = 'Inbound'\n rule.destination_port_ranges = ['22','80', '443', '50051']\n end\n\n sg.location = WEST_EU\n sg.security_rules = [ sr ]\n end\n nsg = @network_client.network_security_groups.create_or_update(GROUP_NAME,'coffe-grpc_rules', params_nsg)\n\n puts \"Creating a network interface for the VM #{vm_name}\"\n print_item nic = @network_client.network_interfaces.create_or_update(\n GROUP_NAME,\n \"nic-#{vm_name}\",\n NetworkModels::NetworkInterface.new.tap do |interface|\n interface.location = WEST_EU\n interface.network_security_group = nsg\n interface.ip_configurations = [\n NetworkModels::NetworkInterfaceIPConfiguration.new.tap do |nic_conf|\n nic_conf.name = \"nic-#{vm_name}\"\n nic_conf.private_ipallocation_method = NetworkModels::IPAllocationMethod::Dynamic\n nic_conf.subnet = subnet\n nic_conf.public_ipaddress = public_ip\n end\n ]\n end\n )\n\n puts 'Creating a Ubuntu 16.04.0-LTS Standard DS2 V2 virtual machine w/ a public IP'\n vm_create_params = ComputeModels::VirtualMachine.new.tap do |vm|\n vm.location = location\n vm.os_profile = ComputeModels::OSProfile.new.tap do |os_profile|\n os_profile.computer_name = vm_name\n os_profile.admin_username = @conf[:user]\n os_profile.admin_password = 'Asd1234554321'\n end\n\n vm.storage_profile = ComputeModels::StorageProfile.new.tap do |store_profile|\n store_profile.image_reference = ComputeModels::ImageReference.new.tap do |ref|\n ref.publisher = 'canonical'\n ref.offer = 'UbuntuServer'\n ref.sku = '16.04.0-LTS'\n ref.version = 'latest'\n end\n store_profile.os_disk = ComputeModels::OSDisk.new.tap do |os_disk|\n os_disk.name = \"os-disk-#{vm_name}\"\n os_disk.caching = ComputeModels::CachingTypes::None\n os_disk.create_option = ComputeModels::DiskCreateOptionTypes::FromImage\n os_disk.vhd = ComputeModels::VirtualHardDisk.new.tap do |vhd|\n vhd.uri = \"https://#{storage_acct.name}.blob.core.windows.net/rubycontainer/#{vm_name}.vhd\"\n end\n end\n end\n\n vm.hardware_profile = ComputeModels::HardwareProfile.new.tap do |hardware|\n hardware.vm_size = ComputeModels::VirtualMachineSizeTypes::StandardDS2V2\n end\n\n vm.network_profile = ComputeModels::NetworkProfile.new.tap do |net_profile|\n net_profile.network_interfaces = [\n ComputeModels::NetworkInterfaceReference.new.tap do |ref|\n ref.id = nic.id\n ref.primary = true\n end\n ]\n end\n end\n\n vm_create_params.os_profile.linux_configuration = ComputeModels::LinuxConfiguration.new.tap do |linux|\n linux.disable_password_authentication = false\n linux.ssh = ComputeModels::SshConfiguration.new.tap do |ssh_config|\n keys = []\n @conf[:access].each do |key|\n k = ComputeModels::SshPublicKey.new.tap do |pub_key|\n pub_key.key_data = key\n pub_key.path = '/home/user_admin/.ssh/authorized_keys'\n end\n keys << k\n end\n ssh_config.public_keys = keys\n end\n end\n\n print_item vm = @compute_client.virtual_machines.create_or_update(GROUP_NAME, vm_name, vm_create_params)\n vm\nend",
"def list_l2_vpns_0_with_http_info(tier_0_id, locale_service_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#list_l2_vpns_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def read_l2_vpn_0(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n data, _status_code, _headers = read_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts)\n data\n end",
"def kvm_setup(handle: , max_sessions: 1, port: 2068,\\\n encrypt: false, mirror_locally: false, server_id: 1)\n kvm_mo = CommKvm.new(parent_mo_or_dn: _get_comm_mo_dn(handle, server_id))\n params = {\n :admin_state => \"enabled\",\n :total_sessions => max_sessions.to_s,\n :port => port.to_s,\n :encryption_state => encrypt ? \"enabled\" : \"disabled\",\n :local_video_state => mirror_locally ? \"enabled\" : \"disabled\"\n }\n\n kvm_mo.set_prop_multiple(**params)\n handle.set_mo(mo: kvm_mo)\n return kvm_mo\nend",
"def tunnel_connection(service = \"ssh\", server = nil)\n shelly.tunnel(code_name, service, server)\n end",
"def list(options={})\n param = { :uniq_id => @uniq_id }.merge options\n Storm::Base::SODServer.remote_list '/VPN/list', param do |u|\n user = VPNUser.new\n user.from_hash u\n user\n end\n end",
"def protocol_new(config)\r\n\t\t\tp = SwarmP2P::Protocol.new(self, config)\r\n\t\t\tprotocol_add(p)\r\n\t\t\tp\r\n\t\tend",
"def create\n @vpn = current_user.build_vpn(params[:vpn])\n\n respond_to do |format|\n if @vpn.save\n format.html { redirect_to vpn_path, notice: 'Vpn was successfully created.' }\n format.json { render json: @vpn, status: :created, location: @vpn }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vpn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_or_update_tier1_l2_vpn_service_0_with_http_info(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service_0\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service_0\"\n end\n # verify the required parameter 'l2_vpn_service' is set\n if @api_client.config.client_side_validation && l2_vpn_service.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_service' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_service)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2VPNService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_update_tier1_l2_vpn_service_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_l2_vpn_session(l2vpn_session_id, opts = {})\n data, _status_code, _headers = get_l2_vpn_session_with_http_info(l2vpn_session_id, opts)\n data\n end",
"def connect!\n @socket = @socket_factory.open( @socket_name )\n\n # determine what type of agent we're communicating with\n buffer = @buffers.writer\n buffer.write_string Net::SSH::Transport::Session.version\n type, body = send_with_reply SSH2_AGENT_REQUEST_VERSION, buffer\n\n if type == SSH2_AGENT_VERSION_RESPONSE\n raise NotImplementedError, \"SSH2 agents are not yet supported\"\n elsif type != SSH_AGENT_RSA_IDENTITIES_ANSWER\n raise AgentError,\n \"unknown response from agent: #{type}, #{body.to_s.inspect}\"\n end\n end",
"def post_init\n start_tls(\n :verify_peer => true,\n :private_key_file => key_file,\n :cert_chain_file => crt_file\n )\n end",
"def connect_to_server_remote(info)\n # update connection data\n @use_http_tunnel = info[:use_http_tunnel]\n @host_server = info[:host_server]\n @port_server = info[:port_server]\n @login_name = info[:login_name]\n @password_saved = info[:password_saved] \n use_guest_login = info[:use_guest_login]\n \n # the connect dialog provide an already coded password\n # on server password in decoded and checked against a digest string in the database\n @password_login_md5 = info[:password_login_md5]\n \n # close old connection before\n @log.debug \"connect_to_server_remote\"\n @socket_srv.close if @socket_srv\n @id_http_session = nil\n #p @host_server, @port_server\n status = Timeout::timeout(6) {\n # avoid to blocking for more time\n @socket_srv = TCPSocket.new(@host_server, @port_server)\n }\n # reset connection data model\n @model_net_data.reset_data\n # avoid funny characters\n #@login_name = @login_name.slice(/\\w+/)\n # use the same regex as the registration (this check is also done on the server)\n @login_name = @login_name.slice(/\\A\\w[\\w\\.\\-_@]+\\z/)\n msg_det = \"#{@login_name},#{@password_login_md5}\"\n if use_guest_login\n msg_det = \"ospite,ospite\"\n end\n \n #send login message\n cmd_to_send = build_cmd(:login, msg_det)\n send_data_to_server(cmd_to_send)\n #start read thread\n if @use_http_tunnel\n @rd_sock_thread = Thread.new{read_data_on_http_tunnel}\n else\n @rd_sock_thread = Thread.new{ background_read }\n end\n rescue Timeout::Error\n @cup_gui.log_sometext \"ERRORE: timeout connessione col server \"\n @cup_gui.log_sometext \" #{@host_server}:#{@port_server} (#{$!})\\n\"\n @socket_srv = nil\n rescue\n @cup_gui.log_sometext \"Errore connessione server #{@host_server}:#{@port_server} (#{$!})\\n\"\n @cup_gui.log_sometext \"Probabilmente il server e' offline, oppure le configurazioni del PC non consentono l'accesso ad internet\\n\"\n @socket_srv = nil\n end",
"def setup_socket\n ctx = setup_certificate\n\n APN.log(:debug, \"Connecting to #{@host}:#{@port}...\")\n\n socket_tcp = TCPSocket.new(@host, @port)\n OpenSSL::SSL::SSLSocket.new(socket_tcp, ctx).tap do |s|\n s.sync = true\n s.connect\n end\n end",
"def get_tier0_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_0_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier0_l2_vpn_session_remote_macs_for_ls_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def open_listener\n @listener = PCAPRUB::Pcap.open_live(IFACE, 65535, false, 1)\n @listener.setfilter(\"tcp port #{@port} and tcp[tcpflags] & tcp-ack != 0\")\n end",
"def read_l2_vpn_context_with_http_info(tier_0_id, locale_service_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_context ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_context\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_context\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnContext')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#read_l2_vpn_context\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def process_ntlm_type1(type1_msg)\n type2_msg = Net::NTLM::Message::Type2.new.tap do |msg|\n msg.target_name = 'LOCALHOST'.encode('UTF-16LE').b\n msg.flag = 0\n %i{ KEY56 KEY128 KEY_EXCHANGE UNICODE TARGET_INFO VERSION_INFO }.each do |flag|\n msg.flag |= NTLM::NEGOTIATE_FLAGS.fetch(flag)\n end\n\n if type1_msg.flag & NTLM::NEGOTIATE_FLAGS[:EXTENDED_SECURITY] == NTLM::NEGOTIATE_FLAGS[:EXTENDED_SECURITY]\n msg.flag |= NTLM::NEGOTIATE_FLAGS[:EXTENDED_SECURITY]\n end\n\n @server_challenge = @provider.generate_server_challenge\n msg.challenge = @server_challenge.unpack1('Q<') # 64-bit unsigned, little endian (uint64_t)\n target_info = Net::NTLM::TargetInfo.new('')\n target_info.av_pairs.merge!({\n Net::NTLM::TargetInfo::MSV_AV_NB_DOMAIN_NAME => @provider.netbios_domain.encode('UTF-16LE').b,\n Net::NTLM::TargetInfo::MSV_AV_NB_COMPUTER_NAME => @provider.netbios_hostname.encode('UTF-16LE').b,\n Net::NTLM::TargetInfo::MSV_AV_DNS_DOMAIN_NAME => @provider.dns_domain.encode('UTF-16LE').b,\n Net::NTLM::TargetInfo::MSV_AV_DNS_COMPUTER_NAME => @provider.dns_hostname.encode('UTF-16LE').b,\n Net::NTLM::TargetInfo::MSV_AV_TIMESTAMP => [(Time.now.to_i + Net::NTLM::TIME_OFFSET) * Field::FileTime::NS_MULTIPLIER].pack('Q')\n })\n msg.target_info = target_info.to_s\n msg.enable(:target_info)\n msg.context = 0\n msg.enable(:context)\n msg.os_version = NTLM::OSVersion.new(major: 6, minor: 3).to_binary_s\n msg.enable(:os_version)\n end\n\n type2_msg\n end",
"def establish\n @proxy = XMLRPC::Client.new(@hostname, '/RPC2', @port).proxy(@proxy_name)\n end",
"def negotiate!(socket, timeout); end",
"def create_or_update_tier1_l2_vpn_service_0(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n data, _status_code, _headers = create_or_update_tier1_l2_vpn_service_0_with_http_info(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts)\n data\n end",
"def create_esb_server (config, hostname, ip1, ip2)\n config.vm.define hostname do |esb|\n esb.vm.provider \"virtualbox\" do |provider|\n provider.customize [\"modifyvm\", :id, \"--memory\", 2048]\n end\n\n esb.vm.network \"private_network\", ip: ip1\n esb.vm.host_name = hostname\n\n esb.vm.network \"private_network\", ip: ip2\n end\nend",
"def create\n @vpn = Vpn.new(params[:vpn])\n @vpn.account_id = @oeaccount.id\n respond_to do |format|\n if @vpn.save\n format.html { redirect_to @vpn, notice: 'Vpn was successfully created.' }\n format.json { render json: @vpn, status: :created, location: @vpn }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vpn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_create_connection(connection_id)\n if @connections[connection_id]\n E \"asked to create already open connection #{connection_id}\"\n return\n end\n \n D \"Tunnel #{connection_id} to #{@tunnel_to_host} port #{@tunnel_to_port}\"\n connection = EventMachine.connect(@tunnel_to_host, @tunnel_to_port,\n Client::TunnelConnection, connection_id, @client)\n @connections[connection_id] = connection\n end",
"def create_or_update_l2_vpn_service_0_with_http_info(tier_0_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service_0\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service_0\"\n end\n # verify the required parameter 'l2_vpn_service' is set\n if @api_client.config.client_side_validation && l2_vpn_service.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_service' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_service)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2VPNService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_update_l2_vpn_service_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def default_tls_port; end",
"def create_session\n @connection.create_session(@config || {})\n end",
"def delete_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.delete_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.delete_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, 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: ManagementPlaneApiVpnL2VpnSessionsApi#delete_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def connect!(agent_socket_factory = T.unsafe(nil), identity_agent = T.unsafe(nil)); end",
"def opentok_session\n opentok.create_session(request.remote_addr).to_s\n end",
"def connect!\n com::unboundid::ldap::sdk::LDAPConnection.new(\n self.host, self.port, self.bind_dn, self.password) \n end",
"def connect_ssl; end",
"def make_single_bridged_node(vm)\n make_proxmox_vm(vm)\n connect_vbox_adapter(vm, @wifi_bridge, 'bridged', @nat_net_cidr)\n\n end",
"def create_or_patch_l2_vpn_service_with_http_info(tier_0_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_service ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_service\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_service\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_service\"\n end\n # verify the required parameter 'l2_vpn_service' is set\n if @api_client.config.client_side_validation && l2_vpn_service.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_service' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_service\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_service)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, 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: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_patch_l2_vpn_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update(options={})\n param = { :uniq_id => @uniq_id }.merge options\n data = Storm::Base::SODServer.remote_call '/VPN/update', param\n self.from_hash data\n end",
"def create_session(timeout=nil)\n if timeout.class == Fixnum && !block_given?\n return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createSession, [Java::long.java_class]).call(timeout),::VertxWeb::Session)\n end\n raise ArgumentError, \"Invalid arguments when calling create_session(timeout)\"\n end",
"def start\n case ssl\n when :tls\n @connection = LDAP::SSLConn.new(host, port, true)\n when true\n @connection = LDAP::SSLConn.new(host, port)\n else\n @connection = LDAP::Conn.new(host, port)\n end\n @connection.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n @connection.set_option(LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_ON)\n @connection.simple_bind(user, password)\n rescue => detail\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end",
"def connect!(in_user, in_password, in_host)\n begin\n @sa_connection=OpswareClient\n @sa_connection.connect(\"https\".to_java, in_host, port, in_user, in_password, true)\n require 'sasync/hpsa_tools/hpsa_tools'\n extend Sasync::HpsaTools\n rescue NativeException => e\n puts \"Error during connection with error: #{e}\"\n return\n end\n\n self.initialize_framework\n #puts @sa_connection.isConnected\n #puts connection_info\n end",
"def request_listen\n send_command RemoteListenCommand.new(@client.remote_listen_address)\n enable_tunnel_timeouts \n end",
"def open_connection\n # FIXME il timeout serve solamente nella versione tcp\n # FIXME perchè utilizzare un'istanza di classe? non sarebbe meglio avere un metodo che genera il transport\n # e successivamente viene utilizzato sempre quello?\n Timeout.timeout @timeout do\n case @transport\n when :tcp\n @connection = KonoEppClient::Transport::TcpTransport.new(server, port)\n when :http\n @connection = KonoEppClient::Transport::HttpTransport.new(server, port,\n ssl_version: ssl_version,\n cookie_file: \"#{@tag.downcase}.cookies.pstore\"\n )\n end\n end\n end",
"def init_proxy(env, secret)\n record = SystemConsole.find_by!(:url_secret => secret) # Retrieve the ticket record using the secret\n\n begin\n ws_sock = env['rack.hijack'].call # Hijack the socket from the incoming HTTP connection\n console_sock = TCPSocket.open(record.host_name, record.port) # Open a TCP connection to the remote endpoint\n\n ws_sock.autoclose = false\n console_sock.autoclose = false\n\n # These adapters will be used for reading/writing from/to the particular sockets\n @adapters[console_sock] = ClientAdapter.new(record, console_sock)\n @adapters[ws_sock] = ServerAdapter.new(record, env, ws_sock)\n\n @proxy.push(ws_sock, console_sock)\n rescue StandardError => ex\n cleanup(:error, \"RemoteConsole proxy for VM %{vm_id} errored with #{ex} #{ex.backtrace.join(\"\\n\")}\", console_sock, ws_sock, record)\n RACK_404\n else\n @logger.info(\"Starting RemoteConsole proxy for VM #{record.vm_id}\")\n RACK_YAY # Rack needs this as a return value\n ensure\n # Release the connection because one SPICE console can open multiple TCP connections\n ActiveRecord::Base.connection_pool.release_connection\n end\n end",
"def create_or_patch_tier1_l2_vpn_service_with_http_info(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_tier1_l2_vpn_service ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_tier1_l2_vpn_service\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_tier1_l2_vpn_service\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_tier1_l2_vpn_service\"\n end\n # verify the required parameter 'l2_vpn_service' is set\n if @api_client.config.client_side_validation && l2_vpn_service.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_service' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_tier1_l2_vpn_service\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_service)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, 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: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_patch_tier1_l2_vpn_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] | [
"0.6675386",
"0.61380833",
"0.6061185",
"0.5906935",
"0.58896804",
"0.58732396",
"0.58028316",
"0.57887095",
"0.5749061",
"0.5645838",
"0.5626455",
"0.55933565",
"0.55907303",
"0.54721963",
"0.5393742",
"0.5384021",
"0.53733975",
"0.5359921",
"0.5348103",
"0.53226995",
"0.530905",
"0.52109164",
"0.51919276",
"0.51861274",
"0.516458",
"0.516458",
"0.5158416",
"0.51506895",
"0.5139192",
"0.5135034",
"0.5131007",
"0.5125869",
"0.50982547",
"0.50888646",
"0.5069807",
"0.5067182",
"0.5048744",
"0.50455993",
"0.502288",
"0.4991504",
"0.49877733",
"0.49780002",
"0.4964824",
"0.4964824",
"0.4963007",
"0.49624187",
"0.49544272",
"0.4944314",
"0.4927452",
"0.4927452",
"0.4919271",
"0.49057588",
"0.4896184",
"0.4876976",
"0.4848366",
"0.4847122",
"0.48408988",
"0.48352218",
"0.48329154",
"0.4828015",
"0.4825206",
"0.48150116",
"0.48041326",
"0.48020762",
"0.479674",
"0.47910833",
"0.47895795",
"0.47753733",
"0.4775237",
"0.4769681",
"0.47637096",
"0.47416073",
"0.4740002",
"0.47386158",
"0.47329876",
"0.47329554",
"0.47306705",
"0.47276443",
"0.47263944",
"0.4724621",
"0.47155952",
"0.47097743",
"0.47094122",
"0.4703591",
"0.47025794",
"0.4695893",
"0.46953493",
"0.46928212",
"0.4690381",
"0.46814138",
"0.46814045",
"0.46706623",
"0.46634066",
"0.46609136",
"0.46585718",
"0.46585473",
"0.46499446",
"0.46445358",
"0.46415386",
"0.46410897"
] | 0.685843 | 0 |
Create L2VPN session Create L2VPN session and bind to a L2VPNService | def create_l2_vpn_session_with_http_info(l2_vpn_session, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session ...'
end
# verify the required parameter 'l2_vpn_session' is set
if @api_client.config.client_side_validation && l2_vpn_session.nil?
fail ArgumentError, "Missing the required parameter 'l2_vpn_session' when calling ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session"
end
# resource path
local_var_path = '/vpn/l2vpn/sessions'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(l2_vpn_session)
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'L2VpnSession')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementPlaneApiVpnL2VpnSessionsApi#create_l2_vpn_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_l2_vpn_session(l2_vpn_session, opts = {})\n data, _status_code, _headers = create_l2_vpn_session_with_http_info(l2_vpn_session, opts)\n data\n end",
"def create_or_patch_l2_vpn(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n create_or_patch_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts)\n nil\n end",
"def create_or_replace_l2_vpn(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n data, _status_code, _headers = create_or_replace_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts)\n data\n end",
"def create_or_patch_l2_vpn_0(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n create_or_patch_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts)\n nil\n end",
"def create_or_replace_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn\"\n end\n # verify the required parameter 'l2_vpn' is set\n if @api_client.config.client_side_validation && l2_vpn.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2Vpn')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_replace_l2_vpn\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_or_replace_l2_vpn_0(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n data, _status_code, _headers = create_or_replace_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts)\n data\n end",
"def get_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSession')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#get_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_openvpn_client\n\n\t\treturn if self.status == \"Online\"\n\n\t\tvpn_server=Server.find(:first, :conditions => [\"server_group_id = ? AND openvpn_server = ?\", self.server_group_id, true])\n\n\t\tbegin\n\t\t\tloop_until_server_online\n\n\t\t\t# server is online but can't ping OpenVPN servers .10 IP\n\t\t\tif not ping_test(vpn_server.internal_ip_addr) then\n\t\t\t\tcs_conn=self.cloud_server_init\n\t\t\t\tcs_conn.reboot_server(self.cloud_server_id_number)\n\t\t\t\tself.add_error_message(\"Server failed ping test.\")\n\t\t\t\tself.retry_count += 1\n\t\t\t\tself.save\n\t\t\t\tsleep 20\n Server.create_vpn_client_for_type(self)\n\t\t\t\treturn\n\t\t\tend\n\n\t\trescue Exception => e\n\t\t\tif self.retry_count <= 3 then\n\t\t\t\tself.retry_count += 1\n\t\t\t\tself.status = \"Pending\" # keep status set to pending\n\t\t\t\tsave!\n\t\t\t\t# delete the existing cloud server instance\n\t\t\t\tif not self.cloud_server_id_number.nil? then\n\t\t\t\t\tdelete_cloud_server(self.cloud_server_id_number)\n\t\t\t\t\tself.cloud_server_id_number=nil\n\t\t\t\t\tsave!\n\t\t\t\tend\n\t\t\t\tsleep 10\n\t\t\t\tAsyncExec.run_job(CreateCloudServer, self.id, true)\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\n\t\tvpn_server_config=OpenvpnConfig::Server.new(vpn_server.external_ip_addr, vpn_server.internal_ip_addr, self.server_group.domain_name, vpn_server.server_group.vpn_network, vpn_server.server_group.vpn_subnet, vpn_server.server_group.vpn_device, vpn_server.server_group.vpn_proto, \"root\", self.server_group.ssh_key_basepath)\n\n\t\tclient=OpenvpnConfig::LinuxClient.new(vpn_server_config, self.external_ip_addr, \"root\", self.server_group.ssh_key_basepath)\n\t\tclient.logger=Rails.logger\n\t\tclient.install_openvpn\n\t\tself.vpn_network_interfaces.each_with_index do |vni, index|\n\t\t\tclient_name = (index == 0) ? self.name : \"#{self.name}-#{index.to_s}\"\n\t\t\tif not client.configure_client_vpn(client_name, vni.vpn_ip_addr, vni.ptp_ip_addr) then\n\t\t\t\tfail_and_raise \"Failed to configure OpenVPN on the client.\"\n\t\t\tend\n\t\tend\n\n\t\tif self.server_command then\n\t\t\tif not Util::Ssh.run_cmd(self.external_ip_addr, self.server_command.command, \"root\", self.server_group.ssh_key_basepath)\n\t\t\t\tfail_and_raise \"Failed to run post install command.\"\n\t\t\tend\n\t\tend\n\n\t\tif not client.start_openvpn then\n\t\t\tfail_and_raise \"Failed to configure OpenVPN on the client.\"\n\t\tend\n\n\t\t# mark the client as online\n\t\tself.status = \"Online\"\n\t\tsave\n\t\t\n\tend",
"def initialize(options)\n pass = nil\n \n # Parsing Options - Set to default values if missing\n if !options.has_key?(\"Host\")\n options[\"Host\"] = \"localhost\"\n end\n \n if !options.has_key?(\"Port\")\n options[\"Port\"] = 1234\n end\n \n if !options.has_key?(\"Timeout\")\n options[\"Timeout\"] = 10 \n end\n \n if options.has_key?(\"Password\")\n pass = options[\"Password\"]\n options.delete(\"Password\")\n end\n \n # Add Prompt to options\n options[\"Prompt\"] = />INFO:OpenVPN.*\\n/\n \n # Create Socket Telnet Connection\n @sock = Net::Telnet::new(options)\n\n # Password Management\n # ----------------------\n # This is just a little trick. \n # The openvpn telnet server for management requests just password without username. \n # The Net::Telnet client wait first for username prompt indeed, so we have to deceive it\n # that there is a user without pass, and this is made inverting the prompt values and \n # sending just pass prompt and pass value :)\n \n\t if !pass.nil?\n \t @sock.login(\"LoginPrompt\" => /ENTER PASSWORD:/, \"Name\" => pass) \n end\n end",
"def create_or_patch_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn\"\n end\n # verify the required parameter 'l2_vpn' is set\n if @api_client.config.client_side_validation && l2_vpn.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, 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: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_patch_l2_vpn\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_l2_vpn_session_with_http_info(l2vpn_session_id, l2_vpn_session, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session\"\n end\n # verify the required parameter 'l2_vpn_session' is set\n if @api_client.config.client_side_validation && l2_vpn_session.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_session' when calling ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_session)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2VpnSession')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#update_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_or_replace_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn_0\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn_0\"\n end\n # verify the required parameter 'l2_vpn' is set\n if @api_client.config.client_side_validation && l2_vpn.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_replace_l2_vpn_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2Vpn')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_replace_l2_vpn_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_ssh_session\n return Net::SSH.start(JUMPSRV_NMC, JUMPSRV_NMC_USER, password: JUMPSRV_NMC_PW, timeout: 40) # verbose: :info,\n end",
"def start_tls(host, ssl_socket_class, ssl_context); end",
"def create_ssl_socket\n ctx = OpenSSL::SSL::SSLContext.new\n ctx.set_params ssl_version: :TLSv1_2\n\n socket = TCPSocket.new(@uri.host, @port)\n OpenSSL::SSL::SSLSocket.new(socket, ctx)\n end",
"def read_l2_vpn(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n data, _status_code, _headers = read_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts)\n data\n end",
"def list_l2_vpn_sessions(opts = {})\n data, _status_code, _headers = list_l2_vpn_sessions_with_http_info(opts)\n data\n end",
"def create_or_patch_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_0\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_0\"\n end\n # verify the required parameter 'l2_vpn' is set\n if @api_client.config.client_side_validation && l2_vpn.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, 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: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_patch_l2_vpn_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def read_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2Vpn')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#read_l2_vpn\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_l2_vpn_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/vpn/l2vpn/sessions'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'l2vpn_service_id'] = opts[:'l2vpn_service_id'] if !opts[:'l2vpn_service_id'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSessionListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#list_l2_vpn_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new_session\n @logger.info(\"Attempting to connect to WinRM (patched)...\")\n @logger.info(\" - Host: #{@host}\")\n @logger.info(\" - Port: #{@port}\")\n @logger.info(\" - Username: #{@username}\")\n\n client = ::WinRM::WinRMWebService.new(endpoint, :ssl, endpoint_options)\n client.set_timeout(@timeout_in_seconds)\n client.toggle_nori_type_casting(:off) #we don't want coersion of types\n client\n end",
"def config_lv_define_box2(vm, conf)\n vm.define conf['hostname_box2'] do |box2|\n box2.vm.hostname = conf['hostname_box2']\n box2.vm.box = conf['imagename_box2']\n box2.vm.network :private_network,\n :libvirt__network_name => \"mgmt\",\n :mac => conf['libvirt_mgmt_mac_box2'],\n :ip => conf['libvirt_mgmt_ip_box2'],\n :libvirt__netmask => conf['libvirt_mgmt_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.network :public_network,\n :network_name => \"ext\",\n :ip => conf['libvirt_ext_ip_box2'],\n :netmask => conf['libvirt_ext_netmask_box2'],\n :gateway => conf['libvirt_ext_gateway_box2'],\n :mac => conf['libvirt_ext_mac_box2'],\n :dev => conf['libvirt_dev'],\n :type => conf['libvirt_type'],\n :mode => conf['libvirt_mode']\n box2.vm.network :private_network,\n :libvirt__network_name => \"ceph\",\n :mac => conf['libvirt_ceph_mac_box2'],\n :ip => conf['libvirt_ceph_ip_box2'],\n :libvirt__netmask => conf['libvirt_ceph_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.network :private_network,\n :libvirt__network_name => \"vm_tunnel\",\n :mac => conf['libvirt_tunnel_mac_box2'],\n :ip => conf['libvirt_tunnel_ip_box2'],\n :libvirt__netmask => conf['libvirt_tunnel_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.provider :libvirt do |domain|\n domain.memory = conf['memory_box2']\n domain.cpus = conf['cpus_box2']\n domain.management_network_name = 'vagrantmgmt'\n domain.management_network_address = conf['libvirt_vagrantmgmt_ip_box2']\n domain.management_network_mode = conf['libvirt_mgmt_mode']\n end\n config_provision(box2.vm, conf)\n end\nend",
"def create_session\n Puppet::HTTP::Session.new(self, build_resolvers)\n end",
"def create_tunnel_listener(listen_port, control_connection, &creation_block)\n if old_control = @tunnel_controls[listen_port]\n D \"Closing old listener on port #{listen_port}\"\n EventMachine.stop_server old_control.listener\n end\n \n EventMachine.next_tick do\n next unless yield\n \n @tunnel_controls[listen_port] = control_connection\n redirect_tunnel_connections old_control, control_connection if old_control\n on_remote_listen\n end\n end",
"def anonymous_vpn?; end",
"def anonymous_vpn?; end",
"def connect\n # Configure the connection to vCenter\n lookup_service_helper = LookupServiceHelper.new(lookup_service_host)\n vapi_urls = lookup_service_helper.find_vapi_urls\n debug(\"Found vAPI endpoints: [\" + vapi_urls.to_s + \"]\")\n\n vim_urls = lookup_service_helper.find_vim_urls\n debug(\"Found VIM endpoints: [\" + vim_urls.to_s + \"]\")\n\n node_id = vim_urls.select { |id, url| url.include? vcenter_host }.keys.first\n debug(\"NodeID of vCenter \" + config[:vcenter_host] + \" is \" + node_id.to_s)\n\n vapi_url = lookup_service_helper.find_vapi_url(node_id)\n debug(\"vAPI Endpoint for vCenter is \" + vapi_url)\n\n # Create the VAPI config object\n ssl_options = {}\n ssl_options[:verify] = config[:vcenter_disable_ssl_verify] ? :none : :peer\n @vapi_config = VAPI::Bindings::VapiConfig.new(vapi_url, ssl_options)\n\n # get the SSO url\n sso_url = lookup_service_helper.find_sso_url\n sso = SSO::Connection.new(sso_url).login(config[:vcenter_username], config[:vcenter_password])\n token = sso.request_bearer_token\n vapi_config.set_security_context(\n VAPI::Security.create_saml_bearer_security_context(token.to_s)\n )\n\n # Login and get the session information\n @session_svc = Com::Vmware::Cis::Session.new(vapi_config)\n @session_id = session_svc.create\n vapi_config.set_security_context(\n VAPI::Security.create_session_security_context(session_id)\n )\n end",
"def call_create_lbvserver(ipaddress=\"0.0.0.0\", args = {})\n print \"adding lb vserver...\"\n @lbvserver_name = \"vs-#{@servicename}-usa-qa-wh\"\n # hard coded for testing\n ipaddress = \"10.126.255.53\"\n # hard coded for testing\n port = \"80\"\n # hard coded for testing\n http_or_ssl = \"HTTP\"\n @uri.path = \"/nitro/v1/config/lbvserver/\"\n @request = Net::HTTP::Post.new(@uri)\n @request.basic_auth \"#{@username}\", \"#{@password}\"\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.lbvserver+json')\n @request.body = { :lbvserver => { :name => \"#{@lbvserver_name}\", :servicetype => \"#{http_or_ssl}\", :ipv46 => \"#{ipaddress}\", :port => \"#{port}\", :persistencetype => \"COOKIEINSERT\", :timeout => \"15\", :lbmethod => \"LRTM\", :cltTimeout => \"1800\", :appflowlog => \"DISABLED\" } }.to_json \n\n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n if response.code == \"201\"\n print \"success!\\n\"\n @status_hash[:lbvserver] = \"@lbvserver_name\"\n else\n print \"fail!\\n\"\n print \"code: \", response.code.to_i, \"\\n\"\n print \"body: \", response.body, \"\\n\"\n end\n }\n end",
"def list_l2_vpns_with_http_info(tier_0_id, locale_service_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#list_l2_vpns\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier1_l2_vpn_session_remote_macs_for_ls\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_or_patch_l2_vpn_service(tier_0_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n create_or_patch_l2_vpn_service_with_http_info(tier_0_id, locale_service_id, service_id, l2_vpn_service, opts)\n nil\n end",
"def create_vnc_proxy\n port = VirtualMachine.next_vnc_port\n timeout = 30\n \n if @host_ip == IPSocket.getaddress(Socket.gethostname)\n prefix = ''\n else\n prefix = \"#{PveHelper::CMD_SSH_BATCH} #{@host_ip} \" \n end\n \n if port\n @vnc_port = port\n \n # generate random password\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n @vnc_password = \"\"\n # password length is 8 as vnc server only accept 8 chars in maxium\n 1.upto(8) { |i| @vnc_password << chars[rand(chars.size-1)] } \n \n qmstr = \"/usr/sbin/qm vncproxy #{@id} #{@vnc_password}\"\n cmdstr = \"/bin/nc -l -p #{@vnc_port} -w #{timeout} -c \\\"#{prefix} #{qmstr}\\\" 2>/dev/null &\"\n puts \"cmd: #{cmdstr}\"\n return system(cmdstr)\n end\n end",
"def start_service\n create_certificate\n\n DRb.start_service 'drbssl://:0', nil, ssl_config\n end",
"def starttls?; end",
"def start_tls(req, options); end",
"def initialize(connection_to_socket, args = {})\n @connection = connection_to_socket\n @user = args[:user]\n @password = args[:password]\n\n srv = connection.protocol::Connect.new(\n protocol: 19,\n user: args[:user],\n password: args[:password]\n ).process(connection)\n\n @session = srv[:session] || OrientdbBinary::OperationTypes::NEW_SESSION\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier1_l2_vpn_session_remote_macs_for_ls_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def establish_connection(options={})\n\t\tconnection.ensure_tunnel(options)\n\tend",
"def read_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_0\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2Vpn')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#read_l2_vpn_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def start_tls(plain_socket)\n ssl_socket_class.new(plain_socket, ssl_context).tap do |ssl_socket|\n ssl_socket.sync_close = true\n ssl_socket.connect\n end\n end",
"def create_or_patch_tier1_l2_vpn_service_0(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n create_or_patch_tier1_l2_vpn_service_0_with_http_info(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts)\n nil\n end",
"def get_l2_vpn_session_peer_codes_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}/peer-codes'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSessionPeerCodes')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#get_l2_vpn_session_peer_codes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_ssl_context\n ctx = OpenSSL::SSL::SSLContext.new\n ctx.ca_file = @tls[:ca_file] if @tls[:ca_file]\n ctx.ca_path = @tls[:ca_path] if @tls[:ca_path]\n ctx.ciphers = @tls[:ciphers] || OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:ciphers]\n ctx.options = @tls[:options] || OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options]\n ctx.ssl_version = :TLSv1_2\n ctx.verify_mode = @tls[:verify_mode] || ( OpenSSL::SSL::VERIFY_PEER |\n OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT )\n\n # https://github.com/jruby/jruby-openssl/issues/99\n set_ssl_context_protocols ctx unless H2.jruby?\n\n ctx\n end",
"def create_ssl_context\n ctx = OpenSSL::SSL::SSLContext.new\n ctx.ca_file = @tls[:ca_file] if @tls[:ca_file]\n ctx.ca_path = @tls[:ca_path] if @tls[:ca_path]\n ctx.ciphers = @tls[:ciphers] || OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:ciphers]\n ctx.options = @tls[:options] || OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options]\n ctx.ssl_version = :TLSv1_2\n ctx.verify_mode = @tls[:verify_mode] || ( OpenSSL::SSL::VERIFY_PEER |\n OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT )\n\n # https://github.com/jruby/jruby-openssl/issues/99\n set_ssl_context_protocols ctx unless H2.jruby?\n\n ctx\n end",
"def open_session\n s = Session.wrap(Cproton.pn_session(@impl))\n s.open\n return s\n end",
"def delete_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.delete_l2_vpn ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.delete_l2_vpn\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.delete_l2_vpn\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.delete_l2_vpn\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, 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: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#delete_l2_vpn\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_or_patch_tier1_l2_vpn_service(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n create_or_patch_tier1_l2_vpn_service_with_http_info(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts)\n nil\n end",
"def connect(global = true, opts={})\r\n\r\n self.sock = super(global, opts)\r\n\r\n if datastore['NRPESSL'] or @force_ssl\r\n ctx = OpenSSL::SSL::SSLContext.new(\"TLSv1\")\r\n ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n ctx.ciphers = \"ADH\"\r\n\r\n @ssl_socket = OpenSSL::SSL::SSLSocket.new(self.sock, ctx)\r\n\r\n @ssl_socket.connect\r\n\r\n self.sock.extend(Rex::Socket::SslTcp)\r\n self.sock.sslsock = @ssl_socket\r\n self.sock.sslctx = ctx\r\n end\r\n\r\n return self.sock\r\n end",
"def tunnel_peer\n\tend",
"def tunnel_peer\n\tend",
"def connect\n configuration = VSphereAutomation::Configuration.new.tap do |c|\n c.host = config[:vcenter_host]\n c.username = config[:vcenter_username]\n c.password = config[:vcenter_password]\n c.scheme = \"https\"\n c.verify_ssl = config[:vcenter_disable_ssl_verify] ? false : true\n c.verify_ssl_host = config[:vcenter_disable_ssl_verify] ? false : true\n end\n\n @api_client = VSphereAutomation::ApiClient.new(configuration)\n api_client.default_headers[\"Authorization\"] = configuration.basic_auth_token\n\n session_api = VSphereAutomation::CIS::SessionApi.new(api_client)\n session_id = session_api.create(\"\").value\n\n api_client.default_headers[\"vmware-api-session-id\"] = session_id\n end",
"def create_or_patch_l2_vpn_service_0(tier_0_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n create_or_patch_l2_vpn_service_0_with_http_info(tier_0_id, locale_service_id, service_id, l2_vpn_service, opts)\n nil\n end",
"def get_tier0_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_0_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier0_l2_vpn_session_remote_macs_for_ls\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def establish_socket_server\n @socket_server = Uninterruptible::Binder.new(server_configuration.bind).bind_to_socket\n\n if server_configuration.tls_enabled?\n @socket_server = Uninterruptible::TLSServerFactory.new(server_configuration).wrap_with_tls(@socket_server)\n end\n @socket_server\n end",
"def create_or_update_l2_vpn_service_with_http_info(tier_0_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service\"\n end\n # verify the required parameter 'l2_vpn_service' is set\n if @api_client.config.client_side_validation && l2_vpn_service.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_service' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_service)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2VPNService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_update_l2_vpn_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_or_create_peer_session(session, rip=SipperConfigurator[:DefaultRIP], \n rp=SipperConfigurator[:DefaultRP] )\n peer = get_peer_session(session)\n peer = create_peer_session(session, rip, rp) unless peer\n session.offer_answer = nil\n peer.offer_answer = nil\n peer\n end",
"def starttls_auto?; end",
"def create_or_update_tier1_l2_vpn_service_with_http_info(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service\"\n end\n # verify the required parameter 'l2_vpn_service' is set\n if @api_client.config.client_side_validation && l2_vpn_service.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_service' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_service)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2VPNService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_update_tier1_l2_vpn_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_vm(vm_name, storage_acct, subnet, public_ip)\n location = WEST_EU\n\n puts \"Creating security group...\"\n params_nsg = NetworkModels::NetworkSecurityGroup.new.tap do |sg|\n sr = NetworkModels::SecurityRule.new.tap do |rule|\n rule.name = 'main'\n rule.description = 'default rule'\n rule.protocol = '*'\n rule.source_address_prefix = '*'\n rule.destination_address_prefix = '*'\n rule.source_port_range = '*'\n rule.access = 'Allow'\n rule.priority = 100\n rule.direction = 'Inbound'\n rule.destination_port_ranges = ['22','80', '443', '50051']\n end\n\n sg.location = WEST_EU\n sg.security_rules = [ sr ]\n end\n nsg = @network_client.network_security_groups.create_or_update(GROUP_NAME,'coffe-grpc_rules', params_nsg)\n\n puts \"Creating a network interface for the VM #{vm_name}\"\n print_item nic = @network_client.network_interfaces.create_or_update(\n GROUP_NAME,\n \"nic-#{vm_name}\",\n NetworkModels::NetworkInterface.new.tap do |interface|\n interface.location = WEST_EU\n interface.network_security_group = nsg\n interface.ip_configurations = [\n NetworkModels::NetworkInterfaceIPConfiguration.new.tap do |nic_conf|\n nic_conf.name = \"nic-#{vm_name}\"\n nic_conf.private_ipallocation_method = NetworkModels::IPAllocationMethod::Dynamic\n nic_conf.subnet = subnet\n nic_conf.public_ipaddress = public_ip\n end\n ]\n end\n )\n\n puts 'Creating a Ubuntu 16.04.0-LTS Standard DS2 V2 virtual machine w/ a public IP'\n vm_create_params = ComputeModels::VirtualMachine.new.tap do |vm|\n vm.location = location\n vm.os_profile = ComputeModels::OSProfile.new.tap do |os_profile|\n os_profile.computer_name = vm_name\n os_profile.admin_username = @conf[:user]\n os_profile.admin_password = 'Asd1234554321'\n end\n\n vm.storage_profile = ComputeModels::StorageProfile.new.tap do |store_profile|\n store_profile.image_reference = ComputeModels::ImageReference.new.tap do |ref|\n ref.publisher = 'canonical'\n ref.offer = 'UbuntuServer'\n ref.sku = '16.04.0-LTS'\n ref.version = 'latest'\n end\n store_profile.os_disk = ComputeModels::OSDisk.new.tap do |os_disk|\n os_disk.name = \"os-disk-#{vm_name}\"\n os_disk.caching = ComputeModels::CachingTypes::None\n os_disk.create_option = ComputeModels::DiskCreateOptionTypes::FromImage\n os_disk.vhd = ComputeModels::VirtualHardDisk.new.tap do |vhd|\n vhd.uri = \"https://#{storage_acct.name}.blob.core.windows.net/rubycontainer/#{vm_name}.vhd\"\n end\n end\n end\n\n vm.hardware_profile = ComputeModels::HardwareProfile.new.tap do |hardware|\n hardware.vm_size = ComputeModels::VirtualMachineSizeTypes::StandardDS2V2\n end\n\n vm.network_profile = ComputeModels::NetworkProfile.new.tap do |net_profile|\n net_profile.network_interfaces = [\n ComputeModels::NetworkInterfaceReference.new.tap do |ref|\n ref.id = nic.id\n ref.primary = true\n end\n ]\n end\n end\n\n vm_create_params.os_profile.linux_configuration = ComputeModels::LinuxConfiguration.new.tap do |linux|\n linux.disable_password_authentication = false\n linux.ssh = ComputeModels::SshConfiguration.new.tap do |ssh_config|\n keys = []\n @conf[:access].each do |key|\n k = ComputeModels::SshPublicKey.new.tap do |pub_key|\n pub_key.key_data = key\n pub_key.path = '/home/user_admin/.ssh/authorized_keys'\n end\n keys << k\n end\n ssh_config.public_keys = keys\n end\n end\n\n print_item vm = @compute_client.virtual_machines.create_or_update(GROUP_NAME, vm_name, vm_create_params)\n vm\nend",
"def list_l2_vpns_0_with_http_info(tier_0_id, locale_service_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#list_l2_vpns_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def read_l2_vpn_0(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n data, _status_code, _headers = read_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts)\n data\n end",
"def kvm_setup(handle: , max_sessions: 1, port: 2068,\\\n encrypt: false, mirror_locally: false, server_id: 1)\n kvm_mo = CommKvm.new(parent_mo_or_dn: _get_comm_mo_dn(handle, server_id))\n params = {\n :admin_state => \"enabled\",\n :total_sessions => max_sessions.to_s,\n :port => port.to_s,\n :encryption_state => encrypt ? \"enabled\" : \"disabled\",\n :local_video_state => mirror_locally ? \"enabled\" : \"disabled\"\n }\n\n kvm_mo.set_prop_multiple(**params)\n handle.set_mo(mo: kvm_mo)\n return kvm_mo\nend",
"def tunnel_connection(service = \"ssh\", server = nil)\n shelly.tunnel(code_name, service, server)\n end",
"def list(options={})\n param = { :uniq_id => @uniq_id }.merge options\n Storm::Base::SODServer.remote_list '/VPN/list', param do |u|\n user = VPNUser.new\n user.from_hash u\n user\n end\n end",
"def protocol_new(config)\r\n\t\t\tp = SwarmP2P::Protocol.new(self, config)\r\n\t\t\tprotocol_add(p)\r\n\t\t\tp\r\n\t\tend",
"def create\n @vpn = current_user.build_vpn(params[:vpn])\n\n respond_to do |format|\n if @vpn.save\n format.html { redirect_to vpn_path, notice: 'Vpn was successfully created.' }\n format.json { render json: @vpn, status: :created, location: @vpn }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vpn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_or_update_tier1_l2_vpn_service_0_with_http_info(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service_0\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service_0\"\n end\n # verify the required parameter 'l2_vpn_service' is set\n if @api_client.config.client_side_validation && l2_vpn_service.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_service' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_tier1_l2_vpn_service_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_service)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2VPNService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_update_tier1_l2_vpn_service_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_l2_vpn_session(l2vpn_session_id, opts = {})\n data, _status_code, _headers = get_l2_vpn_session_with_http_info(l2vpn_session_id, opts)\n data\n end",
"def connect!\n @socket = @socket_factory.open( @socket_name )\n\n # determine what type of agent we're communicating with\n buffer = @buffers.writer\n buffer.write_string Net::SSH::Transport::Session.version\n type, body = send_with_reply SSH2_AGENT_REQUEST_VERSION, buffer\n\n if type == SSH2_AGENT_VERSION_RESPONSE\n raise NotImplementedError, \"SSH2 agents are not yet supported\"\n elsif type != SSH_AGENT_RSA_IDENTITIES_ANSWER\n raise AgentError,\n \"unknown response from agent: #{type}, #{body.to_s.inspect}\"\n end\n end",
"def post_init\n start_tls(\n :verify_peer => true,\n :private_key_file => key_file,\n :cert_chain_file => crt_file\n )\n end",
"def connect_to_server_remote(info)\n # update connection data\n @use_http_tunnel = info[:use_http_tunnel]\n @host_server = info[:host_server]\n @port_server = info[:port_server]\n @login_name = info[:login_name]\n @password_saved = info[:password_saved] \n use_guest_login = info[:use_guest_login]\n \n # the connect dialog provide an already coded password\n # on server password in decoded and checked against a digest string in the database\n @password_login_md5 = info[:password_login_md5]\n \n # close old connection before\n @log.debug \"connect_to_server_remote\"\n @socket_srv.close if @socket_srv\n @id_http_session = nil\n #p @host_server, @port_server\n status = Timeout::timeout(6) {\n # avoid to blocking for more time\n @socket_srv = TCPSocket.new(@host_server, @port_server)\n }\n # reset connection data model\n @model_net_data.reset_data\n # avoid funny characters\n #@login_name = @login_name.slice(/\\w+/)\n # use the same regex as the registration (this check is also done on the server)\n @login_name = @login_name.slice(/\\A\\w[\\w\\.\\-_@]+\\z/)\n msg_det = \"#{@login_name},#{@password_login_md5}\"\n if use_guest_login\n msg_det = \"ospite,ospite\"\n end\n \n #send login message\n cmd_to_send = build_cmd(:login, msg_det)\n send_data_to_server(cmd_to_send)\n #start read thread\n if @use_http_tunnel\n @rd_sock_thread = Thread.new{read_data_on_http_tunnel}\n else\n @rd_sock_thread = Thread.new{ background_read }\n end\n rescue Timeout::Error\n @cup_gui.log_sometext \"ERRORE: timeout connessione col server \"\n @cup_gui.log_sometext \" #{@host_server}:#{@port_server} (#{$!})\\n\"\n @socket_srv = nil\n rescue\n @cup_gui.log_sometext \"Errore connessione server #{@host_server}:#{@port_server} (#{$!})\\n\"\n @cup_gui.log_sometext \"Probabilmente il server e' offline, oppure le configurazioni del PC non consentono l'accesso ad internet\\n\"\n @socket_srv = nil\n end",
"def setup_socket\n ctx = setup_certificate\n\n APN.log(:debug, \"Connecting to #{@host}:#{@port}...\")\n\n socket_tcp = TCPSocket.new(@host, @port)\n OpenSSL::SSL::SSLSocket.new(socket_tcp, ctx).tap do |s|\n s.sync = true\n s.connect\n end\n end",
"def get_tier0_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_0_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier0_l2_vpn_session_remote_macs_for_ls_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def open_listener\n @listener = PCAPRUB::Pcap.open_live(IFACE, 65535, false, 1)\n @listener.setfilter(\"tcp port #{@port} and tcp[tcpflags] & tcp-ack != 0\")\n end",
"def read_l2_vpn_context_with_http_info(tier_0_id, locale_service_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_context ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_context\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_context\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnContext')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#read_l2_vpn_context\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def process_ntlm_type1(type1_msg)\n type2_msg = Net::NTLM::Message::Type2.new.tap do |msg|\n msg.target_name = 'LOCALHOST'.encode('UTF-16LE').b\n msg.flag = 0\n %i{ KEY56 KEY128 KEY_EXCHANGE UNICODE TARGET_INFO VERSION_INFO }.each do |flag|\n msg.flag |= NTLM::NEGOTIATE_FLAGS.fetch(flag)\n end\n\n if type1_msg.flag & NTLM::NEGOTIATE_FLAGS[:EXTENDED_SECURITY] == NTLM::NEGOTIATE_FLAGS[:EXTENDED_SECURITY]\n msg.flag |= NTLM::NEGOTIATE_FLAGS[:EXTENDED_SECURITY]\n end\n\n @server_challenge = @provider.generate_server_challenge\n msg.challenge = @server_challenge.unpack1('Q<') # 64-bit unsigned, little endian (uint64_t)\n target_info = Net::NTLM::TargetInfo.new('')\n target_info.av_pairs.merge!({\n Net::NTLM::TargetInfo::MSV_AV_NB_DOMAIN_NAME => @provider.netbios_domain.encode('UTF-16LE').b,\n Net::NTLM::TargetInfo::MSV_AV_NB_COMPUTER_NAME => @provider.netbios_hostname.encode('UTF-16LE').b,\n Net::NTLM::TargetInfo::MSV_AV_DNS_DOMAIN_NAME => @provider.dns_domain.encode('UTF-16LE').b,\n Net::NTLM::TargetInfo::MSV_AV_DNS_COMPUTER_NAME => @provider.dns_hostname.encode('UTF-16LE').b,\n Net::NTLM::TargetInfo::MSV_AV_TIMESTAMP => [(Time.now.to_i + Net::NTLM::TIME_OFFSET) * Field::FileTime::NS_MULTIPLIER].pack('Q')\n })\n msg.target_info = target_info.to_s\n msg.enable(:target_info)\n msg.context = 0\n msg.enable(:context)\n msg.os_version = NTLM::OSVersion.new(major: 6, minor: 3).to_binary_s\n msg.enable(:os_version)\n end\n\n type2_msg\n end",
"def establish\n @proxy = XMLRPC::Client.new(@hostname, '/RPC2', @port).proxy(@proxy_name)\n end",
"def negotiate!(socket, timeout); end",
"def create_or_update_tier1_l2_vpn_service_0(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n data, _status_code, _headers = create_or_update_tier1_l2_vpn_service_0_with_http_info(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts)\n data\n end",
"def create_esb_server (config, hostname, ip1, ip2)\n config.vm.define hostname do |esb|\n esb.vm.provider \"virtualbox\" do |provider|\n provider.customize [\"modifyvm\", :id, \"--memory\", 2048]\n end\n\n esb.vm.network \"private_network\", ip: ip1\n esb.vm.host_name = hostname\n\n esb.vm.network \"private_network\", ip: ip2\n end\nend",
"def create\n @vpn = Vpn.new(params[:vpn])\n @vpn.account_id = @oeaccount.id\n respond_to do |format|\n if @vpn.save\n format.html { redirect_to @vpn, notice: 'Vpn was successfully created.' }\n format.json { render json: @vpn, status: :created, location: @vpn }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vpn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_create_connection(connection_id)\n if @connections[connection_id]\n E \"asked to create already open connection #{connection_id}\"\n return\n end\n \n D \"Tunnel #{connection_id} to #{@tunnel_to_host} port #{@tunnel_to_port}\"\n connection = EventMachine.connect(@tunnel_to_host, @tunnel_to_port,\n Client::TunnelConnection, connection_id, @client)\n @connections[connection_id] = connection\n end",
"def create_or_update_l2_vpn_service_0_with_http_info(tier_0_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service_0\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service_0\"\n end\n # verify the required parameter 'l2_vpn_service' is set\n if @api_client.config.client_side_validation && l2_vpn_service.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_service' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_update_l2_vpn_service_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_service)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2VPNService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_update_l2_vpn_service_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def default_tls_port; end",
"def create_session\n @connection.create_session(@config || {})\n end",
"def delete_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.delete_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.delete_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, 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: ManagementPlaneApiVpnL2VpnSessionsApi#delete_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def connect!(agent_socket_factory = T.unsafe(nil), identity_agent = T.unsafe(nil)); end",
"def opentok_session\n opentok.create_session(request.remote_addr).to_s\n end",
"def connect!\n com::unboundid::ldap::sdk::LDAPConnection.new(\n self.host, self.port, self.bind_dn, self.password) \n end",
"def connect_ssl; end",
"def make_single_bridged_node(vm)\n make_proxmox_vm(vm)\n connect_vbox_adapter(vm, @wifi_bridge, 'bridged', @nat_net_cidr)\n\n end",
"def create_or_patch_l2_vpn_service_with_http_info(tier_0_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_service ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_service\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_service\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_service\"\n end\n # verify the required parameter 'l2_vpn_service' is set\n if @api_client.config.client_side_validation && l2_vpn_service.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_service' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_l2_vpn_service\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_service)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, 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: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_patch_l2_vpn_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update(options={})\n param = { :uniq_id => @uniq_id }.merge options\n data = Storm::Base::SODServer.remote_call '/VPN/update', param\n self.from_hash data\n end",
"def create_session(timeout=nil)\n if timeout.class == Fixnum && !block_given?\n return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createSession, [Java::long.java_class]).call(timeout),::VertxWeb::Session)\n end\n raise ArgumentError, \"Invalid arguments when calling create_session(timeout)\"\n end",
"def start\n case ssl\n when :tls\n @connection = LDAP::SSLConn.new(host, port, true)\n when true\n @connection = LDAP::SSLConn.new(host, port)\n else\n @connection = LDAP::Conn.new(host, port)\n end\n @connection.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n @connection.set_option(LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_ON)\n @connection.simple_bind(user, password)\n rescue => detail\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end",
"def connect!(in_user, in_password, in_host)\n begin\n @sa_connection=OpswareClient\n @sa_connection.connect(\"https\".to_java, in_host, port, in_user, in_password, true)\n require 'sasync/hpsa_tools/hpsa_tools'\n extend Sasync::HpsaTools\n rescue NativeException => e\n puts \"Error during connection with error: #{e}\"\n return\n end\n\n self.initialize_framework\n #puts @sa_connection.isConnected\n #puts connection_info\n end",
"def request_listen\n send_command RemoteListenCommand.new(@client.remote_listen_address)\n enable_tunnel_timeouts \n end",
"def open_connection\n # FIXME il timeout serve solamente nella versione tcp\n # FIXME perchè utilizzare un'istanza di classe? non sarebbe meglio avere un metodo che genera il transport\n # e successivamente viene utilizzato sempre quello?\n Timeout.timeout @timeout do\n case @transport\n when :tcp\n @connection = KonoEppClient::Transport::TcpTransport.new(server, port)\n when :http\n @connection = KonoEppClient::Transport::HttpTransport.new(server, port,\n ssl_version: ssl_version,\n cookie_file: \"#{@tag.downcase}.cookies.pstore\"\n )\n end\n end\n end",
"def init_proxy(env, secret)\n record = SystemConsole.find_by!(:url_secret => secret) # Retrieve the ticket record using the secret\n\n begin\n ws_sock = env['rack.hijack'].call # Hijack the socket from the incoming HTTP connection\n console_sock = TCPSocket.open(record.host_name, record.port) # Open a TCP connection to the remote endpoint\n\n ws_sock.autoclose = false\n console_sock.autoclose = false\n\n # These adapters will be used for reading/writing from/to the particular sockets\n @adapters[console_sock] = ClientAdapter.new(record, console_sock)\n @adapters[ws_sock] = ServerAdapter.new(record, env, ws_sock)\n\n @proxy.push(ws_sock, console_sock)\n rescue StandardError => ex\n cleanup(:error, \"RemoteConsole proxy for VM %{vm_id} errored with #{ex} #{ex.backtrace.join(\"\\n\")}\", console_sock, ws_sock, record)\n RACK_404\n else\n @logger.info(\"Starting RemoteConsole proxy for VM #{record.vm_id}\")\n RACK_YAY # Rack needs this as a return value\n ensure\n # Release the connection because one SPICE console can open multiple TCP connections\n ActiveRecord::Base.connection_pool.release_connection\n end\n end",
"def create_or_patch_tier1_l2_vpn_service_with_http_info(tier_1_id, locale_service_id, service_id, l2_vpn_service, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_tier1_l2_vpn_service ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_tier1_l2_vpn_service\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_tier1_l2_vpn_service\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_tier1_l2_vpn_service\"\n end\n # verify the required parameter 'l2_vpn_service' is set\n if @api_client.config.client_side_validation && l2_vpn_service.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_service' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.create_or_patch_tier1_l2_vpn_service\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_service)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, 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: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#create_or_patch_tier1_l2_vpn_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] | [
"0.685843",
"0.61380833",
"0.6061185",
"0.5906935",
"0.58896804",
"0.58732396",
"0.58028316",
"0.57887095",
"0.5749061",
"0.5645838",
"0.5626455",
"0.55933565",
"0.55907303",
"0.54721963",
"0.5393742",
"0.5384021",
"0.53733975",
"0.5359921",
"0.5348103",
"0.53226995",
"0.530905",
"0.52109164",
"0.51919276",
"0.51861274",
"0.516458",
"0.516458",
"0.5158416",
"0.51506895",
"0.5139192",
"0.5135034",
"0.5131007",
"0.5125869",
"0.50982547",
"0.50888646",
"0.5069807",
"0.5067182",
"0.5048744",
"0.50455993",
"0.502288",
"0.4991504",
"0.49877733",
"0.49780002",
"0.4964824",
"0.4964824",
"0.4963007",
"0.49624187",
"0.49544272",
"0.4944314",
"0.4927452",
"0.4927452",
"0.4919271",
"0.49057588",
"0.4896184",
"0.4876976",
"0.4848366",
"0.4847122",
"0.48408988",
"0.48352218",
"0.48329154",
"0.4828015",
"0.4825206",
"0.48150116",
"0.48041326",
"0.48020762",
"0.479674",
"0.47910833",
"0.47895795",
"0.47753733",
"0.4775237",
"0.4769681",
"0.47637096",
"0.47416073",
"0.4740002",
"0.47386158",
"0.47329876",
"0.47329554",
"0.47306705",
"0.47276443",
"0.47263944",
"0.4724621",
"0.47155952",
"0.47097743",
"0.47094122",
"0.4703591",
"0.47025794",
"0.4695893",
"0.46953493",
"0.46928212",
"0.4690381",
"0.46814138",
"0.46814045",
"0.46706623",
"0.46634066",
"0.46609136",
"0.46585718",
"0.46585473",
"0.46499446",
"0.46445358",
"0.46415386",
"0.46410897"
] | 0.6675386 | 1 |
Delete a L2VPN session Delete a specific L2VPN session. If there are any logical switch ports attached to it, those needs to be deleted first. | def delete_l2_vpn_session(l2vpn_session_id, opts = {})
delete_l2_vpn_session_with_http_info(l2vpn_session_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.delete_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.delete_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, 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: ManagementPlaneApiVpnL2VpnSessionsApi#delete_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete_session(env, sid, options); end",
"def delete\n if @session\n @session.destroy\n @session = nil\n end\n end",
"def delete_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def deleteSession(sessionID)\n call :deleteSession, :sessionID => sessionID\n end",
"def delete\n return unless @session\n @session.destroy\n @session = nil\n end",
"def delete_session(session_id)\n delete(\"session:#{session_id}\")\n end",
"def destroy_session\n response_handler(rest_delete('/rest/login-sessions'))\n self\n end",
"def delete_sessions(node)\n @sessions.delete_all(node)\n end",
"def destroy\n self.class.delete_all(\"session_id='#{session_id}'\")\n end",
"def destroy\n set_session\n\n if @session.destroy\n respond_to do |format|\n format.html { redirect_back allow_other_host: false, fallback_location: batch_connect_sessions_url, notice: t(\"dashboard.batch_connect_sessions_status_blurb_delete_success\") }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_back allow_other_host: false, fallback_location: batch_connect_sessions_url, alert: t(\"dashboard.batch_connect_sessions_status_blurb_delete_failure\") }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @session.clear\n end",
"def delete\n if self.class.exists?(handle.address, handle.use_ssl?, handle.port)\n self.class.session_store.delete(self.class.key(handle.address, handle.use_ssl?, handle.port))\n end\n end",
"def delete_session(session)\n return Seasar::Rack::Session.delete_session(@env, session)\n end",
"def destroy_session2_id\n url = \"https://208.65.111.144/rest/Session/logout/{'session_id':'#{get_session2}'}\"\n begin\n apiRequest(url)\n rescue Restclient::InternalServerError => e\n error_message = e.response[e.response.index('faultstring')+14..-3]\n if error_message != \"Session id is expired or doesn't exist\"\n puts \"Something went wrong trying to logout\"\n end\n end\n @@session_id = nil\n end",
"def delete_session\n @env['java.servlet_request'].session.invalidate\n end",
"def delete_session(req, sid, options)\n @lock.delete_session(req.env, sid)\n generate_sid unless options[:drop]\n end",
"def delete_session(env, sid, options)\n @cache.delete(cache_key(sid.private_id))\n @cache.delete(cache_key(sid.public_id))\n generate_sid\n end",
"def destroy\n requires :vpn_connection_id\n\n service.delete_vpn_connection(vpn_connection_id)\n true\n end",
"def delete_l2_vpn(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n delete_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts)\n nil\n end",
"def delete_session(request, _sid, options)\n old_record = destroy_session(request)\n return if options[:drop]\n\n generate_sid.tap do |new_sid|\n if options[:renew]\n request.env[SESSION_RECORD_KEY] =\n @@session_class.create(session_id: new_sid, data: old_record&.data)\n end\n end\n end",
"def destroy\n session.delete(:user)\n end",
"def delete\n GLOBAL_HASH_TABLE.delete(@session_id)\n end",
"def destroy\n @current_session = CurrentSession.find(params[:id])\n @current_session.destroy\n\n head :no_content\n end",
"def delete_tunnel\n super\n end",
"def destroy\n @ykt_session = YktSession.find(params[:id])\n @ykt_session.destroy\n\n respond_to do |format|\n format.html { redirect_to ykt_sessions_url }\n format.json { head :no_content }\n end\n end",
"def kill_session\n session[:session] = false\n session[:sessionToken] = \"\"\n session[:sessionMember] = \"\"\n session[:sessionMV] = \"\"\n session[:sessionOffer] = \"\"\n end",
"def kill_session\n# DEBUG\n# logger.debug \"\\r\\n!! ------ in kill_session -----\"\n# logger.debug params\n if params[:id]\n logger.debug \"\\r\\n!! Killing session #{params[:id]}...\"\n Session.where( :id => params[:id] ).delete_all\n flash[:notice] = I18n.t(:session_deleted)\n else\n flash[:error] = I18n.t(:unable_to_delete_session)\n end\n redirect_to( whos_online_path() )\n end",
"def destroy\n @otg_sess.destroy\n respond_to do |format|\n format.html { redirect_to otg_sesses_url, notice: 'Otg sess was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_session(env, sid, options)\n raise '#destroy_session not implemented'\n end",
"def destroy \n\t session[:guestaccount_id] = nil \n\t \n\tend",
"def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\n if(params[:token].nil?)\n response.status = 400\n render json: {msg: \"Token is not defined\"}\n return\n end\n\n session = validate_session(params[:token])\n\n if session.nil?\n response.status = 401\n render json: {}\n return\n end\n\n begin\n obj = User.find(params[:id])\n\n unless session.user.id == obj.id\n response.status = 403\n render json: {}\n return\n end\n\n # This is what slows down the response.\n # Big DB transactions that delete by foreign key.\n obj.time_sessions.destroy_all\n obj.login_sessions.destroy_all\n\n obj.destroy\n response.status = 20\n render json: {msg: obj.time_sessions.methods}\n rescue ActiveRecord::RecordNotFound => e\n response.status = 404\n render json: {}\n rescue Exception => e\n response.status = 500\n render json: {msg: e}\n end\n\n end",
"def delete_session\n session[:userid] = nil\n session[:attributes] = nil\n end",
"def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server.destroy\n session[:server_id] = nil\n respond_to do |format|\n format.html { redirect_to servers_url, notice: t('notice.server.deleted') }\n end\n end",
"def destroy\n @session_replica.destroy\n respond_to do |format|\n format.html { redirect_to session_replicas_url }\n format.json { head :no_content }\n end\n end",
"def kill_session\n @authenticator.kill_session\n @session = ''\n end",
"def destroy\n logout!\n redirect_to new_session_url\n end",
"def destroy\n\t\t# reset_session will kill the existing session\n\t\treset_session\n\t\tredirect_to '/login'\n\tend",
"def unlink_sessions(session1, session2)\n if session1.b2b_anchor_leg?\n anchor_leg = session1\n peer_leg = session2\n else\n anchor_leg = session2\n peer_leg = session1\n end\n anchor_leg[:_sipper_b2b_peer] = nil\n peer_leg[:_sipper_b2b_peer] = nil\n peer_leg.revert_to_local_session_lock\n end",
"def destroy\n @vpn = Vpn.find(params[:id])\n checkaccountobject(\"vpns\",@vpn)\n @vpn.send_delete\n\n respond_to do |format|\n format.html { redirect_to vpns_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @vpn = current_user.vpn\n @vpn.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboard_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return unless restrict_to_hosts\n\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def action_delete\n if current_resource.exists?\n converge_by(\"remove l2interface #{current_resource.name}\") do\n command = \"netdev l2interface delete #{new_resource.l2_interface_name}\"\n execute_command(command)\n end\n end\n end",
"def destroy\n\t\treset_session\n\t\tredirect_to new_session_path\n\tend",
"def delete_poll_session(poll_id,id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :id => id\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions/{id}\",\n :poll_id => poll_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:delete, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:delete, path, query_params, form_params, headers)\n page_params_store(:delete, path)\n response\n \n end",
"def destroy\n @discovery_session = DiscoverySession.find(params[:id])\n @discovery_session.destroy\n\n respond_to do |format|\n format.html { redirect_to discovery_sessions_url }\n format.json { head :no_content }\n end\n end",
"def revoke_session(user)\n\t\[email protected] user\n\tend",
"def session_destroy(input={}, raw=false)\n response = get('mw/Session.Destroy', input, raw)\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n # reset auth key to nil\n @auth_key = nil\n end",
"def destroy\n @pool_session = PoolSession.find(params[:id])\n @pool_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(sessions_url) }\n format.xml { head :ok }\n end\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n # reset auth key to nil\n @auth_key = nil\n end",
"def destroy\n UserSession.find.try(:destroy)\n redirect_back_or_default login_url\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n ensure\n # reset auth key to nil\n @auth_key = nil\n end",
"def delete\n java_session = @java_request.getSession(false)\n java_session.invalidate if java_session\n end",
"def destroy\n @session_plan_category.session_plans.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to session_plan_category_session_plans_path(@session_plan_category), notice: 'Session Plan was successfully removed.'}\n format.json { head :no_content }\n end\n end",
"def delete(sObjectType, hParams)\n case sObjectType\n when :network\n HPNetwork.delete_network(hParams[:network_connection],\n hParams[:network])\n when :rule\n HPSecurityGroups.delete_rule(hParams[:network_connection],\n hParams[:id])\n obj = hParams[:network_connection]\n obj.security_group_rules.get(hParams[:id]).destroy\n when :server\n required?(hParams, :compute_connection)\n required?(hParams, :server)\n HPCompute.delete_server(hParams[:compute_connection],\n hParams[:server])\n end\n end",
"def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to(sessions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @session_operation.destroy\n respond_to do |format|\n format.html { redirect_to session_operations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = shift_argument ||\n raise(Heroku::Command::CommandFailed, \"Usage: sessions:destroy [ID]\")\n session = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :delete,\n :path => \"/oauth/sessions/#{CGI.escape(id)}\"\n ).body\n end\n puts %{Destroyed \"#{session[\"description\"]}\".}\n end",
"def destroy_session_token!\n update_attribute(:session_token, nil)\n end",
"def destroy\r\n @session = Session.find(params[:id])\r\n @session.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(sessions_url) }\r\n format.xml { head :ok }\r\n format.json { head :ok }\r\n\r\n end\r\n end",
"def delete_session(account_id,\r\n session_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/sessions/{sessionId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false },\r\n 'sessionId' => { 'value' => session_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n when 404\r\n raise APIException.new(\r\n 'Not Found',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def destroy\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :ok }\n end\n end",
"def destroy(env)\n destroy_session(env, current_session_id(env), {})\n end",
"def destroy\n @session_resource.destroy\n\n head :no_content\n end",
"def delete_l2_vpn_0(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n delete_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts)\n nil\n end",
"def close_session(s)\n @sessions.delete(s)\n end",
"def destroy\n @user_session = @current_user_session\n if @user_session\n @user_session.destroy\n end\n redirect_to login_path\n end",
"def destroy\n session.delete(:user_id) if session[:user_id]\n redirect_to new_session_path\n end",
"def destroy_session\n session = Authentication::Session.active_token_session(auth_token)\n session.logout unless session.nil?\n clear_cache(auth_token)\n return {'success' => true}\n end",
"def destroy\n return if Settings.readonly \n\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy \n reset_session\n redirect_to \"/login\"\n end",
"def destroy\n session.destroy\n redirect_to root_path \n end",
"def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end",
"def delete_tls_sub(opts = {})\n delete_tls_sub_with_http_info(opts)\n nil\n end",
"def delete_vm(instance_id)\n with_thread_name(\"delete_vm(#{instance_id}):v2\") do\n logger.info(\"Deleting instance '#{instance_id}'\")\n @cloud_core.delete_vm(instance_id) do |instance_id|\n @registry.delete_settings(instance_id) if @stemcell_api_version < 2\n end\n end\n end",
"def destroy\n session.delete(:user_id)\n session.delete(:auth)\n flash[:notice] = 'Logged out successfully.'\n redirect_to \"/home\"\n end",
"def destroy\n @guest_session_association.destroy\n respond_to do |format|\n format.html { redirect_to jam_sessions_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @session.created_by == current_user.id\n @session.destroy\n else\n flash[:notice] = \"Cannot delete session as you did not create it.\"\n end\n respond_to do |format|\n format.html { redirect_to game_sessions_url }\n format.json { head :no_content }\n end\n end",
"def logout\n payload = delete_session(params[:user_id], params[:session_token], params[:csrf_token])\n if payload == :SESSION_DELETED\n notify_session(\"SESSION_END_NOTICE\", {reason: \"LOGOUT\"}, params[:session_token])\n render status: 200, json: {error: false}\n elsif payload == :SESSION_NO_AUTH\n render status: 403, json: {error: true}\n else\n render status: 404, json: {error: true}\n end\n end",
"def destroy\n user_id = app_session.current_user_id\n current_user_session.register_logout\n\n app_session.logged_out\n DeterLab.logout(user_id)\n SslKeyStorage.delete(user_id)\n\n ActivityLog.for_user(user_id).add(:logout, user_id)\n rescue DeterLab::NotLoggedIn\n # That's ok. We are logging out anyway\n ensure\n redirect_to :login, notice: t(\".success\")\n end",
"def logout\n FlexmlsApi.logger.info(\"Logging out.\")\n delete(\"/session/#{@session.auth_token}\") unless @session.nil?\n @session = nil\n end",
"def destroy\n log_out_user\n redirect_to new_session_url\n end",
"def destroy\n session.delete :name\n end",
"def destroy\n requires :id\n \n service.delete_nat_gateway(id)\n true\n end",
"def destroy\n if params[:id]\n User.find(params[:id]).update_attributes(:last_connected_at => Time.now)\n end\n logout_killing_session!\n #flash[:notice] = I18n.t('user.session.logout_notice')\n redirect_back_or_default('/')\n end",
"def destroy\n @frozen_tunnel_io = FrozenTunnelIo.find(params[:id])\n @frozen_tunnel_io.destroy\n\n respond_to do |format|\n format.html { redirect_to frozen_tunnel_ios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lift_session.destroy\n respond_to do |format|\n format.html { redirect_to lift_sessions_url, notice: 'Lift session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n session.clear\n\n redirect_to root_url\n end",
"def destroy\n @tsession.destroy\n respond_to do |format|\n format.html { redirect_to tsessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy_session_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.destroy_session ...'\n end\n # resource path\n local_var_path = '/v1/sessions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\n\n new_options = opts.merge(\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 => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#destroy_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def remove_session(session)\n found = nil\n @model.each do |model,path,iter|\n if (iter[ID_SESSION] == session.sid.to_s)\n found = iter\n break\n end\n end\n\n @model.remove(found) if found\n end",
"def delete_session(jid)\n @sessions.delete(jid)\n end",
"def delete\n execute_prlctl('delete', @uuid)\n end",
"def destroy\n session.clear\n redirect_to root_path\n end",
"def destroy\n session.clear\n redirect_to root_path\n end",
"def destroy\n session.clear\n redirect_to root_path\n end",
"def destroy\n session.clear\n redirect_to root_path\n end"
] | [
"0.6884213",
"0.6750097",
"0.6658194",
"0.65352345",
"0.63437486",
"0.6209401",
"0.6108679",
"0.60897464",
"0.60321873",
"0.60032254",
"0.59915",
"0.598154",
"0.5939608",
"0.58934855",
"0.5891",
"0.588163",
"0.5875589",
"0.58510727",
"0.5823639",
"0.5803315",
"0.57784283",
"0.5777508",
"0.5772703",
"0.57592344",
"0.57285386",
"0.5719959",
"0.5704451",
"0.5702362",
"0.56824625",
"0.56539613",
"0.5650779",
"0.5625811",
"0.5621429",
"0.5603283",
"0.5594342",
"0.55906916",
"0.557973",
"0.5577025",
"0.55767256",
"0.55730206",
"0.5566791",
"0.55541646",
"0.5548591",
"0.5537656",
"0.5530177",
"0.5519192",
"0.5518616",
"0.54942024",
"0.5493291",
"0.54905856",
"0.54839003",
"0.548336",
"0.5479911",
"0.5477414",
"0.54745716",
"0.54530114",
"0.5450967",
"0.5449054",
"0.5446708",
"0.5442118",
"0.54388267",
"0.54356426",
"0.5430336",
"0.5430218",
"0.54249525",
"0.5424293",
"0.54150385",
"0.5403362",
"0.5403188",
"0.5399909",
"0.5399694",
"0.5394861",
"0.5391122",
"0.5381385",
"0.5370848",
"0.53641236",
"0.5359365",
"0.5358069",
"0.5354655",
"0.53406763",
"0.53380823",
"0.5332089",
"0.5328889",
"0.53281015",
"0.53266484",
"0.5325659",
"0.5323462",
"0.53212035",
"0.53205746",
"0.5319445",
"0.5318355",
"0.5315852",
"0.53150547",
"0.53128266",
"0.53093964",
"0.5306656",
"0.53064317",
"0.53064317",
"0.53064317",
"0.53064317"
] | 0.6743412 | 2 |
Delete a L2VPN session Delete a specific L2VPN session. If there are any logical switch ports attached to it, those needs to be deleted first. | def delete_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.delete_l2_vpn_session ...'
end
# verify the required parameter 'l2vpn_session_id' is set
if @api_client.config.client_side_validation && l2vpn_session_id.nil?
fail ArgumentError, "Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.delete_l2_vpn_session"
end
# resource path
local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementPlaneApiVpnL2VpnSessionsApi#delete_l2_vpn_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_session(env, sid, options); end",
"def delete_l2_vpn_session(l2vpn_session_id, opts = {})\n delete_l2_vpn_session_with_http_info(l2vpn_session_id, opts)\n nil\n end",
"def delete\n if @session\n @session.destroy\n @session = nil\n end\n end",
"def delete_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def deleteSession(sessionID)\n call :deleteSession, :sessionID => sessionID\n end",
"def delete\n return unless @session\n @session.destroy\n @session = nil\n end",
"def delete_session(session_id)\n delete(\"session:#{session_id}\")\n end",
"def destroy_session\n response_handler(rest_delete('/rest/login-sessions'))\n self\n end",
"def delete_sessions(node)\n @sessions.delete_all(node)\n end",
"def destroy\n self.class.delete_all(\"session_id='#{session_id}'\")\n end",
"def destroy\n set_session\n\n if @session.destroy\n respond_to do |format|\n format.html { redirect_back allow_other_host: false, fallback_location: batch_connect_sessions_url, notice: t(\"dashboard.batch_connect_sessions_status_blurb_delete_success\") }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_back allow_other_host: false, fallback_location: batch_connect_sessions_url, alert: t(\"dashboard.batch_connect_sessions_status_blurb_delete_failure\") }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @session.clear\n end",
"def delete\n if self.class.exists?(handle.address, handle.use_ssl?, handle.port)\n self.class.session_store.delete(self.class.key(handle.address, handle.use_ssl?, handle.port))\n end\n end",
"def delete_session(session)\n return Seasar::Rack::Session.delete_session(@env, session)\n end",
"def destroy_session2_id\n url = \"https://208.65.111.144/rest/Session/logout/{'session_id':'#{get_session2}'}\"\n begin\n apiRequest(url)\n rescue Restclient::InternalServerError => e\n error_message = e.response[e.response.index('faultstring')+14..-3]\n if error_message != \"Session id is expired or doesn't exist\"\n puts \"Something went wrong trying to logout\"\n end\n end\n @@session_id = nil\n end",
"def delete_session\n @env['java.servlet_request'].session.invalidate\n end",
"def delete_session(req, sid, options)\n @lock.delete_session(req.env, sid)\n generate_sid unless options[:drop]\n end",
"def delete_session(env, sid, options)\n @cache.delete(cache_key(sid.private_id))\n @cache.delete(cache_key(sid.public_id))\n generate_sid\n end",
"def destroy\n requires :vpn_connection_id\n\n service.delete_vpn_connection(vpn_connection_id)\n true\n end",
"def delete_l2_vpn(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n delete_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts)\n nil\n end",
"def delete_session(request, _sid, options)\n old_record = destroy_session(request)\n return if options[:drop]\n\n generate_sid.tap do |new_sid|\n if options[:renew]\n request.env[SESSION_RECORD_KEY] =\n @@session_class.create(session_id: new_sid, data: old_record&.data)\n end\n end\n end",
"def destroy\n session.delete(:user)\n end",
"def delete\n GLOBAL_HASH_TABLE.delete(@session_id)\n end",
"def destroy\n @current_session = CurrentSession.find(params[:id])\n @current_session.destroy\n\n head :no_content\n end",
"def delete_tunnel\n super\n end",
"def destroy\n @ykt_session = YktSession.find(params[:id])\n @ykt_session.destroy\n\n respond_to do |format|\n format.html { redirect_to ykt_sessions_url }\n format.json { head :no_content }\n end\n end",
"def kill_session\n session[:session] = false\n session[:sessionToken] = \"\"\n session[:sessionMember] = \"\"\n session[:sessionMV] = \"\"\n session[:sessionOffer] = \"\"\n end",
"def kill_session\n# DEBUG\n# logger.debug \"\\r\\n!! ------ in kill_session -----\"\n# logger.debug params\n if params[:id]\n logger.debug \"\\r\\n!! Killing session #{params[:id]}...\"\n Session.where( :id => params[:id] ).delete_all\n flash[:notice] = I18n.t(:session_deleted)\n else\n flash[:error] = I18n.t(:unable_to_delete_session)\n end\n redirect_to( whos_online_path() )\n end",
"def destroy\n @otg_sess.destroy\n respond_to do |format|\n format.html { redirect_to otg_sesses_url, notice: 'Otg sess was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_session(env, sid, options)\n raise '#destroy_session not implemented'\n end",
"def destroy \n\t session[:guestaccount_id] = nil \n\t \n\tend",
"def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\n if(params[:token].nil?)\n response.status = 400\n render json: {msg: \"Token is not defined\"}\n return\n end\n\n session = validate_session(params[:token])\n\n if session.nil?\n response.status = 401\n render json: {}\n return\n end\n\n begin\n obj = User.find(params[:id])\n\n unless session.user.id == obj.id\n response.status = 403\n render json: {}\n return\n end\n\n # This is what slows down the response.\n # Big DB transactions that delete by foreign key.\n obj.time_sessions.destroy_all\n obj.login_sessions.destroy_all\n\n obj.destroy\n response.status = 20\n render json: {msg: obj.time_sessions.methods}\n rescue ActiveRecord::RecordNotFound => e\n response.status = 404\n render json: {}\n rescue Exception => e\n response.status = 500\n render json: {msg: e}\n end\n\n end",
"def delete_session\n session[:userid] = nil\n session[:attributes] = nil\n end",
"def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server.destroy\n session[:server_id] = nil\n respond_to do |format|\n format.html { redirect_to servers_url, notice: t('notice.server.deleted') }\n end\n end",
"def destroy\n @session_replica.destroy\n respond_to do |format|\n format.html { redirect_to session_replicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n logout!\n redirect_to new_session_url\n end",
"def kill_session\n @authenticator.kill_session\n @session = ''\n end",
"def destroy\n\t\t# reset_session will kill the existing session\n\t\treset_session\n\t\tredirect_to '/login'\n\tend",
"def unlink_sessions(session1, session2)\n if session1.b2b_anchor_leg?\n anchor_leg = session1\n peer_leg = session2\n else\n anchor_leg = session2\n peer_leg = session1\n end\n anchor_leg[:_sipper_b2b_peer] = nil\n peer_leg[:_sipper_b2b_peer] = nil\n peer_leg.revert_to_local_session_lock\n end",
"def destroy\n @vpn = Vpn.find(params[:id])\n checkaccountobject(\"vpns\",@vpn)\n @vpn.send_delete\n\n respond_to do |format|\n format.html { redirect_to vpns_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @vpn = current_user.vpn\n @vpn.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboard_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return unless restrict_to_hosts\n\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def action_delete\n if current_resource.exists?\n converge_by(\"remove l2interface #{current_resource.name}\") do\n command = \"netdev l2interface delete #{new_resource.l2_interface_name}\"\n execute_command(command)\n end\n end\n end",
"def destroy\n\t\treset_session\n\t\tredirect_to new_session_path\n\tend",
"def delete_poll_session(poll_id,id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :id => id\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions/{id}\",\n :poll_id => poll_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:delete, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:delete, path, query_params, form_params, headers)\n page_params_store(:delete, path)\n response\n \n end",
"def destroy\n @discovery_session = DiscoverySession.find(params[:id])\n @discovery_session.destroy\n\n respond_to do |format|\n format.html { redirect_to discovery_sessions_url }\n format.json { head :no_content }\n end\n end",
"def revoke_session(user)\n\t\[email protected] user\n\tend",
"def session_destroy(input={}, raw=false)\n response = get('mw/Session.Destroy', input, raw)\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n # reset auth key to nil\n @auth_key = nil\n end",
"def destroy\n @pool_session = PoolSession.find(params[:id])\n @pool_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(sessions_url) }\n format.xml { head :ok }\n end\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n # reset auth key to nil\n @auth_key = nil\n end",
"def destroy\n UserSession.find.try(:destroy)\n redirect_back_or_default login_url\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n ensure\n # reset auth key to nil\n @auth_key = nil\n end",
"def delete\n java_session = @java_request.getSession(false)\n java_session.invalidate if java_session\n end",
"def destroy\n @session_plan_category.session_plans.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to session_plan_category_session_plans_path(@session_plan_category), notice: 'Session Plan was successfully removed.'}\n format.json { head :no_content }\n end\n end",
"def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to(sessions_url) }\n format.xml { head :ok }\n end\n end",
"def delete(sObjectType, hParams)\n case sObjectType\n when :network\n HPNetwork.delete_network(hParams[:network_connection],\n hParams[:network])\n when :rule\n HPSecurityGroups.delete_rule(hParams[:network_connection],\n hParams[:id])\n obj = hParams[:network_connection]\n obj.security_group_rules.get(hParams[:id]).destroy\n when :server\n required?(hParams, :compute_connection)\n required?(hParams, :server)\n HPCompute.delete_server(hParams[:compute_connection],\n hParams[:server])\n end\n end",
"def destroy\n @session_operation.destroy\n respond_to do |format|\n format.html { redirect_to session_operations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = shift_argument ||\n raise(Heroku::Command::CommandFailed, \"Usage: sessions:destroy [ID]\")\n session = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :delete,\n :path => \"/oauth/sessions/#{CGI.escape(id)}\"\n ).body\n end\n puts %{Destroyed \"#{session[\"description\"]}\".}\n end",
"def destroy_session_token!\n update_attribute(:session_token, nil)\n end",
"def destroy\r\n @session = Session.find(params[:id])\r\n @session.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(sessions_url) }\r\n format.xml { head :ok }\r\n format.json { head :ok }\r\n\r\n end\r\n end",
"def delete_session(account_id,\r\n session_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/sessions/{sessionId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false },\r\n 'sessionId' => { 'value' => session_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n when 404\r\n raise APIException.new(\r\n 'Not Found',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def destroy\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :ok }\n end\n end",
"def destroy(env)\n destroy_session(env, current_session_id(env), {})\n end",
"def destroy\n @session_resource.destroy\n\n head :no_content\n end",
"def close_session(s)\n @sessions.delete(s)\n end",
"def destroy\n @user_session = @current_user_session\n if @user_session\n @user_session.destroy\n end\n redirect_to login_path\n end",
"def destroy\n session.delete(:user_id) if session[:user_id]\n redirect_to new_session_path\n end",
"def delete_l2_vpn_0(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n delete_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts)\n nil\n end",
"def destroy_session\n session = Authentication::Session.active_token_session(auth_token)\n session.logout unless session.nil?\n clear_cache(auth_token)\n return {'success' => true}\n end",
"def destroy\n return if Settings.readonly \n\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy \n reset_session\n redirect_to \"/login\"\n end",
"def destroy\n session.destroy\n redirect_to root_path \n end",
"def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end",
"def delete_tls_sub(opts = {})\n delete_tls_sub_with_http_info(opts)\n nil\n end",
"def destroy\n session.delete(:user_id)\n session.delete(:auth)\n flash[:notice] = 'Logged out successfully.'\n redirect_to \"/home\"\n end",
"def delete_vm(instance_id)\n with_thread_name(\"delete_vm(#{instance_id}):v2\") do\n logger.info(\"Deleting instance '#{instance_id}'\")\n @cloud_core.delete_vm(instance_id) do |instance_id|\n @registry.delete_settings(instance_id) if @stemcell_api_version < 2\n end\n end\n end",
"def destroy\n @guest_session_association.destroy\n respond_to do |format|\n format.html { redirect_to jam_sessions_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @session.created_by == current_user.id\n @session.destroy\n else\n flash[:notice] = \"Cannot delete session as you did not create it.\"\n end\n respond_to do |format|\n format.html { redirect_to game_sessions_url }\n format.json { head :no_content }\n end\n end",
"def logout\n payload = delete_session(params[:user_id], params[:session_token], params[:csrf_token])\n if payload == :SESSION_DELETED\n notify_session(\"SESSION_END_NOTICE\", {reason: \"LOGOUT\"}, params[:session_token])\n render status: 200, json: {error: false}\n elsif payload == :SESSION_NO_AUTH\n render status: 403, json: {error: true}\n else\n render status: 404, json: {error: true}\n end\n end",
"def destroy\n user_id = app_session.current_user_id\n current_user_session.register_logout\n\n app_session.logged_out\n DeterLab.logout(user_id)\n SslKeyStorage.delete(user_id)\n\n ActivityLog.for_user(user_id).add(:logout, user_id)\n rescue DeterLab::NotLoggedIn\n # That's ok. We are logging out anyway\n ensure\n redirect_to :login, notice: t(\".success\")\n end",
"def logout\n FlexmlsApi.logger.info(\"Logging out.\")\n delete(\"/session/#{@session.auth_token}\") unless @session.nil?\n @session = nil\n end",
"def destroy\n log_out_user\n redirect_to new_session_url\n end",
"def destroy\n session.delete :name\n end",
"def destroy\n if params[:id]\n User.find(params[:id]).update_attributes(:last_connected_at => Time.now)\n end\n logout_killing_session!\n #flash[:notice] = I18n.t('user.session.logout_notice')\n redirect_back_or_default('/')\n end",
"def destroy\n requires :id\n \n service.delete_nat_gateway(id)\n true\n end",
"def destroy\n @lift_session.destroy\n respond_to do |format|\n format.html { redirect_to lift_sessions_url, notice: 'Lift session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n session.clear\n\n redirect_to root_url\n end",
"def destroy\n @frozen_tunnel_io = FrozenTunnelIo.find(params[:id])\n @frozen_tunnel_io.destroy\n\n respond_to do |format|\n format.html { redirect_to frozen_tunnel_ios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tsession.destroy\n respond_to do |format|\n format.html { redirect_to tsessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy_session_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.destroy_session ...'\n end\n # resource path\n local_var_path = '/v1/sessions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\n\n new_options = opts.merge(\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 => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#destroy_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def remove_session(session)\n found = nil\n @model.each do |model,path,iter|\n if (iter[ID_SESSION] == session.sid.to_s)\n found = iter\n break\n end\n end\n\n @model.remove(found) if found\n end",
"def delete_session(jid)\n @sessions.delete(jid)\n end",
"def destroy\n session.clear\n redirect_to root_path\n end",
"def destroy\n session.clear\n redirect_to root_path\n end",
"def destroy\n session.clear\n redirect_to root_path\n end",
"def destroy\n session.clear\n redirect_to root_path\n end",
"def delete\n execute_prlctl('delete', @uuid)\n end"
] | [
"0.6753051",
"0.6744462",
"0.6662052",
"0.65379804",
"0.6346409",
"0.62133276",
"0.6111714",
"0.60931176",
"0.6034961",
"0.60064596",
"0.59941137",
"0.59852016",
"0.59428304",
"0.5897266",
"0.5892356",
"0.5884579",
"0.5878992",
"0.58543134",
"0.5823081",
"0.5802549",
"0.5781515",
"0.5780969",
"0.5776053",
"0.57626545",
"0.57280785",
"0.5722704",
"0.5707332",
"0.5704109",
"0.5685475",
"0.56569767",
"0.56529295",
"0.56291324",
"0.5624746",
"0.5606917",
"0.55977356",
"0.5592936",
"0.55813813",
"0.5579605",
"0.5578916",
"0.5576744",
"0.5567642",
"0.5554725",
"0.55499977",
"0.55403906",
"0.5529739",
"0.5522652",
"0.55208015",
"0.5496547",
"0.5495188",
"0.54931164",
"0.54869515",
"0.54856086",
"0.5483069",
"0.54804176",
"0.54776675",
"0.54558784",
"0.5452546",
"0.54498905",
"0.54492795",
"0.54447806",
"0.54402083",
"0.5438245",
"0.5433585",
"0.5432453",
"0.54285014",
"0.54274225",
"0.5418128",
"0.54058915",
"0.540352",
"0.54028934",
"0.5402589",
"0.539816",
"0.53947914",
"0.53846806",
"0.5374411",
"0.53677994",
"0.5359684",
"0.53582835",
"0.53575826",
"0.5343255",
"0.5341544",
"0.5335308",
"0.5331665",
"0.53314465",
"0.532969",
"0.53287625",
"0.5322765",
"0.53225493",
"0.53220963",
"0.53218347",
"0.53204614",
"0.5318583",
"0.53175414",
"0.53155595",
"0.5312522",
"0.5310055",
"0.5310055",
"0.5310055",
"0.5310055",
"0.5307408"
] | 0.68838084 | 0 |
Get a L2VPN session Get a specific L2VPN session | def get_l2_vpn_session(l2vpn_session_id, opts = {})
data, _status_code, _headers = get_l2_vpn_session_with_http_info(l2vpn_session_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSession')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#get_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_session2\n privileged = @@session_id_privileged rescue false\n if !privileged\n @@session_id = nil\n @@session_id_privileged = true\n end\n begin\n if not @@session_id.nil?\n return @@session_id\n else\n @@session_id = get_new_session2\n end\n rescue\n @@session_id = get_new_session2\n end\n return @@session_id\n end",
"def session_get\n nessus_rest_get(\"session\")\n end",
"def create_l2_vpn_session_with_http_info(l2_vpn_session, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session ...'\n end\n # verify the required parameter 'l2_vpn_session' is set\n if @api_client.config.client_side_validation && l2_vpn_session.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_session' when calling ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions'\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_session)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, 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 => 'L2VpnSession')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#create_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_l2_vpn_sessions(opts = {})\n data, _status_code, _headers = list_l2_vpn_sessions_with_http_info(opts)\n data\n end",
"def get_session( params )\n LastFM.get( \"auth.getSession\", params, :secure )\n end",
"def find_session(env, sid); end",
"def read_l2_vpn(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n data, _status_code, _headers = read_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts)\n data\n end",
"def retrieve_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def get_session_key\n\t\tres = RestClient.get 'https://secure.techfortesco.com/groceryapi_b1/restservice.aspx', {:params => {:command => 'LOGIN', :email => '[email protected]', :password => 'stokfridge', :developerkey => 'OULdsDZaBmGE47M7SWK2', :applicationkey => '04291BA250D2B7D6A01D'}}\n\t\tres = JSON.parse(res)\n\t\tres['SessionKey']\n\tend",
"def get_session(env, sid)\n raise '#get_session not implemented.'\n end",
"def list_l2_vpn_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/vpn/l2vpn/sessions'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'l2vpn_service_id'] = opts[:'l2vpn_service_id'] if !opts[:'l2vpn_service_id'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSessionListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#list_l2_vpn_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_l2_vpn_session(l2_vpn_session, opts = {})\n data, _status_code, _headers = create_l2_vpn_session_with_http_info(l2_vpn_session, opts)\n data\n end",
"def C_GetSessionInfo()\n @pk.C_GetSessionInfo(@sess)\n end",
"def get_session(env, sid)\n raise '#get_session needs to be implemented.'\n end",
"def get_l2_vpn_session_peer_codes_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}/peer-codes'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSessionPeerCodes')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#get_l2_vpn_session_peer_codes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_session\n @authenticator.get_session\n end",
"def get_session(options = {})\n get_session!(options)\n rescue Error::SessionsNotSupported\n nil\n end",
"def sess\n self.http_get(self.session_uri)#.tap{|t| STDERR.puts \"Trace: #{caller[1]}: returning #{t}\"}\n end",
"def get_session\n @session = Session.find(@blocker.session_id)\n end",
"def session\n Session.wrap(Cproton.pn_link_session(@impl))\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier1_l2_vpn_session_remote_macs_for_ls\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_info\n @info ||= @instance.client.getSessionInfo(sessionID: @id)\n end",
"def update_l2_vpn_session_with_http_info(l2vpn_session_id, l2_vpn_session, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session\"\n end\n # verify the required parameter 'l2_vpn_session' is set\n if @api_client.config.client_side_validation && l2_vpn_session.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_session' when calling ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_session)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2VpnSession')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#update_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def open_session\n s = Session.wrap(Cproton.pn_session(@impl))\n s.open\n return s\n end",
"def opentok_session\n opentok.create_session(request.remote_addr).to_s\n end",
"def get_session\n env = get_session_tagged\n req_headers = env.request_headers\n res_headers = env.response_headers\n @session.class.new(user_id: req_headers['mhvCorrelationId'],\n expires_at: res_headers['expires'],\n token: res_headers['token'])\n end",
"def read_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2Vpn')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#read_l2_vpn\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get\n params.required(:id)\n\n # Grab the device that is trying to authenticate\n unathenticated_error unless @api_consumer.is_a? Service\n service = @api_consumer\n\n @session = service.sessions.find(params[:id])\n end",
"def get_session( env, sid )\n return _get_session( env, sid ) unless env['rack.multithread']\n mutex.synchronize do\n return _get_session( env, sid )\n end \n end",
"def get_session(options = {})\n resp = @connection.post do |req|\n req.headers = { :Accept => 'application/json'}\n req.url 'v1/sessions'\n req.body = options.to_json\n end\n check_response_for_errors resp.body\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier1_l2_vpn_session_remote_macs_for_ls_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def ebayapi_get_session_id\n ebay= Ebay::Api.new\n begin\n response = ebay.get_session_id(:ru_name => EBAY_RU_NAME)\n if response.ack ==\"Success\"\n session_id = response.session_id\n end\n rescue Exception => e\n logger.info e.message\n end\n session_id\n end",
"def retrieve\n session = session_from_redis\n return session if session.present?\n\n establish_chip_session\n end",
"def get(session=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\t# The KS to be parsed, keep it empty to use current session.\n\t\t\tclient.add_param(kparams, 'session', session);\n\t\t\tclient.queue_service_action_call('session', 'get', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def read_l2_vpn_0(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n data, _status_code, _headers = read_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts)\n data\n end",
"def select_session\n @session = Session.find_by_session_id(@session_id)\n @session = @session.last rescue @session\n set_req_no\n end",
"def session_get(id)\n sessions.select {|s| s.SessionId().to_s == id.to_s}\n end",
"def get_l2_vpn_session_summary(opts = {})\n data, _status_code, _headers = get_l2_vpn_session_summary_with_http_info(opts)\n data\n end",
"def web_session()\n get(:signed, {:method => \"auth.getWebSession\"})\n end",
"def get_okta_session_token\n url = \"#{APP_CONFIG['okta_base_url']}/api/v1/authn\"\n body = { username: APP_CONFIG['okta_username'], password: APP_CONFIG['okta_password'] }.to_json\n result = HTTParty.post(url, body: body, headers: {\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json'\n })\n result['sessionToken']\n end",
"def delete_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.delete_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.delete_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, 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: ManagementPlaneApiVpnL2VpnSessionsApi#delete_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_ssh_session\n ssh = nil\n begin\n ssh = Net::SSH.start(@node, @user, :password => @password)\n ssh.loop(true)\n rescue Exception => e\n puts \"Unknown Net:SSH Exception : #{e.message}\"\n return nil\n end\n ssh\n end",
"def sessionGet(options={})\n assert_valid_keys(options, :sessionId)\n assert_keys_exists(options, :sessionId)\n execute(:sessionGet, options)\n end",
"def sessionGet(options={})\n assert_valid_keys(options, :sessionId)\n assert_keys_exists(options, :sessionId)\n execute(:sessionGet, options)\n end",
"def get_session\n session = Session.create!(key: Random.rand(0xFFFFFFFF).to_s)\n render json: { id: session.id, key: session.key }\n end",
"def fetch_session_key(&blk)\n doc = last_fm_web_service(\"method\" => \"auth.gettoken\")\n request_token = doc.value_at(\"//token\")\n\n yield \"http://www.last.fm/api/auth/?api_key=#{api_key}&token=#{request_token}\"\n\n doc = last_fm_web_service(\"method\" => \"auth.getsession\", \"token\" => request_token)\n\n @session_key = doc.value_at(\"//key\")\n @user = doc.value_at(\"//name\")\n\n @session_key\n end",
"def get_login(token)\n session[:login] ||= query_login(token)\nend",
"def get(req)\n # TODO: check that we aren't already connected\n session = ::Ebay::Api.session\n Lynr.cache.set(\"#{req.session['dealer_id']}_ebay_session\", YAML.dump(session))\n redirect ::Ebay::Api.sign_in_url(session)\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n data, _status_code, _headers = get_tier1_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts)\n data\n end",
"def get_with_session_login(path, session)\n get path, nil, {\"rack.session\" => {\"uid\" => session['uid']}}\n end",
"def get_l2_vpn_session_summary_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnStatisticsL2VpnSessionsSummaryApi.get_l2_vpn_session_summary ...'\n end\n if @api_client.config.client_side_validation && opts[:'source'] && !['realtime', 'cached'].include?(opts[:'source'])\n fail ArgumentError, 'invalid value for \"source\", must be one of realtime, cached'\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/summary'\n\n # query parameters\n query_params = {}\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VPNSessionSummary')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnStatisticsL2VpnSessionsSummaryApi#get_l2_vpn_session_summary\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_session\n return Seasar::CGI::Session.get_session(@cgi)\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls_0(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n data, _status_code, _headers = get_tier1_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts)\n data\n end",
"def get_session\n return Seasar::Rack::Session.get_session(@env)\n end",
"def read_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_0\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2Vpn')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#read_l2_vpn_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_session(session_id)\n session = Session.find(:first, :conditions => ['session_id=?', session_id])\n return session\n end",
"def chat_find_one_session(from_person_id, other_person_id)\n ChatSession.all.each { |s|\n p = s.participants\n #puts \"#{s.id}: #{p.size}\"\n next if p.size != 2\n return s if((p[0].person_id == from_person_id and p[1].person_id == other_person_id) or (p[1].person_id == from_person_id and p[0].person_id == other_person_id))\n }\n return nil\n end",
"def session(token)\n get(:signed, {:method => \"auth.getSession\", :token => token})\n end",
"def vcd_session(vcd, username, password)\n vcd_session_link = RestClient::Resource.new(vcd + '/api/sessions', username, password )\n vcd_session_response = vcd_session_link.post({'Accept' => 'application/*+xml;version=5.5'})\n myvar = 'x_vcloud_authorization'\n @mysession = vcd_session_response.headers[myvar.to_sym]\nend",
"def get_session_id\n check_lisitng_id\n calendar_frame = get_vrbo_calendar_page.iframes.first.src\n page = @agent.get calendar_frame\n link = page.links[3].href\n uri = Addressable::URI.parse(link)\n uri.query_values['sessionId']\n end",
"def get_tier0_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_0_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier0_l2_vpn_session_remote_macs_for_ls\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_session_id\n @agent.get( @root_url + '/dwr/engine.js') do |page|\n @session_id = extract_session_id(page.body)\n end\n end",
"def getSessionInfo(sessionID)\n call :getSessionInfo, :sessionID => sessionID\n end",
"def session(id)\n search_sessions(xml_doc, id).first\n end",
"def get_session(env, sid)\n\n # Start each HTTP request with a fresh view of the repository.\n Maglev.abort_transaction\n\n session = @sessions[sid] if sid\n unless sid and session\n session = Hash.new\n sid = generate_sid\n @sessions[sid] = session # Rely on the commit_transaction in set_session\n end\n return [sid, session]\n rescue Exception => e\n puts \"== Get Session: EXCEPTION: #{e}\"\n return [nil, {}]\n end",
"def get_new_session\n client = prepare_request(auth_url)\n\n login_response = do_request_and_handle_errors do\n client.request :login do |soap|\n soap.body = {:id => @user, :pw => @pass}\n end\n end\n\n @session = login_response.to_hash[:login_response][:login_return]\n @cookie = login_response.http.headers[\"Set-Cookie\"]\n\n false unless @session.instance_of? Nori::StringWithAttributes\n end",
"def get_token\n return if @session_token\n\n response = request @google + '/accounts/AuthSubSessionToken'\n\n response.body =~ /^Token=(.*)/\n\n @authsub_token = $1\n @http.headers['Authorization'] = \"AuthSub token=\\\"#{@authsub_token}\\\"\"\n @session_token = true\n end",
"def get_session_guid(timeout=nil)\n request = Packet.create_request(COMMAND_ID_CORE_GET_SESSION_GUID)\n\n args = [request]\n args << timeout if timeout\n\n response = client.send_request(*args)\n\n response.get_tlv_value(TLV_TYPE_SESSION_GUID)\n end",
"def sessionGet(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :sessionId)\n assert_keys_exists(options, :sessionId)\n execute(:sessionGet, options)\n end",
"def _get_session(env, sid)\n logger.debug \"Getting session info for #{sid.inspect}\"\n if sid\n ses_obj = sessions.find_one( { :_id => sid } )\n if ses_obj \n logger.debug \"Found session object on #{sid.inspect}\"\n else\n logger.debug \"Unable to find session object #{sid.inspect}\"\n end\n session = MongoRack::SessionHash.new( deserialize(ses_obj['data']) ) if ses_obj and fresh?( ses_obj )\n end\n \n unless sid and session\n logger.warn \"Session ID not found - #{sid.inspect} - Creating new session\"\n session = MongoRack::SessionHash.new\n sid = generate_sid\n ret = sessions.save( { :_id => sid, :data => serialize(session) } )\n raise \"Session collision on '#{sid.inspect}'\" unless ret\n end\n merged = MongoRack::SessionHash.new.merge(session)\n logger.debug \"Setting old session #{merged.inspect}\" \n session.instance_variable_set( '@old', merged )\n return [sid, session]\n rescue => boom \n logger.error \"#{self} Hoy! something bad happened loading session data\"\n logger.error $!.inspect\n boom.backtrace.each{ |l| logger.error l } \n return [ nil, MongoRack::SessionHash.new ]\n end",
"def session\n return nil unless session_id\n QuoVadis::Session.find_by id: session_id\n end",
"def session; @session; end",
"def session; @session; end",
"def session; @session; end",
"def get_session_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.get_session ...\"\n end\n # resource path\n local_var_path = \"/session\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'InlineResponse20043')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#get_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def open_session; end",
"def get_tier0_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_0_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier0_l2_vpn_session_remote_macs_for_ls_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def ebayapi_get_fetch_token\n begin\n ebay=Ebay::Api.new\n if ebayapi_get_session_id && ebay_get_session_id.session_id\n # here maybe call by the view\n response = ebay.fetch_token(:session_id => ebayapi_get_session_id.session_id)\n if response.ack == \"Success\"\n auth_token = response.auth_token\n save_ebay_auth_token(auth_token)\n end\n end\n rescue Exception => e\n logger.info e.message\n end\n end",
"def login_5\n\n #definde needed header\n headers = {'Authorization' => \"Basic \" + @base_user_string, 'Accept' => 'application/*+xml;version=1.5'}\n\n #Login\n response = request({:method => \"POST\", :url => @host + \"session\", :headers => headers})\n\n #Get authentication header key\n @auth_key = response.headers[:x_vcloud_authorization]\n\n\n #Get organisation link\n parse_content(response.body, '//Session/Link').each do |org|\n\n if org.attribute('type')==\"application/vnd.vmware.vcloud.orgList+xml\"\n res = request({:url => org.attribute('href').to_s})\n @org_link = parse_content(res, '//OrgList/Org')[0].attribute('href').to_s\n end\n\n end\n\n end",
"def getplayer2\r\n\t\t\treturn @player2\r\n\t\tend",
"def get_router_ipaddr()\n SNMP::Manager.open(\n :Host => RouterIP,\n :Community => SNMPpw,\n :Timeout => 60,\n :Retries => 5\n ) do |manager|\n # XXX Timeout on the next line (or the one below) will kick us out.\n response = manager.get([\"ip.21.1.7.0.0.0.0\"])\n response.each_varbind do |vb|\n default_route = \"#{vb.value.to_s}\"\n # puts \"ip.21.1.7.#{default_route}\"\n response = manager.get([\"ip.21.1.7.#{default_route}\"])\n response.each_varbind do |vb|\n my_ipaddr = \"#{vb.value.to_s}\"\n # puts my_ipaddr\n return my_ipaddr\n end\n end\n end\nend",
"def get_session_key\n action = 'uam'\n\n url_params = {\n 'action' => action,\n 'rssuserid' => @parameters['RSSAdminUserID'],\n 'rssurl' => @parameters['RSSURL'],\n 'rssdsn' => @parameters['RSSDSN'],\n 'packetuser' => @parameters['PacketUser'],\n 'assignedby' => @parameters['RSSAdminUserID'],\n 'tssurl' => @parameters['TSSURL']\n }\n\n response_body = get_request(url_params).body\n \n key = response_body.match(/sessionKey = '(.*?)';/)[1]\n if key.nil?\n raise StandardError, \"Session key not found\"\n else\n return key\n end\n end",
"def info id\n get(\"ssl/v1/#{id}\")\n end",
"def session_from_redis\n redis_handler.get\n end",
"def current_member\n session[:oracle] ||= Oracle::Session.new(request.remote_ip)\n end",
"def login(user, password, sid = nil)\n sid ||= IDMIN + rand(IDMAX-IDMIN)\n @nurl ||= \"https://localhost:8834/\"\n post = { \"username\" => user, \"password\" => password, 'seq' => sid }\n\n response_json = nessus_request('session', post)\n\n if response_json['token']\n @token = response_json['token']\n @name = user\n @seqid = sid\n # Compatibility with XMLRPC ivar\n user_permissions = nessus_request('session', auth_header, :get)['permissions']\n @admin = ([64,128].any? {|perm| perm == user_permissions}).to_s.upcase\n return @token\n else\n raise \"Cannot authenticate to #{@nurl} as #{user} with #{password} due to #{response_json['error']}\"\n end\n\n end",
"def gettoken(url,username,password,tenant)\n url1 = \"#{url}/identity/api/tokens\"\n uri = URI.parse(url1)\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request.body = JSON.dump({\n \"username\" => username,\n \"password\" => password,\n \"tenant\" => tenant\n })\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n verify_mode: OpenSSL::SSL::VERIFY_NONE,\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n token_output = response.body\n token_json = JSON.parse(token_output)\n vra_token = token_json[\"id\"]\n return vra_token\n end",
"def session\n Thread.current['clients_manager'].client('Website').session\n end",
"def find_negotiate_context(type)\n negotiate_context_list.find { |nc| nc.context_type == type }\n end",
"def get_ebay_session(req)\n session_data = Lynr.cache.get(\"#{req.session['dealer_id']}_ebay_session\")\n YAML.load(session_data)\n end",
"def list(options={})\n param = { :uniq_id => @uniq_id }.merge options\n Storm::Base::SODServer.remote_list '/VPN/list', param do |u|\n user = VPNUser.new\n user.from_hash u\n user\n end\n end",
"def get_token\n get(TOKEN_URL)\n end",
"def create_session\n raw_token, enc_token = account.create_session(ip, meta_info)\n set_account_cache(account, raw_token)\n set_auth_token_cache(enc_token, raw_token)\n return raw_token\n end",
"def auth_get(path)\n\t\theader = {\n\t\t\t\"Cookie\" => \"JSESSIONID=#{@cookies['JSESSIONID']}\",\n\t\t}\n\t\treturn @conn.get(path, header)\n\tend",
"def session\n @connection.request('session-get') do |resp|\n if resp == :connection_error\n yield :connection_error\n else\n yield Session.new(resp)\n end\n end\n end",
"def _session\n\t\t\tThread.current[SESSION]\n\t\tend",
"def fetch_olympus_session0\n\n\n response = request(:get, \"https://appstoreconnect.apple.com/olympus/v1/session\")\n body = response.body\n if body\n body = JSON.parse(body) if body.kind_of?(String)\n user_map = body[\"user\"]\n if user_map\n self.user_email = user_map[\"emailAddress\"]\n end\n\n provider = body[\"provider\"]\n if provider\n self.provider = Spaceship::Provider.new(provider_hash: provider)\n return true\n end\n end\n\n return false\n end",
"def read_l2_vpn_context_with_http_info(tier_0_id, locale_service_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_context ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_context\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_context\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnContext')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#read_l2_vpn_context\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_smite_api_session\n session_timestamp = Time.now.getutc.strftime(\"%Y%m%d%H%M%S\")\n session_string = \"#{ENV['SMITE_API_DEV_ID']}\" + 'createsession' + \"#{ENV['SMITE_API_AUTHKEY']}\" + session_timestamp\n session_signature = Digest::MD5.hexdigest(session_string)\n\n smite_session = RestClient.get(\"#{SMITE_PC_URL}/createsessionJson/#{ENV['SMITE_API_DEV_ID']}/#{session_signature}/#{session_timestamp}\")\n JSON.parse(smite_session)['session_id']\nend"
] | [
"0.68863684",
"0.65346664",
"0.6142881",
"0.6033498",
"0.5987291",
"0.58496064",
"0.582263",
"0.5783638",
"0.57282025",
"0.570861",
"0.5691314",
"0.56578994",
"0.56189305",
"0.55903184",
"0.55779153",
"0.5559573",
"0.5545683",
"0.55303633",
"0.55278563",
"0.55197275",
"0.5499265",
"0.54878104",
"0.5465208",
"0.54404634",
"0.54361564",
"0.54340744",
"0.5418243",
"0.5399869",
"0.5398241",
"0.5385278",
"0.5373699",
"0.5366883",
"0.53325737",
"0.5319466",
"0.53159064",
"0.5313214",
"0.5306728",
"0.5306056",
"0.52945745",
"0.52913195",
"0.526938",
"0.52641886",
"0.52465194",
"0.52445555",
"0.52445555",
"0.52378494",
"0.52231836",
"0.51883215",
"0.5175455",
"0.5172091",
"0.5168124",
"0.5158572",
"0.5145218",
"0.51411927",
"0.5139072",
"0.51269007",
"0.51156723",
"0.51108164",
"0.51053697",
"0.51020545",
"0.50822383",
"0.50802183",
"0.50636065",
"0.5060087",
"0.5047657",
"0.5042794",
"0.5031099",
"0.50186855",
"0.50066596",
"0.5005027",
"0.4996782",
"0.4986133",
"0.49606833",
"0.49606833",
"0.49606833",
"0.49523968",
"0.49521512",
"0.49496365",
"0.49364528",
"0.4914481",
"0.4913534",
"0.4908072",
"0.48899508",
"0.48889396",
"0.48818606",
"0.4878309",
"0.4867148",
"0.48611903",
"0.48519173",
"0.48423854",
"0.48342106",
"0.48267162",
"0.48265973",
"0.4826378",
"0.48242626",
"0.48149034",
"0.4813621",
"0.48081216",
"0.4806783",
"0.48013756"
] | 0.67856747 | 1 |
Get a L2VPN session Get a specific L2VPN session | def get_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session ...'
end
# verify the required parameter 'l2vpn_session_id' is set
if @api_client.config.client_side_validation && l2vpn_session_id.nil?
fail ArgumentError, "Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session"
end
# resource path
local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'L2VpnSession')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementPlaneApiVpnL2VpnSessionsApi#get_l2_vpn_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_l2_vpn_session(l2vpn_session_id, opts = {})\n data, _status_code, _headers = get_l2_vpn_session_with_http_info(l2vpn_session_id, opts)\n data\n end",
"def get_session2\n privileged = @@session_id_privileged rescue false\n if !privileged\n @@session_id = nil\n @@session_id_privileged = true\n end\n begin\n if not @@session_id.nil?\n return @@session_id\n else\n @@session_id = get_new_session2\n end\n rescue\n @@session_id = get_new_session2\n end\n return @@session_id\n end",
"def session_get\n nessus_rest_get(\"session\")\n end",
"def create_l2_vpn_session_with_http_info(l2_vpn_session, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session ...'\n end\n # verify the required parameter 'l2_vpn_session' is set\n if @api_client.config.client_side_validation && l2_vpn_session.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_session' when calling ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions'\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_session)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, 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 => 'L2VpnSession')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#create_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_l2_vpn_sessions(opts = {})\n data, _status_code, _headers = list_l2_vpn_sessions_with_http_info(opts)\n data\n end",
"def get_session( params )\n LastFM.get( \"auth.getSession\", params, :secure )\n end",
"def find_session(env, sid); end",
"def read_l2_vpn(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n data, _status_code, _headers = read_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts)\n data\n end",
"def retrieve_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def get_session_key\n\t\tres = RestClient.get 'https://secure.techfortesco.com/groceryapi_b1/restservice.aspx', {:params => {:command => 'LOGIN', :email => '[email protected]', :password => 'stokfridge', :developerkey => 'OULdsDZaBmGE47M7SWK2', :applicationkey => '04291BA250D2B7D6A01D'}}\n\t\tres = JSON.parse(res)\n\t\tres['SessionKey']\n\tend",
"def get_session(env, sid)\n raise '#get_session not implemented.'\n end",
"def list_l2_vpn_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/vpn/l2vpn/sessions'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'l2vpn_service_id'] = opts[:'l2vpn_service_id'] if !opts[:'l2vpn_service_id'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSessionListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#list_l2_vpn_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_l2_vpn_session(l2_vpn_session, opts = {})\n data, _status_code, _headers = create_l2_vpn_session_with_http_info(l2_vpn_session, opts)\n data\n end",
"def C_GetSessionInfo()\n @pk.C_GetSessionInfo(@sess)\n end",
"def get_session(env, sid)\n raise '#get_session needs to be implemented.'\n end",
"def get_l2_vpn_session_peer_codes_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}/peer-codes'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSessionPeerCodes')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#get_l2_vpn_session_peer_codes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_session\n @authenticator.get_session\n end",
"def get_session(options = {})\n get_session!(options)\n rescue Error::SessionsNotSupported\n nil\n end",
"def sess\n self.http_get(self.session_uri)#.tap{|t| STDERR.puts \"Trace: #{caller[1]}: returning #{t}\"}\n end",
"def get_session\n @session = Session.find(@blocker.session_id)\n end",
"def session\n Session.wrap(Cproton.pn_link_session(@impl))\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier1_l2_vpn_session_remote_macs_for_ls\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_info\n @info ||= @instance.client.getSessionInfo(sessionID: @id)\n end",
"def update_l2_vpn_session_with_http_info(l2vpn_session_id, l2_vpn_session, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session\"\n end\n # verify the required parameter 'l2_vpn_session' is set\n if @api_client.config.client_side_validation && l2_vpn_session.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_session' when calling ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_session)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2VpnSession')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#update_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def open_session\n s = Session.wrap(Cproton.pn_session(@impl))\n s.open\n return s\n end",
"def opentok_session\n opentok.create_session(request.remote_addr).to_s\n end",
"def get_session\n env = get_session_tagged\n req_headers = env.request_headers\n res_headers = env.response_headers\n @session.class.new(user_id: req_headers['mhvCorrelationId'],\n expires_at: res_headers['expires'],\n token: res_headers['token'])\n end",
"def read_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2Vpn')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#read_l2_vpn\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get\n params.required(:id)\n\n # Grab the device that is trying to authenticate\n unathenticated_error unless @api_consumer.is_a? Service\n service = @api_consumer\n\n @session = service.sessions.find(params[:id])\n end",
"def get_session( env, sid )\n return _get_session( env, sid ) unless env['rack.multithread']\n mutex.synchronize do\n return _get_session( env, sid )\n end \n end",
"def get_session(options = {})\n resp = @connection.post do |req|\n req.headers = { :Accept => 'application/json'}\n req.url 'v1/sessions'\n req.body = options.to_json\n end\n check_response_for_errors resp.body\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier1_l2_vpn_session_remote_macs_for_ls_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def ebayapi_get_session_id\n ebay= Ebay::Api.new\n begin\n response = ebay.get_session_id(:ru_name => EBAY_RU_NAME)\n if response.ack ==\"Success\"\n session_id = response.session_id\n end\n rescue Exception => e\n logger.info e.message\n end\n session_id\n end",
"def retrieve\n session = session_from_redis\n return session if session.present?\n\n establish_chip_session\n end",
"def get(session=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\t# The KS to be parsed, keep it empty to use current session.\n\t\t\tclient.add_param(kparams, 'session', session);\n\t\t\tclient.queue_service_action_call('session', 'get', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def read_l2_vpn_0(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n data, _status_code, _headers = read_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts)\n data\n end",
"def select_session\n @session = Session.find_by_session_id(@session_id)\n @session = @session.last rescue @session\n set_req_no\n end",
"def session_get(id)\n sessions.select {|s| s.SessionId().to_s == id.to_s}\n end",
"def get_l2_vpn_session_summary(opts = {})\n data, _status_code, _headers = get_l2_vpn_session_summary_with_http_info(opts)\n data\n end",
"def web_session()\n get(:signed, {:method => \"auth.getWebSession\"})\n end",
"def get_okta_session_token\n url = \"#{APP_CONFIG['okta_base_url']}/api/v1/authn\"\n body = { username: APP_CONFIG['okta_username'], password: APP_CONFIG['okta_password'] }.to_json\n result = HTTParty.post(url, body: body, headers: {\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json'\n })\n result['sessionToken']\n end",
"def delete_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.delete_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.delete_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, 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: ManagementPlaneApiVpnL2VpnSessionsApi#delete_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_ssh_session\n ssh = nil\n begin\n ssh = Net::SSH.start(@node, @user, :password => @password)\n ssh.loop(true)\n rescue Exception => e\n puts \"Unknown Net:SSH Exception : #{e.message}\"\n return nil\n end\n ssh\n end",
"def sessionGet(options={})\n assert_valid_keys(options, :sessionId)\n assert_keys_exists(options, :sessionId)\n execute(:sessionGet, options)\n end",
"def sessionGet(options={})\n assert_valid_keys(options, :sessionId)\n assert_keys_exists(options, :sessionId)\n execute(:sessionGet, options)\n end",
"def get_session\n session = Session.create!(key: Random.rand(0xFFFFFFFF).to_s)\n render json: { id: session.id, key: session.key }\n end",
"def fetch_session_key(&blk)\n doc = last_fm_web_service(\"method\" => \"auth.gettoken\")\n request_token = doc.value_at(\"//token\")\n\n yield \"http://www.last.fm/api/auth/?api_key=#{api_key}&token=#{request_token}\"\n\n doc = last_fm_web_service(\"method\" => \"auth.getsession\", \"token\" => request_token)\n\n @session_key = doc.value_at(\"//key\")\n @user = doc.value_at(\"//name\")\n\n @session_key\n end",
"def get_login(token)\n session[:login] ||= query_login(token)\nend",
"def get(req)\n # TODO: check that we aren't already connected\n session = ::Ebay::Api.session\n Lynr.cache.set(\"#{req.session['dealer_id']}_ebay_session\", YAML.dump(session))\n redirect ::Ebay::Api.sign_in_url(session)\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n data, _status_code, _headers = get_tier1_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts)\n data\n end",
"def get_with_session_login(path, session)\n get path, nil, {\"rack.session\" => {\"uid\" => session['uid']}}\n end",
"def get_l2_vpn_session_summary_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnStatisticsL2VpnSessionsSummaryApi.get_l2_vpn_session_summary ...'\n end\n if @api_client.config.client_side_validation && opts[:'source'] && !['realtime', 'cached'].include?(opts[:'source'])\n fail ArgumentError, 'invalid value for \"source\", must be one of realtime, cached'\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/summary'\n\n # query parameters\n query_params = {}\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VPNSessionSummary')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnStatisticsL2VpnSessionsSummaryApi#get_l2_vpn_session_summary\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_session\n return Seasar::CGI::Session.get_session(@cgi)\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls_0(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n data, _status_code, _headers = get_tier1_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts)\n data\n end",
"def get_session\n return Seasar::Rack::Session.get_session(@env)\n end",
"def read_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_0\"\n end\n # verify the required parameter 'l2vpn_id' is set\n if @api_client.config.client_side_validation && l2vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns/{l2vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l2vpn-id' + '}', l2vpn_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2Vpn')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#read_l2_vpn_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_session(session_id)\n session = Session.find(:first, :conditions => ['session_id=?', session_id])\n return session\n end",
"def chat_find_one_session(from_person_id, other_person_id)\n ChatSession.all.each { |s|\n p = s.participants\n #puts \"#{s.id}: #{p.size}\"\n next if p.size != 2\n return s if((p[0].person_id == from_person_id and p[1].person_id == other_person_id) or (p[1].person_id == from_person_id and p[0].person_id == other_person_id))\n }\n return nil\n end",
"def session(token)\n get(:signed, {:method => \"auth.getSession\", :token => token})\n end",
"def vcd_session(vcd, username, password)\n vcd_session_link = RestClient::Resource.new(vcd + '/api/sessions', username, password )\n vcd_session_response = vcd_session_link.post({'Accept' => 'application/*+xml;version=5.5'})\n myvar = 'x_vcloud_authorization'\n @mysession = vcd_session_response.headers[myvar.to_sym]\nend",
"def get_session_id\n check_lisitng_id\n calendar_frame = get_vrbo_calendar_page.iframes.first.src\n page = @agent.get calendar_frame\n link = page.links[3].href\n uri = Addressable::URI.parse(link)\n uri.query_values['sessionId']\n end",
"def get_tier0_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_0_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier0_l2_vpn_session_remote_macs_for_ls\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_session_id\n @agent.get( @root_url + '/dwr/engine.js') do |page|\n @session_id = extract_session_id(page.body)\n end\n end",
"def getSessionInfo(sessionID)\n call :getSessionInfo, :sessionID => sessionID\n end",
"def session(id)\n search_sessions(xml_doc, id).first\n end",
"def get_session(env, sid)\n\n # Start each HTTP request with a fresh view of the repository.\n Maglev.abort_transaction\n\n session = @sessions[sid] if sid\n unless sid and session\n session = Hash.new\n sid = generate_sid\n @sessions[sid] = session # Rely on the commit_transaction in set_session\n end\n return [sid, session]\n rescue Exception => e\n puts \"== Get Session: EXCEPTION: #{e}\"\n return [nil, {}]\n end",
"def get_new_session\n client = prepare_request(auth_url)\n\n login_response = do_request_and_handle_errors do\n client.request :login do |soap|\n soap.body = {:id => @user, :pw => @pass}\n end\n end\n\n @session = login_response.to_hash[:login_response][:login_return]\n @cookie = login_response.http.headers[\"Set-Cookie\"]\n\n false unless @session.instance_of? Nori::StringWithAttributes\n end",
"def get_token\n return if @session_token\n\n response = request @google + '/accounts/AuthSubSessionToken'\n\n response.body =~ /^Token=(.*)/\n\n @authsub_token = $1\n @http.headers['Authorization'] = \"AuthSub token=\\\"#{@authsub_token}\\\"\"\n @session_token = true\n end",
"def get_session_guid(timeout=nil)\n request = Packet.create_request(COMMAND_ID_CORE_GET_SESSION_GUID)\n\n args = [request]\n args << timeout if timeout\n\n response = client.send_request(*args)\n\n response.get_tlv_value(TLV_TYPE_SESSION_GUID)\n end",
"def sessionGet(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :sessionId)\n assert_keys_exists(options, :sessionId)\n execute(:sessionGet, options)\n end",
"def _get_session(env, sid)\n logger.debug \"Getting session info for #{sid.inspect}\"\n if sid\n ses_obj = sessions.find_one( { :_id => sid } )\n if ses_obj \n logger.debug \"Found session object on #{sid.inspect}\"\n else\n logger.debug \"Unable to find session object #{sid.inspect}\"\n end\n session = MongoRack::SessionHash.new( deserialize(ses_obj['data']) ) if ses_obj and fresh?( ses_obj )\n end\n \n unless sid and session\n logger.warn \"Session ID not found - #{sid.inspect} - Creating new session\"\n session = MongoRack::SessionHash.new\n sid = generate_sid\n ret = sessions.save( { :_id => sid, :data => serialize(session) } )\n raise \"Session collision on '#{sid.inspect}'\" unless ret\n end\n merged = MongoRack::SessionHash.new.merge(session)\n logger.debug \"Setting old session #{merged.inspect}\" \n session.instance_variable_set( '@old', merged )\n return [sid, session]\n rescue => boom \n logger.error \"#{self} Hoy! something bad happened loading session data\"\n logger.error $!.inspect\n boom.backtrace.each{ |l| logger.error l } \n return [ nil, MongoRack::SessionHash.new ]\n end",
"def session\n return nil unless session_id\n QuoVadis::Session.find_by id: session_id\n end",
"def session; @session; end",
"def session; @session; end",
"def session; @session; end",
"def get_session_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.get_session ...\"\n end\n # resource path\n local_var_path = \"/session\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'InlineResponse20043')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#get_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def open_session; end",
"def get_tier0_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_0_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier0_l2_vpn_session_remote_macs_for_ls_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def ebayapi_get_fetch_token\n begin\n ebay=Ebay::Api.new\n if ebayapi_get_session_id && ebay_get_session_id.session_id\n # here maybe call by the view\n response = ebay.fetch_token(:session_id => ebayapi_get_session_id.session_id)\n if response.ack == \"Success\"\n auth_token = response.auth_token\n save_ebay_auth_token(auth_token)\n end\n end\n rescue Exception => e\n logger.info e.message\n end\n end",
"def login_5\n\n #definde needed header\n headers = {'Authorization' => \"Basic \" + @base_user_string, 'Accept' => 'application/*+xml;version=1.5'}\n\n #Login\n response = request({:method => \"POST\", :url => @host + \"session\", :headers => headers})\n\n #Get authentication header key\n @auth_key = response.headers[:x_vcloud_authorization]\n\n\n #Get organisation link\n parse_content(response.body, '//Session/Link').each do |org|\n\n if org.attribute('type')==\"application/vnd.vmware.vcloud.orgList+xml\"\n res = request({:url => org.attribute('href').to_s})\n @org_link = parse_content(res, '//OrgList/Org')[0].attribute('href').to_s\n end\n\n end\n\n end",
"def getplayer2\r\n\t\t\treturn @player2\r\n\t\tend",
"def get_router_ipaddr()\n SNMP::Manager.open(\n :Host => RouterIP,\n :Community => SNMPpw,\n :Timeout => 60,\n :Retries => 5\n ) do |manager|\n # XXX Timeout on the next line (or the one below) will kick us out.\n response = manager.get([\"ip.21.1.7.0.0.0.0\"])\n response.each_varbind do |vb|\n default_route = \"#{vb.value.to_s}\"\n # puts \"ip.21.1.7.#{default_route}\"\n response = manager.get([\"ip.21.1.7.#{default_route}\"])\n response.each_varbind do |vb|\n my_ipaddr = \"#{vb.value.to_s}\"\n # puts my_ipaddr\n return my_ipaddr\n end\n end\n end\nend",
"def get_session_key\n action = 'uam'\n\n url_params = {\n 'action' => action,\n 'rssuserid' => @parameters['RSSAdminUserID'],\n 'rssurl' => @parameters['RSSURL'],\n 'rssdsn' => @parameters['RSSDSN'],\n 'packetuser' => @parameters['PacketUser'],\n 'assignedby' => @parameters['RSSAdminUserID'],\n 'tssurl' => @parameters['TSSURL']\n }\n\n response_body = get_request(url_params).body\n \n key = response_body.match(/sessionKey = '(.*?)';/)[1]\n if key.nil?\n raise StandardError, \"Session key not found\"\n else\n return key\n end\n end",
"def info id\n get(\"ssl/v1/#{id}\")\n end",
"def session_from_redis\n redis_handler.get\n end",
"def current_member\n session[:oracle] ||= Oracle::Session.new(request.remote_ip)\n end",
"def login(user, password, sid = nil)\n sid ||= IDMIN + rand(IDMAX-IDMIN)\n @nurl ||= \"https://localhost:8834/\"\n post = { \"username\" => user, \"password\" => password, 'seq' => sid }\n\n response_json = nessus_request('session', post)\n\n if response_json['token']\n @token = response_json['token']\n @name = user\n @seqid = sid\n # Compatibility with XMLRPC ivar\n user_permissions = nessus_request('session', auth_header, :get)['permissions']\n @admin = ([64,128].any? {|perm| perm == user_permissions}).to_s.upcase\n return @token\n else\n raise \"Cannot authenticate to #{@nurl} as #{user} with #{password} due to #{response_json['error']}\"\n end\n\n end",
"def gettoken(url,username,password,tenant)\n url1 = \"#{url}/identity/api/tokens\"\n uri = URI.parse(url1)\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request.body = JSON.dump({\n \"username\" => username,\n \"password\" => password,\n \"tenant\" => tenant\n })\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n verify_mode: OpenSSL::SSL::VERIFY_NONE,\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n token_output = response.body\n token_json = JSON.parse(token_output)\n vra_token = token_json[\"id\"]\n return vra_token\n end",
"def session\n Thread.current['clients_manager'].client('Website').session\n end",
"def find_negotiate_context(type)\n negotiate_context_list.find { |nc| nc.context_type == type }\n end",
"def get_ebay_session(req)\n session_data = Lynr.cache.get(\"#{req.session['dealer_id']}_ebay_session\")\n YAML.load(session_data)\n end",
"def list(options={})\n param = { :uniq_id => @uniq_id }.merge options\n Storm::Base::SODServer.remote_list '/VPN/list', param do |u|\n user = VPNUser.new\n user.from_hash u\n user\n end\n end",
"def get_token\n get(TOKEN_URL)\n end",
"def create_session\n raw_token, enc_token = account.create_session(ip, meta_info)\n set_account_cache(account, raw_token)\n set_auth_token_cache(enc_token, raw_token)\n return raw_token\n end",
"def auth_get(path)\n\t\theader = {\n\t\t\t\"Cookie\" => \"JSESSIONID=#{@cookies['JSESSIONID']}\",\n\t\t}\n\t\treturn @conn.get(path, header)\n\tend",
"def session\n @connection.request('session-get') do |resp|\n if resp == :connection_error\n yield :connection_error\n else\n yield Session.new(resp)\n end\n end\n end",
"def _session\n\t\t\tThread.current[SESSION]\n\t\tend",
"def fetch_olympus_session0\n\n\n response = request(:get, \"https://appstoreconnect.apple.com/olympus/v1/session\")\n body = response.body\n if body\n body = JSON.parse(body) if body.kind_of?(String)\n user_map = body[\"user\"]\n if user_map\n self.user_email = user_map[\"emailAddress\"]\n end\n\n provider = body[\"provider\"]\n if provider\n self.provider = Spaceship::Provider.new(provider_hash: provider)\n return true\n end\n end\n\n return false\n end",
"def read_l2_vpn_context_with_http_info(tier_0_id, locale_service_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_context ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_context\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.read_l2_vpn_context\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnContext')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#read_l2_vpn_context\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_smite_api_session\n session_timestamp = Time.now.getutc.strftime(\"%Y%m%d%H%M%S\")\n session_string = \"#{ENV['SMITE_API_DEV_ID']}\" + 'createsession' + \"#{ENV['SMITE_API_AUTHKEY']}\" + session_timestamp\n session_signature = Digest::MD5.hexdigest(session_string)\n\n smite_session = RestClient.get(\"#{SMITE_PC_URL}/createsessionJson/#{ENV['SMITE_API_DEV_ID']}/#{session_signature}/#{session_timestamp}\")\n JSON.parse(smite_session)['session_id']\nend"
] | [
"0.67856747",
"0.65346664",
"0.6142881",
"0.6033498",
"0.5987291",
"0.58496064",
"0.582263",
"0.5783638",
"0.57282025",
"0.570861",
"0.5691314",
"0.56578994",
"0.56189305",
"0.55903184",
"0.55779153",
"0.5559573",
"0.5545683",
"0.55303633",
"0.55278563",
"0.55197275",
"0.5499265",
"0.54878104",
"0.5465208",
"0.54404634",
"0.54361564",
"0.54340744",
"0.5418243",
"0.5399869",
"0.5398241",
"0.5385278",
"0.5373699",
"0.5366883",
"0.53325737",
"0.5319466",
"0.53159064",
"0.5313214",
"0.5306728",
"0.5306056",
"0.52945745",
"0.52913195",
"0.526938",
"0.52641886",
"0.52465194",
"0.52445555",
"0.52445555",
"0.52378494",
"0.52231836",
"0.51883215",
"0.5175455",
"0.5172091",
"0.5168124",
"0.5158572",
"0.5145218",
"0.51411927",
"0.5139072",
"0.51269007",
"0.51156723",
"0.51108164",
"0.51053697",
"0.51020545",
"0.50822383",
"0.50802183",
"0.50636065",
"0.5060087",
"0.5047657",
"0.5042794",
"0.5031099",
"0.50186855",
"0.50066596",
"0.5005027",
"0.4996782",
"0.4986133",
"0.49606833",
"0.49606833",
"0.49606833",
"0.49523968",
"0.49521512",
"0.49496365",
"0.49364528",
"0.4914481",
"0.4913534",
"0.4908072",
"0.48899508",
"0.48889396",
"0.48818606",
"0.4878309",
"0.4867148",
"0.48611903",
"0.48519173",
"0.48423854",
"0.48342106",
"0.48267162",
"0.48265973",
"0.4826378",
"0.48242626",
"0.48149034",
"0.4813621",
"0.48081216",
"0.4806783",
"0.48013756"
] | 0.68863684 | 0 |
Get peer codes for the L2VpnSession Get peer codes for the L2VPN session to program the remote side of the tunnel. | def get_l2_vpn_session_peer_codes(l2vpn_session_id, opts = {})
data, _status_code, _headers = get_l2_vpn_session_peer_codes_with_http_info(l2vpn_session_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_l2_vpn_session_peer_codes_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}/peer-codes'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSessionPeerCodes')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#get_l2_vpn_session_peer_codes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_l2_vpn_sessions(opts = {})\n data, _status_code, _headers = list_l2_vpn_sessions_with_http_info(opts)\n data\n end",
"def get_cvv2_code()\n return @RESPONSE_HASH['CVV2']\n end",
"def getpeerinfo\n @api.request 'getpeerinfo'\n end",
"def peer_info\n peer_bytes = get_peername[2, 6].unpack(\"nC4\")\n port = peer_bytes.first.to_i\n ip = peer_bytes[1, 4].join(\".\")\n\n [ip, port]\n end",
"def peer_info\n peer_bytes = get_peername[2, 6].unpack(\"nC4\")\n port = peer_bytes.first.to_i\n ip = peer_bytes[1, 4].join(\".\")\n\n [ip, port]\n end",
"def peerinfo\n if self.conn\n pi = self.conn.peerinfo || nil\n if pi\n return {\n 'addr' => pi.split(':')[0],\n 'port' => pi.split(':')[1].to_i\n }\n end\n end\n nil\n end",
"def tunnel_peer\n\t\tbegin\n\t\t\t@peer_info = rstream.peerinfo\n\t\trescue ::Exception\n\t\t\t@peer_info ||= '127.0.0.1'\n\t\tend\n\tend",
"def get_l2_vpn_session(l2vpn_session_id, opts = {})\n data, _status_code, _headers = get_l2_vpn_session_with_http_info(l2vpn_session_id, opts)\n data\n end",
"def get_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSession')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#get_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def cvv2_resp_code\n params['x_cvv2_resp_code']\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n data, _status_code, _headers = get_tier1_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts)\n data\n end",
"def cvv2_resp_code\n params['x_cvv2_resp_code']\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier1_l2_vpn_session_remote_macs_for_ls\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_l2_vpn_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/vpn/l2vpn/sessions'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'l2vpn_service_id'] = opts[:'l2vpn_service_id'] if !opts[:'l2vpn_service_id'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSessionListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#list_l2_vpn_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def peer_list\n ip_list = []\n raw_peers.each_slice(6) { |e| ip_list << e if e.length == 6 }\n\n ip_list.map! { |e| { :ip => e[0..3].join('.'), :port => (e[4] * 256) + e[5] } }\n end",
"def getpeerinfo\n node.pool.peers.map do |peer|\n local_addr = \"#{peer.remote_version.remote_addr.addr_string}:18333\"\n {\n id: peer.id,\n addr: \"#{peer.host}:#{peer.port}\",\n addrlocal: local_addr,\n services: peer.remote_version.services.to_even_length_hex.rjust(16, '0'),\n relaytxes: peer.remote_version.relay,\n lastsend: peer.last_send,\n lastrecv: peer.last_recv,\n bytessent: peer.bytes_sent,\n bytesrecv: peer.bytes_recv,\n conntime: peer.conn_time,\n pingtime: peer.ping_time,\n minping: peer.min_ping,\n version: peer.remote_version.version,\n subver: peer.remote_version.user_agent,\n inbound: !peer.outbound?,\n startingheight: peer.remote_version.start_height,\n best_hash: peer.best_hash,\n best_height: peer.best_height\n }\n end\n end",
"def get_tier0_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_0_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier0_l2_vpn_session_remote_macs_for_ls\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def read_l2_vpn(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n data, _status_code, _headers = read_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts)\n data\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls_0(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n data, _status_code, _headers = get_tier1_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts)\n data\n end",
"def tunnel_peer\n\tend",
"def tunnel_peer\n\tend",
"def get_tier1_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier1_l2_vpn_session_remote_macs_for_ls_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def peer_info; socket.peer_info if socket end",
"def connection_state_code\n conn_state = @ole_connection.State\n\n STATECODES.each do |value|\n return value if (((conn_state & value) == value && value > 0) || (conn_state == value))\n end\n \n return nil\n end",
"def booking_language_codes_get(opts = {})\n data, _status_code, _headers = booking_language_codes_get_with_http_info(opts)\n data\n end",
"def getcodes\r\n result = SUPPORTED_LANG_CODES\r\n end",
"def list_ip_sec_vpn_peer_endpoints(opts = {})\n data, _status_code, _headers = list_ip_sec_vpn_peer_endpoints_with_http_info(opts)\n data\n end",
"def secondary_response_code\r\n params['src']\r\n end",
"def smb_peer_lm\n\t\tself.simple.client.peer_native_lm\n\tend",
"def get_tier0_l2_vpn_session_remote_macs_for_ls(tier_0_id, locale_service_id, service_id, session_id, opts = {})\n data, _status_code, _headers = get_tier0_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_0_id, locale_service_id, service_id, session_id, opts)\n data\n end",
"def peerinfo\n if (pi = getpeername_as_array)\n return pi[1] + ':' + pi[2].to_s\n end\n end",
"def get_tier0_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_0_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier0_l2_vpn_session_remote_macs_for_ls_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def smb_peer_lm\n unless self.simple.negotiated_smb_version == 1\n print_warning(\"peer_native_lm is only available with SMB1 (current version: SMB#{self.simple.negotiated_smb_version})\")\n end\n self.simple.client.peer_native_lm\n end",
"def peer\n @peer ||= begin\n addr = @socket.getpeername\n ip_address = Socket.getnameinfo(addr, Socket::NI_NUMERICHOST | Socket::NI_NUMERICSERV).first\n { :ip => ip_address, :port => @port.to_i, :host => @host }\n end\n end",
"def discover_peers(port, key_private)\r\n handshake_peer(port, FIRST_PORT, key_private) # Handshake Genesis Peer\r\n i = 0\r\n peers = Array.new # Array To Store Ports Of Discovered Peers\r\n $peers.length.times do |i| # Store Your Discovered Peers\r\n peers << $peers[i].port.to_s\r\n end\r\n while (i < peers.length) # Store Others Discovered Peers\r\n their_peers = Faraday.get(\"#{URL}:#{peers[i]}/peer_peers\").body.to_s.chomp\r\n their_peers = their_peers.split(\",\")\r\n their_peers.length.times do |j|\r\n search_result = 0\r\n peers.length.times do |k|\r\n search_result = -1 if (their_peers[j] == peers[k])\r\n end\r\n peers << their_peers[j] if (search_result != -1)\r\n end\r\n i += 1\r\n end\r\n # Handshake Newly Discovered Peers\r\n i = 0\r\n peers.length.times do |i|\r\n handshake_peer(port, peers[i], key_private) if (search_peers_by_port(peers[i]) == -1)\r\n end\r\nend",
"def get_l2_vpn_session_summary(opts = {})\n data, _status_code, _headers = get_l2_vpn_session_summary_with_http_info(opts)\n data\n end",
"def create_l2_vpn_session(l2_vpn_session, opts = {})\n data, _status_code, _headers = create_l2_vpn_session_with_http_info(l2_vpn_session, opts)\n data\n end",
"def peer_count\n make_promise(@core.web3.JS[:net], 'getPeerCount')\n end",
"def receive_codes(opts = {})\n receive_codes_with_http_info(opts)\n nil\n end",
"def peerinfo(peer)\n send_packet @utils.packet_mangler({\"NodeIdentifier\" => peer,\"WithVolatile\" => false,\"WithMetadata\" => true}, \"ListPeer\")\n wait_for :peer, /Peer/\n end",
"def find_recovery_codes(opts = {})\n data, _status_code, _headers = find_recovery_codes_with_http_info(opts)\n data\n end",
"def read_acpc_matchstate\n\t\t\t\tinterpret_acpc_matchstate(socket_get)\n\t\t\tend",
"def peers\n if sessions.count > 0\n puts\n puts \"Currently Managing\"\n puts \"------------------\"\n puts\n sessions.each_with_index do |session, i|\n puts \"[#{i}] #{session.peername}\"\n end\n puts\n else\n puts \"No active sessions\"\n end\n nil\n end",
"def peer_ip; end",
"def resume_status\n Cproton.pn_ssl_resume_status(@impl)\n end",
"def to_ary\n [@code, @message]\n end",
"def code\n @code ||= @net_http_res.code.to_i\n end",
"def create_l2_vpn_session_with_http_info(l2_vpn_session, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session ...'\n end\n # verify the required parameter 'l2_vpn_session' is set\n if @api_client.config.client_side_validation && l2_vpn_session.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_session' when calling ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions'\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_session)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, 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 => 'L2VpnSession')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#create_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def read_l2_vpn_0(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n data, _status_code, _headers = read_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts)\n data\n end",
"def get_ip_sec_vpnike_session_status(session_id, opts = {})\n data, _status_code, _headers = get_ip_sec_vpnike_session_status_with_http_info(session_id, opts)\n data\n end",
"def voyage_port_code\n @voyage_port_code = VoyagePortType.find(self.port_type_id).voyage_port_type_code if @voyage_port_code\n return @voyage_port_code\n end",
"def get_avs_code()\n return @RESPONSE_HASH['AVS']\n end",
"def find_connected_peer_terminations\r\n if self.in_connection? \r\n self.aln_connection.aln_terminations.to_ary.delete(self)\r\n self.aln_connection.aln_terminations\r\n else \r\n []\r\n end \r\n end",
"def cvv_result_code\n cvv_result_code_message = self.messages.find {|m| m.context=='processor.cvv_result_code' || m.context=='gateway.cvv_result_code' }\n cvv_result_code_message && cvv_result_code_message.key\n end",
"def peer_ip\n peername[0]\n end",
"def result_code\n self[:result_code]\n end",
"def get_connected_peers\n filter_by_state = { :state => 2 }\n connected = self.peers filter_by_state\n end",
"def peer\n @peer ||= { ip: socket.peer_ip, port: @port.to_i, host: @host, canonized: host_as_string }\n end",
"def on_response(session)\n peer_session = get_peer_session(session)\n if peer_session && session[:_sipper_b2b_transparent]\n peer_session.respond_with(session.iresponse.code)\n else\n super\n end\n end",
"def connection_states\n hash = {}\n names = STATENAMES.reverse\n \n STATECODES.sort.each_with_index do |code, index|\n hash[names[index]] = code\n end\n \n return hash\n end",
"def get_tier0_l2_vpn_session_remote_macs_for_ls_0(tier_0_id, locale_service_id, service_id, session_id, opts = {})\n data, _status_code, _headers = get_tier0_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_0_id, locale_service_id, service_id, session_id, opts)\n data\n end",
"def list(options={})\n param = { :uniq_id => @uniq_id }.merge options\n Storm::Base::SODServer.remote_list '/VPN/list', param do |u|\n user = VPNUser.new\n user.from_hash u\n user\n end\n end",
"def code\n @grpc.language_code\n end",
"def vpns\n NodeWrapper.new @links.select{|e| e.type == :vpn}.map(&:to)\n end",
"def language_codes_for_select\n configuration(:languages).collect { |language|\n language[:language_code]\n }\n end",
"def find_negotiate_context(type)\n negotiate_context_list.find { |nc| nc.context_type == type }\n end",
"def verification_code\n raise ArgumentError, 'Hash is not set' if @hash.nil?\n\n binary = @hash.unpack1('B*').split //\n [*binary.first(6), *binary.last(7)].join.to_i(2)\n end",
"def peer; end",
"def get_crypto_stats(port)\r\n r = 0 # Received\r\n g = 0 # Generated\r\n m = 0 # Mined\r\n $blockchain.length.times do |i|\r\n block = $blockchain[i]\r\n r +=1 if (block.payee == port)\r\n g +=1 if (block.payer == port)\r\n m +=1 if (block.miner == port)\r\n end\r\n return [r, g, m]\r\nend",
"def peeraddrs\n @peeraddrs ||= {}\n end",
"def get_session_id\n\t\t\tresponse = perform_request(MAGIC_BYTES + REQUEST_BYTE[:challenge] + CLIENT_ID)\n\t\t\t\n\t\t\t# the challenge token comes back as a series of bytes that represent the\n\t\t\t# integer we want, so we have to convert it to the actual 32bit int\n\t\t\t[response.slice(5..-2).to_i].pack(\"l>\").bytes.to_a\n\t\tend",
"def process_v4_connection_response(socket)\n packet = socket.recv(2).unpack(\"C*\")\n dump(:read, packet)\n version = packet[0]\n result_code = packet[1]\n\n case result_code\n when 90 then\n log(:green, build_v4_result_code_message(result_code))\n else\n raise SockitError, build_v4_result_code_message(result_code)\n end\n\n port = socket.recv(2).unpack(\"n\")\n dump(:read, port)\n\n host = socket.recv(4).unpack(\"C*\")\n dump(:read, host)\n\n [host.join('.'), port.join]\n end",
"def cvv_result(response)\n case response[:raw][:CardSecurityCodeMatch]\n when \"Pass\"\n return \"M\" # Match\n when \"Fail\"\n return \"N\" # No Match\n else\n return \"P\" # Not Processed\n end\n end",
"def get_conversations_cobrowsesession_participant_wrapupcodes(conversation_id, participant_id, opts = {})\n data, _status_code, _headers = get_conversations_cobrowsesession_participant_wrapupcodes_with_http_info(conversation_id, participant_id, opts)\n return data\n end",
"def get_guest_protocols(protocols)\n Hash[ protocols.select {|k,v| v[\"guest access\"] == \"1\" } ].keys\n end",
"def raw_peers\n uri.query = URI.encode_www_form(peer_hash)\n data = BEncode.load(Net::HTTP.get(uri))\n data['peers'].bytes\n end",
"def peer\n return @remote_address\n end",
"def gather_pvn_vlan_details\n loop do\n answer = ask(\n \"Please enter the IP range you'd like to set up your private virtual network in CIDR \"\\\n \"notation:\"){ |q| q.default = '10.10.10.0/24'}\n begin\n ip = IPAddress.parse(answer)\n if ip.prefix == 32\n say \"Please enter a range. You entered a single IP address.\".red\n else\n say \"Configuring private virtual network as Address: #{ip.address} \"\\\n \"- Netmask: #{ip.netmask}\".green\n return ip\n end\n rescue\n say \"Invalid CIDR IP range.\".red\n end\n end\n end",
"def mother_tongues\n spoken_languages.where(language_level_code: LanguageLevel[:mother_tongue].code).map(&:language)\n end",
"def tpl\n connection_name = 'PrivateConnection'\n local_vpc_id_ref, remote_vpc_id_ref = %W(#{connection_name}VpcId #{connection_name}PeerVpcId)\n\n def validate_params(*params)\n params.each do |param|\n fail \"Unable to find required parameter #{param}\" unless @parameters.key?(param)\n end\n rescue RuntimeError => e\n puts e\n exit 1\n end\n\n validate_params(*[remote_vpc_id_ref])\n\n local_vpc, remote_vpc = [vpc, vpc(id: @parameters[remote_vpc_id_ref])]\n\n description 'Stack to create peering connection between two VPCs'\n\n parameter_vpc_id(local_vpc_id_ref,\n 'VpcId from where connection gets created',\n local_vpc.id)\n\n parameter_vpc_id(remote_vpc_id_ref,\n 'VpcId where peering connection should go',\n remote_vpc.id)\n\n # Initialize Peering connection\n vpc_peering_init(connection_name,\n tags: [\n {\n Key: 'Name',\n Value: connection_name\n }\n ])\n\n def read_vpc_route_tables(vpc)\n routes = []\n vpc.route_tables.each do |rt|\n routes << rt\n end\n routes\n end\n\n # Add rules to local VPC routing table\n read_vpc_route_tables(local_vpc).map(&:id).each_with_index do |rt_id, i|\n local_vpc_route_rule = \"LocalVPCPeeringRoute#{i + 1}\"\n resource local_vpc_route_rule,\n Type: 'AWS::EC2::Route',\n Properties: {\n RouteTableId: rt_id,\n DestinationCidrBlock: remote_vpc.cidr_block,\n VpcPeeringConnectionId: ref(connection_name)\n }\n\n output local_vpc_route_rule,\n Description: \"Local VPC Peering connection for #{rt_id}\",\n Value: ref(local_vpc_route_rule)\n end\n\n # Add rules to remote VPC routing table\n read_vpc_route_tables(remote_vpc).map(&:id).each_with_index do |rt_id, i|\n remote_vpc_route_rule = \"RemoteVPCPeeringRoute#{i + 1}\"\n resource remote_vpc_route_rule,\n Type: 'AWS::EC2::Route',\n Properties: {\n RouteTableId: rt_id,\n DestinationCidrBlock: local_vpc.cidr_block,\n VpcPeeringConnectionId: ref(connection_name)\n }\n\n output remote_vpc_route_rule,\n Description: \"Remote VPC Peering connection for #{rt_id}\",\n Value: ref(remote_vpc_route_rule)\n end\n end",
"def b2b_direct_connect_outbound\n return @b2b_direct_connect_outbound\n end",
"def inspect\n \"pc: #{@pc} codes: #{@codes.inspect}\"\n end",
"def ssl_check_peer_state\n super\n end",
"def get_auth_code()\n return @RESPONSE_HASH['AUTH_CODE']\n end",
"def list_pc_codes\n\treturn if authorise_for_web(program_name?,'read_pc_code') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:pc_codes_page] = params['page']\n\n\t\t render_list_pc_codes\n\n\t\t return \n\telse\n\t\tsession[:pc_codes_page] = nil\n\tend\n\n\tlist_query = \"@pc_code_pages = Paginator.new self, PcCode.count, @@page_size,@current_page\n\t @pc_codes = PcCode.find(:all,\n\t\t\t\t :limit => @pc_code_pages.items_per_page,\n\t\t\t\t :offset => @pc_code_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_pc_codes\nend",
"def C_GetSessionInfo()\n @pk.C_GetSessionInfo(@sess)\n end",
"def connection_status_crypt_response; end",
"def list_ipfixl2_profiles(opts = {})\n data, _status_code, _headers = list_ipfixl2_profiles_with_http_info(opts)\n data\n end",
"def find_current_user_vpn_config_with_http_info(code, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VPNApi.find_current_user_vpn_config ...'\n end\n # verify the required parameter 'code' is set\n if @api_client.config.client_side_validation && code.nil?\n fail ArgumentError, \"Missing the required parameter 'code' when calling VPNApi.find_current_user_vpn_config\"\n end\n # verify enum value\n allowable_values = [\"ewr1\", \"scj1\", \"arm1\", \"nrt1\"]\n if @api_client.config.client_side_validation && !allowable_values.include?(code)\n fail ArgumentError, \"invalid value for \\\"code\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/user/vpn'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'code'] = code\n\n # header parameters\n header_params = opts[: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 = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'VPNConfig'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['x_auth_token']\n\n new_options = opts.merge(\n :operation => :\"VPNApi.find_current_user_vpn_config\",\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 => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VPNApi#find_current_user_vpn_config\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def pgrespcode\n\t\t \tparams['pgRespCode']\n\t\t end",
"def list_l2_vpns_with_http_info(tier_0_id, locale_service_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#list_l2_vpns\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def current_room_sessionids \n result = []\n peeps = simperson.simplace.simpeople\n peeps.each do |aperson|\n result << aperson.simcharacter.simplayer.sessionid if aperson.simcharacter.simplayer.online == true\n end\n result\n end",
"def extract_peer(bgp, ip_name, type)\n # rubocop:disable Style/Semicolon\n ret = nil\n if type == :ip\n vrf = extract(bgp, :vrf, :'peer-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:'remote-address'] == ip_name }\n end\n elsif type == :template\n vrf = extract(bgp, :vrf, :'peer-group-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:name] == ip_name }\n end\n else\n # This condition should not be hit.\n raise \"Invalid neighbor type #{type}\"\n end\n ret\n # rubocop:enable Style/Semicolon\n end",
"def extract_peer(bgp, ip_name, type)\n # rubocop:disable Style/Semicolon\n ret = nil\n if type == :ip\n vrf = extract(bgp, :vrf, :'peer-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:'remote-address'] == ip_name }\n end\n elsif type == :template\n vrf = extract(bgp, :vrf, :'peer-group-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:name] == ip_name }\n end\n else\n # This condition should not be hit.\n raise \"Invalid neighbor type #{type}\"\n end\n ret\n # rubocop:enable Style/Semicolon\n end",
"def list_l2_vpns(tier_0_id, locale_service_id, opts = {})\n data, _status_code, _headers = list_l2_vpns_with_http_info(tier_0_id, locale_service_id, opts)\n data\n end",
"def language_codes_for_select\n configuration(:languages).collect{ |language|\n language[:language_code]\n }\n end",
"def _voyager_lookup code\n\n metadata = {}\n\n voyager = OCI8.new($config['voyager']['user'], $config['voyager']['pass'], $config['voyager']['host'])\n\n # Do the main Voyager query to get bibid from barcode\n voyager.exec(\"select bt.* from item_barcode ib, bib_item bi, bib_text bt where ib.item_barcode='#{code}' and ib.item_id=bi.item_id and bi.bib_id = bt.bib_id\") do |result|\n metadata[:bibid] = result[0]\n metadata[:author] = result[1]\n metadata[:title] = result[3]\n end\n\n # Do a secondary query to collect oclc number\n index_fields = voyager.exec(\"select normal_heading from bib_index where bib_id='#{metadata[:bibid]}' and index_code='0350'\")\n while field = index_fields.fetch\n if result = /.*OCOLC\\D*(\\d+)/i.match(field[0])\n metadata[:oclc_id] = result.captures[0]\n end\n end\n\n return metadata\n\nend",
"def get_disconnected_peers\n filter_by_state = { :state => 1 }\n disconnected = self.peers filter_by_state\n end",
"def parse_status_packet(packet)\n { :code => packet.read_long }\n end"
] | [
"0.71293914",
"0.5819167",
"0.5471055",
"0.5189417",
"0.51367766",
"0.5108261",
"0.5076274",
"0.5057087",
"0.5023644",
"0.4959744",
"0.49277085",
"0.49203652",
"0.48814026",
"0.4824515",
"0.48199093",
"0.47869185",
"0.4767501",
"0.4755308",
"0.47380775",
"0.47254547",
"0.47062403",
"0.47062403",
"0.47048563",
"0.4696969",
"0.4669394",
"0.46662974",
"0.4660807",
"0.4655401",
"0.46472898",
"0.46428227",
"0.46308517",
"0.45952502",
"0.45550483",
"0.45173916",
"0.44923505",
"0.44921574",
"0.4486402",
"0.44813785",
"0.44811055",
"0.4480635",
"0.44678083",
"0.44624716",
"0.44477752",
"0.4420676",
"0.44136304",
"0.44082555",
"0.44079635",
"0.43939626",
"0.43704113",
"0.4364802",
"0.43499637",
"0.434659",
"0.4338055",
"0.4337185",
"0.43359938",
"0.4333487",
"0.43192098",
"0.43138656",
"0.42995358",
"0.4293461",
"0.42933738",
"0.42878112",
"0.4282019",
"0.42798218",
"0.427408",
"0.42669186",
"0.42476562",
"0.42450202",
"0.42223316",
"0.42057493",
"0.4201599",
"0.4186034",
"0.41847125",
"0.41837546",
"0.41677314",
"0.41580674",
"0.41487136",
"0.41480678",
"0.41475493",
"0.4147099",
"0.41392443",
"0.41333887",
"0.41284415",
"0.41233966",
"0.4122792",
"0.41204113",
"0.41190743",
"0.41173118",
"0.41125628",
"0.4106648",
"0.41058975",
"0.41051137",
"0.41039377",
"0.40866387",
"0.40866387",
"0.40836602",
"0.40813503",
"0.4079737",
"0.40792218",
"0.4077453"
] | 0.79052573 | 0 |
Get peer codes for the L2VpnSession Get peer codes for the L2VPN session to program the remote side of the tunnel. | def get_l2_vpn_session_peer_codes_with_http_info(l2vpn_session_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes ...'
end
# verify the required parameter 'l2vpn_session_id' is set
if @api_client.config.client_side_validation && l2vpn_session_id.nil?
fail ArgumentError, "Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes"
end
# resource path
local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}/peer-codes'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'L2VpnSessionPeerCodes')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementPlaneApiVpnL2VpnSessionsApi#get_l2_vpn_session_peer_codes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_l2_vpn_session_peer_codes(l2vpn_session_id, opts = {})\n data, _status_code, _headers = get_l2_vpn_session_peer_codes_with_http_info(l2vpn_session_id, opts)\n data\n end",
"def list_l2_vpn_sessions(opts = {})\n data, _status_code, _headers = list_l2_vpn_sessions_with_http_info(opts)\n data\n end",
"def get_cvv2_code()\n return @RESPONSE_HASH['CVV2']\n end",
"def getpeerinfo\n @api.request 'getpeerinfo'\n end",
"def peer_info\n peer_bytes = get_peername[2, 6].unpack(\"nC4\")\n port = peer_bytes.first.to_i\n ip = peer_bytes[1, 4].join(\".\")\n\n [ip, port]\n end",
"def peer_info\n peer_bytes = get_peername[2, 6].unpack(\"nC4\")\n port = peer_bytes.first.to_i\n ip = peer_bytes[1, 4].join(\".\")\n\n [ip, port]\n end",
"def peerinfo\n if self.conn\n pi = self.conn.peerinfo || nil\n if pi\n return {\n 'addr' => pi.split(':')[0],\n 'port' => pi.split(':')[1].to_i\n }\n end\n end\n nil\n end",
"def tunnel_peer\n\t\tbegin\n\t\t\t@peer_info = rstream.peerinfo\n\t\trescue ::Exception\n\t\t\t@peer_info ||= '127.0.0.1'\n\t\tend\n\tend",
"def get_l2_vpn_session(l2vpn_session_id, opts = {})\n data, _status_code, _headers = get_l2_vpn_session_with_http_info(l2vpn_session_id, opts)\n data\n end",
"def get_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSession')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#get_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def cvv2_resp_code\n params['x_cvv2_resp_code']\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n data, _status_code, _headers = get_tier1_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts)\n data\n end",
"def cvv2_resp_code\n params['x_cvv2_resp_code']\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier1_l2_vpn_session_remote_macs_for_ls\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_l2_vpn_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/vpn/l2vpn/sessions'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'l2vpn_service_id'] = opts[:'l2vpn_service_id'] if !opts[:'l2vpn_service_id'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSessionListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#list_l2_vpn_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def peer_list\n ip_list = []\n raw_peers.each_slice(6) { |e| ip_list << e if e.length == 6 }\n\n ip_list.map! { |e| { :ip => e[0..3].join('.'), :port => (e[4] * 256) + e[5] } }\n end",
"def getpeerinfo\n node.pool.peers.map do |peer|\n local_addr = \"#{peer.remote_version.remote_addr.addr_string}:18333\"\n {\n id: peer.id,\n addr: \"#{peer.host}:#{peer.port}\",\n addrlocal: local_addr,\n services: peer.remote_version.services.to_even_length_hex.rjust(16, '0'),\n relaytxes: peer.remote_version.relay,\n lastsend: peer.last_send,\n lastrecv: peer.last_recv,\n bytessent: peer.bytes_sent,\n bytesrecv: peer.bytes_recv,\n conntime: peer.conn_time,\n pingtime: peer.ping_time,\n minping: peer.min_ping,\n version: peer.remote_version.version,\n subver: peer.remote_version.user_agent,\n inbound: !peer.outbound?,\n startingheight: peer.remote_version.start_height,\n best_hash: peer.best_hash,\n best_height: peer.best_height\n }\n end\n end",
"def get_tier0_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_0_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier0_l2_vpn_session_remote_macs_for_ls\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def read_l2_vpn(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n data, _status_code, _headers = read_l2_vpn_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts)\n data\n end",
"def get_tier1_l2_vpn_session_remote_macs_for_ls_0(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n data, _status_code, _headers = get_tier1_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts)\n data\n end",
"def tunnel_peer\n\tend",
"def tunnel_peer\n\tend",
"def get_tier1_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_1_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier1_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier1_l2_vpn_session_remote_macs_for_ls_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def peer_info; socket.peer_info if socket end",
"def connection_state_code\n conn_state = @ole_connection.State\n\n STATECODES.each do |value|\n return value if (((conn_state & value) == value && value > 0) || (conn_state == value))\n end\n \n return nil\n end",
"def booking_language_codes_get(opts = {})\n data, _status_code, _headers = booking_language_codes_get_with_http_info(opts)\n data\n end",
"def getcodes\r\n result = SUPPORTED_LANG_CODES\r\n end",
"def list_ip_sec_vpn_peer_endpoints(opts = {})\n data, _status_code, _headers = list_ip_sec_vpn_peer_endpoints_with_http_info(opts)\n data\n end",
"def secondary_response_code\r\n params['src']\r\n end",
"def smb_peer_lm\n\t\tself.simple.client.peer_native_lm\n\tend",
"def get_tier0_l2_vpn_session_remote_macs_for_ls(tier_0_id, locale_service_id, service_id, session_id, opts = {})\n data, _status_code, _headers = get_tier0_l2_vpn_session_remote_macs_for_ls_with_http_info(tier_0_id, locale_service_id, service_id, session_id, opts)\n data\n end",
"def peerinfo\n if (pi = getpeername_as_array)\n return pi[1] + ':' + pi[2].to_s\n end\n end",
"def get_tier0_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_0_id, locale_service_id, service_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi.get_tier0_l2_vpn_session_remote_macs_for_ls_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-services/{service-id}/sessions/{session-id}/remote-mac'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'service-id' + '}', service_id.to_s).sub('{' + 'session-id' + '}', session_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'segment_path'] = opts[:'segment_path'] if !opts[:'segment_path'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'AggregateL2VpnSessionRemoteMac')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNRemoteMacApi#get_tier0_l2_vpn_session_remote_macs_for_ls_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def smb_peer_lm\n unless self.simple.negotiated_smb_version == 1\n print_warning(\"peer_native_lm is only available with SMB1 (current version: SMB#{self.simple.negotiated_smb_version})\")\n end\n self.simple.client.peer_native_lm\n end",
"def discover_peers(port, key_private)\r\n handshake_peer(port, FIRST_PORT, key_private) # Handshake Genesis Peer\r\n i = 0\r\n peers = Array.new # Array To Store Ports Of Discovered Peers\r\n $peers.length.times do |i| # Store Your Discovered Peers\r\n peers << $peers[i].port.to_s\r\n end\r\n while (i < peers.length) # Store Others Discovered Peers\r\n their_peers = Faraday.get(\"#{URL}:#{peers[i]}/peer_peers\").body.to_s.chomp\r\n their_peers = their_peers.split(\",\")\r\n their_peers.length.times do |j|\r\n search_result = 0\r\n peers.length.times do |k|\r\n search_result = -1 if (their_peers[j] == peers[k])\r\n end\r\n peers << their_peers[j] if (search_result != -1)\r\n end\r\n i += 1\r\n end\r\n # Handshake Newly Discovered Peers\r\n i = 0\r\n peers.length.times do |i|\r\n handshake_peer(port, peers[i], key_private) if (search_peers_by_port(peers[i]) == -1)\r\n end\r\nend",
"def peer\n @peer ||= begin\n addr = @socket.getpeername\n ip_address = Socket.getnameinfo(addr, Socket::NI_NUMERICHOST | Socket::NI_NUMERICSERV).first\n { :ip => ip_address, :port => @port.to_i, :host => @host }\n end\n end",
"def get_l2_vpn_session_summary(opts = {})\n data, _status_code, _headers = get_l2_vpn_session_summary_with_http_info(opts)\n data\n end",
"def create_l2_vpn_session(l2_vpn_session, opts = {})\n data, _status_code, _headers = create_l2_vpn_session_with_http_info(l2_vpn_session, opts)\n data\n end",
"def peer_count\n make_promise(@core.web3.JS[:net], 'getPeerCount')\n end",
"def receive_codes(opts = {})\n receive_codes_with_http_info(opts)\n nil\n end",
"def peerinfo(peer)\n send_packet @utils.packet_mangler({\"NodeIdentifier\" => peer,\"WithVolatile\" => false,\"WithMetadata\" => true}, \"ListPeer\")\n wait_for :peer, /Peer/\n end",
"def find_recovery_codes(opts = {})\n data, _status_code, _headers = find_recovery_codes_with_http_info(opts)\n data\n end",
"def read_acpc_matchstate\n\t\t\t\tinterpret_acpc_matchstate(socket_get)\n\t\t\tend",
"def peers\n if sessions.count > 0\n puts\n puts \"Currently Managing\"\n puts \"------------------\"\n puts\n sessions.each_with_index do |session, i|\n puts \"[#{i}] #{session.peername}\"\n end\n puts\n else\n puts \"No active sessions\"\n end\n nil\n end",
"def peer_ip; end",
"def resume_status\n Cproton.pn_ssl_resume_status(@impl)\n end",
"def to_ary\n [@code, @message]\n end",
"def code\n @code ||= @net_http_res.code.to_i\n end",
"def create_l2_vpn_session_with_http_info(l2_vpn_session, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session ...'\n end\n # verify the required parameter 'l2_vpn_session' is set\n if @api_client.config.client_side_validation && l2_vpn_session.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_session' when calling ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions'\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_session)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, 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 => 'L2VpnSession')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#create_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def read_l2_vpn_0(tier_0_id, locale_service_id, l2vpn_id, opts = {})\n data, _status_code, _headers = read_l2_vpn_0_with_http_info(tier_0_id, locale_service_id, l2vpn_id, opts)\n data\n end",
"def get_ip_sec_vpnike_session_status(session_id, opts = {})\n data, _status_code, _headers = get_ip_sec_vpnike_session_status_with_http_info(session_id, opts)\n data\n end",
"def voyage_port_code\n @voyage_port_code = VoyagePortType.find(self.port_type_id).voyage_port_type_code if @voyage_port_code\n return @voyage_port_code\n end",
"def find_connected_peer_terminations\r\n if self.in_connection? \r\n self.aln_connection.aln_terminations.to_ary.delete(self)\r\n self.aln_connection.aln_terminations\r\n else \r\n []\r\n end \r\n end",
"def get_avs_code()\n return @RESPONSE_HASH['AVS']\n end",
"def peer_ip\n peername[0]\n end",
"def cvv_result_code\n cvv_result_code_message = self.messages.find {|m| m.context=='processor.cvv_result_code' || m.context=='gateway.cvv_result_code' }\n cvv_result_code_message && cvv_result_code_message.key\n end",
"def result_code\n self[:result_code]\n end",
"def get_connected_peers\n filter_by_state = { :state => 2 }\n connected = self.peers filter_by_state\n end",
"def peer\n @peer ||= { ip: socket.peer_ip, port: @port.to_i, host: @host, canonized: host_as_string }\n end",
"def connection_states\n hash = {}\n names = STATENAMES.reverse\n \n STATECODES.sort.each_with_index do |code, index|\n hash[names[index]] = code\n end\n \n return hash\n end",
"def on_response(session)\n peer_session = get_peer_session(session)\n if peer_session && session[:_sipper_b2b_transparent]\n peer_session.respond_with(session.iresponse.code)\n else\n super\n end\n end",
"def get_tier0_l2_vpn_session_remote_macs_for_ls_0(tier_0_id, locale_service_id, service_id, session_id, opts = {})\n data, _status_code, _headers = get_tier0_l2_vpn_session_remote_macs_for_ls_0_with_http_info(tier_0_id, locale_service_id, service_id, session_id, opts)\n data\n end",
"def list(options={})\n param = { :uniq_id => @uniq_id }.merge options\n Storm::Base::SODServer.remote_list '/VPN/list', param do |u|\n user = VPNUser.new\n user.from_hash u\n user\n end\n end",
"def code\n @grpc.language_code\n end",
"def vpns\n NodeWrapper.new @links.select{|e| e.type == :vpn}.map(&:to)\n end",
"def language_codes_for_select\n configuration(:languages).collect { |language|\n language[:language_code]\n }\n end",
"def find_negotiate_context(type)\n negotiate_context_list.find { |nc| nc.context_type == type }\n end",
"def verification_code\n raise ArgumentError, 'Hash is not set' if @hash.nil?\n\n binary = @hash.unpack1('B*').split //\n [*binary.first(6), *binary.last(7)].join.to_i(2)\n end",
"def peer; end",
"def get_crypto_stats(port)\r\n r = 0 # Received\r\n g = 0 # Generated\r\n m = 0 # Mined\r\n $blockchain.length.times do |i|\r\n block = $blockchain[i]\r\n r +=1 if (block.payee == port)\r\n g +=1 if (block.payer == port)\r\n m +=1 if (block.miner == port)\r\n end\r\n return [r, g, m]\r\nend",
"def peeraddrs\n @peeraddrs ||= {}\n end",
"def get_session_id\n\t\t\tresponse = perform_request(MAGIC_BYTES + REQUEST_BYTE[:challenge] + CLIENT_ID)\n\t\t\t\n\t\t\t# the challenge token comes back as a series of bytes that represent the\n\t\t\t# integer we want, so we have to convert it to the actual 32bit int\n\t\t\t[response.slice(5..-2).to_i].pack(\"l>\").bytes.to_a\n\t\tend",
"def process_v4_connection_response(socket)\n packet = socket.recv(2).unpack(\"C*\")\n dump(:read, packet)\n version = packet[0]\n result_code = packet[1]\n\n case result_code\n when 90 then\n log(:green, build_v4_result_code_message(result_code))\n else\n raise SockitError, build_v4_result_code_message(result_code)\n end\n\n port = socket.recv(2).unpack(\"n\")\n dump(:read, port)\n\n host = socket.recv(4).unpack(\"C*\")\n dump(:read, host)\n\n [host.join('.'), port.join]\n end",
"def cvv_result(response)\n case response[:raw][:CardSecurityCodeMatch]\n when \"Pass\"\n return \"M\" # Match\n when \"Fail\"\n return \"N\" # No Match\n else\n return \"P\" # Not Processed\n end\n end",
"def get_conversations_cobrowsesession_participant_wrapupcodes(conversation_id, participant_id, opts = {})\n data, _status_code, _headers = get_conversations_cobrowsesession_participant_wrapupcodes_with_http_info(conversation_id, participant_id, opts)\n return data\n end",
"def get_guest_protocols(protocols)\n Hash[ protocols.select {|k,v| v[\"guest access\"] == \"1\" } ].keys\n end",
"def raw_peers\n uri.query = URI.encode_www_form(peer_hash)\n data = BEncode.load(Net::HTTP.get(uri))\n data['peers'].bytes\n end",
"def peer\n return @remote_address\n end",
"def mother_tongues\n spoken_languages.where(language_level_code: LanguageLevel[:mother_tongue].code).map(&:language)\n end",
"def gather_pvn_vlan_details\n loop do\n answer = ask(\n \"Please enter the IP range you'd like to set up your private virtual network in CIDR \"\\\n \"notation:\"){ |q| q.default = '10.10.10.0/24'}\n begin\n ip = IPAddress.parse(answer)\n if ip.prefix == 32\n say \"Please enter a range. You entered a single IP address.\".red\n else\n say \"Configuring private virtual network as Address: #{ip.address} \"\\\n \"- Netmask: #{ip.netmask}\".green\n return ip\n end\n rescue\n say \"Invalid CIDR IP range.\".red\n end\n end\n end",
"def tpl\n connection_name = 'PrivateConnection'\n local_vpc_id_ref, remote_vpc_id_ref = %W(#{connection_name}VpcId #{connection_name}PeerVpcId)\n\n def validate_params(*params)\n params.each do |param|\n fail \"Unable to find required parameter #{param}\" unless @parameters.key?(param)\n end\n rescue RuntimeError => e\n puts e\n exit 1\n end\n\n validate_params(*[remote_vpc_id_ref])\n\n local_vpc, remote_vpc = [vpc, vpc(id: @parameters[remote_vpc_id_ref])]\n\n description 'Stack to create peering connection between two VPCs'\n\n parameter_vpc_id(local_vpc_id_ref,\n 'VpcId from where connection gets created',\n local_vpc.id)\n\n parameter_vpc_id(remote_vpc_id_ref,\n 'VpcId where peering connection should go',\n remote_vpc.id)\n\n # Initialize Peering connection\n vpc_peering_init(connection_name,\n tags: [\n {\n Key: 'Name',\n Value: connection_name\n }\n ])\n\n def read_vpc_route_tables(vpc)\n routes = []\n vpc.route_tables.each do |rt|\n routes << rt\n end\n routes\n end\n\n # Add rules to local VPC routing table\n read_vpc_route_tables(local_vpc).map(&:id).each_with_index do |rt_id, i|\n local_vpc_route_rule = \"LocalVPCPeeringRoute#{i + 1}\"\n resource local_vpc_route_rule,\n Type: 'AWS::EC2::Route',\n Properties: {\n RouteTableId: rt_id,\n DestinationCidrBlock: remote_vpc.cidr_block,\n VpcPeeringConnectionId: ref(connection_name)\n }\n\n output local_vpc_route_rule,\n Description: \"Local VPC Peering connection for #{rt_id}\",\n Value: ref(local_vpc_route_rule)\n end\n\n # Add rules to remote VPC routing table\n read_vpc_route_tables(remote_vpc).map(&:id).each_with_index do |rt_id, i|\n remote_vpc_route_rule = \"RemoteVPCPeeringRoute#{i + 1}\"\n resource remote_vpc_route_rule,\n Type: 'AWS::EC2::Route',\n Properties: {\n RouteTableId: rt_id,\n DestinationCidrBlock: local_vpc.cidr_block,\n VpcPeeringConnectionId: ref(connection_name)\n }\n\n output remote_vpc_route_rule,\n Description: \"Remote VPC Peering connection for #{rt_id}\",\n Value: ref(remote_vpc_route_rule)\n end\n end",
"def b2b_direct_connect_outbound\n return @b2b_direct_connect_outbound\n end",
"def inspect\n \"pc: #{@pc} codes: #{@codes.inspect}\"\n end",
"def ssl_check_peer_state\n super\n end",
"def get_auth_code()\n return @RESPONSE_HASH['AUTH_CODE']\n end",
"def list_pc_codes\n\treturn if authorise_for_web(program_name?,'read_pc_code') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:pc_codes_page] = params['page']\n\n\t\t render_list_pc_codes\n\n\t\t return \n\telse\n\t\tsession[:pc_codes_page] = nil\n\tend\n\n\tlist_query = \"@pc_code_pages = Paginator.new self, PcCode.count, @@page_size,@current_page\n\t @pc_codes = PcCode.find(:all,\n\t\t\t\t :limit => @pc_code_pages.items_per_page,\n\t\t\t\t :offset => @pc_code_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_pc_codes\nend",
"def C_GetSessionInfo()\n @pk.C_GetSessionInfo(@sess)\n end",
"def connection_status_crypt_response; end",
"def list_ipfixl2_profiles(opts = {})\n data, _status_code, _headers = list_ipfixl2_profiles_with_http_info(opts)\n data\n end",
"def current_room_sessionids \n result = []\n peeps = simperson.simplace.simpeople\n peeps.each do |aperson|\n result << aperson.simcharacter.simplayer.sessionid if aperson.simcharacter.simplayer.online == true\n end\n result\n end",
"def list_l2_vpns_with_http_info(tier_0_id, locale_service_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingNetworkServicesVPNL2VPNServicesApi.list_l2_vpns, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l2vpn-context/l2vpns'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNL2VPNServicesApi#list_l2_vpns\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def find_current_user_vpn_config_with_http_info(code, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VPNApi.find_current_user_vpn_config ...'\n end\n # verify the required parameter 'code' is set\n if @api_client.config.client_side_validation && code.nil?\n fail ArgumentError, \"Missing the required parameter 'code' when calling VPNApi.find_current_user_vpn_config\"\n end\n # verify enum value\n allowable_values = [\"ewr1\", \"scj1\", \"arm1\", \"nrt1\"]\n if @api_client.config.client_side_validation && !allowable_values.include?(code)\n fail ArgumentError, \"invalid value for \\\"code\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/user/vpn'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'code'] = code\n\n # header parameters\n header_params = opts[: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 = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'VPNConfig'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['x_auth_token']\n\n new_options = opts.merge(\n :operation => :\"VPNApi.find_current_user_vpn_config\",\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 => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VPNApi#find_current_user_vpn_config\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def pgrespcode\n\t\t \tparams['pgRespCode']\n\t\t end",
"def extract_peer(bgp, ip_name, type)\n # rubocop:disable Style/Semicolon\n ret = nil\n if type == :ip\n vrf = extract(bgp, :vrf, :'peer-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:'remote-address'] == ip_name }\n end\n elsif type == :template\n vrf = extract(bgp, :vrf, :'peer-group-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:name] == ip_name }\n end\n else\n # This condition should not be hit.\n raise \"Invalid neighbor type #{type}\"\n end\n ret\n # rubocop:enable Style/Semicolon\n end",
"def extract_peer(bgp, ip_name, type)\n # rubocop:disable Style/Semicolon\n ret = nil\n if type == :ip\n vrf = extract(bgp, :vrf, :'peer-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:'remote-address'] == ip_name }\n end\n elsif type == :template\n vrf = extract(bgp, :vrf, :'peer-group-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:name] == ip_name }\n end\n else\n # This condition should not be hit.\n raise \"Invalid neighbor type #{type}\"\n end\n ret\n # rubocop:enable Style/Semicolon\n end",
"def list_l2_vpns(tier_0_id, locale_service_id, opts = {})\n data, _status_code, _headers = list_l2_vpns_with_http_info(tier_0_id, locale_service_id, opts)\n data\n end",
"def get_disconnected_peers\n filter_by_state = { :state => 1 }\n disconnected = self.peers filter_by_state\n end",
"def language_codes_for_select\n configuration(:languages).collect{ |language|\n language[:language_code]\n }\n end",
"def _voyager_lookup code\n\n metadata = {}\n\n voyager = OCI8.new($config['voyager']['user'], $config['voyager']['pass'], $config['voyager']['host'])\n\n # Do the main Voyager query to get bibid from barcode\n voyager.exec(\"select bt.* from item_barcode ib, bib_item bi, bib_text bt where ib.item_barcode='#{code}' and ib.item_id=bi.item_id and bi.bib_id = bt.bib_id\") do |result|\n metadata[:bibid] = result[0]\n metadata[:author] = result[1]\n metadata[:title] = result[3]\n end\n\n # Do a secondary query to collect oclc number\n index_fields = voyager.exec(\"select normal_heading from bib_index where bib_id='#{metadata[:bibid]}' and index_code='0350'\")\n while field = index_fields.fetch\n if result = /.*OCOLC\\D*(\\d+)/i.match(field[0])\n metadata[:oclc_id] = result.captures[0]\n end\n end\n\n return metadata\n\nend",
"def parse_status_packet(packet)\n { :code => packet.read_long }\n end"
] | [
"0.79057103",
"0.58211654",
"0.54679704",
"0.5190082",
"0.5138232",
"0.5109675",
"0.5076664",
"0.50579065",
"0.502413",
"0.49591893",
"0.49243572",
"0.4920729",
"0.48780403",
"0.4823812",
"0.48201475",
"0.47893485",
"0.47692594",
"0.47544664",
"0.47376856",
"0.47256473",
"0.47069046",
"0.47069046",
"0.47041145",
"0.46983516",
"0.46673825",
"0.46659687",
"0.4660342",
"0.4658003",
"0.46445352",
"0.46423912",
"0.4631085",
"0.4596176",
"0.45540756",
"0.45171458",
"0.44943258",
"0.4493352",
"0.44871473",
"0.44818553",
"0.44808498",
"0.4479607",
"0.44690913",
"0.44623637",
"0.4447921",
"0.44233027",
"0.44135976",
"0.44082662",
"0.44082528",
"0.43911842",
"0.43698025",
"0.43644238",
"0.43498465",
"0.4344258",
"0.43386805",
"0.43350938",
"0.4333577",
"0.43334386",
"0.4316191",
"0.4315376",
"0.4300325",
"0.42936042",
"0.42923173",
"0.4287846",
"0.42828467",
"0.42784023",
"0.42754433",
"0.42656782",
"0.42486265",
"0.42439362",
"0.42227045",
"0.4205868",
"0.42042026",
"0.41853988",
"0.4184834",
"0.41816196",
"0.4167594",
"0.41600597",
"0.41499922",
"0.41476646",
"0.41473767",
"0.4147314",
"0.4139613",
"0.41321093",
"0.41276687",
"0.4124949",
"0.41200092",
"0.41195947",
"0.41185358",
"0.41163144",
"0.41142774",
"0.4105332",
"0.41052362",
"0.41045445",
"0.41039124",
"0.4086991",
"0.4086991",
"0.40849593",
"0.40804863",
"0.40800107",
"0.40773347",
"0.4075684"
] | 0.7128506 | 1 |
Get all L2VPN sessions Get paginated list of all L2VPN sessions | def list_l2_vpn_sessions(opts = {})
data, _status_code, _headers = list_l2_vpn_sessions_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_l2_vpn_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/vpn/l2vpn/sessions'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'l2vpn_service_id'] = opts[:'l2vpn_service_id'] if !opts[:'l2vpn_service_id'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'L2VpnSessionListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#list_l2_vpn_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n sessions = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/sessions\"\n ).body\n end\n styled_header(\"OAuth Sessions\")\n styled_array(sessions.map { |session|\n [session[\"description\"], session[\"id\"]]\n })\n end",
"def index\n @lift_sessions = LiftSession.all\n end",
"def session_list\n @admin_customer_emails = Admin::Customer::Email.by_session(MyStudio::Session.find(params[:id]))\n @record_count = @admin_customer_emails.count\n @admin_customer_emails = @admin_customer_emails.page(params[:page])\n render :index\n end",
"def list_my_sessions(opts = {})\n data, _status_code, _headers = list_my_sessions_with_http_info(opts)\n data\n end",
"def list(options={})\n param = { :uniq_id => @uniq_id }.merge options\n Storm::Base::SODServer.remote_list '/VPN/list', param do |u|\n user = VPNUser.new\n user.from_hash u\n user\n end\n end",
"def get_all_sessions(opts = {})\n data, _status_code, _headers = get_all_sessions_with_http_info(opts)\n return data\n end",
"def listtokens(session)\n\tbegin\n\t\tprint_status(\"Getting Tokens...\")\n\t\tdt = ''\n\t\tsession.core.use(\"incognito\")\n\t\ti = 0\n\t\tdt << \"****************************\\n\"\n\t\tdt << \" List of Available Tokens\\n\"\n\t\tdt << \"****************************\\n\\n\"\n\t\twhile i < 2\n\t\t\ttokens = session.incognito.incognito_list_tokens(i)\n\t\t\tif i == 0\n\t\t\t\ttType = \"User\"\n\t\t\telse\n\t\t\t\ttType = \"Group\"\n\t\t\tend\n\t\t\tdt << \"#{tType} Delegation Tokens Available \\n\"\n\t\t\tdt << \"======================================== \\n\"\n\n\t\t\ttokens['delegation'].each_line{ |string|\n\t\t\t\tdt << string + \"\\n\"\n\t\t\t}\n\n\t\t\tdt << \"\\n\"\n\t\t\tdt << \"#{tType} Impersonation Tokens Available \\n\"\n\t\t\tdt << \"======================================== \\n\"\n\n\t\t\ttokens['impersonation'].each_line{ |string|\n\t\t\t\tdt << string + \"\\n\"\n\t\t\t}\n\t \t\ti += 1\n\t \t\tbreak if i == 2\n\t\tend\n\t\tprint_status(\"All tokens have been processed\")\n\trescue ::Exception => e\n\t\tprint_status(\"Error Getting Tokens: #{e.class} #{e}\")\n\tend\n\tdt\n\nend",
"def index\n @sessions = Session.all\n end",
"def index\n @sessions = Session.all\n end",
"def index\n @sessions = Session.all\n end",
"def index\n @sessions = Session.all\n end",
"def index\n @user_sessions = UserSession.all\n end",
"def list_poll_sessions_for_poll(poll_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions\",\n :poll_id => poll_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def index\n @pairing_sessions = PairingSession.all\n end",
"def get_all_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.get_all_sessions ...\"\n end\n # resource path\n local_var_path = \"/session/all\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'Array<Session>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#get_all_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_my_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FrontendApi.list_my_sessions ...'\n end\n if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"per_page\"]\" when calling FrontendApi.list_my_sessions, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"per_page\"]\" when calling FrontendApi.list_my_sessions, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling FrontendApi.list_my_sessions, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/sessions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-Session-Token'] = opts[:'x_session_token'] if !opts[:'x_session_token'].nil?\n header_params[:'Cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<Session>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FrontendApi.list_my_sessions\",\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 => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FrontendApi#list_my_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @session_logins = SessionLogin.all\n end",
"def index\n @ergo_sessions = ErgoSession.all\n end",
"def index\n @guest_session_associations = GuestSessionAssociation.where(user_id:[session[:user_id]])\n end",
"def index\n @guest_chat_tokens = GuestChatToken.all\n end",
"def list_opened_poll_sessions(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/poll_sessions/opened\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def list\n @session[:clustername]=nil\n @session[:clustername1]=nil\n @group_pages, @groups = paginate :groups, :per_page => 10\n end",
"def index\n\t\t@class_sessions = ClassSession.all\n\tend",
"def index\n @class_sessions = ClassSession.all\n end",
"def index\n @class_sessions = ClassSession.all\n end",
"def index\n @connection_tokens = ConnectionToken.all\n end",
"def list\n response = connect(base_url, :get)\n pagination_links(response)\n self.current_page = JSON.load(response.body)\n end",
"def get_all_conversations\n response = RestClient::Request.execute method: :get,\n url: URL,\n user: USERNAME,\n password: PASSWORD,\n headers: {params: {pageSize: OBJECTS_PER_PAGE, page:ARGV[1]}},\n :content_type => :json,\n :accept => :json\n JSON(response)['conversations'][396..-1]\n end",
"def index\n @sevone_sessions = SevoneSession.all\n end",
"def list opts = {}\n get_with_size_and_position('ssl/v1', opts)\n end",
"def sessions!\n @sessions = search_sessions(xml_doc!)\n end",
"def each_session(&block)\n return enum_for(:each_session) unless block_given?\n s = Cproton.pn_session_head(@impl, 0);\n while s\n yield Session.wrap(s)\n s = Cproton.pn_session_next(s, 0)\n end\n self\n end",
"def sessions\n @sessions.each_key.to_a\n end",
"def all_sessions\n @the_sessions = []\n teachers = Teacher.where(school_id: current_teacher.school_id)\n teachers.each do |the_teacher|\n some_sessions = Session.where( session_teacher: the_teacher)\n @the_sessions << some_sessions \n end\n return @the_sessions\n end",
"def userIndex\n @user_sessions = current_user.sessions\n end",
"def index\n return unless restrict_to_hosts\n\n @sessions = Session.where(event_id: @event.id)\n end",
"def sessions\n @sessions ||= search_sessions(xml_doc)\n end",
"def index\n result = current_user.photo_sessions.search(params).page(params[:page]).per(20)\n @photo_sessions = PagesDecorator.decorate(result.records, with: PhotoSessionDecorator)\n end",
"def index\n @sessions = Session.where(finalized: true).page(params[:page_id]).per(100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end",
"def show\n @robot_instance_sessions = @robot_instance.robot_instance_sessions.order(start_session: :desc)\n end",
"def all_sessions\n self.test_sessions\n end",
"def index\n @v2_users = V2User.all\n end",
"def index\n @csessions = Csession.all\n end",
"def sessions\n return @sessions\n end",
"def list_sessions(user_id:)\n path = '/users/{userId}/sessions'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::SessionList\n )\n end",
"def listSessionsOfGroup(groupID)\n call :listSessionsOfGroup, :groupID => groupID\n end",
"def index\n @sessions = BatchConnect::Session.all\n @sessions.each(&:update_cache_completed!)\n\n set_app_groups\n set_my_quotas\n end",
"def sessions\n @sessions\n end",
"def get_l2_vpn_session_summary(opts = {})\n data, _status_code, _headers = get_l2_vpn_session_summary_with_http_info(opts)\n data\n end",
"def get_all_message_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.get_all_message_sessions ...'\n end\n # resource path\n local_var_path = '/api/v2/sessions'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'GetAllMessageSessionsPaginatedResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TextMagicApi#get_all_message_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def sessions\n PokerSession.find(:all)\n end",
"def index\n @servers = Server.order(:ip).page params[:page]\n end",
"def session_get\n nessus_rest_get(\"session\")\n end",
"def list_closed_poll_sessions(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/poll_sessions/closed\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def index\n @session_resources = SessionResource.all\n\n render json: @session_resources\n end",
"def index\n @session_times = SessionTime.all\n end",
"def get_all_message_sessions(opts = {})\n data, _status_code, _headers = get_all_message_sessions_with_http_info(opts)\n data\n end",
"def sessionList\n if (\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 @sessionlist = @experiment.ute_ex_sessions.where(:is_active => true).pluck(:session_code)\n #[ \n # UteExSession.where(:'ute_experiment.experiment_code' => params[:experiment_code], :is_active => true).pluck(:session_code)\n #].collect { |aoc| aoc.to_a}.flatten\n\n respond_to do |format|\n format.html { render text: 'Session list: <br/>' + { 'sessions' => @sessionlist }.to_json }\n format.json { \n render json: { 'sessions' => @sessionlist }.to_json \n }\n end\n end",
"def get_sessions\n\t\tsessions = Session.get_week(self.user_id, self.start_date)\n\t\tget_nice_array(sessions)\n\tend",
"def index\n @programme_sessions = ProgrammeSession.all\n end",
"def index\n allow :get\n expires_in 60.seconds\n\n nodes = @kavlan.nodes_vlan(params[:vlan_id])\n result = {\n 'total' => nodes.length,\n 'offset' => 0,\n 'items' => nodes.map { |n| { 'uid' => n, 'vlan' => params[:vlan_id] } },\n 'links' => links_for_collection\n }\n\n result['items'].each do |item|\n item['links'] = links_for_item(item)\n end\n\n render_result(result)\n end",
"def list_rmt_varieties\n\treturn if authorise_for_web('varieties','read') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:rmt_varieties_page] = params['page']\n\n\t\t render_list_rmt_varieties\n\n\t\t return \n\telse\n\t\tsession[:rmt_varieties_page] = nil\n\tend\n\n\tlist_query = \"@rmt_variety_pages = Paginator.new self, RmtVariety.count, @@page_size,@current_page\n\t @rmt_varieties = RmtVariety.find(:all,\n\t\t\t\t :limit => @rmt_variety_pages.items_per_page,\n\t\t\t\t :offset => @rmt_variety_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_rmt_varieties\nend",
"def list_subscriptions options = {}\n paged_enum = subscriber.list_subscriptions project: project_path(options),\n page_size: options[:max],\n page_token: options[:token]\n\n paged_enum.response\n end",
"def get_all_bulk_sessions(opts = {})\n data, _status_code, _headers = get_all_bulk_sessions_with_http_info(opts)\n data\n end",
"def selected_sessions #:nodoc:\n select_hash = params[:_cb_sessions] || {}\n select_hash.keys.select { |sub| select_hash[sub] == '1' }.sort\n end",
"def fetchTokens\n self.class.request.get \"#{id}/tokens\" \n end",
"def index\n @sessions = Session.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end",
"def session_tokens\n @data[:session_tokens]\n end",
"def index\n @sessions = Session.all\n authorize @sessions\n end",
"def index\n @vms = Vm.order(:ip).page params[:page]\n end",
"def get_all_bulk_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.get_all_bulk_sessions ...'\n end\n # resource path\n local_var_path = '/api/v2/bulks'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'GetAllBulkSessionsPaginatedResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TextMagicApi#get_all_bulk_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @subject_sessions = SubjectSession.all\n end",
"def index\n @sessions = current_user.fitness_sessions\n end",
"def index\n render json: AuthIpAddressGroup.paginate(page: params[:page], per_page: 25)\n end",
"def index\n @keys = ApiKey.where(user_id: current_user.id).order(id: :desc).page params[:page] # kaminari\n end",
"def get_l2_vpn_session(l2vpn_session_id, opts = {})\n data, _status_code, _headers = get_l2_vpn_session_with_http_info(l2vpn_session_id, opts)\n data\n end",
"def index\n paginate json: @user.playlists.all\n end",
"def getSessions(hostname,username)\n\n client.railgun.add_function('netapi32', 'NetSessionEnum', 'DWORD',[\n ['PWCHAR','servername','in'],\n ['PWCHAR','UncClientName','in'],\n ['PWCHAR','username','in'],\n ['DWORD','level','in'],\n ['PDWORD','bufptr','out'],\n ['DWORD','prefmaxlen','in'],\n ['PDWORD','entriesread','out'],\n ['PDWORD','totalentries','out'],\n ['PDWORD','resume_handle','inout']\n ])\n\n buffersize = 500\n result = client.railgun.netapi32.NetSessionEnum(hostname,nil,username,10,4,buffersize,4,4,nil)\n if result['return'] == 5\n if @verbose == true\n print_error(\"Access Denied when trying to access host: #{hostname}\")\n end\n return nil\n elsif result['return'] == 53\n if @verbose == true\n print_error(\"Host not found or did not respond: #{hostname}\")\n end\n return nil\n elsif result['return'] == 123\n if @verbose == true\n print_error(\"Invalid host: #{hostname}\")\n end\n return nil\n elsif result['return'] == 0\n if @verbose == true\n print_status(\"#{hostname} Session identified\")\n end\n elsif result['return'] == 2221 #username not found\n return nil\n else\n if result['return'] != 234\n if @verbose == true\n print_status(\"Unaccounted for error code: #{result['return']}\")\n end\n return nil\n end\n end\n\n while result['return'] == 234\n buffersize = buffersize + 500\n print_status(\"Buff me\")\n result = client.railgun.netapi32.NetSessionEnum(hostname,nil,username,10,4,buffersize,4,4,nil)\n end\n\n netsessions = read_session_struct(result['bufptr'],result['totalentries'])\n if netsessions.size > 0\n netsessions.each do |x|\n if username != nil\n print_good(\"#{username} is logged in at #{hostname} and has been idle for #{x[:idletime]} seconds\")\n @sessions = @sessions + 1\n else\n print_good(\"#{x[:username]} logged in at #{hostname} and has been idle for #{x[:idletime]} seconds\")\n end\n \n end\n end\n end",
"def active_sessions\n render json: Session.where(\"active = ?\", true)\n end",
"def list_terminals\n Terminal.list_terminals(@user_token, @access_token)\n end",
"def get_all_class_sessions(opts = {})\n data, _status_code, _headers = get_all_class_sessions_with_http_info(opts)\n return data\n end",
"def index\n @session_operations = SessionOperation.all\n end",
"def get_all_user_sessions(user_uid,start_date,user_request_id)\n # PostgresLacticSessions.get_by_uid(user_uid,start_date,user_request_id)\n get_pg_by_uid(user_uid,start_date,user_request_id)\n end",
"def user_list\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/users/\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\tputs \"Here is a list of users...\"\n\t\tparsed_json = JSON.parse(get_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend",
"def index\n @ngos = Ngo.all\n # reset_session\n end",
"def get_session_status keys\n @con.call 'core.get_session_status', keys, {}\n end",
"def get_all_with_trashed_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.get_all_with_trashed_sessions ...\"\n end\n # resource path\n local_var_path = \"/session/all-with-trashed\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'Array<Session>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#get_all_with_trashed_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @admin_session = AdminSession.all\n end",
"def index\n\t\tauthenticate_or_request_with_http_token do |token, options|\n\t\t\trender json: Conversation.all_by_token(token), each_serializer: ConversationSparseSerializer\t\t\t\n\t\tend\n\tend",
"def read_session_struct(startmem,count)\n base = 0\n netsessions = []\n mem = client.railgun.memread(startmem, 16*count)\n count.times{|i|\n x = {}\n cnameptr = mem[(base + 0),4].unpack(\"V*\")[0]\n usernameptr = mem[(base + 4),4].unpack(\"V*\")[0]\n x[:usetime] = mem[(base + 8),4].unpack(\"V*\")[0]\n x[:idletime] = mem[(base + 12),4].unpack(\"V*\")[0]\n x[:cname] = client.railgun.memread(cnameptr,255).split(\"\\0\\0\")[0].split(\"\\0\").join\n x[:username] = client.railgun.memread(usernameptr,255).split(\"\\0\\0\")[0].split(\"\\0\").join\n netsessions << x\n base = base + 16\n }\n return netsessions\n end",
"def get_all_class_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ClasssessionApi.get_all_class_sessions ...\"\n end\n # resource path\n local_var_path = \"/class-session/all\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'Array<TrainingSession>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ClasssessionApi#get_all_class_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @obsessions = Obsession.all\n end",
"def who_is_online\n time_window = Time.now.utc - 30.minutes.to_i\n online_sessions = CGI::Session::ActiveRecordStore::Session.find(:all,\n :select => \"user_id, last_url_visited, updated_at\",\n :conditions => [ \"updated_at > ? and user_id is not null\", time_window ],\n :limit => 50 )\n online_users = []\n online_sessions.each do |session|\n online_users << User.find(session.user_id)\n end\n online_users\n end",
"def index\n @dream_sessions = current_user.dream_sessions.order(created_at: :desc)\n end",
"def retrieve_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def index\n @users = LDAP::User.all.sort_by(&:login)\n render json: @users\n end",
"def sessions\n\n key = \"000000:#{TransamController::ACTIVE_SESSION_LIST_CACHE_VAR}\"\n @sessions = Rails.cache.fetch(key)\n @sessions.delete_if { |key, value| value[:expire_time] < Time.now }\n @sessions ||= {}\n\n end",
"def index\n @scopes = Scope.all.page(params[:page]).per(20)\n end",
"def list_users\n http_get(:uri=>\"/users\", :fields=>x_cookie)\n end"
] | [
"0.7177643",
"0.62780446",
"0.62716323",
"0.60475665",
"0.5932879",
"0.5919063",
"0.591813",
"0.58998376",
"0.5872089",
"0.5872089",
"0.5872089",
"0.5872089",
"0.5816827",
"0.5789972",
"0.5785835",
"0.569206",
"0.5642155",
"0.5592925",
"0.5585024",
"0.5576251",
"0.5561094",
"0.55590117",
"0.5553762",
"0.5518428",
"0.5518057",
"0.55178624",
"0.5515327",
"0.548742",
"0.54858893",
"0.54856306",
"0.5477913",
"0.5472437",
"0.54691815",
"0.5461291",
"0.5451322",
"0.5443226",
"0.5427376",
"0.542172",
"0.54205966",
"0.5417119",
"0.5406237",
"0.5399687",
"0.5398526",
"0.53964233",
"0.53797936",
"0.5378412",
"0.5373788",
"0.53735924",
"0.5367359",
"0.536645",
"0.536628",
"0.53421634",
"0.5334377",
"0.5332255",
"0.53135216",
"0.53102237",
"0.5309604",
"0.5291888",
"0.5290119",
"0.5272396",
"0.5237578",
"0.5232372",
"0.52321017",
"0.521756",
"0.5209654",
"0.51935077",
"0.5192973",
"0.51845175",
"0.5181492",
"0.51755226",
"0.5153867",
"0.51481915",
"0.5145192",
"0.5126809",
"0.5125475",
"0.5106912",
"0.5103611",
"0.51002026",
"0.5096402",
"0.508429",
"0.5070886",
"0.50682265",
"0.5064276",
"0.5062426",
"0.5059202",
"0.50560105",
"0.5054737",
"0.50479966",
"0.50465316",
"0.50413257",
"0.50310796",
"0.5011813",
"0.49992147",
"0.4997271",
"0.4987185",
"0.49788114",
"0.49753904",
"0.4956231",
"0.49482235",
"0.49468404"
] | 0.74568003 | 0 |
Get all L2VPN sessions Get paginated list of all L2VPN sessions | def list_l2_vpn_sessions_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions ...'
end
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be smaller than or equal to 1000.'
end
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be greater than or equal to 0.'
end
# resource path
local_var_path = '/vpn/l2vpn/sessions'
# query parameters
query_params = {}
query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?
query_params[:'l2vpn_service_id'] = opts[:'l2vpn_service_id'] if !opts[:'l2vpn_service_id'].nil?
query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?
query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'L2VpnSessionListResult')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementPlaneApiVpnL2VpnSessionsApi#list_l2_vpn_sessions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_l2_vpn_sessions(opts = {})\n data, _status_code, _headers = list_l2_vpn_sessions_with_http_info(opts)\n data\n end",
"def index\n sessions = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/sessions\"\n ).body\n end\n styled_header(\"OAuth Sessions\")\n styled_array(sessions.map { |session|\n [session[\"description\"], session[\"id\"]]\n })\n end",
"def index\n @lift_sessions = LiftSession.all\n end",
"def session_list\n @admin_customer_emails = Admin::Customer::Email.by_session(MyStudio::Session.find(params[:id]))\n @record_count = @admin_customer_emails.count\n @admin_customer_emails = @admin_customer_emails.page(params[:page])\n render :index\n end",
"def list_my_sessions(opts = {})\n data, _status_code, _headers = list_my_sessions_with_http_info(opts)\n data\n end",
"def list(options={})\n param = { :uniq_id => @uniq_id }.merge options\n Storm::Base::SODServer.remote_list '/VPN/list', param do |u|\n user = VPNUser.new\n user.from_hash u\n user\n end\n end",
"def get_all_sessions(opts = {})\n data, _status_code, _headers = get_all_sessions_with_http_info(opts)\n return data\n end",
"def listtokens(session)\n\tbegin\n\t\tprint_status(\"Getting Tokens...\")\n\t\tdt = ''\n\t\tsession.core.use(\"incognito\")\n\t\ti = 0\n\t\tdt << \"****************************\\n\"\n\t\tdt << \" List of Available Tokens\\n\"\n\t\tdt << \"****************************\\n\\n\"\n\t\twhile i < 2\n\t\t\ttokens = session.incognito.incognito_list_tokens(i)\n\t\t\tif i == 0\n\t\t\t\ttType = \"User\"\n\t\t\telse\n\t\t\t\ttType = \"Group\"\n\t\t\tend\n\t\t\tdt << \"#{tType} Delegation Tokens Available \\n\"\n\t\t\tdt << \"======================================== \\n\"\n\n\t\t\ttokens['delegation'].each_line{ |string|\n\t\t\t\tdt << string + \"\\n\"\n\t\t\t}\n\n\t\t\tdt << \"\\n\"\n\t\t\tdt << \"#{tType} Impersonation Tokens Available \\n\"\n\t\t\tdt << \"======================================== \\n\"\n\n\t\t\ttokens['impersonation'].each_line{ |string|\n\t\t\t\tdt << string + \"\\n\"\n\t\t\t}\n\t \t\ti += 1\n\t \t\tbreak if i == 2\n\t\tend\n\t\tprint_status(\"All tokens have been processed\")\n\trescue ::Exception => e\n\t\tprint_status(\"Error Getting Tokens: #{e.class} #{e}\")\n\tend\n\tdt\n\nend",
"def index\n @sessions = Session.all\n end",
"def index\n @sessions = Session.all\n end",
"def index\n @sessions = Session.all\n end",
"def index\n @sessions = Session.all\n end",
"def index\n @user_sessions = UserSession.all\n end",
"def list_poll_sessions_for_poll(poll_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions\",\n :poll_id => poll_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def index\n @pairing_sessions = PairingSession.all\n end",
"def get_all_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.get_all_sessions ...\"\n end\n # resource path\n local_var_path = \"/session/all\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'Array<Session>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#get_all_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_my_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FrontendApi.list_my_sessions ...'\n end\n if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"per_page\"]\" when calling FrontendApi.list_my_sessions, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"per_page\"]\" when calling FrontendApi.list_my_sessions, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling FrontendApi.list_my_sessions, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/sessions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-Session-Token'] = opts[:'x_session_token'] if !opts[:'x_session_token'].nil?\n header_params[:'Cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<Session>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FrontendApi.list_my_sessions\",\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 => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FrontendApi#list_my_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @session_logins = SessionLogin.all\n end",
"def index\n @ergo_sessions = ErgoSession.all\n end",
"def index\n @guest_session_associations = GuestSessionAssociation.where(user_id:[session[:user_id]])\n end",
"def index\n @guest_chat_tokens = GuestChatToken.all\n end",
"def list_opened_poll_sessions(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/poll_sessions/opened\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def list\n @session[:clustername]=nil\n @session[:clustername1]=nil\n @group_pages, @groups = paginate :groups, :per_page => 10\n end",
"def index\n\t\t@class_sessions = ClassSession.all\n\tend",
"def index\n @class_sessions = ClassSession.all\n end",
"def index\n @class_sessions = ClassSession.all\n end",
"def index\n @connection_tokens = ConnectionToken.all\n end",
"def list\n response = connect(base_url, :get)\n pagination_links(response)\n self.current_page = JSON.load(response.body)\n end",
"def get_all_conversations\n response = RestClient::Request.execute method: :get,\n url: URL,\n user: USERNAME,\n password: PASSWORD,\n headers: {params: {pageSize: OBJECTS_PER_PAGE, page:ARGV[1]}},\n :content_type => :json,\n :accept => :json\n JSON(response)['conversations'][396..-1]\n end",
"def index\n @sevone_sessions = SevoneSession.all\n end",
"def list opts = {}\n get_with_size_and_position('ssl/v1', opts)\n end",
"def sessions!\n @sessions = search_sessions(xml_doc!)\n end",
"def each_session(&block)\n return enum_for(:each_session) unless block_given?\n s = Cproton.pn_session_head(@impl, 0);\n while s\n yield Session.wrap(s)\n s = Cproton.pn_session_next(s, 0)\n end\n self\n end",
"def sessions\n @sessions.each_key.to_a\n end",
"def all_sessions\n @the_sessions = []\n teachers = Teacher.where(school_id: current_teacher.school_id)\n teachers.each do |the_teacher|\n some_sessions = Session.where( session_teacher: the_teacher)\n @the_sessions << some_sessions \n end\n return @the_sessions\n end",
"def userIndex\n @user_sessions = current_user.sessions\n end",
"def index\n return unless restrict_to_hosts\n\n @sessions = Session.where(event_id: @event.id)\n end",
"def sessions\n @sessions ||= search_sessions(xml_doc)\n end",
"def index\n result = current_user.photo_sessions.search(params).page(params[:page]).per(20)\n @photo_sessions = PagesDecorator.decorate(result.records, with: PhotoSessionDecorator)\n end",
"def index\n @sessions = Session.where(finalized: true).page(params[:page_id]).per(100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end",
"def show\n @robot_instance_sessions = @robot_instance.robot_instance_sessions.order(start_session: :desc)\n end",
"def all_sessions\n self.test_sessions\n end",
"def index\n @v2_users = V2User.all\n end",
"def index\n @csessions = Csession.all\n end",
"def sessions\n return @sessions\n end",
"def list_sessions(user_id:)\n path = '/users/{userId}/sessions'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::SessionList\n )\n end",
"def listSessionsOfGroup(groupID)\n call :listSessionsOfGroup, :groupID => groupID\n end",
"def index\n @sessions = BatchConnect::Session.all\n @sessions.each(&:update_cache_completed!)\n\n set_app_groups\n set_my_quotas\n end",
"def sessions\n @sessions\n end",
"def get_l2_vpn_session_summary(opts = {})\n data, _status_code, _headers = get_l2_vpn_session_summary_with_http_info(opts)\n data\n end",
"def get_all_message_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.get_all_message_sessions ...'\n end\n # resource path\n local_var_path = '/api/v2/sessions'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'GetAllMessageSessionsPaginatedResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TextMagicApi#get_all_message_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def sessions\n PokerSession.find(:all)\n end",
"def index\n @servers = Server.order(:ip).page params[:page]\n end",
"def session_get\n nessus_rest_get(\"session\")\n end",
"def list_closed_poll_sessions(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/poll_sessions/closed\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def index\n @session_resources = SessionResource.all\n\n render json: @session_resources\n end",
"def index\n @session_times = SessionTime.all\n end",
"def get_all_message_sessions(opts = {})\n data, _status_code, _headers = get_all_message_sessions_with_http_info(opts)\n data\n end",
"def sessionList\n if (\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 @sessionlist = @experiment.ute_ex_sessions.where(:is_active => true).pluck(:session_code)\n #[ \n # UteExSession.where(:'ute_experiment.experiment_code' => params[:experiment_code], :is_active => true).pluck(:session_code)\n #].collect { |aoc| aoc.to_a}.flatten\n\n respond_to do |format|\n format.html { render text: 'Session list: <br/>' + { 'sessions' => @sessionlist }.to_json }\n format.json { \n render json: { 'sessions' => @sessionlist }.to_json \n }\n end\n end",
"def get_sessions\n\t\tsessions = Session.get_week(self.user_id, self.start_date)\n\t\tget_nice_array(sessions)\n\tend",
"def index\n @programme_sessions = ProgrammeSession.all\n end",
"def index\n allow :get\n expires_in 60.seconds\n\n nodes = @kavlan.nodes_vlan(params[:vlan_id])\n result = {\n 'total' => nodes.length,\n 'offset' => 0,\n 'items' => nodes.map { |n| { 'uid' => n, 'vlan' => params[:vlan_id] } },\n 'links' => links_for_collection\n }\n\n result['items'].each do |item|\n item['links'] = links_for_item(item)\n end\n\n render_result(result)\n end",
"def list_rmt_varieties\n\treturn if authorise_for_web('varieties','read') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:rmt_varieties_page] = params['page']\n\n\t\t render_list_rmt_varieties\n\n\t\t return \n\telse\n\t\tsession[:rmt_varieties_page] = nil\n\tend\n\n\tlist_query = \"@rmt_variety_pages = Paginator.new self, RmtVariety.count, @@page_size,@current_page\n\t @rmt_varieties = RmtVariety.find(:all,\n\t\t\t\t :limit => @rmt_variety_pages.items_per_page,\n\t\t\t\t :offset => @rmt_variety_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_rmt_varieties\nend",
"def list_subscriptions options = {}\n paged_enum = subscriber.list_subscriptions project: project_path(options),\n page_size: options[:max],\n page_token: options[:token]\n\n paged_enum.response\n end",
"def get_all_bulk_sessions(opts = {})\n data, _status_code, _headers = get_all_bulk_sessions_with_http_info(opts)\n data\n end",
"def selected_sessions #:nodoc:\n select_hash = params[:_cb_sessions] || {}\n select_hash.keys.select { |sub| select_hash[sub] == '1' }.sort\n end",
"def fetchTokens\n self.class.request.get \"#{id}/tokens\" \n end",
"def index\n @sessions = Session.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end",
"def session_tokens\n @data[:session_tokens]\n end",
"def index\n @sessions = Session.all\n authorize @sessions\n end",
"def index\n @vms = Vm.order(:ip).page params[:page]\n end",
"def get_all_bulk_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.get_all_bulk_sessions ...'\n end\n # resource path\n local_var_path = '/api/v2/bulks'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'GetAllBulkSessionsPaginatedResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TextMagicApi#get_all_bulk_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @subject_sessions = SubjectSession.all\n end",
"def index\n @sessions = current_user.fitness_sessions\n end",
"def index\n render json: AuthIpAddressGroup.paginate(page: params[:page], per_page: 25)\n end",
"def index\n @keys = ApiKey.where(user_id: current_user.id).order(id: :desc).page params[:page] # kaminari\n end",
"def get_l2_vpn_session(l2vpn_session_id, opts = {})\n data, _status_code, _headers = get_l2_vpn_session_with_http_info(l2vpn_session_id, opts)\n data\n end",
"def index\n paginate json: @user.playlists.all\n end",
"def getSessions(hostname,username)\n\n client.railgun.add_function('netapi32', 'NetSessionEnum', 'DWORD',[\n ['PWCHAR','servername','in'],\n ['PWCHAR','UncClientName','in'],\n ['PWCHAR','username','in'],\n ['DWORD','level','in'],\n ['PDWORD','bufptr','out'],\n ['DWORD','prefmaxlen','in'],\n ['PDWORD','entriesread','out'],\n ['PDWORD','totalentries','out'],\n ['PDWORD','resume_handle','inout']\n ])\n\n buffersize = 500\n result = client.railgun.netapi32.NetSessionEnum(hostname,nil,username,10,4,buffersize,4,4,nil)\n if result['return'] == 5\n if @verbose == true\n print_error(\"Access Denied when trying to access host: #{hostname}\")\n end\n return nil\n elsif result['return'] == 53\n if @verbose == true\n print_error(\"Host not found or did not respond: #{hostname}\")\n end\n return nil\n elsif result['return'] == 123\n if @verbose == true\n print_error(\"Invalid host: #{hostname}\")\n end\n return nil\n elsif result['return'] == 0\n if @verbose == true\n print_status(\"#{hostname} Session identified\")\n end\n elsif result['return'] == 2221 #username not found\n return nil\n else\n if result['return'] != 234\n if @verbose == true\n print_status(\"Unaccounted for error code: #{result['return']}\")\n end\n return nil\n end\n end\n\n while result['return'] == 234\n buffersize = buffersize + 500\n print_status(\"Buff me\")\n result = client.railgun.netapi32.NetSessionEnum(hostname,nil,username,10,4,buffersize,4,4,nil)\n end\n\n netsessions = read_session_struct(result['bufptr'],result['totalentries'])\n if netsessions.size > 0\n netsessions.each do |x|\n if username != nil\n print_good(\"#{username} is logged in at #{hostname} and has been idle for #{x[:idletime]} seconds\")\n @sessions = @sessions + 1\n else\n print_good(\"#{x[:username]} logged in at #{hostname} and has been idle for #{x[:idletime]} seconds\")\n end\n \n end\n end\n end",
"def active_sessions\n render json: Session.where(\"active = ?\", true)\n end",
"def list_terminals\n Terminal.list_terminals(@user_token, @access_token)\n end",
"def get_all_class_sessions(opts = {})\n data, _status_code, _headers = get_all_class_sessions_with_http_info(opts)\n return data\n end",
"def index\n @session_operations = SessionOperation.all\n end",
"def get_all_user_sessions(user_uid,start_date,user_request_id)\n # PostgresLacticSessions.get_by_uid(user_uid,start_date,user_request_id)\n get_pg_by_uid(user_uid,start_date,user_request_id)\n end",
"def user_list\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/users/\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\tputs \"Here is a list of users...\"\n\t\tparsed_json = JSON.parse(get_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend",
"def index\n @ngos = Ngo.all\n # reset_session\n end",
"def get_session_status keys\n @con.call 'core.get_session_status', keys, {}\n end",
"def get_all_with_trashed_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.get_all_with_trashed_sessions ...\"\n end\n # resource path\n local_var_path = \"/session/all-with-trashed\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'Array<Session>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#get_all_with_trashed_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @admin_session = AdminSession.all\n end",
"def index\n\t\tauthenticate_or_request_with_http_token do |token, options|\n\t\t\trender json: Conversation.all_by_token(token), each_serializer: ConversationSparseSerializer\t\t\t\n\t\tend\n\tend",
"def read_session_struct(startmem,count)\n base = 0\n netsessions = []\n mem = client.railgun.memread(startmem, 16*count)\n count.times{|i|\n x = {}\n cnameptr = mem[(base + 0),4].unpack(\"V*\")[0]\n usernameptr = mem[(base + 4),4].unpack(\"V*\")[0]\n x[:usetime] = mem[(base + 8),4].unpack(\"V*\")[0]\n x[:idletime] = mem[(base + 12),4].unpack(\"V*\")[0]\n x[:cname] = client.railgun.memread(cnameptr,255).split(\"\\0\\0\")[0].split(\"\\0\").join\n x[:username] = client.railgun.memread(usernameptr,255).split(\"\\0\\0\")[0].split(\"\\0\").join\n netsessions << x\n base = base + 16\n }\n return netsessions\n end",
"def get_all_class_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ClasssessionApi.get_all_class_sessions ...\"\n end\n # resource path\n local_var_path = \"/class-session/all\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'Array<TrainingSession>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ClasssessionApi#get_all_class_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @obsessions = Obsession.all\n end",
"def who_is_online\n time_window = Time.now.utc - 30.minutes.to_i\n online_sessions = CGI::Session::ActiveRecordStore::Session.find(:all,\n :select => \"user_id, last_url_visited, updated_at\",\n :conditions => [ \"updated_at > ? and user_id is not null\", time_window ],\n :limit => 50 )\n online_users = []\n online_sessions.each do |session|\n online_users << User.find(session.user_id)\n end\n online_users\n end",
"def index\n @dream_sessions = current_user.dream_sessions.order(created_at: :desc)\n end",
"def retrieve_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def index\n @users = LDAP::User.all.sort_by(&:login)\n render json: @users\n end",
"def sessions\n\n key = \"000000:#{TransamController::ACTIVE_SESSION_LIST_CACHE_VAR}\"\n @sessions = Rails.cache.fetch(key)\n @sessions.delete_if { |key, value| value[:expire_time] < Time.now }\n @sessions ||= {}\n\n end",
"def index\n @scopes = Scope.all.page(params[:page]).per(20)\n end",
"def list_users\n http_get(:uri=>\"/users\", :fields=>x_cookie)\n end"
] | [
"0.74568003",
"0.62780446",
"0.62716323",
"0.60475665",
"0.5932879",
"0.5919063",
"0.591813",
"0.58998376",
"0.5872089",
"0.5872089",
"0.5872089",
"0.5872089",
"0.5816827",
"0.5789972",
"0.5785835",
"0.569206",
"0.5642155",
"0.5592925",
"0.5585024",
"0.5576251",
"0.5561094",
"0.55590117",
"0.5553762",
"0.5518428",
"0.5518057",
"0.55178624",
"0.5515327",
"0.548742",
"0.54858893",
"0.54856306",
"0.5477913",
"0.5472437",
"0.54691815",
"0.5461291",
"0.5451322",
"0.5443226",
"0.5427376",
"0.542172",
"0.54205966",
"0.5417119",
"0.5406237",
"0.5399687",
"0.5398526",
"0.53964233",
"0.53797936",
"0.5378412",
"0.5373788",
"0.53735924",
"0.5367359",
"0.536645",
"0.536628",
"0.53421634",
"0.5334377",
"0.5332255",
"0.53135216",
"0.53102237",
"0.5309604",
"0.5291888",
"0.5290119",
"0.5272396",
"0.5237578",
"0.5232372",
"0.52321017",
"0.521756",
"0.5209654",
"0.51935077",
"0.5192973",
"0.51845175",
"0.5181492",
"0.51755226",
"0.5153867",
"0.51481915",
"0.5145192",
"0.5126809",
"0.5125475",
"0.5106912",
"0.5103611",
"0.51002026",
"0.5096402",
"0.508429",
"0.5070886",
"0.50682265",
"0.5064276",
"0.5062426",
"0.5059202",
"0.50560105",
"0.5054737",
"0.50479966",
"0.50465316",
"0.50413257",
"0.50310796",
"0.5011813",
"0.49992147",
"0.4997271",
"0.4987185",
"0.49788114",
"0.49753904",
"0.4956231",
"0.49482235",
"0.49468404"
] | 0.7177643 | 1 |
Edit a L2VPN session Edit a specific L2VPN session | def update_l2_vpn_session(l2vpn_session_id, l2_vpn_session, opts = {})
data, _status_code, _headers = update_l2_vpn_session_with_http_info(l2vpn_session_id, l2_vpn_session, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_l2_vpn_session_with_http_info(l2vpn_session_id, l2_vpn_session, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_client.config.client_side_validation && l2vpn_session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session\"\n end\n # verify the required parameter 'l2_vpn_session' is set\n if @api_client.config.client_side_validation && l2_vpn_session.nil?\n fail ArgumentError, \"Missing the required parameter 'l2_vpn_session' when calling ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session\"\n end\n # resource path\n local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)\n\n # query parameters\n query_params = {}\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(l2_vpn_session)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'L2VpnSession')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnL2VpnSessionsApi#update_l2_vpn_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def edit(struct)\n struct.remapkeys!\n if struct.has_key? :user and struct.has_key? :pass\n rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])\n struct.delete(:user)\n struct.delete(:pass)\n else\n rt = RT_Client.new\n end\n val = rt.edit(struct)\n rt = nil\n val\n end",
"def update(options={})\n param = { :uniq_id => @uniq_id }.merge options\n data = Storm::Base::SODServer.remote_call '/VPN/update', param\n self.from_hash data\n end",
"def update\n respond_to do |format|\n if @otg_sess.update(otg_sess_params)\n format.html { redirect_to @otg_sess, notice: 'Otg sess was successfully updated.' }\n format.json { render :show, status: :ok, location: @otg_sess }\n else\n format.html { render :edit }\n format.json { render json: @otg_sess.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lift_session.update(lift_session_params)\n format.html { redirect_to @lift_session, notice: 'Lift session was successfully updated.' }\n format.json { render :show, status: :ok, location: @lift_session }\n else\n format.html { render :edit }\n format.json { render json: @lift_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ykt_session = YktSession.find(params[:id])\n\n respond_to do |format|\n if @ykt_session.update_attributes(params[:ykt_session])\n format.html { redirect_to @ykt_session, notice: 'Ykt session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ykt_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ergo_session.update(ergo_session_params)\n format.html { redirect_to @ergo_session, notice: 'Ergo session was successfully updated.' }\n format.json { render :show, status: :ok, location: @ergo_session }\n else\n format.html { render :edit }\n format.json { render json: @ergo_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n return unless restrict_to_hosts\n\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to [@event, @session], notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: [@event, @session] }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @session_plan_category.session_plans.find(params[:id]).update(session_plan_params)\n redirect_to session_plan_category_session_plans_path(@session_plan_category), notice: \"Session Plan updated successfully.\"\n else\n render 'edit'\n end\n end",
"def edit\n reset_session_key(:user, @user_id, {})\n redirect_to wizard_path('identity')\n end",
"def update!(**args)\n @session_info = args[:session_info] if args.key?(:session_info)\n end",
"def update\n respond_to do |format|\n if @sevone_session.update(sevone_session_params)\n format.html { redirect_to @sevone_session, notice: 'Sevone session was successfully updated.' }\n format.json { render :show, status: :ok, location: @sevone_session }\n else\n format.html { render :edit }\n format.json { render json: @sevone_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n if params[:invitation_token]\n session[:invitation_token] = params[:invitation_token]\n end\n super\n end",
"def update\n @escapetunnel = Escapetunnel.find(params[:id])\n\n respond_to do |format|\n if @escapetunnel.update_attributes(params[:escapetunnel])\n format.html { redirect_to @escapetunnel, :notice => 'Escapetunnel was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @escapetunnel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n flash[:notice] = 'Session was successfully updated.'\n format.html { \n if @session.course\n redirect_to(admin_course_session_path(@session.course, @session))\n else\n redirect_to(admin_session_path(@session))\n end\n }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @session.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @session_info = args[:session_info] if args.key?(:session_info)\n @verification_code = args[:verification_code] if args.key?(:verification_code)\n end",
"def update\n @plateau_session = PlateauSession.find(params[:id])\n\n respond_to do |format|\n if @plateau_session.update_attributes(params[:plateau_session])\n format.html { redirect_to(@plateau_session, :notice => 'Plateau session was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @plateau_session.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @vpn = current_user.vpn\n\n respond_to do |format|\n if @vpn.update_attributes(params[:vpn])\n format.html { redirect_to vpn_path, notice: 'Vpn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vpn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n return if Settings.readonly \n\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to sessions_url, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n authorize @session\n @session.update(session_params)\n redirect_to trainings_path\n end",
"def update\n @interview_session = InterviewSession.find(params[:id])\n\n respond_to do |format|\n if @interview_session.update_attributes(params[:interview_session])\n format.html { redirect_to(@interview_session, :notice => 'Interview session was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interview_session.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def guest_update\n @trip = session[:trip]\n if @trip != nil\n @trip.update(trip_params)\n redirect_to trip_plans_guest_edit_path\n else\n redirect_to trip_plans_choose_path\n end\n end",
"def update!(**args)\n @session_state_info = args[:session_state_info] if args.key?(:session_state_info)\n @transcription_session_id = args[:transcription_session_id] if args.key?(:transcription_session_id)\n end",
"def update\n @vpn = Vpn.find(params[:id])\n checkaccountobject(\"vpns\",@vpn)\n\n respond_to do |format|\n if @vpn.update_attributes(params[:vpn])\n format.html { redirect_to @vpn, notice: 'Vpn was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vpn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_session_key\n @parameters['sessionKey'] = get_session_key\n end",
"def edit(request)\n render do |xml|\n xml.h2 \"Update rack session\"\n xml.p \"Put marshalized and encoded with base64 ruby hash into the form\"\n xml.form({\n :action => action_path(:update),\n :method => 'post',\n :enctype => 'application/x-www-form-urlencoded'\n }) do |form|\n form.input(:type => 'hidden', :name =>'_method', :value => 'put')\n form.textarea(:cols => 40, :rows => 10, :name => 'data') {}\n form.p do |p|\n p.input(:type => 'submit', :value => \"Update\")\n end\n end\n end\n end",
"def update!(**args)\n @contextual_session_id = args[:contextual_session_id] if args.key?(:contextual_session_id)\n end",
"def update_vpn_status\n # Request parameters\n mac = params[:mac]\n vpn_status_name = params[:vpn_status]\n vpn_sw = params[:vpn_sw]\n ip = params[:ip]\n viewpoint = params[:viewpoint] || \"Unknown\"\n vpn_status = VpnStatus.find_by_name vpn_status_name\n node = Node.find_or_create_by_id mac.to_i(16)\n node.update_vpn_status vpn_status,ip,vpn_sw,viewpoint\n render status: :created, :text => \"\"\n end",
"def update\n respond_to do |format|\n if @tsession.update(tsession_params)\n format.html { redirect_to @tsession, notice: 'Tsession was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tsession.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @session\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_consolepass(vid, new_password)\n perform_request(:action => 'vserver-consolepass', :vserverid => vid, :consolepassword => new_password)\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to game_session_path(@session), notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_password\n @session_user = current_session_user\n end",
"def update\n @frozen_tunnel_io = FrozenTunnelIo.find(params[:id])\n\n respond_to do |format|\n if @frozen_tunnel_io.update_attributes(params[:frozen_tunnel_io])\n format.html { redirect_to @frozen_tunnel_io, notice: 'El tunel de congelado fue editado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @frozen_tunnel_io.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\r\n jump_to(\"/profiles/#{session[:account_id]}/basic\")\r\n end",
"def edit_session(id, start, opts = {})\n data, _status_code, _headers = edit_session_with_http_info(id, start, opts)\n return data\n end",
"def edit\n @col2 = \"form_tips\"\n if params[:id] == 'new'\n if session[:tag_configuration]\n @tag_configuration = session[:tag_configuration]\n @tag_configuration.reset_errors_for_anonymous_session\n else\n logger.debug \"Requested /show/edit but no config in session\"\n redirect_to :action => 'new'\n return\n end\n else\n @tag_configuration = TagConfiguration.find(params[:id])\n end\n end",
"def update\n\t\tif current_invite.present?\n\t\t\treset_session\n\t\t\tsession[:invite_id] = current_invite.id\n\t\t\tredirect_to invite_path(current_invite.id)\n\t\telse\n\t\t\treset_session\n\t\t\tredirect_to root_path\n\t\tend\n\tend",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n if session[:id] && session[:token]\n \n data_output = ::Utility.send_request_to_host_api(\"get\",DOMAIN_HOST+VERSION_API+\"/\"+USERS_TABLE+\"/\"+session[:id].to_s)\n \n if data_output[\"meta\"][\"code\"].to_i == 200\n @data_view = data_output[\"data\"]\n else\n @error = data_output[\"meta\"][\"description\"]\n end\n else\n redirect_to({action:'signin'})\n end\n \n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tutoring_session = TutoringSession.find(params[:id])\n\n respond_to do |format|\n if @tutoring_session.update_attributes(params[:tutoring_session])\n format.html { redirect_to @tutoring_session, notice: 'Tutoring session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutoring_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pool_session = PoolSession.find(params[:id])\n if @pool_session.player1 == @pool_session.player2\n flash[:error] = \"You must specifify 2 separate players in a session\"\n render :action => \"edit\" \n else\n respond_to do |format|\n if @pool_session.update_attributes(params[:session])\n update_player_scores\n format.html { redirect_to(@pool_session, :notice => 'Session was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pool_session.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def update\n @program_session = ProgramSession.find(params[:id])\n\n respond_to do |format|\n if @program_session.update_attributes(params[:program_session])\n flash[:notice] = 'ProgramSession was successfully updated.'\n format.html { redirect_to(@program_session) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @program_session.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_session.update(session_params)\n format.html { redirect_to @admin_session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_session }\n else\n format.html { render :edit }\n format.json { render json: @admin_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @phone_session_info = args[:phone_session_info] if args.key?(:phone_session_info)\n @totp_session_info = args[:totp_session_info] if args.key?(:totp_session_info)\n end",
"def update\n @polling_session = PollingSession.find(params[:id])\n\n respond_to do |format|\n if @polling_session.update_attributes(params[:polling_session])\n format.html { redirect_to @polling_session, notice: 'Polling session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @polling_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @yoga_session = YogaSession.find(params[:id])\n\n respond_to do |format|\n if @yoga_session.update_attributes(params[:yoga_session])\n format.html { redirect_to @yoga_session, notice: 'Yoga session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @yoga_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_session_with_http_info(id, start, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.edit_session ...\"\n end\n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling SessionApi.edit_session\" if id.nil?\n # verify the required parameter 'start' is set\n fail ArgumentError, \"Missing the required parameter 'start' when calling SessionApi.edit_session\" if start.nil?\n # resource path\n local_var_path = \"/session/edit\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = id\n query_params[:'start'] = start\n query_params[:'boat_id'] = opts[:'boat_id'] if !opts[:'boat_id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, 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 => 'InlineResponse20044')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#edit_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @my_studio_portrait = MyStudio::Portrait.find(params[:id])\n @my_studio_portrait.my_studio_session = @my_studio_session\n\n respond_to do |format|\n if @my_studio_portrait.update_attributes(params[:my_studio_portrait])\n format.html { redirect_to my_studio_session_portraits_url(@my_studio_session), notice: 'Portrait was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_studio_portrait.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sessao.update(sessao_params)\n format.html { redirect_to @sessao, notice: 'Sessao was successfully updated.' }\n format.json { render :show, status: :ok, location: @sessao }\n else\n format.html { render :edit }\n format.json { render json: @sessao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(body = nil)\n self.service.edit(self.softlayer_hash, body)\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n mk = connect_mikrotik\n respond_to do |format|\n\n \n @plan_old = @plan.as_json # Guarda os parâmetros antigos do registro para retornar caso não consiga mudar no mikrotik\n \n id = mk.get_reply(\"/ppp/profile/print\", \"?name=#{@plan.profile_name}\")[0][\".id\"]\n puts \"Id do registro a ser mudado\"\n puts id\n\n if @plan.update(plan_params)\n \n result = mk.get_reply(\"/ppp/profile/set\",\n \"=name=#{plan_params[\"profile_name\"]}\",\n \"=rate-limit=#{plan_params[\"rate_limit\"]}\",\n \"=.id=#{id}\")[0][\"message\"]\n\n @notice = 'Plan was successfully updated.'\n if result != nil\n @notice = \"It wasn't possible to update mikrotik\"\n @plan.update(@plan_old)\n end\n\n format.html { redirect_to @plan, notice: @notice }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @current_session = CurrentSession.find(params[:id])\n\n if @current_session.update(params[:current_session])\n head :no_content\n else\n render json: @current_session.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @game_session.update(game_session_params)\n format.html { redirect_to @game_session, notice: 'Game session was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_session }\n else\n format.html { render :edit }\n format.json { render json: @game_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session_type = SessionType.find(params[:id])\n\n respond_to do |format|\n if @session_type.update_attributes(params[:session_type])\n format.html { redirect_to @session_type, notice: 'Session type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exercise_session.update(exercise_session_params)\n format.html { redirect_to @exercise_session, notice: 'Exercise session was successfully updated.' }\n format.json { render :show, status: :ok, location: @exercise_session }\n else\n format.html { render :edit }\n format.json { render json: @exercise_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit2\n @show_element=\"admin\"\n @action=\"update2\"\n @rolesgroup = RolesGroup.find(params[:id])\n @role = Role.find_by_role_name(@rolesgroup.role_name)\n end",
"def update\n respond_to do |format|\n if @help_session_request.update(help_session_request_params)\n format.html { redirect_to @help_session_request, notice: 'Help session request was successfully updated.' }\n format.json { render :show, status: :ok, location: @help_session_request }\n else\n format.html { render :edit }\n format.json { render json: @help_session_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pairing_session.update(pairing_session_params)\n format.html { redirect_to @pairing_session, notice: 'Pairing session was successfully updated.' }\n format.json { render :show, status: :ok, location: @pairing_session }\n else\n format.html { render :edit }\n format.json { render json: @pairing_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @page_title = 'Edit System Options'\n @integration = Integration.first_or_create\n if @option.use_remote_reservations? and [email protected]_login?\n flash[:warning] = \"You have enabled remote reservations and do not have logins enabled<br />This can enable a person doing a remote reservation to access your system<br />You should correct this situation or all of your camper records will be exposed!\"\n end\n rescue => err\n error err.to_s\n flash[:error] = \"Application error\"\n redirect_to :action => 'index', :controller => 'setup/index'\n end",
"def update\n respond_to do |format|\n if @terminal.update(terminal_params)\n format.html { redirect_to [:admin, @terminal], notice: 'Terminal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @terminal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(options = {})\n data = PostData.new\n data[:user] = @login\n data[:pass] = @password\n if options[:tid]\n data[:tid] = options[:tid]\n else\n data[:ord_id] = options[:ord_id]\n data[:service_id] = options[:service_id]\n end\n\n ssl_post(STATUS_TEST_URL, data.to_post_data)\n end",
"def edit\n @menu='tickets' #Set the menu variable\n $title=t(:title_edit_ticket) #Set the title variable\n if !check_session #Validate if the user session is active\n return #If not force return to trigger the redirect of the check_session function\n end\n @election_id = params[:election_id] #Retrieve the params from the query string\n resp = Ticket.find(params[:id],session[:user]) #Retrieve the ticket to update\n if resp[0] #Validate if the response was successfull\n @ticket = resp[1] #Set the ticket object to fill the edit form\n elsif validate_authorized_access(resp[1]) #If the response was unsucessful, validate if it was caused by unauthorized access to the app or expired session\n flash[:danger] = t(:ticket_get_error_flash) #Set the error message for the user\n redirect_to ticket_path #Redirect the user to edit ticket page\n else\n return #If not force return to trigger the redirect of the check_session function\n end\n rescue #Error Handilng code\n general_error_redirection('Controller: '+params[:controller]+'.'+action_name,$!)\n end",
"def update\n\t\tauthorize! :update, TipoPrivilegio\n respond_to do |format|\n if @tipo_privilegio.update(tipo_privilegio_params)\n\t\t\t\t\t\t\t\t\t\tsesion= Sesion.find_by(usuario_id: current_usuario.id, fechaFin: nil)\n\t\t\t\tTransaccion.create!(\n \t\t\t\tdescripcion: \"Actualización del tipo de privilegio: #{@tipo_privilegio.previous_changes}\" ,\n \t\t\t\tsesion_id: sesion.id\n\t\t\t\t)\n format.html { redirect_to @tipo_privilegio\nflash[:success] = 'Tipo privilegio fue actualizado satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @tipo_privilegio }\n else\n format.html { render :edit }\n format.json { render json: @tipo_privilegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = @event.sessions.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to [@event, @session], notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @nag_mode_prompt = NagModePrompt.find(params[:id])\n respond_to do |format|\n if @nag_mode_prompt.update_attributes(params[:nag_mode_prompt])\n format.html { redirect_to([:scaffold, @nag_mode_prompt.nag_mode], :notice => 'Nag mode prompt was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nag_mode_prompt.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session_operation.update(session_operation_params)\n format.html { redirect_to @session_operation, notice: 'Session operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @session_operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @session = Session.find(params[:id])\r\n\r\n\r\n json = ActiveSupport::JSON.decode(request.raw_post)\r\n logger.debug json\r\n\r\n #@session.pla\r\n\r\n #json = ActiveSupport::JSON.decode(request.raw_post)\r\n #@session.state = json['state']\r\n\r\n respond_to do |format|\r\n if @session.save\r\n format.html { redirect_to(@session, :notice => 'Session was successfully updated.') }\r\n format.xml { head :ok }\r\n format.json { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @session.errors, :status => :unprocessable_entity }\r\n format.json { render :json => @session.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n if current_user.admin\n #authorize @natlang\n respond_to do |format|\n if @natlang.update(natlang_params)\n format.html { redirect_to @natlang, notice: 'Natlang was successfully updated.' }\n format.json { render :show, status: :ok, location: @natlang }\n else\n format.html { render :edit }\n format.json { render json: @natlang.errors, status: :unprocessable_entity }\n end\n end\n else \n redirect_to root_url, alert: \"Sorry, only the admin can do this function\"\n end\n end",
"def update_single_poll_session(poll_id,id,poll_sessions__course_id__,poll_sessions__course_section_id__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :poll_sessions__course_id__,\n :poll_sessions__course_section_id__,\n :poll_sessions__has_public_results__,\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"id is required\" if id.nil?\n raise \"poll_sessions__course_id__ is required\" if poll_sessions__course_id__.nil?\n raise \"poll_sessions__course_section_id__ is required\" if poll_sessions__course_section_id__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :id => id,\n :poll_sessions__course_id__ => poll_sessions__course_id__,\n :poll_sessions__course_section_id__ => poll_sessions__course_section_id__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions/{id}\",\n :poll_id => poll_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n response\n \n end",
"def update\n @security = OpenStack::Nova::Compute::SecurityGroup.find('3')\n \n @security.name = params[:firewall][:name]\n @security.description = params[:firewall][:description]\n @security.save\n # respond_to do |format|\n # if @security.update_attributes(params[:security])\n # format.html { redirect_to @security, notice: 'Security was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @security.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n @sslplan = Sslplan.find(params[:id])\n\n respond_to do |format|\n if @sslplan.update_attributes(params[:sslplan])\n format.html { redirect_to @sslplan, :notice => 'Sslplan was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @sslplan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @otp.update(otp_params)\n format.html { redirect_to @otp, notice: 'Otp was successfully updated.' }\n format.json { render :show, status: :ok, location: @otp }\n else\n format.html { render :edit }\n format.json { render json: @otp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ink_varnish = InkVarnish.find(params[:id])\n\n respond_to do |format|\n if @ink_varnish.update_attributes(params[:ink_varnish])\n format.html { redirect_to @ink_varnish, notice: 'Ink varnish was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ink_varnish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sessao.update(sessao_params)\n format.html { redirect_to @sessao, notice: \"Sessao was successfully updated.\" }\n format.json { render :show, status: :ok, location: @sessao }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @sessao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @owner_email = args[:owner_email] if args.key?(:owner_email)\n @recording_session_id = args[:recording_session_id] if args.key?(:recording_session_id)\n @session_state_info = args[:session_state_info] if args.key?(:session_state_info)\n end",
"def update\n @session_info = SessionInfo.first\n\n respond_to do |format|\n if @session_info.update_attributes(params[:session_info])\n format.html { redirect_to session_information_path, notice: 'Session Info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @programme_session.update(programme_session_params)\n format.html { redirect_to @programme_session, notice: 'Programme session was successfully updated.' }\n format.json { render :show, status: :ok, location: @programme_session }\n else\n format.html { render :edit }\n format.json { render json: @programme_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @discovery_session = DiscoverySession.find(params[:id])\n\n respond_to do |format|\n if @discovery_session.update_attributes(params[:discovery_session])\n format.html { redirect_to @discovery_session, notice: 'Discovery session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discovery_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tsp = Tsp.find(params[:id])\n if current_user.role.id == 7\n params[:tsp][:status] = 6\n end\n respond_to do |format|\n if @tsp.update_attributes(params[:tsp])\n format.html { redirect_to@tsp, notice: 'Tsp was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json:@tsp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @otg_ident.update(otg_ident_params)\n format.html { redirect_to @otg_ident, notice: 'Otg ident was successfully updated.' }\n format.json { render :show, status: :ok, location: @otg_ident }\n else\n format.html { render :edit }\n format.json { render json: @otg_ident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sessi = session[:logged]\t\n\tif ( @sessi == true )\n respond_to do |format|\n if @consulting_room.update(consulting_room_params)\n format.html { redirect_to @consulting_room, notice: 'Consulting room was successfully updated.' }\n format.json { render :show, status: :ok, location: @consulting_room }\n else\n format.html { render :edit }\n format.json { render json: @consulting_room.errors, status: :unprocessable_entity }\n end\n end\n\telse \t\n\tredirect_to \"/login\"\t\n\tend\n end",
"def update\n @workoutsession = Workoutsession.find(params[:id])\n\n respond_to do |format|\n wt = params[:workoutsession].delete(:workout_type)\n if @workoutsession.update_attributes(params[:workoutsession])\n @workoutsession.workout_type_id = wt\n @workoutsession.save\n format.html { redirect_to(@workoutsession, :notice => 'Workoutsession was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @workoutsession.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit_vm(vmname, memory, memorylimit, cpucount, cpucountlimit)\r\n current = {:errormsg => \"\", :status => \"\", :time => \"\", :vmstatus => \"\"}\r\n\t\t\t\t\t\t \r\n conn_opts=get_cli_connection\r\n Chef::Log.debug(\"#{conn_opts[:host]}...edit vm name=#{vmname},#{memory},#{memorylimit},#{cpucount},#{cpucountlimit}\")\r\n Net::SSH.start( conn_opts[:host], conn_opts[:user], :password => conn_opts[:password], :port => conn_opts[:port] ) do|ssh|\r\n output = ssh.exec!(\"edit vm name=#{vmname} memory=#{memory} memorylimit=#{memorylimit} cpucount=#{cpucount} cpucountlimit=#{cpucountlimit}\")\r\n output.each_line do |line|\r\n if line.match(/Status:/)\r\n current[:status]=line.split[1].strip\r\n elsif line.match(/Time:/)\r\n line[\"Time: \"]=\"\"\r\n current[:time]=line.strip\r\n elsif line.match(/Error Msg:/)\r\n line[\"Error Msg: \"]=\"\"\r\n current[:errormsg]=line.strip\r\n end\r\n end\r\n end\r\n return current\r\n end",
"def update\n respond_to do |format|\n if @terminal.update(terminal_params)\n format.html { redirect_to @terminal, notice: 'Terminal was successfully updated.' }\n format.json { render :show, status: :ok, location: @terminal }\n else\n format.html { render :edit }\n format.json { render json: @terminal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find_by_id(params[:id])\n\n if @session.nil?\n render json: {message: \"404 Not Found\"}, status: :not_found\n else\n @session.update(session_params)\n end\n end",
"def change_vncpass(vid, new_password)\n perform_request(:action => 'vserver-vncpass', :vserverid => vid, :vncpassword => new_password)\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 edit\n @user = User.find(session[:user_id])\n end",
"def update\n session[:id_cidade] = user_params[:city_id]\n user_params[:password_confirmation] = user_params[:password]\n super\n end"
] | [
"0.63248646",
"0.60819167",
"0.59483075",
"0.5897877",
"0.58323157",
"0.58171827",
"0.5757632",
"0.5704464",
"0.56998515",
"0.56495434",
"0.56353724",
"0.5609072",
"0.55920726",
"0.5590826",
"0.558789",
"0.5574672",
"0.55618584",
"0.55611956",
"0.54988873",
"0.5496382",
"0.5487196",
"0.5483811",
"0.5473831",
"0.54584646",
"0.5458186",
"0.54450184",
"0.54255456",
"0.5425485",
"0.5425391",
"0.5415208",
"0.54148394",
"0.5413571",
"0.53992593",
"0.5397337",
"0.5395485",
"0.5395117",
"0.53940976",
"0.53822243",
"0.53787005",
"0.5357242",
"0.5338565",
"0.53309554",
"0.53309554",
"0.5329635",
"0.53264433",
"0.53097165",
"0.5295592",
"0.5293799",
"0.52908707",
"0.52904296",
"0.5253177",
"0.5249787",
"0.5249787",
"0.5249787",
"0.5249787",
"0.5243433",
"0.5242343",
"0.52411336",
"0.52188355",
"0.5218617",
"0.52172756",
"0.5214642",
"0.5208734",
"0.5207852",
"0.52074885",
"0.51950675",
"0.51852614",
"0.5178209",
"0.5174535",
"0.51742333",
"0.5149853",
"0.514731",
"0.5143961",
"0.5141814",
"0.51263064",
"0.51239574",
"0.5117843",
"0.51141423",
"0.51110893",
"0.51092094",
"0.51034075",
"0.5100726",
"0.50996256",
"0.50982153",
"0.5096475",
"0.50955373",
"0.50947183",
"0.5091086",
"0.5090928",
"0.50835633",
"0.5076138",
"0.50710076",
"0.50657594",
"0.50620186",
"0.50610137",
"0.5055591",
"0.5046938",
"0.5045745",
"0.5044649",
"0.5044541"
] | 0.51929176 | 66 |
Edit a L2VPN session Edit a specific L2VPN session | def update_l2_vpn_session_with_http_info(l2vpn_session_id, l2_vpn_session, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session ...'
end
# verify the required parameter 'l2vpn_session_id' is set
if @api_client.config.client_side_validation && l2vpn_session_id.nil?
fail ArgumentError, "Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session"
end
# verify the required parameter 'l2_vpn_session' is set
if @api_client.config.client_side_validation && l2_vpn_session.nil?
fail ArgumentError, "Missing the required parameter 'l2_vpn_session' when calling ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session"
end
# resource path
local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(l2_vpn_session)
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'L2VpnSession')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementPlaneApiVpnL2VpnSessionsApi#update_l2_vpn_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit(struct)\n struct.remapkeys!\n if struct.has_key? :user and struct.has_key? :pass\n rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])\n struct.delete(:user)\n struct.delete(:pass)\n else\n rt = RT_Client.new\n end\n val = rt.edit(struct)\n rt = nil\n val\n end",
"def update(options={})\n param = { :uniq_id => @uniq_id }.merge options\n data = Storm::Base::SODServer.remote_call '/VPN/update', param\n self.from_hash data\n end",
"def update\n respond_to do |format|\n if @otg_sess.update(otg_sess_params)\n format.html { redirect_to @otg_sess, notice: 'Otg sess was successfully updated.' }\n format.json { render :show, status: :ok, location: @otg_sess }\n else\n format.html { render :edit }\n format.json { render json: @otg_sess.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lift_session.update(lift_session_params)\n format.html { redirect_to @lift_session, notice: 'Lift session was successfully updated.' }\n format.json { render :show, status: :ok, location: @lift_session }\n else\n format.html { render :edit }\n format.json { render json: @lift_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ykt_session = YktSession.find(params[:id])\n\n respond_to do |format|\n if @ykt_session.update_attributes(params[:ykt_session])\n format.html { redirect_to @ykt_session, notice: 'Ykt session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ykt_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ergo_session.update(ergo_session_params)\n format.html { redirect_to @ergo_session, notice: 'Ergo session was successfully updated.' }\n format.json { render :show, status: :ok, location: @ergo_session }\n else\n format.html { render :edit }\n format.json { render json: @ergo_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n return unless restrict_to_hosts\n\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to [@event, @session], notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: [@event, @session] }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @session_plan_category.session_plans.find(params[:id]).update(session_plan_params)\n redirect_to session_plan_category_session_plans_path(@session_plan_category), notice: \"Session Plan updated successfully.\"\n else\n render 'edit'\n end\n end",
"def edit\n reset_session_key(:user, @user_id, {})\n redirect_to wizard_path('identity')\n end",
"def update!(**args)\n @session_info = args[:session_info] if args.key?(:session_info)\n end",
"def update\n respond_to do |format|\n if @sevone_session.update(sevone_session_params)\n format.html { redirect_to @sevone_session, notice: 'Sevone session was successfully updated.' }\n format.json { render :show, status: :ok, location: @sevone_session }\n else\n format.html { render :edit }\n format.json { render json: @sevone_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n if params[:invitation_token]\n session[:invitation_token] = params[:invitation_token]\n end\n super\n end",
"def update\n @escapetunnel = Escapetunnel.find(params[:id])\n\n respond_to do |format|\n if @escapetunnel.update_attributes(params[:escapetunnel])\n format.html { redirect_to @escapetunnel, :notice => 'Escapetunnel was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @escapetunnel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n flash[:notice] = 'Session was successfully updated.'\n format.html { \n if @session.course\n redirect_to(admin_course_session_path(@session.course, @session))\n else\n redirect_to(admin_session_path(@session))\n end\n }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @session.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @session_info = args[:session_info] if args.key?(:session_info)\n @verification_code = args[:verification_code] if args.key?(:verification_code)\n end",
"def update\n @plateau_session = PlateauSession.find(params[:id])\n\n respond_to do |format|\n if @plateau_session.update_attributes(params[:plateau_session])\n format.html { redirect_to(@plateau_session, :notice => 'Plateau session was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @plateau_session.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @vpn = current_user.vpn\n\n respond_to do |format|\n if @vpn.update_attributes(params[:vpn])\n format.html { redirect_to vpn_path, notice: 'Vpn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vpn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n return if Settings.readonly \n\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to sessions_url, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n authorize @session\n @session.update(session_params)\n redirect_to trainings_path\n end",
"def update\n @interview_session = InterviewSession.find(params[:id])\n\n respond_to do |format|\n if @interview_session.update_attributes(params[:interview_session])\n format.html { redirect_to(@interview_session, :notice => 'Interview session was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interview_session.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def guest_update\n @trip = session[:trip]\n if @trip != nil\n @trip.update(trip_params)\n redirect_to trip_plans_guest_edit_path\n else\n redirect_to trip_plans_choose_path\n end\n end",
"def update!(**args)\n @session_state_info = args[:session_state_info] if args.key?(:session_state_info)\n @transcription_session_id = args[:transcription_session_id] if args.key?(:transcription_session_id)\n end",
"def update\n @vpn = Vpn.find(params[:id])\n checkaccountobject(\"vpns\",@vpn)\n\n respond_to do |format|\n if @vpn.update_attributes(params[:vpn])\n format.html { redirect_to @vpn, notice: 'Vpn was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vpn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_session_key\n @parameters['sessionKey'] = get_session_key\n end",
"def edit(request)\n render do |xml|\n xml.h2 \"Update rack session\"\n xml.p \"Put marshalized and encoded with base64 ruby hash into the form\"\n xml.form({\n :action => action_path(:update),\n :method => 'post',\n :enctype => 'application/x-www-form-urlencoded'\n }) do |form|\n form.input(:type => 'hidden', :name =>'_method', :value => 'put')\n form.textarea(:cols => 40, :rows => 10, :name => 'data') {}\n form.p do |p|\n p.input(:type => 'submit', :value => \"Update\")\n end\n end\n end\n end",
"def update!(**args)\n @contextual_session_id = args[:contextual_session_id] if args.key?(:contextual_session_id)\n end",
"def update_vpn_status\n # Request parameters\n mac = params[:mac]\n vpn_status_name = params[:vpn_status]\n vpn_sw = params[:vpn_sw]\n ip = params[:ip]\n viewpoint = params[:viewpoint] || \"Unknown\"\n vpn_status = VpnStatus.find_by_name vpn_status_name\n node = Node.find_or_create_by_id mac.to_i(16)\n node.update_vpn_status vpn_status,ip,vpn_sw,viewpoint\n render status: :created, :text => \"\"\n end",
"def update\n respond_to do |format|\n if @tsession.update(tsession_params)\n format.html { redirect_to @tsession, notice: 'Tsession was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tsession.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @session\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_consolepass(vid, new_password)\n perform_request(:action => 'vserver-consolepass', :vserverid => vid, :consolepassword => new_password)\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to game_session_path(@session), notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_password\n @session_user = current_session_user\n end",
"def update\n @frozen_tunnel_io = FrozenTunnelIo.find(params[:id])\n\n respond_to do |format|\n if @frozen_tunnel_io.update_attributes(params[:frozen_tunnel_io])\n format.html { redirect_to @frozen_tunnel_io, notice: 'El tunel de congelado fue editado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @frozen_tunnel_io.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\r\n jump_to(\"/profiles/#{session[:account_id]}/basic\")\r\n end",
"def edit_session(id, start, opts = {})\n data, _status_code, _headers = edit_session_with_http_info(id, start, opts)\n return data\n end",
"def edit\n @col2 = \"form_tips\"\n if params[:id] == 'new'\n if session[:tag_configuration]\n @tag_configuration = session[:tag_configuration]\n @tag_configuration.reset_errors_for_anonymous_session\n else\n logger.debug \"Requested /show/edit but no config in session\"\n redirect_to :action => 'new'\n return\n end\n else\n @tag_configuration = TagConfiguration.find(params[:id])\n end\n end",
"def update\n\t\tif current_invite.present?\n\t\t\treset_session\n\t\t\tsession[:invite_id] = current_invite.id\n\t\t\tredirect_to invite_path(current_invite.id)\n\t\telse\n\t\t\treset_session\n\t\t\tredirect_to root_path\n\t\tend\n\tend",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n if session[:id] && session[:token]\n \n data_output = ::Utility.send_request_to_host_api(\"get\",DOMAIN_HOST+VERSION_API+\"/\"+USERS_TABLE+\"/\"+session[:id].to_s)\n \n if data_output[\"meta\"][\"code\"].to_i == 200\n @data_view = data_output[\"data\"]\n else\n @error = data_output[\"meta\"][\"description\"]\n end\n else\n redirect_to({action:'signin'})\n end\n \n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tutoring_session = TutoringSession.find(params[:id])\n\n respond_to do |format|\n if @tutoring_session.update_attributes(params[:tutoring_session])\n format.html { redirect_to @tutoring_session, notice: 'Tutoring session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutoring_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pool_session = PoolSession.find(params[:id])\n if @pool_session.player1 == @pool_session.player2\n flash[:error] = \"You must specifify 2 separate players in a session\"\n render :action => \"edit\" \n else\n respond_to do |format|\n if @pool_session.update_attributes(params[:session])\n update_player_scores\n format.html { redirect_to(@pool_session, :notice => 'Session was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pool_session.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def update\n @program_session = ProgramSession.find(params[:id])\n\n respond_to do |format|\n if @program_session.update_attributes(params[:program_session])\n flash[:notice] = 'ProgramSession was successfully updated.'\n format.html { redirect_to(@program_session) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @program_session.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_session.update(session_params)\n format.html { redirect_to @admin_session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_session }\n else\n format.html { render :edit }\n format.json { render json: @admin_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @phone_session_info = args[:phone_session_info] if args.key?(:phone_session_info)\n @totp_session_info = args[:totp_session_info] if args.key?(:totp_session_info)\n end",
"def update\n @polling_session = PollingSession.find(params[:id])\n\n respond_to do |format|\n if @polling_session.update_attributes(params[:polling_session])\n format.html { redirect_to @polling_session, notice: 'Polling session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @polling_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @yoga_session = YogaSession.find(params[:id])\n\n respond_to do |format|\n if @yoga_session.update_attributes(params[:yoga_session])\n format.html { redirect_to @yoga_session, notice: 'Yoga session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @yoga_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_session_with_http_info(id, start, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.edit_session ...\"\n end\n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling SessionApi.edit_session\" if id.nil?\n # verify the required parameter 'start' is set\n fail ArgumentError, \"Missing the required parameter 'start' when calling SessionApi.edit_session\" if start.nil?\n # resource path\n local_var_path = \"/session/edit\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = id\n query_params[:'start'] = start\n query_params[:'boat_id'] = opts[:'boat_id'] if !opts[:'boat_id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, 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 => 'InlineResponse20044')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#edit_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @my_studio_portrait = MyStudio::Portrait.find(params[:id])\n @my_studio_portrait.my_studio_session = @my_studio_session\n\n respond_to do |format|\n if @my_studio_portrait.update_attributes(params[:my_studio_portrait])\n format.html { redirect_to my_studio_session_portraits_url(@my_studio_session), notice: 'Portrait was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_studio_portrait.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sessao.update(sessao_params)\n format.html { redirect_to @sessao, notice: 'Sessao was successfully updated.' }\n format.json { render :show, status: :ok, location: @sessao }\n else\n format.html { render :edit }\n format.json { render json: @sessao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(body = nil)\n self.service.edit(self.softlayer_hash, body)\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n mk = connect_mikrotik\n respond_to do |format|\n\n \n @plan_old = @plan.as_json # Guarda os parâmetros antigos do registro para retornar caso não consiga mudar no mikrotik\n \n id = mk.get_reply(\"/ppp/profile/print\", \"?name=#{@plan.profile_name}\")[0][\".id\"]\n puts \"Id do registro a ser mudado\"\n puts id\n\n if @plan.update(plan_params)\n \n result = mk.get_reply(\"/ppp/profile/set\",\n \"=name=#{plan_params[\"profile_name\"]}\",\n \"=rate-limit=#{plan_params[\"rate_limit\"]}\",\n \"=.id=#{id}\")[0][\"message\"]\n\n @notice = 'Plan was successfully updated.'\n if result != nil\n @notice = \"It wasn't possible to update mikrotik\"\n @plan.update(@plan_old)\n end\n\n format.html { redirect_to @plan, notice: @notice }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @current_session = CurrentSession.find(params[:id])\n\n if @current_session.update(params[:current_session])\n head :no_content\n else\n render json: @current_session.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @game_session.update(game_session_params)\n format.html { redirect_to @game_session, notice: 'Game session was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_session }\n else\n format.html { render :edit }\n format.json { render json: @game_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session_type = SessionType.find(params[:id])\n\n respond_to do |format|\n if @session_type.update_attributes(params[:session_type])\n format.html { redirect_to @session_type, notice: 'Session type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exercise_session.update(exercise_session_params)\n format.html { redirect_to @exercise_session, notice: 'Exercise session was successfully updated.' }\n format.json { render :show, status: :ok, location: @exercise_session }\n else\n format.html { render :edit }\n format.json { render json: @exercise_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_l2_vpn_session(l2vpn_session_id, l2_vpn_session, opts = {})\n data, _status_code, _headers = update_l2_vpn_session_with_http_info(l2vpn_session_id, l2_vpn_session, opts)\n data\n end",
"def edit2\n @show_element=\"admin\"\n @action=\"update2\"\n @rolesgroup = RolesGroup.find(params[:id])\n @role = Role.find_by_role_name(@rolesgroup.role_name)\n end",
"def update\n respond_to do |format|\n if @help_session_request.update(help_session_request_params)\n format.html { redirect_to @help_session_request, notice: 'Help session request was successfully updated.' }\n format.json { render :show, status: :ok, location: @help_session_request }\n else\n format.html { render :edit }\n format.json { render json: @help_session_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pairing_session.update(pairing_session_params)\n format.html { redirect_to @pairing_session, notice: 'Pairing session was successfully updated.' }\n format.json { render :show, status: :ok, location: @pairing_session }\n else\n format.html { render :edit }\n format.json { render json: @pairing_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @page_title = 'Edit System Options'\n @integration = Integration.first_or_create\n if @option.use_remote_reservations? and [email protected]_login?\n flash[:warning] = \"You have enabled remote reservations and do not have logins enabled<br />This can enable a person doing a remote reservation to access your system<br />You should correct this situation or all of your camper records will be exposed!\"\n end\n rescue => err\n error err.to_s\n flash[:error] = \"Application error\"\n redirect_to :action => 'index', :controller => 'setup/index'\n end",
"def update\n respond_to do |format|\n if @terminal.update(terminal_params)\n format.html { redirect_to [:admin, @terminal], notice: 'Terminal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @terminal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(options = {})\n data = PostData.new\n data[:user] = @login\n data[:pass] = @password\n if options[:tid]\n data[:tid] = options[:tid]\n else\n data[:ord_id] = options[:ord_id]\n data[:service_id] = options[:service_id]\n end\n\n ssl_post(STATUS_TEST_URL, data.to_post_data)\n end",
"def edit\n @menu='tickets' #Set the menu variable\n $title=t(:title_edit_ticket) #Set the title variable\n if !check_session #Validate if the user session is active\n return #If not force return to trigger the redirect of the check_session function\n end\n @election_id = params[:election_id] #Retrieve the params from the query string\n resp = Ticket.find(params[:id],session[:user]) #Retrieve the ticket to update\n if resp[0] #Validate if the response was successfull\n @ticket = resp[1] #Set the ticket object to fill the edit form\n elsif validate_authorized_access(resp[1]) #If the response was unsucessful, validate if it was caused by unauthorized access to the app or expired session\n flash[:danger] = t(:ticket_get_error_flash) #Set the error message for the user\n redirect_to ticket_path #Redirect the user to edit ticket page\n else\n return #If not force return to trigger the redirect of the check_session function\n end\n rescue #Error Handilng code\n general_error_redirection('Controller: '+params[:controller]+'.'+action_name,$!)\n end",
"def update\n\t\tauthorize! :update, TipoPrivilegio\n respond_to do |format|\n if @tipo_privilegio.update(tipo_privilegio_params)\n\t\t\t\t\t\t\t\t\t\tsesion= Sesion.find_by(usuario_id: current_usuario.id, fechaFin: nil)\n\t\t\t\tTransaccion.create!(\n \t\t\t\tdescripcion: \"Actualización del tipo de privilegio: #{@tipo_privilegio.previous_changes}\" ,\n \t\t\t\tsesion_id: sesion.id\n\t\t\t\t)\n format.html { redirect_to @tipo_privilegio\nflash[:success] = 'Tipo privilegio fue actualizado satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @tipo_privilegio }\n else\n format.html { render :edit }\n format.json { render json: @tipo_privilegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = @event.sessions.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to [@event, @session], notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @nag_mode_prompt = NagModePrompt.find(params[:id])\n respond_to do |format|\n if @nag_mode_prompt.update_attributes(params[:nag_mode_prompt])\n format.html { redirect_to([:scaffold, @nag_mode_prompt.nag_mode], :notice => 'Nag mode prompt was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nag_mode_prompt.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session_operation.update(session_operation_params)\n format.html { redirect_to @session_operation, notice: 'Session operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @session_operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @session = Session.find(params[:id])\r\n\r\n\r\n json = ActiveSupport::JSON.decode(request.raw_post)\r\n logger.debug json\r\n\r\n #@session.pla\r\n\r\n #json = ActiveSupport::JSON.decode(request.raw_post)\r\n #@session.state = json['state']\r\n\r\n respond_to do |format|\r\n if @session.save\r\n format.html { redirect_to(@session, :notice => 'Session was successfully updated.') }\r\n format.xml { head :ok }\r\n format.json { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @session.errors, :status => :unprocessable_entity }\r\n format.json { render :json => @session.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n if current_user.admin\n #authorize @natlang\n respond_to do |format|\n if @natlang.update(natlang_params)\n format.html { redirect_to @natlang, notice: 'Natlang was successfully updated.' }\n format.json { render :show, status: :ok, location: @natlang }\n else\n format.html { render :edit }\n format.json { render json: @natlang.errors, status: :unprocessable_entity }\n end\n end\n else \n redirect_to root_url, alert: \"Sorry, only the admin can do this function\"\n end\n end",
"def update_single_poll_session(poll_id,id,poll_sessions__course_id__,poll_sessions__course_section_id__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :poll_sessions__course_id__,\n :poll_sessions__course_section_id__,\n :poll_sessions__has_public_results__,\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"id is required\" if id.nil?\n raise \"poll_sessions__course_id__ is required\" if poll_sessions__course_id__.nil?\n raise \"poll_sessions__course_section_id__ is required\" if poll_sessions__course_section_id__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :id => id,\n :poll_sessions__course_id__ => poll_sessions__course_id__,\n :poll_sessions__course_section_id__ => poll_sessions__course_section_id__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions/{id}\",\n :poll_id => poll_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n response\n \n end",
"def update\n @security = OpenStack::Nova::Compute::SecurityGroup.find('3')\n \n @security.name = params[:firewall][:name]\n @security.description = params[:firewall][:description]\n @security.save\n # respond_to do |format|\n # if @security.update_attributes(params[:security])\n # format.html { redirect_to @security, notice: 'Security was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @security.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n @sslplan = Sslplan.find(params[:id])\n\n respond_to do |format|\n if @sslplan.update_attributes(params[:sslplan])\n format.html { redirect_to @sslplan, :notice => 'Sslplan was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @sslplan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @otp.update(otp_params)\n format.html { redirect_to @otp, notice: 'Otp was successfully updated.' }\n format.json { render :show, status: :ok, location: @otp }\n else\n format.html { render :edit }\n format.json { render json: @otp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ink_varnish = InkVarnish.find(params[:id])\n\n respond_to do |format|\n if @ink_varnish.update_attributes(params[:ink_varnish])\n format.html { redirect_to @ink_varnish, notice: 'Ink varnish was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ink_varnish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sessao.update(sessao_params)\n format.html { redirect_to @sessao, notice: \"Sessao was successfully updated.\" }\n format.json { render :show, status: :ok, location: @sessao }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @sessao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @owner_email = args[:owner_email] if args.key?(:owner_email)\n @recording_session_id = args[:recording_session_id] if args.key?(:recording_session_id)\n @session_state_info = args[:session_state_info] if args.key?(:session_state_info)\n end",
"def update\n @session_info = SessionInfo.first\n\n respond_to do |format|\n if @session_info.update_attributes(params[:session_info])\n format.html { redirect_to session_information_path, notice: 'Session Info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @programme_session.update(programme_session_params)\n format.html { redirect_to @programme_session, notice: 'Programme session was successfully updated.' }\n format.json { render :show, status: :ok, location: @programme_session }\n else\n format.html { render :edit }\n format.json { render json: @programme_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @discovery_session = DiscoverySession.find(params[:id])\n\n respond_to do |format|\n if @discovery_session.update_attributes(params[:discovery_session])\n format.html { redirect_to @discovery_session, notice: 'Discovery session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discovery_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tsp = Tsp.find(params[:id])\n if current_user.role.id == 7\n params[:tsp][:status] = 6\n end\n respond_to do |format|\n if @tsp.update_attributes(params[:tsp])\n format.html { redirect_to@tsp, notice: 'Tsp was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json:@tsp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @otg_ident.update(otg_ident_params)\n format.html { redirect_to @otg_ident, notice: 'Otg ident was successfully updated.' }\n format.json { render :show, status: :ok, location: @otg_ident }\n else\n format.html { render :edit }\n format.json { render json: @otg_ident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sessi = session[:logged]\t\n\tif ( @sessi == true )\n respond_to do |format|\n if @consulting_room.update(consulting_room_params)\n format.html { redirect_to @consulting_room, notice: 'Consulting room was successfully updated.' }\n format.json { render :show, status: :ok, location: @consulting_room }\n else\n format.html { render :edit }\n format.json { render json: @consulting_room.errors, status: :unprocessable_entity }\n end\n end\n\telse \t\n\tredirect_to \"/login\"\t\n\tend\n end",
"def update\n @workoutsession = Workoutsession.find(params[:id])\n\n respond_to do |format|\n wt = params[:workoutsession].delete(:workout_type)\n if @workoutsession.update_attributes(params[:workoutsession])\n @workoutsession.workout_type_id = wt\n @workoutsession.save\n format.html { redirect_to(@workoutsession, :notice => 'Workoutsession was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @workoutsession.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit_vm(vmname, memory, memorylimit, cpucount, cpucountlimit)\r\n current = {:errormsg => \"\", :status => \"\", :time => \"\", :vmstatus => \"\"}\r\n\t\t\t\t\t\t \r\n conn_opts=get_cli_connection\r\n Chef::Log.debug(\"#{conn_opts[:host]}...edit vm name=#{vmname},#{memory},#{memorylimit},#{cpucount},#{cpucountlimit}\")\r\n Net::SSH.start( conn_opts[:host], conn_opts[:user], :password => conn_opts[:password], :port => conn_opts[:port] ) do|ssh|\r\n output = ssh.exec!(\"edit vm name=#{vmname} memory=#{memory} memorylimit=#{memorylimit} cpucount=#{cpucount} cpucountlimit=#{cpucountlimit}\")\r\n output.each_line do |line|\r\n if line.match(/Status:/)\r\n current[:status]=line.split[1].strip\r\n elsif line.match(/Time:/)\r\n line[\"Time: \"]=\"\"\r\n current[:time]=line.strip\r\n elsif line.match(/Error Msg:/)\r\n line[\"Error Msg: \"]=\"\"\r\n current[:errormsg]=line.strip\r\n end\r\n end\r\n end\r\n return current\r\n end",
"def update\n respond_to do |format|\n if @terminal.update(terminal_params)\n format.html { redirect_to @terminal, notice: 'Terminal was successfully updated.' }\n format.json { render :show, status: :ok, location: @terminal }\n else\n format.html { render :edit }\n format.json { render json: @terminal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find_by_id(params[:id])\n\n if @session.nil?\n render json: {message: \"404 Not Found\"}, status: :not_found\n else\n @session.update(session_params)\n end\n end",
"def change_vncpass(vid, new_password)\n perform_request(:action => 'vserver-vncpass', :vserverid => vid, :vncpassword => new_password)\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 edit\n @user = User.find(session[:user_id])\n end",
"def update\n session[:id_cidade] = user_params[:city_id]\n user_params[:password_confirmation] = user_params[:password]\n super\n end"
] | [
"0.60819167",
"0.59483075",
"0.5897877",
"0.58323157",
"0.58171827",
"0.5757632",
"0.5704464",
"0.56998515",
"0.56495434",
"0.56353724",
"0.5609072",
"0.55920726",
"0.5590826",
"0.558789",
"0.5574672",
"0.55618584",
"0.55611956",
"0.54988873",
"0.5496382",
"0.5487196",
"0.5483811",
"0.5473831",
"0.54584646",
"0.5458186",
"0.54450184",
"0.54255456",
"0.5425485",
"0.5425391",
"0.5415208",
"0.54148394",
"0.5413571",
"0.53992593",
"0.5397337",
"0.5395485",
"0.5395117",
"0.53940976",
"0.53822243",
"0.53787005",
"0.5357242",
"0.5338565",
"0.53309554",
"0.53309554",
"0.5329635",
"0.53264433",
"0.53097165",
"0.5295592",
"0.5293799",
"0.52908707",
"0.52904296",
"0.5253177",
"0.5249787",
"0.5249787",
"0.5249787",
"0.5249787",
"0.5243433",
"0.5242343",
"0.52411336",
"0.52188355",
"0.5218617",
"0.52172756",
"0.5214642",
"0.5208734",
"0.5207852",
"0.52074885",
"0.51950675",
"0.51929176",
"0.51852614",
"0.5178209",
"0.5174535",
"0.51742333",
"0.5149853",
"0.514731",
"0.5143961",
"0.5141814",
"0.51263064",
"0.51239574",
"0.5117843",
"0.51141423",
"0.51110893",
"0.51092094",
"0.51034075",
"0.5100726",
"0.50996256",
"0.50982153",
"0.5096475",
"0.50955373",
"0.50947183",
"0.5091086",
"0.5090928",
"0.50835633",
"0.5076138",
"0.50710076",
"0.50657594",
"0.50620186",
"0.50610137",
"0.5055591",
"0.5046938",
"0.5045745",
"0.5044649",
"0.5044541"
] | 0.63248646 | 0 |
output if the boolean is true, return half the given integers if false, return 0 E puts calculate_bonus(2800, true) == 1400 puts calculate_bonus(1000, false) == 0 puts calculate_bonus(50000, true) == 25000 D: coded structure A: use ternary operator to halve integer if true, or return 0 if not C: | def calculate_bonus(num, boolean)
boolean == true ? num / 2 : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_bonus(integer, bool)\n if bool\n integer / 2\n else\n 0\n end\nend",
"def calculate_bonus(int, boolean)\n boolean ? int / 2 : 0\nend",
"def calculate_bonus(integer, boolean)\n boolean == true ? integer / 2 : 0\nend",
"def calculate_bonus(integer, boolean)\n if boolean == true\n integer / 2\n elsif boolean == false\n 0\n end\nend",
"def calculate_bonus(number, boolean)\n boolean ? number / 2 : 0\nend",
"def calculate_bonus(integer, boolean)\n boolean ? ((50 * integer)/100) : 0\nend",
"def calculate_bonus(num, boolean_value)\n if boolean_value == true\n num / 2\n else \n 0\n end\nend",
"def calculate_bonus(integer, boolean)\n boolean ? integer / 2.0 : 0\nend",
"def calculate_bonus(num, boolean)\n if boolean\n num / 2\n else\n num * 0\n end\nend",
"def calculate_bonus(num, boolean)\n boolean ? num / 2 : 0\nend",
"def calculate_bonus(salary, bonus)\n if bonus == true\n salary / 2\n elsif bonus == false\n 0\n end\nend",
"def calculate_bonus(salary, boolean)\n return salary / 2 if boolean == true \n return 0 if boolean == false\nend",
"def calculate_bonus(salary,boolean)\n \n if boolean == true\n return (salary / 2) \n else\n return 0\n end\n \nend",
"def calculate_bonus(salary, bonus)\n if bonus == true\n salary / 2\n else\n 0\n end\nend",
"def calculate_bonus(salary, bool)\n bool ? (salary / 2) : 0\nend",
"def calculate_bonus(integer,boolean)\n boolean == true ? integer * 0.5 : 0\nend",
"def calculate_bonus(salary, bonus)\n if bonus == true\n salary / 2\n else\n 0\n end\nend",
"def calculate_bonus(salary, boolean)\n boolean ? (salary/2.0) : 0\nend",
"def calculate_bonus(salary, boolean)\n boolean ? (salary.to_f / 2) : 0\nend",
"def bonus integer, boolean\n boolean == true ? (integer / 2.0) : 0\nend",
"def calculate_bonus(salary, bonus)\n bonus_amount = 0\n if bonus == true\n bonus_amount = salary / 2\n else\n bonus_amount\n end\nend",
"def calculate_bonus(amount, bonus)\n bonus ? amount / 2 : 0\nend",
"def calculate_bonus(salary, bonus)\n bonus == true ? salary * 0.5 : 0\nend",
"def bonus(i, boolean=false)\n return 0 unless boolean\n i / 2\nend",
"def bonus(salary, boolean)\n case boolean\n when true then bonus = salary / 2\n else bonus = 0\n end\n bonus\nend",
"def calculate_bonus(int, bonus)\n if bonus\n p int / 2\n else\n p 0\n end\nend",
"def calculate_bonus(salary, bonus)\n bonus ? (salary / 2) : 0 \nend",
"def calculate_bonus(salary, gets_bonus = true)\n gets_bonus ? add_commas_to_integer(salary / 2) : 0\nend",
"def calculate_bonus(salary, bonus)\n bonus ? (salary / 2) : 0\nend",
"def calculate_bonus(salary, bonus)\n bonus ? (salary / 2) : 0\nend",
"def calculate_bonus(salary, bonus)\n bonus ? (salary / 2) : 0\nend",
"def calculate_bonus(salary, bonus)\n bonus ? (salary / 2) : 0\nend",
"def calculate_bonus(salary, bonus)\n bonus ? (salary / 2) : 0\nend",
"def calculate_bonus(salary, bonus = true)\n if bonus == true\n bonus_amount = salary / 2\n else\n bonus_amount = 0\n end\n bonus_amount\nend",
"def calculate_bonus(salary, gets_bonus) \n bonus = 0\n bonus = salary / 2 if gets_bonus\n bonus\nend",
"def calculate_bonus(salary, bonus_bol)\n bonus_bol ? salary / 2 : 0\nend",
"def calculate_bonus(salary, bonus)\n bonus ? salary / 2 : 0\nend",
"def calculate_bonus(salary, bonus)\n bonus ? salary / 2 : 0\nend",
"def calculate_bonus(salary, bonus)\n bonus ? salary / 2 : 0\nend",
"def calculate_bonus(salary, bonus)\n bonus ? salary / 2.0 : 0\nend",
"def calculate_bonus(salary, give_bonus)\n return 0 unless give_bonus\n\n salary / 2\nend",
"def calculate_bonus(num,pay)\n if pay; return num /2 else return 0 end\nend",
"def calculate_bonus(salary, bonus)\n \n return salary / 2 if bonus\n 0\nend",
"def calculate_bonus(salary, eligible)\n bonus = if eligible\n salary / 2\n else\n 0\n end\nend",
"def calculate_bonus(salary, bonus)\n bonus ? (salary.to_f / 2).round(2) : 0\nend",
"def calculate_bonus(salary, t_or_f)\n t_or_f ? salary / 2 : 0\nend",
"def add_bonus(score, inspect_value, bonus_value = 5)\n if score > 0 && inspect_value == '1'\n return (bonus_value)\n end\n return 0\nend",
"def gross_salary(salary, bonus)\n bonus == true ? (salary += (salary*0.5)).to_i : salary.to_i\nend",
"def method(salary, eligible)\n eligible ? salary / 2 : 0\nend",
"def bonus_time(salary, bonus)\n salary = (salary*10).to_i if bonus == true\n \"$#{salary}\"\nend",
"def bonus_time(salary, bonus)\n bonus == true ? \"$#{salary *= 10}\" : \"$#{salary}\"\nend",
"def bonus_time(salary, bonus)\n format(\"$%d\", bonus ? salary * 10 : salary)\nend",
"def defense_bonus(lv)\n (80 * 3 * lv.to_f / 2 + 250) / 100 + 5\n end",
"def calculate(t, fraud, type)\r\n#\t\tpp \"1\"\r\n\t\treturn 0.0 if type == 'billable' && self.bid_fee #if this fee is a bid fee and we are not looking at the bid fees then return 0, else continue on\r\n\t#\tpp \"2\"\r\n \t\r\n \tfee = self.fixed if self.price_type == 'F'\r\n \r\n fee = (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min).at_most(self.max) if self.price_type == 'V' #calculate the fee\r\n \r\n return fee if self.sign == '>=' && self.threshold == 0 #if there is no threshold to worry about get out quick...this is what happens the majority of the time\r\n\t\r\n\t\t#if we get here we know we are dealing with a variable fee\r\n\t\t#puts (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min)\r\n\t#\tfee = (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min).at_most(self.max) #calculate the fee\r\n\t#\tpp fee\r\n\t#\tpp \"3\"\r\n\t#\treturn fee if self.sign == '>=' && self.threshold == 0 #if there is no threshold to worry about get out quick...this is what happens the majority of the time\r\n\t\t\r\n\t\t#otherwise we need to determine the sign and threshold before we can return\r\n\t\tcase self.sign\r\n\t\t\twhen '>'\r\n\t\t\t #pp \">\"\r\n\t\t\t\treturn fee if t.amount > self.threshold\r\n\t\t\twhen '>='\r\n\t\t\t #pp \">=\"\r\n\t\t\t\treturn fee if t.amount >= self.threshold\r\n\t\t\twhen '<'\r\n\t\t\t #pp \"<\"\r\n\t\t\t\treturn fee if t.amount < self.threshold\r\n\t\t\twhen '<='\r\n\t\t\t #pp \"<=\"\r\n\t\t\t\treturn fee if t.amount <= self.threshold\r\n\t\t\telse\r\n\t\t\t #pp \"4\"\r\n\t\t\t\treturn 0.0\r\n\t\tend\r\n\t\t\r\n\t\t#if we get here then we have no idea what to do so just return 0\r\n\t\treturn 0.0\r\n\tend",
"def provide_mortgage_2?(salary, deposit, property_value) \n loan_amount = property_value - deposit\n min_deposit = property_value >= 650_000 ? 0.2 : 0.05 # ternary operator: expr ? value_if_true : value_if_false\n max_multiplier = 5 # how many annual incomes can be borrowed\n deposit >= property_value * min_deposit && salary * max_multiplier >= loan_amount\nend",
"def healthy? (tablespoons_of_butter, butter_calories = 102)\n (tablespoons_of_butter * butter_calories) < 75\nend",
"def fow_bonus(unit)\n return 0\n end",
"def provide_mortgage_4?(salary, deposit, property_value, bankrupt)\n loan_amount = property_value - deposit\n property_value >= 650000 ? min_deposit = 0.2 : min_deposit = 0.05 # 20%\n max_multiplier = 5 # how many annual incomes can be borrowed\n !bankrupt && deposit >= property_value * min_deposit && \n (salary * max_multiplier >= loan_amount || deposit >= property_value * 0.75)\nend",
"def bonus_time(salary, bonus)\n bonus ? \"$#{(salary*10).to_s}\" : \"$#{salary.to_s}\"\nend",
"def is_discounted?\n discounted = false\n discounted = true if price.to_i < 10\n discounted\n end",
"def discounted?\n if price.to_f < 1000\n # return true\n # else\n # return false\n # end\n end\n end",
"def natural_bonus\n 0\n end",
"def bonus?\n kind == 'bonus'\n end",
"def serve_drink(age, onBreak)\n if ((age >= 18) && (onBreak == false))\n return true\n else\n return false\n end\nend",
"def extra_cash(db, user_name)\r\n\t# determine extra monies (conditional on + amount)\r\n\tdifference = (current_income(db, user_name) - current_expenses(db, user_name))\r\n\tcache_bonus = difference if difference > 0 || 0\r\nend",
"def provide_mortgage_4?(salary, deposit, property_value, bankrupt)\n return false if bankrupt\n loan_amount = property_value - deposit\n min_deposit = property_value >= 650_000 ? 0.2 : 0.05\n max_multiplier = 5 # how many annual income can be borrowed\n deposit >= property_value * min_deposit && (salary * max_multiplier >= loan_amount || deposit >= property_value * 0.75)\nend",
"def is_discounted?\n price.to_f <= 2\n end",
"def attack_bonus(lv)\n (110 * 3 * lv.to_f + 250) / 100 + 5\n end",
"def paid?(amt)\n # Predicate methods should always return\n # true or false.\n amt.to_i > 0\nend",
"def discount100(bill)\n\t\tif bill>100\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def is_discounted? #? means will return t/f \n price < 200\nend",
"def assess_situation(danger_level, bad_excuse, save_the_day)\n if danger_level >=50\n puts bad_excuse\n elsif danger_level >=10 && danger_level <50\n puts save_the_day\n else\n puts \"Meh. Hard pass.\"\n end\nend",
"def busted?(total)\n total > GAME_HIGH\nend",
"def calc_bottles(spend_amt)\n spend_amt.to_i/2\nend",
"def can_afford_insurance\n return 1 if (@bet / 2) <= @bankroll\n return nil\n end",
"def multiple_of_100?(int)\n return int % 100 == 0 ? true : false\nend",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n if danger_level > 50\n p bad_excuse\n elsif danger_level > 10 && danger_level < 50\n p save_the_day\n else\n p \"Meh. Hard pass.\"\n end\nend",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n if danger_level >= 50\n puts bad_excuse\n elsif danger_level >= 10 && danger_level < 50\n puts save_the_day\n else\n puts \"Meh. Hard pass.\"\n end\nend",
"def award_bonus(winner,loser,dealer)\n if @scores.include?(winner)\n @scores[winner] += @bonus*Scoring::P_BONUS\n share_count = loser.length\n if share_count>1 then share_count += (@mode==3 ? 1 : 0) end\n bonus_paym = (@bonus*Scoring::P_BONUS)/share_count\n loser.each do |l|\n if @scores.include?(l)\n @scores[l] -= bonus_paym\n else\n printf \"Error: \\\"%s\\\" not in current list of players\\n\", l\n end\n end\n @bonus = 0 if not dealer\n @scores[winner] += @riichi*Scoring::P_RIICHI\n @riichi = 0\n return true\n else\n printf \"Error: \\\"%s\\\" not in current list of players\\n\", winner\n return false\n end\n end",
"def is_discounted\n price.to_i < 10\n end",
"def grade(num_books, has_read_books)\n# turn boolean value into numbers i can manipulate later\n if has_read_books == true\n has_read_books = 1\n else\n has_read_books = 0\n end\n#do the same for the grade boundaries\ncase\nwhen num_books > 21\n num_books = 3\nwhen num_books === 10..20\n num_books = 2\nwhen num_books <= 9\n num_books = 1\nend\n#add them all together and evaluate\ncase\nwhen num_books + has_read_books <= 1\n return \"D\"\nwhen num_books + has_read_books == 2\n return \"C\"\nwhen num_books + has_read_books == 3\n return \"B\"\n else\n return \"A\"\n end\nend",
"def fizz_buzz_or_both(number)\n a1 = divisible_by_3(number)\n a2 = divisible_by_5(number)\n if a1 == true and a2 == true\n b1 = \"fizzbuzz\"\n\n elsif a1 == true and a2 == false\n b1 = \"fizz\"\n\n elsif a1 == false and a2 == true\n b1 = \"buzz\"\n\n end\n return b1\nend",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n if danger_level > 50\n p \"#{bad_excuse}\"\n elsif danger_level < 50 && danger_level < 10\n p \"#{save_the_day}\"\n elsif danger_level < 10\n p \"Meh. Hard Pass.\"\n end\nend",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n\n if danger_level > 50\n puts bad_excuse\n elsif danger_level > 10 && danger_level < 50\n puts save_the_day\n else\n puts \"Meh. Hard pass.\"\n end\nend",
"def probability (user_age, year_born, garlic_bread, insurance)\n if user_age <= 120 && year_born >= 1897 && garlic_bread == \"yes\" && insurance == \"yes\"\n p \"Probably not a vampire.\"\n elsif user_age >= 120 && year_born <= 1897 && (garlic_bread == \"no\" || insurance == \"no\")\n p \"Probably a vampire\"\n elsif user_age >= 120 && year_born <= 1897 && garlic_bread == \"no\" && insurance == \"no\"\n p \"Almost certainly a vampire\"\n else\n p \"Results inconclusive\"\n end\nend",
"def provide_mortgage_3?(salary, deposit, property_value)\n loan_amount = property_value - deposit\n property_value >= 650000 ? min_deposit = 0.2 : min_deposit = 0.05 # 20%\n max_multiplier = 5 # how many annual incomes can be borrowed\n deposit >= property_value * min_deposit && \n (salary * max_multiplier >= loan_amount || deposit >= property_value * 0.75)\nend",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n if danger_level > 50\n puts bad_excuse\n elsif danger_level > 10 && danger_level <= 50\n puts save_the_day\n else\n puts \"Meh. Hard pass.\"\n end\nend",
"def total_available_amount(bonus_type:)\n if bonus_type.eql?('betting')\n withdrawable_amount + betting_bonus\n elsif bonus_type.eql?('casino')\n withdrawable_amount + casino_bonus\n else\n available_amount\n end\n end",
"def bonus_throw?\n return false unless roll_one_val && roll_two_val\n frame_number == 10 && \n roll_one_val + roll_two_val == 10\n end",
"def shield_bonus\n 0\n end",
"def aprobado?(nota1, nota2)\n promedio = (nota1 + nota2)/2\n promedio >= 5? true : false #IF ternario\nend",
"def provide_mortgage_2?(salary, deposit, property_value)\n loan_amount = property_value - deposit\n property_value >= 650000 ? min_deposit = 0.2 : min_deposit = 0.05 # 20%\n max_multiplier = 5 # how many annual incomes can be borrowed\n deposit >= property_value * min_deposit && \n salary * max_multiplier >= loan_amount\nend",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n if danger_level >= 50\n puts bad_excuse\n elsif danger_level >= 10 && danger_level <= 50\n puts save_the_day\n elsif danger_level <= 10\n puts \"Meh. Hard pass.\"\n end\nend",
"def test_if_qualify(current_salary, monthly_payment)\n\tmonthly_salary = current_salary / 12\n\ttimes_greater = monthly_salary / monthly_payment\n\tif times_greater >= 2 \n\t\tanswer = true \n\telse\n\t\tanswer = false \n\tend\n\treturn answer\nend",
"def binary(num)\n if num < 0\n positiveNumBinary = calculate_binary(num.abs, 'negative')\n else\n return calculate_binary(num, 'positive')\n end\n\nend",
"def value\n return @value if @value\n\n return @value = 900 if royal_flush?\n return @value = 800 + high_card_bonus if straight_flush?\n return @value = 700 + high_card_bonus if four_of_a_kind?\n return @value = 600 + high_card_bonus if full_house?\n return @value = 500 + high_card_bonus if flush?\n return @value = 400 + high_card_bonus if straight?\n return @value = 300 + high_card_bonus if three_of_a_kind?\n return @value = 200 + high_card_bonus if two_pairs?\n return @value = 100 + high_card_bonus if pair?\n @value = self.cards.map {|card| card.value}.inject(:+)\n end",
"def assess_situation(danger_level, save_the_day, bad_excuse)\n if danger_level > 50\n puts bad_excuse\n elsif danger_level >= 10 && danger_level <=50\n puts save_the_day\n elsif danger_level <10\n puts 'Meh. Hard pass.'\n end\nend",
"def serve_drink(age, onBreak)\n if onBreak == false \n if age >= 18\n return true\n end\n else\n if age >= 18\n return false\n end\n end\n\n if age < 18\n return false\n end\nend",
"def suitable_halfs\n required_amount\n end",
"def hold_bonus\n game_type == 'zones' ? config.bonus || 0 : nil\n end"
] | [
"0.8662063",
"0.85986024",
"0.8564059",
"0.8531671",
"0.851488",
"0.8503154",
"0.8502087",
"0.85006475",
"0.8484156",
"0.8437396",
"0.83231544",
"0.82608944",
"0.8222967",
"0.8192086",
"0.8183173",
"0.81785685",
"0.817468",
"0.81733966",
"0.81329834",
"0.81027395",
"0.8067501",
"0.80231196",
"0.80097854",
"0.7876082",
"0.7803463",
"0.77907896",
"0.7759178",
"0.7741897",
"0.77296895",
"0.77296895",
"0.77296895",
"0.77296895",
"0.77296895",
"0.7717123",
"0.7689151",
"0.76549286",
"0.764123",
"0.764123",
"0.764123",
"0.76045245",
"0.75049615",
"0.7471693",
"0.745943",
"0.7399667",
"0.7303899",
"0.7244589",
"0.671415",
"0.6596259",
"0.6455691",
"0.6419278",
"0.628208",
"0.61834764",
"0.6106245",
"0.60949004",
"0.60720074",
"0.603234",
"0.5952984",
"0.591572",
"0.59008586",
"0.58167946",
"0.5793168",
"0.5791671",
"0.5791614",
"0.5790869",
"0.5755681",
"0.57499796",
"0.57281345",
"0.57189006",
"0.57181865",
"0.57173014",
"0.5715633",
"0.57131785",
"0.5704535",
"0.5697854",
"0.5682067",
"0.56786865",
"0.5676425",
"0.5653398",
"0.5652745",
"0.5651956",
"0.56367433",
"0.56362104",
"0.5628676",
"0.5626306",
"0.56211495",
"0.5608025",
"0.5606928",
"0.56035537",
"0.5601729",
"0.559761",
"0.5582743",
"0.55813533",
"0.557442",
"0.5571352",
"0.5570029",
"0.5562269",
"0.555874",
"0.55550253",
"0.55537295",
"0.5546855"
] | 0.8451289 | 9 |
GET /mbrackets GET /mbrackets.json | def index
@mbrackets = Mbracket.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cnmrbrackets = Cnmrbracket.all\n end",
"def list_assets\n get('/video/v1/assets')\n end",
"def index\n @abuckets = @account.abuckets\n @help = \"Bucket List\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @abuckets }\n end\n end",
"def manifest\n @manifest ||= Sprockets::Manifest.new(sprockets, File.join(public_folder, prefix))\n end",
"def index\n @bucketlist_item = BucketlistItem.all\n # @bucketlist_item = @trip.bucketlist_item\n render json: @bucketlist_item\n end",
"def index\n @resources = []\n\t\tDir.glob(\"#{params[:path]}/*\").each do |f|\n\t\tunless File.directory?(f)\n\t\t\[email protected](File.basename(f))\n\t\tend\n\tend\n\n\trender json: @resources\n end",
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def destroy\n @cnmrbracket.destroy\n respond_to do |format|\n format.html { redirect_to cnmrbrackets_url, notice: 'Cnmrbracket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @blocks = Block.all\n\n render json: @blocks\n end",
"def index\n @videos = Video.all\n render json: @videos\n end",
"def index\n @api_javascripts = Api::Javascript.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_javascripts }\n end\n end",
"def find_asset_json\n res = Asset.find(@params['id'])\n render :string => res.to_json, :content_type => \"application/json\", :layout => false\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend",
"def list_my_buckets(s3)\n resp = s3.list_buckets\n puts \"My buckets now are:\\n\\n\"\n\n resp.buckets.each do |bucket|\n puts bucket.name\n end\n\nend",
"def list_my_buckets(s3)\n resp = s3.list_buckets()\n puts \"My buckets now are:\\n\\n\"\n\n resp.buckets.each do |bucket|\n puts bucket.name\n end\n\nend",
"def index\n @file_versions = FileVersion.all\n\n render json: @file_versions\n end",
"def scrape_bracket url\n bracket_json = Hash.new\n @agent.get(url) do |bracket_page|\n script_data = bracket_page.search('script').to_s\n bracket_script = script_data.split('bootstrapBracketsData = ')[1]\n bracket_info = bracket_script.split('opm_transfer')[0][0..-4].concat(\"}}\")\n bracket_json = JSON.parse(bracket_info)\n end\n bracket_json \n end",
"def index\n @videoconferencias = Videoconferencium.all\n render json: @videoconferencias\n end",
"def assets\n []\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def show\n begin\n render template: 'assets/show', status: :ok\n rescue Exception => e\n render json: {:message=> e.to_s}.to_json, status: :not_found\n end\n end",
"def index\n @subthemes = Subtheme.all\n\n render json: @subthemes\n end",
"def index\n @bemaps = Bemap.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bemaps }\n end\n end",
"def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end",
"def sprockets\n if @sprockets.nil?\n @sprockets = Sprockets::Environment.new { |env| env.logger = Logger.new($stdout) }\n asset_paths.each {|path| @sprockets.append_path(path)}\n end\n return @sprockets\n end",
"def manifests\n api.get('manifests')\n end",
"def swf_bucket\n return Brevidy::Application::S3_BUCKET\n end",
"def assets_manifest; end",
"def assets_manifest; end",
"def index\n @global_assets = GlobalAsset.paginate(:page => params[:page], :per_page => GlobalSettings.per_page).order('id DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: GlobalAsset.select(\"id, data_file_name as text\").where(\"assetable_id is NULL\").to_json }\n end\n end",
"def list_s3_buckets()\n\n s3 = connect_to_s3()\n response = s3.list_buckets\n\n response.buckets.each do |bucket|\n puts \"#{bucket.creation_date} #{bucket.name}\"\n end\n\nend",
"def index\n @cdn_configs = CdnConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cdn_configs }\n end\n end",
"def list_buckets\n puts '> AWS Buckets'.yellow\n response = s3_client.list_buckets\n buckets = response.buckets.map do |bucket|\n \"#{bucket.name.yellow} - created: #{bucket.creation_date.to_s.greenish}\"\n end\n buckets.each do |bucket|\n puts bucket\n end\n end",
"def index\n @cargo_manifests = CargoManifest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cargo_manifests }\n end\n end",
"def show\n @global_asset = GlobalAsset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @global_asset }\n end\n end",
"def index\n @themes = Theme.all\n json_response(@themes)\n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def assets\n\n javascript={}\n css={}\n\n Dir.glob(bower_asset_path+'/production/*.html').each { |path|\n next if files_omit.include?(File.basename(path))\n page = Nokogiri::HTML(open(path))\n javascript[path]=[]\n css[path]=[]\n page.css('script').each { |st|\n javascript[path] << st.attr('src').sub('../vendors/', '') if st.attr('src') && st.attr('src').start_with?('../')\n }\n page.css('link').each { |st|\n css[path] << st.attr('href').sub('../vendors/', '') if st.attr('rel') && st.attr('rel') == 'stylesheet'\n }\n }\n\n# Merge the lists of script and css references using array union\n javascript_src=[]\n javascript.values.map { |s| javascript_src = javascript_src | s }\n javascript_src.uniq!\n\n# Omit the references that we won't include in the gem\n javascript_omit.each { |s| javascript_src.delete(s) }\n\n css_src=[]\n css.values.map { |s| css_src = css_src | s }\n css_src.uniq!\n\n css_omit.each { |s| css_src.delete(s) }\n\n {\n javascript: javascript_src,\n css: css_src,\n }\n\nend",
"def index\n @bookmarks = Bookmark.all\n render json: { bookmarks: @bookmarks }, status: :ok\n end",
"def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end",
"def show\n repo = assets_repo\n @v_asset = repo.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_asset }\n end\n end",
"def default_bucket\n request(method: :get, path: '/v1/buckets')\n end",
"def show\n @kb = Kb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @kb }\n end\n end",
"def json_index_static_contents\n\n @static_contents = StaticContent.all\n respond_to do |format|\n\n format.json { render json: @static_contents }\n end\n end",
"def index\n @brackets = Bracket.paginate(page: params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brackets }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset }\n end\n end",
"def show\n @asset_host = DayzGps::Application.config.action_controller.asset_host ||\n \"http://localhost:#{request.port.inspect}\"\n respond_to do |format|\n format.html\n format.json { render json: @group_map.map_markers }\n end\n end",
"def destroy\n @mbracket.destroy\n respond_to do |format|\n format.html { redirect_to mbrackets_url, notice: 'Mbracket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def get(path) # code generated from moviedb website\n url = URI(\"#{HOST_URL}#{path}#{ENV['API_KEY']}\")\n response = Net::HTTP.get_response(url)\n begin\n response_hash = JSON.parse(response.read_body)\n return response_hash\n rescue\n {}\n end\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def index\n\t\t@assets = Asset.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.json { render json: @assets }\n\t\tend\n\tend",
"def index\r\n\t\t#not #nessisary\r\n\t\t#@s3_songs = AWS::S3::Bucket.find(BUCKET).objects\r\n\r\n\t\t#@songs = Song.all\r\n\t\t@artist = Artist.find_by_url_slug(params[:url_slug])\r\n\t\t@songs = @artist.songs\r\n\r\n\t\trespond_to do |format|\r\n\t\t\tformat.html # index.html.erb\r\n\t\t\tformat.xml { render :xml => @song }\r\n\t\t\tformat.json {\r\n\t\t\t\trender :json => {\r\n\t\t\t\t\t\t:success => true,\r\n\t\t\t\t\t\t:\"#content\" => render_to_string(\r\n\t\t\t\t\t\t\t\t:action => 'index.html.erb',\r\n\t\t\t\t\t\t\t\t:layout => false\r\n\t\t\t\t\t\t)\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\tend\r\n\tend",
"def show\n @asset = Asset.find(params[:id])\n @assets = @uploadable.assets\n respond_to do |format|\n format.html\n format.json { render json: @asset}\n end\n end",
"def index\n @cars = Car.all\n render json: @cars\n end",
"def index\n @cmms = Cmm.all\n render json: @cmms\n end",
"def show\n client = Aws::S3::Client.new(\n region: Rails.application.credentials.aws[:aws_region],\n access_key_id: Rails.application.credentials.aws[:access_key_id],\n secret_access_key: Rails.application.credentials.aws[:secret_access_key])\n @objects = client.list_objects({bucket:'awsprojectbuckett'}).contents\n end",
"def app\n render json: {app_load: true}\n #@location_path = \"/#{params[:path]}\"\n end",
"def index\n render json: Picture.all\n end",
"def show\n @rubygem = Rubygem.find(params[:id])\n\n render json: @rubygem\n end",
"def get_brandings\n request :get, \"/v3/brandings.json\"\n end",
"def index\n @cars = Car.all\n\n render json: @cars\n end",
"def index\n @web_car_galleries = WebCarGallery.all\n\n render json: @web_car_galleries\n end",
"def json_show_static_content_by_name\n\n @static_content = StaticContent.find_by_name(params[:name])\n respond_to do |format|\n format.json { render json: @static_content }\n end\n end",
"def parsed\n JSON.parse(File.read(\"#{Rails.root}/public/#{@file}\"))\n end",
"def show\n render json: @application\n end",
"def objects\n bucket_obj = Aws::S3::Bucket.new(name: bucket, client: s3_client)\n bucket_obj.objects( prefix: prefix)\n end",
"def index\n @places = Place.all\n render json: @places , status: 403\n end",
"def show\n render json: @stage\n end",
"def index_ajax\n @assets = Asset.find(:all)\n render :back => '/app'\n end",
"def list\n @sizes = Admin::Size.all\n\n render json: { sizes: @sizes }\n end",
"def assets; end",
"def assets; end",
"def assets; end",
"def index\n @contents = Content.all\n render json: @contents\n end",
"def index\n @boats = current_user.boats\n puts \" ** ENV['S3_REGION']: #{ENV['S3_REGION'].inspect}\"\n puts \" ** ENV['S3_BUCKET']: #{ENV['S3_BUCKET'].inspect}\"\n puts \" ** ENV['AWS_ACCESS_KEY_ID']: #{ENV['AWS_ACCESS_KEY_ID'].inspect}\"\n puts \" ** ENV['AWS_SECRET_ACCESS_KEY']: #{ENV['AWS_SECRET_ACCESS_KEY'].inspect}\"\n end",
"def index\n @kbs = Kb.search(params[:q]).page(params[:page]).order(\"id desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kbs }\n end\n end",
"def scrape_bracket url\n @agent.get(url) do |bracket_page|\n return JSON.parse(bracket_page.search('script').to_s.split('bootstrapBracketsData = ')[1].split('opm_transfer')[0][0..-4].concat(\"}}\"))\n end \n end",
"def sprockets_path\n File.expand_path('../', Mutton.template_path)\n end",
"def list_buckets\n s3 = Aws::S3::Client.new(\n region: 'us-east-1'\n )\n resp = s3.list_buckets({})\n # get the total number of buckets\n num_buckets = resp.buckets.length\n # loop through and puts name\n num_buckets.times do |i|\n puts resp.buckets[i].name.colorize(:light_magenta).colorize(:background => :black)\n end\nend",
"def show\n @bloom = Bloom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bloom }\n end\n end",
"def get_bucket_info\n bucket = \"#{ENV['S3_BUCKET_PREFIX']}#{ENV['S3_BUCKET_SEPARATOR']}#{ENV['SERVER_NAME']}\"\n output = (`#{ENV['S3CMD_PATH']} du s3://#{bucket}`).split(' ')\n return [output[0], output[1]]\nend",
"def sprockets_js_erb_cache_bust\n do_sprockets_cache_bust(:time_stamp)\n end",
"def get_bucket(bucket_name, options={})\n resp = get(bucket_name, '/', options)\n resp_obj = Crack::XML.parse(resp.body)\n if resp.code == \"200\"\n resp_obj[:success] = true\n resp_obj[:bucket_name] = bucket_name\n resp_obj[:message] = \"Bucket retrieved successfully\"\n contents = resp_obj[\"ListBucketResult\"][\"Contents\"] ? Array.new : nil\n resp_obj[\"ListBucketResult\"][\"Contents\"].is_a?(Array) ? \\\n (contents = resp_obj[\"ListBucketResult\"][\"Contents\"]) : \\\n (contents[0] = resp_obj[\"ListBucketResult\"][\"Contents\"]) unless contents.nil?\n resp_obj[:contents] = contents\n resp_obj[:raw] = Crack::XML.parse(resp.body)\n resp_obj.each_key {|key| resp_obj.delete(key) unless [:success, :bucket_name, :message, :contents, :raw].include?(key) }\n\n else\n resp_obj[:success] = false\n resp_obj[:bucket_name] = bucket_name\n resp_obj[:message] = resp_obj[\"Error\"][\"Message\"]\n resp_obj[:contents] = nil\n resp_obj[:code] = resp_obj[\"Error\"][\"Code\"]\n resp_obj[:raw] = Crack::XML.parse(resp.body)\n resp_obj.each_key {|key| resp_obj.delete(key) unless [:success, :bucket_name, :message, :contents, :code, :raw].include?(key) }\n\n end\n return resp_obj\n end",
"def assets\n {\n css: css_assets,\n js: js_assets,\n image: image_assets\n }\n end",
"def resources\n videos\n end",
"def index\n @clubs = Club.all\n render json: @clubs\n end",
"def index\n @baz3s = Baz3.all\n end",
"def show\n @boot = Boot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boot }\n end\n end",
"def index\n @stars = Star.all\n render :json => @stars\n end",
"def index\n @registro_videoconferencia = RegistroVideoconferencium.all\n render json: @registro_videoconferencia\n end",
"def json_at(url)\n JSON.parse(open(url).read, symbolize_names: true)[:objects]\nend",
"def index\n @instances = Instance.all\n render json: @instances\n end",
"def index\n @albums = Album.all\n render json: @albums\n end",
"def index\n @projects = Project.all\n render json: @projects\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @media_scopes }\n end\n end",
"def index\n @banks = Bank.all\n render json: @banks\n end",
"def asset(asset_id)\n get \"/video/v1/assets/##{asset_id}\"\n end",
"def index\n render json: {message: \"This is my api\"}\n end",
"def sources\n respond_to do |format|\n format.html{ redirect_to root_path }\n format.json{\n list = []\n Plugins::Import.included_modules.each do |plugin|\n list << { \n :display => \"#{plugin::Meta::NAME} (#{plugin.name} #{plugin::Meta::VERSION::STRING})\",\n :value => plugin.name\n }\n end\n render :json => list\n }\n end\n end"
] | [
"0.61459535",
"0.5878671",
"0.57804185",
"0.5624205",
"0.5548744",
"0.5442309",
"0.5441612",
"0.54038733",
"0.5327505",
"0.5325637",
"0.5309805",
"0.5285535",
"0.52602696",
"0.5228278",
"0.52167517",
"0.5215463",
"0.52030003",
"0.5196619",
"0.51772296",
"0.51601577",
"0.51545143",
"0.5154422",
"0.5144376",
"0.5143153",
"0.5141273",
"0.5132796",
"0.5124108",
"0.511979",
"0.5111448",
"0.51089114",
"0.5107243",
"0.5105235",
"0.5098331",
"0.5086915",
"0.50818497",
"0.5076788",
"0.5066824",
"0.50639886",
"0.5063947",
"0.50635487",
"0.5062072",
"0.505448",
"0.5048069",
"0.5039076",
"0.5035233",
"0.50321215",
"0.50205684",
"0.50188386",
"0.5012379",
"0.501084",
"0.500956",
"0.4999284",
"0.49951538",
"0.49894324",
"0.4988107",
"0.49807185",
"0.4978632",
"0.49735135",
"0.49734533",
"0.49719602",
"0.49711153",
"0.496313",
"0.49575847",
"0.49554843",
"0.4946857",
"0.49455667",
"0.49445644",
"0.4940342",
"0.49301526",
"0.49295065",
"0.49226755",
"0.49223712",
"0.49223712",
"0.49223712",
"0.49185684",
"0.4918504",
"0.49177185",
"0.49168357",
"0.49144453",
"0.49122733",
"0.49083465",
"0.49018133",
"0.490103",
"0.4900747",
"0.48992074",
"0.48991215",
"0.48974186",
"0.48949593",
"0.4891645",
"0.48845264",
"0.48837656",
"0.48837382",
"0.48773634",
"0.48758423",
"0.48750213",
"0.4873329",
"0.48704952",
"0.48691258",
"0.48664472",
"0.48659822"
] | 0.6294522 | 0 |
GET /mbrackets/1 GET /mbrackets/1.json | def show
@team = Team.all
@rank1 = Team.rank1
@rank2 = Team.rank2
@rank3 = Team.rank3
@rank4 = Team.rank4
@rank5 = Team.rank5
@rank6 = Team.rank6
@rank7 = Team.rank7
@rank8 = Team.rank8
@rank9 = Team.rank9
@rank10 = Team.rank10
@rank11 = Team.rank11
@rank12 = Team.rank12
@rank13 = Team.rank13
@rank14 = Team.rank14
@rank15 = Team.rank15
@rank16 = Team.rank16
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @mbrackets = Mbracket.all\n end",
"def index\n @cnmrbrackets = Cnmrbracket.all\n end",
"def list_assets\n get('/video/v1/assets')\n end",
"def index\n @abuckets = @account.abuckets\n @help = \"Bucket List\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @abuckets }\n end\n end",
"def manifest\n @manifest ||= Sprockets::Manifest.new(sprockets, File.join(public_folder, prefix))\n end",
"def index\n @bucketlist_item = BucketlistItem.all\n # @bucketlist_item = @trip.bucketlist_item\n render json: @bucketlist_item\n end",
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def index\n @resources = []\n\t\tDir.glob(\"#{params[:path]}/*\").each do |f|\n\t\tunless File.directory?(f)\n\t\t\[email protected](File.basename(f))\n\t\tend\n\tend\n\n\trender json: @resources\n end",
"def index\n @file_versions = FileVersion.all\n\n render json: @file_versions\n end",
"def show\n repo = assets_repo\n @v_asset = repo.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_asset }\n end\n end",
"def show\n @global_asset = GlobalAsset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @global_asset }\n end\n end",
"def show\n @rubygem = Rubygem.find(params[:id])\n\n render json: @rubygem\n end",
"def find_asset_json\n res = Asset.find(@params['id'])\n render :string => res.to_json, :content_type => \"application/json\", :layout => false\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def index\n @blocks = Block.all\n\n render json: @blocks\n end",
"def show\n begin\n render template: 'assets/show', status: :ok\n rescue Exception => e\n render json: {:message=> e.to_s}.to_json, status: :not_found\n end\n end",
"def index\n @cargo_manifests = CargoManifest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cargo_manifests }\n end\n end",
"def load_bitbucket()\n JSON.parse(IO.read('db-1.0.json'))\nend",
"def show\n @asset = Asset.find(params[:id])\n @assets = @uploadable.assets\n respond_to do |format|\n format.html\n format.json { render json: @asset}\n end\n end",
"def index\n @videos = Video.all\n render json: @videos\n end",
"def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end",
"def destroy\n @cnmrbracket.destroy\n respond_to do |format|\n format.html { redirect_to cnmrbrackets_url, notice: 'Cnmrbracket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def json_show_static_content_by_name\n\n @static_content = StaticContent.find_by_name(params[:name])\n respond_to do |format|\n format.json { render json: @static_content }\n end\n end",
"def show\n @boot = Boot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boot }\n end\n end",
"def show\n @kb = Kb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @kb }\n end\n end",
"def index\n @subthemes = Subtheme.all\n\n render json: @subthemes\n end",
"def index\n @bemaps = Bemap.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bemaps }\n end\n end",
"def index\n @global_assets = GlobalAsset.paginate(:page => params[:page], :per_page => GlobalSettings.per_page).order('id DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: GlobalAsset.select(\"id, data_file_name as text\").where(\"assetable_id is NULL\").to_json }\n end\n end",
"def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end",
"def assets_manifest; end",
"def index\n @videoconferencias = Videoconferencium.all\n render json: @videoconferencias\n end",
"def assets_manifest; end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset }\n end\n end",
"def show\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb }\n end\n end",
"def default_bucket\n request(method: :get, path: '/v1/buckets')\n end",
"def index\n response = VersionResponse.new( BUILD_VERSION )\n render json: response, :status => 200\n end",
"def index\n @api_javascripts = Api::Javascript.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_javascripts }\n end\n end",
"def show\n @bloom = Bloom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bloom }\n end\n end",
"def json_for_version(version)\n JSON.parse(json_pathname(version).read)['content']\n end",
"def assets\n []\n end",
"def show\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @barrack }\n end\n end",
"def json_index_static_contents\n\n @static_contents = StaticContent.all\n respond_to do |format|\n\n format.json { render json: @static_contents }\n end\n end",
"def show\n @bundle = Bundle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bundle }\n end\n end",
"def show\n @bundle = Bundle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bundle }\n end\n end",
"def show\n @cargo_manifest = CargoManifest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cargo_manifest }\n end\n end",
"def version_info\n path = File.join(SERVER_ROOT, 'public', 'version_info.json')\n JSON.load File.read(path)\nend",
"def index\n @cdn_configs = CdnConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cdn_configs }\n end\n end",
"def index\n @builds = Build.all\n render json: @builds\n end",
"def show\n @ref_mkb = Ref::Mkb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ref_mkb }\n end\n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def app\n render json: {app_load: true}\n #@location_path = \"/#{params[:path]}\"\n end",
"def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def show\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bb }\n end\n end",
"def asset(asset_id)\n get \"/video/v1/assets/##{asset_id}\"\n end",
"def index\n\t\t@assets = Asset.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.json { render json: @assets }\n\t\tend\n\tend",
"def show\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset }\n end\n end",
"def show\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset }\n end\n end",
"def show\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset }\n end\n end",
"def show\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset }\n end\n end",
"def show\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset }\n end\n end",
"def index_ajax\n @assets = Asset.find(:all)\n render :back => '/app'\n end",
"def index\n render json: Picture.all\n end",
"def list_bundles\n BrickFTP::API::Bundle.all\n end",
"def list_bundles\n BrickFTP::API::Bundle.all\n end",
"def get(path) # code generated from moviedb website\n url = URI(\"#{HOST_URL}#{path}#{ENV['API_KEY']}\")\n response = Net::HTTP.get_response(url)\n begin\n response_hash = JSON.parse(response.read_body)\n return response_hash\n rescue\n {}\n end\n end",
"def index\n @lobs = Lob.all\n\n render json: @lobs\n end",
"def show\n @c_asset = CAsset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @c_asset }\n end\n end",
"def list_my_buckets(s3)\n resp = s3.list_buckets()\n puts \"My buckets now are:\\n\\n\"\n\n resp.buckets.each do |bucket|\n puts bucket.name\n end\n\nend",
"def show\n @fileversion = Fileversion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fileversion }\n end\n end",
"def show\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go_slim }\n end\n end",
"def list_my_buckets(s3)\n resp = s3.list_buckets\n puts \"My buckets now are:\\n\\n\"\n\n resp.buckets.each do |bucket|\n puts bucket.name\n end\n\nend",
"def show\n render :json => @slab_project\n end",
"def index\n @shots = Shot.all\n\n render json: @shots\n end",
"def index\n @themes = Theme.all\n json_response(@themes)\n end",
"def sprockets_js_erb_cache_bust\n do_sprockets_cache_bust(:time_stamp)\n end",
"def index\n @project=Project.find(params[:project_id])\n @scripts = @project.scripts\n self.crumb\n authorize! :show, @project\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scripts }\n end\n end",
"def json_at(url)\n JSON.parse(open(url).read, symbolize_names: true)[:objects]\nend",
"def show\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @slab }\n end\n end",
"def show\n @s3_image = S3Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @s3_image }\n end\n end",
"def resource_base_name\n 'JSON'\n end",
"def index\n @contents = Content.all\n render json: @contents\n end",
"def list\n @sizes = Admin::Size.all\n\n render json: { sizes: @sizes }\n end",
"def json_index_bundles\n\n @bundles = Bundle.where(\"active = 'y'\").order(:id)\n respond_to do |format|\n format.json { render json: @bundles.as_json()\n\n }\n end\n\n end",
"def get_json\n return JSON(@asset_repo.get_json(@pid.gsub(\"druid:\", \"\")))\n rescue => e\n return nil\n end",
"def render_version\n render json: { version: BUILD_VERSION }, status: 200\n end",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend",
"def show\n render json: @stage\n end",
"def assets_application_v1(name)\n return 'layouts/v1/controllers/' + name\n end",
"def show\n @asset_host = DayzGps::Application.config.action_controller.asset_host ||\n \"http://localhost:#{request.port.inspect}\"\n respond_to do |format|\n format.html\n format.json { render json: @group_map.map_markers }\n end\n end",
"def show\n @server = Server.find(params[:id])\n add_breadcrumb @server.name, [@server]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server.to_json(:include => { :websites => {:include => :plugins } }) }\n end\n end",
"def index\n @instances = Instance.all\n render json: @instances\n end",
"def index\n Dir[\"#{@base_path}/*.json\"].map{|p| File.basename(p)}\n end",
"def manifests\n api.get('manifests')\n end",
"def index\n\n #@bundles = Bundle.paginate(page: params[:page], :per_page => 10)\n #@bundles = Bundle.paginate(page: params[:page]).order('id')\n\n @bundles = Bundle.order('id').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bundles }\n end\n end",
"def scrape_bracket url\n bracket_json = Hash.new\n @agent.get(url) do |bracket_page|\n script_data = bracket_page.search('script').to_s\n bracket_script = script_data.split('bootstrapBracketsData = ')[1]\n bracket_info = bracket_script.split('opm_transfer')[0][0..-4].concat(\"}}\")\n bracket_json = JSON.parse(bracket_info)\n end\n bracket_json \n end",
"def parsed\n JSON.parse(File.read(\"#{Rails.root}/public/#{@file}\"))\n end",
"def index\n @cmms = Cmm.all\n render json: @cmms\n end",
"def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end",
"def assets; end",
"def assets; end"
] | [
"0.6181096",
"0.5977827",
"0.5727121",
"0.56343037",
"0.5602006",
"0.55155116",
"0.54377556",
"0.5428718",
"0.5387181",
"0.5379383",
"0.53762144",
"0.5343459",
"0.534158",
"0.53385484",
"0.5338115",
"0.5278292",
"0.52658635",
"0.52585226",
"0.52403015",
"0.5223005",
"0.5220666",
"0.5213507",
"0.52074045",
"0.52031547",
"0.519359",
"0.51915264",
"0.5190439",
"0.5180254",
"0.5172599",
"0.51688844",
"0.5168407",
"0.5166346",
"0.51634043",
"0.51507056",
"0.5132181",
"0.512808",
"0.51275194",
"0.5124205",
"0.51236707",
"0.5109207",
"0.51025087",
"0.50902516",
"0.5089663",
"0.5089663",
"0.5085307",
"0.5084429",
"0.50772834",
"0.50692934",
"0.50691956",
"0.5058499",
"0.5052992",
"0.5052321",
"0.50493914",
"0.50351983",
"0.503037",
"0.5028193",
"0.50245",
"0.50245",
"0.50245",
"0.50245",
"0.50245",
"0.5021732",
"0.5021549",
"0.50181574",
"0.50181574",
"0.5016987",
"0.5011317",
"0.49998096",
"0.49952954",
"0.49930236",
"0.4991597",
"0.49915197",
"0.49910638",
"0.49877295",
"0.49855608",
"0.49833626",
"0.49798933",
"0.49783897",
"0.49782535",
"0.49693137",
"0.4966115",
"0.4963839",
"0.49595553",
"0.49588826",
"0.49541312",
"0.49538857",
"0.49538183",
"0.49527174",
"0.49465308",
"0.49432442",
"0.49406415",
"0.494057",
"0.49397844",
"0.4939468",
"0.49375916",
"0.49355558",
"0.49350482",
"0.4933341",
"0.49261123",
"0.49251866",
"0.49251866"
] | 0.0 | -1 |
POST /mbrackets POST /mbrackets.json | def create
@mbracket = Mbracket.new(mbracket_params)
respond_to do |format|
if @mbracket.save
format.html { redirect_to @mbracket, notice: 'Mbracket was successfully created.' }
format.json { render :show, status: :created, location: @mbracket }
else
format.html { render :new }
format.json { render json: @mbracket.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @abucket = @account.abuckets.build(params[:abucket])\n respond_to do |format|\n if @abucket.save\n flash[:notice] = 'Bucket was successfully assigned.'\n format.html { redirect_to(account_abuckets_path(@account)) }\n format.xml { render :xml => @abucket, :status => :created, :location => @abucket }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @abucket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @bucket = Bucket.new(bucket_params)\n\n respond_to do |format|\n if @bucket.save\n format.html { redirect_to @bucket, notice: 'Bucket was successfully created.' }\n format.json { render :show, status: :created, location: @bucket }\n else\n format.html { render :new }\n format.json { render json: @bucket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cnmrbracket = Cnmrbracket.new(cnmrbracket_params)\n\n respond_to do |format|\n if @cnmrbracket.save\n format.html { redirect_to @cnmrbracket, notice: 'Cnmrbracket was successfully created.' }\n format.json { render :show, status: :created, location: @cnmrbracket }\n else\n format.html { render :new }\n format.json { render json: @cnmrbracket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mbracket_params\n params.require(:mbracket).permit(:name)\n end",
"def destroy\n @cnmrbracket.destroy\n respond_to do |format|\n format.html { redirect_to cnmrbrackets_url, notice: 'Cnmrbracket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @asset = Asset.new(params[:asset])\n\n if @asset.save\n respond_to do |format|\n format.html do\n render json: [@asset.to_jq_upload].to_json,\n content_type: 'text/html',\n layout: false\n end\n format.json do\n render json: [@asset.to_jq_upload].to_json\n end\n end\n else\n render json: [{ error: 'custom_failure' }], status: 304\n end\n end",
"def create\n @bucket = current_user.buckets.new(bucket_params)\n if bucket_params[:pins_attributes]\n @bucket.pins.first.user_id = current_user.id\n end\n respond_to do |format|\n if @bucket.save\n format.js\n format.html { redirect_to buckets_path, notice: \"bucket created #{@bucket.pins.count}- time to add some kicks\"}\n else\n format.json { render json: @bucket.errors, status: :unprocessable_entity }\n format.html { redirect_to buckets_path, alert: \"Unable to create Bucket. Name required\" }\n end\n end\n # end\n end",
"def create\n @video_upload = VideoUpload.new\n @video_upload.save!\n @video_upload.prepare!\n\n render json: @video_upload, status: :created, location: @video_upload\n end",
"def create\n response.headers['Content-Type'] = 'text/javascript'\n\n attributes = params.require(:board).permit(:name)\n @board = Board.create!(attributes)\n $redis.publish('boards:create', @board.to_json)\n render nothing: true\n end",
"def bucket_params\n params.require(:bucket).permit(:name)\n end",
"def destroy\n @mbracket.destroy\n respond_to do |format|\n format.html { redirect_to mbrackets_url, notice: 'Mbracket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @kb = Kb.new(params[:kb])\n\n respond_to do |format|\n if @kb.save\n format.html { redirect_to @kb, :notice => 'Kb was successfully created.' }\n format.json { render :json => @kb, :status => :created, :location => @kb }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @kb.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @brave_burst = BraveBurst.new(brave_burst_params)\n\n respond_to do |format|\n if @brave_burst.save\n format.html { redirect_to @brave_burst, notice: 'Brave burst was successfully created.' }\n format.json { render action: 'show', status: :created, location: @brave_burst }\n else\n format.html { render action: 'new' }\n format.json { render json: @brave_burst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_bucket(bucket_key,access_token)\n response = RestClient.post(\"#{API_URL}/oss/v2/buckets\",\n { bucketKey: bucket_key, policyKey:'transient'}.to_json,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/json' })\n return response\nend",
"def create\n @barrack = Barrack.new(params[:barrack])\n\n respond_to do |format|\n if @barrack.save\n format.html { redirect_to @barrack, notice: 'Barrack was successfully created.' }\n format.json { render json: @barrack, status: :created, location: @barrack }\n else\n format.html { render action: \"new\" }\n format.json { render json: @barrack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @brace = Brace.new(brace_params)\n\n respond_to do |format|\n if @brace.save\n format.html { redirect_to @brace, notice: 'Brace was successfully created.' }\n format.json { render :show, status: :created, location: @brace }\n else\n format.html { render :new }\n format.json { render json: @brace.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @mbrackets = Mbracket.all\n end",
"def create\n # @asset = @attachable.assets.new(params[:asset])\n @asset = @attachable.assets.build(asset_params)\n\n respond_to do |format|\n if @asset.save\n format.html {\n render :json => [@asset.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json { render json: {files: [@asset.to_jq_upload]}, status: :created, location: @upload }\n else\n format.html { render action: \"new\" }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def bucket_params\n params.require(:bucket).permit(:experiment_id, :http_verb, :api_path, :uuid_key, :uuid_placeholder, :request_body, :timeout, :impression_id, :is_graph_query, :modular, :is_empty, :description, :variables)\n end",
"def create\n @bucket_list = BucketList.new(bucket_list_params)\n\t\tif params[:file]\n\t\t\tresponse = Cloudinary::Uploader.upload params[:file]\n\t\t\t@bucket_list.image = response[\"url\"]\n\t\tend\n respond_to do |format|\n if @bucket_list.save\n format.html { redirect_to @bucket_list, notice: 'Your wish has been added :)' }\n format.json { render :show, status: :created, location: @bucket_list }\n else\n format.html { render :new }\n format.json { render json: @bucket_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setup_bucket(params={})\n granting_params = { \n :s3_videos_bucket => params[:bucket],\n :user_aws_key => params[:access_key],\n :user_aws_secret => params[:secret_key]\n }\n\n put(\"/clouds/#{@cloud_id}.json\", granting_params)\n end",
"def create\n # {\"vcpus\": 1, \"disk\": 1, \"name\": \"test\", \"rxtx_factor\": 1, \"OS-FLV-EXT-DATA:ephemeral\": 1, \"ram\": 512, \"id\": 6, \"swap\": 1}}'\n @flavor = compute.create_flavor(\"rxtx_factor\"=>1,\"OS-FLV-EXT-DATA:ephemeral\"=>params[:ephemeral],:vcpus=>params[:vcpus],:disk=>params[:disk],:name=>params[:name],:ram=>params[:ram],:id=>params[:id],:swap=>params[:swap])\n\n respond_to do |format|\n format.html { redirect_to flavors_path, :notice => 'Flavor was successfully created.' }\n format.json { render :json => @flavor, :status => :created, :location => @flavor }\n end\n end",
"def update\n respond_to do |format|\n if @mbracket.update(mbracket_params)\n format.html { redirect_to @mbracket, notice: 'Mbracket was successfully updated.' }\n format.json { render :show, status: :ok, location: @mbracket }\n else\n format.html { render :edit }\n format.json { render json: @mbracket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def to_jq_upload\n {\n name: read_attribute(:asset_path),\n size: asset_path.size,\n url: asset_path.url,\n delete_path: cms_asset_path(id)\n }\n end",
"def bucket_list_params\n params.require(:bucket_list).permit(:name, :location, :mates, :timing, :comment, :image, :status)\n end",
"def create\n @video = Video.new(video_params)\n @video.save!\n render json: @video\n end",
"def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end",
"def create\n @bracket = Bracket.new(params[:bracket])\n\n respond_to do |format|\n if @bracket.save\n format.html { redirect_to @bracket, notice: 'Bracket was successfully created.' }\n format.json { render json: @bracket, status: :created, location: @bracket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bracket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pmkb = Pmkb.new(pmkb_params)\n\n respond_to do |format|\n if @pmkb.save\n format.html { redirect_to @pmkb, notice: 'Pmkb was successfully created.' }\n format.json { render :show, status: :created, location: @pmkb }\n else\n format.html { render :new }\n format.json { render json: @pmkb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n hawkData = {\n # The first value [name:] corresponds to the backend object model\n # The second value [params[:name]] corresponds to the frontend\n name: params[:java_script_name],\n species: params[:java_script_species]\n }\n Hawk.create(hawkData)\n #render json: hawk\n end",
"def create\n @idea = current_member.ideas.new(idea_params) \n respond_to do |format|\n sectors_params.delete(\"\")\n if @idea.save\n sectors_params.each do |k|\n @idea.sectors << Sector.find_by(id:k)\n end\n format.json { head :no_content }\n format.js\n else\n\n format.json { render :json => { :error => @idea.errors.full_messages }, :status => 422 }\n end\n \n end\n end",
"def upload_asset(filename, data)\n r = request('UploadAsset', { :filename => filename, :data => data })\n \n result = { :status => r['status'] == ' ok ', :key => r['key'] }\n \n return result\n end",
"def create_json\n respond_to do | wants |\n wants.json do\n _create do | image, image_placement |\n if image.save && image_placement.save\n render :layout => false, :json => { :status => 'UPLOADED', :image_url => url_for(:action=>'show', :id=>image_placement.id, :only_path => true)} \n # returning application/json, text/x-json, text/json cause Firefox 3 to try to open an app\n # returning text/html or application/xhtml+xml causes ampersands (&) in json \n # strings to get html_escape (&)\n response.content_type = Mime::HTML\n else\n render :layout => false, :json => { :status => 'FAILED'}\n # otherwise Rails returns application/json and Firefox 3 tries to open an app\n response.content_type = Mime::HTML\n end\n end\n end\n end\n end",
"def create\n @bookmark = Bookmark.new(params[:bookmark])\n# req = ActiveSupport::JSON.decode(request.body)\n# @bookmark = Bookmark.new(req)\n\n respond_to do |format|\n if @bookmark.save\n format.html { redirect_to @bookmark, notice: 'Bookmark was successfully created.' }\n format.json { render json: @bookmark, status: :created, location: @bookmarks }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bookmark.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_marketplaceapp(to_hash)\n end",
"def create\n megam_rest.post_marketplaceapp(to_hash)\n end",
"def post_asset(url, params = {})\n post '/video/v1/assets', {\n input: url\n }.merge(params)\n end",
"def create\n @secret_key = SecretKey.new(secret_key_params)\n\n respond_to do |format|\n if @secret_key.save\n #format.html { redirect_to @secret_key, notice: 'Secret key was successfully created.' }\n format.json { render :json=> @secret_key.to_json({}) }\n else\n format.html { render action: 'new' }\n format.json { render json: @secret_key.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bracket_golfer = BracketGolfer.new(bracket_golfer_params)\n\n respond_to do |format|\n if @bracket_golfer.save\n format.json { respond_with @bracket_golfer }\n else\n format.json { render json: @bracket_golfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_bucket(bucket_name, options={})\n options[:send_goog_project_id] = true\n resp = put(bucket_name, '/', options)\n if resp.code == \"200\"\n resp_obj = {}\n resp_obj[:success] = true\n resp_obj[:bucket_name] = bucket_name\n resp_obj[:message] = \"Bucket created\"\n\n else\n resp_obj = Crack::XML.parse(resp.body)\n resp_obj[:success] = false\n resp_obj[:bucket_name] = bucket_name\n resp_obj[:message] = resp_obj[\"Error\"][\"Message\"].to_s\n resp_obj[:code] = resp_obj[\"Error\"][\"Code\"]\n resp_obj[:raw] = Crack::XML.parse(resp.body)\n resp_obj.each_key {|key| resp_obj.delete(key) unless [:success, :bucket_name, :message, :code, :raw].include?(key) }\n\n end\n return resp_obj\n end",
"def create\n\t\tboat = Boat.new(boat_params)\n \tif boat.save\n \t\trender json: boat, status: 201\n \tend\n\tend",
"def push_assets\n PUSH_ASSETS\n end",
"def create\n @climb_tag = ClimbTag.new(climb_tag_params)\n\n respond_to do |format|\n if @climb_tag.save\n format.html { redirect_to @climb_tag, notice: 'Climb tag was successfully created.' }\n format.json { render :show, status: :created, location: @climb_tag }\n else\n format.html { render :new }\n format.json { render json: @climb_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_method\n :put_json\n end",
"def bucket_params\n params.require(:bucket).permit(:description)\n end",
"def create\n @bucket = current_user.buckets.new(params[:bucket])\n\n respond_to do |format|\n if @bucket.save\n flash[:notice] = 'Bucket was successfully created.'\n format.html { redirect_to(buckets_path) }\n format.xml { render :xml => @bucket, :status => :created, :location => @bucket }\n format.iphone { redirect_to(buckets_path) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bucket.errors, :status => :unprocessable_entity }\n format.iphone { render :action => \"new\", :layout => false}\n end\n end\n end",
"def create body = {}\n @connection.request(method: :post, path: \"/volumes/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end",
"def create\n render json: Post.create(params[\"post\"])\n end",
"def create_bucket(bucket_name)\n send_request(PUT, bucket_name)\n end",
"def create \n # binding.pry\n\n video = Video.new(video_params)\n if video.save\n render json: video, status: :created, location: @video\n else\n render json: {error: \"error This did not save my bro!\"}\n console.log(\"error This did not save my bro!\")\n end\n #render json: videos.to_json(:include => :rapper)\n\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 create\n @bom = Bom.new(bom_params)\n\n respond_to do |format|\n if @bom.save\n format.html { redirect_to @bom, notice: 'Bom was successfully created.' }\n format.json {\n render json: {\n status: \"ok\",\n bom: {\n id: @bom.id,\n name: @bom.name,\n description: @bom.description,\n photo: @bom.photo.url,\n purchase_order_number: @bom.purchase_order_number,\n bom_category_id: @bom.bom_category_id\n }\n },\n status: :created\n }\n else\n format.html { render :new }\n format.json { render json: @bom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @enqueue = Enqueue.new(enqueue_params)\n\n respond_to do |format|\n if @enqueue.save\n format.html { redirect_to @enqueue, notice: 'Enqueue was successfully created.' }\n format.json { render :show, status: :created, location: @enqueue }\n else\n format.html { render :new }\n format.json { render json: @enqueue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add\n @asset = Asset.create!(asset_param)\n json_response(@asset, :created)\n end",
"def create_volume(options={}) \n raise \"Volume nickname required\" unless options[:nickname]\n params = {:nickname => options[:nickname],:size => options[:size], :api_version => 1.0}\n params[:description] = options[:description] if options[:description]\n #STDERR.puts \"HERE IS THE URL: #{@api_url}/create_ebs_volume.js (PARAMS: #{params.inspect})\"\n body = RestClient.post @api_url+\"/create_ebs_volume.js\",params\n json = JSON.load(body)\n STDERR.puts \"CREATED_VOLUME: #{json}\"\n json\n rescue => e\n display_exception(e, \"create_volume: #{options.inspect}\")\n end",
"def create\n respond_to do |format|\n if @upload.save\n result = @upload.to_jq_upload()\n result[:delete_url] = upload_path(@upload)\n \n format.html { redirect_to @upload, :notice => 'Upload was successfully created.' }\n #format.json { render :json => @upload, :status => :created, :location => @upload }\n format.json { render :json => [result].to_json, :status => :created, :location => @upload }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @upload.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def bucket_params\n params.require(:bucket).permit(:name, pins_attributes: [:id, :sneaker_id, :price_watch])\n end",
"def json_entry_params\n params.require(:json_entry).permit(:area_id, :data, :name, :verb, :post_body)\n end",
"def index\n @cnmrbrackets = Cnmrbracket.all\n end",
"def create\n @plate = Plate.new(params[:plate])\n\n if @plate.save\n render json: @plate, status: :created, location: @plate\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end",
"def create\n @bowl = Bowl.new(params[:bowl])\n \n # set the current user's id and the creation time for this bowl\n @bowl.user_id = session[:user].userid.to_i\n @bowl.created = Time.now\n \n respond_to do |format|\n if @bowl.save\n\n Rails.logger.info \"Adding contents for bowl\"\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n \n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully created.' }\n format.json { render :json => @bowl, :status => :created, :location => @bowl }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n response = post_request(URI.parse(\"http://\"+Storage.find(cookies[:donabe_ip]).data+\"/\"+Storage.find(cookies[:current_tenant]).data+\"/containers.json\"), params[:container].to_json, Storage.find(cookies[:current_token]).data)\n json_respond response.body \n\n end",
"def create\n @booksmarks = Booksmark.all\n @booksmark = Booksmark.new(booksmark_params)\n if @booksmark.save\n respond_to do |format|\n format.js {render nothing: true} \n end\n end\n # unless @post.save \n # render json: @post.errors\n # end\n \n end",
"def create\n @ref_mkb = Ref::Mkb.new(params[:ref_mkb])\n\n respond_to do |format|\n if @ref_mkb.save\n format.html { redirect_to @ref_mkb, notice: 'Mkb was successfully created.' }\n format.json { render json: @ref_mkb, status: :created, location: @ref_mkb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ref_mkb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @abucket.update_attributes(params[:abucket])\n flash[:notice] = 'Bucket was successfully updated.'\n format.html { redirect_to(account_abuckets_path(@account)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @abucket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @plsbgmusic_mediafile = PlsbgmusicMediafile.new(plsbgmusic_mediafile_params)\n\n respond_to do |format|\n if @plsbgmusic_mediafile.save\n format.html { redirect_to @plsbgmusic_mediafile, notice: 'Plsbgmusic mediafile was successfully created.' }\n format.json { render :show, status: :created, location: @plsbgmusic_mediafile }\n else\n format.html { render :new }\n format.json { render json: @plsbgmusic_mediafile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n logger.debug \"PARAMS: #{params.inspect}\"\n\n @api_javascript = Api::Javascript.new(params[:api_javascript])\n\n respond_to do |format|\n if @api_javascript.save\n format.html { redirect_to @api_javascript, notice: 'Javascript was successfully created.' }\n format.json { render json: @api_javascript, status: :created, location: @api_javascript }\n else\n format.html { render action: \"new\" }\n format.json { render json: @api_javascript.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asset = Asset.new(params[:asset])\n\n respond_to do |format|\n if @asset.save\n flash[:notice] = 'Asset was successfully created.'\n format.html { redirect_to(admin_assets_url) }\n format.xml { render :xml => @asset, :status => :created, :location => admin_asset_url(@asset) }\n format.js { render :json => @asset, :status => 200, :location => admin_asset_url(@asset) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @asset.errors, :status => :unprocessable_entity }\n format.js { render :json => @asset.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def cnmrbracket_params\n params.require(:cnmrbracket).permit(:signal, :multiplet, :amountc, :coupling, :buffera, :bufferb, :countc, :adaptc, :oka, :okb, :nmrdetailc_id, :cnmr_id, :singlepart_id, :description_id, :fulldoc_id)\n end",
"def put_bucket_cors(bucket_name, cors)\n data = Fog::AWS::Storage.hash_to_cors(cors)\n\n headers = {}\n headers['Content-MD5'] = Base64.encode64(OpenSSL::Digest::MD5.digest(data)).strip\n headers['Content-Type'] = 'application/json'\n headers['Date'] = Fog::Time.now.to_date_header\n\n request({\n :body => data,\n :expects => 200,\n :headers => headers,\n :bucket_name => bucket_name,\n :method => 'PUT',\n :query => {'cors' => nil}\n })\n end",
"def create\n @scratcher = Scratcher.new(permitted_params)\n\n if @scratcher.save\n render json: @scratcher, status: :created, location: @scratcher\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end",
"def create\n @asset = Asset.new(params[:asset])\n\n respond_to do |format|\n if @asset.save\n format.html { redirect_to assets_url, notice: 'Asset was successfully created.' }\n format.json { render json: @asset, status: :created, location: @asset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @c_asset = CAsset.new(params[:c_asset])\n\n authorize! :create, @c_asset\n respond_to do |format|\n if @c_asset.save\n format.html { redirect_to c_assets_path, :notice => 'C asset was successfully created.' }\n format.json { render :json => @c_asset, :status => :created, :location => @c_asset }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @c_asset.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n begin\n @asset = Asset.create!(asset_params)\n render template: 'assets/show', status: :created\n rescue Exception => e\n render json: {:message=> e.to_s}.to_json, status: :internal_server_error\n end\n end",
"def create\n @bundle = Bundle.new(params[:bundle])\n\n params[:bundle][:category] = params[:bundle][:category].strip.downcase\n params[:bundle][:style] = params[:bundle][:style].strip.downcase\n params[:bundle][:color] = params[:bundle][:color].strip.downcase\n params[:bundle][:brand] = params[:bundle][:brand].strip.downcase\n params[:bundle][:make] = params[:bundle][:make].strip.downcase\n params[:bundle][:location] = params[:bundle][:location].strip.downcase\n\n\n respond_to do |format|\n if @bundle.save\n format.html { redirect_to @bundle, notice: 'Bundle was successfully created.' }\n format.json { render json: @bundle, status: :created, location: @bundle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bundle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @barcode_asset = BarcodeAsset.new(barcode_asset_params)\n\n respond_to do |format|\n if @barcode_asset.save\n format.html { redirect_to @barcode_asset, notice: 'Barcode asset was successfully created.' }\n format.json { render action: 'show', status: :created, location: @barcode_asset }\n else\n format.html { render action: 'new' }\n format.json { render json: @barcode_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def to_jq_upload\n {\n \"name\" => self.event.name,\n \"size\" => self.clip.file.size,\n \"url\" => self.clip.url,\n \"thumbnail_url\" => \"\",\n \"delete_url\" => \"/videos/#{self.id}\",\n \"delete_type\" => \"DELETE\"\n }\n end",
"def authorize_upload_postprocess\n\n upload = Panda.post('/videos/upload.json', {\n file_name: upload_payload['filename'],\n file_size: upload_payload['filesize'],\n profiles: \"h264\",\n })\n\n render :json => {:upload_url => upload['location'], :postprocess_url => \"/videos/postprocess\"}\n end",
"def create\n @slab = Slab.new(params[:slab])\n\n respond_to do |format|\n if @slab.save\n format.html { redirect_to @slab, :notice => 'Slab was successfully created.' }\n format.json { render :json => @slab, :status => :created, :location => @slab }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @slab.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @bench_test_s3 = BenchTest::S3.new(params[:bench_test_s3])\n\n mark_as_starting @bench_test_s3\n\n\n respond_to do |format|\n if @bench_test_s3.save\n format.html { redirect_to(@bench_test_s3, :notice => 'S3 was successfully created.') }\n format.xml { render :xml => @bench_test_s3, :status => :created, :location => @bench_test_s3 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bench_test_s3.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_appreq(to_hash)\n end",
"def create\n puts params[:song]\n @song = Song.new params[:song]\n create_song @song\n\n respond_to do |format|\n if @song.save\n format.html {\n render :json => [@song.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json { render json: [@song.to_jq_upload].to_json, status: :created, location: @song }\n else\n format.html { render action: \"new\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def aws_post_url\n \"#{AWS_S3_ACCESS_URL}/#{self.class.media_bucket}\"\n end",
"def make_bucket(name)\n msg \"making bucket #{bucket_name(name)}\"\n AWS::S3::Bucket.create(bucket_name(name))\n end",
"def create\n @bloom = Bloom.new(params[:bloom])\n\n respond_to do |format|\n if @bloom.save\n format.html { redirect_to @bloom, notice: 'Bloom was successfully created.' }\n format.json { render json: @bloom, status: :created, location: @bloom }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bloom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stage = Stage.new(stage_params)\n\n if @stage.save\n render json: @stage, status: :created\n else\n render json: @stage.errors, status: :unprocessable_entity\n end\n end",
"def create\n @secret = current_user.secrets.build(secret_params)#Secret.new(secret_params)\n\n if @secret.save\n render json: @secret\n else\n render json: @secret.errors, status: :unprocessable_entity\n end\n end",
"def create\n @brainfart = Brainfart.new(brainfart_params)\n\n respond_to do |format|\n if @brainfart.save\n format.html { redirect_to @brainfart, notice: 'Brainfart was successfully created.' }\n format.json { render :show, status: :created, location: @brainfart }\n else\n format.html { render :new }\n format.json { render json: @brainfart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rubygem = Rubygem.new(rubygem_params)\n\n if @rubygem.save\n render json: @rubygem, status: :created, location: @rubygem\n else\n render json: @rubygem.errors, status: :unprocessable_entity\n end\n end",
"def create\n @frame = Frame.new(params[:frame])\n\n if @frame.save\n respond_to do |format|\n format.html {\n render :json => [@frame.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json {\n render :json => [@frame.to_jq_upload].to_json\n }\n end\n else\n render :json => [{:error => \"custom_failure\"}], :status => 304\n end\n end",
"def create\n @brand = Brand.new(brand_params)\n respond_to do |format|\n if @brand.save\n @created = true\n format.js\n format.html { redirect_to brands_path, notice: 'Brand was successfully created.' }\n format.json { render :show, status: :created, location: @brand }\n else\n @created = false\n format.js\n format.html { render :new }\n format.json { render json: @brand.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def create\n @go_slim = GoSlim.new(params[:go_slim])\n\n respond_to do |format|\n if @go_slim.save\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully created.' }\n format.json { render json: @go_slim, status: :created, location: @go_slim }\n else\n format.html { render action: \"new\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bike_rack = BikeRack.new(bike_rack_params)\n\n respond_to do |format|\n if @bike_rack.save\n flash[:success] = 'Bike rack was successfully created.'\n format.html { redirect_to @bike_rack }\n format.json { render :show, status: :created, location: @bike_rack }\n else\n flash[:danger] = 'There was a problem with creating Bike rack.'\n format.html { render :new }\n format.json { render json: @bike_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def job_params\n params.require(:preflight).permit(:manifest)\n end",
"def create_stored_manifest\n unless stored_manifest\n @stored_manifest = directory.files.new(:body => components.to_json, :key => \"#{manifest.name}-#{version}.json\", :content_type => 'application/json')\n @stored_manifest.acl = 'public-read' if Manifesto.public_manifests?\n @stored_manifest.save\n create_current_manifest\n end\n end",
"def create\n @asset_scrapping_entry = AssetScrappingEntry.new(asset_scrapping_entry_params)\n\n respond_to do |format|\n if @asset_scrapping_entry.save\n format.html { redirect_to @asset_scrapping_entry, notice: 'Asset scrapping entry was successfully created.' }\n format.json { render :show, status: :created, location: @asset_scrapping_entry }\n else\n format.html { render :new }\n format.json { render json: @asset_scrapping_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def manifest\n @manifest ||= Sprockets::Manifest.new(sprockets, File.join(public_folder, prefix))\n end",
"def create\n @asset = Asset.new(params[:asset])\n\n respond_to do |format|\n if @asset.save\n format.html { redirect_to @asset, notice: 'Asset was successfully created.' }\n format.json { render json: @asset, status: :created, location: @asset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers/\"+params[:containerID].to_s+\"/deploy.json\"), (sesh :current_token))\n json_respond response.body\n end"
] | [
"0.58926225",
"0.5855267",
"0.5675764",
"0.5573238",
"0.5555356",
"0.54543626",
"0.5419137",
"0.5354525",
"0.53034854",
"0.5223558",
"0.51780456",
"0.5177694",
"0.5146059",
"0.51358217",
"0.5079961",
"0.5068309",
"0.5057744",
"0.5056958",
"0.50495857",
"0.50196517",
"0.4997125",
"0.4994536",
"0.49922493",
"0.4990127",
"0.49871382",
"0.4972203",
"0.49697515",
"0.49655214",
"0.4962465",
"0.49370894",
"0.4929769",
"0.49066016",
"0.4892797",
"0.48855874",
"0.4881925",
"0.4881925",
"0.4869724",
"0.4862544",
"0.48594365",
"0.48541102",
"0.48225883",
"0.48218536",
"0.4820803",
"0.48089674",
"0.48084444",
"0.48048106",
"0.4802712",
"0.4793661",
"0.4786164",
"0.47812778",
"0.4780164",
"0.47746953",
"0.47656357",
"0.4764188",
"0.47635025",
"0.4760899",
"0.4759315",
"0.47575366",
"0.4755668",
"0.4752769",
"0.47462925",
"0.47452912",
"0.474144",
"0.47396004",
"0.4728562",
"0.4727853",
"0.47258085",
"0.47248012",
"0.47214288",
"0.472123",
"0.4720995",
"0.47173724",
"0.47173217",
"0.4717269",
"0.47164074",
"0.47140548",
"0.4711844",
"0.47113016",
"0.47100237",
"0.4709628",
"0.47068557",
"0.4703758",
"0.47027102",
"0.47025323",
"0.47021085",
"0.4698379",
"0.4696956",
"0.46937788",
"0.46874723",
"0.46861842",
"0.46845576",
"0.46829736",
"0.46822655",
"0.46774897",
"0.46752423",
"0.4672028",
"0.46717465",
"0.46713924",
"0.46700498",
"0.4665279"
] | 0.59274787 | 0 |
PATCH/PUT /mbrackets/1 PATCH/PUT /mbrackets/1.json | def update
respond_to do |format|
if @mbracket.update(mbracket_params)
format.html { redirect_to @mbracket, notice: 'Mbracket was successfully updated.' }
format.json { render :show, status: :ok, location: @mbracket }
else
format.html { render :edit }
format.json { render json: @mbracket.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @abucket.update_attributes(params[:abucket])\n flash[:notice] = 'Bucket was successfully updated.'\n format.html { redirect_to(account_abuckets_path(@account)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @abucket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bucket_bloc.update(bucket_bloc_params)\n format.html { redirect_to @bucket_bloc, notice: 'Bucket bloc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bucket_bloc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bucket.update(bucket_params)\n format.html { redirect_to @bucket, notice: 'Bucket was successfully updated.' }\n format.json { render :show, status: :ok, location: @bucket }\n else\n format.html { render :edit }\n format.json { render json: @bucket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def patch!\n request! :patch\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @bucket.update(bucket_params)\n format.html { redirect_to buckets_path, notice: 'Bucket was successfully updated.' }\n format.json { render :show, status: :ok, location: @pin }\n else\n format.html { render :edit, status: :unprocessable_entity}\n format.json { render json: @bucket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.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 respond_to do |format|\n if @brace.update(brace_params)\n format.html { redirect_to @brace, notice: 'Brace was successfully updated.' }\n format.json { render :show, status: :ok, location: @brace }\n format.js { render :nothing => true }\n else\n format.html { render :edit }\n format.json { render json: @brace.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @kb = Kb.find(params[:id])\n\n respond_to do |format|\n if @kb.update_attributes(params[:kb])\n format.html { redirect_to @kb, :notice => 'Kb was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @kb.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @bundle = Bundle.find(params[:id])\n\n\n respond_to do |format|\n params[:bundle][:category] = params[:bundle][:category].strip.downcase\n params[:bundle][:style] = params[:bundle][:style].strip.downcase\n params[:bundle][:color] = params[:bundle][:color].strip.downcase\n params[:bundle][:brand] = params[:bundle][:brand].strip.downcase\n params[:bundle][:make] = params[:bundle][:make].strip.downcase\n params[:bundle][:location] = params[:bundle][:location].strip.downcase\n\n if @bundle.update_attributes(params[:bundle])\n format.html { redirect_to @bundle, notice: 'Bundle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundle.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 puts \"update #{@need.as_json} #{updated_params.as_json}\"\n respond_to do |format|\n if @need.update(updated_params)\n puts \"brucep update success\"\n format.html { redirect_to new_need_path }\n format.json { render :show, status: :ok, location: @need }\n else\n format.html { render :edit }\n format.json { render json: @need.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n respond_to do |format|\n if @climb.update(climb_params)\n format.html { redirect_to @climb, notice: 'Climb was successfully updated.' }\n format.json { render :show, status: :ok, location: @climb }\n else\n format.html { render :edit }\n format.json { render json: @climb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bundle = Bundle.find(params[:id])\n\n respond_to do |format|\n if @bundle.update_attributes(params[:bundle])\n format.html { redirect_to @bundle, notice: 'Bundle was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n if @barrack.update_attributes(params[:barrack])\n format.html { redirect_to @barrack, notice: 'Barrack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @barrack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n head :no_content\n end",
"def update\n head :no_content\n end",
"def update\n @api_javascript = Api::Javascript.find(params[:id])\n\n respond_to do |format|\n if @api_javascript.update_attributes(params[:api_javascript])\n format.html { redirect_to @api_javascript, notice: 'Javascript was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_javascript.errors, status: :unprocessable_entity }\n end\n end\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\n #formats as js since it's getting parsed on the front end\n respond_to do |format|\n format.js\n end\n end",
"def update\n respond_to do |format|\n if @cnmrbracket.update(cnmrbracket_params)\n format.html { redirect_to @cnmrbracket, notice: 'Cnmrbracket was successfully updated.' }\n format.json { render :show, status: :ok, location: @cnmrbracket }\n else\n format.html { render :edit }\n format.json { render json: @cnmrbracket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cookbook = current_cookbook\n\n # Process Paperclip attachments\n @cookbook.process_attachments(params)\n \n if @cookbook.update_attributes_individually params[:cookbook]\n flash[:notice] = 'The template was updated.'\n end\n respond_to do |format|\n format.js { render :update, content_type: \"text/plain\" }\n end\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 # PATCH\n raise NotImplementedError\n end",
"def update\n respond_to do |format|\n if @brave_burst.update(brave_burst_params)\n format.html { redirect_to @brave_burst, notice: 'Brave burst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @brave_burst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, **args); end",
"def update\n @bucket = current_user.buckets.find(params[:id])\n respond_to do |format|\n if @bucket.update_attributes(params[:bucket])\n flash[:notice] = 'Bucket was successfully updated.'\n format.html { redirect_to(@bucket) }\n format.xml { head :ok }\n format.iphone { redirect_to(@bucket) }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bucket.errors, :status => :unprocessable_entity }\n format.iphone { render :action => \"edit\", :layout => false}\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 update\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n if @go_slim.update_attributes(params[:go_slim])\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n head :ok\n end",
"def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def update\n @boot = Boot.find(params[:id])\n\n respond_to do |format|\n if @boot.update_attributes(params[:boot])\n flash[:success] = \"Updated successfully \"\n format.html { redirect_to boots_path, notice: 'Boot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @boot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n #@manifestation = Manifestation.find(params[:id])\n \n respond_to do |format|\n if @manifestation.update_attributes(params[:manifestation])\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.manifestation'))\n format.html { redirect_to @manifestation }\n format.json { head :no_content }\n format.js\n else\n prepare_options\n format.html { render :action => \"edit\" }\n format.json { render :json => @manifestation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @manifest.update(manifest_params)\n format.html { redirect_to @manifest, notice: 'Manifest was successfully updated.' }\n format.json { render :show, status: :ok, location: @manifest }\n else\n format.html { render :edit }\n format.json { render json: @manifest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch; end",
"def patch; end",
"def update\n find_asset\n @asset.update!(asset_params)\n\n render json: @asset, adapter: :json\n end",
"def patches\n \"http://github.com/kr/beanstalkd/commit/80da772efeeaabb12893f52a93da74ca9e69206d.patch\"\n end",
"def update\n respond_to do |format|\n if @enqueue.update(enqueue_params)\n format.html { redirect_to @enqueue, notice: 'Enqueue was successfully updated.' }\n format.json { render :show, status: :ok, location: @enqueue }\n else\n format.html { render :edit }\n format.json { render json: @enqueue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @buckle.update(buckle_params)\n format.html { redirect_to admin_buckles_path, notice: 'Buckle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @buckle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path = '/files/', params = {})\n request :put, path, params\n end",
"def update\n respond_to do |format|\n if @makrana_marble.update(makrana_marble_params)\n format.html { redirect_to @makrana_marble, notice: 'Marble product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @makrana_marble.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ref_mkb = Ref::Mkb.find(params[:id])\n\n respond_to do |format|\n if @ref_mkb.update_attributes(params[:ref_mkb])\n format.html { redirect_to @ref_mkb, notice: 'Mkb was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ref_mkb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boc.update(boc_params)\n format.html { redirect_to @boc, notice: 'Boc was successfully updated.' }\n format.json { render :show, status: :ok, location: @boc }\n else\n format.html { render :edit }\n format.json { render json: @boc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @job_manifests_path = args[:job_manifests_path] if args.key?(:job_manifests_path)\n @manifest_path = args[:manifest_path] if args.key?(:manifest_path)\n @skaffold_config_path = args[:skaffold_config_path] if args.key?(:skaffold_config_path)\n end",
"def update\n @request = Request.find(params[:id])\n\n if @request.update(params[:request])\n head :no_content\n else\n render json: @request.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @asset.update(asset_params)\n format.html { redirect_to root_path, notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n if @climb.update_attributes(params[:climb])\n format.html { redirect_to @climb, notice: 'Climb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @climb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scrobble = Scrobble.find(params[:id])\n\n respond_to do |format|\n if @scrobble.update_attributes(params[:scrobble])\n format.html { redirect_to @scrobble, notice: 'Scrobble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scrobble.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @project = Project.find(params[:project_id])\n if @asset.update(asset_params)\n format.js\n #format.html { redirect_to edit_project_path(@project), notice: 'Asset was successfully updated.' }\n #format.json { head :no_content }\n else\n format.js\n #format.html { render action: 'edit' }\n #format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @asset_request = AssetRequest.find(params[:id])\n\n respond_to do |format|\n if @asset_request.update_attributes(params[:asset_request])\n format.html { redirect_to @asset_request, notice: 'Asset request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asset_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n job = Job.find(params[:id])\n job.update_attributes(job_params)\n render json: job\n end",
"def update\n respond_to do |format|\n if @upload.update_attributes(params[:upload]) && @resource.update_attributes(params[:resource])\n format.js \n end\n end\n end",
"def update\n respond_to do |format|\n if @bike_rack.update(bike_rack_params)\n flash[:success] = 'Bike rack was successfully updated.'\n format.html { redirect_to @bike_rack }\n format.json { render :show, status: :ok, location: @bike_rack }\n else\n flash[:danger] = 'There was a problem editing Bike rack.'\n format.html { render :edit }\n format.json { render json: @bike_rack.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\n respond_to do |format|\n if @singleb.update(singleb_params)\n format.html { redirect_to @singleb, notice: 'Singleb was successfully updated.' }\n format.json { render :show, status: :ok, location: @singleb }\n else\n format.html { render :edit }\n format.json { render json: @singleb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end",
"def update\n respond_to do |format|\n if @climb_class.update(climb_class_params)\n format.html { redirect_to @climb_class, notice: 'Climb class was successfully updated.' }\n format.json { render :show, status: :ok, location: @climb_class }\n else\n format.html { render :edit }\n format.json { render json: @climb_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rack_installation.update(rack_installation_params)\n format.html { redirect_to @rack_installation, notice: 'Rack installation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rack_installation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(path)\n output { patch(path, params) }\n end",
"def update\n respond_to do |format|\n if @blueprint.update(blueprint_params)\n format.html { redirect_to @blueprint, notice: 'Blueprint was successfully updated.' }\n format.json { render :show, status: :ok, location: @blueprint }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @blueprint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plate = Plate.find(params[:id])\n\n if @plate.update(params[:plate])\n head :no_content\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end",
"def update\n @lob = Lob.find(params[:id])\n\n if @lob.update(lob_params)\n head :no_content\n else\n render json: @lob.errors, status: :unprocessable_entity\n end\n end",
"def update\n put :update\n end",
"def update\n respond_to do |format|\n if @app_static.update(app_static_params)\n format.html { redirect_to @app_static, notice: 'App static was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @app_static.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bs_system.update(bs_system_params)\n format.html { redirect_to [@bs_project, @bs_system], notice: 'Bs system was successfully updated.' }\n format.json { render :show, status: :ok, location: @bs_system }\n else\n format.html { render :edit }\n format.json { render json: @bs_system.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rubygem = Rubygem.find(params[:id])\n\n if @rubygem.update(rubygem_params)\n head :no_content\n else\n render json: @rubygem.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @bucket_list.update(bucket_list_params)\n if params[:file]\n\t\t\t response = Cloudinary::Uploader.upload params[:file]\n\t\t\t @bucket_list.update :image => response[\"url\"]\n\t\t end\n format.html { redirect_to @bucket_list, notice: 'Update successful!' }\n format.json { render :show, status: :ok, location: @bucket_list }\n else\n format.html { render :edit }\n format.json { render json: @bucket_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n if @slab.update_attributes(params[:slab])\n format.html { redirect_to @slab, :notice => 'Slab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @slab.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ba_spec = BaSpec.find(params[:id])\n\n respond_to do |format|\n if @ba_spec.update_attributes(params[:ba_spec])\n format.html { redirect_to session[:return_to] }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ba_spec.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_manifest(manifest_version)\n manifest = JSON.parse(IO.read(@manifest_template_path))\n if manifest.instance_of? Array\n manifest.each { |m| m['version'] = manifest_version }\n else\n manifest['version'] = manifest_version\n if !manifest['tasks'].nil? and manifest['tasks'].instance_of? Array\n manifest['tasks'].each { |m| m['version'] = manifest_version }\n end\n end\n\n File.open('manifest.json','w'){ |f| f.write(JSON.pretty_generate(manifest)) }\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bones_segment.update(bones_segment_params)\n format.html { redirect_to @bones_segment, notice: 'Bones segment was successfully updated.' }\n format.json { render :show, status: :ok, location: @bones_segment }\n else\n format.html { render :edit }\n format.json { render json: @bones_segment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spkj_bsb=SpkjBsb.find(params[:id])\n @spkj_bsb.update_attributes(params[:spkj_bsb])\n\n respond_to do |format|\n format.html { redirect_to(\"/spkj_bsbs\") }\n format.json { render json: @spkj_bsb }\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 respond_to do |format|\n if @asset.update(asset_params)\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bench_test_s3 = BenchTest::S3.find(params[:id])\n\n respond_to do |format|\n if @bench_test_s3.update_attributes(params[:bench_test_s3])\n format.html { redirect_to(@bench_test_s3, :notice => 'S3 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bench_test_s3.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_method\n :put_json\n end",
"def update(request)\n end",
"def update(request)\n end",
"def update\n @ja_blocked_root = JaBlockedRoot.find(params[:id])\n\n respond_to do |format|\n if @ja_blocked_root.update_attributes(params[:ja_blocked_root])\n format.html { redirect_to @ja_blocked_root, notice: 'Ja blocked root was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ja_blocked_root.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bounty.update(bounty_params)\n format.html { redirect_to @bounty, notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @asset_file.update(asset_file_params)\n format.html { redirect_to @asset_file, notice: 'Asset file was successfully updated.' }\n format.json { render :show, status: :ok, location: @asset_file }\n else\n format.html { render :edit }\n format.json { render json: @asset_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @minor.update(minor_params)\n format.html { redirect_to :show, notice: 'Minor was successfully updated.' }\n format.json { render :show, status: :ok, location: @minor }\n else\n format.html { render :edit }\n format.json { render json: @minor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_boat_part.update(vehicle_boat_part_params)\n format.html { redirect_to @vehicle_boat_part, notice: 'Vehicle boat part was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_boat_part }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_boat_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bracket = Bracket.find(params[:id])\n\n respond_to do |format|\n if @bracket.update_attributes(params[:bracket])\n format.html { redirect_to @bracket, notice: 'Bracket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bracket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n prms = @boat_type.is_modification? ? modification_params : boat_type_params\n respond_to do |format|\n if @boat_type.update(prms)\n format.html { redirect_to edit_boat_type_path(@boat_type), notice: 'Тип лодки успешно обновлён' }\n format.json { render json: @boat_type.hash_view('control'), status: :ok}\n else\n format.html { render :edit }\n format.json { render json: @boat_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @climb_tag.update(climb_tag_params)\n format.html { redirect_to @climb_tag, notice: 'Climb tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @climb_tag }\n else\n format.html { render :edit }\n format.json { render json: @climb_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job_compact = JobCompact.find(params[:id])\n\n respond_to do |format|\n if @job_compact.update_attributes(params[:job_compact])\n format.html { redirect_to @job_compact, notice: 'Job compact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_compact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vagrant_json_update(image_name, version_entry)\n # Load the vagrant JSON file\n json_file = File.new(\"#{Packer::OUTPUT_DIR}/#{image_name}.json\", 'w+')\n json_str = json_file.read\n \n # Load the JSON data\n begin\n json_data = JSON.load json_str\n rescue JSON::ParserError\n json_data = {\n \"name\" => image_name,\n \"versions\" => []\n }\n end\n\n # This will make sure there are no duplicate\n # entries for each box version specified in the\n # JSON file\n json_data['versions'].each_index do |i|\n box_version = json_data['versions'][i]\n if box_version['version'] == version_entry['version']\n json_data['versions'][i].delete\n break\n end\n end\n\n # Insert the new version entry\n json_data['versions'].push version_entry\n \n # Write the thing\n json_file.puts JSON.dump json_data\nend",
"def update\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n if @bb.update_attributes(params[:bb])\n format.html { redirect_to @bb, notice: 'Bb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bb.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6146706",
"0.59289056",
"0.5795",
"0.57512766",
"0.5737652",
"0.56975603",
"0.56896573",
"0.56379503",
"0.55683506",
"0.5561941",
"0.5560071",
"0.5523778",
"0.5479658",
"0.5464934",
"0.54600555",
"0.54535997",
"0.54489356",
"0.5421928",
"0.5415702",
"0.5405829",
"0.5405829",
"0.536918",
"0.5357362",
"0.535109",
"0.5350345",
"0.53445923",
"0.53414226",
"0.53330195",
"0.5330947",
"0.5307551",
"0.530557",
"0.5304383",
"0.5304383",
"0.52951264",
"0.52927154",
"0.52901113",
"0.52800435",
"0.527234",
"0.5268202",
"0.52600425",
"0.5257717",
"0.5256215",
"0.5256215",
"0.5249365",
"0.524909",
"0.524687",
"0.52442515",
"0.5237825",
"0.5236988",
"0.52142894",
"0.5212184",
"0.52026975",
"0.5201788",
"0.5201634",
"0.5199342",
"0.5185943",
"0.5184562",
"0.5178452",
"0.5176271",
"0.51752007",
"0.5171946",
"0.5170278",
"0.5164158",
"0.5162887",
"0.5161153",
"0.5153614",
"0.5149286",
"0.51492834",
"0.51482016",
"0.5142039",
"0.51367044",
"0.5127041",
"0.51234716",
"0.51231796",
"0.5119618",
"0.511274",
"0.511257",
"0.510454",
"0.5101465",
"0.5100079",
"0.5099024",
"0.5096031",
"0.50932854",
"0.50874084",
"0.5086716",
"0.5083993",
"0.50813556",
"0.50813556",
"0.508097",
"0.5078718",
"0.5078419",
"0.5078273",
"0.5077957",
"0.5077376",
"0.5074899",
"0.50741816",
"0.5070712",
"0.5069607",
"0.50658756",
"0.50611216"
] | 0.608883 | 1 |
DELETE /mbrackets/1 DELETE /mbrackets/1.json | def destroy
@mbracket.destroy
respond_to do |format|
format.html { redirect_to mbrackets_url, notice: 'Mbracket was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cnmrbracket.destroy\n respond_to do |format|\n format.html { redirect_to cnmrbrackets_url, notice: 'Cnmrbracket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bes_asset.destroy\n respond_to do |format|\n format.html { redirect_to bes_assets_url, notice: 'Asset was successfully deleted!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bones_segment.destroy\n respond_to do |format|\n format.html { redirect_to bones_segments_url, notice: 'Bones segment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @global_asset = GlobalAsset.find(params[:id])\n @global_asset.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_global_assets_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n # sorry but not delete is not allow\n #@bundle = Bundle.find(params[:id])\n #@bundle.destroy\n\n respond_to do |format|\n format.html { redirect_to bundles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @singleb.destroy\n respond_to do |format|\n format.html { redirect_to singlebs_url, notice: 'Singleb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bucket.destroy\n respond_to do |format|\n format.html { redirect_to buckets_path, notice: 'bucket deleted!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = Asset.find(params[:id])\n @asset.destroy\n\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = Asset.find(params[:id])\n @asset.destroy\n\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = Asset.find(params[:id])\n @asset.destroy\n\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = Asset.find(params[:id])\n @asset.destroy\n\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baz3.destroy\n respond_to do |format|\n format.html { redirect_to baz3s_url, notice: \"Baz3 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset_file.destroy\n respond_to do |format|\n format.html { redirect_to asset_files_url, notice: 'Asset file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bucket.destroy\n respond_to do |format|\n format.html { redirect_to buckets_url, notice: 'Bucket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = Resource.find(params[:id])\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to admin_resources_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bundle = Bundle.find(params[:id])\n @bundle.destroy\n\n respond_to do |format|\n format.html { redirect_to bundles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @boot = Boot.find(params[:id])\n @boot.destroy\n\n\n respond_to do |format|\n flash[:success] = \"Deleted successfully \"\n format.html { redirect_to boots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to assets_url, notice: 'Asset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @q_resource = QResource.find(params[:id])\n @q_resource.bfile.remove!\n @q_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to q_resources_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @stage.destroy\n render json: {message: 'Etapa Excluida'}, status: :ok\n end",
"def destroy\n record = Asset.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 @file.destroy\n respond_to do |format|\n format.js\n format.json { head :no_content, status: :destroyed }\n end\n end",
"def destroy\n @app_static.destroy\n respond_to do |format|\n format.html { redirect_to app_statics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kb = Kb.find(params[:id])\n @kb.destroy\n\n respond_to do |format|\n format.html { redirect_to kbs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @file_version.destroy\n head :no_content\n end",
"def destroy\n @misc_asset.destroy\n respond_to do |format|\n format.html { redirect_to misc_assets_url, notice: 'Misc asset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = Asset.find(params[:id])\n @asset.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_assets_url) }\n format.js { render :nothing => true }\n format.xml { head :ok }\n end\n end",
"def destroy\n @primary_asset.destroy\n respond_to do |format|\n format.html { redirect_to primary_assets_url, notice: 'Primary asset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gadget_file.destroy\n respond_to do |format|\n format.html { redirect_to gadget_files_url, notice: 'Gadget file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bs_system.destroy\n respond_to do |format|\n format.html { redirect_to @bs_project, notice: 'Bs system was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baz8.destroy\n respond_to do |format|\n format.html { redirect_to baz8s_url, notice: \"Baz8 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n repo = assets_repo\n repo.destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to v_assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset_manage.destroy\n respond_to do |format|\n format.html { redirect_to asset_manages_url, notice: 'Asset manage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset_request = AssetRequest.find(params[:id])\n @asset_request.destroy\n\n respond_to do |format|\n format.html { redirect_to asset_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @abucket.destroy\n respond_to do |format|\n format.html { redirect_to(account_abuckets_path(@account)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @b = B.find(params[:id])\n @b.destroy\n\n respond_to do |format|\n format.html { redirect_to bs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset_scrapping_entry.destroy\n respond_to do |format|\n format.html { redirect_to asset_scrapping_entries_url, notice: 'Asset scrapping entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bustour.destroy\n respond_to do |format|\n format.html { redirect_to bustours_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manifest.destroy\n respond_to do |format|\n format.html { redirect_to manifests_url, notice: 'Manifest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manifest.destroy\n respond_to do |format|\n format.html { redirect_to manifests_url, notice: 'Manifest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove!\n basename = File.basename(public_url)\n o = s3_bucket.objects[\"#{asset_path}#{basename}\"]\n o.delete\n end",
"def remove!\n basename = File.basename(public_url)\n o = s3_bucket.objects[\"#{asset_path}#{basename}\"]\n o.delete\n end",
"def destroy\n @shrink.destroy\n respond_to do |format|\n format.html { redirect_to shrinks_url, notice: 'Shrink 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 @e_asset.destroy\n respond_to do |format|\n format.html { redirect_to e_assets_url, notice: 'E asset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bq.destroy\n respond_to do |format|\n format.html { redirect_to bqs_url, notice: 'Bq was successfully destroyed.' }\n format.json { head :no_content }\n format.js { render js: 'window.location.reload()' }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n\n # Destroy s3 objects\n aws_s3_delete(@photo.key)\n Sebitmin::Application.config.thumbnail_sizes.each do |thumbnail_size|\n aws_s3_delete(@photo[\"thumbnail_key_#{thumbnail_size}\"])\n end\n\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset_tag = AssetTag.find(params[:id])\n @asset_tag.destroy\n render json: {}\n \n end",
"def destroy\n @production_block.destroy\n respond_to do |format|\n format.html { redirect_to production_blocks_url, notice: 'Production block was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rackitem = Rackitem.find(params[:id])\n @rackitem.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Rackitem removed' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @massive_load = MassiveLoad.find(params[:id])\n @massive_load.destroy\n\n respond_to do |format|\n format.html { redirect_to massive_loads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bench_test_s3 = BenchTest::S3.find(params[:id])\n @bench_test_s3.destroy\n\n respond_to do |format|\n format.html { redirect_to(bench_test_s3s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @climb = Climb.find(params[:id])\n @climb.destroy\n\n respond_to do |format|\n format.html { redirect_to climbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attached_asset = AttachedAsset.find(params[:id])\n @attached_asset.destroy\n\n respond_to do |format|\n format.html { redirect_to attached_assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bundle.destroy\n respond_to do |format|\n format.html { redirect_to bundles_url, notice: 'Bundle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bluray_storage.destroy\n respond_to do |format|\n format.html { redirect_to bluray_storages_url, notice: 'Bluray storage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clapme_stage.destroy\n respond_to do |format|\n format.html { redirect_to website_stages_url }\n format.json { head :no_content }\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 @client_asset.destroy\n respond_to do |format|\n format.html { redirect_to client_assets_url, notice: 'Client asset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bicepstricepshome3.destroy\n respond_to do |format|\n format.html { redirect_to bicepstricepshome3s_url, notice: 'Bicepstricepshome3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget_file.destroy\n respond_to do |format|\n format.html { redirect_to budget_files_path, notice: 'BudgetFile was successfully destroyed.' }\n format.js\n format.json { head :no_content }\n end\n end",
"def destroy\n @boc.destroy\n respond_to do |format|\n format.html { redirect_to bocs_url, notice: 'Boc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @climb.destroy\n respond_to do |format|\n format.html { redirect_to climbs_url, notice: 'Climb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@static_content = StaticContent.find(params[:id])\n #@static_content.destroy\n #\n #respond_to do |format|\n # format.html { redirect_to static_contents_url }\n # format.json { head :no_content }\n #end\n end",
"def destroy\n @api_javascript = Api::Javascript.find(params[:id])\n @api_javascript.destroy\n\n respond_to do |format|\n format.html { redirect_to api_javascripts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = Asset.find(params[:id])\n @asset.destroy\n\n respond_to do |format|\n format.js # render destroy.rjs << added for P/C >>\n format.html { redirect_to assets_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lob.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @barrack = Barrack.find(params[:id])\n @barrack.destroy\n\n respond_to do |format|\n format.html { redirect_to barracks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @ministorage.destroy\n respond_to do |format|\n format.html { redirect_to admin_ministorages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bb.destroy\n respond_to do |format|\n format.html { redirect_to bbs_url, notice: 'Bb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @backup_file = BackupFile.find(params[:id])\n @backup_file.destroy\n\n respond_to do |format|\n format.html { redirect_to backup_files_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @buckle.destroy\n respond_to do |format|\n format.html { redirect_to admin_buckles_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fixed_asset.destroy\n respond_to do |format|\n format.html { redirect_to fixed_assets_url, notice: 'Fixed asset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fixed_asset.destroy\n respond_to do |format|\n format.html { redirect_to fixed_assets_url, notice: 'Fixed asset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = Asset.find(params[:id])\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.js {render :layout => false}\n format.json { head :no_content }\n end\n end",
"def destroy\n @plsbgmusic_mediafile.destroy\n respond_to do |format|\n format.html { redirect_to plsbgmusic_mediafiles_url, notice: 'Plsbgmusic mediafile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bath.destroy\n respond_to do |format|\n format.html { redirect_to baths_url, notice: 'Bath was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baz1.destroy\n respond_to do |format|\n format.html { redirect_to baz1s_url, notice: \"Baz1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\n @brag = Brag.find(params[:id])\n @brag.destroy\n\n respond_to do |format|\n format.html { redirect_to brags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bbhk.destroy\n respond_to do |format|\n format.html { redirect_to bbhks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @location = Location.find(params[:id])\r\n RemovedLocation.create(server_id: Integer(params[:id]))\r\n directory = Rails.root.join('app','assets','locations');\r\n\r\n path = File.join(directory, @location.image)\r\n File.delete(path)\r\n @location.destroy\r\n mv = MapsVersion.first\r\n mv.version = mv.version+1\r\n mv.save\r\n respond_to do |format|\r\n format.html { redirect_to locations_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @makrana_marble.destroy\n respond_to do |format|\n format.html { redirect_to makrana_marbles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bb = Bb.find(params[:id])\n @bb.destroy\n\n respond_to do |format|\n format.html { redirect_to bbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #File.delete(\"app/assets/songs/\"[email protected])\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url, :flash => {:success => 'Song was successfully destroyed.'} }\n format.json { head :no_content }\n end\n end",
"def destroy\n @static_content.destroy\n respond_to do |format|\n format.html { redirect_to static_contents_url, notice: \"Static content was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @singlepart.destroy\n respond_to do |format|\n format.html { redirect_to singleparts_url, notice: 'Singlepart was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brave_burst.destroy\n respond_to do |format|\n format.html { redirect_to brave_bursts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @broad = Broad.find(params[:id])\n @broad.destroy\n\n respond_to do |format|\n format.html { redirect_to broads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testfile.destroy\n respond_to do |format|\n format.html { redirect_to materials_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n head :no_content\n end",
"def destroy\n head :no_content\n end",
"def destroy\n @bdatabase = Bdatabase.find(params[:id])\n @bdatabase.destroy\n\n respond_to do |format|\n format.html { redirect_to bdatabases_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.69888973",
"0.6659261",
"0.6627805",
"0.6627805",
"0.6627805",
"0.6627805",
"0.6627805",
"0.65069485",
"0.648206",
"0.64722663",
"0.6464805",
"0.644266",
"0.6431193",
"0.6431193",
"0.6431193",
"0.6431193",
"0.6409544",
"0.6395895",
"0.6392431",
"0.6387701",
"0.6368856",
"0.6364482",
"0.6362429",
"0.63611716",
"0.63584197",
"0.63578755",
"0.6334314",
"0.6333593",
"0.63222826",
"0.6320602",
"0.6316595",
"0.62963897",
"0.62937975",
"0.62926537",
"0.62808347",
"0.6272849",
"0.62607163",
"0.6258521",
"0.6257793",
"0.62542015",
"0.6248827",
"0.6242728",
"0.62378377",
"0.6237507",
"0.6237507",
"0.6235748",
"0.6235748",
"0.62329656",
"0.62306273",
"0.6228283",
"0.62268883",
"0.62265563",
"0.6223465",
"0.6222495",
"0.62219554",
"0.6216281",
"0.62124586",
"0.621105",
"0.62089115",
"0.62043995",
"0.6203563",
"0.61958957",
"0.619563",
"0.6195604",
"0.6195486",
"0.61949086",
"0.6191415",
"0.6185743",
"0.6177978",
"0.61709553",
"0.6169255",
"0.61684006",
"0.61673564",
"0.61598015",
"0.61549956",
"0.6154629",
"0.61537474",
"0.6153368",
"0.6151052",
"0.6151052",
"0.6150508",
"0.614828",
"0.61476725",
"0.6145528",
"0.6145528",
"0.61440516",
"0.61440396",
"0.6139831",
"0.6138277",
"0.6134723",
"0.6134319",
"0.6128507",
"0.6128279",
"0.61198336",
"0.6116372",
"0.61158997",
"0.611539",
"0.61153746",
"0.61153746",
"0.6115177"
] | 0.66546935 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_mbracket
@mbracket = Mbracket.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 mbracket_params
params.require(:mbracket).permit(:name)
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 |
Read a save file, and attempt to initialize a game from it | def load_game
print_saves
begin
read_save
rescue IOError, SystemCallError
puts 'File not found'
load_game
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load\n file_name = ask_save_file\n save_file = File.open(file_name, 'r')\n save_file.pos = 0\n contents = unserialize(save_file.read)\n @name = contents['name']\n @guess = contents['guess']\n @word = contents['word']\n @bank = contents['bank']\n @lives = contents['lives']\n @letter = contents['letter']\n puts \"Game has been loaded from Save File #{file_name[-5]}!\"\n puts \"\\n\\n\"\n end",
"def load_game\n save_file = YAML.load(File.read('save_game.yml'))\n @guess = save_file['guess']\n @secret_word = save_file['secret_word']\n @word_teaser = save_file['word_teaser']\n @lives = save_file['lives']\n round_start\n end",
"def load_game\n file = File.open(\"../saves/log.yml\", \"r\")\n s_log = file.read.to_i\n file.close\n if s_log == 0\n puts \"No save data.\"\n else\n puts \"Select a save file (1 to #{s_log}).\"\n s_choice = gets.chomp.to_i\n if s_choice <= s_log\n puts \"Loading save game # #{s_choice}...\"\n game_state = YAML.load(File.read(\"../saves/save_#{s_choice}.yml\"))\n game_state.play\n else\n puts \"Selected save file does not exist.\"\n end\n end\n end",
"def load_game_from_save\n #TODO implement game state saving and loading\n end",
"def load_game\n if File.exists?(@save_file)\n File.open(@save_file, 'r') do |f|\n @hero = Marshal.load(f)\n end\n @cmd_window.setpos(0,0)\n @cmd_window << \"Game loaded!\".rjust(CMD_WIDTH)\n else\n @cmd_window.setpos(0,0)\n @cmd_window << \"No save file found!\".rjust(CMD_WIDTH)\n end\n end",
"def load_game(i)\n sys('load')\n File.open(filename(i), \"rb\") do |file|\n Marshal.load(file)\n extract_save_contents(Marshal.load(file))\n $game.reload\n @index = i\n end\n return true\n end",
"def load #TODO: validation\n \tputs \"What game do you want to load?\"\n \tsaved_game = gets.chomp.gsub(' ', '_')\n \tsaved_game = \"#{saved_game}.yaml\"\n \tload_game(saved_game)\n end",
"def load_game\n\t\tload_gameplay = YAML.load(File.read 'saved_game.yaml')\n\t\t@board = load_gameplay[0]\n\t\t@current_player = load_gameplay[1]\n\t\tshow_board\n\t\tinput_validation\n\tend",
"def load_into_cog(filename: 'savefile')\n game_state = nil\n File.open(\"saves/#{filename}.bin\", 'rb') do |f|\n game_state = Marshal.load(f)\n end\n save_cog(game_state: game_state, filename: filename)\n end",
"def load_state\n begin\n save_file = File.read(\"saved_state.json\")\n rescue\n return \"No saved game found\"\n end\n json_hash = JSON.parse(save_file)\n json_hash[\"json_board\"].each do |key, value|\n value == nil ? @board[key] = nil : \n @board[key] = Chess.const_get(value[\"class\"]).new(value[\"team\"])\n end\n @current_player = json_hash[\"current_player\"]\n return \"Game loaded\"\n end",
"def init_gamedata\r\n file = File.open(@filename, \"r\")\r\n @time_stamp = file.mtime\r\n @characters = Marshal.load(file)\r\n @frame_count = Marshal.load(file)\r\n @game_system = Marshal.load(file)\r\n @game_switches = Marshal.load(file)\r\n @game_variables = Marshal.load(file)\r\n @total_sec = @frame_count / Graphics.frame_rate\r\n file.close\r\n end",
"def load_state file=nil\n file=App.outpath + \"save.rb\" if file.nil?\n f=File.open(file,'r')\n content=f.read\n # puts content\n App.out= YAML.load(content)\n f.close\nend",
"def initialize(file, game)\n @file = file\n @game = game\n end",
"def load \n \tputs \"Type 'load' to load an existing game, or press Enter to continue.\"\n \tanswer = gets.chomp.downcase\n \tif answer == 'load'\n data = YAML.load_file('store.yml')\n @turns = data.turns\n @lives = data.lives\n @wrong = data.wrong\n @right = data.right\n @word= data.word\n puts \"Loading...\"\n sleep(2)\n end\n\n end",
"def load_game\n\t\tall_saved_games = yaml_load(SAVED_FILENAME)\n\t\tgame_name = get_game_name(all_saved_games, \"load\")\n\t\treturn if game_name.nil?\n\n\t\tsaved_game = YAML::load(all_saved_games[game_name])\n\t\tmessage_then_enter \"'#{ game_name }' successfully loaded.\"\n\t\tsaved_game.play_game\n\tend",
"def load_or_new_game\n puts \"Welcome to Hangman!\"\n if File.exist?(\"savefile.txt\")\n puts \"Would you like to (1) load your saved game or (2) start a new game? Please enter 1 or 2.\"\n answer = gets.chomp\n if answer == \"1\"\n save_state = File.read(\"savefile.txt\")\n status = YAML.load(save_state)\n File.delete(\"savefile.txt\")\n else\n status = start_game\n end\n else \n status = start_game\n end\n show_board(status)\n return status\n end",
"def load_file(filename)\n file = File.open(filename, \"r\")\n grid = JSON.parse(file.read)\n file.close\n return Game.new(grid.length, grid[0].length, grid)\nend",
"def load_game\n begin\n display_saves\n choice = gets.chomp\n raise StandardError, 'Please choose an option from the above list.' unless choice.to_i.between?(0,\n Dir.children('./saves').size - 1)\n rescue StandardError => e\n puts e.message\n retry\n end\n\n \"./saves/#{Dir.children('./saves')[choice.to_i]}\"\nend",
"def load\n puts \"Would you like to load your previous game? (y/n)\"\n puts \"\"\n response = gets.strip.downcase\n puts \"\"\n if response == \"y\" && File.exist?(\"saves.yaml\")\n save = File.read(\"saves.yaml\")\n @computer = YAML::load(save)\n puts \"Your game has been loaded!\"\n puts \"\"\n else\n puts \"New game created!\"\n puts \"\"\n end\n end",
"def load_save\n return {} unless File.exist?(DEFAULT_SAVE)\n\n save_file_contents = YAML.unsafe_load_file(DEFAULT_SAVE)\n save_file_contents ||= {} # if game save file is empty\n\n raise GameSaveError, 'Invalid game save format.' unless save_file_contents.is_a?(Hash)\n\n save_file_contents.to_symbolized_hash\n end",
"def save_game\n\t\tputs \"Type a name for your saved game\"\n\t\tgame_name = gets.chomp\t\n\t\tfilename = \"#{game_name}.yml\"\n\n\t\t ex_file = File.expand_path(\"./saved_games/#{filename}\")\n\t\t \n\t\tif File.exists?(ex_file)\n\t puts \"#{filename} exists\" #overwrite method?\n\t \n\t self.save_game\n\t else\n\t\t\tFile.open(ex_file, \"w\") do |f|\n\t\t\t\tgame_state = YAML::dump(self)\n\t\t\t\tf.puts game_state\n\t\t\t\tputs \"Your game was saved as #{filename}\" \n\t\t\tend\n\t\tend\n\tend",
"def load_gamedata\n @time_stamp = Time.at(0)\n @file_exist = FileTest.exist?(@filename)\n if @file_exist\n file = File.open(@filename, \"r\")\n @time_stamp = file.mtime\n begin\n @characters = Marshal.load(file)\n @frame_count = Marshal.load(file)\n @last_bgm = Marshal.load(file)\n @last_bgs = Marshal.load(file)\n @game_system = Marshal.load(file)\n @game_message = Marshal.load(file)\n @game_switches = Marshal.load(file)\n @game_variables = Marshal.load(file)\n @total_sec = @frame_count / Graphics.frame_rate\n rescue\n @file_exist = false\n ensure\n file.close\n end\n end\n end",
"def start_game\n puts \"What would you like to do?\"\n puts \"1. Load Saved Game\"\n puts \"2. Start New Game\"\n choice = gets.chomp\n if choice == \"1\"\n find_save_file\n elsif choice == \"2\"\n initialize\n end\n end",
"def start_game\n puts \"What would you like to do?\"\n puts \"1. Load Saved Game\"\n puts \"2. Start New Game\"\n choice = gets.chomp\n if choice == \"1\"\n find_save_file\n elsif choice == \"2\"\n initialize\n end\n end",
"def load_menu\n\t\ti = 1\n File.new(\"saved_games.yaml\",\"w\") unless File.exist?(\"saved_games.yaml\")\n if File.read(\"saved_games.yaml\").empty?\n puts \"There are no saved games, yet.\"\n initialize\n else\n YAML.load_stream(File.open(\"saved_games.yaml\")) do |saved_game|\n puts \"#{i}: \" + saved_game[-1].strftime(\"%m/%d/%Y %I:%M%P\")\n i += 1\n end\n puts \"\"\n puts \"Choose a game to load or \\\"exit\\\" to menu:\"\n game_index = gets.chomp.strip.downcase\n if game_index == \"exit\"\n initialize\n elsif game_index.to_i <= i && game_index.to_i >= 1\n game_index = game_index.to_i\n i = 1\n File.new(\"temp.yaml\",\"w\")\n puts \"\"\n YAML.load_stream(File.open(\"saved_games.yaml\")) do |game|\n if i == game_index\n \t@gameboard = game[0]\n @pieces = game[1]\n @player_color = game[2]\n else\n File.open(\"temp.yaml\",\"a\") do |out|\n YAML::dump(game,out)\n end\n end\n i += 1\n end\n File.delete(\"saved_games.yaml\")\n File.rename(\"temp.yaml\",\"saved_games.yaml\")\n Chess.new(@gameboard,@pieces,@player_color)\n else\n puts \"Invalid input. Try again...\"\n puts \"\"\n load_menu\n end\n end\n\tend",
"def initialise(loadfile)\n\n # Initialise steps\n\n phases = Phases.new\n $commands = Commands.new\n \n if $testing == 1\n require_relative 'Testing.rb'\n require_relative '../Extra/Parser.rb'\n end\n \n if $debugplay == 1\n $debug.debugplay\n end\n \n # Initialise graphics if graphics mode is on\n #if $graphics == 1\n #require 'RMagick'\n require_relative '../Graphics/GraphicsHandler.rb'\n #graphicsinit\n #end\n \n #system(\"unzip ../Resources/Images.zip\")\n \n \n # Load game\n if $loadgame == true\n loadgame(loadfile)\n end\n \n # Set command authentication levels\n IO.foreach(\"cards.txt\") { |line| puts line }\n \nend",
"def save_game\n\t\tputs \"Type a name for your saved game\"\n\t\tgame_name = gets.chomp\n\t\tfilename = \"#{game_name}.txt\"\n\n\t\t ex_file = File.expand_path(\"./saved_games/#{filename}\")\n\t\t \n\t\tif File.exists?(ex_file)\n\t puts \"#{filename} exists\" #overwrite method?\n\t \n\t self.save_game\n\t else\n\t\t\tFile.open(ex_file, \"w\") do |f|\n\n\t\t\t\tf.puts YAML::dump(game_state)\n\n\t\t\t\tputs \"Your game was saved as #{filename}\" \n\t\t\tend\n\t\tend\n\tend",
"def load file='GOL.sav'\n self.state=File.open(file,'r') do |f|\n Marshal.load(f)\n end\n end",
"def save_game\n save_data = YAML::dump(self)\n puts \"Please enter a name for your save game:\"\n prompt\n @filename = gets.chomp\n File.open(\"./saved/#{@filename}\", \"w\") { |file| file.write(save_data)}\n puts \"Saved\"\n get_input\n end",
"def find_save_file\n if File.exist?(\"save.txt\")\n save_file = File.read(\"save.txt\")\n load_save(save_file)\n else\n puts \"No save found!\"\n end\n end",
"def load_game\n require './game/setup.rb'\n end",
"def load\n return false unless File.file?(FILENAME)\n file = File.new(FILENAME, 'r')\n file = Zlib::GzipReader.new(file)\n state = Marshal.load(file.read)\n file.close\n reset(state)\n puts \"Bot state loaded.\"\n end",
"def initialize(path=\"\",rows = nil, cols= nil, mode = \"\", level=\"\", time = 0)\n\t\tif path != \"\"\n\t\t\t@level = path.split(\"&\")[1]\n\t\t\t@mode = path.split(\"&\")[0]\n\t\t\tpath = File.dirname(__FILE__) + \"/Saves/\"+path\n\t\t\t@path = Pathname.new(path)\n\t\t\tdata = YAML.load_file(path)\n\t\telse\n\t\t\tdate = Time.now\n\t\t\t@level = level\n\t\t\t@path = Pathname.new(File.dirname(__FILE__) + \"/Saves/\"+mode+\"&\"+level+\"&\"+date.to_s.split(' ').join('_')+\".yml\")\n\t\t\tdata = {\"rows\"=>rows, \"cols\"=>cols , \"moves\"=>Moves.new , \"time\"=>time, \"nbGames\" => 0}\n\t\t\tFile.open(@path.to_s, \"w\") {|out| out.puts data.to_yaml }\n\t\tend\n\t\t@rows = data[\"rows\"]\n\t\t@cols = data[\"cols\"]\n\t\t@moves = data[\"moves\"]\n\t\t@time = data[\"time\"]\n\t\t@nbGames = data[\"nbGames\"]\n\tend",
"def save_game\n file_name = input_save_name\n begin\n Dir.mkdir('saves') unless Dir.exist?('saves')\n save_file = File.new(file_name, 'w')\n save_file.puts generate_save\n save_file.close\n puts 'Game saved!'\n rescue IOError\n puts 'Save failed'\n end\n end",
"def save_game\n #yaml = YAML::dump(self)\n puts \"Please enter a filename for the saved game.\"\n save_file_name = gets.chomp.downcase\n save_file = File.write(\"saved_games/#{save_file_name}.yaml\", self.to_yaml)\n #save_file.write(yaml)\n puts \"Your game has been saved!\"\n puts \"Goodbye!\"\n end",
"def find_save_file\n if File.exist?(\"./lib/save.txt\")\n save_file = File.read(\"./lib/save.txt\")\n load_save(save_file)\n else\n puts \"No save found!\"\n end\n end",
"def load_game\n\tsettings.game_data = Ben::Game.load\n\tgame_json\nend",
"def load_hero_file\n clear_message_box\n #ask for file\n @ui.set_colour(DungeonOfDoom::C_BLACK_ON_YELLOW)\n @ui.place_text('USE CHARACTER FILE?'.ljust(20),1,2)\n @ui.place_text('>'.ljust(20),1,3)\n file_name=nil\n #loop until file is good\n while file_name.nil?\n @ui.place_text(' '*19,2,3)\n file_name = @ui.get_string(2,3)\n #check and try to open file\n if file_name.split('.').last != 'yaml' #needs yaml extention\n @ui.place_text('!REQUIRES YAML EXT'.ljust(20),1,4)\n file_name=nil\n elsif !File.exists?(file_name) #file must exist\n @ui.place_text('!FILE NOT FOUND'.ljust(20),1,4)\n file_name=nil\n else\n hero_data = YAML.load(File.open(file_name))\n if hero_data.is_a? Hash #file must be in a valid yaml format\n #load stats\n hero_data[:stats].each do |stat|\n @stats[stat[0].downcase.to_sym] = stat[1]\n end\n @orig_stats.merge!(@stats) #make a copy\n #load objects\n @objects = hero_data[:objects]\n #load remaining gold (used for final score)\n @gold_count += hero_data[:gold]\n #display heros name\n @ui.place_text(hero_data[:name].center(20), 1, 1, DungeonOfDoom::C_BLACK_ON_WHITE)\n #set magic spell count based on 2 x power of NECRONOMICON and SCROLLS\n book = @objects.find { |object| object[:name]=='NECRONOMICON' }\n if book\n power = book[:power]\n [:super_zap, :santuary, :teleport].each do |spell|\n @spells[spell] = power\n end\n end\n scroll = @objects.find { |object| object[:name]=='SCROLLS' }\n if scroll\n power = scroll[:power]\n [:powersurge, :metamorphosis, :healing].each do |spell|\n @spells[spell] = power\n end\n end\n #set torch power\n torch = @objects.find { |object| object[:name]=='TORCH' }\n @torch_power = torch[:power] if torch\n #find initial potion count\n potion = @objects.find { |object| object[:name]=='POTION' }\n @potions += potion[:count] if potion\n #find initial attack power\n ['2 HAND SWORD','BROADSWORD','SHORTSWORD','AXE','MACE','FLAIL','DAGGER','GAUNTLET'].each do |item|\n object = @objects.find { |object| object[:name]==item }\n @attack += object[:power] if object\n end\n @attack += @stats[:strength]\n #find initial defence power\n ['HEAVY ARMOUR','CHAIN ARMOUR','LEATHER SKINS','HEAVY ROBE','GOLD HELMET','HEADPIECE','SHIELD'].each do |item|\n object = @objects.find { |object| object[:name]==item }\n @defence += object[:power] if object\n end\n else #all okay!\n @ui.place_text('!FILE BAD FORMAT'.ljust(20),1,4)\n file_name=nil\n end\n end\n end\n end",
"def load_game\nputs \"Please choose one of the below saved profiles:\"\nsystem (\"ls *.ca\")\nprint \":\"\n$name = gets.chomp\n$file_name = $name + \".ca\"\nwhile(!system(\"test -e '#{$file_name}'\")) do\nputs \"Such profile does not exits, please choose a valid one.\"\nsystem (\"ls *.ca\")\nprint \":\"\n$name = gets.chomp\n$file_name = $name + \".ca\"\nend\ninfo = IO.readlines(\"#{$file_name}\") # info is a array and each index value is the info of a line info[3] = info that is on line number three.\n# now info is acctualy being loaded intro the system variables\n$name = info[0]\n$lvl = info[1]\n$gold = info[2]\nfor i in 3..((info.length)-1) do\n$inventory[$inventory.length] = info[i] # with $inventory.length start from 0 becuse it's initial null it will automaticaly grow\nend\nputs \"Loading please wait...\"\nsleep(2)\nprint \"............\"\nsleep(1)\nputs \"............\"\nputs $name\nputs $gold\nputs $lvl\nputs $inventory\n####call the level method\nend",
"def save_game\n Dir.mkdir(\"../saves\") unless Dir.exists?(\"../saves\")\n @@save_count += 1\n binding.pry\n log_saves\n savefile = \"../saves/save_#{@@save_count}.yml\"\n File.open(savefile, 'w') do | file |\n file.write(self.to_yaml)\n end\n end",
"def load_game\n begin\n player = YAML.load_file(\"player.yaml\")\n return player\n rescue\n return nil\n end\nend",
"def load_file(filename)\n full_file = File.expand_path(filename, @dispatch.save_dir)\n save_dir(full_file)\n begin\n File.new(full_file, 'r').each do |line|\n break unless load(full_file, $., line)\n end\n rescue\n puts \"Error loading file #{full_file}\"\n end\n restore_dir\n end",
"def initialize(file = \"\")\n @file = file\n @replays = []\n\n load if File.exist?(file)\n end",
"def load_game\n puts \"Would you like to load a saved game?\"\n puts \"Enter \\\"y\\\" or \\\"n\\\":\"\n input = gets.chomp\n if input != \"\" && input[0].downcase == \"y\"\n game = YAML.load(File.read(\"hangman.yaml\"))\n @word = game[:word]\n @max_turn = game[:max_turn]\n @current_turn = game[:current_turn]\n @display_word = game[:display_word]\n @current_guess = game[:current_turn]\n end\n puts \"Game is loaded!\"\n end",
"def load_saved_file\n\n begin\n parse_json_file('./data/user_data.json')\n\n puts \"Great to have you back #{@parsed_data[:userdata][:username]}!\"\n attribute_data_from_parsed_file()\n\n @prompt.keypress(Rainbow('Please press space or enter to continue!').orange.to_s, keys: %i[space return])\n\n rescue\n puts \"It appears that no previous file exists. Sorry... it just doesn't....\"\n\n @prompt.keypress(Rainbow('Please press space or enter to return!').orange.to_s,keys: %i[space return])\n\n upload_data_from_file()\n\n end\n\n end",
"def load_state\n save_file = File.read(\"saved_state.json\")\n json_hash = JSON.parse(save_file)\n @secret_word = json_hash[\"secret_word\"]\n @display_content = json_hash[\"display_content\"]\n @failed_attemps = json_hash[\"failed_attemps\"]\n end",
"def loader_helper\n\t\tif !(Dir.exists? \"saves\") || Dir[\"saves/*\"].length == 0\n\t\t\tputs \"There are no save files...Starting game.\"\n\t\t\treturn false\n\t\tend\n\t\tsaves = Dir.entries(\"saves\")\n\t\tsaves.delete(\".\")\n\t\tsaves.delete(\"..\")\n\t\tputs \"The save files are: #{saves.join(\", \")}\"\n\t\tprint \"Type the save name: \"\n\t\tsave = gets.chomp\n\t\tunless saves.include? save\n\t\t\tputs \"That file doesn't exist. Try again.\\n\\n\"\n\t\t\tsave = loader_helper \n\t\tend\n\t\tsave\n\tend",
"def load()\n code = File.open(@filename) {|file| file.read}\n dup = @players.last.dup\n begin\n dup.reset\n dup.instance_eval(code)\n @players.push(dup)\n rescue\n puts \"LOAD ERROR #{$!}\"\n end\n @load_time = Time.now.to_i\n end",
"def load\n if File.exists? @file\n @main = YAML::load_file @file\n else\n self.load_defaults\n end\n end",
"def initialize(name = 'Kasih', file_name='./dictionary.txt')\n @name = name\n @full_dictionary = import_dictionary(file_name)\n @dictionary = @full_dictionary.dup\n @guessed_letters = [] #must reset at the end!\n @new_game = true\n end",
"def load_game_from_map(map_path)\n $LOGGER.info \"Loading map from file. Path: '#{map_path}'\"\n begin\n game_state = Game::GameState.new [Map::GameMap.new(Map.load_map(map_path))], Character::Character.new\n $LOGGER.info \"Map with id: '#{game_state.current_map}' loaded successful.\"\n return game_state\n rescue Map::MapParseException, NoMethodError => e\n $LOGGER.error \"Errors occured while map loading:\"\n $LOGGER.error e.message\n fail e\n end\n end",
"def new_game(saver)\n File.open(\"#{saver}\",\"a\") do |line|\n write_to = open(Player.my_name, 'w')\n write_to.write(Player.my_name)\n write_to.write(\"\\n\")\n write_to.write(Player.type)\n write_to.write(\"\\n\")\n write_to.write(Player.location)\n write_to.write(\"\\n\")\n write_to.write(Player.x_pos)\n write_to.write(\"\\n\")\n write_to.write(Player.y_pos)\n write_to.write(\"\\n\")\n write_to.write(Player.exp_to_next_lvl)\n write_to.write(\"\\n\")\n write_to.write(Player.cur_exp)\n write_to.write(\"\\n\")\n write_to.write(Player.fatigue)\n write_to.write(\"\\n\")\n write_to.write(Player.stats.agility)\n write_to.write(\"\\n\")\n write_to.write(Player.stats.attack)\n write_to.write(\"\\n\")\n write_to.write(Player.stats.defense)\n write_to.write(\"\\n\")\n write_to.write(Player.stats.health_cur)\n write_to.write(\"\\n\")\n write_to.write(Player.stats.health_max)\n write_to.write(\"\\n\")\n write_to.write(Player.stats.vitality)\n write_to.write(\"\\n\")\n write_to.write(Player.inventory.name)\n write_to.write(\"\\n\")\n write_to.write(Player.level)\n write_to.write(\"\\n\")\n end\nend",
"def loadGame()\n\nend",
"def initialize(path, load=nil)\n @path = path\n @inihash = {}\n \n if load or ( load.nil? and FileTest.readable_real? @path )\n restore()\n end\n end",
"def save_game\n\t\tDir.mkdir('saved_games') unless Dir.exist? 'saved_games'\n\t\tDir.chdir(\"saved_games\")\n\t\tdata = save\n\t\tFile.open(\"save.yaml\", \"w\") do |file|\n\t\t\tsaved_games = YAML::dump(data)\n\t\t\tfile.write(saved_games)\n\t\tend\n\t\tputs \"Games Saved!!\"\n\t\tabort\n\tend",
"def load_file(filename); end",
"def load_file(filename); end",
"def save_game(game)\n print \"Enter a new filename to save game in: \"\n filename = gets.chomp\n File.open(filename, \"w\") {|f| f.puts game.to_yaml}\nend",
"def save_game \n File.open('hangman_save.yml', 'w') { |f| YAML.dump(self,f)}\n exit\n end",
"def load(filename)\n end",
"def load_game(file) \n raise \"I suspect you of cheating.\" if File.mtime(file) != Time.at(File.readlines(file).last.to_i)\nend",
"def save_game\n store = YAML.dump(self)\n File.open('lib/saved_game.yml', 'w') do |file|\n file.puts(store)\n end\n puts 'your game has been saved!'\n end",
"def load_game\n\t\tprint \"Load game (y/n): \"\n\t\tload = gets.chomp.downcase[0]\n\t\treturn false if load == 'n'\n\t\treturn loader if load == 'y'\n\t\tload_game if (load != 'n' || load != 'y')\n\tend",
"def initialize(slot_name, filename)\n @slot_name = slot_name\n if FileTest.exist?(filename)\n @used = true\n # Start load data\n file = File.open(filename, \"r\")\n @time = file.mtime\n @characters = Marshal.load(file)\n @frame_count = Marshal.load(file)\n @last_bgm = Marshal.load(file)\n @last_bgs = Marshal.load(file)\n @game_sys = Marshal.load(file)\n @game_mes = Marshal.load(file)\n @game_swi = Marshal.load(file)\n @game_var = Marshal.load(file)\n @game_self_swi = Marshal.load(file)\n @game_act = Marshal.load(file)\n @game_par = Marshal.load(file)\n @game_tro = Marshal.load(file)\n @game_map = Marshal.load(file)\n @game_pla = Marshal.load(file)\n @screenshot_stream = Marshal.load(file)\n file.close\n else\n @used = false\n end\n end",
"def load\n input(@infile)\n true\n end",
"def initialize\n Game.engine.draw(Game.engine.markdown.parse('# Bandit Mayhem'))\n selection = Game.engine.prompt.select('Select an option', 'New game', 'Load game', 'Quit')\n\n case selection\n when 'New game'\n save_name = Game.engine.prompt.ask('Enter save name:', default: 'bandit-mayhem')\n\n Game.player = Player.new(name: 'Nigel', health: 30, x: 1, y: 5, map: BanditMayhem::Map::Map.new('lynwood/strick_household'))\n\n # intro\n Cinematic.new('intro').play\n\n @quit = false\n when 'Load game'\n Game.load_save if File.exist?(DEFAULT_SAVE)\n # TODO fix\n # Game.player = Player.new(name: 'Nigel', health: 30, x: 1, y: 5, map: BanditMayhem::Map::Map.new('lynwood/strick_household'))\n @quit = false\n when 'Quit'\n @quit = true\n end\n end",
"def load_prompt\n puts 'Do you want to load a saved game? (yes/no)'\n answer = gets.chomp\n if answer == 'yes'\n load_game\n else\n puts \"Enter 'save' to save the game between turns\"\n round_start\n end\n end",
"def save(game)\n\t\tprint \"Name the save: \"\n\t\tsave_name = gets.chomp.downcase\n\t\tDir.mkdir \"saves\" unless Dir.exists? \"saves\"\n\t\tfile_path = File.join(\"saves\", \"#{save_name}\")\n\t\tFile.open(file_path, \"w\") { |f|\n\t\t\tf.write(YAML.dump(game))\n\t\t}\n\t\tputs \"The game has been saved!\"\n\tend",
"def load\n config = YAML.load_file @config_path\n @path = config['steam']\n end",
"def test_serialize\n first=[[0,0,0],[0,0,0],[0,0,0]]\n f1='test_first.sav'\n\n second=[[0,1,0],[1,0,1],[0,1,0]]\n f2='test_second.sav'\n\n @game.state=first\n @game.save f1\n @game.state=second\n @game.save f2\n\n @game.load f1\n assert_equal first,@game.state\n\n @game.load f2\n assert_equal second,@game.state\n\n File.delete('test_first.sav')\n File.delete('test_second.sav')\n end",
"def loader\n\t\tsave = loader_helper\n\t\tif save\n\t\t\tFile.open(\"saves/#{save}\", 'r'){ |f|\n\t\t\t\treturn YAML.load(f)\n\t\t\t} \n\t\tend\n\t\tfalse\n\tend",
"def save_game\n\t\tputs \"To save game please provide a game name. Please only use letters, numbers and underscores\"\n\t\tinput = gets.chomp.downcase\n\t\tvalid = input.index(/[^\\d,\\w,_]/)\n\t\tuntil !valid\n\t\t\tputs \"Please enter a valid name\"\n\t\t\tinput = gets.chomp.downcase\t\n\t\t\tvalid = input.index(/[^\\d+,\\w+, _+]/)\t\t\t\n\t\tend\n\t\tputs \"Saving #{input}\"\n\t\tyaml = YAML::dump(self)\n\t\tif !Dir.exists?(\"saved\")\n\t\t\tDir.mkdir(\"saved\") \n\t\tend\n\t\tsave_file = File.open(\"saved/#{input}.yaml\", 'w')\n\t\tsave_file.write(yaml)\n\t\tsave_file.close\n\t\tputs \"Game Saved!\"\n\t\texit\n\tend",
"def load(file = @monster.filename, dir = @monster.work_dir, *_args)\n path = get_path(file, dir)\n a = split_canvas(ChunkyPNG::Canvas.from_file(path))\n h = { rom: @rom, index: @index }\n\n normal_rgb = a[0].to_rgb_stream + a[2].to_rgb_stream\n shiny_rgb = a[1].to_rgb_stream + a[3].to_rgb_stream\n\n @palettes = Palette.create_synced_palettes(\n normal_rgb,\n shiny_rgb,\n h.merge(table: :palette_table),\n h.merge(table: :shinypal_table)\n )\n\n frames = @rom.special_frames.fetch(@index, @rom.frames)\n front = crop_canvas(a[0], frames.first * 64)\n back = crop_canvas(a[2], frames.last * 64)\n\n @sprites = [\n Sprite.from_canvas(\n front,\n @palettes.first,\n h.merge(table: :front_table)\n ),\n Sprite.from_canvas(\n back,\n @palettes.first,\n h.merge(table: :back_table)\n )\n ]\n\n justify\n self\n end",
"def set_up_local_data\n Player.deserialize_from_file('players.dat')\n Game.deserialize_from_file('games.dat')\n Performance.deserialize_from_file('performance.dat')\n end",
"def load(filename)\n\t\tend",
"def load_game?\n\t\tputs \"Would you like to load a previously saved game\"\n\t\tputs \"(yes or no)\"\n\t\tanswer = gets.chomp.downcase\n\t\tif answer == \"yes\"\n\t\t\tload\n\t\telsif answer == \"no\"\n\t\t\treturn\n\t\telse\n\t\t\tputs \"I did not understand that answer, try again\"\n\t\t\tload_game?\n\t\tend\n\tend",
"def initialize(path)\n File.open(path, 'rb') do |file|\n num_players = file.size / PLAYER_LENGTH\n @players = Buffer2d.new(num_players, PLAYER_LENGTH, nil)\n num_players.times do |x|\n player = file.read(PLAYER_LENGTH).chars\n @players.write_vert(x, 0, player)\n end\n\n puts \"Players file contains #{num_players} players.\"\n\n # modify_attribute(4, ATTRIBUTE_INFO[:name], 'sheeit')\n # modify_attribute(4, ATTRIBUTE_INFO[:exp], 100000)\n\n modify_attribute(4, ATTRIBUTE_INFO[:hp], 13200)\n\n modify_attribute(4, ATTRIBUTE_INFO[:level], 25)\n\n modify_attribute(4, ATTRIBUTE_INFO[:shield], 72)\n modify_attribute(4, ATTRIBUTE_INFO[:cloak], 72)\n modify_attribute(4, ATTRIBUTE_INFO[:boots], 72)\n modify_attribute(4, ATTRIBUTE_INFO[:ring], 72)\n modify_attribute(4, ATTRIBUTE_INFO[:weapon], 72)\n modify_attribute(4, ATTRIBUTE_INFO[:armor], 72)\n\n modify_attribute(4, ATTRIBUTE_INFO[:str], 32)\n modify_attribute(4, ATTRIBUTE_INFO[:int], 32)\n modify_attribute(4, ATTRIBUTE_INFO[:wis], 32)\n modify_attribute(4, ATTRIBUTE_INFO[:con], 32)\n modify_attribute(4, ATTRIBUTE_INFO[:dex], 32)\n modify_attribute(4, ATTRIBUTE_INFO[:cha], 32)\n\n compare\n print_by_attribute\n\n save_players\n end\n end",
"def load_state\n begin\n if File.file?(\"#{$statefile}\") && File.readable?(\"#{$statefile}\") \n @current_state = File.read(\"#{$statefile}\").strip.split(':')\n end\n rescue\n error('Invalid Resume Point')\n exit 1\n end\n end",
"def get_game\n\t\tif @file_exists == 1\n\t\t\t# If the file exists, but there are no rows in it, there are no saved games\n\t\t\tif @data.length == 0\n\t\t\t\tputs \"Oops, you have no saved games.\"\n\t\t\t\tputs \"Here, start a new one!\"\n\t\t\t\tputs\n\t\t\t\tnew_game\n\t\t\telse\n\t\t\t\tputs \"Which game?\"\n\t\t\t\t# Display each partially guessed word like: \"1. _ e _ _ t\"\n\t\t\t\[email protected]_with_index { |row, i| puts \"#{i+1}. #{row[1].split(\"\").join(\" \")}\" }\n\t\t\t\t# Get user's choice\n\t\t\t\tgame = gets.chomp.to_i\n\t\t\t\t# If the user entered a number that appears on the board...\n\t\t\t\tif game.between?(1,@data.length)\n\t\t\t\t\t# Get all info out of chosen row\n\t\t\t\t\t@word = @data[game-1][0].split(\"\").to_a\n\t\t\t\t\t@guess = @data[game-1][1]\n\t\t\t\t\t@wrong_letters = @data[game-1][2]\n\t\t\t\t\t@turn = @data[game-1][3].to_i\n\t\t\t\t\t@running_saved_game = (game - 1)\n\t\t\t\t\t# Get the next guess\n\t\t\t\t\tget_guess\n\t\t\t\telse\n\t\t\t\t\tputs \"Not a valid choice! Pick again\"\n\t\t\t\t\tget_game\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tputs \"Oops, you have no saved games.\"\n\t\t\tputs \"Here, start a new one!\"\n\t\t\tputs\n\t\t\tnew_game\n\t\tend\n\tend",
"def start\n puts \"Load game or start new?\"\n puts \"Type 'load' to load a previous save, or type 'new' to start a new game.\"\n game_type = gets.chomp.downcase.strip\n if game_type == \"load\"\n load\n elsif game_type == \"new\"\n load_secret_word\n init_guess_count\n @wrong_guesses = []\n else\n start\n end\n end",
"def initialize(file_index, filename)\n super(0, 56 + file_index % 4 * 90, 544, 90)\n @file_index = file_index\n @filename = filename\n load_gamedata\n refresh\n @selected = false\n end",
"def load(file); end",
"def save\n file_name = ask_save_file\n save_file = File.open(file_name, 'w')\n save_file.puts(serialize)\n save_file.close\n puts \"Game has been saved to Save File #{file_name[-5]}!\"\n puts \"\\n\\n\"\n end",
"def pbRgssOpen(file,mode=nil)\n #File.open(\"debug.txt\",\"ab\") { |fw| fw.write([file,mode,Time.now.to_f].inspect+\"\\r\\n\") }\n if !safeExists?(\"./Game.rgssad\") && !safeExists?(\"./Game.rgss2a\")\n if block_given?\n File.open(file,mode) { |f| yield f }\n return nil\n else\n return File.open(file,mode)\n end\n end\n file = canonicalize(file)\n Marshal.neverload = true\n begin\n str = load_data(file)\n ensure\n Marshal.neverload = false\n end\n if block_given?\n StringInput.open(str) { |f| yield f }\n return nil\n else\n return StringInput.open(str)\n end\nend",
"def pbRgssOpen(file,mode=nil)\n #File.open(\"debug.txt\",\"ab\"){|fw| fw.write([file,mode,Time.now.to_f].inspect+\"\\r\\n\") }\n if !safeExists?(\"./Game.rgssad\") && !safeExists?(\"./Game.rgss2a\")\n if block_given?\n File.open(file,mode){|f| yield f }\n return nil\n else\n return File.open(file,mode)\n end\n end\n file=canonicalize(file)\n Marshal.neverload=true\n begin\n str=load_data(file)\n ensure\n Marshal.neverload=false\n end\n if block_given?\n StringInput.open(str){|f| yield f }\n return nil\n else\n return StringInput.open(str)\n end\nend",
"def initialize(delete_game = false)\n super()\n GameData::Text.load\n @running = true\n @index = 0\n @delete_game = File.exist?(Save.save_filename) & delete_game & (MAXIMUM_SAVE <= 1)\n if @delete_game\n $pokemon_party = PFM::Pokemon_Party.new(false, @pokemon_party.options.language)\n $pokemon_party.expand_global_var\n end\n end",
"def save_game\n Dir.mkdir 'save_files' unless Dir.exists?(\"save_files\")\n\n filename = \"save#{Dir[\"save_files/**/*\"].length}.json\"\n\n save_data = {\n code_word: @code_word,\n good_guesses: @good_guesses,\n bad_guesses: @bad_guesses,\n tries: @tries\n }\n\n File.write(\"save_files/#{filename}\", JSON.dump(save_data))\n end",
"def load_dungeon_file(level)\n clear_message_box\n #ask for file if necessary\n @ui.set_colour(DungeonOfDoom::C_BLACK_ON_YELLOW)\n unless @dungeon_file\n @ui.place_text('USE DUNGEON FILE?'.ljust(20),1,2)\n @ui.place_text('>'.ljust(20),1,3)\n #loop until file is good\n while @dungeon_file.nil?\n @ui.place_text(' '*19,2,3)\n @dungeon_file = @ui.get_string(2,3)\n #check to see if file exists\n unless File.exists?(@dungeon_file) #file must exist\n @ui.place_text('!FILE NOT FOUND'.ljust(20), 1, 4)\n @dungeon_file=nil\n end\n end\n end\n #check if here has enough experience to enter level\n if LEVEL_EXPERIENCE_CHECK && level > @stats[:experience]\n @ui.place_text(MSG_EXP.ljust(20),1,4)\n else\n #all okay, load level and start location\n levels = IO.readlines(@dungeon_file)\n new_level = levels.find do |data|\n #level data should be at position (15x15)+4=229\n data[229..230].to_i == level\n end\n if new_level\n #okay level found\n data = new_level.chars.to_a #make and array of characters\n (0..14).each do |row|\n (0..14).each do |col|\n @room[row][col] = data[(15*row)+col]\n end\n end\n @ui.draw_box(15,15,2,6,DungeonOfDoom::C_WHITE_ON_BLACK)\n @cur_x = (data[225]+data[226]).to_i\n @cur_y = (data[227]+data[228]).to_i\n @current_level = level\n @monster_detected = false\n else\n @ui.place_text(\"!LEVEL #{level} NOT FOUND\".ljust(20),1,4)\n @ui.place_text('!BAD DUNGEON FILE'.ljust(20),1,5)\n end\n end\n end",
"def start_new_game\n # TODO: increment stats\n # stats = GameStats.new\n # stats.game_number += 1\n\n # create new player\n\n\n # print New game text\n new_game_banner = File.read('./old_code/fancy_text/new_game.txt')\n puts new_game_banner\n\n # display into story\n puts display_intro(@player_one.name)\n\n # auto load stage 1\n require './lib/stage'\n Stage.new(1, 5, @player_one)\n end",
"def save_game\n\t\t# If current game was previously saved, delete the old version of current game...\n\t\tif @running_saved_game != nil\n\t\t\tover_write_data\n\t\tend\n\t\t# And add new version of current game to saved data\n\t\tFile.open(@path, 'a+') do |f|\n\t\t\t\tf.puts \"#{@word.join},#{@guess},#{@wrong_letters},#{@turn}\"\n\t\tend\n\tend",
"def save_game(game_state)\n save_file = File.open('save_game.yml', 'w')\n YAML.dump(game_state, save_file)\n save_file.close\n exit\n end",
"def load(file_path); end",
"def load(file_path); end",
"def from_yaml\n\t\tdata = YAML.load File.read(\"save.yaml\")\n\t\t@board = Board.new(data[:board], data[:positions])\n\t\t@current_turn = data[:current_turn]\n\t\t@ai_on = data[:ai_on]\t\t\n\tend",
"def save_game\n\t\tall_saved_games = yaml_load(SAVED_FILENAME)\n\t\tgame_name = get_save_name(all_saved_games)\n\t\treturn if game_name.nil?\n\n\t\tgame_string = self.to_yaml \n\t\tall_saved_games[game_name] = game_string\n\t\tyaml_save(SAVED_FILENAME, all_saved_games)\n\t\tmessage_then_enter \"'#{ game_name }' successfully saved.\"\n\tend",
"def save_game\n puts \"=================================================\"\n puts \"\\nSaving game...\"\n filename = \"../saved_games/hangman_save.json\"\n File.open(filename, \"w\") { |file| file.puts self.serialize }\n puts \"Game Saved.\"\n puts \"\\n=================================================\"\n end",
"def attempt_load_world_from_file\n return if state.world # return if the world collection is already populated\n state.world ||= [] # initialized as an empty collection\n exported_world = gtk.read_file(MAP_FILE_PATH) # reads the file using the path mentioned at top of code\n return unless exported_world # return unless the file read was successful\n state.world = exported_world.each_line.map do |l| # perform action on each line of exported_world\n l.split(',').map(&:to_i) # calls split using ',' as a delimiter, and invokes .map on the collection,\n # calling to_i (converts to integers) on each element\n end\n end",
"def determine_savefile\n if @saving\n if FileTest.exist?(make_filename(@last_slot_index))\n Sound.play_decision\n @confirm_window.show()\n @window_slotlist.active=false\n else\n Sound.play_save\n do_save()\n end\n else\n if FileTest.exist?(make_filename(@last_slot_index))\n Sound.play_load\n do_load()\n else\n Sound.play_buzzer\n end\n end\n end",
"def load_file(file); end",
"def load\n statefile_filename = state_filename\n if File.exist?(statefile_filename) &&\n File.file?(statefile_filename) &&\n File.readable?(statefile_filename)\n $log.debug \"Loading state from #{statefile_filename}\"\n @state = YAML.load_file(statefile_filename)\n else\n $log.debug 'No statefile found.'\n clean\n end\n @changed = false\n end"
] | [
"0.7642684",
"0.76054585",
"0.7590426",
"0.7520142",
"0.7355775",
"0.72137725",
"0.71496314",
"0.7041646",
"0.7003075",
"0.6940102",
"0.68225586",
"0.68003446",
"0.67826295",
"0.67689615",
"0.67403746",
"0.67222226",
"0.6719393",
"0.6710889",
"0.6656671",
"0.6475185",
"0.6466729",
"0.64532053",
"0.64302206",
"0.64302206",
"0.642466",
"0.64120495",
"0.63436496",
"0.62805593",
"0.6255179",
"0.6245387",
"0.6194632",
"0.6186366",
"0.6170905",
"0.6167602",
"0.61580604",
"0.61011916",
"0.6096624",
"0.60605735",
"0.6060257",
"0.60557926",
"0.6050396",
"0.6029964",
"0.60253006",
"0.60132325",
"0.5994945",
"0.5992682",
"0.5953566",
"0.59167284",
"0.5910315",
"0.5900833",
"0.5900717",
"0.58913976",
"0.5887145",
"0.58805215",
"0.5875022",
"0.5867443",
"0.5867443",
"0.5859723",
"0.58526886",
"0.5844894",
"0.5829036",
"0.5823214",
"0.5817166",
"0.5797014",
"0.5785615",
"0.57782423",
"0.5775211",
"0.57715976",
"0.5770928",
"0.57657987",
"0.5753296",
"0.5720884",
"0.5716828",
"0.5716399",
"0.5702607",
"0.5681801",
"0.567938",
"0.56727487",
"0.56674314",
"0.5658285",
"0.565641",
"0.56541",
"0.56470704",
"0.56470096",
"0.5641615",
"0.5641494",
"0.56406516",
"0.56311244",
"0.5617434",
"0.5610627",
"0.5608038",
"0.5607973",
"0.5607973",
"0.56070405",
"0.55968577",
"0.55854833",
"0.5585072",
"0.5575175",
"0.5564102",
"0.55215776"
] | 0.81866574 | 0 |
Saves are serialized in JSON format. This would have been much easier in YAML(Yaml.dump(self)) | def save_game
file_name = input_save_name
begin
Dir.mkdir('saves') unless Dir.exist?('saves')
save_file = File.new(file_name, 'w')
save_file.puts generate_save
save_file.close
puts 'Game saved!'
rescue IOError
puts 'Save failed'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize\n YAML::dump(self)\n end",
"def generate_save\n YAML.dump(self)\n end",
"def save\n ::File.open(@file, \"w\") { |file| file << self.to_hash.to_yaml }\n end",
"def save_data\n puts \"saving data\"\n\n File.open(generate_filename(self), \"w\") do |f|\n f.write(ostruct_to_hash(self.json).to_yaml)\n end\n end",
"def to_yaml\n YAML::dump(self)\n end",
"def to_yaml\n YAML::dump(self)\n end",
"def to_yaml\n YAML::dump(self)\n end",
"def to_yaml\n YAML::dump(self)\n end",
"def to_yml\n YAML.dump(self)\n end",
"def save( file )\n begin\n File.open( file, 'w' ) { |f| f.write( YAML.dump( self ) ) }\n rescue\n File.open( file, 'wb' ) { |f| f.write( Marshal.dump( self ) ) }\n end\n end",
"def save\n \tdata = self\n \t\n \tFile.open('store.yml','w') do |f|\n \t\tf.write(data.to_yaml)\n \tend\n \tputs data\n \tputs \"Saved!\"\n \tputs \"\"\n end",
"def save\r\n props = {}\r\n instance_variables.each{|v|\r\n # props[v.to_s[1..-1]] = instance_variable_get(\"#{v}\")\r\n p = v.to_s[1..-1]\r\n props[p] = self.send(p)\r\n }\r\n File.write(STORAGE, YAML.dump(props))\r\n end",
"def save\n @save_mixin.json_dict = @json_dict\n @save_mixin._deleted = @_deleted\n @save_mixin.save\n @json_dict = @save_mixin.json_dict\n end",
"def to_yaml() end",
"def to_yaml\n\t\tYAML::dump self.to_hash\n\tend",
"def save_config\n self.data = JSON.dump(self.config)\n end",
"def save_config\n self.data = JSON.dump(self.config)\n end",
"def save_file\r\n @saved = true\r\n saving\r\n Dir.mkdir(\"saves\") unless Dir.exists? \"saves\"\r\n File.open(\"my_save.yaml\", \"w\") {|f| f.puts YAML::dump(self) }\r\n end",
"def serialize\n self.to_hash.to_json\n end",
"def to_yaml\n\t\tFile.write(\"save.yaml\", YAML.dump({\n\t\t\t:board => @board.board,\n\t\t\t:positions => @board.positions,\n\t\t\t:current_turn => @current_turn,\n\t\t\t:ai_on => @ai_on\n\t\t\t}))\n\tend",
"def dump\n File.open(\"saved_games.yaml\", \"a\") do |out|\n YAML::dump(self, out)\n end\n end",
"def to_yaml\n self.to_h.to_yaml\n end",
"def to_yaml\n self.to_h.to_yaml\n end",
"def save\n File.write @name, Oj.dump(as_json)\n end",
"def save\n prepare\n h = {}\n h[:title] = @title\n h[:sequence] = @sequence.map(&:export)\n outfile = File.join(@basedir, \"#{@name}.json\")\n File.open(outfile, 'w') do |f|\n f.write JSON.pretty_generate(h)\n end\n end",
"def save\n File.write(yfile, to_yaml)\n end",
"def serialize \n Base64.encode64(@data.to_yaml) \n end",
"def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end",
"def to_yaml\n # write yaml\n end",
"def _save\n properties\n end",
"def to_yaml\n to_hash.to_yaml\n end",
"def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end",
"def serialize( ses )\n YAML.dump( ses )\n end",
"def serialize\n end",
"def serialized\n serializer_class.new(self).serializable_hash\n end",
"def serialize\n JSON.generate(to_h)\n end",
"def to_yaml\n self.original.to_yaml\n end",
"def serialize\n obj = {}\n obj[:players] = [@player.serialize]\n obj[:word_array] = @word_array\n obj[:word_array_player] = @word_array_player\n obj[:letters_guessed] = @letters_guessed\n obj[:errors_left] = @errors_left\n obj[:round_over] = @round_over\n obj[:round_won] = @round_won\n obj[:continuing_saved_game] = @continuing_saved_game\n @@serializer.dump(obj)\n end",
"def serialize\n JSON.dump(@hash)\n end",
"def to_yaml\n to_h.to_yaml\n end",
"def save\n File.open(yaml_file, 'w') {|f| f.write(to_yaml) }\n end",
"def save_game\n store = YAML.dump(self)\n File.open('lib/saved_game.yml', 'w') do |file|\n file.puts(store)\n end\n puts 'your game has been saved!'\n end",
"def serialize; end",
"def serialize; end",
"def to_yaml\n to_hash.to_yaml\n end",
"def to_yaml\n to_hash.to_yaml\n end",
"def serialize\n \n end",
"def to_yaml\n\t\tYAML.dump self.export\n\tend",
"def save\n File.open(file_path, 'w') do |file|\n YAML.dump(data, file)\n end\n end",
"def save\n @items.to_json\n end",
"def serialize()\n data = {\n 'channels' => @channels.values.collect {|c| c.serialize },\n 'users' => @users.values.collect {|u| u.serialize },\n }\n data.to_yaml\n end",
"def save\n self.class.mapper.put(self)\n end",
"def save\n $redis.hsetnx RedisContainer, self.full_name, self.to_json\n end",
"def save\n if any?\n FileUtils.mkdir_p basedir if !Dir.exist? basedir\n backup if @backup\n\n # I do this the long way because I want an immediate sync.\n f = open(@file, 'w')\n f.write YAML::dump self\n f.sync\n f.close\n\n set_mode if @mode\n end\n true\n end",
"def save\n @create_mixin.json_dict = @json_dict\n @create_mixin._deleted = @_deleted\n @create_mixin.save\n @json_dict = @create_mixin.json_dict\n end",
"def save\n super save\n end",
"def save_game\n puts \"=================================================\"\n puts \"\\nSaving game...\"\n filename = \"../saved_games/hangman_save.json\"\n File.open(filename, \"w\") { |file| file.puts self.serialize }\n puts \"Game Saved.\"\n puts \"\\n=================================================\"\n end",
"def save\n File.open(file_name, 'w') { |f| f.write config.to_yaml }\n end",
"def to_yaml\n to_h.to_yaml\n end",
"def serialize\n margaret_file = File.open(\"messages.yaml\", \"a+\")\n margaret_file.puts YAML::dump(@string_margaret)\n end",
"def before_save\n deserialized_values.each{|k,v| @values[k] = serialize_value(k, v)}\n super\n end",
"def to_yaml\n @attributes.to_yaml\n end",
"def serialized_filename\n \"#{self.name}.yaml\"\n end",
"def persistanse_data\n @attributes.to_json\n end",
"def to_yaml\n to_hash.to_yaml\n end",
"def to_yaml\n to_parsed.to_yaml\n end",
"def instance_to_json\n\t\t# byebug\n\t\t{\n\t\tid: self.id,\n\t\tname: self.name,\n\t\theight: self.height,\n\t\tlast_watered: self.last_watered,\n\t\tlast_watered_amount: self.last_watered_amount,\n\t\tgrow_zone: self.grow_zone,\n\t\tnotes: self.notes,\n\t\tplanted_date: self.planted_date,\n\t\tfarm: self.farm,\t\n\t\tsensor: self.sensor\n\t\t# farm: { \n\t\t# \tfarm: self.farm.name,\n\t\t# \tfarm: self.farm.id,\n\t\t# },\n\t\t}\n\tend",
"def save\n unless saved?\n # TODO: decide whether or not I should perform validations like this at\n # save-time, or only read-time. They can be quite slow.\n self.class.verify_type(hash, type)\n self.class.verify_length(hash, length, dump)\n self.class.verify_hash(hash, type, dump)\n \n contents = OUTPUT_FORMAT % [ type, length, dump ]\n \n self.class.write(hash, contents)\n end\n \n self\n end",
"def serialize(object)\n YAML.dump(object)\n end",
"def store\n File.open(@file_name, 'w') do |file|\n file.write YAML::dump(@data)\n end\n end",
"def to_yaml\n as_yaml.to_yaml\n end",
"def yaml_save object, filename\nFile.open filename, 'w' do |f| f.write(object.to_yaml)\nend end",
"def save_settings\n File.open(@path, \"w\") do |file|\n file.write @settings.to_yaml\n end\n end",
"def save\n File.open(path, 'w') do |out|\n YAML.dump(data, out)\n end\n end",
"def save_self(safe = true)\n super && embedments.values.each do |e|\n e.loaded?(self) && Array(e.get!(self)).each { |r| r.original_attributes.clear }\n end\n end",
"def save\n write_properties\n notify(EVENT_SAVE, self)\n end",
"def save_state\n json_object = { :secret_word => @secret_word, :display_content => @display_content,\n \t :failed_attemps => @failed_attemps }.to_json\n File.open(\"saved_state.json\", \"w\") { |file| file.write(json_object) }\n end",
"def json_serialize\n end",
"def to_yaml\n self.to_h.deep_stringify_keys.compact.to_yaml\n end",
"def save(file)\n serialized_vars = []\n vars.each do |k, v|\n if marked_for_save.include?(k)\n serialized_vars << { 'name' => k, 'value' => v }\n end\n end\n File.open(file, 'w') do |out|\n YAML.dump(serialized_vars, out)\n end\n end",
"def save_game\n Dir.mkdir(\"../saves\") unless Dir.exists?(\"../saves\")\n @@save_count += 1\n binding.pry\n log_saves\n savefile = \"../saves/save_#{@@save_count}.yml\"\n File.open(savefile, 'w') do | file |\n file.write(self.to_yaml)\n end\n end",
"def serializer; end",
"def to_yaml\n YAML.dump ({\n :name => @name,\n :age => @age,\n :gender => @gender\n })\n end",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def save\n update({})\n end",
"def save\n json = JSON.dump @attributes\n\n @dbm[@id] = json\n\n true\n end",
"def save\n File.open(SETTING_FILE, 'w') do |file|\n file.write @values.to_yaml\n end\n end",
"def save!\n $redis.hset RedisContainer, self.full_name, self.to_json\n end",
"def save_game\n\t\tall_saved_games = yaml_load(SAVED_FILENAME)\n\t\tgame_name = get_save_name(all_saved_games)\n\t\treturn if game_name.nil?\n\n\t\tgame_string = self.to_yaml \n\t\tall_saved_games[game_name] = game_string\n\t\tyaml_save(SAVED_FILENAME, all_saved_games)\n\t\tmessage_then_enter \"'#{ game_name }' successfully saved.\"\n\tend",
"def serialize(object) end",
"def to_yaml\n require 'yaml'\n self.config.to_hash.to_yaml\n end",
"def save()\n File.write(@database_file, @data.to_json)\n end",
"def save()\n File.open(CONFIG_FILE, 'w'){ |f| f.write config.to_yaml } # Store\n end",
"def serialize(writer) \n super\n writer.write_collection_of_primitive_values(\"categories\", @categories)\n writer.write_string_value(\"changeKey\", @change_key)\n writer.write_date_value(\"createdDateTime\", @created_date_time)\n writer.write_date_value(\"lastModifiedDateTime\", @last_modified_date_time)\n end",
"def save_settings!\n File.open(settings_path, \"w\") { |f| f << settings.to_nested_hash.to_yaml }\n settings.create_accessors!\n end"
] | [
"0.75708884",
"0.75315285",
"0.7015672",
"0.699909",
"0.6849924",
"0.6825399",
"0.6825399",
"0.6825399",
"0.6798712",
"0.6761611",
"0.67493725",
"0.6742367",
"0.6731286",
"0.67009515",
"0.6683374",
"0.667178",
"0.667178",
"0.6591724",
"0.6574427",
"0.6502932",
"0.6485812",
"0.6479298",
"0.6479298",
"0.6470763",
"0.64494455",
"0.64032084",
"0.6389658",
"0.63893336",
"0.6386151",
"0.63475126",
"0.6340027",
"0.6293249",
"0.6277606",
"0.6277532",
"0.62688047",
"0.6260927",
"0.6260892",
"0.624103",
"0.6225032",
"0.62232095",
"0.62004775",
"0.61996055",
"0.61969143",
"0.61969143",
"0.6194664",
"0.6194664",
"0.619421",
"0.61714417",
"0.6170172",
"0.61620426",
"0.61614853",
"0.61592686",
"0.6152635",
"0.6109566",
"0.61074996",
"0.61058646",
"0.60893375",
"0.60858214",
"0.608486",
"0.60765857",
"0.6069907",
"0.60672617",
"0.6056607",
"0.6048211",
"0.6045556",
"0.60432",
"0.60363215",
"0.60359627",
"0.60221225",
"0.6019864",
"0.60169274",
"0.60017985",
"0.6000752",
"0.59851724",
"0.5958705",
"0.59559095",
"0.5952123",
"0.59410006",
"0.5929791",
"0.5927101",
"0.59232056",
"0.5920863",
"0.5913353",
"0.59129256",
"0.59129256",
"0.59129256",
"0.59129256",
"0.59129256",
"0.59129256",
"0.59129256",
"0.58972335",
"0.5894158",
"0.58906925",
"0.58886695",
"0.58573425",
"0.5854082",
"0.58537525",
"0.58522445",
"0.5849487",
"0.584232",
"0.58379704"
] | 0.0 | -1 |
TODO: Generate yaml of game | def generate_save
YAML.dump(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game\n {\n starting_decision: :stormy_night,\n decisions: {\n stormy_night: {\n description: 'It was a dark and stormy night. (storyline located in decision.rb)',\n option_one: {\n description: 'Go to sleep.',\n decision: :nap\n },\n option_two: {\n description: 'Watch a movie.',\n decision: :movie\n },\n option_three: {\n description: 'Go outside.',\n decision: :go_outside\n },\n option_four: {\n description: 'Get a snack.',\n decision: :get_a_snack\n }\n },\n nap: {\n description: 'You took a nap. The end.',\n option_one: {\n description: 'Start over.',\n decision: :stormy_night\n }\n }\n }\n }\nend",
"def save_game\n game = {\n :word => @word,\n :max_turn => @max_turn,\n :current_turn => @current_turn,\n :display_word => @display_word,\n :current_guess => @current_guess\n }\n File.open(\"hangman.yaml\", 'w') { |f| f.write(game.to_yaml)}\n print \"Game is saved!\\n\"\n end",
"def save_game \n File.open('hangman_save.yml', 'w') { |f| YAML.dump(self,f)}\n exit\n end",
"def dump\n File.open(\"saved_games.yaml\", \"a\") do |out|\n YAML::dump(self, out)\n end\n end",
"def save_game\n\t\tall_saved_games = yaml_load(SAVED_FILENAME)\n\t\tgame_name = get_save_name(all_saved_games)\n\t\treturn if game_name.nil?\n\n\t\tgame_string = self.to_yaml \n\t\tall_saved_games[game_name] = game_string\n\t\tyaml_save(SAVED_FILENAME, all_saved_games)\n\t\tmessage_then_enter \"'#{ game_name }' successfully saved.\"\n\tend",
"def load #TODO: validation\n \tputs \"What game do you want to load?\"\n \tsaved_game = gets.chomp.gsub(' ', '_')\n \tsaved_game = \"#{saved_game}.yaml\"\n \tload_game(saved_game)\n end",
"def save_game\n store = YAML.dump(self)\n File.open('lib/saved_game.yml', 'w') do |file|\n file.puts(store)\n end\n puts 'your game has been saved!'\n end",
"def save_game(game)\n print \"Enter a new filename to save game in: \"\n filename = gets.chomp\n File.open(filename, \"w\") {|f| f.puts game.to_yaml}\nend",
"def save_game\n\t\tDir.mkdir('saved_games') unless Dir.exist? 'saved_games'\n\t\tDir.chdir(\"saved_games\")\n\t\tdata = save\n\t\tFile.open(\"save.yaml\", \"w\") do |file|\n\t\t\tsaved_games = YAML::dump(data)\n\t\t\tfile.write(saved_games)\n\t\tend\n\t\tputs \"Games Saved!!\"\n\t\tabort\n\tend",
"def save_game\n\t\tsaves = []\n\t\tsaves << @board\n\t\tsaves << @current_player\n\t\tsave_yaml = YAML.dump(saves)\n\n\t\tFile.open('saved_game.yaml', 'w') do |file|\n\t\t\tfile.puts save_yaml\n\t\tend\n\t\tputs \"Your game has been saved.\"\n\t\tputs \"Closing the game...\"\n\t\texit\n\tend",
"def load_game\n save_file = YAML.load(File.read('save_game.yml'))\n @guess = save_file['guess']\n @secret_word = save_file['secret_word']\n @word_teaser = save_file['word_teaser']\n @lives = save_file['lives']\n round_start\n end",
"def save_game\n #yaml = YAML::dump(self)\n puts \"Please enter a filename for the saved game.\"\n save_file_name = gets.chomp.downcase\n save_file = File.write(\"saved_games/#{save_file_name}.yaml\", self.to_yaml)\n #save_file.write(yaml)\n puts \"Your game has been saved!\"\n puts \"Goodbye!\"\n end",
"def save_game(game_state)\n save_file = File.open('save_game.yml', 'w')\n YAML.dump(game_state, save_file)\n save_file.close\n exit\n end",
"def setup_game\n name_player = set_name_player\n number_columns = set_number_columns\n number_rabbits = set_number_rabbits(number_columns)\n number_foxs = set_number_foxs(number_columns)\n\n board = build_board(number_columns)\n rabbit_collection = build_rabbit_collection(number_columns, number_rabbits)\n fox_collection = build_fox_collection(number_columns, number_foxs)\n\n\n [ board, name_player, number_columns, rabbit_collection, fox_collection ]\nend",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game\n fetch('games.super_mario.games')\n end",
"def game; end",
"def game; end",
"def save_game(player)\n player_data = YAML::dump(player)\n File.open(\"player.yaml\", \"w\") do |file|\n file.puts player_data\n end\n print \"Successfully saved the game!\\n\\n\"\n return\nend",
"def to_yaml\n\t\tFile.write(\"save.yaml\", YAML.dump({\n\t\t\t:board => @board.board,\n\t\t\t:positions => @board.positions,\n\t\t\t:current_turn => @current_turn,\n\t\t\t:ai_on => @ai_on\n\t\t\t}))\n\tend",
"def generate_filename(game)\n \"./data/#{Time.now.to_i}#{game.json.gamestate.opponent}.yml\"\n end",
"def mame_each\n\t\tstatus = {}\n\t\txmlin = IO.popen(\"#{@mametarget} -listxml\")\n\n\t\tendid = 0\n\t\t\n# seriously ugly hack around Nokogiri versioning issues\n\t\tbegin\n\t\t\tendid = Nokogiri::XML::Reader::TYPE_END_ELEMENT\n\t\trescue\n\t\t\tendid = 15\n\t\tend\n\t\t\n\t\txp = Nokogiri::XML::Reader.from_io( xmlin )\n\t\twhile (xp.read)\n\t\t\tnext unless xp.name == \"game\"\n\t\t\tnext if xp.node_type == endid\n\t\t\t\n\t\t\tnode_tree = Nokogiri::XML.parse( xp.outer_xml.dup ) \n\t\t\tnext if node_tree.root.attributes[\"isbios\"]\n\t\t\tnext if @skipclone and node_tree.root.attributes[\"cloneof\"]\n\n\t\t\ttitle = node_tree.xpath(\"//game/description\").text\n\t\t\tshorttitle = title.split(/\\s\\(/)[0]\n\t\t\tshorttitle = shorttitle.split(/\\//)[0] if shorttitle.index(\"/\")\n\t\t\t\n\t\t\ttitle.strip! if title\n\t\t\tshorttitle.strip! if title\n\t\t\t\n\t\t\ttitle = @shorttitle ? shorttitle : title\n\t\t\tsetname = node_tree.root.attributes['name'].value\n\n\t\t\tres = Game.LoadSingle(title, setname, @target.pkid)\n\t\t\tres = Game.new unless res\n\t\t\t\n\t\t\tres.target = @target\n\t\t\tres.title = title\n\t\t\tres.setname = setname\n\t\t\n\t\t\tres.ctrlmask = 0\n\t\t\tres.year = node_tree.xpath(\"//game/year\").text\n\t\t\tres.year = res.year.to_i if (res.year) \n\t\t\tres.year = 0 if res.year < 1900\n\t\t\t\n\t\t\tres.manufacturer = node_tree.xpath(\"//game/manufacturer\").text\n\t\t\tres.system = \"Arcade\" # It might be possible to parse more out of the description\n\t\t\tres.family = @series[res.setname]\n\t\t\tif (@categories[res.setname])\n\t\t\t\tres.genre = @categories[res.setname][0]\n\t\t\t\tres.subgenre = @categories[res.setname][1]\n\t\t\tend\n\t\t\t\n\t\t\tdriver = node_tree.xpath(\"//game/driver\")[0]\n\t\t\t\n\t\t\tnext if (driver == nil)\n\t\t\tnext if (@onlygood and driver.attributes[\"status\"].value != \"good\")\n\n\t\t\tnode_input = node_tree.xpath(\"//game/input\")[0]\n\t\t\tres.players = node_input.attributes[\"players\"].value\n\t\t\tres.buttons = node_input.attributes[\"buttons\"]\n\t\t\tres.buttons = res.buttons == nil ? 0 : res.buttons.value\n\t\t\tres.target = @target\n\n# currently just ignored, but there can be seriously weird combinations (wheel + paddle + stick + buttons + ...)\n\t\t\tnode_input.children.each{|child|\n\t\t\t\tif (child and child.attributes[\"type\"])\n#\t\t\t\t inputlabel = convert_inputtype(child)\n#\t\t\t\t res.ctrlmask = res.ctrlmask | res.get_mask( mmask ) if inputlabel\n\t\t\t\tend \n\t\t\t}\n\n\t\t\tyield res\n\t\tend\n\tend",
"def list_games\n\t\tall_saved_games = yaml_load(SAVED_FILENAME)\n\t\tgame_string = \"Saved Games\\n===========\\n\"\n\t\tall_saved_games.keys.each { |game_name| game_string += \"#{ game_name }\\n\"}\n\t\tmessage_then_enter game_string\n\tend",
"def save_game\n\t\tputs \"Type a name for your saved game\"\n\t\tgame_name = gets.chomp\t\n\t\tfilename = \"#{game_name}.yml\"\n\n\t\t ex_file = File.expand_path(\"./saved_games/#{filename}\")\n\t\t \n\t\tif File.exists?(ex_file)\n\t puts \"#{filename} exists\" #overwrite method?\n\t \n\t self.save_game\n\t else\n\t\t\tFile.open(ex_file, \"w\") do |f|\n\t\t\t\tgame_state = YAML::dump(self)\n\t\t\t\tf.puts game_state\n\t\t\t\tputs \"Your game was saved as #{filename}\" \n\t\t\tend\n\t\tend\n\tend",
"def save(game)\n\t\tprint \"Name the save: \"\n\t\tsave_name = gets.chomp.downcase\n\t\tDir.mkdir \"saves\" unless Dir.exists? \"saves\"\n\t\tfile_path = File.join(\"saves\", \"#{save_name}\")\n\t\tFile.open(file_path, \"w\") { |f|\n\t\t\tf.write(YAML.dump(game))\n\t\t}\n\t\tputs \"The game has been saved!\"\n\tend",
"def load_game\n\t\tload_gameplay = YAML.load(File.read 'saved_game.yaml')\n\t\t@board = load_gameplay[0]\n\t\t@current_player = load_gameplay[1]\n\t\tshow_board\n\t\tinput_validation\n\tend",
"def game\n fetch('esport.games')\n end",
"def show_games\n puts Rainbow(\"------------------------------\").red\n puts MyCliProject::Game.all.last.description\n puts Rainbow(\"------------------------------\").red\n continue_or_exit\n end",
"def show_start_game(game)\n puts \"#{game.player1.name} is: #{game.player1.identity}\"\n puts \"#{game.player2.name} is: #{game.player2.identity}\"\n puts 'TIC TAC TOE.. start!'\nend",
"def games\n 'Games/Toys' if %w[r m].include?(record.leader[6]) &&\n (%w[g w].include?(record.leader[16]) ||\n (record['006'] && record['006'].value[9] == 'g') ||\n (record['008'] && (%w[g w].include?(record['008'].value[33]) || record['008'].value[26] == 'g')))\n end",
"def game_setup\n end",
"def save_game\n Dir.mkdir(\"../saves\") unless Dir.exists?(\"../saves\")\n @@save_count += 1\n binding.pry\n log_saves\n savefile = \"../saves/save_#{@@save_count}.yml\"\n File.open(savefile, 'w') do | file |\n file.write(self.to_yaml)\n end\n end",
"def game_mode; end",
"def gameflow\n \n end",
"def load_game\n\t\tall_saved_games = yaml_load(SAVED_FILENAME)\n\t\tgame_name = get_game_name(all_saved_games, \"load\")\n\t\treturn if game_name.nil?\n\n\t\tsaved_game = YAML::load(all_saved_games[game_name])\n\t\tmessage_then_enter \"'#{ game_name }' successfully loaded.\"\n\t\tsaved_game.play_game\n\tend",
"def save_game\n\t\tputs \"To save game please provide a game name. Please only use letters, numbers and underscores\"\n\t\tinput = gets.chomp.downcase\n\t\tvalid = input.index(/[^\\d,\\w,_]/)\n\t\tuntil !valid\n\t\t\tputs \"Please enter a valid name\"\n\t\t\tinput = gets.chomp.downcase\t\n\t\t\tvalid = input.index(/[^\\d+,\\w+, _+]/)\t\t\t\n\t\tend\n\t\tputs \"Saving #{input}\"\n\t\tyaml = YAML::dump(self)\n\t\tif !Dir.exists?(\"saved\")\n\t\t\tDir.mkdir(\"saved\") \n\t\tend\n\t\tsave_file = File.open(\"saved/#{input}.yaml\", 'w')\n\t\tsave_file.write(yaml)\n\t\tsave_file.close\n\t\tputs \"Game Saved!\"\n\t\texit\n\tend",
"def save_game\n puts \"=================================================\"\n puts \"\\nSaving game...\"\n filename = \"../saved_games/hangman_save.json\"\n File.open(filename, \"w\") { |file| file.puts self.serialize }\n puts \"Game Saved.\"\n puts \"\\n=================================================\"\n end",
"def name\n @game_info['name']\n end",
"def to_yaml\n longest_track_name_length =\n @tracks.keys.inject(0) do |max_length, name|\n (name.to_s.length > max_length) ? name.to_s.length : max_length\n end\n ljust_amount = longest_track_name_length + 7\n \n yaml = \"#{@name.to_s.capitalize}:\\n\"\n @tracks.keys.sort.each do |track_name|\n yaml += \" - #{track_name}:\".ljust(ljust_amount)\n yaml += \"#{@tracks[track_name].rhythm}\\n\"\n end\n \n return yaml\n end",
"def load_game_from_save\n #TODO implement game state saving and loading\n end",
"def save_game\n\t\tputs \"Type a name for your saved game\"\n\t\tgame_name = gets.chomp\n\t\tfilename = \"#{game_name}.txt\"\n\n\t\t ex_file = File.expand_path(\"./saved_games/#{filename}\")\n\t\t \n\t\tif File.exists?(ex_file)\n\t puts \"#{filename} exists\" #overwrite method?\n\t \n\t self.save_game\n\t else\n\t\t\tFile.open(ex_file, \"w\") do |f|\n\n\t\t\t\tf.puts YAML::dump(game_state)\n\n\t\t\t\tputs \"Your game was saved as #{filename}\" \n\t\t\tend\n\t\tend\n\tend",
"def load_game\n\tsettings.game_data = Ben::Game.load\n\tgame_json\nend",
"def main()\n name_game(\"Lincoln\")\nend",
"def simple(title=Wep::Default_title,all_actors=1)\n # Check for upcase conversion\n if Wep::Upcase_titles\n title.upcase!\n end\n # Load mapinfo for map name\n mapinfos = load_data(\"Data/MapInfos.rxdata\")\n # Make the filename\n if Wep::Random_file_name and Wep::Modify_game_system\n filename = Wep::Game_version+\"-\"+$game_system.random_filename+\"-\"+Wep::File_name\n else\n filename = Wep::Game_version+\"-\"+Wep::File_name\n end\n \n estado = open(filename, \"a\")\n estado.write(\"------------------------------------------\\n\")\n estado.write(\"||||\"+title+\"||||\")\n estado.write(\"\\n------------------------------------------\\n\") \n # Writes System time\n date = \"\\nDate: \"\n \n date+= estado.mtime.to_s\n estado.write(date)\n # Write time\n @total_sec = Graphics.frame_count / Graphics.frame_rate\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n text = sprintf(\"%02d:%02d:%02d\", hour, min, sec)\n tiempo = \"\\nPlaytime: \"\n tiempo+= text\n estado.write(tiempo)\n # If uses normal style\n if not Wep::Compact_style\n # Write money\n money = \"\\nMoney: \"\n money += $game_party.gold.to_s\n estado.write(money)\n # Write steps\n estado.write(\"\\nSteps: \"+$game_party.steps.to_s)\n # Write actual map(and name)\n estado.write(\".\\n Map: \"+$game_map.map_id.to_s+\" (\"+mapinfos[$game_map.map_id].name+\")\")\n # If uses compact style\n else\n # Write money\n money = \"\\nMoney: \"\n money += $game_party.gold.to_s\n estado.write(money)\n # Write steps\n estado.write(\". Steps: \"+$game_party.steps.to_s)\n # Write actual map(and name)\n estado.write(\". Map: \"+$game_map.map_id.to_s+\" (\"+mapinfos[$game_map.map_id].name+\")\")\n end\n # Write actors\n estado.write (\"\\n\")\n # If its only for the actual group\n if all_actors == 1\n for actor in $game_party.actors\n # If uses normal style\n if not Wep::Compact_style\n estado.write (\"-----------------\\n\")\n estado.write(actor.name)\n estado.write (\"\\n---------------\\n\") \n estado.write($data_classes[actor.class_id].name)\n estado.write (\"\\nNv \")\n estado.write(actor.level)\n estado.write (\"\\n\") \n # If uses compact style\n else\n estado.write(\"\\n\"+actor.name+\" (\"+$data_classes[actor.class_id].name+\") Nv\"+actor.level.to_s+\"\\n\")\n end\n end\n \n # If its for all actors\n else\n for i in 1...$data_actors.size\n # If uses normal style\n if not Wep::Compact_style\n estado.write (\"-----------------\\n\")\n estado.write(actor.name)\n estado.write (\"\\n---------------\\n\") \n estado.write($data_classes[$game_actors[i].class_id].name)\n estado.write (\"\\nNv \")\n estado.write($game_actors[i].level)\n estado.write (\"\\n\") \n # If uses compact style\n else\n estado.write(\"\\n\"+$game_actors[i].name+\" (\"+$data_classes[$game_actors[i].class_id].name+\") Nv\"+$game_actors[i].level.to_s+\"\\n\")\n end\n end\n \n end\n estado.write (\"\\n\")\n estado.close\n end",
"def start_game\n dictionary = File.readlines(\"dictionary.txt\")\n secret_word = get_word(dictionary).split(\"\")\n word = secret_word.map { |x| x = \"_\" }\n game_status = {\n secret_word: secret_word,\n word: word,\n incorrect_guesses: [],\n images: ['\n +---+\n | |\n | \n | \n | \n | \n ==========', '\n +---+\n | |\n | O \n | \n | \n | \n ==========', '\n +---+\n | |\n | O \n | | \n | \n | \n ==========', '\n +---+\n | |\n | O \n | /| \n | \n | \n ==========', '\n +---+ \n | | \n | O \n | /|\\ \n | \n | \n ==========', '\n +---+ \n | | \n | O \n | /|\\ \n | / \n | \n ==========', '\n +---+ \n | | \n | O \n | /|\\ \n | / \\ \n | \n ==========']\n }\n end",
"def apply(game)\n end",
"def load_supported_games\n @supported_game_map = InfoAvilGames.info_supported_games(@log)\n #@supported_game_map.each{|k,v| p k}\n #p @supported_game_map\n # execute require 'mygame'\n @all_games_bots.each do |botgame|\n infogame = @supported_game_map[botgame[:key]]\n if infogame != nil and infogame[:enabled] == true\n botgame[:name] = infogame[:name]\n botgame[:opt] = infogame[:opt]\n else\n @log.warn(\"Game bot key #{botgame[:key]} not enabled in game_info\")\n end\n end\n #p @all_games_bots\n end",
"def hard\n g = Game.new\n sets = g.play\n \n sets\nend",
"def load_game\n begin\n player = YAML.load_file(\"player.yaml\")\n return player\n rescue\n return nil\n end\nend",
"def to_yaml() end",
"def run_full_game()\n set_max_games()\n name_all_players()\n puts play_through_set_of_games()\n set_determine_set_winner()\n puts overall_winner_message()\n end",
"def loadGame()\n\nend",
"def easy\n g = Game.new(Deck.new(Deck.all_cards[0..11]))\n sets = g.play\n \n sets\nend",
"def play\n #calls to all the methods that produce game!\n end",
"def game_title\n\t\t\"#{home_team} vs. #{visitor_team}\"\n\tend",
"def derive_game_model\n case @selected_game\n when 1\n TetrisMetaData\n when 2\n GameOfLifeMetaData\n when 3\n SokobanMetaData\n when 4\n SnakeMetaData\n when 5\n PingPongMetaData\n when 6\n FractalMetaData\n when 7\n DemoSpritesMetaData\n end\n end",
"def to_game_string\n s = \"#{@state};\"\n s = \"#{s}#{@on_move};\"\n @@PLAYERS.each do |player|\n @hands[player].each do |c|\n s = \"#{s}#{c.to_s}\"\n end\n s = \"#{s};\"\n end\n \n @hole_cards.each do |c|\n s = \"#{s}#{c.to_s}\"\n end\n s = \"#{s};\"\n \n @@PLAYERS.each do |p|\n if @played[p] \n s = \"#{s}#{@played[p]}\"\n else\n s = \"#{s}XX\"\n end \n end\n s = \"#{s};\"\n @@PLAYERS.each do |p|\n @taken[p].each do |c|\n s = \"#{s}#{c.to_s}\"\n end\n s = \"#{s};\"\n end\n s = \"#{s}END;\" \n s\n end",
"def write()\n\t\tdata = {\"rows\"=>@rows, \"cols\"=>@cols , \"moves\"=>@moves , \"time\"=> @time, \"nbGames\" => @nbGames}\n\t\tFile.open(@path, \"w\") {|out| out.puts data.to_yaml }\n\t\treturn self\n\tend",
"def generate_game_info(room)\n players = room.players.inject(\"\"){ |acc, p| acc << \" id : #{p.id}, name : #{p.name}\\n\" }\n \"======================================\\n\"+\n \"[Game Information]\\n\"+\n \"Room name : #{room.name}\\n\"+\n \"Round : #{room.max_round} round\\n\"+\n \"player : #{room.player_num} player\\n\"+\n \"#{players}\"+\n \"======================================\\n\"\n end",
"def load \n \tputs \"Type 'load' to load an existing game, or press Enter to continue.\"\n \tanswer = gets.chomp.downcase\n \tif answer == 'load'\n data = YAML.load_file('store.yml')\n @turns = data.turns\n @lives = data.lives\n @wrong = data.wrong\n @right = data.right\n @word= data.word\n puts \"Loading...\"\n sleep(2)\n end\n\n end",
"def winning_play\n {paper: [:rock, :spock], rock: [:lizard, :scissors], scissors: [:paper, :lizard], lizard: [:spock, :paper], spock: [:rock, :scissors], scratch: [:scratch]}\n end",
"def load_menu\n\t\ti = 1\n File.new(\"saved_games.yaml\",\"w\") unless File.exist?(\"saved_games.yaml\")\n if File.read(\"saved_games.yaml\").empty?\n puts \"There are no saved games, yet.\"\n initialize\n else\n YAML.load_stream(File.open(\"saved_games.yaml\")) do |saved_game|\n puts \"#{i}: \" + saved_game[-1].strftime(\"%m/%d/%Y %I:%M%P\")\n i += 1\n end\n puts \"\"\n puts \"Choose a game to load or \\\"exit\\\" to menu:\"\n game_index = gets.chomp.strip.downcase\n if game_index == \"exit\"\n initialize\n elsif game_index.to_i <= i && game_index.to_i >= 1\n game_index = game_index.to_i\n i = 1\n File.new(\"temp.yaml\",\"w\")\n puts \"\"\n YAML.load_stream(File.open(\"saved_games.yaml\")) do |game|\n if i == game_index\n \t@gameboard = game[0]\n @pieces = game[1]\n @player_color = game[2]\n else\n File.open(\"temp.yaml\",\"a\") do |out|\n YAML::dump(game,out)\n end\n end\n i += 1\n end\n File.delete(\"saved_games.yaml\")\n File.rename(\"temp.yaml\",\"saved_games.yaml\")\n Chess.new(@gameboard,@pieces,@player_color)\n else\n puts \"Invalid input. Try again...\"\n puts \"\"\n load_menu\n end\n end\n\tend",
"def to_yaml\n @main.to_yaml\n end",
"def save_game\n save_data = YAML::dump(self)\n puts \"Please enter a name for your save game:\"\n prompt\n @filename = gets.chomp\n File.open(\"./saved/#{@filename}\", \"w\") { |file| file.write(save_data)}\n puts \"Saved\"\n get_input\n end",
"def run_app\n games = []\n @standings = []\n\n # load file from cli arg and parse teams and games\n # NOTE: for this exercise, if CLI argument is omitted, \n # it will load the sample file by default\n load_file.each do |line|\n game = []\n\n # get game's teams, fetch scores, and ensure team is listed in standings\n teams = line.chomp.split(\", \")\n\n teams.each do |team|\n team_stats = parse_game(team)\n add_team_to_standings(team_stats[:name])\n\n game << team_stats\n end\n\n games << game\n end\n\n # determine if tie game\n games.each do |game|\n if game.first[:score] == game.last[:score]\n its_a_tie(game)\n else\n determine_winner(game)\n end\n end\n\n # return and print winners by placement\n output_placements\nend",
"def title\n \"Game #{self.id}: \" + players.map { |p| p.username }.join(\" vs \")\n end",
"def current_game\n\tputs \" #{@board[\"1\"]} | #{@board[\"2\"]} | #{@board[\"3\"]}\"\n puts \"-----------\"\n puts \" #{@board[\"4\"]} | #{@board[\"5\"]} | #{@board[\"6\"]}\"\n puts \"-----------\"\n puts \" #{@board[\"7\"]} | #{@board[\"8\"]} | #{@board[\"9\"]}\"\nend",
"def game_title\n object.game ? object.game.title : 'Не прикреплен ни к одной игре'\n end",
"def from_yaml\n\t\tdata = YAML.load File.read(\"save.yaml\")\n\t\t@board = Board.new(data[:board], data[:positions])\n\t\t@current_turn = data[:current_turn]\n\t\t@ai_on = data[:ai_on]\t\t\n\tend",
"def game\n _parent\n end",
"def wargames(player_1 = Players::Computer.new(\"X\"), player_2 = Players::Computer.new(\"O\"),board = Board.new)\n game = Game.new(player_1, player_2, board)\n game.play\n end",
"def load_game\n puts \"Would you like to load a saved game?\"\n puts \"Enter \\\"y\\\" or \\\"n\\\":\"\n input = gets.chomp\n if input != \"\" && input[0].downcase == \"y\"\n game = YAML.load(File.read(\"hangman.yaml\"))\n @word = game[:word]\n @max_turn = game[:max_turn]\n @current_turn = game[:current_turn]\n @display_word = game[:display_word]\n @current_guess = game[:current_turn]\n end\n puts \"Game is loaded!\"\n end",
"def load\n puts \"Would you like to load your previous game? (y/n)\"\n puts \"\"\n response = gets.strip.downcase\n puts \"\"\n if response == \"y\" && File.exist?(\"saves.yaml\")\n save = File.read(\"saves.yaml\")\n @computer = YAML::load(save)\n puts \"Your game has been loaded!\"\n puts \"\"\n else\n puts \"New game created!\"\n puts \"\"\n end\n end",
"def game_hash\n\t#game_hash = \n\t{\n\t\thome: {\n\t\t\tteam_name: \"Brooklyn Nets\",\n\t\t\tcolors: [\"Black\", \"White\"],\n\t\t\tplayers: {\n\t\t\t\t\"Alan Anderson\" => {\n\t\t\t\t\tnumber: 0,\n\t\t\t\t\tshoe: 16,\n\t\t\t\t\tpoints: 22,\n\t\t\t\t\trebounds: 12,\n\t\t\t\t\tassists: 12,\n\t\t\t\t\tsteals: 3,\n\t\t\t\t\tblocks: 1,\n\t\t\t\t\tslam_dunks: 1\n\t\t\t\t},\n\t\t\t\t\"Reggie Evans\" => {\n\t\t\t\t\tnumber: 30,\n\t\t\t\t\tshoe: 14,\n\t\t\t\t\tpoints: 12,\n\t\t\t\t\trebounds: 12,\n\t\t\t\t\tassists: 12,\n\t\t\t\t\tsteals: 12,\n\t\t\t\t\tblocks: 12,\n\t\t\t\t\tslam_dunks: 7\n\t\t\t\t},\n\t\t\t\t\"Brook Lopez\" => {\n\t\t\t\t\tnumber: 11,\n\t\t\t\t\tshoe: 17,\n\t\t\t\t\tpoints:17,\n\t\t\t\t\trebounds: 19,\n\t\t\t\t\tassists: 10,\n\t\t\t\t\tsteals: 3,\n\t\t\t\t\tblocks: 1,\n\t\t\t\t\tslam_dunks: 15\n\t\t\t\t},\n\t\t\t\t\"Mason Plumlee\" => {\n\t\t\t\t\tnumber: 1,\n\t\t\t\t\tshoe: 19,\n\t\t\t\t\tpoints: 26,\n\t\t\t\t\trebounds: 12,\n\t\t\t\t\tassists: 6,\n\t\t\t\t\tsteals: 3,\n\t\t\t\t\tblocks: 8,\n\t\t\t\t\tslam_dunks: 5\n\t\t\t\t},\n\t\t\t\t\"Jason Terry\" => {\n\t\t\t\t\tnumber: 31,\n\t\t\t\t\tshoe: 15,\n\t\t\t\t\tpoints: 19,\n\t\t\t\t\trebounds: 2,\n\t\t\t\t\tassists: 2,\n\t\t\t\t\tsteals: 4,\n\t\t\t\t\tblocks: 11,\n\t\t\t\t\tslam_dunks: 1\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\taway: {\n\t\t\tteam_name: \"Charlotte Hornets\",\n\t\t\tcolors: [\"Turquoise\", \"Purple\"],\n\t\t\tplayers: {\n\t\t\t\t\"Jeff Adrien\" => {\n\t\t\t\t\tnumber: 4,\n\t\t\t\t\tshoe: 18,\n\t\t\t\t\tpoints: 10,\n\t\t\t\t\trebounds: 1,\n\t\t\t\t\tassists: 1,\n\t\t\t\t\tsteals: 2,\n\t\t\t\t\tblocks: 7,\n\t\t\t\t\tslam_dunks: 2\n\t\t\t\t},\n\t\t\t\t\"Bismak Biyombo\" => {\n\t\t\t\t\tnumber: 0,\n\t\t\t\t\tshoe: 16,\n\t\t\t\t\tpoints: 12,\n\t\t\t\t\trebounds: 4,\n\t\t\t\t\tassists: 7,\n\t\t\t\t\tsteals: 7,\n\t\t\t\t\tblocks: 15,\n\t\t\t\t\tslam_dunks: 10\n\t\t\t\t},\n\t\t\t\t\"DeSagna Diop\" => {\n\t\t\t\t\tnumber: 2,\n\t\t\t\t\tshoe: 14,\n\t\t\t\t\tpoints: 24,\n\t\t\t\t\trebounds: 12,\n\t\t\t\t\tassists: 12,\n\t\t\t\t\tsteals: 4,\n\t\t\t\t\tblocks: 5,\n\t\t\t\t\tslam_dunks: 5\n\t\t\t\t},\n\t\t\t\t\"Ben Gordon\" => {\n\t\t\t\t\tnumber: 8,\n\t\t\t\t\tshoe: 15,\n\t\t\t\t\tpoints: 33,\n\t\t\t\t\trebounds: 3,\n\t\t\t\t\tassists: 2,\n\t\t\t\t\tsteals: 1,\n\t\t\t\t\tblocks: 1,\n\t\t\t\t\tslam_dunks: 0\n\t\t\t\t},\n\t\t\t\t\"Brendan Haywood\" => {\n\t\t\t\t\tnumber: 33,\n\t\t\t\t\tshoe: 15,\n\t\t\t\t\tpoints: 6,\n\t\t\t\t\trebounds: 12,\n\t\t\t\t\tassists: 12,\n\t\t\t\t\tsteals: 22,\n\t\t\t\t\tblocks: 5,\n\t\t\t\t\tslam_dunks: 12\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\nend",
"def setup_game\n @deck.shuffle!\n end",
"def model_class\n\t\tGame\n\tend",
"def game_hash\n{\n\t:home => {\n\t\t:team_name => \"Brooklyn Nets\",\n\t\t:colors => [\"Black\", \"White\"],\n\t\t:players => {\n\t\t\t\"Alan Anderson\" => {\n\t\t\t\t:number => 0,\n\t\t\t\t:shoe => 16,\n\t\t\t\t:points => 22,\n\t\t\t\t:rebounds => 12,\n\t\t\t\t:assists => 12,\n\t\t\t\t:steals => 3,\n\t\t\t\t:blocks => 1,\n\t\t\t\t:slam_dunks => 1\n\t\t\t},\n\t\t\t\"Reggie Evans\" => {\n\t\t\t\t:number => 30,\n\t\t\t\t:shoe => 14,\n\t\t\t\t:points => 12,\n\t\t\t\t:rebounds => 12,\n\t\t\t\t:assists => 12,\n\t\t\t\t:steals => 12,\n\t\t\t\t:blocks => 12,\n\t\t\t\t:slam_dunks => 7\n\t\t\t},\n\t\t\t\"Brook Lopez\" => {\n\t\t\t\t:number => 11,\n\t\t\t\t:shoe => 17,\n\t\t\t\t:points => 17,\n\t\t\t\t:rebounds => 19,\n\t\t\t\t:assists => 10,\n\t\t\t\t:steals => 3,\n\t\t\t\t:blocks => 1,\n\t\t\t\t:slam_dunks => 15\n\t\t\t},\n\t\t\t\"Mason Plumlee\" => {\n\t\t\t\t:number => 1,\n\t\t\t\t:shoe => 19,\n\t\t\t\t:points => 26,\n\t\t\t\t:rebounds => 12,\n\t\t\t\t:assists => 6,\n\t\t\t\t:steals => 3,\n\t\t\t\t:blocks => 8,\n\t\t\t\t:slam_dunks => 5\n\t\t\t},\n\t\t\t\"Jason Terry\" => {\n\t\t\t\t:number => 31,\n\t\t\t\t:shoe => 15,\n\t\t\t\t:points => 19,\n\t\t\t\t:rebounds => 2,\n\t\t\t\t:assists => 2,\n\t\t\t\t:steals => 4,\n\t\t\t\t:blocks => 11,\n\t\t\t\t:slam_dunks => 1\n\t\t\t}\n\t\t}\n\t},\n\t:away => {\n\t\t:team_name => \"Charlotte Hornets\",\n\t\t:colors => [\"Turquoise\", \"Purple\"],\n\t\t:players => {\n\t\t\t\"Jeff Adrien\" => {\n\t\t\t\t:number => 4,\n\t\t\t\t:shoe => 18,\n\t\t\t\t:points => 10,\n\t\t\t\t:rebounds => 1,\n\t\t\t\t:assists => 1,\n\t\t\t\t:steals => 2,\n\t\t\t\t:blocks => 7,\n\t\t\t\t:slam_dunks => 2\n\t\t\t},\n\t\t\t\"Bismack Biyombo\" => {\n\t\t\t\t:number => 0,\n\t\t\t\t:shoe => 16,\n\t\t\t\t:points => 12,\n\t\t\t\t:rebounds => 4,\n\t\t\t\t:assists => 7,\n\t\t\t\t:steals => 7,\n\t\t\t\t:blocks => 15,\n\t\t\t\t:slam_dunks => 10\n\t\t\t},\n\t\t\t\"DeSagna Diop\" => {\n\t\t\t\t:number => 2,\n\t\t\t\t:shoe => 14,\n\t\t\t\t:points => 24,\n\t\t\t\t:rebounds => 12,\n\t\t\t\t:assists => 12,\n\t\t\t\t:steals => 4,\n\t\t\t\t:blocks => 5,\n\t\t\t\t:slam_dunks => 5\n\t\t\t},\n\t\t\t\"Ben Gordon\" => {\n\t\t\t\t:number => 8,\n\t\t\t\t:shoe => 15,\n\t\t\t\t:points => 33,\n\t\t\t\t:rebounds => 3,\n\t\t\t\t:assists => 2,\n\t\t\t\t:steals => 1,\n\t\t\t\t:blocks => 1,\n\t\t\t\t:slam_dunks => 0\n\t\t\t},\n\t\t\t\"Brendan Haywood\" => {\n\t\t\t\t:number => 33,\n\t\t\t\t:shoe => 15,\n\t\t\t\t:points => 6,\n\t\t\t\t:rebounds => 12,\n\t\t\t\t:assists => 12,\n\t\t\t\t:steals => 22,\n\t\t\t\t:blocks => 5,\n\t\t\t\t:slam_dunks => 12\n\t\t\t}\n\t\t}\n\t}\n}\nend",
"def game_params\n params.require(:game).permit(:game_name, :start_level_id, :description, :admin_id, :image_url, :popularity, :game_image)\n end",
"def game_params\n params.require(:game).permit(:user_id, :game_id, :game_name, :platforms, :img_url_small, :img_url_large, :deck, :developers, :genre)\n end",
"def create_group_stage_game(game) \n \n if Game.cup_home_away_exist?(self, game[0], game[1]) \n \n standing = Standing.find(:first, :conditions => [\"cup_id = ? and item_id = ? and item_type = ?\", self.id, game[0].id, game[0].class.to_s])\n\n last_game = get_the_last_game \n \n return Game.create!(:name => \"Group #{standing.group_stage_name}\", \n :cup_id => self.id, :home_id => game[0].id ,:away_id => game[1].id, \n :starts_at => last_game['starts_at'], :ends_at => last_game['ends_at'], \n :reminder_at => last_game['reminder_at'], :deadline_at => last_game['deadline_at'], \n :type_name => 'GroupStage', :jornada => last_game['jornada'],\n :points_for_single => POINTS_FOR_SINGLE, :points_for_double => POINTS_FOR_DOUBLE, \n :points_for_winner => POINTS_FOR_WINNER, :points_for_draw => POINTS_FOR_DRAW, \n :points_for_goal_difference => POINTS_FOR_GOAL_DIFFERENCE,\n :points_for_goal_total => POINTS_FOR_GOAL_TOTAL)\n end\n end",
"def start_game(game_config)\n # start a new game\nend",
"def description_for(game)\n File.read(\"app/views/games/description/_#{game.slug}.html.haml\")\n end",
"def initialize_game\n setup_boards\n end",
"def game_hash\n game = {\n home: {\n team_name: \"Brooklyn Nets\",\n colors:[\"Black\", \"White\"],\n players: {\n \"Alan Anderson\" => {\n number: 0,\n shoe: 16,\n points: 22,\n rebounds: 12,\n assists: 12,\n steals: 3,\n blocks: 1,\n slam_dunks: 1\n },\n\n \"Reggie Evans\" => {\n number: 30,\n shoe: 14,\n points: 12,\n rebounds: 12,\n assists: 12,\n steals: 12,\n blocks: 12,\n slam_dunks: 7\n },\n\n \"Brook Lopez\" => {\n number: 11,\n shoe: 17,\n points: 17,\n rebounds: 19,\n assists: 10,\n steals: 3,\n blocks: 1,\n slam_dunks: 15\n },\n\n \"Mason Plumlee\" => {\n number: 1,\n shoe: 19,\n points: 26,\n rebounds: 12,\n assists: 6,\n steals: 3,\n blocks: 8,\n slam_dunks: 5\n },\n\n \"Jason Terry\" => {\n number: 31,\n shoe: 15,\n points: 19,\n rebounds: 2,\n assists: 2,\n steals: 4,\n blocks: 11,\n slam_dunks: 1\n }\n }\n },\n\n away: {\n team_name:\"Charlotte Hornets\",\n colors:[\"Turquoise\", \"Purple\"] ,\n players: {\n \"Jeff Adrien\" => {\n number: 4,\n shoe: 18,\n points: 10,\n rebounds: 1,\n assists: 1,\n steals: 2,\n blocks: 7,\n slam_dunks: 2\n },\n\n \"Bismak Biyombo\" => {\n number: 0,\n shoe: 16,\n points: 12,\n rebounds: 4,\n assists: 7,\n steals: 7,\n blocks: 15,\n slam_dunks: 10\n },\n\n \"DeSagna Diop\" => {\n number: 2,\n shoe: 14,\n points: 24,\n rebounds: 12,\n assists: 12,\n steals: 4,\n blocks: 5,\n slam_dunks: 5\n },\n\n \"Ben Gordon\" => {\n number: 8,\n shoe: 15,\n points: 33,\n rebounds: 3,\n assists: 2,\n steals: 1,\n blocks: 1,\n slam_dunks: 0\n },\n\n \"Brendan Haywood\" => {\n number: 33,\n shoe: 15,\n points: 6,\n rebounds: 12,\n assists: 12,\n steals: 22,\n blocks: 5,\n slam_dunks: 12\n }\n }\n }\n }\nend",
"def game_meta_data\n @game_meta_data\n end",
"def start\n # start a new game using @config\n end",
"def complex(title=Wep::Default_title,all_actors=0)\n # Check for upcase conversion\n if Wep::Upcase_titles\n title.upcase!\n end\n # Load mapinfo for map name\n mapinfos = load_data(\"Data/MapInfos.rxdata\")\n # Make the filename\n if Wep::Random_file_name and Wep::Modify_game_system\n filename = Wep::Game_version+\"-\"+$game_system.random_filename+\"-\"+Wep::File_name\n else\n filename = Wep::Game_version+\"-\"+Wep::File_name\n end\n estado = open(filename, \"a\")\n estado.write(\"------------------------------------------\\n\")\n estado.write(\"||||\"+title+\"||||\")\n estado.write(\"\\n------------------------------------------\\n\") \n # Write system time\n date = \"\\nDate: \"\n date+= estado.mtime.to_s\n estado.write(date)\n \n # Write time\n @total_sec = Graphics.frame_count / Graphics.frame_rate\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n \n text = sprintf(\"%02d:%02d:%02d\", hour, min, sec)\n tiempo = \"\\nPlaytime: \"\n tiempo+= text\n estado.write(tiempo)\n # If uses normal style\n if not Wep::Compact_style\n # Write money\n money = \"\\nMoney: \"\n money += $game_party.gold.to_s\n estado.write(money)\n # Write steps\n estado.write(\"\\nSteps: \"+$game_party.steps.to_s)\n # Write actual map(and name)\n estado.write(\"\\nMap: \"+$game_map.map_id.to_s+\" (\"+mapinfos[$game_map.map_id].name+\")\")\n # If uses compact style\n else\n # Write money\n money = \"\\nMoney: \"\n money += $game_party.gold.to_s\n estado.write(money)\n # Write steps\n estado.write(\". Steps: \"+$game_party.steps.to_s)\n # Write actual map(and name)\n estado.write(\". Map: \"+$game_map.map_id.to_s+\" (\"+mapinfos[$game_map.map_id].name+\")\")\n end\n \n # Write actors\n estado.write (\"\\n\\n\")\n # If its only for the actual group\n if all_actors == 1\n actor_id = 1\n for actor in $game_party.actors\n # If uses normal style\n if not Wep::Compact_style\n # Write actor basic Info\n estado.write (\"\\n---------------\\n\")\n estado.write(actor.name)\n estado.write (\"\\n---------------\\n\") \n estado.write($data_classes[actor.class_id].name)\n estado.write (\"\\nNv \")\n estado.write(actor.level)\n estado.write (\"\\n\") \n # If uses compact style\n else\n # Write actor basic Info\n estado.write(\"\\n------------------------\\n\"+actor.name+\" (\"+$data_classes[actor.class_id].name+\") Nv\"+actor.level.to_s+\"\\n------------------------\\n\")\n end\n \n # Write actor equipment (check if equipped)\n if Wep::Write_actor_equipment\n estado.write(\"\\n\\nEquipment:\\n\\n\")\n \n if $game_actors[actor_id].weapon_id != 0\n estado.write(\" \"+$data_system.words.weapon)\n estado.write(\": \")\n estado.write($data_weapons[$game_actors[actor_id].weapon_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.weapon)\n estado.write(\": \")\n estado.write(\"\\n\")\n end\n \n if $game_actors[actor_id].armor1_id != 0\n estado.write(\" \"+$data_system.words.armor1)\n estado.write(\": \")\n estado.write($data_armors[$game_actors[actor_id].armor1_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.armor1)\n estado.write(\": \")\n estado.write(\"\\n\")\n end \n \n if $game_actors[actor_id].armor2_id != 0\n estado.write(\" \"+$data_system.words.armor2)\n estado.write(\": \")\n estado.write($data_armors[$game_actors[actor_id].armor2_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.armor2)\n estado.write(\": \")\n estado.write(\"\\n\")\n end \n \n if $game_actors[actor_id].armor3_id != 0\n estado.write(\" \"+$data_system.words.armor3)\n estado.write(\": \")\n estado.write($data_armors[$game_actors[actor_id].armor3_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.armor3)\n estado.write(\": \")\n estado.write(\"\\n\")\n end\n \n if $game_actors[actor_id].armor4_id != 0\n estado.write(\" \"+$data_system.words.weapon)\n estado.write(\": \")\n estado.write($data_armors[$game_actors[actor_id].armor4_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.armor4)\n estado.write(\": \")\n estado.write(\"\\n\")\n end\n end\n \n # Write actor parameters\n if Wep::Write_actor_parameters\n # If uses normal style\n if not Wep::Compact_style\n estado.write (\"\\n\\nParameters:\\n\\n HP \") \n estado.write($game_actors[actor_id].hp)\n estado.write(\"\\\\\")\n estado.write($game_actors[actor_id].maxhp)\n estado.write(\"\\n SP \")\n estado.write($game_actors[actor_id].sp)\n estado.write(\"\\\\\")\n estado.write($game_actors[actor_id].maxsp)\n estado.write( \"\\n Str \") \n estado.write($game_actors[actor_id].base_str)\n estado.write(\"\\n Dex \") \n estado.write($game_actors[actor_id].base_dex)\n estado.write(\"\\n Agi \")\n estado.write($game_actors[actor_id].base_agi)\n estado.write(\"\\n Int \")\n estado.write($game_actors[actor_id].base_int)\n estado.write(\"\\n PDef \")\n estado.write($game_actors[actor_id].base_pdef)\n estado.write(\"\\n MDef \")\n estado.write($game_actors[actor_id].base_mdef)\n estado.write(\"\\n Atk \")\n estado.write($game_actors[actor_id].base_atk)\n estado.write(\"\\n Eva \")\n estado.write($game_actors[actor_id].base_eva)\n estado.write(\"\\n\")\n # If uses compact style\n else\n estado.write (\"\\n\\nParameters:\\n\\n HP \") \n estado.write($game_actors[actor_id].hp)\n estado.write(\"\\\\\")\n estado.write($game_actors[actor_id].maxhp)\n estado.write(\". SP \")\n estado.write($game_actors[actor_id].sp)\n estado.write(\"\\\\\")\n estado.write($game_actors[actor_id].maxsp)\n estado.write( \"\\n Str \") \n estado.write($game_actors[actor_id].base_str)\n estado.write(\". Dex \") \n estado.write($game_actors[actor_id].base_dex)\n estado.write(\". Agi \")\n estado.write($game_actors[actor_id].base_agi)\n estado.write(\"\\n Int \")\n estado.write($game_actors[actor_id].base_int)\n estado.write(\". PDef \")\n estado.write($game_actors[actor_id].base_pdef)\n estado.write(\". MDef \")\n estado.write($game_actors[actor_id].base_mdef)\n estado.write(\"\\n Atk \")\n estado.write($game_actors[actor_id].base_atk)\n estado.write(\". Eva \")\n estado.write($game_actors[actor_id].base_eva)\n estado.write(\"\\n\")\n end\n end\n \n # Write actor skills \n if Wep::Write_actor_skills\n estado.write(\"\\nSkills:\\n\\n \") \n # If uses normal style\n if not Wep::Compact_style\n for i in 0...$game_actors[actor_id].skills.size \n skill = $data_skills[$game_actors[actor_id].skills[i]]\n if skill != nil\n estado.write(skill.name+\"\\n \")\n end\n end\n # If uses compact style\n else\n c=0\n for i in 0...$game_actors[actor_id].skills.size\n skill = $data_skills[$game_actors[actor_id].skills[i]]\n if skill != nil\n if c == 0\n estado.write(skill.name+\". \") \n c += 1\n elsif c == 1\n estado.write(skill.name+\"\\n \")\n c = 0\n end\n \n end\n \n end\n \n end\n \n end\n \n \n \n \n \n \n estado.write(\"\\n\")\n actor_id += 1\n end\n \n # If is for all actors\n else\n for i in 1...$data_actors.size\n actor_id = i\n actor = $game_actors[i]\n # If uses normal style\n if not Wep::Compact_style\n # Write actor basic Info\n estado.write (\"\\n---------------\\n\")\n estado.write(actor.name)\n estado.write (\"\\n---------------\\n\") \n estado.write($data_classes[actor.class_id].name)\n estado.write (\"\\nNv \")\n estado.write(actor.level)\n estado.write (\"\\n\") \n # If uses compact style\n else\n # Write actor basic Info\n estado.write(\"\\n------------------------\\n\"+actor.name+\" (\"+$data_classes[actor.class_id].name+\") Nv\"+actor.level.to_s+\"\\n------------------------\\n\")\n end\n \n # Write actor equipment (check if equipped)\n if Wep::Write_actor_equipment\n estado.write(\"\\n\\nEquipment:\\n\\n\")\n \n if $game_actors[actor_id].weapon_id != 0\n estado.write(\" \"+$data_system.words.weapon)\n estado.write(\": \")\n estado.write($data_weapons[$game_actors[actor_id].weapon_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.weapon)\n estado.write(\": \")\n estado.write(\"\\n\")\n end\n \n if $game_actors[actor_id].armor1_id != 0\n estado.write(\" \"+$data_system.words.armor1)\n estado.write(\": \")\n estado.write($data_armors[$game_actors[actor_id].armor1_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.armor1)\n estado.write(\": \")\n estado.write(\"\\n\")\n end \n \n if $game_actors[actor_id].armor2_id != 0\n estado.write(\" \"+$data_system.words.armor2)\n estado.write(\": \")\n estado.write($data_armors[$game_actors[actor_id].armor2_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.armor2)\n estado.write(\": \")\n estado.write(\"\\n\")\n end \n \n if $game_actors[actor_id].armor3_id != 0\n estado.write(\" \"+$data_system.words.armor3)\n estado.write(\": \")\n estado.write($data_armors[$game_actors[actor_id].armor3_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.armor3)\n estado.write(\": \")\n estado.write(\"\\n\")\n end\n \n if $game_actors[actor_id].armor4_id != 0\n estado.write(\" \"+$data_system.words.weapon)\n estado.write(\": \")\n estado.write($data_armors[$game_actors[actor_id].armor4_id].name)\n estado.write(\"\\n\")\n else\n estado.write(\" \"+$data_system.words.armor4)\n estado.write(\": \")\n estado.write(\"\\n\")\n end\n end\n \n # Write actor parameters\n if Wep::Write_actor_parameters\n # If uses normal style\n if not Wep::Compact_style\n estado.write (\"\\n\\nParameters:\\n\\n HP \") \n estado.write($game_actors[actor_id].hp)\n estado.write(\"\\\\\")\n estado.write($game_actors[actor_id].maxhp)\n estado.write(\"\\n SP \")\n estado.write($game_actors[actor_id].sp)\n estado.write(\"\\\\\")\n estado.write($game_actors[actor_id].maxsp)\n estado.write( \"\\n Str \") \n estado.write($game_actors[actor_id].base_str)\n estado.write(\"\\n Dex \") \n estado.write($game_actors[actor_id].base_dex)\n estado.write(\"\\n Agi \")\n estado.write($game_actors[actor_id].base_agi)\n estado.write(\"\\n Int \")\n estado.write($game_actors[actor_id].base_int)\n estado.write(\"\\n PDef \")\n estado.write($game_actors[actor_id].base_pdef)\n estado.write(\"\\n MDef \")\n estado.write($game_actors[actor_id].base_mdef)\n estado.write(\"\\n Atk \")\n estado.write($game_actors[actor_id].base_atk)\n estado.write(\"\\n Eva \")\n estado.write($game_actors[actor_id].base_eva)\n estado.write(\"\\n\")\n # If uses compact style\n else\n estado.write (\"\\n\\nParameters:\\n\\n HP \") \n estado.write($game_actors[actor_id].hp)\n estado.write(\"\\\\\")\n estado.write($game_actors[actor_id].maxhp)\n estado.write(\". SP \")\n estado.write($game_actors[actor_id].sp)\n estado.write(\"\\\\\")\n estado.write($game_actors[actor_id].maxsp)\n estado.write( \"\\n Str \") \n estado.write($game_actors[actor_id].base_str)\n estado.write(\". Dex \") \n estado.write($game_actors[actor_id].base_dex)\n estado.write(\". Agi \")\n estado.write($game_actors[actor_id].base_agi)\n estado.write(\"\\n Int \")\n estado.write($game_actors[actor_id].base_int)\n estado.write(\". PDef \")\n estado.write($game_actors[actor_id].base_pdef)\n estado.write(\". MDef \")\n estado.write($game_actors[actor_id].base_mdef)\n estado.write(\"\\n Atk \")\n estado.write($game_actors[actor_id].base_atk)\n estado.write(\". Eva \")\n estado.write($game_actors[actor_id].base_eva)\n estado.write(\"\\n\")\n end\n end\n \n # Write actor skills \n if Wep::Write_actor_skills\n estado.write(\"\\nSkills:\\n\\n \") \n # If uses normal style\n if not Wep::Compact_style\n for i in 0...$game_actors[actor_id].skills.size \n skill = $data_skills[$game_actors[actor_id].skills[i]]\n if skill != nil\n estado.write(skill.name+\"\\n \")\n end\n end\n # If uses compact style\n else\n c=0\n for i in 0...$game_actors[actor_id].skills.size\n skill = $data_skills[$game_actors[actor_id].skills[i]]\n if skill != nil\n if c == 0\n estado.write(skill.name+\". \") \n c += 1\n elsif c == 1\n estado.write(skill.name+\"\\n \")\n c = 0\n end\n \n end\n \n end\n \n end\n \n end\n \n estado.write(\"\\n\")\n \n end\n \n end\n estado.write (\"\\n\")\n \n \n # Write normal style \n if not Wep::Compact_style\n # Write actor items\n if Wep::Write_items\n estado.write(\"--------------\\nInventary:\\n--------------\\n \") \n estado.write(\"\\nItems:\\n\\n \") \n c=0\n for i in 1...$data_items.size\n if $game_party.item_number(i) > 0\n estado.write($data_items[i].name+\": \"+$game_party.item_number(i).to_s+\"\\n \")\n end\n end\n # Write actor weapons\n estado.write(\"\\nWeapons:\\n\\n \")\n c=0\n for i in 1...$data_weapons.size\n if $game_party.weapon_number(i) > 0\n estado.write($data_weapons[i].name+\": \"+$game_party.weapon_number(i).to_s+\"\\n \")\n end\n end\n # Write actor armors\n estado.write(\"\\nArmors:\\n\\n \")\n c=0\n for i in 1...$data_armors.size\n if $game_party.armor_number(i) > 0\n estado.write($data_armors[i].name+\": \"+$game_party.armor_number(i).to_s+\"\\n \")\n end\n end\n end\n \n # Write compact style\n else\n \n # Write items\n if Wep::Write_items\n estado.write(\"--------------\\nInventary:\\n--------------\\n \") \n estado.write(\"\\nItems:\\n\\n \") \n c=0\n for i in 1...$data_items.size\n if $game_party.item_number(i) > 0\n if c == 0\n estado.write($data_items[i].name+\": \"+$game_party.item_number(i).to_s+\". \") \n c += 1\n elsif c == 1 \n estado.write($data_items[i].name+\": \"+$game_party.item_number(i).to_s+\"\\n \")\n end\n end\n end\n # Write weapons\n estado.write(\"\\nWeapons:\\n\\n \")\n c=0\n for i in 1...$data_weapons.size\n if $game_party.weapon_number(i) > 0\n if c == 0\n estado.write($data_weapons[i].name+\": \"+$game_party.weapon_number(i).to_s+\". \") \n c += 1\n elsif c == 1 \n estado.write($data_weapons[i].name+\": \"+$game_party.weapon_number(i).to_s+\"\\n \")\n end \n end\n end\n # Write armors\n estado.write(\"\\n\\nArmors:\\n\\n \")\n c=0\n for i in 1...$data_armors.size\n if $game_party.armor_number(i) > 0\n if c == 0\n estado.write($data_armors[i].name+\": \"+$game_party.armor_number(i).to_s+\". \") \n c += 1\n elsif c == 1 \n estado.write($data_armors[i].name+\": \"+$game_party.armor_number(i).to_s+\"\\n \")\n end\n end\n end\n end \n \n \n \n \n end\n estado.write (\"\\n\")\n estado.close\n end",
"def game_list\n \n # Get the data and create a new instance of \n # Game for each item in the main list\n @doc.css('item').each do |item|\n name = item.css('name')[0]['value']\n rank = item['rank']\n id = item['id']\n year = item.css('yearpublished')[0]['value']\n\n # Create a new instance of Game with item data\n game = BggHotnessCLI::Game.new(name, id, year, rank)\n end\n\n end",
"def commandnewgame_gamedata\r\n # Reset frame count for measuring play time\r\n Graphics.frame_count = 0\r\n # Make each type of game object\r\n $game_temp = Game_Temp.new\r\n $game_system = Game_System.new\r\n $game_switches = Game_Switches.new\r\n $game_variables = Game_Variables.new\r\n $game_self_switches = Game_SelfSwitches.new\r\n $game_screen = Game_Screen.new\r\n $game_actors = Game_Actors.new\r\n $game_party = Game_Party.new\r\n $game_troop = Game_Troop.new\r\n $game_map = Game_Map.new\r\n $game_player = Game_Player.new\r\n end",
"def play_game\n # WarAPI.play_turn()\n end",
"def show_board_game(current_game)\n puts \"#{current_game.players[0].name.capitalize} #{current_game.players[0].avatar} #{current_game.players[0].symbol} \\u{1F19A} #{current_game.players[1].name.capitalize} #{current_game.players[1].avatar} #{current_game.players[1].symbol}\"\n puts \"\"\n for i in 0..2 do\n puts \"----------------\"\n for j in 0..2 do\n print \"| #{current_game.board.boardcase[i][j].content} \"\n end\n puts \"|\"\n end\n puts \"----------------\"\n end",
"def save_moves\n\t\tFile.open(@filename, 'w') {|f| f.write(@past_moves.to_yaml)}\n\tend",
"def start_new_game\n # TODO: increment stats\n # stats = GameStats.new\n # stats.game_number += 1\n\n # create new player\n\n\n # print New game text\n new_game_banner = File.read('./old_code/fancy_text/new_game.txt')\n puts new_game_banner\n\n # display into story\n puts display_intro(@player_one.name)\n\n # auto load stage 1\n require './lib/stage'\n Stage.new(1, 5, @player_one)\n end",
"def load_supported_games\r\n @supported_game_map = InfoAvailableGames.info_supported_games(@log)\r\n #p @supported_game_map\r\n SETTINGS_DEFAULT_APPGUI[:games_opt] = {}\r\n @supported_game_map.each do |k, game_item|\r\n if game_item[:enabled] == true\r\n require game_item[:file_req]\r\n @log.debug(\"Game #{game_item[:name]} is enabled\")\r\n SETTINGS_DEFAULT_APPGUI[:games_opt][k] = game_item[:opt]\r\n end\r\n end\r\n end",
"def play\n $game.surface.+$game.white.get('Ant')\n $game.surface.+$game.black.get('Beetle')\n $game.surface.+($game.white.get('Ant'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant1]), Side::Face[:bottom_left])\n #$game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:bottom_left])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Ant'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]), Side::Face[:bottom_right])\n $game.surface.+($game.black.get('Queen'), $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Queen'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant3]), Side::Face[:bottom_right])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:queen1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Spider'), $game.surface.bug(Hive::Color[:white], Bug::Type[:queen1]), Side::Face[:bottom_center])\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper2]).move(Hive::Color[:black], Bug::Type[:beetle1], Side::Face[:bottom_left])\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]).move(Hive::Color[:black], Bug::Type[:queen1], Side::Face[:bottom_center])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:top_center])\n \n # Try putting a $game.list_moves after any move directive\n\n puts \"\\n\\n=====PROOF SECTION=======================\"\n $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper1]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper2]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper3]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:queen1]).describe\n \n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant1]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant3]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:queen1]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:spider1]).describe\n end",
"def game(name)\n\t\t\traise ArgumentError, 'BGGPlays::game Argument is not string' unless name.is_a? String \n\t\t\t#validates string\n\t\t\tname.to_s\n\t\t\tselect(:bg_name, name)\n\t\tend"
] | [
"0.6945381",
"0.6874358",
"0.6593015",
"0.657946",
"0.65297467",
"0.650175",
"0.6465459",
"0.64196795",
"0.6417755",
"0.64036214",
"0.6372766",
"0.63324267",
"0.63127553",
"0.63097715",
"0.63062483",
"0.63062483",
"0.63062483",
"0.63062483",
"0.63062483",
"0.630572",
"0.6305287",
"0.6305287",
"0.6282468",
"0.62620246",
"0.6238144",
"0.6212574",
"0.6176898",
"0.6167555",
"0.6148994",
"0.61033916",
"0.609556",
"0.60589474",
"0.605623",
"0.601532",
"0.59872997",
"0.5978103",
"0.59475803",
"0.59382176",
"0.59366626",
"0.5924768",
"0.5886992",
"0.5885518",
"0.5867628",
"0.5861509",
"0.5854798",
"0.5853949",
"0.5834109",
"0.5830604",
"0.5819469",
"0.5817486",
"0.5816891",
"0.5790112",
"0.5785599",
"0.578344",
"0.5776302",
"0.57700545",
"0.5760111",
"0.57595724",
"0.5756104",
"0.5747974",
"0.57475203",
"0.57434815",
"0.5732939",
"0.57095426",
"0.5693328",
"0.56821185",
"0.5669439",
"0.5668515",
"0.56655633",
"0.5663044",
"0.5659863",
"0.564727",
"0.56442654",
"0.56058824",
"0.55921483",
"0.55912113",
"0.55742407",
"0.55730397",
"0.5567315",
"0.55633986",
"0.55496037",
"0.5546203",
"0.55437213",
"0.55429095",
"0.55425113",
"0.5540917",
"0.5539334",
"0.5536083",
"0.55234694",
"0.5520068",
"0.5510479",
"0.550622",
"0.5505467",
"0.55023247",
"0.5501577",
"0.55002105",
"0.54982334",
"0.54844445",
"0.5482931",
"0.5481338"
] | 0.54805577 | 100 |
stubs blocks yield Performance Monitor This is (a stripped down version of) an actual useful concept: a function that runs a block of code and then tells you how long it took to run. | def measure (n=1)
cnt=0
elapsed_time=Time.now
n.times {
cnt+=1
yield}
elapsed_time=(Time.now-elapsed_time)/cnt
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timed_run(&block)\n time = Benchmark.measure do\n block.call\n end\n puts time\nend",
"def bench(descr)\n start = Time.now\n yield\n puts \"#{descr} : #{Time.now-start} seconds\"\nend",
"def benchmark\n start = Time.now\n yield\n p Time.now - start\nend",
"def measure_time(&block)\n start_time = Time.now\n yield\n Time.now - start_time\nend",
"def profile block_description, &block\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\" if $profiling_status\nend",
"def bench(&block)\n t0 = Time.now\n block.call\n t1 = Time.now\n\n t1 - t0\nend",
"def custom_benchmark\n start_time = Time.now\n yield if block_given?\n elapsed_time = Time.now - start_time\n puts \"Custom Benchmark Time in Seconds: #{elapsed_time}\"\nend",
"def custom_benchmark(name)\n start_time = Time.now\n yield if block_given?\n elapsed_time = Time.now - start_time\n puts \"#{name} Time in Seconds: #{elapsed_time}\"\nend",
"def benchmark\n start_time = Time.now\n yield\n end_time = Time.now\n running_time = end_time - start_time\nend",
"def bench type\n t1 = Time.now\n yield\n t2 = Time.now\n p \"#{type} used #{t2 - t1} seconds\"\nend",
"def bench(name, &block)\n time = Benchmark.realtime do\n yield block\n end\n puts \"#{name}: #{time}\"\nend",
"def benchmark\n start_time = Time.now\n calculation = yield\n end_time = Time.now\n run_time = end_time - start_time\n run_time\nend",
"def profile block_description, &block\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\nend",
"def profile block_description, &block\n profiling_on = true\n if profiling_on == true\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\n else\n block.call\n end\nend",
"def profile (block_description, &block)\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\nend",
"def benchmark\n start_time = Time.now\n result = yield\n end_time = Time.now\n benchmark = end_time - start_time\nend",
"def measure\n start = Time.now\n yield\n Time.now - start\n end",
"def profile block_description, &block \n \tif $profiling_on\n \t\tstart_time = Time.new\n\t\tblock.call\n\t\tduration = Time.new - start_time\n\t\tputs \"#{block_description}: #{duration} seconds\"\n\telse\n\t\tblock.call\n\tend\nend",
"def time_it\n time_before = Time.now\n yield\n time_after = Time.now\n\n puts \"It took #{time_after - time_before} seconds.\"\nend",
"def profile(description_of_block, &block)\n start_time = Time.now \n block.call \n duration = Time.now - start_time\n puts description_of_block+': '+duration.to_s+' seconds'\nend",
"def time_it\n time_before = Time.now\n yield\n time_after = Time.now\n\n puts \"it took #{time_after - time_before} seconds.\"\nend",
"def profile blockDescription, &block\n startTime = Time.now\n\n block.call\n \n duration = Time.now - startTime\n\n puts blockDescription + ': '+duration.to_s+' seconds'\n\nend",
"def time_block\n start = Time.now\n yield\n time = Time.now - start\n puts \"Block took basically 0 time\" if time < 0.001\n raise \"Block took #{time} to execute\" if time > 0.001\nend",
"def time description = '', &block\n start = Time.now\n yield\n puts \"execution time of #{description.empty? ? block.to_s : description}: #{Time.now - start}\"\nend",
"def benchmark\n start_time = Time.now\n yield\n end_time = Time.now\n end_time - start_time\n\n # Your benchmarking code goes here.\nend",
"def benchmark(&block)\n end",
"def blocks_time\n Benchmark::Tms.new\n end",
"def profile_time\n time_elapsed = Benchmark.realtime do\n yield\n end\n\n puts \"Time: #{time_elapsed.round(3)} seconds\"\n # print \";#{time_elapsed.round(3)}\"\n end",
"def time(times = 1)\n require 'benchmark'\n ret = nil\n Benchmark.bm { |x| x.report { times.times { ret = yield } } }\n ret\nend",
"def measure\n start = Time.now\n yield\n Time.now - start\n end",
"def benchmark\n t1 = Time.now\n output = yield\n [\"#{(Time.now - t1) * 1000}ms\", output]\nend",
"def timer\n # 2. start executing the method\n start_time = Time.now\n yield # 3. jump out of 'timer', start execuding the block\n\n # 6. continue executing the method as per usual\n end_time = Time.now\n\n puts \"Elapsed time: #{end_time - start_time} s\"\nend",
"def tm()\n start = Time.now\n result = yield\n delta = Time.now - start\n puts \"Elapsed: #{delta} seconds\"\n result\nend",
"def benchmark\n start_time = Time.now\n result = yield\n\n [time_beween_in_ms(start_time, Time.now), result]\n end",
"def measure(heading)\n start_time = Time.now\n print heading\n result = yield\n end_time = Time.now - start_time\n puts \" (#{end_time} s)\"\n result\nend",
"def time(count = 1000, &block)\n start = Time.now\n 1000.times { yield }\n end_time = Time.now\n puts (end_time - start) * 1000\nend",
"def time_it\n time_before = Time.now\n yield # do whatever\n time_after = Time.now\n puts \"It tooke #{time_after - time_before} seconds!\"\nend",
"def grandfather_clock block_description, &block\n profling_on = true\n if profling_on == true\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\n else\n block.call\n end\nend",
"def with_logging(&block)\n\tstart_time = Time.now\n\tputs \"Starting running code at #{start_time}\"\n\tblock.call\n\tend_time = Time.now\n\tputs \"Finishing running code #{end_time}\"\n\ttime_taken = end_time - start_time\n\tputs \"Time taken was #{time_taken} seconds\"\nend",
"def measure(prefix = '', &block)\n # GC.start\n # memory_before = `ps -o rss= -p #{Process.pid}`.to_i/1024\n \n time = Benchmark.realtime do\n yield\n end\n \n # GC.start\n # memory_after = `ps -o rss= -p #{Process.pid}`.to_i/1024\n # puts \"#{prefix}time: #{time.round(2)}, memory: #{\"%d MB\" % (memory_after - memory_before)}\"\n puts \"#{prefix}time: #{time.round(2)}\"\nend",
"def time_this &block\n _time_this_starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n block.call\n Process.clock_gettime(Process::CLOCK_MONOTONIC) - _time_this_starting\nend",
"def time\n start = Time.now.to_f\n yield\n puts \"Computation time is:\\n\"\n puts Time.now.to_f - start\n end",
"def record_measure_elapsed(label)\n elapsed = Benchmark.realtime do\n yield\n end\n\n mins, secs = elapsed.abs.divmod(60)\n $logger.debug(\"#{label}: #{mins}m #{secs.to_i}s\")\nend",
"def time_it(label)\n start_time = Time.now\n yield\n elapsed_time = Time.now - start_time\n puts \"#{label} took #{elapsed_time} seconds\"\nend",
"def bmark(title, times, &code)\n print \"* #{title}...\"\n result = 0\n times.times do\n @setup.call if @setup\n partial = Time.now \n yield\n result += Time.now - partial\n @teardown.call if @teardown\n end\n puts \"done: #{time result}\"\n result \n end",
"def times\n if block_given? # metodo de kernel para verificar si viene un bloque\n p yield(1, 100) # yield ejecuta el bloque que se paso por parametros\n end\nend",
"def benchmark(title)\n result = nil\n logger.level = Logger::ERROR\n bm = Benchmark.measure { result = yield }\n logger.level = Logger::DEBUG\n logger.info \"#{title} (#{sprintf(\"%f\", bm.real)})\"\n return result\n end",
"def measure(name, &block)\n if self.running? name\n yield\n else\n result = nil\n self.results[name] ||= 0\n self.running << name\n self.results[name] += Benchmark.measure{result = yield}.real\n self.running.delete(name)\n result\n end\n end",
"def timer(&block)\n start_time = Time.now\n yield(start_time)\n time_elapsed = Time.now - start_time\n end",
"def measure\n start_real = System.monotonic_time\n start_cpu = System.cpu_time\n retval = yield\n\n real_time = System.monotonic_time - start_real\n cpu_time = System.cpu_time - start_cpu\n\n @real_time += real_time\n @cpu_time += cpu_time\n @call_count += 1\n\n if above_threshold?\n self.class.gitlab_method_call_duration_seconds.observe(@transaction.labels.merge(labels), real_time)\n end\n\n retval\n end",
"def time(message=nil)\n start = Time.now\n result = yield\n elapsed = Time.now - start\n \n print \"[#{message}] \" if message\n puts \"elapsed time: %0.5fs\" % elapsed\n result\nend",
"def timer\n start_at = Time.now\n yield\n seconds = Time.now - start_at\n time_per_gem_text = \"#{(seconds / Float(gems_count)).round(2)} second(s) per gem\"\n puts \"\\nIt took #{seconds} second(s) to spy #{gems_count} gem(s) (#{time_per_gem_text}).\"\n end",
"def benchmark_time(*args, &block)\n b = BenchmarkTime::BenchmarkTime.new(*args, &block)\n b.run\nend",
"def with_benchmarking\n self.time = Benchmark.realtime do\n yield\n end\n end",
"def time\n tstart = Time.now.to_f\n yield\n tend = Time.now.to_f\n tend - tstart\nend",
"def timer(method=nil, *args)\n start_time = Time.now\n if block_given?\n yield\n else\n send(method, args)\n end\n end_time = Time.now\n puts \"Time elapsed #{(end_time - start_time)} seconds\"\nend",
"def average_exec_time(&block)\n (0...1000).sum do\n Benchmark.measure(&block).real\n end / 1000\nend",
"def time\n @began = Time.now\n yield\n ensure\n self.info \"Finished in %.1f sec.\" % (Time.now - @began)\n end",
"def time\n start = Time.now\n yield\n Time.now - start\nend",
"def benchmark\nend",
"def methods_time\n Benchmark::Tms.new\n end",
"def around_perform_measure_ttp(*)\n ttp = Benchmark.realtime { yield }\n @registry.hset key, 'ttp', ttp\n @registry.hincrbyfloat key, 'total_ttp', ttp\n end",
"def time(msg, &block)\n return(yield) unless $verbose\n print \"#{msg}...\"\n t = Time.now.to_f\n response = yield\n print \"(%0.2f ms) \" % (Time.now.to_f - t)\n if info = response['result_info']\n print \"[%s/%s/%s/%s] \" %\n info.values_at(*%w(page per_page count total_count)).map(&:to_s)\n end\n puts \"OK\" if response.fetch('success')\n puts \"FAIL\" unless response.fetch('success')\n response\n end",
"def record_measure(label)\n $logger.debug(\n tms = Benchmark.measure(label) do\n yield\n end.format(\"%n: %10.6rreal %10.6u user %10.6y sys\")\n )\nend",
"def with_timer(name, &block)\n start = Time.now\n block.call\n duration = Time.now - start\n # report in ms\n self.add_field(name, duration * 1000)\n self\n end",
"def with_timer(&block)\n start_time = Time.now\n block.call\n end_time = Time.now\n duration_in_seconds = (end_time - start_time).to_i\n $stderr.puts \"Total duration: #{ duration_in_seconds } seconds.\"\n end",
"def timed(&block)\n @@start_time = Time.now\n Thread.new(&block).join\n @@elapsed_time = Time.now - @@start_time\n @@average_times.push(@@elapsed_time) \n end",
"def quick(repetitions=100, &block)\n require 'benchmark'\n Benchmark.bmbm do |b|\n b.report {repetitions.times &block}\n end\n nil\nend",
"def measure\n start_real = System.monotonic_time\n start_cpu = System.cpu_time\n retval = yield\n\n real_time = System.monotonic_time - start_real\n cpu_time = System.cpu_time - start_cpu\n\n @real_time += real_time\n @cpu_time += cpu_time\n @call_count += 1\n\n if call_measurement_enabled? && above_threshold?\n self.class.call_duration_histogram.observe(@transaction.labels.merge(labels), real_time / 1000.0)\n end\n\n retval\n end",
"def with_timing(caption)\n start_time = Time.now\n print caption.to_s\n yield\n puts \"(#{(Time.now - start_time).duration})\"\n end",
"def time(label, &block)\n raise ArgumentError, 'no block given' unless block\n\n `#{@native}.time(label)`\n\n begin\n if block.arity == 0\n instance_exec(&block)\n else\n yield(self)\n end\n ensure\n `#{@native}.timeEnd()`\n end\n end",
"def profile\n profile_memory do\n profile_time do\n profile_gc do\n yield\n end\n end\n end\n end",
"def monitor(*args, &bl)\n result = nil\n took = Benchmark.realtime {\n result = bl.call\n }\n Tools.info(args, op_took: took)\n result\n end",
"def build_timing; end",
"def time\n start_time = Time.now.to_f\n yield\n end_time = Time.now.to_f\n return end_time - start_time\n end",
"def time(key, &block)\n if block_given?\n yield\n else\n NullTimedExecution\n end\n end",
"def measure(msg)\n start = Time.now\n yield\n printf \"%<msg>s in %<elapsed>.2f seconds\\n\", msg: msg, elapsed: Time.now - start\nend",
"def measure(msg)\n start = Time.now\n yield\n printf \"%<msg>s in %<elapsed>.2f seconds\\n\", msg: msg, elapsed: Time.now - start\nend",
"def quick(repetitions=100, &block)\n require 'benchmark'\n\n Benchmark.bmbm do |b|\n b.report {repetitions.times &block} \n end\n nil\nend",
"def quick(repetitions=100, &block)\n require 'benchmark'\n Benchmark.bmbm do |b|\n b.report {repetitions.times &block} \n end\n nil\nend",
"def exec_time(proc)\n start = Time.now\n proc.call\n Time.now - start\nend",
"def timer(method)\n Benchmark.bm do |x|\n x.report { method }\n end\n end",
"def bench n\n t = Time.now\n n.times{ yield }\n cost = Time.now - t\n\n t = Time.now\n n.times{}\n baseline = Time.now - t\n\n cost - baseline\nend",
"def time(identifier)\n if active?\n unless block_given?\n raise \"Please supply a block of code for Etalon to instrument\"\n end\n\n start = Time.now\n\n return_value = yield\n\n duration = elapsed(start)\n\n key = key_from(identifier: identifier)\n store = instrument_store_for(key: key)\n\n store[:count] += 1\n store[:min] = duration if duration < store[:min]\n store[:max] = duration if duration > store[:max]\n store[:all] << duration\n\n return_value\n else\n yield\n end\n end",
"def time_operation(&block)\n start = Time.now.to_ms\n yield\n Time.now.to_ms - start\n end",
"def exec_time(proc)\n start_time = Time.now\n proc.call\n Time.now - start_time\nend",
"def bm( description, &block )\n tms = nil\n puts \"Benchmarking #{description}\"\n\n Benchmark.bm { |x| tms = x.report(&block) }\n delete_all\n failed = false\n\n OpenStruct.new description: description, tms: tms, failed: failed\n end",
"def summarize(&block)\n started = Time.now\n yield\n ensure\n results(Time.now - started)\n end",
"def with_timer(name)\n start = Time.now\n yield\n duration = Time.now - start\n # report in ms\n add_field(name, duration * 1000)\n self\n end",
"def time\n beg_time = Time.now\n yield\n end_time = Time.now\n end_time - beg_time\n end",
"def _ta(label)\n $agg[label] ||= { time: 0, num_calls: 0 }\n t = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n ret = yield\n ensure\n $agg[label][:time] += (Process.clock_gettime(Process::CLOCK_MONOTONIC) - t)\n $agg[label][:num_calls] += 1\n ret\n end",
"def server_timing; end",
"def benchmark(function)\n RubyBenchmarks.time_method do\n self.send(function)\n end\n end",
"def benchmark(message)\n start = Time.now\n print(stdout, \"#{message} \")\n result = yield\n duration = Time.now - start\n info(\"✔\".green + format(\" %0.3fs\", duration).gray)\n result\n rescue\n info(\"✘\".red)\n raise\n end",
"def benchmark(title = nil, &block)\n puts \"\\n## #{title}\\n\\n\\n```\\n\" if title\n Benchmark.bmbm(&block)\n puts \"```\"\n end",
"def benchmark(title = nil, &block)\n puts \"\\n## #{title}\\n\\n\\n```\\n\" if title\n Benchmark.bmbm(&block)\n puts \"```\"\n end",
"def time_method\n beginning_time = Time.now\n yield\n end_time = Time.now\n (end_time - beginning_time) * 1000\nend",
"def exec_time(proc)\n begin_time = Time.now\n proc.call\n Time.now - begin_time\nend",
"def exec_time(proc)\n # your code here\n x = Time.now\n proc.call()\n y = Time.now\n y - x\nend",
"def test_returns_correct_output_minitest\n stat_printer = StatCustomPrinter.new\n\n # stubbing the Ruby way ... OK\n stat = Object.new\n def stat.name\n \"My Stat\"\n end\n def stat.value\n 100\n end\n\n # Stub out Time.now() ONLY for the duration of the block\n Time.stub(:now, Time.mktime(2015, 05, 11)) do\n assert_equal(\"Date : 11/05/2015\\nName: My Stat\\nvalue:100\",\n stat_printer.print(stat))\n end\n end"
] | [
"0.7542573",
"0.7482536",
"0.73488665",
"0.7310012",
"0.7307402",
"0.72471327",
"0.7212225",
"0.7210083",
"0.7194402",
"0.7180565",
"0.7180482",
"0.7177534",
"0.71647835",
"0.71335363",
"0.7118577",
"0.711352",
"0.7095569",
"0.7031781",
"0.7027405",
"0.7023289",
"0.7017483",
"0.69959813",
"0.69907683",
"0.6977941",
"0.69450885",
"0.6917594",
"0.6869492",
"0.6839701",
"0.67904425",
"0.6782915",
"0.6774491",
"0.6751227",
"0.6725602",
"0.6704401",
"0.6696181",
"0.66507244",
"0.66317815",
"0.6630783",
"0.66228396",
"0.65763986",
"0.6512376",
"0.64971805",
"0.64871454",
"0.64570975",
"0.6437604",
"0.642606",
"0.6418719",
"0.6413549",
"0.63971126",
"0.6390464",
"0.6381738",
"0.63806695",
"0.6368631",
"0.63588506",
"0.6341628",
"0.6309986",
"0.62874323",
"0.6275023",
"0.62421435",
"0.62165296",
"0.6202019",
"0.6184118",
"0.61711633",
"0.6170577",
"0.616621",
"0.6150683",
"0.61460966",
"0.61353576",
"0.6130348",
"0.6103895",
"0.6100044",
"0.6094192",
"0.60898376",
"0.6083868",
"0.6069368",
"0.6061816",
"0.605438",
"0.605438",
"0.604179",
"0.6037401",
"0.6003295",
"0.5982154",
"0.5967906",
"0.5966095",
"0.59356123",
"0.5925273",
"0.59170216",
"0.5911561",
"0.5911112",
"0.5902002",
"0.5900543",
"0.58986026",
"0.5892509",
"0.58919114",
"0.5889894",
"0.5889894",
"0.5884101",
"0.5876653",
"0.58623415",
"0.5862055"
] | 0.62784004 | 57 |
Overwriting the sign_out redirect path method | def after_sign_out_path_for(resource_or_scope)
root_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_sign_out_path_for(resource_or_scope)\n '/signed_out'\n end",
"def after_sign_out_path_for(_resource_or_scope)\n '/'\n end",
"def after_sign_out_path_for(resource_or_scope); end",
"def signout_url\n {:controller => 'auth', :action => 'signout'}\n end",
"def after_sign_out_path_for(resource_or_scope)\n '/users/sign_in'\n end",
"def after_sign_out_path_for(resource_or_scope)\n \"/app/users/sign_in\"\n end",
"def after_sign_out_path_for(resource_or_scope)\n Faraday.get(logout_path) if logout_path.present?\n super(resource_or_scope)\n end",
"def after_sign_out_path_for(resource)\n '/'\n end",
"def after_sign_out_path_for(user)\n '/'\n end",
"def after_sign_out_path_for(_resource_or_scope)\n user_session_path\n end",
"def after_sign_out_path_for(_resource_or_scope)\n user_session_path\n end",
"def after_sign_out_path_for(_resource_or_scope)\n user_session_path\n end",
"def after_sign_out_path_for(_resource_or_scope)\n user_session_path\n end",
"def sign_out_and_redirect(resource_or_scope); end",
"def after_sign_out_path_for(resource_or_scope)\n # caught by apache to trigger pubcookie logout\n '/logout'\n end",
"def after_sign_out_path_for(resource_or_scope)\n flash[:logout] = true\n root_path\n end",
"def sign_out_and_redirect!(return_to = \"/\")\n sign_out_user\n redirect_to sign_out_url(return_to)\n end",
"def after_sign_out_path_for(resource)\n \tnew_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n user_session_path\n end",
"def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n '/'\n end",
"def after_sign_out_path_for(resource_or_scope)\n '/'\n end",
"def after_sign_out_path_for user\n reset_session\n\n # for hijacking\n # cookies.delete :secure_user_id\n\n new_user_session_path\n # root_path\n end",
"def after_sign_out_path_for(_resource_or_scope)\n # require 'pry'\n # binding.pry\n # Note: at this time: flash[:notice] => \"Signed out successfully.\"\n # current_user is nil.\n new_user_session_path # signIn page\n end",
"def after_sign_out_path_for(resource_or_scope)\n # path before sign out request\n \"#{URI(request.referer).path}?logged_out=1\"\n end",
"def destroy\n super\n after_sign_out_path_for(resource)\n end",
"def sign_out\n\n # mark them as signed out.\n # (this is a helper method of devise, the rails ruby gem we're using for\n # authentication in the sample app.)\n # \n # \n #session_sign_out <---- NEED TO CHANGE TO CUSTOM USER SIGN OUT\n\n # send them back to the homepage.\n redirect_to root_path\n\n end",
"def after_sign_out_path_for(resource_or_scope)\n if request.params[:type] == \"sso\"\n Rails.configuration.devise[:sign_out_redirect_url]\n else\n super\n end\n end",
"def after_sign_out_path_for(resource_or_scope)\r\n '/'\r\n end",
"def after_sign_out_path_for(resource_or_scope)\n sign_in_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n sign_in_path\n end",
"def after_sign_out_path_for(_resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(_resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(_resource)\n root_path\n end",
"def after_sign_out_path_for(_resource)\n root_path\n end",
"def after_sign_out_path_for(_resource_or_scope)\n root_path\n # new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n cookies.delete :pa_auth_token\n \n \"#{Civiccommons::PeopleAggregator.URL}/logout.php?redirect=http://#{request.host}#{request.port == \"80\" ? nil : \":#{request.port}\"}\"\n end",
"def after_sign_out_path_for(resource)\n #if current_user_signed_in?\n # redirect_to home_path \n # else\n redirect_to site_index_path \n #end \n end",
"def after_sign_out_path_for(_resource)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource)\n\t\tnew_user_session_path\n\tend",
"def after_sign_out_path_for(resource_or_scope)\n user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path \n end",
"def sign_out\n logout\n end",
"def after_sign_out_path_for(resource_or_scope)\n if logout_path.present?\n logout_path\n else\n super(resource_or_scope)\n end\n end",
"def after_sign_out_path_for(resource_or_scope)\n if logout_path.present?\n logout_path\n else\n super(resource_or_scope)\n end\n end",
"def after_sign_out_path_for(resource_or_scope)\n if logout_path.present?\n logout_path\n else\n super(resource_or_scope)\n end\n end",
"def after_sign_out_path_for(resource_or_scope)\n if logout_path.present?\n logout_path\n else\n super(resource_or_scope)\n end\n end",
"def after_sign_out_path_for(resource_or_scope)\n \tuser_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n \tlogin_path\n \tend",
"def after_sign_out_path_for(resource_or_scope)\n login_url\n end",
"def after_sign_out_path_for(resource_or_scope)\n home_path(:ref => \"logout\")\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n \tlogin_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n \t\t\troot_path\n \t\t end",
"def after_sign_out_path_for(_resource)\n root_url\n end",
"def after_sign_out_path_for resource_or_scope\n redirect_uri = params[:redirect_uri]\n redirect_uri ? redirect_uri : super\n end",
"def after_sign_out_path_for(resource_or_scope)\n '/members/sign_in'\n end",
"def signout\n self.oaw_signout\n redirect_to root_url\n end",
"def after_sign_out_path_for(resource)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n login_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n # root_path\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\r\n login_path\r\n end",
"def after_sign_out_path_for(_)\n root_url\n end",
"def after_sign_out_path_for(resource)\r\n app_root + \"/sessions/new\"\r\n end",
"def after_sign_out_path_for(resource)\n root_path\n end",
"def after_sign_out_path_for(resource)\n root_path\n end",
"def after_sign_out_path_for(resource)\n root_path\n end",
"def signed_out_user\n redirect_to root_path unless !user_signed_in?\n end",
"def after_sign_out_path_for(params)\n bienvenida_path\n end",
"def destroy\n redirect_path = after_sign_out_path_for(\"user\")\n signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(\"user\"))\n set_flash_message :notice, :signed_out if signed_out && is_navigational_format?\n super\n end",
"def after_sign_out_path_for(_resource)\n I18n.locale == I18n.default_locale ? '/' : \"/#{I18n.locale}\"\n end",
"def after_sign_out_path_for(_resource_or_scope)\n home_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n \tnew_user_session_path\n end",
"def after_sign_out_path_for(user)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource)\n home_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end"
] | [
"0.8102037",
"0.8007481",
"0.7984188",
"0.79324496",
"0.7897868",
"0.78892565",
"0.7874593",
"0.78685254",
"0.7857867",
"0.78436327",
"0.78436327",
"0.78436327",
"0.78436327",
"0.7842701",
"0.7821579",
"0.77880424",
"0.7748489",
"0.77373666",
"0.7731692",
"0.77291566",
"0.77291566",
"0.77291566",
"0.77291566",
"0.77291566",
"0.77275157",
"0.77275157",
"0.77213097",
"0.7716111",
"0.77091455",
"0.7708274",
"0.7705286",
"0.7694537",
"0.769133",
"0.76831216",
"0.76831216",
"0.7682263",
"0.7682263",
"0.76777554",
"0.76777554",
"0.766948",
"0.76651865",
"0.7643722",
"0.7641334",
"0.7640336",
"0.7632876",
"0.76290107",
"0.7623703",
"0.7622437",
"0.7622437",
"0.7622437",
"0.7622437",
"0.7620571",
"0.76168233",
"0.76150995",
"0.7613417",
"0.76068157",
"0.7601874",
"0.75970936",
"0.75918543",
"0.7589092",
"0.7588269",
"0.75851965",
"0.7572588",
"0.75579655",
"0.75575614",
"0.7550016",
"0.75415194",
"0.75405365",
"0.7534009",
"0.7534009",
"0.7534009",
"0.7527172",
"0.7521995",
"0.75215167",
"0.75173414",
"0.7514277",
"0.7509254",
"0.7504709",
"0.74846214",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154",
"0.74819154"
] | 0.0 | -1 |
Creates and initializes a new instance of the Web class. | def initialize(client)
@client = client
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @web= Web.new\n end",
"def create_web(name, template, options = {}, &blk)\n\t\t\t # create our new web\n\t\t\t new_web = Webs.create_web(@web, name, template, options)\n\t\t\t context_for_new_object(new_web, WebContext, &blk)\n\t\t\tend",
"def initialize(web3)\n @web3 = web3\n end",
"def initialize\n @logger = Logging::Logger[self]\n\n @builder = Builder.new\n ::Webby.load_files\n\n @watcher = DirectoryWatcher.new '.', :interval => 2\n @watcher.add_observer self\n\n glob = []\n glob << File.join(::Webby.site.layout_dir, '**', '*')\n glob << File.join(::Webby.site.content_dir, '**', '*')\n @watcher.glob = glob\n\n @web_server = ::Webby.site.use_web_server ? WebServer.new : nil\n\n @launchy = ::Webby.site.autobuild_launch_url\n unless @launchy\n @launchy = \"http://localhost:#{::Webby.site.web_port}\" if @web_server\n end\n end",
"def initialize(*args)\n @web_node = args[0]\n end",
"def web_hook\n unless instance_variable_defined?(:@web_hook)\n @web_hook = if (cls = web_hook_class)\n cls.new(self)\n end\n end\n\n @web_hook\n end",
"def initialize(params = {}, &block)\n @module_name = self.class.parent.to_s\n @class_name = self.class.to_s.split(\"::\").last\n define_site_pages\n define_flows\n config = Settings.config(@class_name).merge(params)\n browser_name = config[:browser] || 'chrome'\n browser_driver = config[:driver] || 'watir' \n browser_params = config[browser_name] || {}\n @browser = Browser.create(browser_name, browser_driver, browser_params)\n goto(config[:url]) if config[:url]\n execute_block_and_close_browser(browser, &block) if block_given?\n end",
"def set_web\n @web = Web.find(params[:id])\n end",
"def web=(value)\n @web = value\n end",
"def setup_browser\n @browser = Browser.new(self)\n end",
"def initialize(url)\n self.url = url\n self\n end",
"def createWebView\n # Initialize the WebView\n @web_view = WebView.alloc.initWithFrame(CGRectMake(1, 1, POPUP_WIDTH, POPUP_HEIGHT - ARROW_HEIGHT))\n @web_view.setMainFrameURL WEB_VIEW_URL\n\n @web_view.setFrameLoadDelegate(self) #?\n @web_view.setDrawsBackground(false) #?\n end",
"def initialize(kernel, id, url)\n @kernel, @id, @base_url = kernel, id, url\n @browser = Waw::WSpec::Browser.new(url)\n @logged = false\n end",
"def initialize(url=nil)\n @url = url\n @@all << self\n end",
"def set_web\n @web = Web.find(params[:id]) if params[:id].is_a?(Integer)\n end",
"def initialize(url)\n @url = url\n # Create our mechanized instance\n @mechanize_instance = SharedMechanize.instance\n end",
"def initialize(url)\n @client = Mechanize.new\n get(url)\n end",
"def initialize(env)\n @traits = Class.new { include Attributes }.new( :waves => {} )\n @request = Rack::Request.new(env).freeze\n @response = Waves::Response.new( self )\n end",
"def new\n @url = Url.new\n end",
"def initialize(url)\n @url = url\n end",
"def initialize\n raise NotImplementedError, 'need to implement #intialize and set @url'\n end",
"def initialize(url)\n @url = url\n end",
"def initialize\n @browsers = []\n @selenium_port = 4444\n @selenium_timeout = 4000\n @url = \"http://www.google.com\"\n @hooks = {:before => {}, :after =>{}}\n end",
"def initialize()\r\n buildProperties = parse([BUILD_PROPERTIES, LOCAL_PROPERTIES]);\r\n testProperties = parse([TEST_PROPERTIES, LOCAL_PROPERTIES]);\r\n @app_host = testProperties[\"config_appHost\"]\r\n @module_html = buildProperties[\"config_appStartupUrl\"]\r\n @base_url = self.app_host + \"/\" + self.module_html\r\n @admin_user = testProperties[\"config_credentialsAdmin\"]\r\n @normal_user = testProperties[\"config_credentialsUser\"]\r\n @browser = testProperties[\"config_capybaraSeleniumBrowser\"]\r\n @browserPath = testProperties[\"config_capybaraSeleniumBrowserPath\"]\r\n @defaultAjaxWaitTime = testProperties[\"config_defaultAjaxWaitTime\"]\r\n end",
"def start_webserver\n stop_webserver\n Webserver.run!\n end",
"def initialize(url)\n @url = url\n end",
"def web\n return @web\n end",
"def initialize(url)\n self.url = url\n end",
"def create\n @web = Web.new(web_params)\n\n respond_to do |format|\n if @web.save\n format.html { redirect_to @web, notice: 'Web was successfully created.' }\n format.json { render :show, status: :created, location: @web }\n else\n format.html { render :new }\n format.json { render json: @web.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(auth, user_agent = nil, api_url: 'https://api.weeb.sh')\n @user_agent = WeebSh::API.format_user_agent(user_agent)\n @auth = auth\n @api_url = api_url\n\n raise WeebSh::Err::BadAuth, 'Authorization is empty!' if auth.empty?\n puts '[WeebSh::Client] Your User Agent is empty. Please consider adding a user agent to help identify issues easier.' if user_agent.nil?\n puts '[WeebSh::Client] Your User Agent is not ideal. Please consider adding a user agent to help identify issues easier.' if !user_agent.nil? && user_agent.split('/').count < 2\n\n @toph = WeebSh::Toph.new(auth, user_agent, api_url: api_url, client: self)\n @korra = WeebSh::Korra.new(auth, user_agent, api_url: api_url, client: self)\n @shimakaze = WeebSh::Shimakaze.new(auth, user_agent, api_url: api_url, client: self)\n @tama = WeebSh::Tama.new(auth, user_agent, api_url: api_url, client: self)\n end",
"def init(url = 'localhost:3000', app = 'weapp')\n @url = url\n @app = app\n end",
"def initialize(url)\n @url = url\n freeze\n end",
"def initialize(env)\n @request = Zero::Request.new(env)\n @response = Zero::Response.new\n @renderer = self.class.renderer\n end",
"def web_client\n client.web_client\n end",
"def initialize(web_service_url, username=nil, password=nil)\n @url = web_service_url\n @url.chop! if @url =~ /\\/$/ # Remove any trailing slash\n @username = username\n @password = password\n @client = Cherby::Client.new(@url)\n end",
"def new\n \t@url = Url.new\n end",
"def initialize(options = {})\n \n # TODO: elegant regexp for Merb.root folder\n self.name = options[:name] || sanitize_filename(Merb.root[/\\/(.[^\\/]*)$/,1]) \n \n path = File.join(\"webby\", self.name)\n index = File.join(path, \"content\", \"index\")\n \n unless File.exists? index\n # Generate webby app with this site parameters\n # use --force to rewrite website (avoid console prompt on overwrite)\n Webby::Apps::Generator.new.run [\"--force\", # options\n \"website\", # template\n path] # path\n \n # rename index file, without extension\n File.rename \"#{index}.txt\", index\n end\n end",
"def initialize browser\n @browser = browser\n end",
"def initialize(name, url) \n\t\t@name = name \n\t\t@url = url \n\t\t@@all << self \n\tend",
"def initialize( page )\n unless page.instance_of? Resources::Page\n raise ArgumentError,\n \"only page resources can be rendered '#{page.path}'\"\n end\n\n @page = page\n @pages = Resources.pages\n @partials = Resources.partials\n @content = nil\n @config = ::Webby.site\n\n @_bindings = []\n @log = Logging::Logger[self]\n end",
"def initialize\n @renderer = RenderingPolicy.new(configuration)\n @middleware = configuration.middleware\n end",
"def web\n Minimart::Commands::Web.new(options).execute!\n\n rescue Minimart::Error::BaseError => e\n Minimart::Error.handle_exception(e)\n end",
"def initialize(params={}, &block)\n @site = self\n @parent_module = self.class.parent\n @module_name = @parent_module.to_s\n @class_name = self.class.to_s.split(\"::\").last\n\n define_flows\n load_methods_files\n \n page_loader = PageLoader.new(@module_name, pages_path)\n @pages = page_loader.page_names\n @methods_module = page_loader.page_methods\n @methods_module.send(:include, Methods)\n @methods_module.send(:include, Spec::Matchers)\n @methods_module.send(:include, @parent_module::Methods) if defined?(@parent_module::Methods)\n self.extend(@methods_module)\n\n @browser = params[:browser]\n initialize_browser\n\n execute_block_and_close_browser(&block) if block_given?\n end",
"def initialize(url = \"http://localhost:3000\", headers = {})\n @uri = URI url\n @headers = headers\n end",
"def initialize(address)\n @requests = [HTTY::Request.new(address)]\n end",
"def initialize(url = BASE_URL)\n @agent = Mechanize.new\n @current_page = @agent.get url\n end",
"def call(env)\n (@web_server ||= WebServer.new).call(env)\n end",
"def initialize(http)\n @http = http\n end",
"def initialize\n super\n self.scripts = []\n self.template_paths = []\n self.libraries = {}\n self.options = SymbolHash.new(false).update(\n :single_library => true,\n :caching => false\n )\n self.server_options = {:Port => 8808}\n end",
"def initialize(url_str)\n STDERR.puts \"Getting URL '#{url_str}'\"\n uri = URI.parse(url_str)\n unless VALID_SCHEMES.include?(uri.scheme)\n STDERR.puts \"URL protocol is not one of #{VALID_SCHEMES.join(',')}\"\n exit 1\n end\n if proxy = ENV['HTTP_PROXY']\n prx_uri = URI.parse(proxy)\n prx_host = prx_uri.host\n prx_port = prx_uri.port\n end\n\n h = Net::HTTP.new(uri.host, uri.port, prx_host, prx_port)\n h.set_debug_output($stderr) if $DEBUG\n h.use_ssl = uri.scheme == \"https\"\n h.verify_mode = OpenSSL::SSL::VERIFY_NONE # OpenSSL::SSL::VERIFY_PEER\n\n @body = ''\n begin\n @get_resp = h.get2(uri.request_uri, HTTP_GET_HEADER){|resp| @body += resp.body}\n rescue Exception => ex\n STDERR.puts \"Unable to get web page. Error: #{ex}\"\n exit 1\n end\n STDERR.puts \"#{@get_resp.class}\"\n\n end",
"def initialize\n # Set some default values.\n # We're running `varnishlog` on localhost.\n default_http_hostname = 'http://localhost'\n default_http_port = '80'\n default_request_uri = '/'\n \n @uri = URI.parse(\"#{default_http_hostname}:#{default_http_port}#{default_request_uri}\")\n @http = Net::HTTP.new(@uri.host, @uri.port)\n @request_headers = {\n 'Host' => 'www.example.com',\n 'User-Agent' => 'shellac'\n }\n @request = Net::HTTP::Get.new(@uri.request_uri, @request_headers)\n end",
"def initialize\n @klass = 'HOME'\n @description = nil\n # Wait for the page to be displayed with MAX_WAIT_ON_LOAD seconds timeout\n raise 'The page was not loaded' unless self.displayed?($janus::MAX_WAIT_ON_LOAD)\n end",
"def new\n @url = Url.new\n end",
"def new\n @url = Url.new\n end",
"def initialize(web_page)\n @title = web_page.detect_meta_tag('property', 'og:title', 'content')\n @type = web_page.detect_meta_tag('property', 'og:type', 'content')\n @image = parse_media(:image, web_page)\n @url = web_page.detect_meta_tag('property', 'og:url', 'content')\n @video = parse_media(:video, web_page)\n end",
"def initialize\n @agent = Mechanize.new\n end",
"def initialize\n\t\t\t\tcgi = CGI.new('html4')\n\n\t\t\t\t# We make sure to delete an old session if one exists,\n\t\t\t\t# not just to free resources, but to prevent the session\n\t\t\t\t# from being maliciously hijacked later on.\n\t\t\t\tbegin\n\t\t\t\t\t@session = CGI::Session.new(cgi, 'database_manager' => CGI::Session::PStore, 'new_session' => false)\n\t\t\t\t\[email protected]\n\t\t\t\trescue ArgumentError # if no old session\n\t\t\t\tend\n\t\t\t\t@session = CGI::Session.new(cgi, 'database_manager' => CGI::Session::PStore, 'new_session' => true)\n\t\t\t\t@session['datastore'] = {}\n\t\t\tend",
"def initialize!\n return if params[:id] == 'ping'\n\n key = \"/#{self.class.route_root}/#{params[:id]}\"\n test_params = Internal::Controller.cache_read(key)\n\n @component_name = test_params[0]\n @component_params = test_params[1]\n @html_block = test_params[2]\n @render_params = test_params[3]\n @render_on = @render_params.delete(:render_on) || :client_only\n @_mock_time = @render_params.delete(:mock_time)\n @style_sheet = @render_params.delete(:style_sheet)\n @javascript = @render_params.delete(:javascript)\n @code = @render_params.delete(:code)\n\n @page = ['<body>']\n end",
"def initialize\n init\n end",
"def new\n #Creates a new tweet object. Variable is used with the new html page\n @tweet = Tweet.new\n end",
"def new\n @host = Host.new\n end",
"def initialize\n @router = Router.new(ROUTES)\n end",
"def new\n @element = Element.new\n end",
"def initialize(app_class, env)\n\t\t\t@app_class = app_class\n\t\t\t@env = env\n\t\t\t@request = Flame::Dispatcher::Request.new(env)\n\t\t\t@response = Flame::Dispatcher::Response.new\n\t\tend",
"def initialize(options) #:not-new:\n @options = options\n load_html_template\n @main_page_path = nil\n end",
"def initialize( host, port = 8888, path = \"websocket\",\n version = self.version, support )\n super(\"http://#{host}:#{port}/#{path}\") #setup websocket connection\n\n self.init_event_handlers()\n\n @callbacks = {}\n @collections = {}\n @subs = {}\n @version = version\n @session = nil\n @curr_id = 0\n @support = support\n\n end",
"def initialize(html_parser, css_parser, configure, symbol_file_name = nil)\n Hatemile::Helper.require_not_nil(html_parser, css_parser, configure)\n Hatemile::Helper.require_valid_type(\n html_parser,\n Hatemile::Util::Html::HTMLDOMParser\n )\n Hatemile::Helper.require_valid_type(\n css_parser,\n Hatemile::Util::Css::StyleSheetParser\n )\n Hatemile::Helper.require_valid_type(\n configure,\n Hatemile::Util::Configure\n )\n Hatemile::Helper.require_valid_type(symbol_file_name, String)\n\n @html_parser = html_parser\n @css_parser = css_parser\n @configure = configure\n @id_generator = Hatemile::Util::IDGenerator.new('css')\n set_symbols(symbol_file_name)\n end",
"def initialize(url, hdrs = nil)\n @logger = Neko.logger\n @init_uri = URI(url)\n raise ArgumentError, 'Invalid URL' unless @init_uri.class <= URI::HTTP\n @http = Net::HTTP.new(init_uri.host, init_uri.port)\n http.use_ssl = init_uri.scheme == 'https'\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n @headers = hdrs\n end",
"def initialize()\n end",
"def initialize(instanceName)\r\n\t\tif Object.respond_to?(:_get, true)\r\n\t\t\t@get = _get\r\n\t\t\t@useragent = _meta[\"HTTP_USER_AGENT\"]\r\n\t\telse\r\n\t\t\tKnj::Web::global_params\r\n\t\t\t@get = $_GET\r\n\t\t\t@useragent = Apache.request.headers_in[\"User-Agent\"]\r\n\t\tend\r\n\t\t\r\n\t\t@InstanceName = instanceName\r\n\t\t@BasePath = '/fckeditor/'\r\n\t\t@Width = '100%'\r\n\t\t@Height = '200'\r\n\t\t@ToolbarSet\t= 'Default'\r\n\t\t@Value = ''\r\n\t\t@Config = []\r\n\tend",
"def initialize( *args )\n\t\t@template = nil\n\t\t@template_dir = GENERATOR_DIR + 'template/darkfish'\n\t\t\n\t\t@files = []\n\t\t@classes = []\n\t\t@hyperlinks = {}\n\n\t\t@basedir = Pathname.pwd.expand_path\n\n\t\tsuper\n\tend",
"def initialize(browser)\n self.browser = browser\n end",
"def initialize(verbose=nil, debug=nil)\n url = URI.parse(\"https://www.blablacar.fr/\")\n if debug\n proxy = Net::HTTP::Proxy(\"127.0.0.1\", 8080)\n @http = proxy.start(\n url.host,\n url.port,\n :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE)\n else\n @http = Net::HTTP.new(url.host, url.port)\n @http.use_ssl = true\n end\n @cookie = nil\n @messages = 0\n @notifications = []\n @virement = nil\n $VERBOSE = verbose\n $DDEBUG = debug\n @authenticated = nil\n @dashboard = nil\n @current_user = nil\n end",
"def initialize(url, username, password, ba_username = nil, ba_password = nil)\n @agent = WWW::Mechanize.new\n if ba_username != nil\n @agent.auth(ba_username, ba_password)\n end\n @url = url\n @username = username\n @password = password\n @log = Logger.new(STDOUT)\n @log.progname = self.class.to_s\n @log.level = Logger::DEBUG\n @dummy =false\n end",
"def initialize(config)\n setup(config)\n log 'New World Instance initialized!'\n end",
"def initialize\n @client = Savon.client(wsdl: Twinfield::WSDLS[:session])\n end",
"def initialize(url=\"\")\n @serverURL = url\n end",
"def initialize(params)\n @options = params[:options] || { }\n @target = params[:target] || './'\n\n @html_files = []\n @links = []\n @errors = []\n @warnings = []\n @return_code = 0\n\n @options[:max_threads] ||= 4\n end",
"def initialize(url_str)\n $LOG.info \"Getting URL '#{url_str}'\"\n uri = URI.parse(url_str)\n unless VALID_SCHEMES.include?(uri.scheme)\n $LOG.fatal \"URL protocol is not one of #{VALID_SCHEMES.join(',')}\"\n exit 1\n end\n if proxy = ENV['HTTP_PROXY']\n prx_uri = URI.parse(proxy)\n prx_host = prx_uri.host\n prx_port = prx_uri.port\n end\n\n h = Net::HTTP.new(uri.host, uri.port, prx_host, prx_port)\n h.set_debug_output($stderr) if $DEBUG\n h.use_ssl = uri.scheme == \"https\"\n h.verify_mode = OpenSSL::SSL::VERIFY_NONE # OpenSSL::SSL::VERIFY_PEER\n\n @body = ''\n begin\n @get_resp = h.get2(uri.request_uri, Config[:http_get_header]){|resp| @body += resp.body}\n rescue Exception => ex\n $LOG.fatal \"Unable to get web page. Error: #{ex}\"\n exit 1\n end\n\n if http_redirect?\n $LOG.debug \"#{@get_resp.class} is a kind of HTTPRedirection\"\n $LOG.debug \"Redirect location = #{redirect_location}\"\n elsif http_success?\n $LOG.debug \"#{@get_resp.class} is a kind of HTTPSuccess\"\n else\n $LOG.debug \"#{@get_resp.class} is neither HTTPSuccess nor HTTPRedirection!!!\"\n end\n\n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def initialize\n config.base_uri = Config::BASE_URI\n config.user_agent = Config::USER_AGENT\n config.extend(Config)\n end",
"def initialize(browser = Watirloo::BrowserHerd.browser , &blk)\n @b = browser\n @faces = {}\n instance_eval(&blk) if block_given? # allows the shortcut to do some work at page creation\n end",
"def initialize(browser)\n @browser = browser\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize(page, _url = nil)\n @page = page\n #@page.click_button('Continue') if @page.has_text?('Maintainence')\n @page.visit(target_base_url + '/sources')\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end"
] | [
"0.7012912",
"0.66679406",
"0.66447395",
"0.6522962",
"0.6464505",
"0.62941104",
"0.62031883",
"0.6153433",
"0.6145058",
"0.60960096",
"0.6031048",
"0.60147876",
"0.59465915",
"0.5945385",
"0.59400433",
"0.59072125",
"0.5900642",
"0.589394",
"0.58758444",
"0.5866958",
"0.5865451",
"0.58650684",
"0.5864658",
"0.58499277",
"0.5820349",
"0.5813312",
"0.58118063",
"0.5805826",
"0.57754433",
"0.5773435",
"0.57703817",
"0.57528734",
"0.57509285",
"0.57492954",
"0.5739666",
"0.5732812",
"0.5725308",
"0.57223725",
"0.572181",
"0.5719087",
"0.57142997",
"0.5691446",
"0.5678682",
"0.56706536",
"0.56686556",
"0.56611866",
"0.56574136",
"0.5649696",
"0.5649486",
"0.56494415",
"0.5645372",
"0.5642382",
"0.5637728",
"0.5637728",
"0.5636366",
"0.5634204",
"0.5633023",
"0.56255645",
"0.5620157",
"0.5617638",
"0.56126225",
"0.56106824",
"0.55908287",
"0.5589079",
"0.55859876",
"0.5581145",
"0.5563995",
"0.5544763",
"0.552862",
"0.552045",
"0.5518232",
"0.5513574",
"0.5512558",
"0.5510091",
"0.5492403",
"0.5481556",
"0.54729354",
"0.5471581",
"0.5470114",
"0.5464483",
"0.5464483",
"0.5464483",
"0.5464483",
"0.5464483",
"0.5464483",
"0.5464483",
"0.5464483",
"0.5464483",
"0.5464422",
"0.5451615",
"0.54466116",
"0.54445034",
"0.54445034",
"0.5442982",
"0.5441857",
"0.5441857",
"0.5441857",
"0.5441857",
"0.5441857",
"0.5441857",
"0.5441857"
] | 0.0 | -1 |
Create slicing planes which are perpendicular to the reference segment. | def slicing_planes(segmenter)
plane_normal = segmenter.segment.line[1]
segmenter.points.map { |point|
[point.clone, plane_normal.clone]
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_perpendicular\n p1dot_ = self * P1\n p2dot_ = self * P2\n p1dot_ = -p1dot_ if p1dot_ < 0\n p2dot_ = -p2dot_ if p2dot_ < 0\n p1dot_ < p2dot_ ? (self % P1) : (self % P2)\n end",
"def plane\n return nil if @vertices.length < 3\n Plane.three_points(*@vertices[0..2])\n end",
"def project_to_plane\n end",
"def vertices\n [\n @origin,\n { x: x_max, y: y_min, z: z_min },\n { x: x_min, y: y_max, z: z_min },\n { x: x_min, y: y_min, z: z_max },\n { x: x_max, y: y_max, z: z_min },\n { x: x_max, y: y_min, z: z_max },\n { x: x_min, y: y_max, z: z_max },\n { x: x_max, y: y_max, z: z_max }\n ]\n end",
"def unit_perpendicular_vector(options={})\n return [self[1], -self[0]].unit_vector if options[:counter_clockwise]\n [-self[1], self[0]].unit_vector\n end",
"def normal_vector a_point\n i_point = Point.new()\n i_point.add_object(self)\n plane = Plane.new.add_object(a_point).add_object([self, :normal])\n i_point.add_object(plane)\n Vector.new i_point, a_point\n end",
"def perpendicular\n Vector2d.new(-@y, @x)\n end",
"def vertices\n vertices = []\n\n vertices << [(@origin[0] + @l/2.0), (@origin[1] + @h/2.0), (@origin[2] + @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] + @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] - @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] - @h/2.0), (@origin[2] + @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] - @h/2.0), (@origin[2] + @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] - @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] + @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] + @h/2.0), (@origin[2] + @w/2.0)]\n\n vertices\n end",
"def perpendicular\n Vector2d.new(-y, x)\n end",
"def cross v\n x = @y * v.z - @z * v.y\n y = @z * v.x - @x * v.z\n z = @x * v.y - @y * v.x\n Vector.new x, y, z\n end",
"def polygon_vertices(sides, size)\n return [CP::Vec2.new(-size, size), CP::Vec2.new(size, size), CP::Vec2.new(size, -size), CP::Vec2.new(-size, -size)]\n end",
"def perpendicular_segment(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point.' unless point.is_a?(Point)\n\n return point if self.contains?(point)\n \n l = self.perpendicular_line(point)\n p = Line.new(self.p1, self.p2).intersection(l).first\n\n Segment.new(point, p)\n end",
"def sides\n return @sides if defined?(@sides)\n\n @sides = []\n (-vertices.length...0).each do |i|\n @sides << Segment.new(vertices[i], vertices[i + 1])\n end\n\n @sides\n end",
"def flip_range_xy(points); points.collect{ |v| Vertex.new(-v.y,-v.x)}; end",
"def Point3dAreVectorsPerpendicular(arg0, arg1)\n ret = _invoke(1610743881, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def perp\n Vect2.new(-@y, @x)\n end",
"def add_plane()\n planes << Plane.new(\n gen_location,\n 0,\n width,\n height,\n gen_speed(),\n true\n )\n end",
"def Vector3dAreVectorsPerpendicular(arg0, arg1)\n ret = _invoke(1610744182, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def solid\n return [@p1.x, @p1.y,\n @p2.x - @p1.x,\n @p2.y - @p1.y,\n @r, @g, @b]\n end",
"def initilize land_planes=[] #collection of planes\n\t\t@land_planes = land_planes\n\tend",
"def projected_onto( vector )\n dup.project_onto!( vector )\n end",
"def Transform3dIsMirrorAboutPlane(arg0, arg1, arg2)\n ret = _invoke(1610744074, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def perpendicular?(vector2)\n end",
"def Point3dPlanarAngleBetweenVectors(arg0, arg1, arg2)\n ret = _invoke(1610743866, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def world_to_segment_space\n # TODO: Will the direction of the segment matter? Does it need to be\n # sorted somehow?\n @segment.transformation.inverse\n end",
"def offset(delta, dist = 1.5)\n # set delta according to polygon direction, set veriables for first and last p/l\n delta = delta * orientation\n p_first, p_last = nil; offset_lines = []\n l_first, l_last = nil; offset_points = []\n refined_points = []\n\n # Offset lines between 2 consecutive vertices out by delta\n vertices.each_cons(2) do |p1, p2|\n p_first ||= p1; p_last = p2 # save first and last vector for final line\n offset_lines << offset_line(p1, p2, delta)\n end\n offset_lines << offset_line(p_last, p_first, delta)\n\n # Calculate intersections between adjacent lines for new vertices\n offset_lines.each_cons(2) do |l1, l2|\n l_first ||= l1; l_last = l2 # save first and last vector for final intersection\n offset_points << line_intersection(l1, l2)\n end\n offset_points.insert(0, line_intersection(l_first, l_last))\n\n # Smooth corners of very acute angles\n offset_points.each_with_index do |p, key|\n v = p - vertices[key]\n if v.magnitude > (dist * delta).abs\n p2 = vertices[key] + v.normalize * dist * delta.abs\n # normal vector for 2 vertices through a point dist*delta away\n cutoff_line = [p2, p2 + v.normal_vector]\n [-1, 0].each do |i|\n if key + i < 0\n n = offset_lines.size - 1\n elsif key + i >= offset_lines.size\n n = 0\n else\n n = key + i\n end\n refined_points << line_intersection(cutoff_line, offset_lines[n])\n end\n else\n refined_points << p\n end\n end\n refined_points\n end",
"def normal_towards(a, b, c)\n ac = a.dot(c)\n bc = b.dot(c)\n\n x = b.x * ac - a.x * bc\n y = b.y * ac - a.y * bc\n\n V.new(x, y)\n end",
"def mesh_vertices\r\n # private ?\r\n d = TT::Instance.definition( @instance )\r\n transformation = @instance.model.edit_transform\r\n points = mesh_points( final_subdivs, transformation )\r\n vertices = raw_mesh_vertices()\r\n\r\n # <debug>\r\n unless points.size == vertices.size\r\n Console.log( 'mesh_vertices' )\r\n Console.log( \"> Points: #{points.size}\" )\r\n Console.log( \"> Vertices: #{vertices.size}\" )\r\n end\r\n # </debug>\r\n\r\n patch_vertices = []\r\n for point in points\r\n vertex = vertices.find { |v| v.position == point } # (!) Optimize\r\n patch_vertices << vertex\r\n vertices.delete( vertex )\r\n end\r\n patch_vertices\r\n end",
"def create_rod(sPoint, a)\r\n pts = []\r\n pts[0] = sPoint\r\n pts[1] = Geom::Point3d.new(sPoint[0] + a, sPoint[1], sPoint[2])\r\n return pts\r\nend",
"def vertices\n result = [[@origin_x, @origin_y, @origin_z]]\n dimensions = [@length, @width, @height]\n \n dimensions.each_with_index do |dimension, index|\n temp = result[0].dup\n temp[index] += dimension\n result << temp\n (index...dimensions.length).each do |index2|\n next if index == index2\n temp2 = temp.dup\n temp2[index2] += dimensions[index2]\n result << temp2\n end\n end\n result << [@origin_x + @length, @origin_y + @width, @origin_z + @height]\n result\n end",
"def Transform3dFromMirrorPlane(arg0, arg1)\n ret = _invoke(1610744055, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def add_section_plane(plane)\n end",
"def reflection\n i = self.copy\n n = self.normalized\n r = ( 2 * ((i*(-1.0)).dot(n)) * (n) ) + ( n )\n r = Vector.new(r.a)\n end",
"def flip_range_neg_xy(points); points.collect{ |v| Vertex.new(v.y,v.x)}; end",
"def center\n @center ||= begin\n xs, ys = vertices.transpose\n [xs.inject(:+)/xs.size.to_f, ys.inject(:+)/ys.size.to_f]\n end\n end",
"def Point2dAreVectorsPerpendicular(arg0, arg1)\n ret = _invoke(1610743831, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def calculate_road p0, p1\n # unit vector pointing from p0 to p1\n n = (p1 - p0).normalize.normal_vector * ROAD_WIDTH\n \n a = p0 + n\n b = p0 - n\n c = p1 + n\n d = p1 - n\n [a, b, c, d]\n end",
"def perpendicular_line(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point.' unless point.is_a?(Point)\n\n # any two lines in R^2 intersect, so blindly making\n # a line through p in an orthogonal direction will work\n Line.new(point, point + self.direction.orthogonal_direction.to_point)\n end",
"def compute_field_of_view(ux,uy,vx,vy)\n\n # --- Near plan :\n near_left_x = ux * ( @near - @center ) - vx * @near_fov_width\n near_left_y = uy * ( @near - @center ) - vy * @near_fov_width\n near_right_x = ux * ( @near - @center ) + vx * @near_fov_width\n near_right_y = uy * ( @near - @center ) + vy * @near_fov_width\n\n # --- Far plan :\n far_left_x = ux * ( @far - @center ) - vx * @far_fov_width\n far_left_y = uy * ( @far - @center ) - vy * @far_fov_width\n far_right_x = ux * ( @far - @center ) + vx * @far_fov_width\n far_right_y = uy * ( @far - @center ) + vy * @far_fov_width\n\n # --- Rotation center :\n center_x = 0#ux * ( @center )\n center_y = 0#uy * ( @center )\n\n [ [ [ near_left_x, near_left_y ],\n [ near_right_x, near_right_y ],\n [ far_right_x, far_right_y ],\n [ far_left_x, far_left_y ] ],\n\n [ center_x, center_y ] ]\n end",
"def unit_vector\n\t\tlen = self.r\n\t\traise Vector::ZeroOperation if (len == 0)\n\t\tself * (1/len)\n\t\t# Vector3D.new(@x*(1.0/len), @y*(1.0/len), @z*(1.0/len))\n\tend",
"def perpendicular_bisector(x1, y1, x2, y2)\n [\n x2 - x1,\n y2 - y1,\n 0.5 * (x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1)\n ]\n end",
"def to_v\n Vector3.new(@x, @y, @z)\n end",
"def s_copy\n Vector3f.new(@x, @y, @z)\n end",
"def vector(idx)\n # Dir'n: right up left down\n vectors = [[1, 0], [0, 1], [-1, 0], [0, -1]]\n vectors[idx % 4]\nend",
"def vertices\n VertexList.new(1, nil, [@centre])\n end",
"def extract_vector3d!\n a = self\n if false and a.length == 0 then raise \"Expected vector coordinates\"\n elsif a.length >= 4 and a[0].kind_of? Numeric and a[1].kind_of? Numeric and a[2].kind_of? Numeric and\n a[3].kind_of? Numeric\n return Vector3d.new(a.slice!(0, 4))\n elsif a.length >= 3 and a[0].kind_of? Numeric and a[1].kind_of? Numeric and a[2].kind_of? Numeric\n return Vector3d.new(a.slice!(0, 3))\n elsif a.length >= 1 and a[0].kind_of? Vertex3d\n return a.slice!(0, 1).first\n elsif a.length >= 1 and a[0].kind_of? Array and (a[0].length == 3 or a[0].length == 4)\n return Vector3d.new(*a.slice!(0, 1).first)\n elsif a.length >= 1 and a.first.kind_of? Array and a.first.length == 1 and a.first.first.kind_of? Numeric\n i = a.slice!(0,1).first.first\n return Vector3d.new(i, i, i)\n elsif a.length == 1 and a[0].kind_of? Numeric # but a[1] and/or a[2] are not, so it's only 1 number\n return Vector3d.new(a.slice!(0, 1).first)\n elsif a.length == 0\n return Vector3d.new(0,0,0)\n end\n raise ArgumentError, \"Could not parse vector coordinates out of #{self.inspect}\"\n end",
"def perpdot v\n (@x * v.y) - (@y * v.x)\n end",
"def distance_to_plane(plane)\n end",
"def cross!(*args)\n vx, vy, vz = args.extract_vector3i!\n self.x, self.y, self.z = y * vz - z * vy, z * vx - x * vz, x * vy - y * vx\n self\n end",
"def Vector3dPlanarAngleBetweenVectors(arg0, arg1, arg2)\n ret = _invoke(1610744172, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def test_intersect_with_a_coplanar_ray\n p = Plane()\n r = Ray(Point(0, 0, 0), Vector(0, 0, 1))\n xs = p.intersect(r)\n assert_equal xs.count, 0\n end",
"def Point3dProjectToPlane3d(arg0, arg1, arg2 = nil, arg3 = nil)\n ret = _invoke(1610744125, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_VARIANT, VT_BOOL])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def subdivide\n ab = (midpoint a, b).normalize\n bc = (midpoint b, c).normalize\n ca = (midpoint c, a).normalize\n smallerTriangles = Array.new\n smallerTriangles << (Triangle.new a, ab, ca)\n smallerTriangles << (Triangle.new ab, b, bc)\n smallerTriangles << (Triangle.new bc, c, ca)\n smallerTriangles << (Triangle.new ab, bc, ca)\n end",
"def vertices\n [\n pos,\n Vertex.new(pos.x, pos.y + dims.y, pos.z),\n Vertex.new(pos.x + dims.x, pos.y + dims.y, pos.z),\n Vertex.new(pos.x + dims.x, pos.y, pos.z),\n Vertex.new(pos.x, pos.y, pos.z + dims.z),\n Vertex.new(pos.x, pos.y + dims.y, pos.z + dims.z),\n Vertex.new(pos.x + dims.x, pos.y, pos.z + dims.z),\n Vertex.new(pos.x + dims.x, pos.y + dims.y, pos.z + dims.z)\n ]\n end",
"def flip_range_x(points); points.collect{ |v| Vertex.new(v.x, -v.y)}; end",
"def crossPointsAround\n [KBPoint.new.init([x+1,y]),KBPoint.new.init([x-1,y]),KBPoint.new.init([x,y-1]),KBPoint.new.init([x,y+1])]\n end",
"def petunin(points)\n\tif points.size() < 4\n\t\tputs \"Error on #{__LINE__} in #{__FILE__}\"\n\t\texit(1)\n\tend\n\t#return [x,x0,y,y0]\n\trect = find_rect(points)\n\tdx, phi, coef = get_transf_coef(rect)\n\tdx.each {}\n\t#rect = translate(rect, -dx[0], -dx[1])\n\trect = rotate(rect, phi)\n\trect = scale(rect, 1.0, coef)\n\n\t#points = translate(points, -dx[0], -dx[1])\n\tpoints = rotate(points,phi)\n\tpoints = scale(points, 1, coef)\n\n\tcentre = rect[0].zip(rect[2]).to_a.map { |u,v| (u+v)/2 }\n\trs = []\n\tpoints.each do |p|\n\t\trs << [dist(p, centre), p]\n\tend\n\trs = rs.sort\n\n\tres = []\n\n\trs.each do |r,p|\n\t\tel = Ellipse.new\n\t\tel.centre = centre\n\t\tel.axes = [r]*2\n\n\t\t#back\n\t\tel.scale(1, 1/coef)\n\n\t\tel.rotate(-phi)\n\t\tres << [el,p]\n\tend\n\n\treturn res\n\n\t# For testing reasons only\n\n\t#rect = scale(rect, 1, 1/coef)\n\t#points = scale(points, 1, 1/coef)\n\t#rect = rotate(rect, -phi)\n\t#points = rotate(points, -phi)\n\t#points.map! { |x| [x] }\n\n\t#points + [rect] + res.inject([]) { |sum,el| sum + [el.get_draw_data] }\nend",
"def projection(vect1, vect2)\n d = vect2.dot(vect2)\n\n if 0 < d\n dp = vect1.dot(vect2)\n vect2 * (dp / d)\n else\n vect2\n end\n end",
"def use_section_planes?\n end",
"def cross(v1, v2)\n dx, dy = v2[0] - v1[0], v2[1] - v1[1]\n cr = [] # array containing intersections\n\n if dx == 0 and dy ==0 then\n\tnc = 0\n elsif dx == 0 then\n\tt = ( 0.0 - v1[1] ) / dy # y = 0\n\tx , y = v1[0] + t * dx, v1[1] + t * dy\n cr.push( [x, y] ) if x >= 0 && x <= 1 && t >= 0 && t <= 1\n\tt = ( 1.0 - v1[1] ) / dy # y = 1\n\tx, y = v1[0] + t * dx, v1[1] + t * dy\n\tcr.push( [x, y] ) if x >= 0 && x <= 1 && t >= 0 && t <= 1\n elsif dy == 0 then\n\tt = ( 0.0 - v1[0] ) / dx # x = 0\n\tx, y = v1[0] + t * dx, v1[1] + t * dy\n\tcr.push( [x, y] ) if y >= 0 && y <= 1 && t >= 0 && t <= 1\n\tt = ( 1.0 - v1[0] ) / dx # x = 1\n\tx, y = v1[0] + t * dx, v1[1] + t * dy\n cr.push( [x, y] ) if y >= 0 && y <= 1 && t >= 0 && t <= 1\n else\n\tt = ( 0.0 - v1[1] ) / dy # y = 0\n\tx , y = v1[0] + t * dx, v1[1] + t * dy\n cr.push( [x, y] ) if x >= 0 && x <= 1 && t >= 0 && t <= 1\n\tt = ( 1.0 - v1[1] ) / dy # y = 1\n\tx, y = v1[0] + t * dx, v1[1] + t * dy\n\tcr.push( [x, y] ) if x >= 0 && x <= 1 && t >= 0 && t <= 1\n\tt = ( 0.0 - v1[0] ) / dx # x = 0\n\tx, y = v1[0] + t * dx, v1[1] + t * dy\n\tcr.push( [x, y] ) if y >= 0 && y <= 1 && t >= 0 && t <= 1\n\tt = ( 1.0 - v1[0] ) / dx # x = 1\n\tx, y = v1[0] + t * dx, v1[1] + t * dy \n cr.push( [x, y] ) if y >= 0 && y <= 1 && t >= 0 && t <= 1\n end\n return cr\n end",
"def normalize\n mag = self.magnitude\n Vector.new @x/mag, @y/mag, @z/mag\n end",
"def to_chipmunk\n\t\tself.normalize!\n\t\[email protected] { |point| vec2(point[0] - self.center_x, point[1] - self.center_y) }\n\tend",
"def use_section_planes=(setting)\n end",
"def pan(direction = :left, distance_bp = (self.length_bp.to_f/5).round)\n upstream_slice = self.class.sketch.slices.select{|s| s.start_cumulative_bp < @start_cumulative_bp}.sort_by{|s| s.start_cumulative_bp}[-1]\n downstream_slice = self.class.sketch.slices.select{|s| s.start_cumulative_bp > @start_cumulative_bp}.sort_by{|s| s.stop_cumulative_bp}[0]\n\n #Check if we actually _can_ pan. Can't do that if the slice in the panned\n #direction has less basepairs than what we want to add to our slice in focus\n if ( direction == :left and upstream_slice.length_bp > distance_bp ) or\n ( direction == :right and downstream_slice.length_bp > distance_bp )\n\n #Just so we can always add the distance_pixel\n if direction == :left\n distance_bp = -distance_bp\n end\n\n @start_cumulative_bp += distance_bp\n @stop_cumulative_bp += distance_bp\n self.fetch_sequence\n\n upstream_slice.stop_cumulative_bp = @start_cumulative_bp - 1\n downstream_slice.start_cumulative_bp = @stop_cumulative_bp + 1\n [upstream_slice, downstream_slice].each do |s|\n s.length_bp = s.stop_cumulative_bp - s.start_cumulative_bp + 1\n s.resolution = s.length_pixel.to_f/s.length_bp\n s.range_cumulative_bp = Range.new(s.start_cumulative_bp, s.stop_cumulative_bp)\n s.fetch_sequence\n end\n self.class.sketch.slices.each{|s| s.format_resolution}\n\n self.class.sketch.buffer_images[:zoomed] = self.class.sketch.draw_zoomed_buffer\n self.class.sketch.buffer_images[:information_panel] = self.class.sketch.draw_information_panel\n end\n end",
"def perp\n self.class.new( -@y, @x )\n end",
"def initialize(p1, p2, p3)\n @point1 = p1\n @point2 = p2\n @point3 = p3\n\n # adjust all the points so that they are relative to p1\n @rel_point1 = Vector[0, 0, 0]\n @rel_point2 = @point2 - @point1\n @rel_point3 = @point3 - @point1\n end",
"def getNormalPoint(p, a, b) \n # Vector from a to p\n ap = PVector.sub(p,a)\n # Vector from a to b\n ab = PVector.sub(b,a)\n ab.normalize # Normalize the line\n # Project vector \"diff\" onto line by using the dot product\n ab.mult(ap.dot(ab))\n normalPoint = PVector.add(a,ab)\n return normalPoint\n end",
"def project_onto!( vector )\n raise \"can't modify frozen object\" if frozen?\n b = vector.unit\n @x, @y = *(b.scale(self.dot(b)))\n @hash = nil\n self\n end",
"def directions\n vectors.map {|v| v.direction }\n end",
"def triangle_point(sPoint, a, b, c)\r\n pts = []\r\n pts[0] = sPoint\r\n pts[1] = Geom::Point3d.new(sPoint[0] + a, sPoint[1], sPoint[2])\r\n a = a.to_f\r\n b = b.to_f\r\n c = c.to_f\r\n dx = (b*b - c*c + a*a) / (2*a)\r\n dy = Math.sqrt(b*b - dx*dx)\r\n pts[2] = Geom::Point3d.new(sPoint[0] + dx, sPoint[1] + dy, sPoint[2])\r\n return pts\r\nend",
"def unit_vector\n len = self.r\n raise Vector::ZeroOperationError if (len == 0.0)\n self * (1.0/len)\n # Mageo::Vector3D.new(@x*(1.0/len), @y*(1.0/len), @z*(1.0/len))\n end",
"def generate_points(u_count, v_count)\n points = []\n v_count.times do |iv|\n row = []\n u_count.times do |iu|\n u = map1d(iu, (0..u_count), U_RANGE)\n v = map1d(iv, (0..v_count), V_RANGE)\n # default scale: 50, param: Array.new(12, 1) and mesh_distortion: 0\n row << superformula(u: u, v: v)\n end\n points << row\n end\n points\nend",
"def mirror\n point3.mirror!\n end",
"def lay_out\n layout = []\n @move_list.each do |move|\n end_point = layout.empty? ? ORIGIN : layout.last.end_point\n layout << Vector.new(end_point, end_point.extend(move))\n end\n layout\n end",
"def create_battle_planes\n @battle_plane = Battle_Plane.new(@viewport1)\n end",
"def polygon_vertices(sides, size)\n vertices = []\n sides.times do |i|\n angle = -2 * Math::PI * i / sides\n vertices << angle.radians_to_vec2() * size\n end\n return vertices\n end",
"def polygon_vertices(sides, size)\n vertices = []\n sides.times do |i|\n angle = -2 * Math::PI * i / sides\n vertices << radians_to_vec2(angle) * size\n end\n return vertices\n end",
"def initialize\n # create 4 faces of an octahedron that\n # lie on the near side of the x-y plane.\n\n north = Vector.new 0.0, 1.0, 0.0\n east = Vector.new 1.0, 0.0, 0.0\n south = Vector.new 0.0, -1.0, 0.0\n west = Vector.new -1.0, 0.0, 0.0\n near = Vector.new 0.0, 0.0, 1.0\n\n northeast = Triangle.new north, east, near\n southeast = Triangle.new east, south, near\n southwest = Triangle.new near, south, west\n northwest = Triangle.new north, near, west\n\n @faces = [northeast, southeast, southwest, northwest] \n end",
"def subtract v\n Vector.new @x - v.x, @y - v.y, @z - v.z\n end",
"def mesh_points( subdivs, transformation )\r\n points = []\r\n for patch in @patches\r\n points.concat( patch.mesh_points( subdivs, transformation ).to_a )\r\n end\r\n points = TT::Point3d.extend_all( points ) # So that .uniq! works\r\n points.uniq!\r\n points\r\n end",
"def active_section_plane\n end",
"def active_section_plane\n end",
"def is_plane\n\t\t@angle == 0 || @angle == 180\n\tend",
"def vector_to(point2)\n end",
"def perpendicular?( vector2 )\n if( dotProduct( vector2 ) == 0 )\n return true\n else\n return false\n end\n end",
"def incenter\n return @incenter if defined?(@incenter)\n\n s = self.sides\n l = [1, 2, 0].map { |i| s[i].length }\n p = l.sum\n\n x_arr = self.vertices.map { |v| v.x / p }\n y_arr = self.vertices.map { |v| v.y / p }\n\n x = l[0] * x_arr[0] + l[1] * x_arr[1] + l[2] * x_arr[2]\n y = l[0] * y_arr[0] + l[1] * y_arr[1] + l[2] * y_arr[2]\n\n @incenter = Point.new(x, y)\n @incenter\n end",
"def plane\n end",
"def Vector3dUnitPerpendicularXY(arg0)\n ret = _invoke(1610744176, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def flip_range_y(points); points.collect{ |v| Vertex.new(-v.x,v.y)}; end",
"def -@\n Vector3D.new(-x, -y, -z)\n end",
"def getVertices( x0, y0, x1, y1) # arguments define bounding box\n\t\tw, h = x1 - x0, y1 - y0\n\t\td = 5 # size of corner chip\n\n\t\t[\n\t\t\t[ d, 0], [ w - d, 0],\n [ w, d], [w, h - d],\n [ w - d, h], [ d, h],\n [ 0, h - d], [ 0, d]\n\t\t].map do |v| [ v[0] + x0, v[1] + y0 ] end.flatten\n\tend",
"def calc_vertices\n @worksheet.position_object( @params[:start_col],\n @params[:start_row],\n @params[:x_offset],\n @params[:y_offset],\n @params[:width],\n @params[:height]\n )\n end",
"def direction\n self.vector.normalize\n end",
"def rel_pos(enpt, vec)\n ratio = @enpt.prog / @enpt.points[1].pos.distance(@enpt.points[2].pos).to_m\n tangent = spline_tangent(@enpt, ratio)\n angle = Math::PI - Math.atan2(tangent.x, tangent.y)\n vec.transform!(Geom::Transformation.rotation(enpt, Z_AXIS, angle))\n # camera is focused at player's head, so we add 200 to the height\n return enpt + vec + [0, 0, 200.m]\n end",
"def get_contour_points_adv()\r\n result = []\r\n idx = 0\r\n result[idx] = Offset.vertices(@active_face.outer_loop.vertices, -(@bit_diameter * 0.5)).offsetPoints\r\n# puts \" outer #{result[idx].length} #{result[idx]} \"\r\n @active_face.loops.each { |lp|\r\n if (!lp.outer?)\r\n idx += 1\r\n result[idx] = Offset.vertices(lp.vertices, -(@bit_diameter * 0.5) ).offsetPoints \r\n# puts \" inner[#{idx}] #{result[idx]}\" \r\n end\r\n }\r\n return result \r\nend",
"def corners\n\t\t[[0,0],[0,@m-1],[@n-1,0],[@n-1,@m-1]]\n\tend",
"def untransformed(p)\r\n (0..1).map do |i|\r\n (p[i] - @old_center[i])/@zoom + (@old_center[i] - @center[i]) + @old_center[i]\r\n end\r\n end",
"def estimate_normal(\n p # vec3\n)\n Vec3.new(\n scene_sdf(Vec3.new(p.x + $EPSILON, p.y, p.z)) - scene_sdf(Vec3.new(p.x - $EPSILON, p.y, p.z)),\n scene_sdf(Vec3.new(p.x, p.y + $EPSILON, p.z)) - scene_sdf(Vec3.new(p.x, p.y - $EPSILON, p.z)),\n scene_sdf(Vec3.new(p.x, p.y, p.z + $EPSILON)) - scene_sdf(Vec3.new(p.x, p.y, p.z - $EPSILON))\n ).normalize\nend",
"def raw_mesh_vertices\r\n vertices = []\r\n definition = TT::Instance.definition( @instance )\r\n for entity in definition.entities\r\n next unless entity.is_a?( Sketchup::Edge )\r\n vertices.concat( entity.vertices )\r\n end\r\n vertices.uniq!\r\n vertices\r\n end",
"def zcrossproduct(point1, point2, point3)\n dx1 = point2.x - point1.x\n dy1 = point2.y - point1.y\n dx2 = point3.x - point2.x\n dy2 = point3.y - point2.y\n dx1*dy2 -dy1*dx2\n end"
] | [
"0.60368395",
"0.59248894",
"0.57970124",
"0.547599",
"0.5413303",
"0.5211689",
"0.5192795",
"0.5153421",
"0.51324207",
"0.5099675",
"0.5024902",
"0.5005301",
"0.4974331",
"0.49632823",
"0.49546692",
"0.49196318",
"0.49046892",
"0.48149726",
"0.47870997",
"0.47808498",
"0.4778235",
"0.47778946",
"0.47516197",
"0.47270063",
"0.47237122",
"0.4720024",
"0.4719427",
"0.47172943",
"0.47100094",
"0.47031736",
"0.46971884",
"0.46753404",
"0.46673024",
"0.46548706",
"0.4652164",
"0.465019",
"0.46469334",
"0.45769462",
"0.4565086",
"0.4558423",
"0.45580962",
"0.45527634",
"0.45464125",
"0.45337993",
"0.45222917",
"0.45210177",
"0.4514032",
"0.45069227",
"0.4480206",
"0.44790825",
"0.4471583",
"0.4468365",
"0.44465572",
"0.44332728",
"0.44186184",
"0.44147712",
"0.44126976",
"0.44115582",
"0.44057485",
"0.43933147",
"0.43926495",
"0.43925968",
"0.43914542",
"0.43887794",
"0.43827397",
"0.4377653",
"0.43776518",
"0.43772057",
"0.43765593",
"0.43585196",
"0.4354436",
"0.43533266",
"0.43488973",
"0.43424505",
"0.433084",
"0.43164685",
"0.43085957",
"0.43060672",
"0.43032598",
"0.4300708",
"0.4299798",
"0.4299798",
"0.42958623",
"0.4291802",
"0.4291353",
"0.42829978",
"0.42803514",
"0.4279841",
"0.4260122",
"0.42567027",
"0.42555344",
"0.42547506",
"0.4253686",
"0.4242448",
"0.42205942",
"0.42149204",
"0.42100987",
"0.42072508",
"0.41890597",
"0.418583"
] | 0.7468517 | 0 |
Creates a transformation that convert world coordinates to a local coordinate for the reference segment. | def world_to_segment_space
# TODO: Will the direction of the segment matter? Does it need to be
# sorted somehow?
@segment.transformation.inverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_transformation( transformation )\r\n # Cast Vector3d into Transformation.\r\n if transformation.is_a?( Geom::Vector3d )\r\n transformation = Geom::Transformation.new( transformation )\r\n end\r\n et = @instance.model.edit_transform\r\n local_transform = (et.inverse * transformation) * et\r\n end",
"def create_inverse\r\n ptr = Api.proj_coordoperation_create_inverse(self.context, self)\r\n self.class.create_object(ptr, self.context)\r\n end",
"def apply_transform!\n @location = @dy.transformPoint( @location )\n end",
"def to_local(point)\n inverse * point\n end",
"def normalize\n Transformation.new(self, base, @to_base)\n end",
"def get_transformation(circ)\n p1 = get_triple\n p2 = circ.get_triple.reverse\n\n m1 = Matrix.cross_ratio(p1)\n m2 = Matrix.cross_ratio(p2).proj_inv\n\n m2 * m1\n end",
"def normalize\n Transformation.new(self, self, [lambda{|x|x}])\n end",
"def translate(x, y = 0)\n current_transformation.translate(x, y)\n self[\"transform\"] = current_transformation.to_s\n end",
"def coord_geographic\n FACTORY.unproject(self.coord)\n end",
"def transform(otherProjection, point)\r\n transform!(otherProjection, point.dup)\r\n end",
"def vectorize_local_to_local(src, dst, options = nil)\r\n vectorize(src, dst, true, true, options)\r\n end",
"def trm_transform(x, y)\n trm = text_rendering_matrix\n if x == 0 && y == 0\n [trm.e, trm.f]\n else\n [\n (trm.a * x) + (trm.c * y) + (trm.e),\n (trm.b * x) + (trm.d * y) + (trm.f)\n ]\n end\n end",
"def trans(coord)\n\treturn [coord[0]+600, -coord[1]+350]\nend",
"def to_outer(point)\n transform * point\n end",
"def transform(vec)\n return getRotationMatrix() * vec\n end",
"def normalize_for_visualization\r\n ptr = Api.proj_normalize_for_visualization(self.context, self)\r\n self.class.create_object(ptr, self.context)\r\n end",
"def relative_transform_matrix(bone)\n return channel_data_for(bone).relative_transform_matrix\n end",
"def transform(unit_triangle)\n # The unit triangle has a base of 1. We need to determine the length of the\n # desired base, either by calculating a distance (say :AB) or using the\n # :base specification. We then scale by that factor.\n #\n # The unit_triangle has a _flat_ base between (0,0) and (1,0). We need to\n # determine the _angle_ of the base (probably by calculating the angle :AB).\n # We then rotate by that amount.\n #\n # The unit triangle has its starting point at the origin. We need to\n # determine the desired starting point (:A) and translate the triangle.\n #\n # The actual transformation is handled by the PointList class. This method\n # determines the appropriate amounts of scaling, reflection and rotation.\n # It looks at the length and angle of the desired base.\n\n scale, angle, vector = 1, 0.d, [0,0] # Default values: identity transform\n # In the following comments, it's assumed the vertices are named A, B and C.\n case @vertices.mask\n when /F../\n # A is undefined, so we ignore others and default everything.\n scale = @base_length || DEFAULT_BASE\n angle = @base_angle || 0.d\n vector = @p || Point[0,0]\n when /TF./\n # A is defined but B is not.\n scale = @base_length || DEFAULT_BASE\n angle = 0.d\n vector = @p\n when /TTF/\n # A and B are defined, so we use the base length and angle that were calculated\n # in #initialize.\n scale = @base_length\n angle = @base_angle\n vector = @p\n when /F.*T/\n # If non-existing points are specified in the label before existing points,\n # we have a problem.\n error \"Invalid label: non-existing point(s) precede existing one(s)\"\n when /TTT/\n # Shouldn't get here; if all points are defined, there's no need to\n # construct or transform anything.\n end\n debug [scale, angle, vector].inspect if $test_unit_current_test =~ /two_points/\n unit_triangle.transform(scale, angle, vector)\n end",
"def transform\n # Pass through\n @target.transform\n end",
"def transformation\n end",
"def translate(x, y, &block)\n transformation_matrix(1, 0, 0, 1, x, y, &block)\n end",
"def translate(x, y = 0)\n transform[:translate] = [x, y]\n end",
"def compass_transformation(view, position, direction)\n # Make compass always have same size on screen so the tool feels and looks\n # the same, regardless of whether we model a city or an outhouse.\n # Translate size from logical screen pixels to 3d space length units.\n scale = view.pixels_to_model(1, position)\n\n Geom::Transformation.new(position) *\n Geom::Transformation.axes(ORIGIN, direction.axes[0], direction) *\n Geom::Transformation.scaling(ORIGIN, scale)\n end",
"def normal_towards(a, b, c)\n ac = a.dot(c)\n bc = b.dot(c)\n\n x = b.x * ac - a.x * bc\n y = b.y * ac - a.y * bc\n\n V.new(x, y)\n end",
"def project x1, y1, a, m\n rad = a * D2R\n [x1 + Math.cos(rad) * m, y1 + Math.sin(rad) * m]\n end",
"def worldToModel _obj, _args\n \"_obj worldToModel _args;\" \n end",
"def apply_custom_transformation\n end",
"def translate( *args ) \n ## From Martin Rinehart 'Edges to Rubies' chapter 15\n ## May be called with a transformation and a vector, \n ## or with a transformation and r, g, b values.\n\n trans = args[0]\n if args.length == 2\n vec = args[1]\n r = vec[0]; g = vec[1]; b = vec[2] \n else\n r = args[1]; g = args[2]; b = args[3] \n end\n arr = trans.to_a()\n arr[12] += r; arr[13] += g; arr[14] += b \n return Geom::Transformation.new( arr )\n \n\tend",
"def translatef(*args)\n r = Rect.new x, y, w, h\n r.position += r.resolution * Vector2[args.singularize]\n r\n end",
"def test_ogr_transform()\n return if not @have_proj4\n\n utm_srs = Gdal::Osr::SpatialReference.new()\n utm_srs.set_utm(11)\n utm_srs.set_well_known_geog_cs('WGS84')\n\n ll_srs = Gdal::Osr::SpatialReference.new()\n ll_srs.set_well_known_geog_cs('WGS84')\n\n ct = Gdal::Osr::CoordinateTransformation.new(ll_srs, utm_srs)\n\n pnt = Gdal::Ogr.create_geometry_from_wkt('POINT(-117.5 32.0)', ll_srs)\n result = pnt.transform(ct)\n\n out_srs = pnt.get_spatial_reference().export_to_pretty_wkt()\n\n assert_equal(out_srs[0..5], 'PROJCS',\n 'output srs corrupt, ref counting issue?')\n end",
"def to_xyz\n\t\t\tlab = []\n\n\t\t\tlab[1] = (self.l * 100 + 16) / 116\n\t\t\tlab[0] = self.a / 500 + lab[1]\n\t\t\tlab[2] = lab[1] - self.b / 200\n\n\t\t\tputs \"lab\"\n\t\t\tputs lab\n\n\t\t\tlab = lab.collect do |c| \n\t\t\t\tc = c ** 3 > 0.008856 ? c ** 3 : ( c - 16 / 116 ) / 7.787\n\t\t\tend\n\n\t\t\tx = lab[0] * CIELab::Reference[:x]\n\t\t\ty = lab[1] * CIELab::Reference[:y]\n\t\t\tz = lab[2] * CIELab::Reference[:z]\n\n\t\t\tx = x.has_decimals? ? x.to_i : x.round(2)\n\t\t y = y.has_decimals? ? y.to_i : y.round(2)\n\t\t z = z.has_decimals? ? z.to_i : z.round(2)\n\t\t\t\n\t\t\tXYZ.new([x, y, z]).to_s\n\t\tend",
"def global_origin\n utm = utm_global_origin\n Eigen::Vector3.new(utm.y, 1_000_000 - utm.x, utm.z)\n end",
"def transform(transformation)\n end",
"def get_transformation_matrix\n return self.get_rotation_matrix() * self.get_translation_matrix()\n end",
"def transform\n if rotate\n \"rotate(#{rotate},#{x},#{y})\"\n else\n nil\n end\n end",
"def transform_as_normal(normal, transformation)\n normal.transform(transpose(transformation).inverse).normalize\n end",
"def ref(x, y, _width, _height)\n translate(x, y) if x != 0 || y != 0\n end",
"def api\n CLLocationCoordinate2DMake(latitude, longitude)\n end",
"def absolute_transform_matrix(bone)\n relative = relative_transform_matrix(bone)\n if bone.parent then absolute_transform_matrix(bone.parent) * relative\n else relative\n end\n end",
"def project_onto!( vector )\n raise \"can't modify frozen object\" if frozen?\n b = vector.unit\n @x, @y = *(b.scale(self.dot(b)))\n @hash = nil\n self\n end",
"def translate(x, y)\n [ x - bounds.x, y - bounds.y ]\n end",
"def ctm_transform(x, y)\n [\n (ctm.a * x) + (ctm.c * y) + (ctm.e),\n (ctm.b * x) + (ctm.d * y) + (ctm.f)\n ]\n end",
"def matrix\n (follow_object ? follow_object.matrix.inverse : Matrix.identity(4)) * rotation.matrix + rotation.translate(0,0,-@zoom)\n end",
"def modelToWorld _obj, _args\n \"_obj modelToWorld _args;\" \n end",
"def translate(options={})\n options = options.to_hash rescue options.to_h\n \n {\n x: absolute_x + options[:x].to_i,\n y: absolute_y + options[:y].to_i\n }\n end",
"def relative(xr, yr)\n Position.new(x + xr, y + yr)\n end",
"def calculate_transform(matrix, pos)\n vector = Matrix[[pos % board.dim, pos / board.dim]]\n d = Matrix[[ board.dim-1, board.dim-1 ]]\n new_vector = (vector*matrix + (d-d*matrix)/2).row(0)\n new_pos = new_vector[1]*board.dim + new_vector[0]\n end",
"def to_geo\n self.translate(KA, GEO)\n end",
"def translate(x, y)\n primitive 'translate ' + sprintf('%g,%g', x, y)\n end",
"def loc_geographic\n FACTORY.unproject(self.loc)\n end",
"def create_flattened_sphere(name, semi_major_axis, inverse_flattening, linear_unit, *optional)\n semi_major_axis = semi_major_axis.to_f\n inverse_flattening = inverse_flattening.to_f\n semi_minor_axis = semi_major_axis - semi_major_axis / inverse_flattening\n semi_minor_axis = semi_major_axis if semi_minor_axis.infinite?\n new(name, semi_major_axis, semi_minor_axis, inverse_flattening, true, linear_unit, *optional)\n end",
"def translate_to_point(*location)\n p = Point.new(*location)\n Line.new(p, Point.new(p.x + (x2 - x1), p.y + (y2 - y1)))\n end",
"def translate(*args)\n r = Rect.new x, y, w, h\n r.position += Vector2[args.singularize]\n r\n end",
"def transform_data\n latitude = self.latitude\n longitude = self.longitude\n tempLat = latitude/100\n floatLat = (latitude - (tempLat.to_i * 100))/60\n lat = tempLat.to_i + floatLat\n tempLng = longitude/100\n floatLng = (longitude - (tempLng.to_i * 100))/60\n lng = tempLng.to_i + floatLng\n self.latitude = lat \n self.longitude = lng \nend",
"def create_projected_point_from_projected_coord(x, y)\n Rails.logger.debug \"RgeoGeometryAdapter Creating projected point geometry from x = #{x}, y = #{y}\"\n @geometry_factory.projection_factory.point(x, y) \n end",
"def mirror\n point3.mirror!\n end",
"def Transform3dIdentity\n ret = _invoke(1610743927, [], [])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def translate(vector)\n Point.new(*to_a.zip(vector.to_a).map { |a, b| a + b})\n end",
"def projected_onto( vector )\n dup.project_onto!( vector )\n end",
"def build_transform_attr(transform = {})\n # TODO: Support matrix, scale, and translate transforms\n \"\" if transform.nil?\n\n transforms = []\n\n unless transform[:rotate].nil?\n unless transform[:rotate_origin].nil?\n transforms << \"translate(#{transform[:rotate_origin].join(\",\")})\"\n end\n transforms << \"rotate(#{transform[:rotate]})\"\n unless transform[:rotate_origin].nil?\n transforms << \"translate(#{transform[:rotate_origin].map{|el| -el}.join(\",\")})\"\n end\n end\n\n transforms.join(\" \")\n end",
"def Transform3dFromLineAndRotationAngle(arg0, arg1, arg2)\n ret = _invoke(1610743933, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def setTransform(transform)\n # Pass through\n @target.transform = transform\n end",
"def translate(p1, p2, p3, d)\r\n v = p3 - p2\r\n v.length = d\r\n trans=Geom::Transformation.translation(v)\r\n return p1.transform(trans)\r\n end",
"def translate(p1, p2, p3, d)\r\n v = p3 - p2\r\n v.length = d\r\n trans=Geom::Transformation.translation(v)\r\n return p1.transform(trans)\r\n end",
"def convert_local_to_local(src, dst, options = nil)\r\n convert(src, dst, true, true, false, options)\r\n end",
"def translate!(bone, x, y, z)\n set_channel(bone, 'Xposition', channel_data_for(bone).get_channel('Xposition')+x)\n set_channel(bone, 'Yposition', channel_data_for(bone).get_channel('Yposition')+y)\n set_channel(bone, 'Zposition', channel_data_for(bone).get_channel('Zposition')+z)\n end",
"def transform(t)\n ovwrite_me t.vectormult(self)\n end",
"def resize_to_local_point!(grab_handle, point, minimum_dimension=1)\n\t\ttype, target_indicies = VEC_TO_TRANSFORM_DATA[grab_handle.to_a]\n\t\t\n\t\t\n\t\tverts = self.verts()\n\t\toriginal_verts = verts.collect{ |vec| vec.clone }\n\t\t\n\t\tcase type\n\t\t\twhen :edge\n\t\t\t\t# scale the edge along the axis shared by it's verts\n\t\t\t\ta,b = target_indicies.collect{|i| verts[i] }\n\t\t\t\taxis = ( a.x == b.x ? :x : :y )\n\t\t\t\t\n\t\t\t\t\n\t\t\t\ttarget_indicies.each do |i|\n\t\t\t\t\teval \"verts[#{i}].#{axis} = point.#{axis}\"\n\t\t\t\tend\n\t\t\t\t\n\t\t\twhen :vert\n\t\t\t\t# move one main vert on both axis,\n\t\t\t\t# and two secondary verts one axis each, in accordance with the main one.\n\t\t\t\ti = target_indicies.first\n\t\t\t\t\n\t\t\t\tmain = verts[i]\n\t\t\t\t\n\t\t\t\tother = verts.select.with_index{ |vert, index| index != i }\n\t\t\t\ta = other.find{ |vert| vert.x == main.x }\n\t\t\t\tb = other.find{ |vert| vert.y == main.y }\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tmain.x = point.x\n\t\t\t\tmain.y = point.y\n\t\t\t\ta.x = point.x\n\t\t\t\tb.y = point.y\n\t\t\twhen :center\n\t\t\t\t# do nothing\n\t\tend\n\t\t\n\t\t\n\t\tclamp_dimensions!(verts, original_verts, minimum_dimension)\n\t\tcommit_verts!(verts)\n\tend",
"def new_coord\n [@position, @@move[@direction]].transpose.map { |coord| coord.reduce(:+) }\n end",
"def test_translate_nad_shift()\n srs = Gdal::Osr::SpatialReference.new()\n srs.set_gs(-117.0, 100000.0, 100000)\n srs.set_geog_cs('Test GCS', 'Test Datum', 'WGS84',\n Gdal::Osr::SRS_WGS84_SEMIMAJOR,\n Gdal::Osr::SRS_WGS84_INVFLATTENING)\n\n srs.set_towgs84(1, 2, 3)\n\n assert_equal(srs.get_towgs84(), [1,2,3,0,0,0,0])\n proj4 = srs.export_to_proj4()\n\n srs2 = Gdal::Osr::SpatialReference.new()\n srs2.import_from_proj4(proj4)\n\n assert_equal(srs2.get_towgs84(), [1,2,3,0,0,0,0])\n end",
"def construct_coordinates\n construct_latitude\n construct_longitude\n end",
"def simple_mercator_factory(opts_={})\n factory_ = Geographic::Factory.new('Projected', :proj4 => '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', :srid => 4326, :has_z_coordinate => opts_[:has_z_coordinate], :has_m_coordinate => opts_[:has_m_coordinate])\n projector_ = Geographic::SimpleMercatorProjector.new(factory_, :buffer_resolution => opts_[:buffer_resolution], :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions], :has_z_coordinate => opts_[:has_z_coordinate], :has_m_coordinate => opts_[:has_m_coordinate])\n factory_._set_projector(projector_)\n factory_\n end",
"def get_geo_transform\n @gdalfile.get_geo_transform\n end",
"def transform\n end",
"def relative(mode = :terrain)\r\n modifier = mode == :terrain ? -1 : 1\r\n Position.new(map, (@x + modifier)/2, (@y + modifier)/2)\r\n end",
"def transforms; end",
"def to_n\n Normal3.new(@x, @y, @z)\n end",
"def Transform3dFromMirrorPlane(arg0, arg1)\n ret = _invoke(1610744055, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def transform_to(target_datum)\n return self if datum == target_datum\n if helmert = Osgb::Helmert[:\"#{self.datum}_to_#{target_datum}\"]\n cartesian_coordinates = Osgb::Ellipsoid[self.datum].polar_to_cartesian(@lat.to_radians,@lng.to_radians)\n transformed = helmert.transform(*cartesian_coordinates)\n phi, lambda = Osgb::Ellipsoid[target_datum].cartesian_to_polar(*transformed)\n self.class.new(phi.to_degrees, lambda.to_degrees, target_datum, precision)\n else\n raise Osgb::TransformationError, \"Missing helmert transformation for #{self.datum} to #{target_datum}\"\n end\n end",
"def flip\n Loc.new(@y,@x)\n end",
"def normalize\n f = 1.0 / length\n Vector2.new(@x * f, @y * f)\n end",
"def Transform3dFromXYZ(arg0, arg1, arg2)\n ret = _invoke(1610743931, [arg0, arg1, arg2], [VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def transformation_command\n scale, crop = @current_geometry.transformation_to(@target_geometry, crop?)\n trans = \"-scale \\\"#{scale}\\\"\"\n trans << \" -crop \\\"#{crop}\\\" +repage\" if crop\n trans << \" #{convert_options}\" if convert_options\n trans\n end",
"def set_transform\n @transform = Transform.find(params[:id])\n end",
"def utm_global_origin\n utm = spherical_coordinates.utm(zone: utm_zone, north: utm_north?)\n Eigen::Vector3.new(utm.easting, utm.northing,\n world.spherical_coordinates.elevation)\n end",
"def transformation=(transform)\n end",
"def transformations; end",
"def transformed(p)\r\n (0..1).map do |i|\r\n (p[i] - @old_center[i])*@zoom + (@center[i] - @old_center[i])*@zoom + @old_center[i]\r\n end\r\n end",
"def translate(p1, p2, p3, d)\r\n v = p3 - p2\r\n v.length = d\r\n trans=Geom::Transformation.translation(v)\r\n return p1.transform(trans)\r\n end",
"def transform\n Transform.new(handle: @handle, apikey: @apikey, security: @security)\n end",
"def use_sdf_world\n world = sdf_world\n\n if @sdf_model\n model_in_world = resolve_model_in_world\n\n # Parse the whole world and massage it before we merge it in the\n # profile's transformer\n world_tr = ::Transformer::Configuration.new\n world_tr.parse_sdf_world(world)\n\n model_in_world_full_name = model_in_world.full_name(root: world)\n model_in_world_frame_prefix = \"#{model_in_world_full_name}::\"\n\n frame_mapping = Hash[model_in_world_full_name => @sdf_model.name]\n world_tr.frames.each do |frame_name|\n if frame_name.start_with?(model_in_world_frame_prefix)\n frame_mapping[frame_name] = \"#{@sdf_model.name}::#{frame_name[model_in_world_frame_prefix.size..-1]}\"\n end\n end\n world_tr.rename_frames(frame_mapping)\n transformer.merge(world_tr)\n else\n transformer.parse_sdf_world(world)\n end\n\n # There can be only one world ... name it 'world'\n if !transformer.has_frame?('world')\n transformer.static_transform Eigen::Vector3.Zero, world.full_name => 'world'\n end\n end",
"def transform(x)\n x = check_convert_sample_array(x)\n z = x.dup\n\n z[z.ne(0)] = Numo::NMath.log(z[z.ne(0)]) + 1 if @params[:sublinear_tf]\n z *= @idf if @params[:use_idf]\n case @params[:norm]\n when 'l2'\n z = Rumale::Preprocessing::L2Normalizer.new.fit_transform(z)\n when 'l1'\n z = Rumale::Preprocessing::L1Normalizer.new.fit_transform(z)\n end\n z\n end",
"def transforms(direction = :from)\n direction == :from ? transforms_from : transforms_to\n end",
"def forward_latlon (lat, lon, z = nil)\n return forward(lon, lat, z)\n end",
"def project_to_plane\n end",
"def to_latlng(options={})\n if is_gridref?\n Osgb::Gridref.new(self, options).to_latlng(options[:datum])\n else\n self.coordinates(options[:datum])\n end\n end",
"def to_loc\n Location.new(id,\n @name,\n country,\n generic_name: core_name,\n valid_creatures: @creatures,\n valid_plants: @plants,\n fitness: fitness,\n structure_key: core_node || id)\n end",
"def set_camera(worldView)\n GLU::LookAt(worldView[POSITION][0], worldView[POSITION][1], worldView[POSITION][2], \n worldView[LOOKAT][0], worldView[LOOKAT][1], worldView[LOOKAT][2], \n worldView[LOOKUP][0], worldView[LOOKUP][1], worldView[LOOKUP][2]) \n end",
"def view_matrix(\n eye, # vec3 \n center, # vec3 \n up # vec3 \n) # mat4\n # Based on gluLookAt man page\n f = center.sub(eye).normalize # vec3\n s = Vec3.cross(f, up).normalize # vec3\n u = Vec3.cross(s, f) # vec3\n neg_f = f.mul_scalar(-1.0)\n Mat4.new(\n Vec4.new(s.x, s.y, s.z, 0.0),\n Vec4.new(u.x, u.y, u.z, 0.0),\n Vec4.new(neg_f.x, neg_f.y, neg_f.z, 0.0),\n Vec4.new(0.0, 0.0, 0.0, 1.0)\n );\nend",
"def to_lat\n self.translate(\"#{GEO}#{KA}\", \"#{LAT}#{LAT}\")\n end"
] | [
"0.6654681",
"0.5739941",
"0.5708238",
"0.56390935",
"0.5512808",
"0.5412651",
"0.5387135",
"0.5310979",
"0.5166456",
"0.51522624",
"0.5109401",
"0.5099228",
"0.50434667",
"0.502317",
"0.50109315",
"0.4996229",
"0.49886397",
"0.49800968",
"0.49607196",
"0.49449757",
"0.49375916",
"0.49132338",
"0.4900494",
"0.4898124",
"0.4862288",
"0.48570764",
"0.48437354",
"0.48381174",
"0.4836796",
"0.48065528",
"0.47875088",
"0.4784887",
"0.47648424",
"0.47588947",
"0.47210237",
"0.4700438",
"0.4680651",
"0.4678441",
"0.46464792",
"0.46427563",
"0.46405077",
"0.4637452",
"0.4636178",
"0.46220103",
"0.46104345",
"0.4607238",
"0.46059754",
"0.45993042",
"0.4591844",
"0.45827892",
"0.45765978",
"0.45708022",
"0.45674133",
"0.45648324",
"0.45619366",
"0.45610878",
"0.45578066",
"0.45479578",
"0.45335507",
"0.45266676",
"0.4520218",
"0.45139676",
"0.450215",
"0.450215",
"0.4483292",
"0.4475308",
"0.44694442",
"0.44688448",
"0.44649416",
"0.445853",
"0.44581324",
"0.4454951",
"0.44465604",
"0.4446416",
"0.44420975",
"0.443485",
"0.4434352",
"0.4420769",
"0.4414991",
"0.44132194",
"0.44121104",
"0.44062996",
"0.43936172",
"0.4392715",
"0.43909058",
"0.43906912",
"0.43871424",
"0.4385309",
"0.43814334",
"0.4381326",
"0.43740582",
"0.43710002",
"0.43697336",
"0.436745",
"0.43570477",
"0.4356332",
"0.4354475",
"0.43489358",
"0.43480203",
"0.43345428"
] | 0.56818104 | 3 |
Return the full orientation of the two lines. Going counterclockwise. | def full_angle_between(vector1, vector2, normal = Z_AXIS)
direction = (vector1 * vector2) % normal
angle = vector1.angle_between(vector2)
angle = 360.degrees - angle if direction < 0.0
angle
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_angle(p1,p2)\n v1 = RBA::DPoint.new(1,0)\n v2 = p2-p1\n return vector_angle(v1,v2)\n end",
"def orientation \n @position - @prev_position\n end",
"def orientation\n p1, p2, p3 = *convex_sub_polygon\n det = (p2[0]-p1[0])*(p3[1]-p1[1]) - (p3[0]-p1[0])*(p2[1]-p1[1])\n @orientation ||= (det < 0)? 1 : -1\n end",
"def calculate_orientation\n x, y = @components.values\n if x.pos? and y.zero?\n 0.deg\n elsif x.zero? and y.pos?\n 90.deg\n elsif x.neg? and y.zero?\n 180.deg\n elsif x.zero? and y.neg?\n 270.deg\n elsif x.pos? and y.pos?\n Math.atan( y/x ).rad # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.pos?\n angle = Math.atan( y/x.abs ).rad\n (180 - angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.neg?\n angle = Math.atan( y.abs/x.abs ).rad\n (180 + angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.pos? and y.neg?\n angle = Math.atan( y.abs/x ).rad\n (360 - angle.deg).deg\n end\n end",
"def calc_angle(x1, y1, x2, y2)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n if (x1 == x2)\r\n if (y2 >= y1)\r\n return 0\r\n else\r\n return 180\r\n end #else\r\n elsif (y1 == y2)\r\n if (x2 >= x1)\r\n return 90\r\n else\r\n return 270\r\n end #else\r\n else\r\n x1 = x1 + 0.0 # force to be floating point\r\n x2 = x2 + 0.0 # force to floating point\r\n slope = (y2-y1) / (x2-x1)\r\n radians = Math.atan(slope)\r\n degrees = conv_radian_to_degree(radians)\r\n # Handle Adjusting Quadrent\r\n if ((x2 > x1) && (y2 > y1))\r\n # Quadrent 1;\r\n degrees = degrees\r\n elsif ((x2 > x1) && (y2 < y1))\r\n # Quadrent 2\r\n degrees = 90 - degrees;\r\n elsif ((x2 < x1) && (y2 < y1))\r\n # Quadrent 3\r\n degrees = 270 - degrees\r\n else\r\n # must be Quadrent 4\r\n degrees = 270 - degrees\r\n end # else\r\n end # else\r\n return degrees\r\nend",
"def angle(x1, y1, x2, y2)\n end",
"def mirror_angle_vertically!\n @angle = (180 - @angle) % 360\n end",
"def rDiagonalLines\n Pxlsrt::Lines.getDiagonals(horizontalLines.reverse.flatten(1).reverse, @width, @height)\n end",
"def orthocenter\n return @orthocenter if defined?(@orthocenter)\n\n a = self.altitudes\n a1 = a[self.vertices[0]]; a2 = a[self.vertices[1]]\n \n l1 = Line.new(a1.p1, a1.p2)\n l2 = Line.new(a2.p1, a2.p2)\n\n @orthocenter = l1.intersection(l2)[0]\n @orthocenter\n end",
"def angle_direction(a,b)\n magnitude = angle_difference(a,b)\n if angle_difference(a + 1, b) < magnitude\n magnitude\n else\n -magnitude\n end\n end",
"def tangents(right)\n left = self\n\n max_count = left.count + right.count\n\n # Walk clockwise around left, counterclockwise around right, until the\n # next point on both sides is left of X->Y, showing that X->Y is the\n # lowest segment.\n x = left.rightmost\n y = right.leftmost\n z = y.first\n z1 = x.first\n z2 = z1 && x.clockwise(z1)\n lower = nil\n max_count.times do\n if z && z.right_of?(x, y)\n old_z = z\n z = z.counterclockwise(y)\n y = old_z\n elsif z2 && z2.right_of?(x, y)\n old_z2 = z2\n z2 = z2.clockwise(x)\n x = old_z2\n else\n lower = [x, y]\n break\n end\n end\n\n # Walk counterclockwise around left, clockwise around right, until the\n # next point on both sides is to the right of X->Y, showing that X->Y is\n # the highest segment.\n x = left.rightmost\n y = right.leftmost\n z = y.first\n z_r = z && y.clockwise(z)\n z_l = x.first\n upper = nil\n max_count.times do\n if z_r && z_r.left_of?(x, y)\n old_z = z_r\n z_r = z_r.clockwise(y)\n y = old_z\n elsif z_l && z_l.left_of?(x, y)\n old_z = z_l\n z_l = z_l.counterclockwise(x)\n x = old_z\n else\n upper = [x, y]\n break\n end\n end\n\n return lower, upper\n end",
"def flip_vertical\n @text_lines.reverse!\n @sltn_lines.reverse!\n end",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def oriented_exit(exit_point)\n @orientation.times do\n exit_point = Direction.clockwise_from(exit_point)\n end\n\n exit_point\n end",
"def normalizeLine(c1,c2)\n x = c2[0] - c1[0]\n y = c2[1] - c1[1]\n\n # make sure we didn't wrap one way or the other.\n # taking the shortest great circle distance.\n x = x <= -180 ? x + 360 : x\n x = x >= 180 ? x - 360 : x\n return [[0,0],[x,y]]\n end",
"def required_rotation_for_upright_display\n required_rotation_orientation_in_degrees = (360 - self.orientation) % 360\n return required_rotation_orientation_in_degrees\n end",
"def compass_direction\n angle = Sketchup.active_model.shadow_info[\"NorthAngle\"].degrees\n rotation = Geom::Transformation.rotation(ORIGIN, Z_AXIS, -angle)\n\n Y_AXIS.transform(rotation)\n end",
"def angle x1, y1, a, m, c\n x2, y2 = project x1, y1, a, m\n line x1, y1, x2, y2, c\n end",
"def line_order = locale_info(:layout, :orientation, :line_order)",
"def orientation\n return nil if not @rep\n\n # get the transformation from the group or component instance\n t = @rep.transformation\n eye = t.origin\n dir = t.xaxis\n up = t.zaxis\n y = t.yaxis\n\n # See if there is an offset that needs to be applied to the eye position\n eo = self.get_offset\n if( eo )\n offset = Geom::Vector3d.linear_combination eo.x, dir, eo.y, y, eo.z, up\n eye.offset!(offset)\n end\n\n [eye, dir, up]\nend",
"def flip_horizontal\n (0...@text_lines.size).each do |i|\n @text_lines[i].reverse!\n @sltn_lines[i].reverse!\n end\n end",
"def angle_between(p1, p2)\n vect_p1 = p1 - self\n vect_p2 = p2 - self\n\n theta = vect_p1.polar - vect_p2.polar\n theta += 360.0 if theta < 0.0\n theta = 360.0 - theta if theta > 180.0\n return theta\n end",
"def direction\n return nil if x_vel.zero? && y_vel.zero?\n vector_to_angle(*drop_diagonal)\n end",
"def calculate_radians\n if x_length == 0 || y_length == 0\n angle_to_start_of_quadrant\n else\n case angle_to_end_of_quadrant\n when DEGREES_90\n angle_ignoring_quadrant\n when DEGREES_180\n DEGREES_180 - angle_ignoring_quadrant\n when DEGREES_270\n DEGREES_180 + angle_ignoring_quadrant\n else\n DEGREES_360 - angle_ignoring_quadrant\n end\n end\n end",
"def orientation\n if landscape?\n :landscape\n elsif portrait?\n :portrait\n else\n :square\n end\n end",
"def getAngle(c1,c2)\n x = c2[0] - c1[0]\n y = c2[1] - c1[1]\n x = x <= -180 ? x + 360 : x\n x = x >= 180 ? x - 360 : x\n\n a = Math.atan2(y, x)\n rescue\n p \"Error x=#{x}, y=#{y} sq= #{Math.sqrt(x*x+y*y)} rat=#{x / Math.sqrt(x*x+y*y)}\"\n raise Error\n end",
"def clockwise(a, b, c)\n oriented_area(a, b, c).negative?\n end",
"def angle\n Math.atan2( @y, @x )\n end",
"def angle\n Math.atan2(@y, @x)\n end",
"def rotate(angle)\n x = x2 - x1\n y = y2 - y1\n cos_angle = Math.cos(angle)\n sin_angle = Math.sin(angle)\n new_x = (x * cos_angle) - (y * sin_angle)\n new_y = (x * sin_angle) - (y * cos_angle)\n Line.new(p1, Point.new(x1 + new_x, y1 + new_y))\n end",
"def eulerline\n return self.orthocenter if self.is_equilateral?\n Line.new(self.orthocenter, self.circumcenter)\n end",
"def direction(p0, p1, p2)\n return (p0.x-p1.x)*(p2.y-p1.y) - (p2.x-p1.x)*(p0.y-p1.y)\n end",
"def direction_to(other_x, other_y)\n vector_to_angle(*drop_diagonal(other_x - @x, other_y - @y))\n end",
"def direction_to(other_x, other_y)\n vector_to_angle(*drop_diagonal(other_x - @x, other_y - @y))\n end",
"def right\r\n @angle += ROTATION_ANGLE\r\n end",
"def orientation\n @orientation ||= :column\n end",
"def compute_direction(this_exit, other_exit, curvilinear_type)\n if curvilinear_type == STRAIGHT\n # no curve but we still need a direction, and we need to ensure both\n # \"half paths\" have different directions\n return this_exit < other_exit ? :left : :right\n end\n\n return :none if !other_exit || !this_exit\n\n if (this_exit + curvilinear_type) % 6 == other_exit\n :left\n elsif (other_exit + curvilinear_type) % 6 == this_exit\n :right\n end\n end",
"def angle_diff(angle1, angle2)\n end",
"def verify_clockwise()\n total = 0\n 0.upto(self.length - 1) do |index|\n point0 = self[index - 1]\n point1 = self[index]\n point2 = self[index + 1]\n delta_x = point0.x - point1.x\n delta_y = point0.y - point1.y\n start_angle = Math.atan2(delta_y, delta_x) / Math::PI * 180\n delta_x = point1.x - point2.x\n delta_y = point1.y - point2.y\n end_angle = Math.atan2(delta_y, delta_x) / Math::PI * 180 - start_angle\n if (end_angle > 180)\n end_angle = end_angle - 360\n end\n if (end_angle < -180)\n end_angle = end_angle + 360\n end\n total -= end_angle\n end\n if (total < 0)\n # -360! Abort! Abort!\n @points.reverse!\n end\n end",
"def angle_controller_positions\n\n [0, 1].map do |i|\n vector = @path[-i] - @path[1 - 3 * i]\n vector.length = @handle_length/Math.cos(@end_angles[i])\n a = @end_angles[i] + GRAPHICAL_ANGLES[i]\n vector.transform! Geom::Transformation.rotation(ORIGIN, Z_AXIS, a)\n\n @path[-i].offset vector\n end\n\n end",
"def getOrientation(row, col)\n case (@orientation_index)\n when 0\n return [\n Block.new(row, col),\n Block.new(row, col - 1),\n Block.new(row, col + 1),\n Block.new(row + 1, col + 1)\n ]\n when 1\n return [\n Block.new(row, col),\n Block.new(row + 1, col - 1),\n Block.new(row + 1, col),\n Block.new(row - 1, col)\n ]\n when 2\n return [\n Block.new(row, col),\n Block.new(row, col - 1),\n Block.new(row - 1, col - 1),\n Block.new(row, col + 1)\n ]\n when 3\n return [\n Block.new(row, col),\n Block.new(row + 1, col),\n Block.new(row - 1, col),\n Block.new(row - 1, col + 1)\n ]\n else\n abort('No such rotation orientation')\n end\n end",
"def rotate_clockwise\n @view = VIEWS.invert[view]\n end",
"def direction\n @direction ||= Vector.new(p2.x - p1.x, p2.y - p1.y)\n end",
"def orientations\n return @orientations\n end",
"def to_rgl_oriented\n RGL::ImplicitGraph.new do |g|\n g.vertex_iterator do |block|\n self.each_segment do |segment|\n [:+, :-].each do |orient|\n block.call([segment, orient].to_oriented_segment)\n end\n end\n end\n g.adjacent_iterator do |oriented_segment, block|\n s = segment(oriented_segment.segment)\n o = oriented_segment.orient\n s.links[:from][o].each do |l|\n os = [segment(l.to), l.to_orient].to_oriented_segment\n block.call(os)\n end\n o = oriented_segment.invert_orient\n s.links[:to][o].each do |l|\n os = [segment(l.from), l.from_orient].to_oriented_segment\n block.call(os.invert_orient)\n end\n end\n g.directed = true\n end\n end",
"def direction(x_diff, y_diff)\n Math.atan2(0, -1) - Math.atan2(x_diff, y_diff)\n end",
"def mirror_angle_horizontally!\n @angle = (-@angle) % 360\n end",
"def rightascensionascendingnode\n (@line2[17...25]).to_f\n end",
"def getNewOrientation(direction)\n clockwise = ['normal', 'right', 'inverted', 'left']\n\n if clockwise.include?(direction)\n return direction\n else\n curdir = clockwise.find_index(getOrientation())\n\n shift = case direction\n when '+left' then -1\n when '+right' then 1\n when 'flip' then 2\n else\n raise \"Unrecognised rotate direction #{direction}\"\n end\n \n newdir = (curdir + shift) % 4\n\n return clockwise[newdir]\n end\nend",
"def rotateRight()\n twoTypeRotate()\n end",
"def theta\n (@x == 0)? ((@y > 0)? @@pio2 : -@@pio2) : Math.atan2(@y,@x)\n end",
"def anglecw\n 360 - angle\n end",
"def angle_between(vector2)\n end",
"def turn_right\n @orientation == 3 ? @orientation = 0 : @orientation += 1\n end",
"def angle_delta_oblique() \r\n #al(@ma, @ta, Celes.faom03(@ta)) - ra_Sun()\r\n al_Sun() - ra_Sun() \r\n end",
"def clockwise points\n ul = Struct.new(:x, :y).new 0, 0\n upper_left = points.min_by { |point| distance point, ul }\n until points.first == upper_left\n points = points.rotate\n end\n points\n end",
"def orientation_with_root(a, b)\n orientation(root, a, b)\n end",
"def vertical_seperator x, y, y2\n [x, y, x, y2, 150, 150, 150]\n end",
"def vertical_line (board)\n transposed_board = board.transpose\n return horizontal_line (transposed_board)\n end",
"def angle_between(other)\n raise TypeError, 'Must pass only LinearEntity objects.' unless other.is_a?(LinearEntity)\n \n v1 = self.direction\n v2 = other.direction\n\n # Convert numerator to BigDecimal for more precision.\n numerator = BigDecimal(v1.dot(v2).to_f.to_s)\n denominator = v1.to_point.abs * v2.to_point.abs\n\n return Math.acos(numerator / denominator)\n end",
"def get_orientation(ship, grid)\n print \"Enter 1 for horizontal or 2 for vertical placement: \"\n case gets.chomp\n when \"1\"\n :horizontal\n when \"2\"\n :vertical\n else\n get_orientation(ship, grid)\n end\n end",
"def orient! direction, edge\n\t\treturn false if edge_to_the(direction) == edge\n\t\tensure_unplaced\n\t\t2.times do\n\t\t\tDIRECTIONS.count.times do\n\t\t\t\trotate!\n\t\t\t\treturn true if edge_to_the(direction) == edge\n\t\t\tend\n\t\t\tflip!\n\t\tend\n\t\traise \"Could not orient piece so that edge matched.\"\n\tend",
"def orthodrome_init_angle(lat1, lon1, lat2, lon2)\n dlon = (lon2 - lon1) * RAD_PER_DEG\n cola1 = Math.cos(lat1 * RAD_PER_DEG)\n sila1 = Math.sin(lat1 * RAD_PER_DEG)\n cola2 = Math.cos(lat2 * RAD_PER_DEG)\n sila2 = Math.sin(lat2 * RAD_PER_DEG)\n\n y = Math.sin(dlon) * cola2\n x = cola1 * sila2 - sila1 * cola2 * Math.cos(dlon)\n angle = Math.atan2(y,x)/RAD_PER_DEG # angle in degrees\n end",
"def angle_a\n Angle.new(\n self,\n :a,\n (\n (\n Math.acos((b**2 + c**2 - a**2) / (2.0 * b * c)) * 180\n ) / Math::PI\n )\n )\n end",
"def get_orientation_string()\n case self.orientation\n when 0\n return \"East\"\n when 90\n return \"South\"\n when 180\n return \"West\"\n when 270\n return \"North\"\n else\n return \"Invalid\" # If the robot orientation is not included in [0 90 180 270] the orientation is invalid\n end\n end",
"def zrotation\n end",
"def orientation_name\n return Orientation::PORTRAIT if size[0] < size[1]\n return Orientation::LANDSCAPE\n end",
"def test_orient_with_two_piece\n h_one = [1,2]\n h_two = [1,4]\n\n assert @chess._is_orient_horizontal(h_one, h_two)\n assert !@chess._is_orient_leftdown(h_one, h_two)\n assert !@chess._is_orient_rightdown(h_one, h_two)\n\n l_one = [2,3]\n l_two = [3,2]\n assert @chess._is_orient_leftdown(l_one, l_two)\n assert !@chess._is_orient_horizontal(l_one, l_two)\n assert !@chess._is_orient_rightdown(l_one, l_two)\n\n r_one = [2,3]\n r_two = [3,4]\n assert @chess._is_orient_rightdown(r_one, r_two)\n assert !@chess._is_orient_horizontal(r_one, r_two)\n assert !@chess._is_orient_leftdown(r_one, r_two)\n end",
"def rotateRight()\n fourTypeRotate(Tetromino::COUNTERCLOCKWISE)\n end",
"def rotate_clockwise2\n if !game_over? and @game.is_running?\n @current_block2.move(0, 0, 1)\n end\n draw\n end",
"def right(values) # turn left\n multiple(values).each { |degree| rotate(-degree) }\n end",
"def angle_b\n Angle.new(\n self,\n :b,\n (\n (\n Math.acos((a**2 + c**2 - b**2) / (2.0 * a * c)) * 180\n ) / Math::PI\n )\n )\n end",
"def side_from_sas(side1, angle, side2)\n Math.sqrt(\n (\n side1**2 + side2**2\n ) - (\n 2 * side1 * side2 * Math.cos(\n (angle * (Math::PI / 180))\n )\n )\n )\n end",
"def angle_c\n Angle.new(\n self,\n :c,\n (\n (\n Math.acos((a**2 + b**2 - c**2) / (2.0 * a * b)) * 180\n ) / Math::PI\n )\n )\n end",
"def rotate_right\n @facing =\n @cardinals_rev[@cardinals_rev.index(@facing) - 1]\n self\n end",
"def determind_sight_angles(angle)\n case direction\n when 2; value = [270 + angle, 270 - angle]\n when 4; value = [180 + angle, 180 - angle]\n when 6; value = [ 0 + angle, 0 - angle]\n when 8; value = [ 90 + angle, 90 - angle]\n end\n value[0] = (value[0] + 360) % 360\n value[1] = (value[1] + 360) % 360\n return value\n end",
"def angle_from_input\n\n return if @path.size < 2\n return unless @active_controller.is_a? Symbol\n\n i = @active_controller == :start ? 0 : 1\n corner = @path[-i]\n ref_vector = @path[-i] - @path[1 - 3 * i]\n input_vector = corner - @ip.position\n return unless input_vector.valid?\n return if input_vector.parallel? Z_AXIS\n return if input_vector.parallel? ref_vector\n\n angle = -(MyGeom.angle_in_plane input_vector, ref_vector)\n angle -= GRAPHICAL_ANGLES[i]\n angle = ((angle+90.degrees)%180.degrees)-90.degrees\n\n @end_angles[i] = angle\n\n end",
"def angle(path)\n io_for(path).angle\n end",
"def to_s\n \"#{@x} #{@y} #{@orientation}\"\n end",
"def orient(rx, ry, qx, qy, px, py)\n (orient_if_sure(px, py, rx, ry, qx, qy) || orient_if_sure(rx, ry, qx, qy, px, py) || orient_if_sure(qx, qy, px, py, rx, ry)) < 0\n end",
"def angle_to(a,b)\n a,b = *[a,b].map(&:to_np)\n d0,d1 = dist_from(a), a.dist_from(b)\n z = self.to(a,1+d1/d0)\n dz = z.dist_from(b)\n Math.asin(dz/2/d1)*2\n end",
"def orientation(img)\n (img.rows > img.columns) ? \"landscape\" : \"portrait\"\n end",
"def vert_mirror(strng)\n string.split(\"\\n\").map do |piece|\n piece.reverse\n end.join(\"/n\")\nend",
"def diagonalLines\n Pxlsrt::Lines.getDiagonals(horizontalLines.flatten(1), @width, @height)\n end",
"def angle\n ns = norm\n x_ = @x / ns\n y_ = @y / ns\n\n Math.atan2(x_, y_)\n end",
"def angles_diff(a1, a2)\n diff = a2 - a1\n while diff > Math::PI\n diff -= 2.0 * Math::PI\n end\n while diff < -Math::PI\n diff += 2.0 * Math::PI\n end\n diff\n end",
"def rotate matrix, direction\n direction == 'clockwise' ? matrix.reverse.transpose : matrix.transpose.reverse\nend",
"def segment_to_line(x1, y1, x2, y2)\n raise 'Need two distinct points to define a segment' if x1 == x2 && y1 == y2\n\n # Vertical/horizontal/oblique lines\n if y1 == y2\n [0.0, 1.0, y1]\n elsif x1 == x2\n [1.0, 0.0, x1]\n else\n [y1 - y2, x2 - x1, x2 * y1 - x1 * y2]\n end\n end",
"def reverse!\n tmp = self.from\n self.from = self.to\n self.to = tmp\n tmp = self.from_orient\n self.from_orient = (self.to_orient == :+) ? :- : :+\n self.to_orient = (tmp == :+) ? :- : :+\n self.overlap = self.reverse_overlap\n return self\n end",
"def inverse(x0, y0, z0)\n theta1 = theta2 = theta3 = 0.0\n theta_1 = calc_angle_yz(x0, y0, z0)\n theta_2 = calc_angle_yz(x0*COS_120 + y0*SIN_120, y0*COS_120-x0*SIN_120, z0) # rotate coords to +120 deg\n theta_3 = calc_angle_yz(x0*COS_120 - y0*SIN_120, y0*COS_120+x0*SIN_120, z0) # rotate coords to -120 deg\n\n [theta_1.round(3), theta_2.round(3), theta_3.round(3)]\n end",
"def start_angle\n end",
"def indentation_vertical\n arr = @lines.map { |x| x == \"\\n\" ? x = nil : x[/^\\s*/].size }\n a = []\n 1.upto(arr.size - 2) do |i|\n if arr[i].nil?\n a.push('x')\n elsif !arr[i].nil? && !arr[i + 1].nil?\n a.push(arr[i] - arr[i + 1])\n elsif !arr[i].nil? && arr[i + 1].nil?\n j = i + 1\n loop do\n j += 1\n break if !arr[j].nil? || (j >= arr.size - 2)\n end\n a.push(arr[i] - arr[j]) if !arr[i].nil? && !arr[j].nil?\n next\n end\n end\n a.each_with_index { |x, indx| @indentation[:vertical].push(indx + 2) unless [0, 2, -2, 'x'].include?(x) }\n end",
"def sum_of_interior_angles\n 180 * (@number_of_sides - 2)\n end",
"def command direction\n ny, nx, nangle = near_xy(direction)\n if @labirint[ny][nx] == 0 || @labirint[ny][nx] == 2\n @x = nx\n @y = ny\n print\n @angle = nangle % 4\n end\n end",
"def angle\n @angle\n end",
"def vector_to_angle(x_vel=@x_vel, y_vel=@y_vel)\n if x_vel == 0 && y_vel == 0\n return puts \"Zero velocity, no angle\"\n end\n if x_vel != 0 && y_vel != 0\n return puts \"Diagonal velocity (#{x_vel}x#{y_vel}), no angle\"\n end\n\n if x_vel.zero?\n (y_vel > 0) ? 180 : 0\n else\n (x_vel > 0) ? 90 : 270\n end\n end",
"def vector_to_angle(x_vel=@x_vel, y_vel=@y_vel)\n if x_vel == 0 && y_vel == 0\n return puts \"Zero velocity, no angle\"\n end\n if x_vel != 0 && y_vel != 0\n return puts \"Diagonal velocity (#{x_vel}x#{y_vel}), no angle\"\n end\n\n if x_vel.zero?\n (y_vel > 0) ? 180 : 0\n else\n (x_vel > 0) ? 90 : 270\n end\n end",
"def vector_angle(v1,v2)\n vcross = v1.x*v2.y-v1.y*v2.x\n vdot = v1.x*v2.x+v1.y*v2.y\n val = vcross/Math.sqrt(v1.sq_abs*v2.sq_abs)\n if val.abs >1\n val = val/val.abs*1 \n end\n if vdot >= 0\n return Math.asin(val)\n elsif vcross !=0\n return vcross/vcross.abs*Math::PI - Math.asin(val)\n else\n return Math::PI - Math.asin(val)\n end\n end",
"def rotate\n @angle += Math::PI / 16\n @angle = @angle % (Math::PI * 2)\n end"
] | [
"0.62789124",
"0.62677735",
"0.6135888",
"0.59395975",
"0.5926302",
"0.5712566",
"0.5707717",
"0.57012683",
"0.56970793",
"0.5648831",
"0.5619228",
"0.5599831",
"0.5594926",
"0.55764705",
"0.55026925",
"0.5493917",
"0.54844475",
"0.5440558",
"0.5424334",
"0.54047996",
"0.53929377",
"0.53849447",
"0.5329101",
"0.53231734",
"0.5316471",
"0.5306085",
"0.53007627",
"0.52943236",
"0.52861077",
"0.5277953",
"0.52674484",
"0.5262089",
"0.52383643",
"0.52242",
"0.52242",
"0.5218143",
"0.5214154",
"0.52085495",
"0.52037156",
"0.5192053",
"0.5190434",
"0.519005",
"0.5182637",
"0.51646763",
"0.51612556",
"0.5150742",
"0.5146346",
"0.5145078",
"0.5125059",
"0.5112463",
"0.51097417",
"0.51085186",
"0.51023215",
"0.5100996",
"0.5099712",
"0.50849193",
"0.5083304",
"0.5080979",
"0.50762814",
"0.5074982",
"0.5066561",
"0.50646293",
"0.5062357",
"0.50611955",
"0.5059856",
"0.5057949",
"0.5044047",
"0.5038059",
"0.5029421",
"0.5022747",
"0.5020664",
"0.5017447",
"0.50144994",
"0.50130343",
"0.5008101",
"0.500613",
"0.50017774",
"0.50010395",
"0.49989864",
"0.49941173",
"0.4991315",
"0.4989965",
"0.49842533",
"0.4983807",
"0.49795306",
"0.49784195",
"0.4963747",
"0.49622482",
"0.49564058",
"0.49462223",
"0.49382228",
"0.4936554",
"0.49341303",
"0.4929689",
"0.4920549",
"0.49109498",
"0.48995483",
"0.48995483",
"0.48960772",
"0.48833236"
] | 0.49792928 | 85 |
Creates a set of `Geom::Point3d` objects for an arc. | def arc(center, xaxis, normal, radius, start_angle, end_angle, num_segments = 12)
# Generate the first point.
t = Geom::Transformation.rotation(center, normal, start_angle)
points = []
points << center.offset(xaxis, radius).transform(t)
# Prepare a transformation we can repeat on the last entry in point to complete the arc.
t = Geom::Transformation.rotation(center, normal, (end_angle - start_angle) / num_segments)
1.upto(num_segments) {
points << points.last.transform(t)
}
points
rescue StandardError
p [center, xaxis, normal, radius, start_angle, end_angle, num_segments]
raise
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_outer_radius(p, outerRadius, angle)\r\n res = Geom::Point3d.new(p[0] + Math.cos(angle * Math::PI) * outerRadius, \r\n p[1] + Math.sin(angle * Math::PI) * outerRadius, \r\n 0)\r\n return res\r\nend",
"def bezier3d(p1, p2, p3, p4, n)\n\tar = []\n\tar.push(p1)\n\tn.times do |i|\n\t\tt = (i+1).to_f / (n+1)\n\t\tp5 = intp3d(p1, p2, t)\n\t\tp6 = intp3d(p2, p3, t)\n\t\tp7 = intp3d(p3, p4, t)\n\t\tp8 = intp3d(p5, p6, t)\n\t\tp9 = intp3d(p6, p7, t)\n\t\tpz = intp3d(p8, p9, t)\n\t\tar.push(pz)\n\tend\n\tar.push(p4)\nend",
"def CreateArcElement3(arg0, arg1, arg2, arg3)\n ret = _invoke(1610744059, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def points_on_circle(center, normal, radius, numseg)\r\n # Get the x and y axes\r\n axes = Geom::Vector3d.new(normal).axes\r\n center = Geom::Point3d.new(center)\r\n xaxis = axes[0]\r\n yaxis = axes[1]\r\n \r\n xaxis.length = radius\r\n yaxis.length = radius\r\n\r\n # compute the points\r\n da = (Math::PI * 2) / numseg\r\n pts = []\r\n for i in 0...numseg do\r\n angle = i * da\r\n cosa = Math.cos(angle)\r\n sina = Math.sin(angle)\r\n vec = Geom::Vector3d.linear_combination(cosa, xaxis, sina, yaxis)\r\n pts.push(center + vec)\r\n end\r\n \r\n # close the circle\r\n pts.push(pts[0].clone)\r\n\r\n pts\r\nend",
"def to_point3d(pt)\n case pt\n when Array\n pt_a = pt.map(&:to_f)\n x, y, z = pt_a\n z ||= 0.0\n Point3d.new(x, y, z)\n when Point3d\n pt\n when WIN32OLE_RECORD\n Point3d.from_ole(pt) if pt.typename == \"Point3d\"\n end\n end",
"def point3c(point3c=nil,point3=self)\n (point3c ||= Point3c.new).set(point3.c_radius,point3.theta,point3.z)\n end",
"def point3s(point3s=nil,point3=self)\n (point3s ||= Point3s.new).set(point3.s_radius,point3.theta,point3.phi)\n end",
"def center\n a, b, c, d = @points\n\n Geom::Point3d.new(\n (a.x + b.x + c.x + d.x) / 4,\n (a.y + b.y + c.y + d.y) / 4,\n (a.z + b.z + c.z + d.z) / 4\n )\n end",
"def create_rod(sPoint, a)\r\n pts = []\r\n pts[0] = sPoint\r\n pts[1] = Geom::Point3d.new(sPoint[0] + a, sPoint[1], sPoint[2])\r\n return pts\r\nend",
"def get_arc_points(cx,cy,radius, beg_angle, end_angle, degree_inc = 1.0)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n deg = beg_angle\r\n degree_inc = degree_inc.abs\r\n ares = Array.new\r\n while (deg < end_angle)\r\n #print \"(deg = \", deg, \")\\n\"\r\n cp = calc_point_from_angle(cx,cy, deg, tradius)\r\n ares.append(cp)\r\n deg += degree_inc\r\n end #while\r\nend",
"def pt_arcs\n _arcs = arcs.select {|arc| arc.from_place_to_transition?}\n\n if block_given?\n _arcs.each {|arc| yield arc}\n else\n return _arcs\n end\n end",
"def to_ole_point3d(pt)\n case pt\n when ole_point3d?(pt)\n pt\n when Point3d\n create_ole_point(pt.x, pt.y, pt.z)\n when Array\n pt1 = pt.map(&:to_f)\n x, y, z = pt1\n z ||= 0.0\n create_ole_point(x, y, z)\n end\n end",
"def get_3d_polygon()\n height = get_keyword_value(\"HEIGHT\").to_f\n width = get_keyword_value(\"WIDTH\").to_f\n x = self.check_keyword?(\"X\")? self.get_keyword_value(\"X\").to_f : 0.0\n y = self.check_keyword?(\"Y\")? self.get_keyword_value(\"Y\").to_f : 0.0\n #counter clockwise\n origin = OpenStudio::Point3d.new( x, y , 0.0 )\n p2 = OpenStudio::Point3d.new(x + width , y,0.0 )\n p3 = OpenStudio::Point3d.new(x + width , y + height , 0.0 )\n p4 = OpenStudio::Point3d.new(x, y + height,0.0 )\n return [origin,p2,p3,p4]\n end",
"def add_arc(centerPoint: { x: 0.0, y: 0.0 }, radius: 1.0, \n startAngle: 0.0, endAngle: Math::PI * 0.25,\n isClockwise: false)\n pathElement = { elementtype: :patharc,\n centerpoint: centerPoint,\n radius: radius,\n startangle: startAngle,\n endangle: endAngle,\n clockwise: isClockwise }\n @pathArray.push(pathElement)\n @pathArray\n end",
"def makeArc\r\n @entities.add_arc @centre, @vector2, @normal, @toolRadius, 0, Math::PI, 6\r\n end",
"def test_radius_in_arcs\n radius = nil\n assert_nothing_raised do\n # Create a 1/2 circle perpendicular to the normal or Z axis\n center = Geom::Point3d.new 0,0,-30\n normal = Geom::Vector3d.new 0,0,1\n xaxis = Geom::Vector3d.new 1,0,0\n start_a = -Math::PI/2\n end_a = 4.0 * Math::PI # Large enough to make a circle\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_arc center, xaxis, normal, 5, start_a, end_a\n edge = edgearray[0]\n arccurve = edge.curve\n radius = arccurve.radius\n end\n assert_equal(5, radius,\n 'Failed in test_radius' )\n end",
"def points_for_arc(x, y, r, start_angle, end_angle)\n cur_page.points_for_arc(x, y, r, start_angle, end_angle)\n end",
"def sp_points_on_circle(center, normal, radius, numseg, rotAngle)\n # Get the x and y axes\n axes = Geom::Vector3d.new(normal).axes\n center = Geom::Point3d.new(center)\n xaxis = axes[0]\n yaxis = axes[1]\n xaxis.length = radius\n yaxis.length = radius\n rotAngle = 0.0 unless rotAngle.is_a?(Numeric)\n # Compute the points\n da = (Math::PI*2) / numseg\n pts = []\n for i in 0...numseg do\n angle = rotAngle + (i * da)\n cosa = Math.cos(angle)\n sina = Math.sin(angle)\n vec = Geom::Vector3d.linear_combination(cosa, xaxis, sina, yaxis)\n pts.push(center + vec)\n end\n # Close the circle\n pts.push(pts[0].clone)\n pts\n end",
"def arc_test_easy_array(mill)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n aArc = CNCShapeArc.new(\r\n mill = mill, \r\n x = 1.5,\r\n y = 1.5,\r\n beg_min_radius = 0.65, \r\n beg_max_radius = 0.85,\r\n beg_angle = 0.0, \r\n end_min_radius = 0.65,\r\n end_max_radius = 0.90,\r\n end_angle = 35.0, \r\n depth = -0.2)\r\n\r\n aArc.circ_array()\r\nend",
"def set( *args )\r\n fail_if_invalid()\r\n if args.size == 1\r\n # .set( Geom::Point3d )\r\n # .set( [ x, y, z ] )\r\n arg = args[0]\r\n if arg.is_a?( Geom::Point3d )\r\n @position = arg\r\n elsif arg.is_a?( Array )\r\n if arg.all? { |i| i.is_a?( Numeric ) }\r\n @position = Geom.Point3d.new( *arg )\r\n else\r\n raise ArgumentError, 'Array does not contain all Numeric.'\r\n end\r\n end\r\n elsif args.size == 3\r\n # .set( x, y, z )\r\n if args.all? { |i| i.is_a?( Numeric ) }\r\n @position = Geom.Point3d.new( *args )\r\n else\r\n raise ArgumentError, 'Arguments not all Numeric.'\r\n end\r\n else\r\n raise ArgumentError, \"Invalid arguments. (#{args.size})\"\r\n end\r\n @position.extend( TT::Point3d_Ex ) # Needed?\r\n @position\r\n end",
"def test_is_polygon_with_arc\n m = Sketchup.active_model\n ents = m.entities\n\n # Create an arc\n center = [0, 0, 0]\n xaxis = [1, 0, 0]\n normal = [0, 0, 1]\n radius = 20\n start_angle = 0\n end_angle = 180\n nsides = 6\n ents.add_arc center, xaxis, normal, radius, start_angle, end_angle, nsides\n\n # Check arc edges\n m.entities.each do |e|\n if e.is_a? Sketchup::Edge and e.curve.respond_to? 'is_polygon?'\n assert_equal(false, e.curve.is_polygon?,\n 'Curve of arc edge should not be polygon.')\n end\n end\n end",
"def triangle_point(sPoint, a, b, c)\r\n pts = []\r\n pts[0] = sPoint\r\n pts[1] = Geom::Point3d.new(sPoint[0] + a, sPoint[1], sPoint[2])\r\n a = a.to_f\r\n b = b.to_f\r\n c = c.to_f\r\n dx = (b*b - c*c + a*a) / (2*a)\r\n dy = Math.sqrt(b*b - dx*dx)\r\n pts[2] = Geom::Point3d.new(sPoint[0] + dx, sPoint[1] + dy, sPoint[2])\r\n return pts\r\nend",
"def arc(x, y, radius, angle1, angle2)\n [x.value, y.value, radius.value, angle1.value * (Math::PI / 180.0), angle2.value * (Math::PI / 180.0)]\n end",
"def tp_arcs\n _arcs = arcs.select {|arc| arc.from_transition_to_place?}\n\n if block_given?\n _arcs.each {|arc| yield arc}\n else\n return _arcs\n end\n end",
"def test_xaxis_returns_vector3d\n centerpoint = Geom::Point3d.new\n # Create a circle perpendicular to the normal or Z axis\n vector = Geom::Vector3d.new 0,0,1\n vector2 = vector.normalize!\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_circle centerpoint, vector2, 50\n edge = edgearray[0]\n arccurve = edge.curve\n\n result = arccurve.xaxis.class\n expected = Geom::Vector3d\n assert_equal(expected, result, 'Expected does not match result.')\n end",
"def Range3dFromPoint3dPoint3dPoint3d(arg0, arg1, arg2)\n ret = _invoke(1610744084, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def triangle(atomids)\n if atomids.size != 3\n raise SizeError\n end\n atoms = []\n atomids.each do |atomid|\n atom = atom_by_id(atomid)\n raise AtomNotFoundError, atomid unless atom\n atoms << atom\n end\n #pp atoms\n tri = CrystalCell::Povray::Triangle.new(\n *atoms.map { |atom| atom.position.to_v3d(self.axes)},\n CrystalCell::Povray::Element.color( atoms[0].element)\n )\n tri.to_pov\n end",
"def Point3dTripleProduct4Points(arg0, arg1, arg2, arg3)\n ret = _invoke(1610743845, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def initialize(p1, p2, p3)\n @point1 = p1\n @point2 = p2\n @point3 = p3\n\n # adjust all the points so that they are relative to p1\n @rel_point1 = Vector[0, 0, 0]\n @rel_point2 = @point2 - @point1\n @rel_point3 = @point3 - @point1\n end",
"def calc_points_for_arc(cx, cy,radius=1.0, beg_angle=0, end_angle = 360, degree_inc = 1.0)\r\n# - - - - - - - - - - - - - - - - - - - - -\r\n if beg_angle > end_angle\r\n #swap if starting point is higher than ending point\r\n tt = beg_angle\r\n end_angle = beg_angle\r\n beg_angle = tt\r\n end #if\r\n res = Array.new\r\n curr_angle = beg_angle\r\n #p2 = calc_point_rotated_relative(p2.x, p2.y,1)\r\n #print \"angle_inc = \", angle_inc, \"\\n\"\r\n #print \"pp = \", pp, \"\\n\"\r\n \r\n start_point = calc_point_from_angle(0,0,beg_angle, radius)\r\n last_point = start_point \r\n res.append(start_point)\r\n \r\n # sets up the change of the \r\n stop_angle = end_angle\r\n if (end_angle == 360) && (beg_angle == 0)\r\n stop_angle -= 1\r\n end #if\r\n\r\n cnt = 1\r\n #print \" relative rotate point = \", p2, \"\\n\"\r\n while (curr_angle <= stop_angle)\r\n curr_angle += angle_inc\r\n p2 = calc_point_rotated_relative(last_point.x, last_point.y, angle_inc)\r\n print \" relative rotate point = \", p2, \"\\n\"\r\n res.append(p2)\r\n last_point = p2\r\n end\r\n return cnt\r\nend",
"def CreateArcElement1(arg0, arg1, arg2, arg3)\n ret = _invoke(1610743976, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def test_arc_radius_after_creation_with_negative_radius\n radius = nil\n assert_nothing_raised do\n # Create a 1/2 circle perpendicular to the normal or Z axis\n center = Geom::Point3d.new 0,0,-30\n normal = Geom::Vector3d.new 0,0,1\n xaxis = Geom::Vector3d.new 1,0,0\n start_a = -Math::PI/2\n end_a = 4.0 * Math::PI # Large enough to make a circle\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_arc center, xaxis, normal, -5, start_a, end_a\n edge = edgearray[0]\n arccurve = edge.curve\n radius = arccurve.radius\n end\n assert_equal(5, radius,\n 'Failed in test_radius' )\n end",
"def to_p\n Point3.new(@x, @y, @z)\n end",
"def Range3dFromPoint3dPoint3d(arg0, arg1)\n ret = _invoke(1610744081, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dFromTransform3dTimesXYZ(arg0, arg1, arg2, arg3)\n ret = _invoke(1610743923, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def make_set(x,y,z)\n return [x,y,z]\n end",
"def Point3dAddAngleDistance(arg0, arg1, arg2, arg3)\n ret = _invoke(1610744060, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def quarter_circle(center, options)\n case options[:quadrant]\n when 1\n start_angle = 0\n end_angle = 90\n when 2\n start_angle = 90\n end_angle = 180\n when 3\n start_angle = 180\n end_angle = 270\n when 4\n start_angle = 270\n end_angle = 360\n end\n pie_slice(center,\n :radius => options[:radius],\n :start_angle => start_angle,\n :end_angle => end_angle,\n :stroke_both_sides => options[:stroke_both_sides])\n end",
"def Point3dProjectToPlane3d(arg0, arg1, arg2 = nil, arg3 = nil)\n ret = _invoke(1610744125, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_VARIANT, VT_BOOL])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Range3dFromPoint3d(arg0)\n ret = _invoke(1610744080, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def sector_a_intfx_coords\n [ [-1.5 * @radius, @radius], [-1.5 * @radius, -@radius], \n [-1.5 * @radius, 3 * @radius], [-3 * @radius, 2 * @radius],\n [-3 * @radius, 0], [-3 * @radius, -2 * @radius],\n [-1.5 * @radius, -3 * @radius] ]\n end",
"def circle_nodes(width=@width, height=@height, nodeset=@nodes)\n center = Vector[width/2, height/2]\n radius = [width,height].min/2\n nodeset.each_with_index{|(key, node), i| nodeset[key].location = Vector[\n center[0] + (radius * Math.sin(Math::PI/4+2*Math::PI*i/nodeset.length)), \n center[1] - (radius * Math.cos(Math::PI/4+2*Math::PI*i/nodeset.length))] if !nodeset[key].static}\n end",
"def vertices\n [\n @origin,\n { x: x_max, y: y_min, z: z_min },\n { x: x_min, y: y_max, z: z_min },\n { x: x_min, y: y_min, z: z_max },\n { x: x_max, y: y_max, z: z_min },\n { x: x_max, y: y_min, z: z_max },\n { x: x_min, y: y_max, z: z_max },\n { x: x_max, y: y_max, z: z_max }\n ]\n end",
"def pie_slice(center, options)\n vertices = arc_vertices(center, options)\n vertices.unshift(:point => center)\n if options[:stroke_both_sides]\n closed_curve(vertices)\n else\n open_curve(vertices)\n end\n end",
"def Point3dFromSegment3dTangent(arg0)\n ret = _invoke(1610744250, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def initalize_3d(desviacion, cantidad, xpos, ypos, zpos, yd)\n @matrix = Array.new\n cantidad.times do\n @matrix.push([xpos + 2 * desviacion * rand - desviacion, ypos + 2 * desviacion * rand - desviacion, zpos + 2 * desviacion * rand - desviacion, yd])\n end\n end",
"def index\n @cp3s = Cp3.all\n end",
"def CreateArcElement5(arg0, arg1, arg2, arg3)\n ret = _invoke(1610744128, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_R8, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def initialize(x,y,z)\n @p = [x,y,z]\n end",
"def arc_around(center, options)\n open_curve(arc_vertices(center, options))\n end",
"def Point3dFromAngleDistance(arg0, arg1, arg2)\n ret = _invoke(1610744061, [arg0, arg1, arg2], [VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def ConstructCirclesTangentToThreeElements(arg0, arg1, arg2, arg3, arg4 = nil, arg5 = nil)\n ret = _invoke(1610744131, [arg0, arg1, arg2, arg3, arg4, arg5], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_DISPATCH, VT_I4])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def mesh_points( subdivs, transformation )\r\n points = []\r\n for patch in @patches\r\n points.concat( patch.mesh_points( subdivs, transformation ).to_a )\r\n end\r\n points = TT::Point3d.extend_all( points ) # So that .uniq! works\r\n points.uniq!\r\n points\r\n end",
"def Point3dFromMatrix3dTimesXYZ(arg0, arg1, arg2, arg3)\n ret = _invoke(1610743885, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def set_cp3\n @cp3 = Cp3.find(params[:id])\n end",
"def test_xaxis_length_matches_radius\n axis = nil\n radius = 5\n assert_nothing_raised do\n centerpoint = Geom::Point3d.new\n # Create a circle perpendicular to the normal or Z axis\n vector = Geom::Vector3d.new 0,0,1\n vector2 = vector.normalize!\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_circle centerpoint, vector2, radius\n edge = edgearray[0]\n arccurve = edge.curve\n axis = arccurve.xaxis\n end\n assert_equal(radius, axis.length,\n 'Axis length does not match radius' )\n end",
"def create_circles(num)\n circle_image = circle_image()\n circles = []\n num.times do\n body = CP::Body.new(1, CP::moment_for_circle(1.0, 10,10, CP::Vec2.new(0, 0))) # mass, moment of inertia\n body.p = CP::Vec2.new(rand(SCREEN_WIDTH), rand(40) - 50)\n shape = CP::Shape::Circle.new(body, 10, CP::Vec2.new(0, 0))\n shape.e = 0.4\n shape.u = 0.4\n circles << AObject.new(circle_image, body)\n @space.add_body(body)\n @space.add_shape(shape) \n end\n return circles\n end",
"def add_dimension_radial(arc_curve, leader_break_pt)\n end",
"def Point3dFromTransform3dTimesPoint3d(arg0, arg1)\n ret = _invoke(1610743922, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def arcto(x1, y1, x2, y2, radius)\n CGContextAddArcToPoint(@ctx, x1, y1, x2, y2, radius)\n end",
"def Point3dCrossProduct3Points(arg0, arg1, arg2)\n ret = _invoke(1610743836, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def initialize(p1, p2, p3)\n @p1 = p1\n @p2 = p2\n @p3 = p3\n end",
"def initialize(p1,p2,p3)\r\n \r\n @p1 = p1\r\n @p2 = p2\r\n @p3 = p3\r\n \r\n end",
"def Point3dFromXYZ(arg0, arg1, arg2)\n ret = _invoke(1610743848, [arg0, arg1, arg2], [VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def test_circle_radius_after_creation_with_negative_radius\n radius = nil\n assert_nothing_raised do\n centerpoint = Geom::Point3d.new\n # Create a circle perpendicular to the normal or Z axis\n vector = Geom::Vector3d.new 0,0,1\n vector2 = vector.normalize!\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_circle centerpoint, vector2, -10\n edge = edgearray[0]\n arccurve = edge.curve\n radius = arccurve.radius\n end\n assert_equal(10, radius,\n 'Failed in test_radius' )\n end",
"def zcrossproduct(point1, point2, point3)\n dx1 = point2.x - point1.x\n dy1 = point2.y - point1.y\n dx2 = point3.x - point2.x\n dy2 = point3.y - point2.y\n dx1*dy2 -dy1*dx2\n end",
"def test_start_angle_on_circle\n start_angle = nil\n assert_nothing_raised do\n centerpoint = Geom::Point3d.new\n # Create a circle perpendicular to the normal or Z axis\n vector = Geom::Vector3d.new 0,0,1\n vector2 = vector.normalize!\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_circle centerpoint, vector2, 11\n edge = edgearray[0]\n arccurve = edge.curve\n start_angle = arccurve.start_angle\n end\n assert_equal(0.0, start_angle,\n 'Failed: start_angle != PI*2' )\n end",
"def ==(point3)\n (@x == point3.x)&&(@y == point3.y)&&(@z == point3.z)\n end",
"def vertex_arc(v)\n x1, y1 = *polar_to_cartesian(angle_to_x(v), ARC_RADIUS)\n x2, y2 = *polar_to_cartesian(angle_to_x(v) + t.angle(v), ARC_RADIUS)\n %[<path d=\"M #{@coords[v][0] + x1},#{@coords[v][1] - y1} A #{ARC_RADIUS},#{ARC_RADIUS} 0 0 0 #{@coords[v][0] + x2},#{@coords[v][1] - y2}\" stroke=\"#90ee90\" stroke-width=\"2\" fill=\"none\"/>\\n]\n end",
"def add_arc(*args)\n end",
"def x509v3_crl_distribution_points\n @x509v3_crl_distribution_points ||= if (node = @node.at('X509v3CRLDistributionPoints'))\n X509v3CRLDistributionPoints.new(node)\n end\n end",
"def create_cross_array(start)\n cross_array =[\n Point.new(start.x-1, start.y),\n Point.new(start.x+1, start.y),\n Point.new(start.x, start.y-1),\n Point.new(start.x, start.y+1),\n ]\n return cross_array\n end",
"def calculate_from_distances(dist1, dist2, dist3)\n # From Wikipedia: https://en.wikipedia.org/wiki/Trilateration\n ex = @rel_point2 / @rel_point2.norm\n i = ex.dot(@rel_point3)\n ey = (@rel_point3 - (i * ex)) / (@rel_point3 - (i * ex)).norm\n ez = ex.cross(ey)\n d = @rel_point2.norm\n j = ey.dot(@rel_point3)\n\n x = (dist1**2 - dist2**2 + d**2) / (2 * d)\n y = ((dist1**2 - dist3**2 + i**2 + j**2) / (2 * j)) - ((i / j) * x)\n\n z = Math.sqrt((dist1**2 - x**2 - y**2).abs)\n\n @point1 + (x * ex) + (y * ey) + (z * ez)\n end",
"def Point3dFromSegment3dFractionParameter(arg0, arg1)\n ret = _invoke(1610744249, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dProjectToRay3d(arg0, arg1, arg2, arg3 = nil, arg4 = nil)\n ret = _invoke(1610744126, [arg0, arg1, arg2, arg3, arg4], [VT_BYREF | VT_R8, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_VARIANT, VT_BOOL])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dFromXY(arg0, arg1)\n ret = _invoke(1610743849, [arg0, arg1], [VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def CreateArcElement2(arg0, arg1, arg2, arg3, arg4, arg5, arg6)\n ret = _invoke(1610743977, [arg0, arg1, arg2, arg3, arg4, arg5, arg6], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_R8, VT_R8, VT_BYREF | VT_DISPATCH, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def test_to_a_returns_array\n obj = Geom::Point3d.new\n a = obj.to_a\n result = a.class\n expected = Array\n assert_equal(expected, result, 'Expected does not match result.')\n end",
"def Point3dAddPoint3dVector3d(arg0, arg1)\n ret = _invoke(1610744208, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def to_a\n [self.x, self.y, self.z]\n end",
"def add_arc_topoint_onpath(tangentPoint1: { x: 0.0, y: 0.0 },\n tangentPoint2: { x: 100.0, y: 100.0 },\n radius: 1.0)\n pathElement = { elementtype: :pathaddarctopoint,\n tangentpoint1: tangentPoint1,\n tangentpoint2: tangentPoint2,\n radius: radius }\n @pathArray.push(pathElement)\n @pathArray\n end",
"def distance_to(point3)\n Math.sqrt(((@x-point3.x)**2)+((@y-point3.y)**2)+((@z-point3.z)**2))\n end",
"def authorise_payment_3dsecure_request(attributes = {})\n Adyen::REST::AuthorisePayment::Request.new('Payment.authorise3d', attributes,\n response_class: Adyen::REST::AuthorisePayment::Response)\n end",
"def arc_test_manual_array(mill = nil)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n #############\r\n ### ARC TEST #0\r\n #############\r\n if (mill == nil)\r\n mill = CNCMill.new\r\n mill.job_start()\r\n mill.home()\r\n end #if\r\n\r\n # variables used here to make\r\n # easy for reader.\r\n circ_x = 3.0\r\n circ_y = 2.0\r\n min_radius = 0.7\r\n max_radius = 0.95\r\n beg_angle = 0\r\n degree_inc = 4\r\n depth = -0.5\r\n sweep_angle = 30\r\n width = 0.1\r\n\r\n curr_beg_angle = beg_angle\r\n lc =0\r\n curr_min_radius = min_radius\r\n # illustrate an easy way to get a \r\n # concentric wrings of arc pockets\r\n while (lc < 3)\r\n max_radius = curr_min_radius + width\r\n curr_beg_angle = beg_angle\r\n lc += 1\r\n # illustrate an easy way to get a\r\n # repeating array of arc pockets\r\n cc = 0\r\n while (cc < 4)\r\n cc += 1\r\n end_angle = curr_beg_angle + sweep_angle\r\n aRes = arc_segment_pocket(mill, \r\n circ_x,\r\n circ_y,\r\n curr_min_radius, \r\n max_radius,\r\n curr_beg_angle,\r\n end_angle, \r\n 0, \r\n depth,\r\n degree_inc)\r\n mill.retract()\r\n curr_beg_angle = end_angle + (sweep_angle * 0.8)\r\n end #while\r\n width = width * 1.2\r\n curr_min_radius = max_radius + (width * 2)\r\n end #while\r\n return aRes\r\nend",
"def circle_nodes_at_point(nodeset=@nodes, center=Vector[@width/2,@height/2], radius=[@width,@height].min/2, reverse=false, offset=0)\n nodeset.each_with_index{|(key, node), i| nodeset[key].location = Vector[\n center[0] + (radius * Math.sin(offset+2*Math::PI*i/nodeset.length)), \n center[1] - (radius * Math.cos(offset+2*Math::PI*i/nodeset.length))]}\n end",
"def add_triangle(points: nil)\n fail \"Needs an array of 3 points\" if points.nil?\n fail \"Needs an array of 3 points\" unless points.length.eql? 3\n \n self.add_moveto(points[0])\n self.add_lineto(points[1])\n self.add_lineto(points[2])\n self.add_lineto(points[0])\n self.add_closesubpath()\n end",
"def curve(x1, y1, x2, y2, x3, y3)\n [x1.value, y1.value, x2.value, y2.value, x3.value, y3.value]\n end",
"def CreateArcElement4(arg0, arg1, arg2)\n ret = _invoke(1610744127, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def initialize(point1, point2, point3)\n\t\t@point1 = point1\n\t\t@point2 = point2\n\t\t@point3 = point3\n\t\t@area = 0\n\t\tfind_area\n\tend",
"def arc_test_0\r\n# - - - - - - - - - - - - - - - - - - - -\r\n #############\r\n ### ARC TEST #0\r\n #############\r\n aMill = CNCMill.new\r\n aMill.job_start()\r\n aMill.home()\r\n # variables used here to make\r\n # easy for reader.\r\n\r\n aRes = arc_segment_pocket(\r\n mill = aMill, \r\n circ_x = 1.0,\r\n circ_y = 1.0,\r\n min_radius = 0.82,\r\n max_radius = 0.95,\r\n beg_angle = 41.0,\r\n end_angle = 48.3,\r\n 0,\r\n depth = -1.8,\r\n degree_inc = 0.5)\r\n \r\n return aRes\r\nend",
"def initialize(center, radius, colors, points=nil)\n self.center(center)\n self.radius(radius)\n if colors.is_a?(Hash)\n self.points(colors.keys)\n self.colors(colors.values)\n else\n self.colors(colors)\n self.points(points)\n end\n end",
"def initialize(center, radius, colors, points=nil)\n self.center(center)\n self.radius(radius)\n if colors.is_a?(Hash)\n self.points(colors.keys)\n self.colors(colors.values)\n else\n self.colors(colors)\n self.points(points)\n end\n end",
"def Point3dFromVector3d(arg0)\n ret = _invoke(1610744207, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dFromTransform3d(arg0)\n ret = _invoke(1610743937, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dFromMatrix3dTimesPoint3d(arg0, arg1)\n ret = _invoke(1610743883, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def create_group_acls(acls)\n acls_ids = Array.new\n\n acls.each{|rule|\n\n acl = OpenNebula::Acl.new(OpenNebula::Acl.build_xml,@client)\n\n rule_ast = \"#{rule} *\" #Add all zone id's\n\n parsed_acl = OpenNebula::Acl.parse_rule(rule_ast)\n\n return parsed_acl, [] if OpenNebula.is_error?(parsed_acl)\n\n rc = acl.allocate(*parsed_acl)\n\n return rc, \"\" if OpenNebula.is_error?(rc)\n\n acls_ids << acl.id\n }\n\n return true, acls_ids\n end",
"def get_marker()\r\n center = Geom::Point3d.new(0, 0, 0)\r\n rotate_around_vector = Geom::Vector3d.new(0, 0, 1)\r\n angle = 14.4.degrees\r\n tr = Geom::Transformation.rotation(center, rotate_around_vector, angle)\r\n vector = Geom::Vector3d.new(@radius, 0, 0)\r\n 26.times.map {center + vector.transform!(tr) }\r\n end",
"def three_by_three_boxes\n @boxes ||= [0,1,2].repeated_permutation(2).map do |box_coord|\n box_row, box_col = *box_coord\n col_offset = box_col * 3\n row(box_row * 3)[col_offset...(col_offset+3)] +\n row(box_row * 3 + 1)[col_offset...(col_offset+3)] +\n row(box_row * 3 + 2)[col_offset...(col_offset+3)]\n end\n end",
"def cross!(x=1/sqrt3,y=1/sqrt3,z=1/sqrt3)\n if x.kind_of? Numeric\n set((@y*z)-(@z*y), (@z*x)-(@x*z), (@x*y)-(@y*x))\n elsif x.point3_like?\n if y.kind_of? Numeric\n cross! x.x, x.y, x.z\n elsif y.point3_like?\n set(x).cross!(y)\n else\n raise_no_conversion y\n end\n else\n raise_no_conversion x\n end\n end",
"def Point3dAdd3ScaledVector3d(arg0, arg1, arg2, arg3, arg4, arg5, arg6)\n ret = _invoke(1610744212, [arg0, arg1, arg2, arg3, arg4, arg5, arg6], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_R8, VT_BYREF | VT_DISPATCH, VT_R8, VT_BYREF | VT_DISPATCH, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end"
] | [
"0.5745622",
"0.56563866",
"0.55909216",
"0.54083776",
"0.53112423",
"0.52581954",
"0.5243789",
"0.5230431",
"0.52199143",
"0.5217242",
"0.51904416",
"0.5160909",
"0.51120985",
"0.50925976",
"0.50517815",
"0.49432805",
"0.49287426",
"0.49136236",
"0.4857209",
"0.48492023",
"0.48410067",
"0.48359776",
"0.48068044",
"0.48037827",
"0.47790086",
"0.47392824",
"0.46839994",
"0.4679639",
"0.46545798",
"0.4641388",
"0.46340898",
"0.46196043",
"0.46067736",
"0.4591076",
"0.45843315",
"0.45701978",
"0.45500004",
"0.45333907",
"0.4509146",
"0.44718793",
"0.44556075",
"0.4436526",
"0.4436301",
"0.4428191",
"0.44169214",
"0.43884793",
"0.43848497",
"0.43834257",
"0.43826512",
"0.43761316",
"0.43651205",
"0.43568283",
"0.43504885",
"0.43503773",
"0.4341115",
"0.4336993",
"0.43126404",
"0.42989346",
"0.42885244",
"0.42819196",
"0.42697972",
"0.42690846",
"0.4259658",
"0.4244784",
"0.4224571",
"0.42227212",
"0.4216275",
"0.42091373",
"0.42005956",
"0.4194528",
"0.4185221",
"0.41797534",
"0.41757458",
"0.41678593",
"0.41573554",
"0.41498134",
"0.41343987",
"0.41289094",
"0.41254717",
"0.4124259",
"0.41191903",
"0.41121504",
"0.41111347",
"0.4110903",
"0.41076404",
"0.4096364",
"0.40832314",
"0.40821695",
"0.40787625",
"0.40760064",
"0.40711796",
"0.40711796",
"0.40643513",
"0.40527284",
"0.40419385",
"0.40352747",
"0.40340343",
"0.40227434",
"0.40225387",
"0.4022485"
] | 0.5582796 | 3 |
Takes a date range and breaks it into an array of ranges by month. The first and last items may be partial months (ex starting in the middle and ending at the end) and the intermediate items are always full months (1st to last of month) | def months(date_range)
results = []
results << (date_range.begin..date_range.begin.end_of_month)
current = date_range.begin.end_of_month + 1.day
while current < date_range.end.beginning_of_month
month_start = current.beginning_of_month
month_end = current.end_of_month
results << (month_start..month_end)
current = month_end + 1.day
end
results << (date_range.end.beginning_of_month..date_range.end) if current < date_range.end
results
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def month_range start_time, end_time\n start_date = start_time.month_start.to_date\n end_date = end_time.month_start.to_date\n current_date = start_date\n result = []\n while current_date <= end_date\n result << current_date.to_time\n current_date = current_date.next_month\n end\n result\nend",
"def months_list\n unless @months_list\n months = []\n date = start_date\n while date <= end_date\n months << date\n date += 1.month\n end\n @month_list = months\n end\n\n @month_list\n end",
"def associated_months\n result = [] # expect no months if no dates\n years = associated_years\n \n\t start_date = event_start\n\t start_date = entry_deadline if is_opportunity?\n\t \t \n start_month_year = Time.parse(\"01/#{start_date}.month/#{start_date}.year\") if !start_date.blank?\n finish_month_year = Time.parse(\"01/#{event_finish}.month/#{event_finish}.year\") if !event_finish.blank?\n \n #this is the case when we only have a start month\n if !start_month_year.blank? and finish_month_year.blank?\n result << start_date.month\n #this is the tricky one...\n elsif !start_month_year.blank? and !finish_month_year.blank?\n delta_year = event_finish.year - start_date.year # year\n \n #if the range spans an entire year we have all the months\n if (delta_year) > 1\n result = [1,2,3,4,5,6,7,8,9,10,11,12]\n #this is the case of months being in the same year\n elsif delta_year == 0\n puts start_month_year.month\n puts finish_month_year.month\n for m in start_month_year.month..finish_month_year.month\n result << m\n end\n \n #this is the annoying one, going over new year\n elsif delta_year == 1\n #add months to year end\n for month in start_month_year.month..12\n result << month\n end\n \n #add months from start of year\n for month in 1.. finish_month_year.month\n result << month\n end \n end\n result\n end\n \n \n \n \n result\n end",
"def month_range(month, year)\n next_month = month == 12 ? 1 : month + 1\n next_year = month == 12 ? year + 1 : year\n Date.new(year, month, 1)..Date.new(next_year, next_month, 1)\n end",
"def parse_months\n date_from = Date.parse('2004-05-01')\n date_to = Date.parse('2014-04-01')\n date_range = date_from..date_to\n date_months = date_range.map {|d| Date.new(d.year, d.month, 1) }.uniq\n date_months.map {|d| d.strftime \"%B %Y\" }\n end",
"def setup_months(start_month, end_month)\n @months = []\n while start_month <= end_month\n @months << start_month\n start_month += 1\n end\n end",
"def month_list(date, limit: 1)\n month_list = []\n (0 ... limit).each { |t| month_list.push month(date + t.month) }\n month_list\n end",
"def fill_month range\n # reset array to empty first\n @month = []\n range.times do |num|\n @month.push(@hours[num])\n end\n end",
"def all_dates_in_month(month, year)\n first_day = Date.civil(year, month, 1)\n last_day = Date.civil(year, month, -1)\n\n (first_day..last_day).to_a\n end",
"def month_range( year, start_month, end_month )\n\t return Time.local( year, start_month ).at_beginning_of_month, Time.local(year,end_month).at_end_of_month\n\tend",
"def monthly(range)\n data = range(range, :skip_bitmap_count => true)\n\n data = data.group_by { |date, value| date.beginning_of_month }\n case self.type\n when :counter\n sum_up_grouped_data(data)\n when :bitmap\n bitmap_or_grouped_data(data)\n end\n end",
"def find_months_between(dates)\n\n start_date = dates.first\n end_date = dates.last\n\n output = []\n # Handle the case where there is no data.\n if start_date.nil? or end_date.nil?\n return output\n end\n # Loop through years\n (start_date.year..end_date.year).each do |y|\n # Find the range of months needed\n start_month = y == start_date.year ? start_date.month : 1\n end_month = y == end_date.year ? end_date.month : 12\n\n # Loop through months\n (start_month..end_month).each do |m|\n output.append(Date.new(y, m, 1))\n end\n end\n output\n end",
"def all_month\n beginning_of_month..end_of_month\n end",
"def month_calculations\n\t\t@prev_beg_range = @beg_range.to_date.beginning_of_month.prev_month\n\t\t@prev_end_range = @beg_range.to_date.beginning_of_month-1.day\n\t\t@next_beg_range = @beg_range.to_date.next_month.beginning_of_month\n\t\t@next_end_range = @beg_range.to_date.next_month.end_of_month\n\tend",
"def year_month_ranges year\n\t\t\tfrom = Date.new(year, Time.now.month, Time.now.beginning_of_month.day) - 1.year\n\t\t\tto = Date.new(year, Time.now.month, Time.now.end_of_month.day)\n\t\t\t(from..to).group_by(&:month).map { |n,v| v.first.beginning_of_month.to_s..(v.first.end_of_month + 1.day).midnight.to_s }\n\t\tend",
"def initialize(first_year, first_month, last_year, last_month)\n @first_year = first_year\n @first_month = first_month\n @last_year = last_year\n @last_month = last_month\n @months = (Month.new(first_year, first_month)..Month.new(last_year, last_month)).to_a\n end",
"def get_periods(first_start, first_end) \n\t\tperiods = []\n\n\t\tnot_ends = \n\t\t\t(@until.is_a? Fixnum) ?\n\t\t\tlambda {|i,d| i < @until} :\n\t\t\tlambda {|i,d| d < @until}\n\n\t\tduration = first_end - first_start\n\t\tcurrent_start = first_start\n\n\t\ti = 0\n\t\tcount = 0\n\t\twhile not_ends.call(count, current_start)\n\t\t\tperiods << [current_start, current_start + duration]\n\n\t\t\ti += 1\n\t\t\t# get first month that has given day number\n\t\t\ti+=1 while (first_start << -(i * @period_duration)).day != first_start.day\n\n\t\t\tcurrent_start = (first_start << -(i * @period_duration))\n\t\t\tcount += 1 \n\t\tend\n\n\t\tperiods\n\tend",
"def find_months_to_generate\n @dates_of_each_month = []\n @dates = Event.all.pluck(:date)\n @dates.each do |date|\n @dates_of_each_month << date.beginning_of_month\n end\n @dates_of_each_month.uniq!\n end",
"def valid_month_interval(arr)\n if k = DATES_MAP[:cardinals][arr.first] \n [k, valid_day_of_week(arr.last)]\n else\n arr.slice(0,1).map {|v| valid_month_date(v) }.uniq.sort\n end\n end",
"def each_months(n=1,offset=0,dur=1)\n build_subrange do |s|\n s.step = n\n s.adjust_range { |r| day_range(r) }\n s.offset { |dt| dt.to_date >> offset }\n s.increment { |dt,i| dt.to_date >> i }\n s.span { |dt| dt.to_date >> dur }\n end\n end",
"def months_as_array\n (1..12).map {|m| [Date::MONTHNAMES[m]]}\n end",
"def month_weeks_ranges year, month\n\t\t\tdate = Date.new(year, month)\n\t\t\tsundays = (date.beginning_of_month..date.end_of_month).select(&:sunday?)\n\t\t\tsundays.push([date.beginning_of_month, date.end_of_month])\n\t\t\tsundays.flatten.uniq.sort.to_weeks_ranges\n\t\tend",
"def fill_alternate_missing_months(range_start_date = nil, range_end_date = nil, from: nil, to: nil)\n raise \"Cannot fill_alternate_missing_months on a series of frequency #{frequency}\" unless frequency == 'month'\n semi = find_sibling_for_freq('S')\n start_date = Date.parse(from || range_start_date) rescue first_observation\n end_date = Date.parse(to || range_end_date) rescue last_observation\n new_dp = {}\n date = start_date + 1.month\n while date < end_date do\n prevm = date - 1.month\n nextm = date + 1.month\n if data[prevm] && data[nextm]\n new_dp[date] = (data[prevm] + data[nextm]) / 2.0\n if semi && date.month % 6 == 0\n semi_date = date - 5.months\n semi_val = semi.at(semi_date)\n if semi_val\n redistribute_semi(semi_val, semi_date, new_dp)\n end\n end\n end\n date += 2.months ## track only the missing data points\n end\n new_transformation(\"Interpolation of alternate missing months from #{self}\", new_dp)\n end",
"def dates(start_date, end_date)\n @start = start_date.to_date\n @end = end_date.to_date\n @array_array_dates = []\n @range = (@start..@end)\n\n @dates = @range.map do |date|\n @day = date.day\n @month = date.mon - 1\n @year = date.year\n date = []\n date << @year\n date << @month\n date << @day\n @array_array_dates << date\n end\n return @array_array_dates\n end",
"def months_list\n\t (Date.today-1.year..Date.today).map{|d| [d.strftime(\"%b-%Y\"), d.strftime(\"%m-%Y\")]}.uniq.reverse\n\tend",
"def usec_aligned_months(start_ts, end_ts)\n raise \"invalid start/end: end is before start\" unless start_ts <= end_ts\n start_dt = usec_to_time(start_ts).to_date\n end_dt = usec_to_time(end_ts).to_date\n first = { :year => start_dt.year, :month => start_dt.month }\n last = { :year => end_dt.year, :month => end_dt.month }\n\n # there's probably a better way to do this, but this passes the tests for now ...\n chunks = []\n current = first.clone\n while current[:year] <= last[:year]\n while current[:month].between? 1, 12\n chunks << Time.utc(current[:year], current[:month], 1).to_i * USEC_ONE_SECOND\n\n if current[:year] == last[:year] and current[:month] == last[:month]\n break\n elsif current[:month] < 12\n current[:month] += 1\n elsif current[:month] == 12\n current[:month] = 1\n break\n end\n end\n\n if current[:year] == last[:year] and current[:month] == last[:month]\n break\n end\n\n current[:year] += 1\n end\n chunks\n end",
"def month_groups(sd,ed)\n\t (sd..ed).map{|d| [Date::MONTHNAMES[d.month], d.year]}.uniq\n\tend",
"def month_array\r\n\t\t[[\"January\", \"1\"],[\"February\", \"2\"], \r\n\t\t[\"March\", \"3\"],[\"April\",4],\r\n\t\t[\"May\",5],[\"June\",6],\r\n\t\t[\"July\",7],[\"August\",8],\r\n\t\t[\"September\",9],[\"October\",10],\r\n\t\t[\"November\",11],[\"December\",12]]\r\n\tend",
"def historic_trading_by_range(region, start, finish)\n region = AEMO::Region.new(region) if region.is_a?(String)\n\n required_data = []\n (start..finish).map { |d| { year: d.year, month: d.month } }\n .uniq.each do |period|\n required_data += historic_trading(region, period[:year],\n period[:month])\n end\n\n required_data.select do |values|\n values.datetime >= start && values.datetime <= finish\n end\n end",
"def array_of_valid_end_dates(start_date, bookings)\n\t\tstart_dates = []\n\t\tvalid_end_date_array = []\n\t\tlast_valid_end_date = nil\n\t\tbookings.each { |booking| start_dates << booking[:start_date] }\n\t\tstart_dates.sort!\n\t\tstart_dates.each do |date|\n\t\t\tif last_valid_end_date == nil && date > start_date\n\t\t\t\tlast_valid_end_date = date.prev_day\n\t\t\tend\n\t\tend\n\t\tif last_valid_end_date == nil\n\t\t\tlast_valid_end_date = start_date.next_month\n\t\tend\n\t\tvalid_end_date_array = (start_date..last_valid_end_date).to_a\n\tend",
"def all_in_month(date)\n self.by_range(date.beginning_of_month, date.end_of_month).find(:all, :order => 'start_datetime asc, name asc')\n end",
"def each_monthnum(nmonth,n=1)\n build_subrange do |s|\n s.step = n\n s.adjust_range { |r| day_range(r) }\n s.offset { |dt| dt >> (nmonth - dt.month)%12 }\n s.increment { |dt,i| dt.to_date >> i*12 } \n s.span { |dt| dt.to_date >> 1 }\n end\n end",
"def parse_dates\n @report_range = if params[:month] and params[:year]\n now = Date.today\n date = Date.new(params[:year].to_i, params[:month].to_i)\n last_day = date.month == now.month ? now.mday : date.end_of_month.mday\n\n {\n :mode => :month,\n :year => params[:year].to_i,\n :month => params[:month].to_i,\n :days => (1..last_day).map {|d| \"#{d}/#{date.month}/#{date.year}\"}\n }\n elsif params[:from] and params[:to]\n range = (Date.parse(params[:from])..Date.parse(params[:to]))\n\n {\n :mode => :range,\n :from => params[:from],\n :to => params[:to],\n :days => range.map {|d| \"#{d.mday}/#{d.month}/#{d.year}\"}\n }\n else\n time = Time.now\n\n {\n :mode => :none,\n :days => (1..time.mday).map {|d| \"#{d}/#{time.month}/#{time.year}\"}\n }\n end\n end",
"def mid_term_day_months\n [DueOnImportable.new(3, 25, 6, 24), DueOnImportable.new(9, 29, 12, 25)]\n end",
"def associated_day_of_months\n months = associated_months\n result = []\n \n\t start_date = event_start\n\t start_date = entry_deadline if is_opportunity?\n\t \t \n\t if !start_date.blank?\n #if we have no finish date then we only have the day of the event start\n if event_finish.blank?\n result = [100*start_date.month + start_date.day]\n else\n position_date = start_date\n while position_date <= event_finish\n result << 100*position_date.month + position_date.day\n position_date = position_date + 1.day\n break if result.length > 31 #no point iterating through years if we have all the days already\n end\n end\n end\n result.sort\n end",
"def month_week_pattern\n week_pattern.map.with_index { |val,idx| Array.new(val,idx+1) }.flatten\n end",
"def each_month\n @all_expenses ||= Expense.find(:all, :order => 'date')\n return if @all_expenses.empty?\n date = @all_expenses.first.date.beginning_of_month\n end_date = @all_expenses.last.date\n while date <= end_date\n yield date\n date += 1.month\n end\n end",
"def event_range events\n [events.map(&:date).min.to_date, events.map(&:date).max.to_date]\nend",
"def calculate_month_by_month\n return StandardError, 'Already calculated stats for period' if @calculated.include?(:month_by_month)\n check_for_dates\n\n months_list.each do |date|\n start = date.beginning_of_month\n final = date.end_of_month\n month_key = start.strftime(MONTH_KEY)\n\n calculate_stats_for(month_key, Statistic::VIEW, start, final)\n calculate_stats_for(month_key, Statistic::STREAM, start, final) if include_streaming\n calculate_stats_for(month_key, Statistic::DOWNLOAD, start, final)\n end\n @calculated << :month_by_month\n self\n end",
"def day_months\n return create_monthly_dates day(1) if monthly?\n return mid_term_day_months if charged_in_code == LEGACY_MID_TERM\n day_months = []\n 1.upto(maximum_dates) do |index|\n break if empty_due_on? month: month(index), day: day(index)\n day_months << DueOnImportable.new(month(index), day(index))\n end\n day_months\n end",
"def merch_months_in(start_date, end_date)\n date_calc.merch_months_in(start_date, end_date)\n end",
"def monthly_stats(timeframe, end_datetime, sale_lease, type, &block)\n puts \"Monthly stats\"\n\n history = Array.new\n\n (1..number_of_months(timeframe)).each do |months_back|\n # Compute the month interval to search\n month_start = end_datetime - months_back.month\n month_end = month_start + 1.month\n\n # Push month's data to history\n puts \"Push\"\n history << block.call(month_start, month_end, sale_lease, type)\n end\n\n return history\n end",
"def ranges(date)\n ranges =[]\n bra_doc = bra_per_day(date)\n bra_doc.each do |element|\n ranges << element[\"massif\"]\n end\n p ranges\n end",
"def rationalise_dates\n default_range = date_range()\n\n begin\n if ( not @range_month_start.blank? )\n year, month = unpack_string( @range_month_start )\n range_start = Date.new( year, month )\n elsif ( not @range_week_start.blank? )\n year, week = unpack_string( @range_week_start )\n range_start = Timesheet.date_for( year, week, TimesheetRow::FIRST_DAY, true )\n else\n range_start = Date.parse( @range_start )\n end\n rescue\n range_start = default_range.min\n end\n\n begin\n if ( not @range_month_end.blank? )\n year, month = unpack_string( @range_month_end )\n range_end = Date.new( year, month ).at_end_of_month()\n elsif ( not @range_week_end.blank? )\n year, week = unpack_string( @range_week_end )\n range_end = Timesheet.date_for( year, week, TimesheetRow::LAST_DAY, true )\n else\n range_end = Date.parse( @range_end )\n end\n rescue\n range_end = default_range.max\n end\n\n if ( range_end < range_start )\n @range = range_end..range_start\n else\n @range = range_start..range_end\n end\n\n # Hard-coded range throttle to 32 days (just over a \"longest month\") for\n # daily reports to avoid excessive server load.\n\n if ( @frequency_data[ :generator ] == :daily_report )\n @range = ( @range.last - 32.days )..( @range.last ) if ( @range.last.to_time - @range.first.to_time > 32.days )\n end\n end",
"def month\n self.range('month')\n end",
"def test_yearly_by_month_loop\n parse(\n 'FREQ=YEARLY;INTERVAL=1;UNTIL=20120203T225959Z;BYMONTH=2;BYSETPOS=1;BYDAY=SU,MO,TU,WE,TH,FR,SA',\n '2012-01-01 15:45:00',\n [\n '2012-02-01 15:45:00'\n ],\n '2012-01-29 23:00:00'\n )\n end",
"def class_commit_monthly_timeline class_name, events\n class_month_dates = events.select {|e| e.class_name == class_name }.map(&:date).map(&:month_start)\n spread(class_month_dates.freq, month_range(class_month_dates.min, class_month_dates.max))\nend",
"def load_data_insight_range_months(num_of_month)\n type = num_of_month == Settings.insights.range_year ? 'year' : 'month'\n range_months = (0..(num_of_month - 1)).to_a.reverse\n month_labels = range_months.reduce([]){ |a, e| a << (day_insight_data - e.months).strftime(\"%m月\") }\n gon.push({\n \"current_year_data_#{type}\" => all_data_in_range_months(range_months),\n \"last_year_data_#{type}\" => all_data_in_range_months(range_months, true),\n \"month_labels_#{type}\" => month_labels\n })\n end",
"def month_entries(pages, year, month)\n #puts \", year = #{year}, month = #{month}\"\n # page.full_name => yyyy/mm/dd\n entries = []\n pages.each do |page|\n if page_is_of_month?(page, year, month)\n entries << page \n end\n end\n entries\n end",
"def get_year_month_list()\n arr=[]\n start=\"2008_01\"\n str=\"\"\n var_date = Time.now\n while( start != str)\n str = var_date.year.to_s + \"_\" + \"%02d\" % var_date.month.to_s\n arr << str\n var_date = var_date - 1.month\n end\n return arr\n end",
"def friendly_date_range\n sessions.first.start.month == sessions.last.start.month ?\n \"#{sessions.first.start.strftime('%B %-d')}-#{sessions.last.start.strftime('%-d, %Y')}\" :\n \"#{sessions.first.start.strftime('%B %-d')} - #{sessions.last.start.strftime('%B %-d, %Y')}\"\n end",
"def month\n @year = params[:year].to_i\n @month = params[:month].to_i\n @first_day = @event.first_day_of_month(@year, @month)\n @last_day_of_month = Date.new(@year, @month, 1).end_of_month\n end",
"def split(range = nil)\n if self.record_category and self.activity?\n entry_end = self.end_timestamp || Time.now\n time = range ? [self.timestamp, range.begin.midnight.in_time_zone].max : self.timestamp\n end_time = range ? [entry_end, range.end.midnight.in_time_zone].min : entry_end\n list = Array.new\n while time < end_time\n new_end = [entry_end, (time + 1.day).midnight.in_time_zone].min\n list << [time, new_end, self]\n time = new_end\n end\n else\n return [self.timestamp, nil, self]\n end\n list\n end",
"def build_date_array(year, month)\n date_array = Array.new\n # cycle through days in month creating one key in the array for each day\n for d in (1..self.days_in_month(year, month))\n if d.to_i < 10 then\n # if date is 1-9 make sure it is 01-09\n d = \"0#{d}\"\n end\n date_array[d.to_i] = d\n end\n # remove 0 key for 1 to 1 mapping in array\n date_array.shift\n return date_array\n end",
"def to_ranges args = Hash.new\n min = args[:min] || -Infinity\n max = args[:max] || Infinity\n collapse = args[:collapse]\n \n ranges = Array.new\n self.split(%r{\\s*,\\s*}).each do |section|\n md = section.match(RANGE_REGEXP)\n next unless md\n \n from = _matchdata_to_number md, 1, min\n to = _has_matchdata?(md, 2) ? _matchdata_to_number(md, 3, max) : from\n\n prevrange = ranges[-1]\n\n if collapse && prevrange && prevrange.include?(from - 1) && prevrange.include?(to - 1)\n ranges[-1] = (prevrange.first .. to)\n else\n ranges << (from .. to)\n end\n end\n\n ranges\n end",
"def ranges(date)\n ranges =[]\n bra_doc = bra_per_day(date)\n bra_doc.each do |element|\n ranges << element[\"massif\"]\n end\n ranges\nend",
"def class_months es, class_name\n es.select {|e| e.class_name == class_name }\n .map {|e|e.date.month_start }\n .uniq\n .sort\nend",
"def find_month_with_available_days\n month, event_dates_in_month = first_available_or_last_month\n previous_month, next_month = previous_and_next_months(month)\n\n yield(\n month_name(month),\n event_dates_in_month,\n weekdays_until(event_dates_in_month.first.date),\n previous_month,\n next_month\n )\n end",
"def months_between(checkin, checkout)\n start = checkin.year * 100 + checkin.month\n finish = checkout.year * 100 + checkout.month\n table.where{year * 100 + month >= start}\n .where{year * 100 + month <= finish}\n end",
"def report_period_to_range\n daily_report = false\n range = case self\n when 'this_month'\n daily_report = true\n (Date.today.beginning_of_month..Date.today)\n when 'last_month'\n daily_report = true\n (1.month.ago.to_date.beginning_of_month..1.month.ago.to_date.end_of_month)\n when 'last_6_months'\n (5.months.ago.to_date.beginning_of_month..Date.today).select {|d| d.day == 1}\n when 'this_year'\n (Date.today.beginning_of_year..Date.today).select {|d| d.day == 1}\n end\n [range, daily_report]\n end",
"def calculated_dates\n [period1_from_date,period1_end_date,\n period2_from_date, period2_end_date] \n end",
"def report_regular_month_array(now = DateTime.now)\n # size 12 array: the last 12 months\n return self.hours_year_array(now).map do |hrs|\n hrs >= MIN_REGULAR_MONTHLY_HOURS ? true : false\n end\n end",
"def months() 30 * days end",
"def extractDateList(start_date, end_date)\n obj_start=Date.new(start_date[0..3].to_i, start_date[4..5].to_i, start_date[6..7].to_i)\n obj_end=Date.new(end_date[0..3].to_i, end_date[4..5].to_i, end_date[6..7].to_i)\n date_num=(obj_end-obj_start+1).to_i\n date_array=Array.new\n date_num.times do |i|\n date_now=obj_start+i\n date_array << date_now.strftime(\"%Y%m%d\")\n end\n date_array\nend",
"def extract_ranges(args)\n ranges = []\n args.each_with_index do |arg, index|\n if arg.downcase == \"to\"\n startdate, enddate = args[index-1], args[index+1]\n enddate = remove_tailing_comma_from_arg enddate\n ranges.push [startdate, enddate]\n\n # remove startdate, enddate, and \"to\" from args so that they don't show up in garbage\n # probably a better way to do this\n (-1..1).each {|offset| args[index + offset] = \"\"}\n end\n end\n return ranges, args.reject {|arg| arg == \"\"} \n end",
"def find_missing_ranges(start_of_range, end_of_range)\n missing_ranges = []\n if downloads.empty?\n missing_ranges << Range.new(start_of_range, end_of_range)\n return missing_ranges\n end\n\n moving_start_of_range = start_of_range\n\n downloads.each do |d|\n # Break if we've moved past the end of range\n if d.date_range.first >= end_of_range\n break\n end\n\n if (moving_start_of_range < d.date_range.first)\n if d.date_range.first > end_of_range\n missing_ranges << Range.new(moving_start_of_range, end_of_range)\n moving_start_of_range = end_of_range\n else\n missing_ranges << Range.new(moving_start_of_range, d.date_range.first)\n moving_start_of_range = d.date_range.last\n end\n elsif start_of_range > d.date_range.first\n moving_start_of_range = d.date_range.last\n end\n end\n return missing_ranges\n end",
"def get_start_and_end_dates(shown_date, first_day_of_week=0)\n # start with the first day of the given month\n start_of_month = Date.civil(shown_date.year, shown_date.month, 1)\n # the end of last month\n strip_start = beginning_of_week(start_of_month, first_day_of_week)\n # the beginning of next month, unless this month ended evenly on the last day of the week\n if start_of_month.next_month == beginning_of_week(start_of_month.next_month, first_day_of_week)\n # last day of the month is also the last day of the week\n strip_end = start_of_month.next_month\n else\n # add the extra days from next month\n strip_end = beginning_of_week(start_of_month.next_month + 7, first_day_of_week)\n end\n [strip_start, strip_end]\n end",
"def merch_month\n # TODO: This is very inefficient, but less complex than strategic guessing\n # maybe switch to a binary search or something\n @merch_month ||= (1..12).detect do |num|\n date_calc.end_of_month(start_of_year.year, num) >= date && date >= date_calc.start_of_month(start_of_year.year, num)\n end\n end",
"def holidays(range=(Date.today..Date.today.next_month))\n output = []\n @tokens.each do |token|\n if ALL_HOLIDAYS.include?(token)\n return HOLIDAYS.values.map do |dates|\n dates.call(range)\n end.flatten.uniq\n end\n HOLIDAYS.each_pair do |labels,dates|\n if labels.include?(token)\n output.concat(dates.call(range))\n end\n end\n end\n output\n end",
"def select_trend_by_month\n self.trend_period = 'month'\n records = []\n records = get_select_trend_by_month(month_from_date, end_date, accounts)\n records = fill_missing_rows(records, month_from_date, end_date)\n records.flatten\n end",
"def file_commit_monthly_timeline file_name, events\n file_month_dates = events.select {|e| e.file_name == file_name }.map(&:date).map(&:month_start)\n spread(file_month_dates.freq, month_range(file_month_dates.min, file_month_dates.max))\nend",
"def start_ymd_select_list(original_date = nil)\n ymd_array=[]\n date = Time.now #parse(\"2011-04-05 00:00:00\")\n ymd_array << [\"#{original_date.strftime(\"%Y-%m\")}-#{original_date.beginning_of_month.strftime(\"%d\")}\"] unless original_date.nil?\n 12.times do\n ymd_array << [\"#{date.strftime(\"%Y-%m\")}-#{date.beginning_of_month.strftime(\"%d\")}\"]\n date = date.next_month\n end\n return ymd_array\n end",
"def build_vertical_array(year, month)\n # pull in arrays of days and dates\n dates = self.build_date_array(Time.now.year, Time.now.month)\n days = self.build_day_array(Time.now.year, Time.now.month)\n\n # zip the two arrays so we have the following single array to work with\n # [['Mo', '01'], ['Tu', '02']]\n vertical = days.zip(dates)\n\n return vertical\n end",
"def date_range( start_date, end_date )\n d_range = []\n cur_date = start_date \n\n until cur_date == end_date\n d_range << cur_date\n cur_date = Calendar.next_day( cur_date )\n end\n \n d_range << end_date\n end",
"def list_price_for_month(opts)\n #logger.debug 'enter list_price_for_month'\n if list_price == 0.0 || list_price.blank?\n return 0\n end\n startdate = start_date\n enddate = end_date\n month = opts[:month]\n year = opts[:year]\n days_in_month = BigDecimal(Time.days_in_month(month, year).to_s)\n\n #this month is before the start date\n return 0 if (startdate.month > month && startdate.year == year) || (startdate.year > year)\n #this month is after the end date\n return 0 if (enddate.month < month && enddate.year == year) || (enddate.year < year)\n\n if startdate.month == month && startdate.year == year\n #beginning month\n start_day = startdate.day\n else\n start_day = 1\n end\n\n if enddate.month == month && enddate.year == year\n #ending month\n end_day = enddate.day\n else\n end_day = days_in_month\n end\n\n days_covered = BigDecimal(((end_day - start_day) + 1).to_s)\n list_price * (days_covered / days_in_month) * BigDecimal(qty.to_s)\n end",
"def month() end",
"def date_range(from_date, until_date, options = {})\n options.symbolize_keys!\n format = options[:format] || :short\n separator = options[:separator] || \"-\"\n\n if format.to_sym == :short\n month_names = I18n.t(\"date.abbr_month_names\")\n else\n month_names = I18n.t(\"date.month_names\")\n end\n\n from_day = from_date.day\n from_month = month_names[from_date.month]\n from_year = from_date.year\n until_day = until_date.day\n\n dates = { from_day: from_day }\n\n if from_date.day == until_date.day && from_date.month == until_date.month && from_date.year == until_date.year\n date_format = \"same_day\"\n dates.merge!(day: from_day, month: from_month, year: from_year)\n elsif from_date.month == until_date.month && from_date.year == until_date.year\n date_format = \"same_month\"\n dates.merge!(until_day: until_day, month: from_month, year: from_year)\n else\n until_month = month_names[until_date.month]\n\n dates.merge!(from_month: from_month, until_month: until_month, until_day: until_day)\n\n if from_date.year == until_date.year\n date_format = \"different_months_same_year\"\n dates.merge!(year: from_year)\n else\n until_year = until_date.year\n\n date_format = \"different_years\"\n dates.merge!(from_year: from_year, until_year: until_year)\n end\n end\n\n I18n.t(\"date_range.#{format}.#{date_format}\", dates.merge(sep: separator))\n end",
"def monthly_language_activity\n memoized_language_breakdowns = all_languages_monthly_activity\n\n MONTHS.map do |month|\n res = [Date::MONTHNAMES[month]]\n memoized_language_breakdowns.each do |lang, breakdown|\n value = breakdown.detect { |b| b.fetch(\"month\") == month }\n prs = value ? value.fetch(\"prs\") : 0\n res << prs\n end\n res\n end\n end",
"def dates_for_axis influences\n\t\tmin = influences[0].date\n\t\tmax = influences[0].date\n\n\t\tinfluences.each do |influence| \n\t\t\tif influence.date < min\n\t\t\t\tmin = influence.date\n\t\t\tend\n\t\t\tif influence.date > max\n\t\t\t\tmax = influence.date\n\t\t\tend\n\t\tend\n\t\thours = ((max - min)/3600)/3\n\n\t\tmedia = min + hours.hour\n\n\t\tdates = []\n\n\t\tdates << min \n\t\tdates << media\n\t\tdates << max\n\n\t\tdates\n\tend",
"def term\n return nil unless start_time\n case start_time.mon\n when 1..3 # Lent term\n return month_range( start_time.year, 1, 3 )\n when 4..6 # Easter term\n return month_range( start_time.year, 4, 6 )\n when 7..9 # Long vac.\n return month_range( start_time.year, 7, 9 )\n when 10..12 # Michaelmas term\n return month_range( start_time.year, 10, 12 )\n end\n end",
"def set_boundaries\n months = calculate_month_and_next_month(@values[:year],\n @values[:time_frame])\n set_values(months)\n return \"Calculated interval for month from input:\" \\\n \" #{months[:actual]} - #{months[:next]}\"\n end",
"def split_range(range)\n start, finish = range.begin, range.end\n start += length if start < 0\n finish += length if finish < 0\n \n [start, finish - start - (range.exclude_end? ? 1 : 0)]\n end",
"def effective_months\n return 0 if start_date > end_date\n y = (end_date.year - start_date.year) * 12\n m = (end_date.mon - start_date.mon)\n last_month_days = ((end_date.day - end_date.beginning_of_month.day) + 1).to_f / end_date.end_of_month.day\n first_month_days = ((start_date.end_of_month.day - start_date.day) + 1).to_f / start_date.end_of_month.day\n first_and_last = start_date.day - 1 == end_date.day ? 1 : last_month_days + first_month_days\n (y + m + first_and_last) - 1\n end",
"def month_days_interval(first_month_day)\n last_month_day = first_month_day.end_of_month\n\n first_week_day = first_month_day.beginning_of_week(:monday)\n last_week_day = last_month_day.end_of_week(:monday)\n\n while (last_week_day - first_week_day).to_i + 1 < DAYS_PER_MONTH\n last_week_day = last_week_day + 1.week\n end\n\n first_week_day .. last_week_day\n end",
"def bra_all_ranges_per_date(date)\n bra_all_ranges = []\n ranges(date).each do |range|\n bra_all_ranges << bra_per_range(bra_key(range,date))\n end\n bra_all_ranges\nend",
"def monthly_sales(report_date = Time.now)\n date = DateTime.parse report_date.to_s\n prior_months = TimeCalculator.prior_year_period(date, {:format => '%b %Y'})\n [].tap do |results|\n prior_months.each { |mon|\n short_mon = DateTime.parse(mon).strftime('%b')\n total_sales = sold_images.sum { |image| image.sale.total_image_sales(mon) }\n results << { :month => short_mon, :sales => total_sales }\n }\n end\n end",
"def delta_months(start_date, end_date)\n unless start_date.class == Date\n start_date = Date.parse(start_date) rescue raise(\"delta_months: parameter #{start_date} not a proper date string\")\n end\n unless end_date.class == Date\n end_date = Date.parse(end_date) rescue raise(\"delta_months: parameter #{end_date} not a proper date string\")\n end\n if end_date < start_date\n Rails.logger.warn { 'delta_months: dates are in reverse of expected order, giving negative result' }\n end\n (end_date.year - start_date.year) * 12 + end_date.month - start_date.month\n end",
"def end_ymd_select_list(original_date = nil)\n ymd_array=[]\n date = Time.now\n ymd_array << [\"#{original_date.strftime(\"%Y-%m\")}-#{original_date.end_of_month.strftime(\"%d\")}\"] unless original_date.nil?\n 12.times do\n ymd_array << [\"#{date.strftime(\"%Y-%m\")}-#{date.end_of_month.strftime(\"%d\")}\"]\n date = date.next_month\n end\n return ymd_array\n end",
"def monthly_ledgers\n list_months.map {|my| Compta::MonthlyLedger.new(self, my)}\n end",
"def start_of_month(year, month)\n begin\n # will raise exception if params are missing or invalid\n start_date = Date.new(year, month)\n raise ArgumentError if start_date < min_date\n raise ArgumentError if start_date > max_date\n start_date\n rescue\n default_start_date\n end\n end",
"def each_day_of_month(nday,dur=1)\n build_subrange do |s|\n s.step = 1\n s.adjust_range { |r| day_range(r) }\n s.offset do |dt| \n totdays = ((Date.civil(dt.year,dt.month,1) >> 1)-1).day\n dt.to_date + (nday - dt.day)%totdays\n end\n s.increment { |dt,i| dt.to_date >> i }\n s.span { |dt| dt.to_date + dur }\n end\n end",
"def slice(start_x, end_x)\n if start_x.class == Fixnum\n if end_x.class == Fixnum\n dates[(start_x-1)..(end_x-1)]\n else\n dates[start_x-1..-1].select{|d| d <= end_x}\n end\n elsif start_x.class ==Date \n if end_x.class == Date\n dates.select{|d| d >= start_x and d <= end_x}\n else\n dates.select{|d| d >= start_x}[0..end_x-1]\n end\n end\n end",
"def payment_dates_array_up_to_date(date)\n start_enrollment = self.order('enrollment_date ASC').limit(1).first\n stop_enrollment = self.order('cancel_date DESC').limit(1).first\n \n if start_enrollment and stop_enrollment \n start = start_enrollment.enrollment_date\n stop = stop_enrollment.cancel_date\n payment_dates_array = []\n \n if date < stop_enrollment.cancel_date\n length_in_months = Date.length_in_months_including_last(start, date)\n else\n length_in_months = Date.length_in_months_including_last(start, stop)\n end\n \n length_in_months.times do |add_month|\n payment_dates_array << ((start + Payment::DATE_SPACER) >> add_month)\n end\n return payment_dates_array\n else\n return []\n end \n end",
"def last_month_dates\n {\n init_date: Date.today.ago(1.month).beginning_of_month&.to_s,\n end_date: Date.today.ago(1.month).end_of_month&.to_s\n }\n end",
"def bra_all_ranges_per_date(date)\n bra_all_ranges = []\n ranges(date).each do |range|\n bra_all_ranges << bra_per_range(bra_key(range,date))\n end\n bra_all_ranges\n end",
"def create_results\n loop_start_date = start_date.at_beginning_of_month\n loop_end_date = end_date.at_beginning_of_month\n\n while loop_start_date < loop_end_date\n result_start_date = loop_start_date\n result_end_date = loop_start_date.next_month\n \n results.create(start_date: result_start_date, end_date: result_end_date, amount: 0, precision: 'month', status: 0)\n\n loop_start_date = result_end_date\n end\n end",
"def make_ranges(day_list)\n day_list.sort.inject([]) { |ranges, day_num|\n if ranges.empty? or day_num != ranges.last.last.succ\n ranges << [day_num]\n else\n ranges.last << day_num\n end\n ranges\n }\n end",
"def to_ranges\n array = self.compact.uniq.sort\n ranges = []\n if !array.empty?\n # Initialize the left and right endpoints of the range\n left, right = array.first, nil\n array.each do |obj|\n # If the right endpoint is set and obj is not equal to right's successor \n # then we need to create a range.\n if right && obj != right.succ\n ranges << Range.new(left,right)\n left = obj\n end\n right = obj\n end\n ranges << Range.new(left,right)\n end\n ranges\n end",
"def by_month(time=Time.zone.now.month, options={}, &block)\n time = Time.zone.now.month if time.nil?\n year, month = work_out_month(time, options.delete(:year))\n\n start_time = start_of_month(month, year)\n end_time = start_time.end_of_month\n\n by_star(start_time, end_time, options, &block)\n end",
"def convertDailyToMonthlyData()\n aggregateData(ChartDirector::ArrayMath.new(@timeStamps).selectStartOfMonth())\n end"
] | [
"0.757665",
"0.73225707",
"0.7177227",
"0.70933497",
"0.7092237",
"0.7079848",
"0.69416416",
"0.68823355",
"0.6880895",
"0.6837699",
"0.682649",
"0.6821009",
"0.6760408",
"0.67402565",
"0.6560415",
"0.65319514",
"0.65215003",
"0.64339083",
"0.63829774",
"0.63628393",
"0.6270525",
"0.6230137",
"0.6174928",
"0.61584467",
"0.611943",
"0.6118946",
"0.60576165",
"0.599972",
"0.59402406",
"0.58675027",
"0.5864503",
"0.5831647",
"0.57948744",
"0.57853895",
"0.5767652",
"0.5762451",
"0.575111",
"0.5733835",
"0.57028055",
"0.56944805",
"0.5683714",
"0.56819147",
"0.5681374",
"0.5674713",
"0.5671488",
"0.5667286",
"0.5654572",
"0.5654184",
"0.56526774",
"0.56464994",
"0.5634088",
"0.5612258",
"0.5603725",
"0.55640143",
"0.5561148",
"0.5558845",
"0.55019104",
"0.5501825",
"0.549324",
"0.5491275",
"0.5488533",
"0.5478864",
"0.5476987",
"0.54702634",
"0.54673773",
"0.54628366",
"0.5426981",
"0.5423903",
"0.54171735",
"0.5402854",
"0.5372552",
"0.5365646",
"0.53588015",
"0.53393817",
"0.53253585",
"0.5321881",
"0.530719",
"0.5305079",
"0.5304084",
"0.5299246",
"0.5297243",
"0.52970445",
"0.5294541",
"0.529316",
"0.5291587",
"0.5283233",
"0.52736014",
"0.5253279",
"0.52530265",
"0.5250127",
"0.52405494",
"0.5226871",
"0.5223597",
"0.52191514",
"0.52059305",
"0.5199434",
"0.5197587",
"0.51932305",
"0.5193104",
"0.519306"
] | 0.85104007 | 0 |
Determines root node for the list | def fetch_entries(context)
@site, @page, @portal_user = context.registers[:site], context.registers[:page], context.registers[:current_portal_user]
set_defaults
page = (case @source
when 'site' then @all_pages.root.minimal_attributes(@options[:add_attributes]).first # start from home page
when 'parent' then top_page
when 'page' then @page
else
@all_pages.fullpath(@source).minimal_attributes(@options[:add_attributes]).first
end)
children = children(page)
children.delete_if { |p| !include_page?(p) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root_node\n root_nodes.first\n end",
"def root_node; end",
"def root\n return nodes.first if nodes.size == 1\n nodes.find { |node| root?(node) }\n end",
"def root_node_id\n 1\n end",
"def root\n node = self\n node = node.parent while !node.parent.nil?\n node\n end",
"def root\n if self.dotted_ids\n self.class.find(self.dotted_ids.split('.').first)\n else\n node = self\n node = node.parent while node.parent\n node\n end\n end",
"def root\n first :parent_id => nil\n end",
"def root\n node = self\n node = node.parent while node.parent\n node\n end",
"def root\n node = self\n node = node.parent while node.parent\n node\n end",
"def root\n @elements[@root_name]\n end",
"def root\n subject.root(node)\n end",
"def root\n node = self\n node = node.parent while node.parent\n node\n end",
"def head\n return @root\n end",
"def root_node(node)\n return node.respond_to?(:root_node) ? node.root_node : node\n end",
"def root\r\n\t\t\t\tself.find(:first, :conditions => 'parent_id IS NULL')\r\n\t\t\tend",
"def root\n @elements[@root]\n end",
"def root\n\t\t\t\tfind_root[0].to_s\n\t\t\tend",
"def root\n @root\n end",
"def root\n @root ||= start\n end",
"def root\n return @root\n end",
"def root\n return @root\n end",
"def node()\n self.root.node()\n end",
"def get_root()\n \n end",
"def root\n @key.nil? ? self : parents.first\n end",
"def root(e)\n while e != id[e]\n id[e] = id[id[e]] # halve the tree\n e = id[e]\n end\n e\n end",
"def node_first\n @head\n end",
"def root\n ltree_scope.where(\"#{self.class.table_name}.#{ltree_path_column} = SUBPATH(?, 0, 1)\", ltree_path).first\n end",
"def root\n n = self\n while n.parent \n n = n.parent\n end\n n\n end",
"def root\n return @root\n end",
"def root\n self_and_ancestors.first\n end",
"def root_node\n if @root_node.nil?\n # TODO: Fix this so that added content at the end of the file doesn't\n # break this stuff.\n # E.g.: http://smogzer.tripod.com/smog.rdf\n # ===================================================================\n begin\n if self.xml_document.nil?\n return nil\n else\n @root_node = self.xml_document.root\n end\n rescue Exception\n return nil\n end\n end\n return @root_node\n end",
"def set_root_node\n self.x_node = \"root\"\n get_node_info(x_node)\n end",
"def root_model\n node = @model\n\n loop do\n parent = node.parent\n if parent\n node = parent\n else\n break\n end\n end\n\n node\n end",
"def root_model\n node = @model\n\n loop do\n parent = node.parent\n if parent\n node = parent\n else\n break\n end\n end\n\n node\n end",
"def root(index)\n return index if index == @store[index]\n root(@store[index])\n end",
"def root\n ancestors.first || self\n end",
"def get_root(doc)\n doc.children.first\n end",
"def initialize\n @root_node = Node.new\n end",
"def list_start\n if self.type != :list || self.list_type != :ordered_list\n raise NodeError, \"can't get list_start for non-ordered list\"\n end\n CMark.node_get_list_start(@pointer)\n end",
"def root\n return @notes.find { |note| note.part == :root } || self.low_note\n end",
"def head_node\n return nil unless valid?\n\n head_node = @nodes.select { |n| n.is_shadow? }.compact\n \n # TODO: is the last guard necessary?\n head_node.empty? ? nil : head_node[0]\n end",
"def root\n self.where(parent: nil).order('index asc').first\n end",
"def root\n if is_root?\n self\n else\n return Especie.none unless ancestry_ascendente_directo.present?\n ancestros = ancestry_ascendente_directo.split(',').map{|a| a.to_i if a.present?}.compact\n return Especie.none unless ancestros.any?\n\n Especie.find(ancestros.first)\n end\n end",
"def set_root(node)\n @root_address = node.node_address\n @nodes.first_entry = node.node_address\n end",
"def root\n return self if is_root?\n ancestors.select { |category| category.is_root? }.first\n end",
"def root\n self[tree_parent_id_field].nil? ? self : tree_search_class.find(self[tree_path_field].first)\n end",
"def _is_root_node?\n @nodes.size == 1\n end",
"def root\n acts_as_nested_set_options[:class].find(:first, :conditions => \"(#{acts_as_nested_set_options[:parent_column]} IS NULL OR #{acts_as_nested_set_options[:parent_column]} = 0)\")\n end",
"def root; skeleton.root; end",
"def effective_root\n if empty? and children.size == 1\n children.first.effective_root\n else\n self\n end\n end",
"def root(root = T.unsafe(nil)); end",
"def root_id\n if is_root?\n id\n else\n root.id\n end\n end",
"def min_order root_node=@root\n current = root_node\n\n until current.left.nil?\n current = current.left\n end\n\n return current\n end",
"def nodelist; end",
"def nodelist; end",
"def TreeView_GetRoot(hwnd) TreeView_GetNextItem(hwnd, NULL, TreeViewGetNextItem[:ROOT]) end",
"def root_entity\n root = self\n loop do\n break if root.parent_id.nil?\n root = root.parent\n end\n root\n end",
"def root\n cursor = self\n cursor = cursor.up until cursor.root?\n cursor\n end",
"def root\n words.find(&:root?)\n end",
"def top\n self.root.first\n end",
"def root\n nested_set_class.find_with_nested_set_scope(:first, :conditions => \"(#{nested_set_parent} IS NULL)\")\n end",
"def get_start_node\n return @nodes.reduce{|sum, pair| pair[0] < sum[0] ? pair : sum}[1] \n end",
"def root\n @parent.root\n end",
"def root\n @root ||= (parent ? parent.root : self)\n end",
"def root\n root = self\n until (parent = root.parent).nil?\n root = parent\n end\n root\n end",
"def root_id\n if ancestor_ids.empty? then\n id\n else\n branches.first.split('/').first.to_i\n end\n end",
"def root\n @root ||= (parent ? parent.root : self)\n end",
"def root\n @attributes[:root]\n end",
"def root(name=nil)\n @root = name.to_sym if name\n # The first rule in a grammar is the default root.\n @root || rule_names.first\n end",
"def root\n @root ||= NodeProxy.new(@doc.root) if @doc && @doc.root\n end",
"def root_id\n if ancestor_ids.empty? then\n id\n else\n branches.first.split('/').first\n end\n end",
"def root_id\n data[:root_id]\n end",
"def root_hash\n self.node_hash root_node_id\n end",
"def tree\r\n @rootNode\r\n end",
"def root\n folders.first\n end",
"def root\n self\n end",
"def root\n self\n end",
"def root; end",
"def root; end",
"def root; end",
"def root; end",
"def root; end",
"def root; end",
"def root; end",
"def root; end",
"def root; end",
"def root; end",
"def root; end",
"def root; end",
"def root; end",
"def root; end",
"def root; end",
"def head\n @current_node = @head\n end",
"def build_tree(item_list = @sorted_list,root_node = nil)\n #sorted root sorts and removes duplicates from the item list\n if (item_list[0] == nil)\n return nil\n else\n start = 0\n end_of_item_list = item_list.length - 1\n mid = (start + item_list.length) / 2\n #set the root node then start creating a tree node for the left and right side of the array\n #Then after that branch is created attach it to the correct position\n root_node = Node.new(item_list[item_list.length/2])\n root_node.right = build_tree(item_list[0,mid],root_node) \n root_node.left = build_tree(item_list[mid+1,end_of_item_list],root_node)\n return root_node\n end\n \n end",
"def root\n unless @root\n @root = Entry.new\n self.class.parse @root, @raw\n @raw = nil\n end\n\n @root\n end",
"def root \n parent.nil? ? self : parent.root\n end",
"def root(stubborn=false)\n\n previous = nil\n current = @h\n\n exps = @context.storage.find_expressions(\n h.fei['wfid']\n ).each_with_object({}) { |exp, h|\n h[exp['fei']] = exp\n }\n\n while current && current['parent_id']\n previous = current\n current = exps[current['parent_id']]\n end\n\n current ||= previous unless stubborn\n\n current ? Ruote::Exp::FlowExpression.from_h(@context, current) : nil\n end",
"def root\n return self if root?\n (root_relation_enabled? && root_ancestor) || ancestors.first\n end",
"def root\n @root.to_s\n end",
"def root(value)\n self.get_framework(self.current_framework)[:root] = value.to_s unless value.blank?\n return nil\n end",
"def root_level\n self.find\n end"
] | [
"0.7744681",
"0.6957455",
"0.69097817",
"0.6772719",
"0.65886706",
"0.6489657",
"0.6412798",
"0.6385489",
"0.6385489",
"0.6369249",
"0.6362248",
"0.6327559",
"0.63098675",
"0.6256922",
"0.6248215",
"0.62422776",
"0.62380075",
"0.623641",
"0.6221097",
"0.6181858",
"0.6181858",
"0.6177943",
"0.61674553",
"0.61316615",
"0.6130115",
"0.6091246",
"0.6033275",
"0.6011779",
"0.598242",
"0.59729284",
"0.59433883",
"0.591328",
"0.5896335",
"0.5896335",
"0.58838844",
"0.5857862",
"0.58576816",
"0.58472604",
"0.5837101",
"0.5835092",
"0.5827614",
"0.5822517",
"0.5815135",
"0.58124685",
"0.5797612",
"0.57966065",
"0.57938135",
"0.5782806",
"0.576639",
"0.5759191",
"0.575009",
"0.5734038",
"0.5730799",
"0.57303846",
"0.57303846",
"0.5713269",
"0.57117176",
"0.5691093",
"0.5687667",
"0.5684321",
"0.5673707",
"0.56697583",
"0.56682926",
"0.5652944",
"0.5646119",
"0.5638944",
"0.5630569",
"0.5619509",
"0.5617346",
"0.56160825",
"0.56149846",
"0.5599845",
"0.5594854",
"0.55902296",
"0.5588892",
"0.55881417",
"0.55881417",
"0.55829424",
"0.55829424",
"0.55829424",
"0.55829424",
"0.55829424",
"0.55829424",
"0.55829424",
"0.55829424",
"0.55829424",
"0.55829424",
"0.55829424",
"0.55829424",
"0.55829424",
"0.55829424",
"0.55829424",
"0.55807066",
"0.55648327",
"0.55644786",
"0.5558189",
"0.55567735",
"0.55534446",
"0.5550876",
"0.55348414",
"0.5532301"
] | 0.0 | -1 |
Returns a list element, a link to the page and its children | def render_entry_link(context, page, css, depth)
selected = @page == page ? " #{@options[:active_class]}" : ''
icon = @options[:icon] ? '<span></span>' : ''
title = render_title(context, page)
label = %{#{icon if @options[:icon] != 'after' }#{title}#{icon if @options[:icon] == 'after' }}
link_options = caret = ''
href = File.join('/', @site.localized_page_fullpath(page))
if render_children_for_page?(page, depth) && bootstrap?
css += ' dropdown'
link_options = %{ class="dropdown-toggle" data-toggle="dropdown"}
href = '#'
caret = %{ <b class="caret"></b>}
end
has_children_class = has_children?(page) ? @options[:has_children_class] : nil
has_active_child_class = has_active_child?(page) ? @options[:has_active_child_class] : nil
has_dropdown_class = page.depth == 1 && @source == 'site' ? @options[:has_dropdown_class] : nil
css_classes_string = ["link#{selected}", "#{css}", "#{@options[:depth_class]}-#{page.depth}", has_children_class, has_active_child_class, has_dropdown_class].compact.join(" ")
output = %{<li id="#{page.slug.to_s.dasherize}-link" class="#{css_classes_string}">}
output << %{<a href="#{href}"#{link_options}>#{label}#{caret}</a>}
output << render_entry_children(context, page, depth.succ) if (depth.succ <= @options[:depth].to_i)
output << %{</li>}
output.strip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def links\n construct_html(self.items)\n end",
"def subpage_navigation(page)\n l = \"<ul>\\n\"\n page.pages.each do |page|\n l << page_navigation_helper(page)\n end\n l << \"</ul>\"\n end",
"def webSiteBuildLinkListForPages(pages, label, baseDir)\n html = \"<ul data-role=\\\"listview\\\" data-inset=\\\"true\\\">\\n\"\n html += \"<li data-role=\\\"list-divider\\\">#{label}</li>\\n\"\n pages.each do |page|\n title = pageGetTitleFromTargetFile(page)\n target = pageTargetFile(page) + \"/index.html\"\n url = target.split(baseDir)[1]\n html += \"<li><a data-ajax=\\\"false\\\" href=\\\"#{url}\\\">#{title}</a></li>\\n\"\n end\n html += \"</ul>\\n\"\n html\nend",
"def next_and_previous_links_listitems(work, chapter)\n links = next_and_previous_links(work, chapter)\n links.collect {|link| \"<li>\" + link + \"</li>\\n\"}\n end",
"def get_listing_children url, after, all_links, max=nil\n if !max.nil? && all_links.size > max\n return all_links\n end\n opts = {query: {\"t\" => \"day\", \"count\" => \"25\", \"after\" => after}}\n response = get_request url, opts\n if response[\"kind\"] == \"Listing\"\n data = response[\"data\"]\n before = data[\"before\"]\n after = data[\"after\"]\n children = data[\"children\"]\n if children.length == 25\n last_loop = false\n else\n last_loop = true\n end\n children.each do |child|\n if child[\"kind\"] == \"t3\"\n link = Link.new(child[\"data\"])\n all_links << link \n else\n raise \"Expected a link\"\n end\n end\n if last_loop\n return all_links\n else\n get_listing_children url, after, all_links, max\n end\n else\n raise \"Expected a listing\"\n end \n end",
"def menu_item_atom( current_piece, page, page_index = 0)\n return '' if current_piece.enabled_depth < page.depth\n\n leaves_content = ''\n unless page.leaf?\n child_index = page_index # consider all descendants as one list for even/odd\n leaves_content = content_tag(:ul, raw( page.children.map{|child| child_index+=1 ;menu_item_atom( current_piece, child, child_index )}.join ), class: \"depth#{page.depth+1}\" )\n end\n cycle_css_class = (page_index%2 == 0 ? 'even' : 'odd')\n item_content = content_tag(:span, page.name, class: 'name' )\n\n item_content= if page.clickable?\n if page.current?\n link_to item_content, page.path, page.extra_html_attributes.merge( { :class=>\"selected depth#{page.depth} #{cycle_css_class}\" } )\n else\n link_to item_content, page.path, page.extra_html_attributes.merge( { :class=>\"depth#{page.depth} #{cycle_css_class}\" } )\n end\n else\n link_to item_content, page.path, page.extra_html_attributes.merge( { :class=>\"noclick depth#{page.depth} #{cycle_css_class}\", :href=>'javascript:void(0)' } )\n end\n\n content_tag(:li, raw( item_content+ leaves_content ) )\n end",
"def name_li(name)\n self.link(:title=>name).parent\n end",
"def related_content\n list = []\n self.div(:class=>\"relatedcontent_list\").links.each do |link|\n list << link.title\n end\n return list\n end",
"def list\n extract_names_and_urls = lambda do |doc|\n [extact_url(@url, document), extract_titles(document)]\n end\n \n html.css('a').map(&extract_names_and_urls)\n end",
"def list_items(o)\n aux = \"\"\n o[:start] = 0 if o[:start] < 0\n items,count = o[:get].call(o[:start],o[:perpage])\n items.each{|n|\n aux << o[:render].call(n)\n }\n last_displayed = o[:start]+o[:perpage]\n if last_displayed < count\n nextpage = o[:link].sub(\"$\",\n (o[:start]+o[:perpage]).to_s)\n aux << H.a(:href => nextpage,:class=> \"more\") {\"[more]\"}\n end\n aux\n end",
"def link_tree\n ''.html_safe.tap do |content|\n content << toggle_link\n\n unless leaf?\n content << h.content_tag(:ul) do\n h.content_tag_for(:li, children) do |c|\n c.decorate.link_tree\n end\n end\n end\n end\n end",
"def navigation(options = {})\n options.reverse_merge!( page: @page, depth: 1 )\n page = options[:page]\n children = page.home? ? page.navigable_children : page.parent.navigable_children\n html = (is_home_and_shown_in_nav?(page) ? nav_link(Page.home) : '').html_safe\n html << list_items(children, options[:depth])\n content_tag(:ul, html, options.slice(:id, :class))\n end",
"def render_entry_children(context, page, depth)\n output = %{}\n\n children = page.children_with_minimal_attributes(@options[:add_attributes]).reject { |c| !include_page?(c) }\n if children.present?\n output = %{<ul id=\"#{@options[:id]}-#{page.slug.to_s.dasherize}\" class=\"#{bootstrap? ? 'dropdown-menu' : ''}\">}\n children.each do |c, page|\n css = []\n css << 'first' if children.first == c\n css << 'last' if children.last == c\n\n output << render_entry_link(context, c, css.join(' '), depth)\n end\n output << %{</ul>}\n end\n\n output\n end",
"def list_items(o)\n aux = \"\"\n o[:start] = 0 if o[:start] < 0\n items,count = o[:get].call(o[:start],o[:perpage])\n items.each{|n|\n aux << o[:render].call(n)\n }\n last_displayed = o[:start]+o[:perpage]\n if last_displayed < count\n nextpage = o[:link].sub(\"$\",\n (o[:start]+o[:perpage]).to_s)\n aux << H.a(:href => nextpage,:class=> \"more\") {\"[more]\"}\n end\n aux\nend",
"def list_children(parent_url)\n depth = path_depth(parent_url)\n children = sitemap.resources.select do |r|\n r.url.include?(parent_url) && path_depth(r.url) == depth + 1\n end.sort_by { |r| r.path }\n return \"\" if children.size == 0\n list = children.reduce(\"\") do |a, e|\n a << \"<li>#{link_to_resource(e)}</li>\\n\"\n end\n \"<ul class='list-unstyled'>#{list}</ul>\"\n end",
"def list_items\n @list_items ||= children(tag_name: 'li')\n end",
"def list_items\n @list_items ||= children(tag_name: 'li')\n end",
"def documentation_navigation_tree_for(page, options = {})\n active_page_type = nil\n items = String.new.tap do |s|\n if page.is_a?(::Documentation::Page)\n\n pages = page.navigation.select { |p,c| documentation_authorizer.can_view_page?(p) }\n\n pages.each do |p, children|\n s << \"<li>\"\n s << \"<a #{page == p ? \"class='active'\" : ''} href='#{documentation_doc_root}/#{p.full_permalink}'>#{p.title}</a>\"\n active_page_type = :root if page == p\n unless children.empty?\n s << \"<ul>\"\n children.select { |c| documentation_authorizer.can_view_page?(c) }.each do |p|\n s << \"<li><a #{page == p ? \"class='active'\" : ''} href='#{documentation_doc_root}/#{p.full_permalink}'>#{p.title}</a></li>\"\n active_page_type = :child if page == p\n end\n s << \"</ul>\"\n end\n s << \"</li>\"\n end\n else\n ::Documentation::Page.roots.select { |p| documentation_authorizer.can_view_page?(p) }.each do |page|\n s << \"<li><a href='#{documentation_doc_root}/#{page.full_permalink}'>#{page.title}</a></li>\"\n end\n end\n end\n\n String.new.tap do |output|\n output << \"<ul>\"\n if options[:include_back] && page && page.breadcrumb.size > 1\n if active_page_type == :root && page.has_children?\n back_page = page.breadcrumb[-2]\n elsif active_page_type == :child && !page.has_children?\n back_page = page.breadcrumb[-3]\n else\n back_page = nil\n end\n\n if back_page\n output << \"<li class='back'><a href='#{documentation_doc_root}/#{back_page.full_permalink}'>← Back to #{back_page.title}</a></li>\"\n end\n end\n output << items\n output << \"</ul>\"\n end.html_safe\n end",
"def navigation_list_link_to(name, options = {}, html_options = {})\n content_tag(\"li\", navigation_link_to(name, options, html_options))\n end",
"def public_pages\n list = []\n self.div(:id=>\"lhnavigation_public_pages\").links.each do |link|\n list << link.text\n end\n return list\n end",
"def render_entry_children(context, page, depth)\n output = %{}\n\n children = children(page).reject { |c| !include_page?(c) }\n if children.present?\n dropdown_class = @source == 'site' && page.depth == 1 ? @options[:dropdown_class] : ''\n output = %{<ul id=\"#{@options[:id]}-#{page.slug.to_s.dasherize}\" class=\"#{bootstrap? ? 'dropdown-menu' : dropdown_class}\">}\n children.each do |c, page|\n css = []\n css << 'first' if children.first == c\n css << 'last' if children.last == c\n\n output << render_entry_link(context, c, css.join(' '), depth)\n end\n output << %{</ul>}\n end\n\n output\n end",
"def list\n @element.content.map do |paragraph_element|\n line_item = paragraph_element.content.map do |text_element|\n text_exporter.new(text_element).export\n end.join\n\n \"<li>#{line_item}</li>\"\n end.join\n end",
"def content\n @node\n .children\n .select { |node| node.name == 'li' }\n .map do |node|\n ParagraphParser\n .new(node: node, css_analyzer: @css_analyzer)\n .element\n end\n end",
"def get_content\n @list \n end",
"def list_content(item_container)\n\n item_container.items.map { |item|\n li_options = item.html_options.except(:link, :description)\n\n # ID namespace \n if options[:id_namespace] \n li_options[:id] = build_item_key(item)\n end\n\n # Adding the ARIA role tag to the list item to\n # supress the list semantics\n li_options[:role] = \"presentation\"\n\n # Build the tag for the link/button/span\n li_content = tag_for(item, item_container.level)\n li_options[:class] = li_options[:class] || \"\"\n\n # Check if this item has children\n if include_sub_navigation?(item)\n li_options[:class] += \" has-children\"\n\n li_options[:data] = li_options[:data] ||{}\n if has_split_toggles\n li_options[:data][:split_icon_parent] = \"\"\n end\n\n # Build subnavigation with accessible considerations\n # if accessible is enabled\n subnav_container_options = {}\n subnav_container_options[:class] = get_class(\"--nested\")\n subnav_container_options[:data] ||= {}\n subnav_container_options[:data][:navigation_nested] = \"\"\n subnav_container_options[:data] ||= {}\n\n if has_toggles\n subnav_container_options[:data][:toggle] = build_item_key(item)\n subnav_container_options[:data][:toggle_temporary] = \"\" if has_temporary_toggles\n subnav_container_options[:data][:toggle_default] = \"\" if has_toggle_default_open(item)\n end\n\n if !has_toggles\n li_content << render_sub_navigation_for(item)\n else\n li_content << content_tag(:div, render_sub_navigation_for(item), subnav_container_options)\n end\n \n end\n content_tag(:li, li_content, li_options)\n }.join\n end",
"def list_content(item_container)\n\n item_container.items.map { |item|\n li_options = item.html_options.except(:link)\n\n # ID namespace \n if options[:id_namespace] \n li_options[:id] = build_item_key(item)\n end\n\n # Adding the ARIA role tag to the list item to\n # supress the list semantics\n li_options[:role] = \"presentation\"\n\n # Build the tag for the link/button/span\n li_content = tag_for(item, item_container.level)\n if include_sub_navigation?(item)\n\n li_options[:class] = li_options[:class] || \"\"\n li_options[:class] += \" has-children\"\n\n # Build subnavigation with accessible considerations\n # if accessible is enabled\n subnav_container_options = {}\n subnav_container_options[:class] = \"simple-navigation--nested\"\n\n if accessible \n subnav_container_options[:data] = {}\n if has_toggles\n subnav_container_options[:data][:toggle] = build_item_key(item)\n subnav_container_options[:data][:toggle_temporary] = \"\"\n end\n end\n\n if is_basic\n li_content << render_sub_navigation_for(item)\n else\n li_content << content_tag(:div, render_sub_navigation_for(item), subnav_container_options)\n end\n \n end\n content_tag(:li, li_content, li_options)\n }.join\n end",
"def links\n\ttmp = []\n @doc.xpath('//field[@id=\"linkedWorkItems\"]/list/struct').each do |struct|\n\t linked_wid = struct.xpath('item[@id=\"workItem\"]').text\n\t role = struct.xpath('item[@id=\"role\"]').text\n\t tmp << \"#{role}:#{linked_wid}\"\n\tend\n\treturn tmp\n end",
"def page_elements\n []\n end",
"def list_children(taxons_collection)\n taxons_collection.sort_by {|p| p.hierarchy}\n html_var = \"\"\n taxons_collection.each do |t|\n if not t.children.empty?\n html_var << \"<li><i class='icon-plus'> </i>\" << link_to(t.name, t) << \"<ul>\" << list_children(t.children) << \"</ul>\"\n else\n html_var << \"<li><i class='icon-white' style='visibility: hidden;'> </i>\" << link_to(t.name, t)\n end\n html_var << \"</li>\\n\"\n end\n return html_var.html_safe\nend",
"def navigation\n [IndexHtmlUnit.new.link] + ModelHtmlUnitCollection.links_by_make(make)\n end",
"def links; end",
"def links; end",
"def display_page_list store, pages = store.cache[:pages], search = nil\n out = RDoc::Markup::Document.new\n\n title = if search then\n \"#{search} pages\"\n else\n 'Pages'\n end\n\n out << RDoc::Markup::Heading.new(1, \"#{title} in #{store.friendly_path}\")\n out << RDoc::Markup::BlankLine.new\n\n list = RDoc::Markup::List.new(:BULLET)\n\n pages.each do |page|\n list << RDoc::Markup::Paragraph.new(page)\n end\n\n out << list\n\n display out\n end",
"def child_index(path)\n resource = sitemap.find_resource_by_path(\"#{path}/index.html\")\n return \"\" if resource.children.size == 0\n resource.children.each { |e| \"<li>#{link_to e.data.id, e.url}</li>\" }\n index = resource.children.reduce(\"\") { |a, e| a + \"<li>#{link_to e.data.title, e.url}</li>\" }\n \"<ul>#{index}</ul>\"\n end",
"def job_links\n links = []\n loop do\n links << listing_page.links_with(class: 'ovalbuttondetails')\n break unless next_link\n @listing_page = next_link.click\n end\n links.flatten\n end",
"def gen_links (res, item, &block)\n\n if block # unique element\n\n [ link('via', res), link('self', res, block.call(item)) ]\n\n elsif item.respond_to?(:current_page) and item.total_pages > 1\n\n a = [\n link('via', ''),\n link('self', res, 'page' => item.current_page)\n ]\n a << link('prev', res, 'page' => item.current_page - 1) \\\n if item.current_page > 1\n a << link('next', res, 'page' => item.current_page + 1) \\\n if item.current_page < item.total_pages\n a\n\n else # collection\n\n [ link('via', ''), link('self', res) ]\n end\n end",
"def extract_pages_list\n if @page\n if @page.wikitopdf_toc_page && @page.wikitopdf_toc_page.istoc\n [ url_by_page(@page) ] + pages_from_toc(@page)\n else\n [ url_by_page(@page) ] + pdf_page_hierarchy(@page.id)\n end\n else\n pdf_page_hierarchy(nil)\n end\n end",
"def featured_content_list\n list = []\n self.div(:id=>\"featuredcontent_content_container\").links(:class=>/featuredcontent_content_title/).each do |link|\n list << link.text\n end\n return list\n end",
"def nestable_list_recursive(items, block)\n content_tag(:ol, class: 'dd-list') do\n tags = items.map do |item|\n content_tag(:li, class: 'dd-item', data: { id: item.to_param }) do\n content = capture_with_haml { block.call(item) }\n recurse = if item.children.empty?\n ''.html_safe\n else\n nestable_list_recursive(item.children, block)\n end\n\n content.html_safe + recurse\n end\n end\n\n tags.join.html_safe\n end\n end",
"def navigation(txt, path, attrs = {}, options = {}, &block)\n options.reverse_merge!(:container => :ol, :wrapper => :li) \n navigation_content = content_tag(options[:container], capture(&block))\n wrapper_attrs = attrs.delete(:wrapper)\n parent_link = nav_link_to(txt, path, attrs, false)\n content_tag(options[:wrapper], \"#{parent_link}\\n#{navigation_content}\".html_safe, (wrapper_attrs || {})) \n end",
"def render_children\n children = ''\n\n list_item.children.each do |child|\n children += self.class.render(child, opts)\n end\n\n children\n end",
"def list_items\r\n begin\r\n expand_combo\r\n get(:type => :list_item, :scope => :children, :how_many => :all)\r\n ensure\r\n collapse_combo\r\n end\r\n end",
"def parse_result_page(page)\n page.search(\"div.listing div.title a\").map do |result_row|\n result_row.attribute(\"href\").value\n end\nend",
"def parse_result_page(page)\n page.search(\"div.listing div.title a\").map do |result_row|\n result_row.attribute(\"href\").value\n end\nend",
"def outlet_settings_list\n=begin\n <li>List item 1 <a class=\"button-main\" href=\"/outlet1\">Button</a></li>\n=end\n html = ''\n @outlets.each do |outlet|\n html << '<li>'\n html << '<strong>' << outlet_name(outlet) << '</strong>'\n html << '<a class=\"button-main\" href=\"/outlet/' << outlet_number_human(outlet) << '\">Settings</a>'\n html << '</li>'\n end\n html\nend",
"def render_list( items, type: :ul, *args )\n non_empty_content_tag( type, *args ) { render_items( items }\n end",
"def link\n h.content_tag :li do\n h.link_to h.content_tag(:i, '' , class: object.icon ) , object.url , target: \"_blank\" , title: object.name\n end\n end",
"def navigation\n [IndexHtmlUnit.new.link, MakeHtmlUnitCollection.link_by_make(make)]\n end",
"def pages(treeish = nil)\n tree_list(treeish || @ref, true, false)\n end",
"def list_text\n prepend_list_tag + list + append_list_tag\n end",
"def render_entry_link(context, page, css, depth)\n selected = @page.fullpath =~ /^#{page.fullpath}(\\/.*)?$/ ? \" #{@options[:active_class]}\" : ''\n\n icon = @options[:icon] ? '<span></span>' : ''\n title = render_title(context, page)\n label = %{#{icon if @options[:icon] != 'after' }#{title}#{icon if @options[:icon] == 'after' }}\n\n link_options = caret = ''\n href = File.join('/', @site.localized_page_fullpath(page))\n\n if render_children_for_page?(page, depth) && bootstrap?\n css += ' dropdown'\n link_options = %{ class=\"dropdown-toggle\" data-toggle=\"dropdown\"}\n href = '#'\n caret = %{ <b class=\"caret\"></b>}\n end\n\n output = %{<li id=\"#{page.slug.to_s.dasherize}-link\" class=\"link#{selected} #{css}\">}\n output << %{<a href=\"#{href}\"#{link_options}>#{label}#{caret}</a>}\n output << render_entry_children(context, page, depth.succ) if (depth.succ <= @options[:depth].to_i)\n output << %{</li>}\n\n output.strip\n end",
"def links()\n return @links\n end",
"def current_list_page\n param_hash_to_link_hash params\n end",
"def extract_group_links\n # this one works to extract the group node container:\n #\n # group_list_node = mahara_dashboard_page.css('#groups').each do |node|\n # ...\n # end\n #\n # However, I decided to go the easy way here with some knowledge on how the url must look like\n\n return @mahara_dashboard_page.links_with(:href => /mahara\\/group\\/view/)\n end",
"def list_entry\n cursor(pos_list_entry).name(\"list\") do |c|\n Innodb::List.get_node(c)\n end\n end",
"def to_html\n \" <li>#{CGI.escapeHTML(self.to_s.strip.chomp)}</li>\\n\"\n end",
"def as_nestable_list(roots, &block)\n content_tag(:div, class: 'dd') do\n nestable_list_recursive(roots, block)\n end\n end",
"def url_for_list(type); end",
"def get_child_links(url)\n\n $log.info \"START #{__FILE__}.#{__method__}\"\n\t\n doc = Nokogiri::HTML(open(url))\n\t\n # append hostname to url\n if url == $url_root_shopping\n doc.xpath($deal_config[$site_name][\"child_links\"][\"a\"]).each do |link|\n $child_links << \"#{URI.parse(url).host}#{link['href']}\"\n #puts $child_links[-1]\n end\n\n else\n doc.xpath($deal_config[$site_name][\"child_links\"][\"b\"]).each do |link|\n $child_links << \"#{URI.parse(url).host}#{link['href']}\"\n #puts $child_links[-1]\n end\n end\n \n #puts doc.xpath($deal_config[$site_name][\"child_links\"][\"1\"])\n\t\n $log.info \"END #{__FILE__}.#{__method__}\"\n\t\n end",
"def guides_posts_list\n $tracer.trace(__method__)\n return ToolTag.new(div.id(\"/fragment-3805/\").ul.className(\"content-list\").li.className(\"/content-item/\"), __method__)\n end",
"def list_items_list(page_id = current_page_id, list_id = current_list_id)\n request \"page/#{page_id}/lists/#{list_id}/items/list\"\n end",
"def external_link_inventory # make this an object attribute for every page object, along with base url, and other helpful state info\n []\n end",
"def list(parent)\n list_in_path parent.model, parent.path\n end",
"def page_breadcrumbs(page)\n page.ancestors.reverse.map { |p| link_to(p.name, p.path) }\n end",
"def page_links(collection, padding = 3)\n current = collection.current_page\n pages = collection.pages\n \n tag(:div, :class => 'pageLinks') do\n html = ''\n if current == 1\n html << tag(:span, '«', :class => 'pageDisabled pagePrevious')\n else\n html << tag(:a, '«', :href => url_for_pagination(current - 1), :class => 'pagePrevious')\n end\n \n page_set(current, pages, padding).each do |page|\n case page\n when 0\n html << tag(:span, \"...\", :class => 'pageSpacer')\n when current\n html << tag(:span, page, :class => 'pageCurrent')\n else\n html << tag(:a, page, :href => url_for_pagination(page), :class => 'pageNumber')\n end\n end\n \n if current == pages\n html << tag(:span, '»', :class => 'pageDisabled pageNext')\n else\n html << tag(:a, '»', :href => url_for_pagination(current + 1), :class => 'pageNext')\n end\n html\n end\n end",
"def child_li(resource)\n title = discover_file_title(resource)\n\n render_partial(extensions[:navtree].options[:navigation_tree_item_child], {:url => resource.url, :resource_status => resource_status(resource), :title => title })\n end",
"def list_page_for model\n param_hash_to_link_hash( (session[:admin_list_params] || {})[model] || {} ).merge( :action => 'list', :model => model )\n end",
"def list_of(items=[], *args, &block)\n renderer = ListRenderer.new(items,self,*args,&block)\n unless block_given? \n renderer.to_html\n end\n end",
"def get_listing_data\n listing_data = []\n # get_pages.each do |page|\n local_pages.each do |page|\n listing_data << page.css('div[@class = \"item\"]')\n end\n listing_data\n end",
"def child\n return @links[:child]\n end",
"def links\n @links ||= []\n @links\n end",
"def children\n @pages = @page.children\n \n respond_to do |format|\n format.json { render :json => @pages }\n format.xml { render :xml => @pages }\n end\n end",
"def news_list_to_html(news)\n H.section(:id => \"newslist\") {\n aux = \"\"\n news.each{|n|\n aux << news_to_html(n)\n }\n aux\n }\nend",
"def list_pages(pages)\n pages.inject(''.html_safe) do |html, page|\n html << render(\n partial: page_partial(page),\n locals: {\n page: page,\n children: sitemap_children_for(page),\n }\n )\n end\n end",
"def js_listing(res)\n # One day I'll get to deprecate Ruby 2.2 and jump into the world of Hash#dig.\n return nil unless res[:json] && res[:json][:data] && res[:json][:data][:things]\n Models::Listing.new(@client, children: res[:json][:data][:things])\n end",
"def links\n return unless success? and body\n\n doc = Nokogiri::HTML(@body)\n \n links = []\n\n doc.css('div.list-lbc a').each do |a|\n link = {\n :url => a['href'],\n :title => a.css('div.title').first.content.strip\n }\n\n link[:ad_id] = link[:url][/^http:\\/\\/www.leboncoin.fr\\/locations\\/(\\d+).*/,1]\n links << link\n yield link if block_given?\n end\n\n links\n end",
"def split_button_list(name,link, options={})\n html_attributes_options(options)\n default_split_options = {'data-icon' => \"gear\"}\n split_options = {'data-rel' => \"dialog\", 'data-transition' => \"slideup\"}\n list = content_tag(\"li\", content_tag(:a, name, {:href => link}.merge(split_options)))\n #list = content_tag(\"li\", content_tag(:a, data, {:href => link}.merge(split_options)))\n content_tag(:ul, list, self.default_options.merge(default_split_options))\n end",
"def get_all_pages()\n a_links = self.xpath('//tr[1]/td/table/tr/td/a/@href')\n a_links.map {|a_link| a_link.value}\n end",
"def navlistbar_hubs_link\n $tracer.trace(__method__)\n return GINavbarHubsListLinks.new(li.className(\"magazine\").div.className(\"subnav\").a, __method__)\n end",
"def menu_list(*link_hashes)\n content_tag :ul do \n links = link_hashes.collect do |lh| \n menu_item_if_permitted(lh[:name], lh[:path], *lh[:sublist])\n end\n raw links.join\n end\n end",
"def internal_links\n respond_with @page.internal_links\n end",
"def internal_links\n respond_with @page.internal_links\n end",
"def user_blogs_list\n $tracer.trace(__method__)\n return ToolTag.new(ul.className(\"/content-list standard/\").li.className(\"/content-item/\"), __method__)\n end",
"def li_to(*args, &block)\n\t\tif block_given?\n\t\t\turl \t\t = args[0] || {}\n\t\t\thtml_options = args[1]\n\n\t\t\tli_to(capture(&block), url, html_options)\n\t\telse\n\t\t\tbody \t\t = args[0]\n\t\t\turl\t \t \t = args[1]\n\t\t\thtml_options = args[2] || {}\n\t\t\t\n\t\t\tcontent_tag(:li, class:cp(url)) do\n\t\t\t\tlink_to(body, url, html_options)\n\t\t\tend\n\t\tend\n\tend",
"def list\n @title = \"Content List\"\n # Get all content node types\n @list_options = ContentNodeType.all_type_names\n\n # Set currently viewing by key\n if params[:key] then\n @viewing_by = params[:key]\n elsif session[:last_content_list_view]\n @viewing_by = session[:last_content_list_view]\n else\n @viewing_by = @list_options[1]\n end\n\n # Find the id of the content node type we're viewing by\n type = ContentNodeType.find(:first, :conditions => [\"name = ?\", @viewing_by])\n\n # Paginate content\n @content_node_pages,\n @content_nodes = paginate :content_node,\n :per_page => 10,\n :conditions => [\"content_node_type_id = ?\", type.id],\n :order => \"display_on DESC, name ASC\"\n session[:last_content_list_view] = @viewing_by\n end",
"def list_of(things,opts={})\n raise ArgumentError, 'got nil list of things' if things.nil?\n if !opts.delete(:force_list) && things.empty?\n content_tag(:span,'none',opts)\n else\n kind = things.first.table_name rescue 'items'\n add_class_to_html_options(opts, kind)\n add_class_to_html_options(opts, 'records') if things.first.andand.is_a?(ActiveRecord::Base)\n add_class_to_html_options(opts, 'list')\n add_class_to_html_options(opts, 'empty') if things.blank?\n content_tag(\n :ul,\n things.andand.collect do |thing|\n list_item(thing, opts)\n end.andand.join(' '),\n opts\n )\n end\n end",
"def pagination_page_list(pager)\n links = []\n window = (pager.current_page - 2)..(pager.current_page + 2)\n\n window = Range.new(0, window.end - window.begin) if window.begin.negative?\n window = Range.new(window.begin, pager.pages - 1) if window.end >= pager.pages\n\n first_link = pagination_navigate_link(pager, 0, '«')\n previous_link = pagination_navigate_link(pager, pager.current_page - 1, '‹')\n last_link = pagination_navigate_link(pager, pager.pages - 1, '»')\n next_link = pagination_navigate_link(pager, pager.current_page + 1, '›')\n\n if pager.previous_page?(window.begin)\n links << pagination_non_link('…', 'disabled')\n end\n\n window.each do |number|\n links << pagination_page_link(number, pager)\n end\n\n if pager.next_page?(window.end)\n links << pagination_non_link('…', 'disabled')\n end\n\n links.unshift(first_link, previous_link)\n links << next_link\n links << last_link\n\n return content_tag(:div, links.reduce(&:+), class: 'btn-group')\n end",
"def printHTML(entriesList, out)\n id = 0\n entriesList.each { |heading,entries|\n out.puts \"<h3>#{heading}</h3>\" if heading\n out.puts \"<ul>\"\n entries.each { |entry|\n out.puts \"<li>\"+entry.toHTML(id)+\"</li>\"\n id += 1\n }\n out.puts \"</ul>\"\n }\nend",
"def list_html(medias)\n list = \"\"\n log \"list_html: #{medias.size}\"\n medias.each do |media|\n log \"media: #{media.title}\"\n list << \"<li><img src='\" << media.url << \"'><br>\" << media.title << \"</li>\"\n end\n \"<ul class='gallery_detail'>#{list}</ul>\"\n end",
"def _find_links_in_markdown_tree markdown_tree_node\n case markdown_tree_node.type\n when :a\n links = [markdown_tree_node.attr['href']]\n when :img\n links = [markdown_tree_node.attr['src']]\n else\n links = []\n end\n markdown_tree_node.children.each { |child| links.concat _find_links_in_markdown_tree child }\n return links\nend",
"def html_list_item(item)\n tag :li, yield, :id => \"nav_#{item.name}\",\n :title => item.title(@inject[item.name]),\n :class => @current == item ? 'active' : ''\n end",
"def render_list(&block)\n view.capture_haml do\n view.haml_tag :ul, class: \"breadcrumb\" do\n yield\n end\n end\n end",
"def get_all_items\n items = @value\n page = self\n while page.next_link != nil && !page.next_link.strip.empty? do\n page = page.get_next_page\n items.concat(page.value)\n end\n items\n end",
"def children_navigation(document)\n content_tag(\n :div,\n '',\n class: \"al-contents child-components children-count-#{document.number_of_children}\",\n data: {\n collapse: I18n.t('arclight.views.show.collapse'),\n expand: I18n.t('arclight.views.show.expand'),\n arclight: {\n level: document.component_level.to_i + 1,\n path: search_catalog_path(hierarchy_context: 'component'),\n name: document.collection_name,\n view: 'child_components',\n parent: document.reference,\n directparent: document.reference,\n childrencount: document.number_of_children,\n originalDocument: document.id,\n originalParents: [document.reference],\n eadid: normalize_id(document.eadid),\n per_page: '100'\n }\n }\n )\n end",
"def navigation_children\n sorted_children\n end",
"def get_items_with_all_category page\n category_links = page.search('li a')\n category_links.each{|item|\n link = item[:href]\n text = item.text\n p text\n\n category_page = @agent.get(link)\n get_items_with_each_category(category_page, text)\n }\nend",
"def get_items_with_all_category page\n category_links = page.search('li a')\n category_links.each{|item|\n link = item[:href]\n text = item.text\n p text\n\n category_page = @agent.get(link)\n get_items_with_each_category(category_page, text)\n }\nend",
"def get_items_with_all_category page\n category_links = page.search('li a')\n category_links.each{|item|\n link = item[:href]\n text = item.text\n p text\n\n category_page = @agent.get(link)\n get_items_with_each_category(category_page, text)\n }\nend",
"def get_items_with_all_category page\n category_links = page.search('li a')\n category_links.each{|item|\n link = item[:href]\n text = item.text\n p text\n\n category_page = @agent.get(link)\n get_items_with_each_category(category_page, text)\n }\nend",
"def index\n @pages = @parent_page.children\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end"
] | [
"0.6466164",
"0.64638126",
"0.64476544",
"0.6368072",
"0.6246507",
"0.6240587",
"0.6231831",
"0.6226405",
"0.62156194",
"0.6214931",
"0.6163092",
"0.615328",
"0.6146338",
"0.61224645",
"0.6063149",
"0.60366535",
"0.60360116",
"0.60340476",
"0.6026651",
"0.60243785",
"0.5991707",
"0.5991051",
"0.5987067",
"0.596769",
"0.59552336",
"0.59536624",
"0.59363467",
"0.5872667",
"0.58600456",
"0.5820016",
"0.5801903",
"0.5801903",
"0.57942146",
"0.57482016",
"0.5742778",
"0.57342964",
"0.5724511",
"0.5719676",
"0.5702444",
"0.569154",
"0.56878",
"0.5686813",
"0.56774825",
"0.56774825",
"0.5674821",
"0.56701505",
"0.5661083",
"0.56467795",
"0.5632748",
"0.562293",
"0.56189644",
"0.5612336",
"0.56056386",
"0.5604414",
"0.5604006",
"0.5586168",
"0.55856013",
"0.55805993",
"0.5575125",
"0.5572633",
"0.5570488",
"0.5566006",
"0.5541403",
"0.55359083",
"0.55348605",
"0.55332905",
"0.5530252",
"0.5524048",
"0.5522833",
"0.552166",
"0.5517507",
"0.5513692",
"0.55120087",
"0.5510281",
"0.5506002",
"0.55051583",
"0.55036384",
"0.55026895",
"0.5500627",
"0.54986095",
"0.5488517",
"0.5488517",
"0.5482234",
"0.54821396",
"0.54816127",
"0.5480578",
"0.5471968",
"0.5466533",
"0.546342",
"0.5456602",
"0.54531294",
"0.5452704",
"0.54511124",
"0.54440475",
"0.54438794",
"0.5442629",
"0.5442629",
"0.5442629",
"0.5442629",
"0.54276884"
] | 0.5733977 | 36 |
Recursively creates a nested unordered list for the depth specified | def render_entry_children(context, page, depth)
output = %{}
children = children(page).reject { |c| !include_page?(c) }
if children.present?
dropdown_class = @source == 'site' && page.depth == 1 ? @options[:dropdown_class] : ''
output = %{<ul id="#{@options[:id]}-#{page.slug.to_s.dasherize}" class="#{bootstrap? ? 'dropdown-menu' : dropdown_class}">}
children.each do |c, page|
css = []
css << 'first' if children.first == c
css << 'last' if children.last == c
output << render_entry_link(context, c, css.join(' '), depth)
end
output << %{</ul>}
end
output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_list_to_html(list, depth_to_traverse=1000, start_depth=0)\n depth = start_depth\n if list.is_a?(Array) && !list.empty?\n str =''\n str << '<ul>'\n depth += 1\n list.each do |value|\n unless depth > depth_to_traverse\n str << \"<li> #{value} </li> \"\n if value.is_a?(Array) \n str << from_hash_to_html(value, depth_to_traverse, depth)\n end\n end\n end\n str << '</ul> '\n return str\n end\n return ''\n end",
"def create_level_linked_list (root, lists, level)\n return if root == nil\n\n list = nil\n if lists.length == level\n list = LinkedList.new\n lists.add(list)\n else\n list = lists[level]\n end\n list.append(root)\n create_level_linked_list(root.left, lists, level + 1)\n create_level_linked_list(root.righ, lists, level + 1)\nend",
"def nestable_list_recursive(items, block)\n content_tag(:ol, class: 'dd-list') do\n tags = items.map do |item|\n content_tag(:li, class: 'dd-item', data: { id: item.to_param }) do\n content = capture_with_haml { block.call(item) }\n recurse = if item.children.empty?\n ''.html_safe\n else\n nestable_list_recursive(item.children, block)\n end\n\n content.html_safe + recurse\n end\n end\n\n tags.join.html_safe\n end\n end",
"def arranged_tree_as_list(hash, options = {}, depth = 0, ul_id = '', &block)\n output = ''\n options = set_options(options)\n\n # sort the hash key based on sort_by options array if :sort_by is given\n unless options[:sort_by].empty?\n hash = Hash[hash.sort_by { |k, _v| options[:sort_by].map { |sort| k.send(sort) } }]\n end\n\n output << create_li_entries(hash, options, depth, block)\n output = create_ul(output, options, depth, ul_id) unless output.blank?\n\n output.html_safe\n end",
"def make_tree(in_list, pid = self.pid)\n [].tap do |top_level|\n left_over = []\n # Categorize into top level, or not top level\n in_list.each do |node|\n if node['parent_page_id'].blank? || node['parent_page_id'] == pid\n top_level.unshift node\n else\n left_over.unshift node\n end\n end\n\n # For each of the top_level nodes make a subtree with the leftovers.\n top_level.each do |node|\n node['children'] = make_tree(left_over, node['id'])\n end\n end\n end",
"def as_nestable_list(roots, &block)\n content_tag(:div, class: 'dd') do\n nestable_list_recursive(roots, block)\n end\n end",
"def nested_list(hash, options={})\n ordered = options[:ordered] || false\n options.delete(:ordered)\n\n content_tag(ordered ? 'ol' : 'ul', options) do\n hash.map do |concept, rels|\n rels.empty? ? content_tag('li', concept) : content_tag('li') do\n h(concept) + nested_list(rels, ordered: ordered) # NB: recursive\n end\n end.join(\"\\n\").html_safe\n end\n end",
"def render_tree(elements, symbols, parents = [])\n i = 0\n x = elements.map do |li|\n last = elements.length == i+1\n\n current = indentation(parents, last, symbols) + li[:value]\n\n children = \"\"\n if li[:children].length > 0\n children = \"\\n\" + render_tree(li[:children], symbols, parents + [last])\n end\n\n i += 1\n current + children\n end\n\n x.join(\"\\n\")\n end",
"def nested_array_to_html(nodes)\n classes = \"depth-#{ nodes.first[:depth] }\"\n classes += \" folder-tree\" if nodes.first[:depth].zero?\n\n html = \"<ul class=\\\"#{ classes }\\\">\"\n nodes.each do |node|\n html += \"<li>\"\n\n if node[:children]\n html += '<i class=\"icon-folder-close\"></i>'\n else\n html += '<i class=\"icon-file-alt\"></i>'\n end\n\n html += \"<span class=\\\"name\\\">#{ node[:name].strip }</span>\"\n unless (node[:children].nil? || node[:children].empty?)\n html += nested_array_to_html(node[:children]) \n end\n html += '</li>'\n end\n\n html += '</ul>'\n\n html\n end",
"def nodes_by_level (depth, node = self.node)\n if depth == 0\n return [node]\n elsif !node.nodes.empty?\n nodes = []\n node.nodes.each {|n| nodes = nodes + nodes_by_level(depth-1, n)}\n return nodes\n else\n return []\n end\n end",
"def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend",
"def linked_list_per_depth\n list = Array.new(height)\n each_depth do |layer, depth|\n n = layer.size - 1\n list[depth] = (0..n).reduce(nil) do |acc, i|\n layer[n-i].nil? ? acc : LinkedList.new(layer[n-i].value, acc)\n end\n end\n list\n end",
"def generate_class_tree_level(parent='')\n $all.map { |klass|\n if parent == klass['parentname']\n [\n klass['name'],\n \"classes/#{klass['fullname']}.html\", # klass.path, \n '',\n generate_class_tree_level(klass['fullname'])\n ]\n else\n nil\n end\n }.compact\nend",
"def new_tree(group, options = {}, &block)\n options[:root_ol] = true if options[:root_ol].nil?\n options[:vehicles] = true if options[:vehicles].nil?\n options[:users] = false if options[:users].nil?\n options[:close_level] ||= 99\n options[:stop_level] ||= 99\n \n html = [[]]\n if options[:root_ol]\n pending = [:ol, :li, group, :nli, :nol]\n level = -1\n else\n pending = [:li, group, :nli]\n level = 0\n end\n \n while node = pending.shift\n case node\n when :ol\n html << []\n level += 1\n when :li\n html << []\n when :nli\n content = content_tag(:li, html.pop.join)\n html.last << content\n when :nol\n content = content_tag(:ol, html.pop.join)\n html.last << content\n level -= 1\n else\n html.last << capture(node, level, &block)\n end\n \n if !node.is_a?(Symbol) && !(node.is_a?(Device) || node.is_a?(User))\n if options[:vehicles]\n children = [:ol, (node.children + node.devices).map {|c| [:li, c, :nli]}, :nol]\n elsif options[:users]\n children = [:ol, (node.children + node.users).map {|c| [:li, c, :nli]}, :nol]\n else\n children = [:ol, node.children.map {|c| [:li, c, :nli]}, :nol]\n end\n \n pending.unshift *(children.flatten)\n end\n end\n \n concat(html.to_s)\n end",
"def ancestry_options(items, &block)\n return ancestry_options(items){ |i| \"#{'-' * i.depth} #{i.name}\" } unless block_given?\n\n result = []\n items.map do |item|\n result << {\"name\" => yield(item), \"id\" => item.id}\n end\n result\n end",
"def optimize_depth_array()\n\n @root = @all_depths[0].first[1]\n\n # for each depth in tree\n @all_depths[1..@all_depths.length-1].each do |depth|\n # for each item in depth (could be node or array of nodes)\n depth.each do |sec_id, item|\n if (item.class == Node)\n node = item\n parent = get_parent(node.path)\n parent.add_child(node)\n else # item is array of nodes\n item.each do |node|\n parent = get_parent(node.path)\n parent.add_child(node)\n end\n end\n end\n end\n\n end",
"def build_toc_list(entries, last_ul_used: false)\n i = 0\n toc_list = ''\n min_h_num = entries.map { |e| e[:h_num] }.min\n\n while i < entries.count\n entry = entries[i]\n if entry[:h_num] == min_h_num\n # If the current entry should not be indented in the list, add the entry to the list\n toc_list << %(<li class=\"toc-entry toc-#{entry[:node_name]}\"><a href=\"##{entry[:id]}#{entry[:uniq]}\">#{entry[:text]}</a>)\n # If the next entry should be indented in the list, generate a sublist\n if i + 1 < entries.count\n next_entry = entries[i + 1]\n if next_entry[:h_num] > min_h_num\n nest_entries = get_nest_entries(entries[i + 1, entries.count], min_h_num)\n toc_list << %(\\n<ul>\\n#{build_toc_list(nest_entries, last_ul_used: true)}</ul>\\n)\n i += nest_entries.count\n end\n end\n # Add the closing tag for the current entry in the list\n toc_list << %(</li>\\n)\n elsif entry[:h_num] > min_h_num\n # If the current entry should be indented in the list, generate a sublist\n nest_entries = get_nest_entries(entries[i, entries.count], min_h_num)\n if last_ul_used\n toc_list << build_toc_list(nest_entries, last_ul_used: true)\n else\n toc_list << %(<ul>\\n#{build_toc_list(nest_entries, last_ul_used: true)}</ul>\\n)\n end\n i += nest_entries.count - 1\n end\n i += 1\n end\n\n toc_list\n end",
"def print_recursive_menu(menu_entry)\n menu_children = MenuEntry.find_all_by_parent_id(menu_entry.id)\n current_entry = \"<li>\" + menu_link(menu_entry) + \"</li>\"\n return current_entry if menu_children.size == 0\n current_entry = \"<li>\" + menu_link(menu_entry) + \"<ul>\"\n for menu_child in menu_children do\n current_entry += print_recursive_menu(menu_child)\n end\n current_entry += \"</ul></li>\"\n return current_entry\n end",
"def look_deeper contexts, deep, max_item_depth = 9, max_aspect_depth = 9, item_depth = 0\n unless item_depth == 0\n deep = look_wider contexts, deep, max_aspect_depth, 0\n deep[:row] += 1\n end\n deep[:indents] ||= []\n # deep[:numberings] ||= []\n deep[:indents ][deep[:row]] = item_depth || 0\n # deep[:numberings][deep[:row]] = self.class.numbering_list || []\n self.class.numbering_push\n unless (item_depth += 1) >= max_item_depth\n items.each do |item|\n self.class.numbering_increment\n deep = (item.recursive_ref || item).look_deeper contexts, deep, max_item_depth, max_aspect_depth, item_depth\n end\n end\n self.class.numbering_pop\n item_depth -= 1\n deep\n end",
"def build_partial_navigation_tree(value, depth = Float::INFINITY, key = nil, level = 0)\n navigation_tree = \"\"\n\n if value.is_a?(String)\n\n # This is a file.\n # Get the Sitemap resource for this file.\n # note: sitemap.extensionless_path converts the path to its 'post-build' extension.\n this_resource = resource_from_value(value)\n\n return \"\" if this_resource.nil?\n\n unless extensions[:navtree].options[:directory_index] && this_resource.directory_index?\n navigation_tree << child_li(this_resource) if this_resource\n end\n else\n\n # This is the first level source directory. We treat it special because it has no key and needs no list item.\n if key.nil?\n value.each do |newkey, child|\n navigation_tree << build_partial_navigation_tree(child, depth, newkey, level + 1)\n end\n\n # Continue rendering deeper levels of the tree, unless restricted by depth.\n elsif depth >= (level + 1)\n\n # Loop through all the directory's contents.\n directory_content = \"\"\n value.each do |newkey, child|\n directory_content << build_partial_navigation_tree(child, depth, newkey, level + 1)\n end\n\n directory_content_html = render_partial(extensions[:navtree].options[:navigation_tree_items_container], { :directory_content => directory_content })\n\n # This is a directory.\n # The directory has a key and should be listed in the page hieararcy with HTML.\n navigation_tree << parent_li(key, value, directory_content_html)\n end\n end\n\n return navigation_tree\n end",
"def produce_tree(ary); end",
"def link_tree\n ''.html_safe.tap do |content|\n content << toggle_link\n\n unless leaf?\n content << h.content_tag(:ul) do\n h.content_tag_for(:li, children) do |c|\n c.decorate.link_tree\n end\n end\n end\n end\n end",
"def build_tree(unit, node, level = 0)\r\n return nil if level > @max_depth\r\n \t\r\n unit.next_move(node.current_case).each do |next_case|\r\n next if next_case[0] < 0 || next_case[0] > 7 ||\r\n next_case[1] < 0 || next_case[1] > 7 \r\n \r\n next_node = Node.new(next_case, node)\r\n node.children << next_node\r\n\r\n build_tree(unit, next_node, level + 1)\r\n end \r\n end",
"def make_list_from_nested(list, flatten = false)\n all = []\n list.each do |item|\n all.concat(make_list_from_item(item, flatten))\n end\n return all\n end",
"def top_level_li\n lambda do |env|\n name, node = env[:node_name], env[:node]\n if name == LIST_ITEM && !node.ancestors.any? { |n| LISTS.include?(n.name) }\n node.replace(node.children)\n end\n end\n end",
"def navtree_build(ret, item, el, el_type = \"\")\n module_name = item[:classnames][2] ? item[:classnames][2] : item[:classnames][1];\n page_name = item[:crumb]\n\n if !ret[module_name]\n ret[module_name] = {:id => module_name, :children => Hash.new}\n #if item[:deprecated] ret[module_name][:deprecated] = true\n end\n\n if !ret[module_name][:children][page_name]\n ret[module_name][:children][page_name] = {\n :id => page_name,\n :path => item.identifier,\n :children => Hash.new\n }\n #if item[:deprecated] ret[module_name][:deprecated] = true\n end\n\n el_name = el.respond_to?(:name) ? el.name : el\n ret[module_name][:children][page_name][:children][el_name] = {\n :signature => el.respond_to?(:sass_signature) ? el.sass_signature(:none) : el,\n :el_type => el_type\n }\n\n ret\nend",
"def recursive => nil",
"def build_items(item, limit, index, hierarchical = false, root_path = \"\")\n return \"\" if index > limit || !item.children.present?\n\n html = \"<ul class='#{index == 1 ? \"menu\" : \"sub-menu\"}'>\"\n item.children.order_default.each do |i|\n if i.visible && i.active\n html << \"<li class='#{\"menu-item-has-children\" if i.children.present?} #{\"active\" if i.slug == params[:menu_id] || i.slug == request.original_fullpath.match(/(\\D+\\/{1}|\\D+)/)[0].gsub('/', '')}'>\"\n\n if i.external_link.blank?\n if hierarchical\n html << \"<a href='#{root_path}/#{i.slug}'>#{i.name}</a>\"\n else\n html << \"<a href='/#{i.slug}'>#{i.name}</a>\"\n end\n else\n html << \"<a href='#{i.external_link}' rel='#{(i.follow || i.follow.nil?) ? \"follow\" : \"nofollow\"}' target='#{i.target.blank? ? '_self' : i.target}'>#{i.name}</a>\"\n end\n\n html << build_items(i, limit, index + 1, hierarchical, root_path + \"/#{i.slug}\")\n html << \"</li>\"\n end\n end\n html << \"</ul>\"\n html.html_safe\n end",
"def nested_array\n curr = @nested\n @list.each do |num|\n r = rand(3)\n if r == 1\n curr << num\n elsif r == 2\n curr << []\n curr = curr[curr.length - 1]\n curr << num\n else\n curr = @nested\n curr << num\n end\n end\n @nested\n end",
"def elegant_tree_by_levels(node)\n stack=[]\n stack.push node if node\n stack.each do |n|\n stack.push n.left if n.left\n stack.push n.right if n.right\n end\n stack.map! &:value\nend",
"def nest(h)\n nesting.pop until nesting.empty? or h.level > nesting.last.level\n nesting << h\n end",
"def node_tree(nodes, &block)\n \n nodes = nodes.dup\n printed_nodes = []\n \n result = \"<ul>\"\n \n # top level nodes first, then others\n for node in nodes\n next if node.instance_of?(Center) || node.instance_of?(Team)\n next unless node.parent == nil\n printed_nodes << node\n result += \"<li>\"\n\n if block_given?\n result += yield node\n else\n result += node.title\n end\n\n children = node.children.dup\n children.delete_if { |r| not nodes.include?(r) }\n if not children.empty?\n result += node_tree_help(children, nodes, printed_nodes, &block)\n end\n \n result += \"</li>\"\n end\n \n # TODO: Add depth counting here to get a minimum of trees\n for node in nodes\n next if printed_nodes.include? node\n printed_nodes << node\n \n result += \"<li>\"\n\n if block_given?\n result += yield node\n else\n result += node.title\n end\n\n children = node.children #.dup\n children.delete_if { |r| not nodes.include?(r) }\n\n if not children.empty?\n result += node_tree_help(children, nodes, printed_nodes, &block)\n end\n \n result += \"</li>\"\n end\n\n result += '</ul>'\n\n return result\n end",
"def build_tree( n , d )\n \n if d.key?('v')\n n < d['v'] ? build_tree(n , d['l']) : build_tree(n, d['r'])\n else\n d['l'] = {}\n d['v'] = n\n d['r'] = {}\n end\n \nend",
"def recursive_each_with_level element, depth, block\n block.call element, depth\n element.children.each do |x|\n recursive_each_with_level x, depth + 1, block\n end\n end",
"def test_nested_list\n items = [\n 'Item 1',\n 'Item 1a',\n 'Item 1a1',\n 'Item 1a1a',\n 'Item 1a1a1',\n 'Item 1a1a1a',\n 'Item 1a1a1a1',\n 'Item 1a1a1a1a',\n 'Item 1a1a1a1a1',\n 'Item 1a1a1a1a1a'\n ]\n\n pre = -3\n markdown = items.inject('') do |md, item|\n pre += 3\n md.concat(' '*pre + '+ ' + item + \"\\n\")\n end\n\n html = GitHub::Markdown.render(markdown)\n parsed = Nokogiri::HTML::DocumentFragment.parse(html)\n\n items.inject(parsed) do |node, expected_item|\n child = node.xpath('.//ul/li')\n child_item = child.children.detect{|e| e.text?}.text.strip\n assert_equal expected_item, child_item\n node = child\n end\n end",
"def to_nested_a(flat = false, mover = nil, descendants = nil, level = self.level, &block)\n descendants ||= self.descendants.all\n array = [ block_given? ? yield(self, level) : self ]\n\n while not descendants.empty?\n break unless descendants.first.parent_id == self.id\n item = descendants.shift\n items = item.to_nested_a(flat, mover, descendants, level + 1, &block)\n array.send flat ? 'concat' : '<<', items if mover.nil? or mover.new? or mover.move_possible?(item)\n end\n\n return array\n end",
"def build_tree(list)\n root = Node.new(list[0], nil)\n list[1...list.length].each do |item|\n current_node = root\n while !item.nil?\n if item > current_node.value\n if current_node.right_child.nil?\n current_node.right_child = Node.new(item, current_node)\n item = nil\n else\n current_node = current_node.right_child\n end\n elsif item < current_node.value\n if current_node.left_child.nil?\n current_node.left_child = Node.new(item, current_node)\n item = nil\n else\n current_node = current_node.left_child\n end\n else\n item = nil\n end\n end\n end\n root\nend",
"def create_tree(node, elem, level, parent)\n node.level = level\n elemtype = check_type(elem[1])\n case elemtype\n when \"array\"\n node.kind = \"array\"\n node.arrsize = elem[1][\".array_size\"].to_i\n if elem[1].has_key?(\".subtype\") && elem[1][\".subtype\"].has_key?(\".members\")\n elem[1][\".subtype\"][\".members\"].each do |m|\n x = Tree.new(m[0], item_type(elem[1]), node)\n node.create_child(x)\n create_tree(x, m, level+1, node)\n end\n if elem[1][\".subtype\"].has_key?(\".type_or_id_name\")\n elem[1][\".subtype\"][\".type_or_id_name\"] =~ /\\((.+)\\): (\\w+)/\n node.s_u_name = $2.clone\n else\n node.s_u_name = \"__ANON__\"\n end\n node.basetype = node.data = elem[1][\".subtype\"][\".type\"].clone\n else\n subkind = check_type(elem[1][\".subtype\"])\n case subkind\n when \"enum\"\n node.basetype = \"enum\"\n node.data = {\".type\" => elem[1][\".subtype\"][\".type\"]}\n node.data[\".type_or_id_name\"] = elem[1][\".subtype\"][\".type_or_id_name\"]\n arr = []\n elem[1][\".subtype\"][\".values\"].each { |k,v| arr << [k,v] }\n node.data[\".values\"] = arr.clone\n node.data[\".values\"].sort! { |a,b| a[1] <=> b[1] }\n when \"numeric_ose\", \"boolean\"\n elem[1][\".subtype\"][\".type_or_id_name\"] =~ /\\((.+)\\): (\\w+)/\n node.basetype = $2.clone\n when \"native\", \"numeric_other\"\n node.basetype = \"OTHER\"\n node.data = {\".type\" => elem[1][\".subtype\"][\".type\"]}\n if elem[1][\".subtype\"].has_key?(\".signed\")\n node.data[\".signed\"] = elem[1][\".subtype\"][\".signed\"] \n end\n if elem[1][\".subtype\"].has_key?(\".type_or_id_name\")\n node.data[\".type_or_id_name\"] = elem[1][\".subtype\"][\".type_or_id_name\"]\n end\n end\n node.leaf = true\n end\n when \"struct\", \"union\"\n node.kind = elemtype\n if is_anon?(elem[1])\n node.s_u_name = \"__ANON__\"\n else\n node.s_u_name = item_name(elem[1])\n end\n elem[1][\".members\"].each do |m|\n x = Tree.new(m[0], item_type(elem[1]), node)\n node.create_child(x)\n create_tree(x, m, level+1, node)\n end\n when \"enum\"\n node.kind = \"enum\"\n node.basetype = \"enum\"\n node.s_u_name = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n arr = []\n elem[1][\".values\"].each { |k,v| arr << [k,v] }\n node.data = arr.clone\n node.data.sort! { |a,b| a[1] <=> b[1] }\n when \"numeric_ose\"\n node.kind = \"numeric\"\n node.basetype = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n when \"boolean\"\n node.kind = \"boolean\"\n node.basetype = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n when \"native\", \"numeric_other\"\n node.kind = \"numeric\"\n node.basetype = \"OTHER\"\n node.data = {'.type' => elem[1][\".type\"]}\n node.data[\".signed\"] = elem[1][\".signed\"] if elem[1].has_key?(\".signed\")\n if elem[1].has_key?(\".type_or_id_name\")\n node.data[\".type_or_id_name\"] = elem[1][\".type_or_id_name\"]\n end\n node.parent = parent\n node.leaf = true\n else\n raise \"Node #{node.name} contains erroneous data\" \n end\n end",
"def tree_for(stack, level, tree)\n stack.each do |debug_item|\n task = debug_item[0][0]\n\n if debug_item.size == 2 # flat\n introspect = debug_item[0].last\n\n name = (node = introspect[task]) ? node[:id] : task\n\n tree << [ level, name ]\n else # nesting\n tree << [ level, task ]\n\n tree_for(debug_item[1..-2], level + 1, tree)\n\n tree << [ level+1, debug_item[-1][0] ]\n end\n\n tree\n end\n end",
"def build_up_to_nth_order(depth)\n (2..depth).each do |order|\n build_nth_order(order)\n end\n end",
"def depth_helper(node, arr, depth)\n if node.left.nil? && node.right.nil? \n arr << depth\n return\n else \n depth += 1 \n if node.left\n depth_helper(node.left, arr, depth) \n end \n if node.right\n depth_helper(node.right, arr, depth)\n end \n end \n end",
"def list_depth(list, depth = 0)\n return depth if !list.is_a?(Array)\n list.empty? ? depth + 1 : list.map { |l| list_depth(l, depth + 1) }.max\n end",
"def toc\n ary = []\n\n lopen = \"<#@toc_style>\"\n lclose = \"</#@toc_style>\"\n prev_depth = open = 0\n\n @toc.each do |a|\n cur = a.first\n\n # close out the previous list item if we're at the same level\n if cur == prev_depth\n ary << \"</li>\"\n\n # if we are increasing the level, then start a new list\n elsif cur > prev_depth\n ary << if ary.empty? then @list_opening else lopen end\n open += 1\n\n # we are decreasing the level; close out tags but ensure we don't\n # close out all the tags (leave one open)\n else\n (prev_depth - cur).times {\n ary << \"</li>\" << lclose\n open -= 1\n break if open <= 0\n }\n if open > 0\n ary << \"</li>\"\n else\n ary << lopen\n open += 1\n end\n end\n\n # add the current element\n ary << \"<li>\" << a.last\n prev_depth = cur\n end\n\n # close out the remaingling tags\n ary << \"</li>\" << lclose\n ary.join(\"\\n\")\n end",
"def group_tree(group, options = {}, level = 0, &block)\n options[:close_level] ||= 99\n options[:include_parent] ||= true\n \n if !group\n group = Struct.new(:id, :name, :children).new('', 'Root', current_account.device_groups.roots)\n end\n \n #if level == 0 && !options[:include_parent]\n # concat(content_tag(:ol,\n # group.children.map {|g| group_tree(g, options, level + 1, &block)}.join,\n # level > options[:close_level] ? {:style => 'display:none'} : {}\n # ))\n # \n # return\n #end\n li_options = level == 0 ? {:class => \"root\"} : {}\n \n html = content_tag(:li, [\n capture(group, level, &block),\n group.children.any? ? content_tag(:ol,\n group.children.map {|g| group_tree(g, options, level + 1, &block)}.join,\n level > options[:close_level] ? {:style => 'display:none'} : {}\n ) : nil\n ].join, li_options\n )\n \n level > 0 ? html : concat(content_tag(:ol, html))\n end",
"def bfs_helper(node, list, level)\n return list if node.nil?\n \n # creating array of arrays for each level in tree\n list[level] = [] if list[level].nil?\n list[level] << {key: node.key, value: node.value}\n\n bfs_helper(node.left, list, level + 1)\n bfs_helper(node.right, list, level + 1)\n end",
"def flatten(data, level = 0)\n return [data] unless data.is_a?(Array) \n flat = []\n data.each do |ele|\n if ele.is_a?(Array)\n flat += flatten(ele, level + 1)\n else\n flat << ele\n end\n end\n flat\nend",
"def render_facet_hierarchy_item(field_name, data, key)\n item = data[:_]\n subset = data.reject { |k,v| ! k.is_a?(String) }\n \n li_class = subset.empty? ? 'h-leaf' : 'h-node'\n li = ul = ''\n \n if item.nil?\n li = key\n elsif facet_in_params?(field_name, item.qvalue)\n li = render_selected_qfacet_value(field_name, item)\n else\n li = render_qfacet_value(field_name, item)\n end\n \n unless subset.empty?\n subul = subset.keys.sort.collect do |subkey| \n render_facet_hierarchy_item(field_name, subset[subkey], subkey) \n end.join('')\n ul = \"<ul>#{subul}</ul>\".html_safe\n end\n \n %{<li class=\"#{li_class}\">#{li.html_safe}#{ul.html_safe}</li>}.html_safe\nend",
"def build_tree_unsorted(arr)\n root = nil\n arr.each do |item|\n root = insert_tree(item, root)\n end\n\n root\nend",
"def to_html_ul(&block)\n ctag = 'div' # HTML tag for content\n btag = 'div' # HTML tag for bullets\n\n o = content ? content.clone : nil\n if block.respond_to? :call\n block.call(self, o)\n end\n\n s = \"\"\n\n hmenu_content_class = \"hmenu-content\"\n\n hmenu_content_class << \" hmenu-root\" if is_root?\n\n # TODO: use displayed_name\n if o\n hmenu_content_class << ' ' << o[:extra_class] if o[:extra_class]\n s << \"<#{ctag} class=\\\"#{hmenu_content_class}\\\" title=\\\"#{(o[:desc] || '')}\\\">\"\n if o[:href]\n s <<\n \"<a href=\\\"#{o[:href]}\\\">#{o[:name]}</a>\" \n elsif o[:name]\n s << (o[:name] || '') \n end\n s << \"</#{ctag}>\"\n else\n s << \"<#{ctag} class=\\\"#{hmenu_content_class}\\\">\" << name.capitalize << \"</#{ctag}>\"\n end\n\n if has_children?\n\n if is_root? \n s += '<ul class=\"hmenu\">'\n else\n s += \"<ul>\"\n end\n\n children.sort.each do |child|\n\n o = child.content ? child.content.clone : nil\n if block.respond_to? :call\n block.call(child, o)\n end\n\n css_li_class = \n child.has_children? ? \n 'hmenu-submenu' : \n 'hmenu-item'\n css_li_class << ' ' << o[:extra_class] if o and o[:extra_class]\n css_bullet_class = \n child.has_children? ? \n 'hmenu-bullet' : \n 'hmenu-bullet-nochildren'\n\n s += \"<li class=\\\"#{css_li_class}\\\">\" << \"<#{btag} class=\\\"#{css_bullet_class}\\\" onclick=\\\"toggle_submenu(this);\\\"></#{btag}>\" << child.to_html_ul(&block) << \"</li>\"\n\n end\n\n s += \"</ul>\"\n\n end\n\n return s\n end",
"def setBredthLevels\n stack = []\n queue = []\n level = 0\n\n queue.push(@root)\n\n while(queue.size != 0)\n node = queue.shift\n\n stack.append([node.name, node.level])\n\n node.children.each_with_index do |child, i|\n level += 1 if i == 0\n child.level = level\n queue.push(child)\n end\n end\n\n return stack\n end",
"def flatten_to_lvl(high_idx, low_idx = 0)\n lvl = high_idx + 1 \n lvl_up = nil\n \n @lvls[low_idx..high_idx].reverse_each do |lvl_children|\n lvl -= 1\n next if lvl_children.count() == 0 || !lvl_up && (lvl_up = lvl)\n \n flatten_lvl(lvl_up,lvl) \n lvl_up = lvl \n end\n \n # Level 0 flattens all levels, and returns an XML node containing the TOC data\n flatten_lvl(lvl_up, 0).first[NODE_CONTENT] if lvl == 0 && lvl_up\n end",
"def get_level_children(dirname,level) #:nodoc:\n dir_children = full_entries(dirname)\n @level_children += dir_children\n if level < @max_level\n dir_children.each {|e|\n if File.directory?(e)\n get_level_children(e,level + 1)\n end\n }\n end\n end",
"def walk(elements, max_depth, *args)\n output = ''\n\n # invalid parameter or nothing to walk\n return output if max_depth < -1 || elements.blank?\n\n parent_field = @db_fields[:parent]\n\n # flat display\n if -1 == max_depth\n empty_array = {}\n elements.each do |e|\n display_element(e, empty_array, 1, 0, args, output)\n end\n return output\n end\n\n # Need to display in hierarchical order.\n # Separate elements into two buckets: top level and children elements.\n # Children_elements is two dimensional array, eg.\n # Children_elements[10][] contains all sub-elements whose parent is 10.\n top_level_elements = []\n children_elements = {}\n elements.each do |e|\n if e.send(parent_field).blank? || e.send(parent_field) == 0\n top_level_elements << e\n else\n children_elements[e.send(parent_field)] ||= []\n children_elements[e.send(parent_field)] << e\n end\n end\n\n # When none of the elements is top level.\n # Assume the first one must be root of the sub elements.\n if top_level_elements.blank?\n root = elements.first\n\n top_level_elements = []\n children_elements = {}\n elements.each do |e|\n if root.send(parent_field) == e.send(parent_field)\n top_level_elements << e\n else\n children_elements[e.send(parent_field).to_i] ||= []\n children_elements[e.send(parent_field).to_i] << e\n end\n end\n end\n\n top_level_elements.each do |e|\n display_element(e, children_elements, max_depth, 0, args, output)\n end\n\n # If we are displaying all levels, and remaining children_elements is not empty,\n # then we got orphans, which should be displayed regardless.\n if max_depth == 0 && !children_elements.empty?\n empty_array = {}\n children_elements.values.each do |orphans|\n orphans.each do |op|\n display_element(op, empty_array, 1, 0, args, output)\n end\n end\n end\n output\n end",
"def indented_child_options type, parent, depth=0, selected_id\n\n result = []\n unless parent.children.empty?\n parent.children.sort { |a, b| a.title.downcase <=> b.title.downcase }.each do |child|\n child_path = send(\"#{type.model_name.underscore}s_path\", :uri=>child.term_uri, :label=> child.title)\n assay_stat = child.assays.size == 0 ? \"\" : \"<span style='color: #666666;'>(#{child.assays.count} assays)</span>\".html_safe\n ontology_term_li = link_to(child.title, child_path).html_safe\n user_defined_term_li = link_to(child.title, child_path, {:style => \"color:green;font-style:italic\"}) + \"*\" + \" \" +\n (child.can_edit? ? link_to(image(\"edit\"), edit_polymorphic_path(child), {:style => \"vertical-align:middle\"}) : \"\") + \" \" +\n (child.can_destroy? ? (child.assays.count == 0 && child.children.empty? ? link_to(image(\"destroy\"), child, :confirm =>\n \"Are you sure you want to remove this #{child.class.name}? This cannot be undone.\",\n :method => :delete, :style => \"vertical-align:middle\") : \"\") : \"\").html_safe\n child_link = (child.respond_to?(:is_user_defined) && child.is_user_defined) ? user_defined_term_li : ontology_term_li\n\n result << (\"<li style=\\\"margin-left:#{12*depth}px;#{child.id == selected_id ? \"background-color: lightblue;\" : \"\"}\\\">\"+ (depth>0 ? \"└ \" : \" \") + child_link + assay_stat +\n \"</li>\")\n result = result + indented_child_options(type, child, depth+1,selected_id) if child.has_children?\n end\n end\n return result\n end",
"def collect_tree_up_from (foliage,\n parents,\n except_homepage,\n except_page,\n except_with_children)\n ancestry_string = parents.collect {|x| x.id.to_s }.join(\"/\")\n name_prefix = parents.collect {|x| x.title }.join(\" / \")\n name_prefix += \" / \" if name_prefix.present?\n\n our_mans_indexes = []\n foliage.each_index do |indx|\n if foliage[indx].ancestry.to_s == ancestry_string\n our_mans_indexes << indx\n end\n end\n\n leaves = []\n\n our_mans_indexes.reverse!\n our_mans_indexes.each do |indx|\n leaves << foliage.delete_at(indx)\n end\n\n leaves.sort! {|a,b| (a.prior == b.prior) ? a.id <=> b.id : a.prior <=> b.prior }\n result = []\n\n leaves.each do |leaf|\n do_writing = true\n if (except_page && leaf == except_page) || (except_homepage && leaf.home?)\n do_writing = false\n end\n result << [ name_prefix + leaf.title, leaf.id ] if do_writing\n unless do_writing == false && except_with_children\n result += collect_tree_up_from foliage,\n (parents + [ leaf ]),\n except_homepage,\n except_page,\n except_with_children\n end\n end\n\n result\n end",
"def set_level current_depth, current_element,next_element\n if next_element.level > current_element.level\n current_depth.push current_element \n elsif next_element.level < current_element.level\n current_depth.pop \n end\n #if depths are equal, or next item doesn't exist, return same level\n current_depth\n end",
"def compose_tree(elements)\n tree = []\n leaf = []\n\n elements.each do |element|\n case element.type\n when :day\n tree << leaf unless leaf.empty?\n leaf = [element]\n\n when :hour\n # leaf << [:date, 'today'] if leaf.empty?\n leaf << element\n\n else\n raise \"Unexpected element #{element}\"\n end\n end\n\n tree << leaf unless leaf.empty?\n tree\n end",
"def with_depth(name = 'depth', start: 0, as: nil)\n @depth = [name.to_s, start, as&.to_s] if recursive?\n end",
"def tree_by_levels(node)\n return [] if node.nil?\n queue = [node]\n visited = []\n while !queue.empty?\n node = queue.shift\n visited << node.value\n [node.left, node.right].each do |child|\n queue << child if child\n end\n end\n visited\nend",
"def construct_html(menu, nested = false)\n return if menu.blank?\n \n links = menu.inject([]) do |items, (item, opts)|\n next(items) unless execute_proc(opts[:if])\n \n text, path, attrs = self.disect(item, opts)\n subnav = construct_html(menu[item][SUBMENU], true).to_s\n attrs.merge!(:class => [attrs[:class], self.current_css(item, nested)].compact.join(' '))\n items << self.view.content_tag(:li, self.view.link_to(text, path) + subnav, attrs)\n end\n \n nested ? self.view.content_tag(:ul, links, :class => 'sub-navigation') : links\n end",
"def build_tree(arr)\n\tend",
"def my_controlled_flatten(level = nil)\n flattened = []\n\n self.each do |ele|\n if ele.is_a?(Array) && level != 0\n flattened += (level.nil? ? ele.my_controlled_flatten : ele.my_controlled_flatten(level - 1))\n else\n flattened << ele\n end\n end\n\n flattened\n end",
"def depthTraversal2(path, parent = nil)\n\tif File.directory?(path)\n\t\tdir = handler.addDirectory(parent, path)\n\n\t\tDir.foreach(path) { |item|\n\t\t\tchild = path +\"/\"+ item\n\t\t\tif File.directory?(child)\n\t\t\t\tif item != '.' && item != '..'\n\t\t\t\t\tdepthTraversal(child, dir)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\thandler.addFile(dir, item)\n\t\t\tend\n\t\t}\n\tend\nend",
"def my_controlled_flatten(level = nil)\n flattened = []\n\n self.each do |ele|\n if ele.is_a?(Array) && level != 0\n flattened += (level.nil? ? ele.my_controlled_flatten : ele.my_controlled_flatten(level - 1))\n else\n flattened << ele\n end\n end\n\n flattened\n end",
"def flat_page_tree\n @flat_tree ||= ([{\n :key => \"page_#{self.root_page.id}\".to_sym,\n :name => self.root_page.menu_name,\n :url => self.root_page.url,\n :options => {:class => \"#{self.root_page.page_type} #{self.root_page.displayed ? '' : 'not-displayed'}\"},\n :items => []\n }] + self.root_page.children.collect {|page| page.tree_hash_value } )\n @flat_tree\n end",
"def print_depth(item)\n return if item.hidden?\n print_item item, 0\n list_recur_print item, 2\n end",
"def show_tree\n htmltree = \"\"\n self.each { |node| \n htmltree += \"<li><a href='#{normalize(node.name)}'>\"\n htmltree += ' ' * node.node_depth * 3\n htmltree += \"#{node.name}</a></li>\\n\"\n }\n htmltree\n end",
"def expand_nested_pairs(pair, recursive=false)\n lst = []\n while pair.instance_of?(Pair)\n head = pair.first\n if recursive and head.instance_of?(Pair)\n lst << expand_nested_pairs(head)\n else\n lst << head\n end\n pair = pair.second\n end\n lst\n end",
"def generate_hierarchy(node, id = nil)\n loc = {}\n $navigation_html += '<ul><li>'\n node.each_element do |element|\n if element.name == 'node_name' && !id.nil?\n loc[:id] = id\n loc[:location] = element.text\n loc[:sub_loc] = []\n $navigation_html += \"<a href='#{loc[:location]}.html'>#{loc[:location]}</a>\"\n else\n loc[:sub_loc] << generate_hierarchy(element, element.attributes['atlas_node_id'])\n end\n end\n $navigation_html += '</li></ul>'\n return loc\nend",
"def hierarchy\n p = self\n h = []\n while(p.parent != nil)\n h = [p] + h\n p = p.parent\n end\n h = [p] + h\n \n h\n end",
"def dump_children(parent,depth=nil)\n list = []\n depth = 0 if (!depth)\n\n parent.children.each do |entry|\n list.push({:NetStruct => entry, :Depth => depth})\n\n if (entry.children.length > 0)\n list.concat( dump_children(entry, (depth+1) ) )\n end\n end\n\n return(list)\n end",
"def list_children(taxons_collection)\n taxons_collection.sort_by {|p| p.hierarchy}\n html_var = \"\"\n taxons_collection.each do |t|\n if not t.children.empty?\n html_var << \"<li><i class='icon-plus'> </i>\" << link_to(t.name, t) << \"<ul>\" << list_children(t.children) << \"</ul>\"\n else\n html_var << \"<li><i class='icon-white' style='visibility: hidden;'> </i>\" << link_to(t.name, t)\n end\n html_var << \"</li>\\n\"\n end\n return html_var.html_safe\nend",
"def create_subitem(item, levels)\n @current_level ||= 0\n\n subitems = item.node.children.accessible.public.shown_in_menu.include_content.order(:position).all.map { |n| n.content }\n\n if item.node.leaf? || subitems.empty? || @current_level == levels\n @current_level = 0 if @current_level == levels\n content = link_to(h(item.content_title), content_node_path(item.node), :title => h(item.content_title))\n content_tag(:li, content, :class => 'link')\n else\n @current_level += 1\n ul = content_tag(:ul, subitems.map { |subitem| create_subitem(subitem, levels) }.join(\"\\n\").html_safe)\n content = link_to(h(item.content_title), content_node_path(item.node), :title => h(item.content_title))\n content_tag(:li, content + ul, :class => 'subitem')\n end\n end",
"def max_nesting=(depth)\n #This is a stub, used for indexing\n end",
"def dfs_levels(node, result, depth = 0)\n return if node.nil?\n\n result[depth] ||= [node.val.to_i, 1]\n\n result[depth] = [(result[depth].first + node.val.to_i), result[depth].last + 1]\n\n dfs_levels(node.left, result, depth + 1)\n dfs_levels(node.right, result, depth + 1)\nend",
"def block_textile_lists( text ) \n text.gsub!( LISTS_RE ) do |match|\n lines = match.split( /\\n/ )\n last_line = -1\n depth = []\n lines.each_with_index do |line, line_id|\n if line =~ LISTS_CONTENT_RE \n tl,atts,content = $~[1..3]\n if depth.last\n if depth.last.length > tl.length\n (depth.length - 1).downto(0) do |i|\n break if depth[i].length == tl.length\n lines[line_id - 1] << \"</li>\\n\\t</#{ lT( depth[i] ) }l>\\n\\t\"\n depth.pop\n end\n end\n if depth.last and depth.last.length == tl.length\n lines[line_id - 1] << '</li>'\n end\n end\n unless depth.last == tl\n depth << tl\n atts = pba( atts )\n atts = shelve( atts ) if atts\n lines[line_id] = \"\\t<#{ lT(tl) }l#{ atts }>\\n\\t<li>#{ content }\"\n else\n lines[line_id] = \"\\t\\t<li>#{ content }\"\n end\n last_line = line_id\n\n else\n last_line = line_id\n end\n if line_id - last_line > 1 or line_id == lines.length - 1\n depth.delete_if do |v|\n lines[last_line] << \"</li>\\n\\t</#{ lT( v ) }l>\"\n end\n end\n end\n lines.join( \"\\n\" )\n end\n end",
"def level_order(root)\n res = []\n return res if root.nil?\n queue = [root]\n tmp = [root.val]\n until queue.empty?\n res << tmp\n parent = queue\n queue = []\n tmp = []\n parent.each do |nodes|\n queue << nodes.left unless nodes.left.nil?\n queue << nodes.right unless nodes.right.nil?\n tmp << nodes.left.val unless nodes.left.nil?\n tmp << nodes.right.val unless nodes.right.nil?\n end\n end\n res\nend",
"def walk_tree(tree, path, level)\n result = []\n tree.children.each do |child|\n open = child.tree? && (child.path == path[0..level].join('/'))\n result << [level, child, open]\n result += walk_tree(child, path, level + 1) if open\n end\n result\n end",
"def inject_deep_flat(list, remaining_path, multiplicity)\n return inject_deep(list, remaining_path) if multiplicity == 0\n\n flat_input = list.flat_map { |v| v.nil? ? [] : v }\n flat_output = inject_deep_flat(flat_input, remaining_path, multiplicity - 1)\n item_index = -1\n list.map { |v| v&.map { flat_output[item_index += 1] } }\n end",
"def generate_structure( value )\n part = {}\n unless value.has_key?( \"children\" )\n return [] if value[\"unbounded\"]\n return \"\"\n else\n value[\"children\"].each do | key, value |\n part[key] = generate_structure(value)\n end \n end\n \n return [part] if value[\"unbounded\"]\n part \n end",
"def create_tree(father,tree)\n tree.each do |name|\n n = Meta::create_class(father, name[0], name[1])\n create_tree(n, name[2])\n end\nend",
"def category_list_classes depth, children\n depth_class = \"depth--#{depth}\"\n children_class = children.any? ? 'has-children' : ''\n \"#{depth_class} #{children_class}\"\n end",
"def my_depth\n 1\n end",
"def build_tree(inorder, postorder)\n return nil if inorder.empty?\n last_node_val = postorder.last\n last_node_index = inorder.index(last_node_val)\n node = TreeNode.new(last_node_val)\n \n if last_node_index > 0\n node.left = build_tree(inorder[0..last_node_index-1], postorder[0..last_node_index-1])\n end\n \n if last_node_index < inorder.length-1\n node.right = build_tree(inorder[last_node_index+1..-1], postorder[last_node_index..-2])\n end\n node\nend",
"def render_entry_children(context, page, depth)\n output = %{}\n\n children = page.children_with_minimal_attributes(@options[:add_attributes]).reject { |c| !include_page?(c) }\n if children.present?\n output = %{<ul id=\"#{@options[:id]}-#{page.slug.to_s.dasherize}\" class=\"#{bootstrap? ? 'dropdown-menu' : ''}\">}\n children.each do |c, page|\n css = []\n css << 'first' if children.first == c\n css << 'last' if children.last == c\n\n output << render_entry_link(context, c, css.join(' '), depth)\n end\n output << %{</ul>}\n end\n\n output\n end",
"def ancestry_nested_comments(comments)\n comments.map do |comment, sub_comments|\n render(comment) + content_tag(:div, ancestry_nested_comments(sub_comments), class: 'ancestry_nested_comments')\n end.join.html_safe\n end",
"def convert_binary_tree_to_double_linked_list(root)\nend",
"def build_tree(item_list = @sorted_list,root_node = nil)\n #sorted root sorts and removes duplicates from the item list\n if (item_list[0] == nil)\n return nil\n else\n start = 0\n end_of_item_list = item_list.length - 1\n mid = (start + item_list.length) / 2\n #set the root node then start creating a tree node for the left and right side of the array\n #Then after that branch is created attach it to the correct position\n root_node = Node.new(item_list[item_list.length/2])\n root_node.right = build_tree(item_list[0,mid],root_node) \n root_node.left = build_tree(item_list[mid+1,end_of_item_list],root_node)\n return root_node\n end\n \n end",
"def internal_structure(indentation=0)\n node_descr = \"\"\n indentation.times { node_descr.concat \" \" }\n description = self.class.to_s.gsub(\"Node\", \"\")\n node_descr.concat \"#{description}\"\n if(!@node_value.nil?)\n node_descr.concat \" #{@node_value}\"\n end\n node_descr.concat \"\\n\"\n if (!children.nil?)\n children.each do |child| \n node_descr.concat(\"#{child.internal_structure(indentation+1)}\")\n end\n end\n return node_descr\n end",
"def build_forums_list parent_id = 0\n stats = {} # A hash that holds the forums latest stats and last post ids\n tree = [] # The array used to build the forum's tree\n\n # get the lastest forum stats and last post ids\n Forum.all().each do |forum|\n stats = stats.merge({\n forum.id => {'topics' => forum.topic_count, 'posts' => forum.post_count, 'last_post_id' => forum.last_post_id}\n })\n end\n \n # build the forums tree\n Rails.cache.read('forums').each do |parent, children|\n if parent_id == 0 or parent.id == parent_id\n break unless parent.is_active?\n tree << parent \n end\n\n # TODO: this needs to be moved in the above block in order for the forum perms to work. If the user doesn't have\n # permissions to the parent forum, then it's child forums will inherit the same permissions.\n if parent.is_active?\n build_child_forums children, tree, stats, parent_id\n end\n end\n \n return tree\n end",
"def children_for(list)\n list.map do |key, value|\n value = Array(value).flatten\n if value.any?\n after = \" \" * string.inspect.length + \" \"\n description = Hansi.render(THEME[:orange], key.to_s)\n Tree.new(description, *value, after: after, prefix_color: PREFIX_COLOR)\n end\n end\n end",
"def recursiveTreeTraversal(element)\n if StereotypesHelper.hasStereotype(element, $veStereotype)\n findOrCreateRefinedParameters(element)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\nend",
"def flatten_lvl(lvl_src, lvl_dst)\n lvl_sib = Nokogiri::XML::Node.new('ul', @doc)\n src_pos = @lvls[lvl_src].first[NODE_ORDER]\n @lvls[lvl_src].each {|lvl_child| lvl_sib.add_child(lvl_child[NODE_CONTENT])}\n @lvls[lvl_src] = []\n \n lvl_dst > 0 && src_pos < @lvls[lvl_dst].last[NODE_ORDER] ?\n @lvls[lvl_dst].insert(-2,[lvl_sib, src_pos]) :\n @lvls[lvl_dst].push([lvl_sib, src_pos])\n @lvls[lvl_dst]\n end",
"def print_tree(array , item, level)\n items = array[item]\n unless items == nil\n indent = level > 0 ? sprintf(\"%#{level * 2}s\", \" \") : \"\"\n items.each do |e|\n puts \"#{indent}-#{e[:title]}\"\n print_tree(e, level + 1)\n end\n end\nend",
"def group_by_depth(arr)\n output = []\n\n nested = false\n arr.each do |x|\n\n if output.last\n\n last_line = output.last[-1]\n\n if line_depth(last_line) == line_depth(x)\n\n if x =~ /Features:/ && last_line =~ /Page: \\d/\n nested = true\n end\n\n if nested\n output.last << x\n else\n output << [x]\n end\n\n elsif line_depth(last_line) > line_depth(x)\n # we are outdenting\n nested = false\n output << [x]\n\n elsif line_depth(last_line) < line_depth(x)\n # we are indenting further\n nested = true\n output.last << x\n end\n else\n output << [x]\n end\n end\n\n output\n end",
"def reorganize\n list = params[:list]\n prev_page = nil\n last_root = nil\n list.each_with_index do |item, i|\n item_params = item[1]\n\n page = Page.find(item_params['id'].to_i)\n \n # if root of tree on rails side\n if item_params['parent_id'] == ''\n page.parent_id = nil\n if last_root\n page.move_to_right_of(last_root.id)\n end\n last_root = page\n page.save\n\n else\n page.parent_id = item_params['parent_id'].to_i\n page.save\n \n # shift to the right of previous element if parent is the same\n if prev_page.parent_id == page.parent_id\n page.move_to_right_of(prev_page.id)\n else\n\n # iterate backwards to find last sibling\n current_index = i - 1 \n found_sibling = false\n keys = list.keys\n\n while found_sibling == false and current_index > 0 do\n if list[keys[current_index]]['parent_id'] == item_params['parent_id']\n page.move_to_right_of(list[keys[current_index]]['id'])\n found_sibling = true\n else\n current_index -= 1\n end\n end\n\n end\n end\n\n # set previous item\n prev_page = page\n\n end\n\n respond_to do |format|\n format.json { head :ok } \n end\n end",
"def unordered_list; end",
"def to_nested_a(flat = false, mover = nil, &block)\n descendants = self.nested.all\n array = []\n\n while not descendants.empty?\n items = descendants.shift.to_nested_a(flat, mover, descendants, 0, &block)\n array.send flat ? 'concat' : '<<', items\n end\n\n return array\n end",
"def flatten(data, path = Path.new([]))\n case data\n when Array\n data.each_with_index.map do |d,i|\n pathi = path + [i]\n pathi.add_index path.length\n flatten(d, pathi)\n end\n when Hash\n data.map {|k,v| flatten(v, path + [k.to_s])}\n else \n leaf = Leaf.new(path,data)\n @leaves << leaf\n end\n @leaves\n end",
"def build_list(nodes)\n return nil if nodes.length == 0\n list = ListNode.new(nodes.last)\n ite = list\n i = nodes.length - 2\n while i>=0\n ite.next = ListNode.new(nodes[i])\n ite = ite.next\n i -= 1\n end\n list\nend",
"def build_children(node, parent = nil)\n\t\tnode.children = get_all_moves(node)\n\t\tunless node.depth + 1 == @max_depth\n\t\t\tnode.children.each {|child| build_children(child, node)}\n\t\tend\n\tend"
] | [
"0.685823",
"0.68208694",
"0.66374844",
"0.6589937",
"0.6552515",
"0.637286",
"0.63725144",
"0.63636017",
"0.63243544",
"0.60720694",
"0.60386866",
"0.5983094",
"0.59502393",
"0.59264046",
"0.5905678",
"0.590465",
"0.58891594",
"0.58663493",
"0.58127165",
"0.5779734",
"0.5768427",
"0.57293344",
"0.572485",
"0.5682061",
"0.56698436",
"0.5660249",
"0.5650902",
"0.5644117",
"0.56378746",
"0.56317514",
"0.56138146",
"0.560177",
"0.5600426",
"0.5592367",
"0.558259",
"0.5581027",
"0.55756944",
"0.5570619",
"0.55512005",
"0.55454904",
"0.5519297",
"0.54975355",
"0.54833335",
"0.5480955",
"0.54770106",
"0.5460241",
"0.5456643",
"0.54560935",
"0.544877",
"0.54457146",
"0.5445594",
"0.5443322",
"0.5438376",
"0.5435044",
"0.5434981",
"0.54348356",
"0.54270774",
"0.5426193",
"0.5426024",
"0.54236156",
"0.5416862",
"0.5394037",
"0.5393643",
"0.53935206",
"0.5383818",
"0.53793633",
"0.53751355",
"0.5371627",
"0.53679734",
"0.5359774",
"0.5358964",
"0.535",
"0.5345608",
"0.53443474",
"0.5331874",
"0.53279775",
"0.53193843",
"0.53114754",
"0.53107035",
"0.5309469",
"0.5307688",
"0.5284706",
"0.5281872",
"0.5281118",
"0.5260481",
"0.5245069",
"0.5225501",
"0.5224881",
"0.52222675",
"0.5218938",
"0.5211723",
"0.5209196",
"0.5208349",
"0.5207541",
"0.5205502",
"0.52043307",
"0.5200581",
"0.5199333",
"0.5183678",
"0.5180154",
"0.51752883"
] | 0.0 | -1 |
Determines whether or not a page should be a part of the menu | def include_page?(page)
if do_not_show?(page)
false
elsif @options[:exclude]
(page.fullpath =~ @options[:exclude]).nil?
else
true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include_in_menu?\n @include_in_menu != false\n end",
"def shown_in_menu?\n false\n end",
"def sidebar_required?\n @menu_elements = []\n if @page.parent_id.present?\n @menu_elements = @page.parent.children.reject{|c| !c.in_menu?}\n end\n unless @page.children.blank?\n @menu_elements = @page.children.reject{|c| !c.in_menu?}\n end\n return !@menu_elements.empty?\n end",
"def has_menu?\n\t\t!self.menu.nil?\n\tend",
"def show_in_menu?\n true\n end",
"def in_menu?\n live? && show_in_menu?\n end",
"def include_in_menu?\n menu_options[:display] != false\n end",
"def is_top_nav?\n\t\t!nav_id\n\tend",
"def home_page?\n active_page? 'info' => ['index']\n end",
"def sidebar_enabled?\n\t\tcurrent_page = \"#{controller.controller_name}.#{controller.action_name}\"\n\t\tcurrent_controller = controller.controller_name\n\t\tpages = %w()\n\n\t\treturn pages.include?(current_page) || pages.include?(current_controller)\n\tend",
"def menu_item?\n @menu_item\n end",
"def not_home?\n page.title != \"Home\"\n end",
"def should_display_about_and_features\n controller.controller_name == \"static_pages\"\n end",
"def has_own_breadcrumbs?\n !self.is_a?(SystemPage)\n end",
"def is_present?\n lookup_context.template_exists?('sub_nav', controller_name, true)\n end",
"def sidebar_enabled?\n current_page = \"#{controller.controller_name}.#{controller.action_name}\"\n current_controller = controller.controller_name\n pages = %w(report_templates.new report_templates.edit )\n\n return pages.include?(current_page) || pages.include?(current_controller)\n end",
"def sub_menu?\n items && (items.empty? ? false : true)\n end",
"def home_page?\n controller_name == 'pages' && %w(home location_name).detect {|x| action_name == x} ? true : false\n end",
"def page_selected?(page)\n self.current_page.fullpath =~ /^#{page.fullpath}(\\/.*)?$/\n end",
"def is_page?\n is_entry? && params[:_entry_type_] == 'page'\n end",
"def display_navbar?\n return true if admin?\n return true if person.is_a?(Mentor) && person.passed_basics?\n return true if person.is_a?(Mentor) && person.current_lead?\n false\n end",
"def link_visible?(page_name)\n if current_user.manager? || current_user.admin?\n pages = ['dashboard', 'home', 'products', 'categories', 'users', 'offers']\n else\n pages = ['home']\n end\n\n pages.include?(page_name)\n end",
"def on_page?\n raise NotImplementedError, \"implement me, e.g. using #has_title?\"\n end",
"def on_page?\n false\n end",
"def valid_context?\n #Rails.logger.debug \"valid=#{menu.current_context}, self.template_tag.current_piece=#{self.template_tag.current_piece.title}\"\n ret = theme.valid_context?(template_tag.current_piece.page_layout, menu)\n #(self.template_tag.current_piece.context? menu.current_context) \n end",
"def display_sub_menu?\n @sub_menus = nil\n\n # sub-menu for Catalog Management\n if controller.is_a?(AdminLeelah::CatalogManagement::CatalogManagementController)\n @sub_menus = {\n '.link.products' => admin_leelah_catalog_management_products_path,\n '.link.categories' => admin_leelah_catalog_management_categories_path,\n }\n # sub-menu for Order Management\n elsif controller.is_a?(AdminLeelah::OrderManagement::OrderManagementController)\n @sub_menus = {\n '.link.orders' => admin_leelah_order_management_orders_path,\n }\n # sub-menu for General Configuration\n elsif controller.is_a?(AdminLeelah::GeneralConfiguration::GeneralConfigurationController)\n @sub_menus = {\n '.link.users' => admin_leelah_general_configuration_users_path,\n }\n end\n\n @sub_menus\n end",
"def include_page?(page)\n if !page.listed? || page.templatized? || !page.published?\n false\n elsif @options[:exclude]\n (page.fullpath =~ @options[:exclude]).nil?\n else\n true\n end\n end",
"def home_page?\n current_route?('')\n end",
"def include_page?(page)\n if !page.listed? || page.templatized? || !page.published?\n false\n elsif @_options[:exclude]\n (page.fullpath =~ @_options[:exclude]).nil?\n else\n true\n end\n end",
"def show_pages\n false\n end",
"def is_subpage_of?(page, parent)\n return false if page.index_or_404?\n\n if page.parent_id # only in the new version of the engine\n return page.parent_id == parent._id\n end\n\n if parent.fullpath == 'index' && page.fullpath.split('/').size == 1\n return true\n end\n\n File.dirname(page.fullpath.dasherize) == parent.fullpath.dasherize\n end",
"def is_admin_request?\n !(@_admin_menus.nil?)\n end",
"def show_nav_bar?(...)\n true\n end",
"def has_items?\n menu_items.present?\n end",
"def side_bar_nav?\n # !(@tag.nil? || @tag.entries.first.try(:link_to_tag) || @tag.predefined_class == \"Gallery\")\n !(@tag.nil? || @tag.predefined_class == \"Gallery\")\n end",
"def page?\n !!self.page_id\n end",
"def test_00010_home_page_contents\n check_main_menu\n check_bottom_menu\n check_footnote\n end",
"def create_categories_page?\n categories_shortcut != inventory_shortcut\n end",
"def only_sub_pages_left?\n active_sub_with_events_left? && current_user.purchased_events <= 0\n end",
"def on_page_portal?\n return (controller.controller_name == \"home\" and controller.action_name == \"portal\") \n end",
"def volunteer_menu?\n cont = controller.controller_name\n act = controller.action_name\n\n volunteer_logged_in? ||\n cont == 'accounts' ||\n cont == 'volunteers' && (act == 'new') ||\n cont == 'self_reports' && (act == 'index' || act == 'create_report' || act == 'edit_report') ||\n cont == 'orientations' && (act == 'v_orientations' || act == 'v_register') ||\n cont == 'projects' && (act == 'index' || act == 'provide_feedback')\n end",
"def is_workplace_page? \n return true if controller_name == \"workplaces\" || controller_name ==\"workplace_posts\" || controller_name == \"workplace_map_posts\"\n end",
"def root_page?\n current_page == root_page\n end",
"def displayed?\n as_page_class.displayed?\n end",
"def activepage?(path)\n \t\t\"active\" if current_page?(path)\n \tend",
"def is_parent_page_active(page)\n current_page.url.match(page)\n end",
"def admin_sub_navigation_entry_active?(entry)\n params[:controller] == entry[\"controller\"].gsub(/^\\//, '') && (params[:action] == entry[\"action\"] || entry[\"nested_actions\"] && entry[\"nested_actions\"].include?(params[:action]))\n end",
"def current_page?(url); end",
"def valid_context?(selected_page_layout, taxon)\n # 当前设计是,只有具有上下文的page_layout,需要stylish,同时页面可以共享头部和尾部\n # 如 文章列表/产品列表页有多种显示方式。 有的是文件下载,有的是新闻\n #\n #stylish only apply page_layout with context other than either.\n if !selected_page_layout.context_either? #selected_page_layout.stylish >0 #\n # Rails.logger.debug \"--------selected_page_layout=#{ selected_page_layout.title} --------\"\n # page_layout.stylish_with_inherited is required, child should get stylish from accestor\n return false unless ( selected_page_layout.stylish_with_inherited == taxon.stylish_with_inherited )\n end\n\n specific_taxons = assigned_resources( Spree::SpecificTaxon, selected_page_layout).compact\n specific_taxon_ids = specific_taxons.collect(&:id)\n is_valid = (selected_page_layout.valid_context?(taxon.current_context))\n\n if is_valid && specific_taxon_ids.present?\n is_valid = specific_taxon_ids.include?(taxon.id)\n unless is_valid\n is_valid = specific_taxons.map{|specific_taxon| taxon.is_descendant_of?(specific_taxon) }.include?( true )\n end\n end\n\n is_valid\n end",
"def card_page?\n current_act = params[:action]\n current_ctrl = params[:controller]\n dashboard_ctrl = (current_ctrl == 'dashboard')\n professional_card_act = (current_ctrl == 'professionals' && current_act != 'index')\n !(dashboard_ctrl || professional_card_act)\n end",
"def page_active?(symbol); selected_page == symbol; end",
"def top_level?\n slug == slug_path\n end",
"def page?\n PAGE_EXTS.include? extname\n end",
"def highlighted?(params)\n !!(params[:controller].try(:gsub, \"admin/\", \"\") =~ menu_match)\n end",
"def create_items_page?\n items_shortcut != inventory_shortcut\n end",
"def may_edit_pages(user)\n true\n end",
"def active? path \n \"active\" if current_page? path\n end",
"def is_home?\n current_page?('/')\n end",
"def includesMainPageLink(link)\n\tlink.to_s.downcase.include?\"main_page\"\nend",
"def active? path\n \"active\" if current_page? path\n end",
"def active? path\n \"active\" if current_page? path\n end",
"def sections?\n false\n end",
"def current?\n self.collection_tag.template_tag.page_generator.menu.id == self.model.id\n end",
"def page_title_set?\n defined?(@_page_title)\n end",
"def landing_page? \n landing_page.present? \n end",
"def can_manage_pages?\n super\n rescue\n raise \"You need to specify a method named 'can_manage_pages?' in your application.rb. Have it return true if the current user should be able to create/edit pages and false otherwise\"\n end",
"def pro_page?\n (session[:user_type] && session[:user_type] == USER_TYPES[:pro])\n end",
"def if_questions_page\n view_context.request.path == '/questions'\n end",
"def nav_check\n @skip_nav = true\n end",
"def is_page?(action)\n d = Dir.new \"pages\"\n d.each do |f|\n if f[0] != '.'\n # TODO: Allow different kind of extensions\n return true if action == File.basename(f, \".html.erb\")\n end\n end\n false\n end",
"def redirect_to_homepage?\n @page.homepage?\n end",
"def protected_slug?\n ['home-page-block', 'footer', 'sidebar', 'between-slide-6-list'].include? self.slug\n end",
"def menu?\n @streams.any? { |stream| stream.is_a? MenuStream }\n end",
"def display?(context = nil)\n return false unless render_in_context(context, @should_display)\n return false if !real_url?(context) && @children.any? && !items(context).any?\n true\n end",
"def page_active? page\n @breadcrumb ||= breadcrumb(@page)\n @breadcrumb.include? page\n end",
"def contains_menu_item?(path)\r\n begin\r\n menu_item(path)\r\n return true\r\n rescue ElementDoesntExist => e\r\n return false\r\n end\r\n end",
"def current_root_menu_include?(menu)\n begin\n if current_root(self)\n current_root(self).traverse(:depth_first) do |menu_item|\n @current_root = menu_item if menu && menu_item && current_page?(menu_item.menu_target) && menu.menu_target[0] != '#'\n end\n end\n rescue => e\n Rails.logger.info(\"** NO ROOT PATH FOUND #{e.inspect}\")\n return false\n end\n @current_root != nil\n end",
"def customization_section?\n current_page_includes?(edit_resource_context_path(@resource_context),\n new_resource_context_path,\n customization_requirement_path(@resource_context)) ||\n ( params[:controller] == 'customizations' && params[:requirement_id] &&\n current_page?(customization_requirement_path(@resource_context, requirement_id: params[:requirement_id])))\n end",
"def admin_page?\n request.path.start_with?('/admin')\n end",
"def restricted?\n page.restricted?\n end",
"def is_page_active(page)\n current_page.url == page\n end",
"def current_menu(cntrl)\n true if controller.controller_name.eql?(cntrl)\n end",
"def global_nav_required?\n GLOBAL_NAV_EXCLUSION_PATHS.exclude?(request.path)\n end",
"def available_on_site?(layout)\n return false unless Alchemy::Site.current\n\n Alchemy::Site.current.definition.blank? ||\n Alchemy::Site.current.definition.fetch(\"page_layouts\", []).include?(layout[\"name\"])\n end",
"def homepage_active?\n active && (! past?)\n end",
"def on_page?\n begin\n rcd_trait\n @trait = rcd_trait\n #consider adding a URL check here\n Watir::Wait.until { @trait.exists? && @trait.present? }\n return true\n rescue\n return false\n end\n end",
"def is_home?\n @is_home\n end",
"def hidden?\n if object.respond_to? :menu_hidden\n object.menu_hidden\n end\n end",
"def is_subpage_of?(fullpath, parent_fullpath)\n return false if %w(index 404).include?(fullpath)\n\n if parent_fullpath == 'index' && fullpath.split('/').size == 1\n return true\n end\n\n File.dirname(fullpath.dasherize) == parent_fullpath.dasherize\n end",
"def identity_page?\n active_page? 'accounts' => ['show']\n end",
"def set_page_info\n unless user_signed_in? && (current_user.is_customer? || current_user.is_vendor? )\n @menus[:general_ledger][:active] = \"active\"\n end\n end",
"def whitelisted_page?(page)\n return false unless page\n return false if /:/.match page\n page[0..5] == '/wiki/' ? true : false\n end",
"def admin_mainnavi_active?(navigation)\n # Has the given navigation entry a active sub navigation?\n has_active_entry?(navigation[\"sub_navigation\"] || []) ||\n # Has the given navigation entry a active nested navigation?\n has_active_entry?(navigation[\"nested\"] || []) ||\n # Is the navigation entry active?\n entry_active?(navigation || {})\n end",
"def show_admin_menu_items?\n can?(:read, :admin_dashboard)\n end",
"def current_spree_page?(url)\n path = request.fullpath.gsub(/^\\/\\//, '/')\n if url.is_a?(String)\n return path == url\n elsif url.is_a?(Hash)\n return path == spree.url_for(url)\n end\n return false\n end",
"def sections_exist?\n @top_level.items.present?\n end",
"def valid_page?\n File.exist?(Pathname.new(Rails.root + \"app/views/welcome/#{params[:page]}.html.erb\"))\n end",
"def is_top_level?\n respond_to?(:includes_origen_top_level?)\n end",
"def has_sidebar?\n content_for?(:layout_sidebar)\n end",
"def is_nav_parent?\n parent_id.blank?\n end"
] | [
"0.71867716",
"0.70993996",
"0.7079304",
"0.70061105",
"0.6975726",
"0.69751304",
"0.68361324",
"0.67792284",
"0.67428446",
"0.6645417",
"0.6640492",
"0.6631472",
"0.6627317",
"0.6617787",
"0.6616841",
"0.6612598",
"0.6600276",
"0.6518728",
"0.65031266",
"0.6467844",
"0.6455494",
"0.64416623",
"0.6427806",
"0.64060634",
"0.63718617",
"0.63493973",
"0.6342044",
"0.63407093",
"0.63368887",
"0.6333089",
"0.62943935",
"0.62779665",
"0.62545997",
"0.62523216",
"0.62402815",
"0.6236705",
"0.6215884",
"0.62134457",
"0.6206404",
"0.61979014",
"0.6161534",
"0.6160209",
"0.61544025",
"0.61478424",
"0.61340696",
"0.61130524",
"0.61095166",
"0.610721",
"0.6104227",
"0.6084983",
"0.6079311",
"0.607781",
"0.607697",
"0.6062039",
"0.6059624",
"0.60566485",
"0.6052773",
"0.605113",
"0.6048613",
"0.6025374",
"0.6025374",
"0.601096",
"0.5999089",
"0.5986928",
"0.5981149",
"0.5973179",
"0.59705716",
"0.5967407",
"0.59473056",
"0.5942121",
"0.59373146",
"0.5936875",
"0.5936019",
"0.59244967",
"0.5905044",
"0.58969545",
"0.5889552",
"0.58878815",
"0.5880851",
"0.5879443",
"0.58677095",
"0.58348656",
"0.5823145",
"0.5819225",
"0.58121043",
"0.5806187",
"0.58014977",
"0.58003753",
"0.57978344",
"0.5795641",
"0.57907546",
"0.5784349",
"0.5782195",
"0.57748204",
"0.5772199",
"0.57696",
"0.5765812",
"0.5764622",
"0.5760606",
"0.5759796"
] | 0.643293 | 22 |
GET /information GET /information.json | def index
@information = Information.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @information = Information.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @information }\n end\n end",
"def show\n @information = Information.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @information }\n end\n end",
"def info\n get(\"/api-info\")\n end",
"def info\n get '/'\n end",
"def info\n response = from_server \"api/info.json\"\n response.data\n end",
"def show\n @information_request = InformationRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @information_request }\n end\n end",
"def info(**args)\n valid_params?(args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/info\", options: params.compact).tap do |resp|\n resp.body = resp.body.map { |_k, data| data }\n end\n end",
"def info(**args)\n valid_params?(args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/info\", options: params.compact).tap do |resp|\n resp.body = resp.body.map { |_k, data| data }\n end\n end",
"def info\n request('getinfo')\n end",
"def getinfo\n @api.request 'getinfo'\n end",
"def show\n @resource_info = ResourceInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_info }\n end\n end",
"def info\n CouchRest.get \"#{@uri}/\"\n end",
"def show\n @general_information = GeneralInformation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @general_information }\n end\n end",
"def getinfo\n request :getinfo\n end",
"def info(kind)\n login_as :place1_admin\n get :info, :kind => kind\n\n # See if the response is success\n assert_equal \"200\", @response.code\n\n return JSON.parse(@response.body)\n end",
"def show\n @person_info = PersonInfo.find(params[:id])\n\n render json: @person_info\n end",
"def show\n @info_page = InfoPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @info_page }\n end\n end",
"def index\n\t my_uuid = params[:uuid]\n\t\tif my_uuid == nil\n\n\t\t\t@information = Information.all\n\t\telse\n\t\t\t@information = Information.where(uuid: my_uuid).all\n\t\tend\n\t\trespond_with @information\n end",
"def new\n @information = Information.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @information }\n end\n end",
"def info( opts = {} )\n http_action :get, nil, opts\n end",
"def new\n @information = Information.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @information }\n end\n end",
"def show\n @yy_information = YyInformation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @yy_information }\n end\n end",
"def show\n @info_polen = InfoPolen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @info_polen }\n end\n end",
"def show\n @info_polen = InfoPolen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @info_polen }\n end\n end",
"def information\n begin\n # TODO HIGH prateekm: Update this section\n gather_info if stale?\n self\n rescue Services::NotFoundException => e\n #self.destroy\n {'error' => e.message}.to_json\n end\n end",
"def information\n begin\n gather_information if stale?\n self.json\n rescue Services::NotFoundException => e\n self.destroy\n {'error' => e.message}.to_json\n end\n end",
"def info\n IbmCloudRest.get \"#{@uri}/\"\n end",
"def info(url)\n rest = RestClient::Request.execute(\n method: :get,\n url: url,\n user: ENV['USER'],\n password: ENV['KEY'],\n headers: {\"Content-Type\" => \"application/json\"}\n )\n JSON.parse(rest, :symbolize_names => true)\n rescue RestClient::Exception\n \"Sorry something went wrong with the API\"\n end",
"def show\n @info_type = InfoType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @info_type }\n end\n end",
"def show_info\n render json: TrackingInformationQuery.single(@tracking_information, @order), status: 200\n end",
"def get_info\n end",
"def get_info\n end",
"def get_info\n end",
"def index\n @infos = Info.all\n end",
"def info\n kind = (params[:kind] || \"account,locations,offers,usage,messages\").split(/\\s*,\\s*/)\n \n info = {}\n\n # General account info\n if kind.include?(\"account\")\n info[:account] = {\n :domain => current_account.full_domain,\n :venue_name => current_account.venue_name, \n :venue_address => current_account.venue_address, \n :venue_type => current_account.venue_type, \n :venue_type_other => current_account.venue_type_other,\n :on_hold => current_account.on_hold\n }\n end\n \n # Offers\n if kind.include?(\"offers\")\n info[:offers] = current_account.offers.map do |o|\n { :id => o.id,\n :name => o.name,\n :text => o.text,\n :details => o.details }\n end\n end\n \n # Message format\n if kind.include?(\"messages\")\n info[:messages] = {\n :conf_message => current_account.conf_message,\n :conf_prepend_venue => current_account.conf_prepend_venue,\n :page_message => current_account.page_message,\n :page_prepend_venue => current_account.page_prepend_venue,\n :offer_id => current_account.offer_id\n }\n end\n \n if kind.include?(\"locations\")\n info[:locations] = current_account.locations.map do |l|\n { :id => l.id,\n :name => l.name,\n :internal_id => l.internal_id }\n end\n end\n \n if kind.include?(\"usage\")\n info[:usage] = usage_info\n end\n \n render :text => info.to_json\n end",
"def info() \n \treturn self.response.info()\n\tend",
"def show\n @item_info = ItemInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_info }\n end\n end",
"def show\n @institucional = Institucional.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institucional }\n end\n end",
"def show\n @information_error = InformationError.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @information_error }\n end\n end",
"def show\n @server_info = ServerInfo.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server_info }\n end\n end",
"def info\n @document = Document.find(params[:id])\n respond_to do |format|\n format.json { render :json => @document, serializer: Api::Mobile::V2::DynamicDocumentSerializer, root: 'document' }\n end\n end",
"def show\n @getoff_infos = GetoffInfo.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @getoff_info }\n end\n \n end",
"def details\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # details.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end",
"def info(id)\n http.get(\"/nfse/#{id}\") do |response|\n respond_with_entity(response)\n end\n end",
"def index\n @info = Info.first\n end",
"def show_information(name)\n id = self.search_for(name).first[\"id\"]\n url = @base_url\n url += \"/show/\" + id.to_s\n @client.query(url)\n end",
"def show\n institution = Institution.find(params[:id])\n render json: { status: '200', message: \"Loaded Institution with id #{params[:id]}\", data: institution }, status: :ok\n rescue ActiveRecord::RecordNotFound\n render json: { status: '404', error: \"No Institution with id #{params[:id]}\", data: institution }, status: :not_found\n end",
"def show\n @weather = Weather.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weather }\n end\n end",
"def show\n @weather = Weather.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weather }\n end\n end",
"def information\n @information || grab_information_without_download\n end",
"def index\n @informations = Information.all\n end",
"def index\n @informations = Information.all\n end",
"def show\n @admin_information = Admin::Information.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @admin_information }\n end\n end",
"def info\n @info\n end",
"def show\n @info = Info.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @info }\n end\n end",
"def show\n @info = Info.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @info }\n end\n end",
"def show\n @contactinfo = Contactinfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contactinfo }\n end\n end",
"def info\n\tend",
"def show\n @profile = Profile.find_by_user_id(current_user.id)\n \n @options = { units: \"metric\", APPID: '58d05a1cb6c05328945b2f9f3de5ff72' }\n #City id or name can be acquirred from a database, i did not\n #have time to do this but once done this is how it would retrieve weather\n @city_id = \"7778677\"\n #@data = OpenWeather::Current.city(\"Dublin, IE\", @options)\n @data = OpenWeather::Current.city_id(@city_id, @options)\n puts @data\n puts @data.keys\n\n @json = JSON.parse(@data.to_json)\n @temp = @json['main']['temp']\n @city = @json['name']\n @description = @json['weather'][0]['description']\n end",
"def show\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person_interest }\n end\n end",
"def show\n @generator_info = GeneratorInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generator_info }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @interest }\n end\n end",
"def show\n\n @internal = Internal.find(params[:id])\n\n puts @internal.inspect\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @internal }\n end\n end",
"def info(key)\n response = request(:get, uri(key))\n if response.status == 200\n data = MultiJson.load(response.body)\n if data.is_a?(Array)\n data.each_with_object({}) do |d, acc|\n info = extract_info(d)\n info.delete(:action)\n acc[info[:key]] = info\n end\n else\n info = extract_info(data)\n info.delete(:action)\n info\n end\n else\n nil\n end\n end",
"def show\n @institution = Institution.find(params[:id])\n\n render json: @institution\n\n rescue ActiveRecord::RecordNotFound\n render json: {message: 'Resource not found'}, status: 404\n\n end",
"def show\n @instruction = Instruction.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instruction }\n end\n end",
"def show\n render json: serialize(read_resource(resource), options), status: :ok\n end",
"def show\n @resource = Resource.find(params[:id])\n render json: @resource, status: 200\n end",
"def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interest }\n end\n end",
"def show\n @comp_info = CompInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comp_info }\n end\n end",
"def show\n @communication = Communication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @communication }\n end\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 show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @interest }\n end\n end",
"def show\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institution }\n end\n end",
"def show\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institution }\n end\n end",
"def show\n @instituicao = Instituicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instituicao }\n end\n end",
"def info\n @info\n end",
"def asterisk_get_info\n get \"asterisk/info\"\n end",
"def company_information(params)\n get('company-information',params)\n end",
"def show\n @bio = Bio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bio }\n end\n end",
"def show\n @inspiration = Inspiration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inspiration }\n end\n end",
"def show\n @store_indices_information = Store::Indices::Information.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_indices_information }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @person }\n end\n end",
"def info\n @info ||= {}\n end",
"def show\n @notice = @person.notices.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notice }\n end\n end",
"def show\n @detail = Detail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @detail }\n end\n end",
"def show\n @detail = Detail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @detail }\n end\n end",
"def show\n @personal_info = current_user.personal_info\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personal_info }\n end\n end",
"def info\n @info ||= {}\n end",
"def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end",
"def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end",
"def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @interest }\n end\n end",
"def show\n @usage = Usage.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usage }\n end\n end",
"def info(options={})\n get(:standard, {:method => \"artist.getInfo\"}.merge(options))\n end",
"def show\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interesting }\n end\n end",
"def show\n @mi = Mi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mi }\n end\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def detail\n render json: @article,\n except: [ :updated_at, :created_by_id, :picture ],\n methods: [ :pictures, :created_by ],\n status: :ok\n end"
] | [
"0.78929687",
"0.78379023",
"0.758303",
"0.75783414",
"0.7538838",
"0.73509043",
"0.7326645",
"0.7326645",
"0.7208983",
"0.712591",
"0.703123",
"0.70282733",
"0.7015941",
"0.6977512",
"0.68791246",
"0.68407077",
"0.6794898",
"0.67802995",
"0.67617553",
"0.67573845",
"0.67361844",
"0.671812",
"0.67172694",
"0.67172694",
"0.67171067",
"0.6656976",
"0.66552985",
"0.6649765",
"0.664865",
"0.66119695",
"0.658533",
"0.658533",
"0.658533",
"0.65678144",
"0.6552341",
"0.6484816",
"0.64555305",
"0.6452063",
"0.64172554",
"0.64026237",
"0.64013815",
"0.63999724",
"0.63971615",
"0.6396901",
"0.63901174",
"0.63827133",
"0.6382265",
"0.63661546",
"0.6358771",
"0.6358771",
"0.63506156",
"0.6343632",
"0.6343632",
"0.63258666",
"0.63243496",
"0.6303324",
"0.6303324",
"0.63017595",
"0.62962765",
"0.62955767",
"0.62940824",
"0.6293498",
"0.62927675",
"0.6287234",
"0.62798977",
"0.62769675",
"0.62734276",
"0.626768",
"0.6261612",
"0.6257669",
"0.62505287",
"0.6250023",
"0.6235255",
"0.6233719",
"0.6233616",
"0.6233616",
"0.6227931",
"0.622314",
"0.6218554",
"0.6214612",
"0.6208332",
"0.6192716",
"0.61902684",
"0.61893415",
"0.6181016",
"0.61787134",
"0.6176501",
"0.6176501",
"0.61685747",
"0.61612374",
"0.6160513",
"0.6160513",
"0.6158393",
"0.6155375",
"0.61502224",
"0.61497664",
"0.6133419",
"0.61315775",
"0.6129172"
] | 0.67366105 | 21 |
POST /information POST /information.json | def create
@information = Information.new(information_params)
respond_to do |format|
if @information.save
conn = Bunny.new(:automatically_recover => false)
conn.start
ch = conn.create_channel
q = ch.queue("user")
ch.default_exchange.publish(@information.content, :routing_key => q.name)
conn.close
format.html { redirect_to @information, notice: 'Information was successfully created.' }
format.json { render :show, status: :created, location: @information }
else
format.html { render :new }
format.json { render json: @information.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @information = Information.new(information_params)\n\n if @information.save\n render json: :ok\n else\n render json: @information.errors, status: :unprocessable_entity\n end\n end",
"def create\n @information = Information.new(params[:information])\n\n respond_to do |format|\n if @information.save\n format.html { redirect_to @information, :notice => 'Information was successfully created.' }\n format.json { render :json => @information, :status => :created, :location => @information }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @information.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @information = Information.new(params[:information])\n\n respond_to do |format|\n if @information.save\n format.html { redirect_to @information, notice: 'Information was successfully created.' }\n format.json { render json: @information, status: :created, location: @information }\n else\n format.html { render action: \"new\" }\n format.json { render json: @information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @information = Information.new(information_params)\n\n respond_to do |format|\n if @information.save\n format.html { redirect_to @information, notice: 'Information was successfully created.' }\n format.json { render :show, status: :created, location: @information }\n else\n format.html { render :new }\n format.json { render json: @information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @informations = Information.order('created_at desc')\n @information = Information.new(information_params)\n\n respond_to do |format|\n if @information.save\n format.html { redirect_to kegiatan_path, notice: 'Information was successfully created.' }\n format.json { render :show, status: :created, location: @information }\n else\n format.html { render :new }\n format.json { render json: @information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @info = Info.new(info_params)\n\n respond_to do |format|\n if @info.save\n format.html { redirect_to @info, notice: 'Info was successfully created.' }\n format.json { render :show, status: :created, location: @info }\n else\n format.html { render :new }\n format.json { render json: @info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @info = Info.new(info_params)\n\n respond_to do |format|\n if @info.save\n format.html { redirect_to @info, notice: 'Info was successfully created.' }\n format.json { render :show, status: :created, location: @info }\n else\n format.html { render :new }\n format.json { render json: @info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_information = Admin::Information.new(admin_information_params)\n\n respond_to do |format|\n if @admin_information.save\n format.html { redirect_to @admin_information }\n format.json { render :show, status: :created, location: @admin_information }\n else\n format.html { render :new }\n format.json { render json: @admin_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @information = Information.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @information }\n end\n end",
"def information_params\n params.require(:information).permit(:title, :content)\n end",
"def new\n @information = Information.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @information }\n end\n end",
"def create\n @info_request = InfoRequest.new(info_request_params)\n\n respond_to do |format|\n if @info_request.save\n format.html { redirect_to @info_request, notice: 'Solicitud de información enviada.' }\n format.json { render :show, status: :created, location: @info_request }\n else\n format.html { render :new }\n format.json { render json: @info_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def information_params\n params.require(:information).permit(:title, :content, :image)\n end",
"def create\n @info = Info.new(params[:info])\n if @info.save\n redirect_to infos_path, :notice => 'Info was successfully created.'\n else\n render :action => \"new\"\n end\n end",
"def information_params\n params.require(:information).permit(:content)\n end",
"def information_params\n params.require(:information).permit(:content)\n end",
"def create\n @information = Information.new(information_params)\n\n respond_to do |format|\n if @information.save\n create_report(@information)\n format.html { redirect_to @information, notice: 'Данные отчета созданы.' }\n format.json { render :show, status: :created, location: @information }\n else\n format.html { render :new }\n format.json { render json: @information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n puts \"HAHAHAHAHHA\"\n @information_request = InformationRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @information_request }\n end\n end",
"def create\n @person_info = PersonInfo.new(person_info_params(params[:person_info]))\n\n if @person_info.save\n render json: @person_info, status: :created, location: @person_info\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end",
"def create\n @information = current_admin.informations.build(information_params)\n respond_to do |format|\n if @information.save\n format.html { redirect_to :admins_root, notice: '新着情報を登録しました。' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @admin_information = Admin::Information.new(params[:admin_information])\n\n respond_to do |format|\n if @admin_information.save\n format.html { redirect_to(@admin_information, :notice => 'Information was successfully created.') }\n format.xml { render :xml => @admin_information, :status => :created, :location => @admin_information }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @admin_information.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @information.update(information_params)\n render json: :ok\n else\n render json: @information.errors, status: :unprocessable_entity\n end\n end",
"def create\n @additional_information = AdditionalInformation.new(additional_information_params)\n\n respond_to do |format|\n if @additional_information.save\n format.html { redirect_to @additional_information, notice: 'Additional information was successfully created.' }\n format.json { render action: 'show', status: :created, location: @additional_information }\n else\n format.html { render action: 'new' }\n format.json { render json: @additional_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @information_cone = InformationCone.new(information_cone_params)\n\n respond_to do |format|\n if @information_cone.save\n format.html { redirect_to @information_cone, notice: 'Information cone was successfully created.' }\n format.json { render action: 'show', status: :created, location: @information_cone }\n else\n format.html { render action: 'new' }\n format.json { render json: @information_cone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @information = Information.new(information_params)\n @information.producer = current_user.id\n @city = City.find_by_user_id(current_user.id)\n\n @info = current_user.email + \" says \" + @information.content\n\n respond_to do |format|\n if @information.save\n\n conn = Bunny.new(:automatically_recover => false)\n conn.start\n\n ch = conn.create_channel\n x = ch.topic(\"topic_logs\")\n severity = ARGV.shift || @city.name\n msg = ARGV.empty? ? \"Hello World!\" : ARGV.join(\" \")\n\n x.publish(@info, :routing_key => severity)\n\n conn.close\n\n format.html { redirect_to information_index_path, notice: 'Information was successfully created.' }\n format.json { render :show, status: :created, location: information_index_path }\n else\n format.html { render :new }\n format.json { render json: @information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dor_information = DorInformation.new(dor_information_params)\n\n respond_to do |format|\n if @dor_information.save\n format.html { redirect_to @dor_information, notice: 'Dor information was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dor_information }\n else\n format.html { render action: 'new' }\n format.json { render json: @dor_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @info_type = InfoType.new(params[:info_type])\n\n respond_to do |format|\n if @info_type.save\n format.html { redirect_to @info_type, notice: 'Info type was successfully created.' }\n format.json { render json: @info_type, status: :created, location: @info_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @info_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @general_information = GeneralInformation.new(params[:general_information])\n\n respond_to do |format|\n if @general_information.save\n format.html { redirect_to @general_information.personal_detail, notice: 'General information was successfully created.' }\n format.json { render json: @general_information, status: :created, location: @general_information }\n else\n format.html { render action: \"new\" }\n format.json { render json: @general_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @system_information = SystemInformation.new(system_information_params)\n\n\n respond_to do |format|\n if @system_information.save \n \n \n format.html { redirect_to @system_information, notice: 'Information was successfully created.' }\n format.json { render json: @system_information, status: :created, location: @system_information }\n \n else\n format.html { render action: \"new\" }\n format.json { render json: @system_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact_information = ContactInformation.new(contact_information_params)\n\n respond_to do |format|\n if @contact_information.save\n format.html { redirect_to @contact_information, notice: 'Contact information was successfully created.' }\n format.json { render :show, status: :created, location: @contact_information }\n else\n format.html { render :new }\n format.json { render json: @contact_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def newinformation_params\n params.require(:newinformation).permit(:title, :body, :photo)\n end",
"def create\n @server_info = ServerInfo.new(params[:server_info])\n\n respond_to do |format|\n if @server_info.save\n format.html { redirect_to @server_info, notice: 'Server info was successfully created.' }\n format.json { render json: @server_info, status: :created, location: @server_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @system_information = SystemInformation.new(system_information_params)\n\n respond_to do |format|\n if @system_information.save\n format.html { redirect_to @system_information, notice: 'System information was successfully created.' }\n format.json { render :show, status: :created, location: @system_information }\n else\n format.html { render :new }\n format.json { render json: @system_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def info_params\n params.require(:info).permit!\n end",
"def create\n @contact_information = ContactInformation.new(contact_information_params)\n\n respond_to do |format|\n if @contact_information.save\n format.html { redirect_to @contact_information, notice: 'Contact information was successfully created.' }\n format.json { render action: 'show', status: :created, location: @contact_information }\n else\n format.html { render action: 'new' }\n format.json { render json: @contact_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def information_params\n params.permit(:data_type, :name)\n end",
"def create\n @user_info = UserInfo.new(user_info_params)\n\n respond_to do |format|\n if @user_info.save\n format.html { redirect_to @user_info, notice: 'User info was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user_info }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @information_error = InformationError.new(params[:information_error])\n\n respond_to do |format|\n if @information_error.save\n format.html { redirect_to @information_error, notice: 'Information error was successfully created.' }\n format.json { render json: @information_error, status: :created, location: @information_error }\n else\n format.html { render action: \"new\" }\n format.json { render json: @information_error.errors, status: :unprocessable_entity }\n end\n end\n end",
"def information_params\n params.require(:information).permit(:task_file, :code_file, :task_text, :user_id)\n end",
"def create\n @preparedinfo = Preparedinfo.new(preparedinfo_params)\n\n respond_to do |format|\n if @preparedinfo.save\n format.html { redirect_to @preparedinfo, notice: 'Preparedinfo was successfully created.' }\n format.json { render :show, status: :created, location: @preparedinfo }\n else\n format.html { render :new }\n format.json { render json: @preparedinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def info_params\n params.require(:info).permit(:text, :email)\n end",
"def show\n @information = Information.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @information }\n end\n end",
"def create\n @awarenesses_has_information = AwarenessesHasInformation.new(awarenesses_has_information_params)\n\n respond_to do |format|\n if @awarenesses_has_information.save\n format.html { redirect_to @awarenesses_has_information, notice: 'Awarenesses has information was successfully created.' }\n format.json { render :show, status: :created, location: @awarenesses_has_information }\n else\n format.html { render :new }\n format.json { render json: @awarenesses_has_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @information_personal = InformationPersonal.new(information_personal_params.merge(user_id: current_user.id)) \n \n respond_to do |format|\n if @information_personal.save\n format.html { redirect_to @information_personal, notice: t('personal_info.create_message') }\n format.json { render :show, status: :created, location: @information_personal }\n else\n format.html { render :new }\n format.json { render json: @information_personal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def information_params\n params.require(:information).permit(:image, :garage_name, :total_parking_space, :position, :longitude, :latitude)\n end",
"def create\n @info_polen = InfoPolen.new(params[:info_polen])\n\n respond_to do |format|\n if @info_polen.save\n format.html { redirect_to @info_polen, notice: 'Info polen was successfully created.' }\n format.json { render json: @info_polen, status: :created, location: @info_polen }\n else\n format.html { render action: \"new\" }\n format.json { render json: @info_polen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @info_polen = InfoPolen.new(params[:info_polen])\n\n respond_to do |format|\n if @info_polen.save\n format.html { redirect_to @info_polen, notice: 'Info polen was successfully created.' }\n format.json { render json: @info_polen, status: :created, location: @info_polen }\n else\n format.html { render action: \"new\" }\n format.json { render json: @info_polen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @information = Information.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @information }\n end\n end",
"def create\n @info_product = InfoProduct.new(info_product_params)\n\n respond_to do |format|\n if @info_product.save\n format.html { redirect_to @info_product, notice: 'Info product was successfully created.' }\n format.json { render action: 'show', status: :created, location: @info_product }\n else\n format.html { render action: 'new' }\n format.json { render json: @info_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle_info = VehicleInfo.new(vehicle_info_params)\n\n respond_to do |format|\n if @vehicle_info.save\n format.html { redirect_to @vehicle_info, notice: 'Vehicle info was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle_info }\n else\n format.html { render :new }\n format.json { render json: @vehicle_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item_info = ItemInfo.new(params[:item_info])\n\n respond_to do |format|\n if @item_info.save\n format.html { redirect_to @item_info, notice: 'Item info was successfully created.' }\n format.json { render json: @item_info, status: :created, location: @item_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @poster_information = PosterInformation.new(poster_information_params)\n\n respond_to do |format|\n if @poster_information.save\n format.html { redirect_to @poster_information, notice: 'Poster information was successfully created.' }\n format.json { render :show, status: :created, location: @poster_information }\n else\n format.html { render :new }\n format.json { render json: @poster_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @basicinfo = Basicinfo.new(basicinfo_params)\n\n respond_to do |format|\n if @basicinfo.save\n format.html { redirect_to support_path, notice: 'Basicinfo was successfully created.' }\n format.json { render :show, status: :created, location: @basicinfo }\n else\n format.html { render :new }\n format.json { render json: @basicinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @room_information = RoomInformation.new(room_information_params)\n\n respond_to do |format|\n if @room_information.save\n format.html { redirect_to @room_information, notice: 'Room information was successfully created.' }\n format.json { render :show, status: :created, location: @room_information }\n else\n format.html { render :new }\n format.json { render json: @room_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @houseinfo = Houseinfo.new(houseinfo_params)\n\n respond_to do |format|\n if @houseinfo.save\n format.html { redirect_to @houseinfo, notice: 'Houseinfo was successfully created.' }\n format.json { render :show, status: :created, location: @houseinfo }\n else\n format.html { render :new }\n format.json { render json: @houseinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @info_page = InfoPage.new(params[:info_page])\n\n respond_to do |format|\n if @info_page.save\n format.html { redirect_to admin_info_pages_path, notice: 'Info page was successfully created.' }\n format.json { render json: @info_page, status: :created, location: @info_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @info_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store_indices_information = Store::Indices::Information.new(params[:store_indices_information])\n\n respond_to do |format|\n if @store_indices_information.save\n format.html { redirect_to @store_indices_information, notice: 'Information was successfully created.' }\n format.json { render json: @store_indices_information, status: :created, location: @store_indices_information }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store_indices_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objects_info = ObjectsInfo.new(params[:objects_info])\n\n respond_to do |format|\n if @objects_info.save\n format.html { redirect_to @objects_info, notice: 'Objects info was successfully created.' }\n format.json { render json: @objects_info, status: :created, location: @objects_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @objects_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @studentinfo = Studentinfo.new(studentinfo_params)\n\n respond_to do |format|\n if @studentinfo.save\n format.html { redirect_to @studentinfo, notice: 'Studentinfo was successfully created.' }\n format.json { render :show, status: :created, location: @studentinfo }\n else\n format.html { render :new }\n format.json { render json: @studentinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @general_information = GeneralInformation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @general_information }\n end\n end",
"def create\n @tax_information = TaxInformation.new(tax_information_params)\n\n respond_to do |format|\n if @tax_information.save\n format.html { redirect_to @tax_information, notice: 'Tax information was successfully created.' }\n format.json { render :show, status: :created, location: @tax_information }\n else\n format.html { render :new }\n format.json { render json: @tax_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @countryinfo = Countryinfo.new(countryinfo_params)\n\n respond_to do |format|\n if @countryinfo.save\n format.html { redirect_to @countryinfo, notice: \"Countryinfo was successfully created.\" }\n format.json { render :show, status: :created, location: @countryinfo }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @countryinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @infobook = Infobook.new(infobook_params)\n\n respond_to do |format|\n if @infobook.save\n format.html { redirect_to @infobook, notice: 'Infobook was successfully created.' }\n format.json { render :show, status: :created, location: @infobook }\n else\n format.html { render :new }\n format.json { render json: @infobook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @band_information = BandInformation.new(band_information_params)\n\n respond_to do |format|\n if @band_information.save\n format.html { redirect_to @band_information, notice: 'Band information was successfully created.' }\n format.json { render :show, status: :created, location: @band_information }\n else\n format.html { render :new }\n format.json { render json: @band_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pageinfo = Pageinfo.new(pageinfo_params)\n\n respond_to do |format|\n if @pageinfo.save\n format.html { redirect_to @pageinfo, notice: 'Pageinfo was successfully created.' }\n format.json { render :show, status: :created, location: @pageinfo }\n else\n format.html { render :new }\n format.json { render json: @pageinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_personal_information = User::PersonalInformation.new(user_personal_information_params)\n\n respond_to do |format|\n if @user_personal_information.save\n format.html { redirect_to @user_personal_information, notice: 'Personal information was successfully created.' }\n format.json { render :show, status: :created, location: @user_personal_information }\n else\n format.html { render :new }\n format.json { render json: @user_personal_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @information_request = InformationRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @information_request }\n end\n end",
"def create\n @car_info = CarInfo.new(car_info_params)\n\n respond_to do |format|\n if @car_info.save\n format.html { redirect_to @car_info, notice: 'Car info was successfully created.' }\n format.json { render :show, status: :created, location: @car_info }\n else\n format.html { render :new }\n format.json { render json: @car_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @informacao = Informacao.new(informacao_params)\n\n respond_to do |format|\n if @informacao.save\n format.html { redirect_to @informacao, notice: 'Informacao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @informacao }\n else\n format.html { render action: 'new' }\n format.json { render json: @informacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @album_information = AlbumInformation.new(album_information_params)\n\n respond_to do |format|\n if @album_information.save\n format.html { redirect_to @album_information, notice: 'Album information was successfully created.' }\n format.json { render :show, status: :created, location: @album_information }\n else\n format.html { render :new }\n format.json { render json: @album_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sekilas_info = SekilasInfo.new(sekilas_info_params)\n\n respond_to do |format|\n if @sekilas_info.save\n format.html { redirect_to @sekilas_info, notice: 'Sekilas info was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sekilas_info }\n else\n format.html { render action: 'new' }\n format.json { render json: @sekilas_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @suspicious_person_info = SuspiciousPersonInfo.new(suspicious_person_info_params)\n\n respond_to do |format|\n if @suspicious_person_info.save\n format.html { redirect_to @suspicious_person_info, notice: 'Suspicious person info was successfully created.' }\n format.json { render :show, status: :created, location: @suspicious_person_info }\n else\n format.html { render :new }\n format.json { render json: @suspicious_person_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_information_params\n params.require(:vehicle_information).permit(:vehicle_id, :information_type, :information, :date)\n end",
"def create\n @informacioncomercial = Informacioncomercial.new(informacioncomercial_params)\n\n respond_to do |format|\n if @informacioncomercial.save\n format.html { redirect_to @informacioncomercial, notice: 'Informacioncomercial was successfully created.' }\n format.json { render :show, status: :created, location: @informacioncomercial }\n else\n format.html { render :new }\n format.json { render json: @informacioncomercial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @yy_information = YyInformation.new(params[:yy_information])\n\n respond_to do |format|\n if @yy_information.save\n format.html { redirect_to @yy_information, notice: 'Yy information was successfully created.' }\n format.json { render json: @yy_information, status: :created, location: @yy_information }\n else\n format.html { render action: \"new\" }\n format.json { render json: @yy_information.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @infographic = Infographic.new(params[:infographic])\n\n respond_to do |format|\n if @infographic.save\n format.html { redirect_to @infographic, notice: 'Infographic was successfully created.' }\n format.json { render json: @infographic, status: :created, location: @infographic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @infographic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spring_info = SpringInfo.new(spring_info_params)\n\n respond_to do |format|\n if @spring_info.save\n format.html { redirect_to @spring_info, notice: 'Spring info was successfully created.' }\n format.json { render :show, status: :created, location: @spring_info }\n else\n format.html { render :new }\n format.json { render json: @spring_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @information_request = InformationRequest.new(params[:information_request])\n @information_request.request_timestamp = Time.now\n\n respond_to do |format|\n if @information_request.save\n InfoRequestConfirmation.requested(@information_request).deliver # send email\n format.html { redirect_to root_path, notice: 'Thank You! Your request for information has been successfully processed.' }\n #format.json { render json: @information_request, status: :created, location: @information_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @information_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @debug_info = DebugInfo.new(debug_info_params)\n\n respond_to do |format|\n if @debug_info.save\n format.html { redirect_to @debug_info, notice: 'Debug info was successfully created.' }\n format.json { render action: 'show', status: :created, location: @debug_info }\n else\n format.html { render action: 'new' }\n format.json { render json: @debug_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_information\n @information = Information.find(params[:id])\n end",
"def new\n @resource_info = ResourceInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_info }\n end\n end",
"def set_information\n @information = Information.find(params[:id])\n end",
"def set_information\n @information = Information.find(params[:id])\n end",
"def set_information\n @information = Information.find(params[:id])\n end",
"def set_information\n @information = Information.find(params[:id])\n end",
"def set_information\n @information = Information.find(params[:id])\n end",
"def set_information\n @information = Information.find(params[:id])\n end",
"def set_information\n @information = Information.find(params[:id])\n end",
"def new\n @system_information = SystemInformation.new\n\n \n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @system_information }\n end\n end",
"def set_information\n\n @information = Information.find(params[:id])\n end",
"def create\n @patientinformation = Patientinformation.new(params[:patientinformation])\n\n respond_to do |format|\n if @patientinformation.save\n format.html { redirect_to(@patientinformation, :notice => 'Patientinformation was successfully created.') }\n format.xml { render :xml => @patientinformation, :status => :created, :location => @patientinformation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @patientinformation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @funeral_info = FuneralInfo.new(funeral_info_params)\n\n respond_to do |format|\n if @funeral_info.save\n format.html { redirect_to @funeral_info, notice: 'Funeral info was successfully created.' }\n format.json { render :show, status: :created, location: @funeral_info }\n else\n format.html { render :new }\n format.json { render json: @funeral_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def information_params\n params.require(:information).permit(:id, :title, :description, :publish,:image, :price, :contact, :mobile_number, :qq, :weixin, :category_id)\n end",
"def new\n @information_error = InformationError.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @information_error }\n end\n end",
"def save_information\n\t\t#Is user logged in?\n\t\trender :json=>{:success=>false, :msg=>'User not logged in.'} and return if @user.nil?\n\t\t\n\t\t#Check information\n\t\trender :json=>{:success=>false, :msg=>'Data error. Please refresh the page and try again.'} and return if (!params.has_key?(:information))\n\t\t\n\t\t#Set user information\n\t\tparams[:information].each do |keyval|\n\t\t\t@user[(keyval[0].to_sym)] = keyval[1]\n\t\tend\n\t\[email protected]\n\t\t\n\t\t#Change password?\n\t\tif (params.has_key?(:password))\n\t\t\tif (!params[:password][:old_password].empty? || !params[:password][:new_password].empty?)\n\t\t\t\t#Check old password\n\t\t\t\tuser = User.check_credentials({:email=>@user.email, :password=>params[:password][:old_password]})\n\t\t\t\trender :json=>{:success=>false, :msg=>'Your old password does not match.'} and return if user.nil?\n\t\t\t\t\n\t\t\t\[email protected]_password(params[:password][:new_password])\n\t\t\t\t\n\t\t\t\trender :json=>{:success=>true, :msg=>'Password changed.'} and return\n\t\t\tend\n\t\tend\n\t\t\n\t\trender :json=>{:success=>true, :msg=>'Information saved.'}\n\tend",
"def create\n @customer_info = CustomerInfo.new(customer_info_params)\n\n respond_to do |format|\n if @customer_info.save\n format.html { redirect_to @customer_info, notice: 'Customer info was successfully created.' }\n format.json { render :show, status: :created, location: @customer_info }\n else\n format.html { render :new }\n format.json { render json: @customer_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @payment_information = PaymentInformation.new(params[:payment_information])\n\n respond_to do |format|\n if @payment_information.save\n flash[:notice] = 'PaymentInformation was successfully created.'\n format.html { redirect_to(@payment_information) }\n format.xml { render :xml => @payment_information, :status => :created, :location => @payment_information }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @payment_information.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @info = Info.new(info_params)\n\n # write info to database\n if @info.save\n redirect_to project_subproject_path(@info.subproject.project.id, @info.subproject.id), :notice => 'Info erfolgreich erstellt.'\n else\n render 'new'\n end\n end",
"def create\n @personal_info = current_user.create_personal_info(params[:personal_info])\n\n respond_to do |format|\n if @personal_info.save\n format.html { redirect_to user_path(current_user), notice: 'Personal info was successfully created.' }\n format.json { render json: @personal_info, status: :created, location: @personal_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personal_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reqinfo = Reqinfo.new(params[:reqinfo])\n\n respond_to do |format|\n if @reqinfo.save\n flash[:notice] = 'Your request for more information has been successfully submitted.'\n\t\t# Tell the Emailer to send an Email after save\n\t\tEmailer.deliver_reqinfo_email(@reqinfo)\n format.html { redirect_to(@reqinfo) }\n format.xml { render :xml => @reqinfo, :status => :created, :location => @reqinfo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reqinfo.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.7813996",
"0.75670433",
"0.7522389",
"0.7512729",
"0.7138231",
"0.71197915",
"0.71197915",
"0.69440216",
"0.694048",
"0.6909741",
"0.69005674",
"0.6864512",
"0.67391384",
"0.66557485",
"0.6588165",
"0.6588165",
"0.6580225",
"0.65799195",
"0.65591663",
"0.65234953",
"0.65153795",
"0.6493689",
"0.6369931",
"0.6369386",
"0.6364833",
"0.63539696",
"0.6353078",
"0.6337083",
"0.631765",
"0.63077456",
"0.62969494",
"0.6286623",
"0.6276377",
"0.62721795",
"0.62709004",
"0.6257978",
"0.62546164",
"0.62322754",
"0.6228284",
"0.6221944",
"0.62191993",
"0.62110585",
"0.6207966",
"0.61791337",
"0.6175824",
"0.6173741",
"0.6173741",
"0.6163074",
"0.61575603",
"0.6142051",
"0.61399174",
"0.6139641",
"0.61215484",
"0.61209154",
"0.6103247",
"0.607131",
"0.60686487",
"0.60635597",
"0.60583115",
"0.6034426",
"0.603135",
"0.60309166",
"0.6023592",
"0.60229135",
"0.60200834",
"0.6008574",
"0.6007126",
"0.60011834",
"0.5987919",
"0.5983548",
"0.5972558",
"0.5969275",
"0.59684294",
"0.59614223",
"0.5958052",
"0.5951999",
"0.59416574",
"0.5929021",
"0.5923017",
"0.59139955",
"0.5911682",
"0.5910419",
"0.5910419",
"0.5910419",
"0.5910419",
"0.5910419",
"0.5910419",
"0.5910419",
"0.5901993",
"0.5888474",
"0.5881396",
"0.5871307",
"0.58702445",
"0.5869879",
"0.5866125",
"0.58647823",
"0.5862812",
"0.58528537",
"0.5846758",
"0.5841897"
] | 0.6569009 | 18 |
Use callbacks to share common setup or constraints between actions. | def set_information
@information = Information.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 information_params
params.require(:information).permit(:content)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n 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 strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \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 model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"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 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 url_whitelist; 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 valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\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 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 backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"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.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004",
"0.6290563",
"0.6284484",
"0.62436926",
"0.6239928",
"0.62184125",
"0.62158304",
"0.6210187",
"0.6194002",
"0.61786795",
"0.61759156",
"0.617342",
"0.6162248",
"0.61528504",
"0.61527",
"0.6146735",
"0.6122714",
"0.61169004",
"0.61082125",
"0.61052656",
"0.6091036",
"0.60807735",
"0.6070328",
"0.60634184",
"0.60213035",
"0.6017676",
"0.6013606",
"0.601112",
"0.6007318",
"0.6007318",
"0.6001461",
"0.6001135",
"0.59966296",
"0.5992013",
"0.59919006",
"0.599182",
"0.5980991",
"0.59676576",
"0.5960269",
"0.59588194",
"0.59585214",
"0.59578323",
"0.5953503",
"0.5952524",
"0.59432703",
"0.5939858",
"0.59388995",
"0.59388995",
"0.5933866",
"0.5930038",
"0.5925672",
"0.5924214",
"0.59169805",
"0.59106255",
"0.5910254",
"0.59086037",
"0.5906149",
"0.5898294",
"0.58981514",
"0.5896171",
"0.58944154",
"0.58943397",
"0.5892325",
"0.5887239",
"0.58842856",
"0.5880209",
"0.5874584",
"0.58694917",
"0.5868719",
"0.58669394",
"0.5866552",
"0.58662945",
"0.5864085",
"0.58623236",
"0.5862258",
"0.58597904",
"0.58579135",
"0.58542645",
"0.5853335",
"0.58517563",
"0.5850614"
] | 0.0 | -1 |
define included attributes for thinkingsphinx indexing define_index do indexes title, :sortable => true indexes content indexes permalink, :sortable => true indexes cached_tag_list has user_id, created_at, updated_at, blog_id set_property :delta => true end Status update | def setup_to_mark_as_drafted
self.status = STATUSES[:drafted]
self.drafted_at = Time.zone.now
self.permalink ||= self.title.parameterize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_index_field(*) super end",
"def index_keywords!\n update_attribute(:_keywords, set_keywords)\n end",
"def construct_index\n end",
"def indexed\n meta(index: true)\n end",
"def index_on( field, opts={} )\n opts = Gnash.new( opts )\n design_document(true).add!( opts.merge!(:name => field) )\n unless indexes.include?( field )\n indexes << field.to_sym \n indexes << field.to_s \n end \n self \n end",
"def update!(**args)\n @anchor_index = args[:anchor_index] if args.key?(:anchor_index)\n @generic_index = args[:generic_index] if args.key?(:generic_index)\n @image_query_index = args[:image_query_index] if args.key?(:image_query_index)\n @jgn_index = args[:jgn_index] if args.key?(:jgn_index)\n @query_index = args[:query_index] if args.key?(:query_index)\n end",
"def update!(**args)\n @index_config = args[:index_config] if args.key?(:index_config)\n @name = args[:name] if args.key?(:name)\n end",
"def index_data(*models)\n if models.nil? || models.empty?\n only_index = @indexed_models\n else\n only_index = models.collect{|m| m.to_s}\n end \n \n Mebla.log(\"Indexing #{only_index.join(\", \")}\", :debug)\n \n # Build up a bulk query to save processing and time\n bulk_query = \"\"\n # Keep track of indexed documents\n indexed_count = {}\n \n # Create the index\n if create_index\n # Start collecting documents\n only_index.each do |model|\n Mebla.log(\"Indexing: #{model}\")\n # Get the class\n to_index = model.camelize.constantize\n \n # Get the records \n entries = []\n unless to_index.embedded?\n if to_index.sub_class?\n entries = to_index.any_in(:_type => [to_index.name])\n else \n entries = to_index.any_in(:_type => [nil, to_index.name])\n end\n else\n parent = to_index.embedded_parent\n access_method = to_index.embedded_as\n \n parent.all.each do |parent_record|\n if to_index.sub_class?\n entries += parent_record.send(access_method.to_sym).any_in(:_type => [to_index.name])\n else\n entries += parent_record.send(access_method.to_sym).any_in(:_type => [nil, to_index.name])\n end\n end\n end\n \n # Save the number of entries to be indexed\n indexed_count[model] = entries.count \n \n # Build the queries for this model \n entries.each do |document|\n attrs = {} #document.attributes.dup # make sure we dont modify the document it self\n attrs[:id] = document.attributes[\"_id\"] # the id is already added in the meta data of the action part of the query\n \n # only index search fields and methods\n document.class.search_fields.each do |field|\n if document.attributes.keys.include?(field.to_s)\n attrs[field] = document.attributes[field.to_s] # attribute\n else\n attrs[field] = document.send(field) # method\n end\n end\n \n # index relational fields\n document.class.search_relations.each do |relation, fields| \n items = document.send(relation.to_sym) # get the relation document\n \n next if items.nil?\n \n # N relation side\n if items.is_a?(Array) || items.is_a?(Mongoid::Relations::Targets::Enumerable)\n next if items.empty?\n attrs[relation] = []\n items.each do |item|\n if fields.is_a?(Array) # given multiple fields to index\n fields_values = {}\n fields.each do |field|\n if item.attributes.keys.include?(field.to_s)\n fields_values.merge!({ field => item.attributes[field.to_s] }) # attribute\n else\n fields_values.merge!({ field => item.send(field) }) # method\n end\n end\n attrs[relation] << fields_values\n else # only index one field in the relation\n if item.attributes.keys.include?(fields.to_s)\n attrs[relation] << { fields => item.attributes[fields.to_s] } # attribute\n else\n attrs[relation] << { fields => item.send(fields) } # method\n end\n end\n end\n # 1 relation side\n else\n attrs[relation] = {}\n if fields.is_a?(Array) # given multiple fields to index\n fields_values = {}\n fields.each do |field|\n if items.attributes.keys.include?(field.to_s)\n fields_values.merge!({ field => items.attributes[field.to_s] }) # attribute\n else\n fields_values.merge!({ field => items.send(field) }) # method\n end\n end\n attrs[relation].merge!(fields_values)\n else # only index one field in the relation\n if items.attributes.keys.include?(fields.to_s)\n attrs[relation].merge!({ fields => items.attributes[fields.to_s] }) # attribute\n else\n attrs[relation].merge!({ fields => items.send(fields) }) # method\n end\n end\n end\n end \n \n # If embedded get the parent id\n if document.embedded?\n parent_id = document.send(document.class.embedded_parent_foreign_key.to_sym).id.to_s \n attrs[(document.class.embedded_parent_foreign_key + \"_id\").to_sym] = parent_id\n attrs[:_parent] = parent_id\n \n # Build add to the bulk query\n bulk_query << build_bulk_query(@slingshot_index_name, to_index.slingshot_type_name, document.id.to_s, attrs, parent_id)\n else\n # Build add to the bulk query\n bulk_query << build_bulk_query(@slingshot_index_name, to_index.slingshot_type_name, document.id.to_s, attrs)\n end\n end\n end\n else\n raise Mebla::Errors::MeblaIndexException.new(\"Could not create #{@slingshot_index_name}!!!\")\n end \n \n Mebla.log(\"Bulk indexing:\\n#{bulk_query}\", :debug) \n \n # Send the query\n response = Slingshot::Configuration.client.post \"#{Mebla::Configuration.instance.url}/_bulk\", bulk_query\n \n # Only refresh the index if no error ocurred\n unless response =~ /error/ \n # Log results\n Mebla.log(\"Indexed #{only_index.count} model(s) to #{self.slingshot_index_name}: #{response}\")\n Mebla.log(\"Indexing Report:\")\n indexed_count.each do |model_name, count|\n Mebla.log(\"Indexed #{model_name}: #{count} document(s)\")\n end\n \n # Refresh the index\n refresh_index\n else\n raise Mebla::Errors::MeblaIndexException.new(\"Indexing #{only_index.join(\", \")} failed with the following response:\\n #{response}\")\n end\n rescue RestClient::Exception => error\n raise Mebla::Errors::MeblaIndexException.new(\"Indexing #{only_index.join(\", \")} failed with the following error: #{error.message}\")\n end",
"def add\n puts \"Adding the following URL to the index: #{url}\".green\n update_attributes!(:title => title,\n :keywords => keywords,\n :created_at => Time.now,\n :updated_at => Time.now)\n end",
"def generate_text_sql\n ThinkingSphinx.context.indexed_models.each do |model|\n model = model.constantize\n model.define_indexes\n model.sphinx_indexes.each do |idx|\n idx.sources.each do |src|\n puts \"#{model.to_s} SQL => \"\n puts src.to_sql\n end\n end\n end\nend",
"def update\n puts \"Updating the following URL in the index: #{url}\".yellow\n keywords = nil\n title = nil\n update_attributes!(:title => title,\n :keywords => keywords,\n :updated_at => Time.now)\n\n end",
"def index(data_path, db_path)\n db = Xapian::WritableDatabase.new(db_path, Xapian::DB_CREATE_OR_OPEN)\n term_generator = Xapian::TermGenerator.new\n term_generator.stemmer = Xapian::Stem.new('en')\n parse_csv_file(data_path).each do |row|\n doc = Xapian::Document.new\n term_generator.document = doc\n term_generator.index_text(row['TITLE'].to_s, 1, 'S')\n term_generator.index_text(row['DESCRIPTION'].to_s, 1, 'XD')\n term_generator.index_text(row['TITLE'].to_s)\n term_generator.increase_termpos\n term_generator.index_text(row['DESCRIPTION'].to_s)\n\n ### Start of new indexing code.\n # Index the MATERIALS field, splitting on semicolons.\n row['MATERIALS'].to_s.split(';').each do |material|\n material.strip!\n material.downcase!\n doc.add_boolean_term(\"XM#{material}\") if material.length.positive?\n end\n ### End of new indexing code.\n\n doc.data = row.to_h.to_json\n idterm = \"Q#{row['id_NUMBER']}\"\n doc.add_boolean_term(idterm)\n db.replace_document(idterm, doc)\n end\nend",
"def index_fields\n\t\t\tif defined? @_index_fields\n\t\t\t\t@_index_fields\n\t\t\telse\n\t\t\t\t#column_names = self.column_names.map do |m|\n\t\t\t\t\t#m.to_sym\n\t\t\t\t#end\n\t\t\t\tsorted_attributes\n\t\t\t# \tsorted_attrs + (column_names - sorted_attrs - [\"created_at\", \"updated_at\", \"id\"])\n\t\t\tend\n\t\tend",
"def do_local_indexing(solr_doc); end",
"def update!(**args)\n @data_source = args[:data_source] if args.key?(:data_source)\n @display_url = args[:display_url] if args.key?(:display_url)\n @docid = args[:docid] if args.key?(:docid)\n @index_tier = args[:index_tier] if args.key?(:index_tier)\n @language_code = args[:language_code] if args.key?(:language_code)\n @latest_page_update_date = args[:latest_page_update_date] if args.key?(:latest_page_update_date)\n @navboost_query = args[:navboost_query] if args.key?(:navboost_query)\n @pagerank = args[:pagerank] if args.key?(:pagerank)\n @petacat_info = args[:petacat_info] if args.key?(:petacat_info)\n @salient_terms = args[:salient_terms] if args.key?(:salient_terms)\n @scholar_info = args[:scholar_info] if args.key?(:scholar_info)\n @spore_graph_mid = args[:spore_graph_mid] if args.key?(:spore_graph_mid)\n @title = args[:title] if args.key?(:title)\n @top_entity = args[:top_entity] if args.key?(:top_entity)\n @url = args[:url] if args.key?(:url)\n @webref_entity = args[:webref_entity] if args.key?(:webref_entity)\n end",
"def _addIndexes ( type, *list )\n type = type.to_s\n type.upcase!.gsub! /_/, ' '\n @attr_index_hints ||= [ ]\n # set the attr_index_hints for the last object in for_vals\n last_ind = @join_sources.length - 1\n @attr_index_hints[last_ind] = { :type => type, :list => SQLObject.get( list ) }\n @string = nil\n return self\n end",
"def build_xapian_index()\n models = [Request, Response]\n if ! $existing_db\n ActsAsXapian::WriteableIndex.rebuild_index(models, verbose=false)\n $existing_db = true\n end\n end",
"def update!(**args)\n @amarna_docid = args[:amarna_docid] if args.key?(:amarna_docid)\n @asr_language = args[:asr_language] if args.key?(:asr_language)\n @craps_data = args[:craps_data] if args.key?(:craps_data)\n @description = args[:description] if args.key?(:description)\n @doc_language = args[:doc_language] if args.key?(:doc_language)\n @duration_ms = args[:duration_ms] if args.key?(:duration_ms)\n @has_asr = args[:has_asr] if args.key?(:has_asr)\n @has_description_anchors = args[:has_description_anchors] if args.key?(:has_description_anchors)\n @is_safe = args[:is_safe] if args.key?(:is_safe)\n @is_watchpage = args[:is_watchpage] if args.key?(:is_watchpage)\n @navqueries = args[:navqueries] if args.key?(:navqueries)\n @nsr = args[:nsr] if args.key?(:nsr)\n @num_views = args[:num_views] if args.key?(:num_views)\n @pseudo_video_data = args[:pseudo_video_data] if args.key?(:pseudo_video_data)\n @saft_doc = args[:saft_doc] if args.key?(:saft_doc)\n @saft_transcript = args[:saft_transcript] if args.key?(:saft_transcript)\n @salient_term_set = args[:salient_term_set] if args.key?(:salient_term_set)\n @subindexid = args[:subindexid] if args.key?(:subindexid)\n @title = args[:title] if args.key?(:title)\n @title_language = args[:title_language] if args.key?(:title_language)\n @transcript_annotations = args[:transcript_annotations] if args.key?(:transcript_annotations)\n @unique_chrome_views = args[:unique_chrome_views] if args.key?(:unique_chrome_views)\n @url = args[:url] if args.key?(:url)\n @vertical_item = args[:vertical_item] if args.key?(:vertical_item)\n @video_genre = args[:video_genre] if args.key?(:video_genre)\n @video_type = args[:video_type] if args.key?(:video_type)\n @video_url = args[:video_url] if args.key?(:video_url)\n @webref_entities = args[:webref_entities] if args.key?(:webref_entities)\n end",
"def index!\n set_search_text!\n set_query_attributes!\n update_columns text: self.text, query: self.query\n end",
"def create_search_index\n #Notice the assoction on article.user.id\n TaggyMcFaggy.create_index :attribute_namespace => :article_text,\n :document_id => id,\n :words => text_content,\n :association => user.id\n \n end",
"def update!(**args)\n @deployed_index_id = args[:deployed_index_id] if args.key?(:deployed_index_id)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @deployed_index_id = args[:deployed_index_id] if args.key?(:deployed_index_id)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end",
"def update!(**args)\n @cdoc_build_info = args[:cdoc_build_info] if args.key?(:cdoc_build_info)\n @content_protected = args[:content_protected] if args.key?(:content_protected)\n @convert_to_roboted_reason = args[:convert_to_roboted_reason] if args.key?(:convert_to_roboted_reason)\n @crawl_status = args[:crawl_status] if args.key?(:crawl_status)\n @demotion_tags = args[:demotion_tags] if args.key?(:demotion_tags)\n @error_type = args[:error_type] if args.key?(:error_type)\n @freshdocs_corpora = args[:freshdocs_corpora] if args.key?(:freshdocs_corpora)\n @hostid = args[:hostid] if args.key?(:hostid)\n @ie_identifier = args[:ie_identifier] if args.key?(:ie_identifier)\n @image_indexing_info = args[:image_indexing_info] if args.key?(:image_indexing_info)\n @indexing_ts = args[:indexing_ts] if args.key?(:indexing_ts)\n @no_longer_canonical_timestamp = args[:no_longer_canonical_timestamp] if args.key?(:no_longer_canonical_timestamp)\n @normalized_click_score = args[:normalized_click_score] if args.key?(:normalized_click_score)\n @raw_navboost = args[:raw_navboost] if args.key?(:raw_navboost)\n @row_timestamp = args[:row_timestamp] if args.key?(:row_timestamp)\n @selection_tier_rank = args[:selection_tier_rank] if args.key?(:selection_tier_rank)\n @tracing_id = args[:tracing_id] if args.key?(:tracing_id)\n @url_changerate = args[:url_changerate] if args.key?(:url_changerate)\n @url_history = args[:url_history] if args.key?(:url_history)\n @url_pattern_signals = args[:url_pattern_signals] if args.key?(:url_pattern_signals)\n @video_indexing_info = args[:video_indexing_info] if args.key?(:video_indexing_info)\n end",
"def reindex!\n indexed if generate_solr_index\n end",
"def coerce_index_definition(defn)\n defn = coerce_symbolized_hash(defn)\n defn[:relvar] = coerce_name(defn[:relvar])\n defn[:attributes] = coerce_attribute_names(defn[:attributes], true)\n defn\n end",
"def update_in_index\n __elasticsearch__.index_document\n\n index_dependent_models.map(&:update_in_index)\n end",
"def update!(**args)\n @indexes = args[:indexes] if args.key?(:indexes)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @indexes = args[:indexes] if args.key?(:indexes)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def define_index_fields(owner: nil, &block)\n return unless block_given?\n _index_content_managers[index_name(owner)] ||= ContentManager.new\n _index_content_managers[index_name(owner)].add_definitions &block\n unless instance_methods(false).include? :_index_content_managers\n define_method(:_index_content_managers) { self.class._index_content_managers }\n end\n end",
"def set_index_comment(index_name, comment)\n\n end",
"def index_keywords!\n all.each { |d| d.index_keywords! }\n end",
"def build_index(params)\n index = Algolia::Index.new(self.subdomain)\n\n params.each do |tablename, getters|\n klass = Object.const_get(tablename.to_s.classify)\n\n klass.all.each do |record|\n object_params = {\"tablename\" => record.class.table_name,\n \"url\" => \"/#{self.class.table_name}/#{self.id}\"}\n\n getters.each{|getter| object_params[getter.to_s] = record.send(getter)}\n\n index.add_object(object_params)\n end\n end\n end",
"def indexes\n raise 'not implemented'\n end",
"def update!(**args)\n @annotated_phrase = args[:annotated_phrase] if args.key?(:annotated_phrase)\n @annotations = args[:annotations] if args.key?(:annotations)\n @author = args[:author] if args.key?(:author)\n @byline_date = args[:byline_date] if args.key?(:byline_date)\n @constituency_node = args[:constituency_node] if args.key?(:constituency_node)\n @constituency_root = args[:constituency_root] if args.key?(:constituency_root)\n @content_firstseen = args[:content_firstseen] if args.key?(:content_firstseen)\n @content_type = args[:content_type] if args.key?(:content_type)\n @contentage = args[:contentage] if args.key?(:contentage)\n @date = args[:date] if args.key?(:date)\n @docid = args[:docid] if args.key?(:docid)\n @entity = args[:entity] if args.key?(:entity)\n @entity_label = args[:entity_label] if args.key?(:entity_label)\n @focus_entity = args[:focus_entity] if args.key?(:focus_entity)\n @golden = args[:golden] if args.key?(:golden)\n @http_headers = args[:http_headers] if args.key?(:http_headers)\n @hyperlink = args[:hyperlink] if args.key?(:hyperlink)\n @labeled_spans = args[:labeled_spans] if args.key?(:labeled_spans)\n @language = args[:language] if args.key?(:language)\n @last_significant_update = args[:last_significant_update] if args.key?(:last_significant_update)\n @measure = args[:measure] if args.key?(:measure)\n @privacy_sensitive = args[:privacy_sensitive] if args.key?(:privacy_sensitive)\n @relation = args[:relation] if args.key?(:relation)\n @rpc_error = args[:rpc_error] if args.key?(:rpc_error)\n @semantic_node = args[:semantic_node] if args.key?(:semantic_node)\n @subsection = args[:subsection] if args.key?(:subsection)\n @syntactic_date = args[:syntactic_date] if args.key?(:syntactic_date)\n @text = args[:text] if args.key?(:text)\n @title = args[:title] if args.key?(:title)\n @token = args[:token] if args.key?(:token)\n @topic = args[:topic] if args.key?(:topic)\n @trace = args[:trace] if args.key?(:trace)\n @url = args[:url] if args.key?(:url)\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @deployed_indexes = args[:deployed_indexes] if args.key?(:deployed_indexes)\n @description = args[:description] if args.key?(:description)\n @display_name = args[:display_name] if args.key?(:display_name)\n @etag = args[:etag] if args.key?(:etag)\n @index_stats = args[:index_stats] if args.key?(:index_stats)\n @index_update_method = args[:index_update_method] if args.key?(:index_update_method)\n @labels = args[:labels] if args.key?(:labels)\n @metadata = args[:metadata] if args.key?(:metadata)\n @metadata_schema_uri = args[:metadata_schema_uri] if args.key?(:metadata_schema_uri)\n @name = args[:name] if args.key?(:name)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def index_definition_sql(table_name, index)\n\t raise Error, \"Partial indexes are not supported for this database\" if index[:where]\n\n\t # Basic index creation DDL.\n\t sql = [\"CREATE\"]\n\t case index[:type]\n\t when :bitmap\n\t\t raise Error, \"Bitmap indexes cannot be unique\" if index[:unique]\n\t sql << 'BITMAP'\n\t when NilClass, :normal\n\t sql << 'UNIQUE' if index[:unique]\n\t else\n\t raise Error, \"Index type #{index[:type].inspect} is not supported for this database\"\n\t end\n\t index_name = index[:name] || default_index_name(table_name, index[:columns])\n\t qualified_table_name = quote_schema_table table_name\n\t sql << \"INDEX #{quote_identifier(index_name)} ON #{qualified_table_name}\"\n\t \n\t # Index columns and join indexes.\n index_join, index_columns = *index.values_at(:join,:columns)\n\t sql << literal(index_columns)\n if index_join\n\t\t raise Error, \"Join clauses are only supported for bitmap indexes\" if index[:type]!=:bitmap\n\t\t sql << \"FROM #{qualified_table_name},\"\n\t\t sql << index_columns.map{|k| quote_identifier schema_and_table(k).first }.uniq.join(', ')\n\t\t \n\t\t # TODO: Document this short-hand syntax: {:columns=>[:ref_table__ref_column], :join=>[:fk_column]}\n if Array===index_join and index_join.length==index_columns.length and index_join.all?{|k| Symbol===k}\n index_join = Hash[ index_join.map{|k| :\"#{table_name}__#{k}\" }.zip(index_columns) ]\n end\n\n\t sql << \"WHERE #{filter_expr(index_join)}\"\n\t end\n\t \n\t # Index attributes and options.\n\t sql << 'LOCAL' if index[:partitioned]\n\t sql << flag_option_sql(index, :parallel)\n\t sql << flag_option_sql(index, :logging)\n\t sql << \"TABLESPACE #{quote_identifier(index[:tablespace])}\" if index[:tablespace]\n\t sql << flag_option_sql(index, :visible, 'INVISIBLE')\n\t sql << compress_option_sql(index)\n\t sql << index[:options] if String === index[:options]\n\t sql << 'UNUSABLE' if FalseClass === index[:valid]\n\t sql.compact.join ' '\n\t end",
"def enqueue_sphinx_index_for_class\n self.class.enqueue_sphinx_index\n end",
"def index_keywords!\n all.each { |d| d.index_keywords! ? MongoidSearch::Log.green(\".\") : MongoidSearch::Log.red(\"F\") }\n end",
"def define_index_field options = {}\n @params = {}\n\n @action = 'define_index_field'\n locals = Locals.fetch(action)\n options = check_required_fields(options, locals)\n\n build_params(locals, options)\n send_auth_request\n end",
"def as_index_document()\n doc = {'format'=>'Node', 'title'=> title, 'id' => persistent_id, 'version'=>id, 'model' => model.id, 'model_name' => model.name, 'pool' => pool_id}\n doc.merge!(solr_attributes)\n doc.merge!(solr_associations)\n doc\n end",
"def new_index_for(clazz, models)\n aaf_configuration = clazz.aaf_configuration\n ferret_cfg = aaf_configuration[:ferret].dup\n ferret_cfg.update :auto_flush => false, \n :create => true,\n :field_infos => clazz.aaf_index.field_infos(models),\n :path => File.join(aaf_configuration[:index_base_dir], 'rebuild')\n Ferret::Index::Index.new ferret_cfg\n end",
"def build_index\n reset @store.all_files.sort, @store.all_classes_and_modules.sort\n\n index_classes\n index_methods\n index_pages\n\n { :index => @index }\n end",
"def build_indexes\n Schema::Physical::Indexes.new\n end",
"def build_index!(&block)\n entries_added = do_build_index(&block) unless built?\n\n #make the hash from abbreviated parts of speech to full definitions\n @pos_hash ||= build_pos_hash\n\n entries_added\n end",
"def build_index!\n puts \"build_index!\"\n @indexes = {}\n \n @indexes = @resource_class.build_indexes(@resources)\n @indexes[:_default] ||= @default_order\n end",
"def index_information\n @db.index_information(@name)\n end",
"def solr_during_indexing\n {\n \"has_model_ssim\" => [\"Collection\"],\n :id => object.id,\n \"title_tesim\" => [object.title.first.to_s],\n \"title_sim\" => [object.title.first.to_s],\n \"collection_type_gid_ssim\" => [object.collection_type_gid],\n \"ark_ssi\" => object.ark,\n \"ursus_id_ssi\" => Californica::IdGenerator.blacklight_id_from_ark(object.ark),\n \"member_ids_ssim\" => [],\n \"object_ids_ssim\" => [],\n \"member_of_collection_ids_ssim\" => [], \"collection_ids_ssim\" => [],\n \"generic_type_sim\" => [\"Collection\"],\n \"bytes_lts\" => 0,\n \"visibility_ssi\" => \"restricted\"\n }\n end",
"def elastic_index(options = {})\n \n options.symbolize_keys!\n Escargot.register_model(self)\n \n if respond_to?('single_collection_inherited?') and single_collection_inherited?\n ivars = %w[@index_name @update_index_policy @index_options @indexing_options @mapping @current_schema_version @previous_schema_version]\n ivars.each do |ivar|\n if passed_option = options[ivar[1..-1].to_sym]\n instance_variable_set ivar, passed_option\n else\n instance_variable_set ivar, superclass.instance_variable_get(ivar)\n end\n end\n else\n @index_name = options[:index_name] || self.name.underscore.gsub(/\\//,'-')\n @update_index_policy = options.include?(:updates) ? options[:updates] : :immediate\n \n if @update_index_policy\n after_save :update_index\n after_destroy :delete_from_index\n end\n \n @index_options = options[:index_options] || {}\n @indexing_options = options[:indexing_options] || {}\n @mapping = options[:mapping] || false\n @current_schema_version = options[:current_schema_version] || \"0\"\n @previous_schema_version = options[:previous_schema_version] || \"0\"\n end\n \n end",
"def setting_index\n end",
"def _addIndexes ( type, *list )\n type = type.to_s\n type.upcase!.gsub! /_/, ' '\n @attr_index_hints ||= [ ]\n # set the attr_index_hints for the last object in for_vals\n last_ind = @attr_from.val.length - 1\n @attr_index_hints[last_ind] = { :type => type, :list => SQLObject.get( list ) }\n @string = nil\n return self\n end",
"def update_index\n all.each do |n|\n n.update_index\n end\n end",
"def index\n set_index_posts\n end",
"def index(model, instance = nil)\n return true if skip? instance\n\n self.class.enqueue(\n FlyingSphinx::IndexRequest.new(model.delta_index_names, true),\n delayed_job_priority\n )\n\n self.class.enqueue_without_duplicates_check(\n FlyingSphinx::FlagAsDeletedJob.new(\n model.core_index_names, instance.sphinx_document_id\n ),\n delayed_job_priority\n ) if instance\n\n true\n end",
"def initialize\n super\n @source = Riddle::Configuration::XMLSource.new(:source, :xmlpipe2)\n @index = Riddle::Configuration::Index.new(:index, @source)\n @file = OpenStruct.new(output_path: \"./sphinx.conf\")\n @static_indexes = {}\n @generated_indexes = {}\n end",
"def index(*rel_type_props)\n if rel_type_props.size == 2 and rel_type_props[1].kind_of?(Hash)\n rel_type_props[1].each_pair do |key,value|\n idx = rel_type_props[0]\n lucene_index.field_infos[idx.to_sym][key] = value\n end\n rel_type_props = rel_type_props[0..0]\n end\n rel_type_props.each do |rel_type_prop|\n rel_type, prop = rel_type_prop.to_s.split('.')\n index_property(rel_type) if prop.nil?\n index_relation(rel_type_prop, rel_type, prop) unless prop.nil?\n end\n end",
"def index_csv(data_path, db_path)\n db = Xapian::WritableDatabase.new(db_path, Xapian::DB_CREATE_OR_OPEN)\n term_generator = Xapian::TermGenerator.new\n term_generator.stemmer = Xapian::Stem.new('en')\n parse_csv_file(data_path).each do |row|\n doc = Xapian::Document.new\n term_generator.document = doc\n term_generator.index_text(row['TITLE'].to_s, 1, 'S')\n term_generator.index_text(row['DESCRIPTION'].to_s, 1, 'XD')\n term_generator.index_text(row['TITLE'].to_s)\n term_generator.increase_termpos\n term_generator.index_text(row['DESCRIPTION'].to_s)\n doc.data = row.to_h.to_json\n idterm = \"Q#{row['id_NUMBER']}\"\n doc.add_boolean_term(idterm)\n db.replace_document(idterm, doc)\n end\nend",
"def update!(**args)\n @deployed_index_id = args[:deployed_index_id] if args.key?(:deployed_index_id)\n @index_endpoint = args[:index_endpoint] if args.key?(:index_endpoint)\n end",
"def index\n set_index\n end",
"def index_information\n @db.index_information(@name)\n end",
"def update!(**args)\n @canonical_docid = args[:canonical_docid] if args.key?(:canonical_docid)\n @docid = args[:docid] if args.key?(:docid)\n @image_index = args[:image_index] if args.key?(:image_index)\n @query_index = args[:query_index] if args.key?(:query_index)\n end",
"def definition(table_name)\n\n if unique?\n \" add_index :#{table_name}, #{index_columns}, :unique => true\"\n else\n \" add_index :#{table_name}, #{index_columns}\"\n end\n end",
"def add_to_index(wiki, index, sha, files)\n end",
"def index_fields=(fields)\n @index_fields = ::ActiveSupport::HashWithIndifferentAccess.new fields\n end",
"def update!(**args)\n @name = args[:name] unless args[:name].nil?\n @index_keys = args[:index_keys] unless args[:index_keys].nil?\n end",
"def add_index(*fields)\n @add_indexed_field = fields\n end",
"def process_index\n bindings = {\n :url => @definition.get_url,\n :name => @definition.get_name,\n :resources => @definition.resources,\n :description => @definition.get_description,\n :version => @definition.get_version\n }\n\n page = Calamum::DocGenerator.new(:index)\n page.save_template('index.html', bindings)\n end",
"def after_update\n super\n self.class.call_es { _index_document }\n end",
"def update!(**args)\n @indexed = args[:indexed] if args.key?(:indexed)\n @submitted = args[:submitted] if args.key?(:submitted)\n @type = args[:type] if args.key?(:type)\n end",
"def index_signature; end",
"def update_search_index(name, updates)\n index = @data[:search_indexes][name] ||= {:name => name, :n_val => 3}\n index[:schema] = updates\n true\n end",
"def add_indexes\n if hereditary? && !index_options[{ _type: 1 }]\n index({ _type: 1 }, { unique: false, background: true })\n end\n true\n end",
"def index\r\n build_index unless @index\r\n @index\r\n end",
"def define_index_args(query, args)\n args = { controller: :observations,\n action: :index,\n matrix: true,\n include: [:name, :location, :user, :rss_log,\n { thumb_image: :image_votes }] }.merge(args)\n\n # Add some alternate sorting criteria.\n links = [\n [\"name\", :sort_by_name.t],\n [\"date\", :sort_by_date.t],\n [\"user\", :sort_by_user.t],\n [\"created_at\", :sort_by_posted.t],\n [(query.flavor == :by_rss_log ? \"rss_log\" : \"updated_at\"),\n :sort_by_updated_at.t],\n [\"confidence\", :sort_by_confidence.t],\n [\"thumbnail_quality\", :sort_by_thumbnail_quality.t],\n [\"num_views\", :sort_by_num_views.t]\n ]\n args[:sorting_links] = links\n\n # Paginate by letter if sorting by user.\n case query.params[:by]\n when \"user\", \"reverse_user\"\n args[:letters] = \"users.login\"\n # Paginate by letter if sorting by name.\n when \"name\", \"reverse_name\"\n args[:letters] = \"names.sort_name\"\n end\n args\n end",
"def index ; @index ; end",
"def update_index\n SolrService.add(to_solr, softCommit: true)\n end",
"def update!(**args)\n @index = args[:index] if args.key?(:index)\n @type = args[:type] if args.key?(:type)\n end",
"def update_tank_indexes\n if tanker_indexable?\n tanker_config.index.add_document(\n it_doc_id, tanker_index_data, tanker_index_options\n )\n else\n delete_tank_indexes\n end\n end",
"def setup_index\n @index_driver.setup_index\n end",
"def reindex!\n logger.debug \"Updating #{self.name} (#{self.id}) to Solr directly...\"\n indexed if generate_solr_index\n end",
"def update_custom_properties\n # properties\n properties = %w[Accuracy VesselName VesselType PhotoSize PhotoPerson Comment] # matches name of concern so camelized\n\n models = %w[photograph] # matches file_name so underscore\n models.each do |m|\n file_text = File.read(\"app/models/#{m}.rb\")\n properties.each do |p|\n next if file_text.include? p\n inject_into_file \"app/models/#{m}.rb\", after: 'WorkBehavior' do\n \"\\n include DogBiscuits::#{p}\"\n end\n end\n end\n\n #Add lat long which needs to be indexed but is part of the Geo concern so not required to be processed above\n properties = %w[Accuracy VesselName VesselType PhotoSize PhotoPerson Comment LatLong RightsHolder GeonameId BibliographicCitation]\n\n # solr_doc\n properties.each do |p|\n solr_doc = \"\\n attribute :#{p.underscore.downcase}, Solr::Array, solr_name('#{p.underscore.downcase}')\\n\"\n next if File.read('app/models/solr_document.rb').include? p.underscore.downcase\n inject_into_file 'app/models/solr_document.rb', before: \"\\nend\\n\" do\n solr_doc\n end\n end\n end",
"def supports_index_include?\n false\n end",
"def update_es_index\n \n if self.respond_to? :op_success\n \n if self.op_success.nil?\n \n es_update\n else\n \n es_update if self.op_success == true\n end\n else\n \n es_update\n end\n \n end",
"def update!(**args)\n @entity_index = args[:entity_index] if args.key?(:entity_index)\n @is_head_component = args[:is_head_component] if args.key?(:is_head_component)\n @mention_index = args[:mention_index] if args.key?(:mention_index)\n @segment_mentions_index = args[:segment_mentions_index] if args.key?(:segment_mentions_index)\n end",
"def index_versions!\n Rails.logger.info \"Updating Solr docs with Version data at #{Time.zone.now}\"\n Version.all.each do |version|\n names = (version.imported_metadata['related_name_display'] || []) + (version.imported_metadata['author_display'] || []).uniq\n update_related_names(version.book.digital_cico_number, names) if names.present?\n end\n solr.commit\n Rails.logger.info \"Done updating Solr docs with Version data at #{Time.zone.now}\"\n end",
"def update!(**args)\n @extra = args[:extra] if args.key?(:extra)\n @general_extra = args[:general_extra] if args.key?(:general_extra)\n @index = args[:index] if args.key?(:index)\n @value = args[:value] if args.key?(:value)\n end",
"def update!(**args)\n @extra = args[:extra] if args.key?(:extra)\n @general_extra = args[:general_extra] if args.key?(:general_extra)\n @index = args[:index] if args.key?(:index)\n @value = args[:value] if args.key?(:value)\n end",
"def index(model)\n model.index\n ElasticMapper.index.refresh\nend",
"def generate_solr_document\n super.tap do |solr_doc|\n index_suppressed(solr_doc)\n index_workflow_fields(solr_doc)\n end\n end",
"def indexed=(val)\n self['indexed'] = 'val'\n end",
"def index_options\n return false unless index && index == entity.key_column\n if entity.is_core\n { unique: true }\n else\n true\n end\n end",
"def update!(**args)\n @anchor = args[:anchor] if args.key?(:anchor)\n @homepage_anchors_dropped = args[:homepage_anchors_dropped] if args.key?(:homepage_anchors_dropped)\n @index_tier = args[:index_tier] if args.key?(:index_tier)\n @local_anchors_dropped = args[:local_anchors_dropped] if args.key?(:local_anchors_dropped)\n @nonlocal_anchors_dropped = args[:nonlocal_anchors_dropped] if args.key?(:nonlocal_anchors_dropped)\n @redundant_anchors_dropped = args[:redundant_anchors_dropped] if args.key?(:redundant_anchors_dropped)\n @redundantanchorinfo = args[:redundantanchorinfo] if args.key?(:redundantanchorinfo)\n @supplemental_anchors_dropped = args[:supplemental_anchors_dropped] if args.key?(:supplemental_anchors_dropped)\n @target_docid = args[:target_docid] if args.key?(:target_docid)\n @target_site = args[:target_site] if args.key?(:target_site)\n @target_url = args[:target_url] if args.key?(:target_url)\n end",
"def add_to_index posts\n indexDir = java.io.File.new(@index_dir);\n writer = IndexWriter.new(indexDir, StandardAnalyzer.new, !File.exists?(indexDir.absolute_path))\n posts.each do |post|\n writer.updateDocument(Term.new(\"id\",post[:id]),create_lucene_document(post))\n @last_id = post[:id]\n @log.debug \"added post ##{post[:id]}\"\n end \n writer.optimize\n writer.close\n @log.info \"added #{posts.size} documents to index\"\n end",
"def add_index_fields_to_qf(solr_parameters, user_parameters)\n solr_parameters[:qf] ||= []\n solr_parameters[:qf] << 'title'\n blacklight_config.index_fields.each do |field_name, obj|\n solr_parameters[:qf] << field_name\n end\n end",
"def add_index_fields_to_qf(solr_parameters, user_parameters)\n solr_parameters[:qf] ||= []\n solr_parameters[:qf] << 'title'\n blacklight_config.index_fields.each do |field_name, obj|\n solr_parameters[:qf] << field_name\n end\n end",
"def update!(**args)\n @features_index = args[:features_index] if args.key?(:features_index)\n @queries_index = args[:queries_index] if args.key?(:queries_index)\n end",
"def update!(**args)\n @field_name = args[:field_name] if args.key?(:field_name)\n @index = args[:index] if args.key?(:index)\n end",
"def safe_add_index(*args, **options); end",
"def update!(**args)\n @index = args[:index] if args.key?(:index)\n end",
"def update!(**args)\n @index = args[:index] if args.key?(:index)\n end",
"def update!(**args)\n @index = args[:index] if args.key?(:index)\n end",
"def update!(**args)\n @index = args[:index] if args.key?(:index)\n end"
] | [
"0.6742292",
"0.63079053",
"0.62691176",
"0.6195474",
"0.61248267",
"0.6117683",
"0.60501474",
"0.6040059",
"0.6006835",
"0.60011077",
"0.59949535",
"0.5987425",
"0.59833694",
"0.59769386",
"0.5947855",
"0.59453726",
"0.59413254",
"0.5932856",
"0.5920413",
"0.5898849",
"0.58919984",
"0.58919984",
"0.58693916",
"0.58623666",
"0.5847118",
"0.584413",
"0.58422834",
"0.58422834",
"0.58383787",
"0.58244836",
"0.5820046",
"0.5816354",
"0.57987714",
"0.5795693",
"0.5784276",
"0.5779938",
"0.5779454",
"0.5779077",
"0.57710314",
"0.5770949",
"0.57688236",
"0.57664853",
"0.576469",
"0.57615185",
"0.5752705",
"0.5748467",
"0.5735375",
"0.57324946",
"0.5727774",
"0.5718953",
"0.5715751",
"0.57134396",
"0.5706075",
"0.5691465",
"0.56878346",
"0.5687144",
"0.56705266",
"0.5669849",
"0.5669429",
"0.5659345",
"0.56540006",
"0.56459105",
"0.563859",
"0.56381315",
"0.56361717",
"0.5627833",
"0.5624971",
"0.56194293",
"0.5607273",
"0.5601445",
"0.55997497",
"0.559951",
"0.55934024",
"0.5585302",
"0.5583508",
"0.5581047",
"0.5577653",
"0.55731475",
"0.5571082",
"0.556727",
"0.55583864",
"0.55490804",
"0.55483717",
"0.55454326",
"0.55451715",
"0.55451715",
"0.5543088",
"0.55364823",
"0.55346495",
"0.5527829",
"0.55277014",
"0.5523798",
"0.5519599",
"0.5519599",
"0.55191445",
"0.55078113",
"0.5506624",
"0.5497037",
"0.5497037",
"0.5497037",
"0.5497037"
] | 0.0 | -1 |
GET /sites GET /projects/:project_id/sites | def index
do_authorize_class
get_project_if_exists
do_authorize_instance(:show, @project) unless @project.nil?
respond_to do |format|
#format.html # index.html.erb
format.json do
@sites, opts = Settings.api_response.response_advanced(
api_filter_params,
list_permissions,
Site,
Site.filter_settings
)
respond_index(opts)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\n @project = Project.find(params[:project_id])\n @site = @project.sites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def show\n @project = Project.find(params[:id])\n @sites = @project.spans\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def list\n get 'projects'\n end",
"def index\n @sites = Cms::Site.all\n end",
"def index\n @sites = Site.all\n end",
"def index\n @sites = Site.all\n end",
"def index\n @sites = Site.all\n end",
"def index\n @sites = Site.all\n end",
"def index\n @sites = Site.all\n end",
"def index\n @sites = Site.all\n end",
"def index\n @sites = User.find(current_user.id).sites #Site.find(\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end",
"def all_viewable_sites\n Site\n .current\n .with_project_or_as_site_user(all_viewable_projects.select(:id), id)\n end",
"def index\n @user = self.current_user\n @sites = @user.find_sites(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @sites.to_xml }\n end\n end",
"def index\n @sites = current_user.sites.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def index\n @sites = @organization.sites.order(id: :desc).all\n end",
"def projects\n resource 'projects'\n end",
"def index\n @site=Site.find(params[:site_id])\n end",
"def index\n @servers = @site.servers\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def show\n @site = Site.find(params[:id])\n @user = @site.user\n @project = @site.project\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def index\n @sprojects = Sproject.all\n end",
"def index\n @sites = current_user.sites\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end",
"def index\n @sites = current_user.sites\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end",
"def index\n @study_sites = StudySite.all\n end",
"def get_sites\n\t\ts = get_admin_section \"system.applicationHost/sites\"\n\t IisObjectCollection.new s.Collection, :site, Site, lambda { |site| site.id = s.Collection.Count + 1 }\n end",
"def index\n @websites = Website.where(client_id: current_client.uuid) \n end",
"def index\n if current_user.school\n @projects = current_user.school.projects\n elsif current_user.site\n @projects = current_user.site.projects\n else\n @projects = Project.all\n end\n @projects = @projects.order('updated_at DESC', 'id DESC').limit(400)\n end",
"def projects\n records \"project\", \"/project/list\"\n end",
"def index\n @sites = Site.all.paginate(page: params[:page])\n end",
"def index\n @mysites = Mysite.all\n end",
"def index\n \n @workspaces = current_user.workspaces\n # debugger\n @projects = Project.where(:workspace_id => @workspace)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def show\n @projects = find_projects\n end",
"def index\n set_user\n @sites = Site.all\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites.to_json }\n end\n end",
"def index\n @sites = fetch_sites\n\n @formattedSites = @sites.map do |site|\n {\n 'title' => {'value' => site.name, 'link' => { 'url' => site.routes.first.host_with_scheme, 'external' => true}, 'searchable' => true, 'sortable' => true},\n 'template' => {'value' => site.site_template&.name, 'searchable' => true, 'sortable' => true},\n 'preview' => {'value' => site.routes.first.host_with_scheme, 'link' => { 'url' => site.routes.first.host_with_scheme, 'external' => true}, 'searchable' => true, 'sortable' => true},\n 'edit' => {'value' => edit_admin_site_site_step_path(site_slug: site.slug, id: :name), 'method' => 'get'},\n 'delete' => {'value' => admin_site_path(slug: site.slug), 'method' => 'delete'}\n }\n end\n\n gon.sites = @formattedSites\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites }\n end\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def index\n @services = SystemSiteMap.where(:system_site_map_id => 2)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def index\n @websites = Website.all\n end",
"def index\n @websites = Website.all\n end",
"def index\n @websites = Website.all\n end",
"def index\n @projects = current_power.projects\n end",
"def index\n respond_to do |format|\n format.html do \n @sites = Site.all\n end\n format.json do\n render json: Site.all\n end\n end\n end",
"def index\n @projects = current_institute.projects\n end",
"def index\n @site = Site.find(params[:site_id])\n @visits = @site.visits\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @visits }\n end\n end",
"def index\n @parsed_sites = ParsedSite.all\n\n render json: @parsed_sites\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end",
"def projects\n Sifter.\n get(\"/api/projects\").\n parsed_response[\"projects\"].\n map { |p| Sifter::Project.new(p) }\n end",
"def get_sites_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.get_sites ...'\n end\n # resource path\n local_var_path = '/api/3/sites'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'PageOfSite')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_sites\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def sites; end",
"def sites; end",
"def sites; end",
"def sites; end",
"def sites; end",
"def index\n @project_environments = @project.project_environments.all\n end",
"def show\n @site = Site.find(params[:id])\n end",
"def get_sites_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.get_sites ...\"\n end\n # resource path\n local_var_path = \"/api/3/sites\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'PageOfSite')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_sites\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def project_url project_id\n server = lookup_server_from_project(project_id)\n pivotal_url = server[:url]\n { :url => \"#{pivotal_url}/projects/#{project_id}\", :token => server[:token] }\nend",
"def index\n @all_projects = Project.by_user_plan_and_tenant(params[:tenant_id], current_user)\n end",
"def index\n @optimized_sites = OptimizedSite.all\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html { render :template => \"admin_sites/index\" }\n format.xml { render :xml => @sites }\n end\n end",
"def index\n @projects = @projects.includes(:latest_iteration).where(:tenant_id => current_user.tenant).order(\"name\").page(params[:page]).per(DEFAULT_ROWS_PER_PAGE)\n\n respond_with @projects\n end",
"def index\n @sites = site_list_plus_default\n @site_vars = site_vars\n @_sites = Site.all\n @_site_vars = SiteVar.all\n \n unless params[:_site].blank?\n unless params[:_site] == \"0\"\n @site = Site.find(params[:_site])\n else # a little hackery to get around the fact that our default site can't be looked up\n @site = Site.new\n @site.id = 0\n end\n end\n unless params[:site_var].blank?\n @site_var = SiteVar.find(params[:site_var])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @site_vars }\n end\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @projects = Project.all\n end",
"def index\n @sites = Site.paginate(:page=>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def index\n #@site_pages = SitePage.all\n end",
"def index\n #@projects = Project.all\n end",
"def show\n @projects = Project.all\n end",
"def all_editable_sites\n Site.current.with_project_or_as_site_editor(all_projects.select(:id), id)\n end",
"def sites\n @sites ||= []\n end",
"def index\n \t@projects = Project.all\n end",
"def listprojects\n get('listprojects.json')['projects']\n end",
"def index\n @dynamic_project_pages = DynamicProjectPage.all\n end",
"def index\n\t\t@projects = Project.all\n\tend",
"def projectinfo_for(p)\n res = sitemap.find_resource_by_page_id(\"projectinfo/#{project_slug(p)}\")\n if res\n return res.render\n end\n end",
"def index\n @sites = Site.where(:reference => false, :page_rank.gt => -1).sort(:name).all\n @reference_sites = Site.where(:reference => true).sort(:name).all\n respond_with(@sites)\n end",
"def stories_url project_id\n server = lookup_server_from_project(project_id)\n pivotal_url = server[:url]\n { :url => \"#{pivotal_url}/projects/#{project_id}/stories\", :token => server[:token] }\nend"
] | [
"0.69330496",
"0.6869819",
"0.67282987",
"0.66814977",
"0.6619648",
"0.6619648",
"0.6619648",
"0.6619648",
"0.6619648",
"0.6619648",
"0.6587409",
"0.65140283",
"0.6482919",
"0.6440983",
"0.64348024",
"0.63573444",
"0.6350226",
"0.6339367",
"0.632594",
"0.632594",
"0.63254887",
"0.63228905",
"0.6244328",
"0.6244328",
"0.62175685",
"0.6212348",
"0.62114984",
"0.619701",
"0.6191642",
"0.61857444",
"0.61835444",
"0.61821723",
"0.6162336",
"0.6137613",
"0.612332",
"0.6115555",
"0.6101466",
"0.60862523",
"0.60862523",
"0.60862523",
"0.6049422",
"0.6029962",
"0.6004376",
"0.59914535",
"0.5990615",
"0.598366",
"0.598366",
"0.598366",
"0.598366",
"0.598366",
"0.5983098",
"0.59785795",
"0.59783816",
"0.59783816",
"0.59783816",
"0.59783816",
"0.59783816",
"0.59672177",
"0.59576684",
"0.59576195",
"0.5947603",
"0.5928516",
"0.5922854",
"0.59193015",
"0.5916545",
"0.5894354",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.5890681",
"0.589013",
"0.58845943",
"0.58831406",
"0.5874883",
"0.5874648",
"0.58739406",
"0.5863595",
"0.5859172",
"0.5853527",
"0.5852359",
"0.5844808",
"0.5832117",
"0.5827727",
"0.5824184"
] | 0.6307397 | 22 |
GET /sites/:id GET /projects/:project_id/sites/:id | def show
do_load_resource
get_project_if_exists
do_authorize_instance
respond_to do |format|
format.html { @site }
format.json { respond_show }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\n @project = Project.find(params[:project_id])\n @site = @project.sites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def show\n @project = Project.find(params[:id])\n @sites = @project.spans\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def index\n @site=Site.find(params[:site_id])\n end",
"def show\n @site = Site.find(params[:id])\n @user = @site.user\n @project = @site.project\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def show\n @site = Site.find(params[:id])\n end",
"def index\n @sites = User.find(current_user.id).sites #Site.find(\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end",
"def show\n respond_with(@site = Site.find(params[:id]))\n end",
"def index\n @sites = Site.all\n end",
"def index\n @sites = Site.all\n end",
"def index\n @sites = Site.all\n end",
"def index\n @sites = Site.all\n end",
"def index\n @sites = Site.all\n end",
"def index\n @sites = Site.all\n end",
"def index\n @websites = Website.where(client_id: current_client.uuid) \n end",
"def index\n @sites = @organization.sites.order(id: :desc).all\n end",
"def index\n @user = self.current_user\n @sites = @user.find_sites(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @sites.to_xml }\n end\n end",
"def all_viewable_sites\n Site\n .current\n .with_project_or_as_site_user(all_viewable_projects.select(:id), id)\n end",
"def url\n \"#{@client.site_url}/#{id}\"\n end",
"def index\n @sites = Cms::Site.all\n end",
"def show\n @sitecity = Sitecity.find_by_url(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitecity }\n end\n end",
"def index\n @sites = current_user.sites.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def list\n get 'projects'\n end",
"def show\n @site = Site.find(params[:id])\n\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n \n end\n end",
"def get_site(state_params)\n Site.find(state_params[\"site_id\"])\n end",
"def show\n @website = Website.find(params[:id])\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @site }\n end\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end",
"def show\n\n @project = Project.find_by_slug(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def project(project_id)\n resource \"projects/#{project_id}\"\n end",
"def show\n # turn ruby database into json\n # route to the project 3 page with this json\n # id = 1\n end",
"def show\n @subsite = Subsite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subsite }\n end\n end",
"def resource\n @project ||= Project.find_by_slug!(params[:id])\n end",
"def projects\n resource 'projects'\n end",
"def project_url project_id\n server = lookup_server_from_project(project_id)\n pivotal_url = server[:url]\n { :url => \"#{pivotal_url}/projects/#{project_id}\", :token => server[:token] }\nend",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def projectinfo_for(p)\n res = sitemap.find_resource_by_page_id(\"projectinfo/#{project_slug(p)}\")\n if res\n return res.render\n end\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_project\n @project = Project.where(url: params[:project_id]).first\n end",
"def index\n @site = Site.find(params[:site_id])\n @visits = @site.visits\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @visits }\n end\n end",
"def show\n @site = Site.find(params[:site_id])\n @visit = Visit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @visit }\n end\n end",
"def index\n @services = SystemSiteMap.where(:system_site_map_id => 2)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site_url\n @site_url = SiteUrl.find(params[:id]) if params[:id]\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html { render :template => \"admin_sites/show\" }\n format.xml { render :xml => @site }\n end\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @site }\n format.xml { render :xml => @site }\n end\n end",
"def index\n @sites = current_user.sites\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end",
"def index\n @sites = current_user.sites\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end",
"def index\n @sites = Site.all.paginate(page: params[:page])\n end",
"def show\n\n \n @projects = Project.select(\"all\").where(:project_id => params[:id]);\n \n end",
"def index\n @sites = fetch_sites\n\n @formattedSites = @sites.map do |site|\n {\n 'title' => {'value' => site.name, 'link' => { 'url' => site.routes.first.host_with_scheme, 'external' => true}, 'searchable' => true, 'sortable' => true},\n 'template' => {'value' => site.site_template&.name, 'searchable' => true, 'sortable' => true},\n 'preview' => {'value' => site.routes.first.host_with_scheme, 'link' => { 'url' => site.routes.first.host_with_scheme, 'external' => true}, 'searchable' => true, 'sortable' => true},\n 'edit' => {'value' => edit_admin_site_site_step_path(site_slug: site.slug, id: :name), 'method' => 'get'},\n 'delete' => {'value' => admin_site_path(slug: site.slug), 'method' => 'delete'}\n }\n end\n\n gon.sites = @formattedSites\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites }\n end\n end",
"def index\n redirect_to Project.find(params[:project_id])\n end",
"def show\n add_breadcrumb \"all\", nil, \"glyphicon-screenshot\"\n\n @site = Site.find(id_from_params)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end",
"def show\n respond_to do |format|\n format.html do \n set_site\n @site\n end\n format.json do\n render json: @site\n end\n end\n end",
"def index\n @study_sites = StudySite.all\n end",
"def show\n @workspaces = current_user.workspaces\n @project = Project.find(params[:id])\n @workspace = Workspace.find(params[:workspace_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def index\n set_user\n @sites = Site.all\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites.to_json }\n end\n end",
"def set_page\n @site_page = SitePage.find(params[:id])\n @site = @site_page.site\n end",
"def index\n @sprojects = Sproject.all\n end",
"def set_site\n @site = current_account.sites.find(params[:site_id]) if params[:site_id]\n end",
"def show\n @projects = find_projects\n end",
"def stories_url project_id\n server = lookup_server_from_project(project_id)\n pivotal_url = server[:url]\n { :url => \"#{pivotal_url}/projects/#{project_id}/stories\", :token => server[:token] }\nend",
"def show\n @info = Info.find(params[:id])\n @subproject = @info.subproject\n @project = @subproject.project\n end",
"def set_project\n @project = Project.find_by(url_slug: params[:url_slug])\n end",
"def set_site\n @site = Cms::Site.find(params[:id])\n end",
"def get_sites\n\t\ts = get_admin_section \"system.applicationHost/sites\"\n\t IisObjectCollection.new s.Collection, :site, Site, lambda { |site| site.id = s.Collection.Count + 1 }\n end",
"def set_site\n @site = Xmt::Press::Site.find(params[:id])\n end",
"def show\n @project = Project.find(params[:project_id])\n @subproject = Subproject.find(params[:id])\n end",
"def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def index\n if current_user.school\n @projects = current_user.school.projects\n elsif current_user.site\n @projects = current_user.site.projects\n else\n @projects = Project.all\n end\n @projects = @projects.order('updated_at DESC', 'id DESC').limit(400)\n end",
"def index\n @servers = @site.servers\n end",
"def show\n @sproject = current_user.sprojects.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sproject }\n end\n end",
"def project_dashboard\n @user = User.first\n @project = Organization.first.projects.find_by(id: params[:id])\n end",
"def set_project\n @projects = Project.find(params[:id])\n end",
"def set_sproject\n @sproject = Sproject.find(params[:id])\n end",
"def show\n @sites = current_user.sites\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def update\n @site = Site.find(id_from_params)\n\n respond_to do |format|\n current_user.account.sites.delete(@site)\n current_user.account.sites << @site\n if current_user.account.sites.exists? @site\n format.html { redirect_to root_path, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_site\n @site = Site.find(params[:site_id])\n end",
"def index\n do_authorize_class\n get_project_if_exists\n do_authorize_instance(:show, @project) unless @project.nil?\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json do\n @sites, opts = Settings.api_response.response_advanced(\n api_filter_params,\n list_permissions,\n Site,\n Site.filter_settings\n )\n respond_index(opts)\n end\n end\n end",
"def all_editable_sites\n Site.current.with_project_or_as_site_editor(all_projects.select(:id), id)\n end",
"def index\n @websites = Website.all\n end",
"def index\n @websites = Website.all\n end",
"def index\n @websites = Website.all\n end",
"def set_study_site\n @study_site = StudySite.find(params[:id])\n end"
] | [
"0.70766526",
"0.66787434",
"0.6606796",
"0.66055626",
"0.64919317",
"0.63666683",
"0.62347466",
"0.61579514",
"0.61579514",
"0.61579514",
"0.61579514",
"0.61579514",
"0.61579514",
"0.61542255",
"0.6110491",
"0.610454",
"0.60918856",
"0.609185",
"0.6072752",
"0.6058747",
"0.60461974",
"0.6045835",
"0.60413647",
"0.6007998",
"0.6001914",
"0.5995412",
"0.5990852",
"0.5990852",
"0.5990852",
"0.59531164",
"0.59478235",
"0.5928682",
"0.591966",
"0.5915049",
"0.59034467",
"0.59015274",
"0.5888118",
"0.5888118",
"0.5880341",
"0.58651716",
"0.58651716",
"0.58651716",
"0.58651716",
"0.58651716",
"0.58651716",
"0.58651716",
"0.58651716",
"0.58651716",
"0.58651716",
"0.58651716",
"0.58651716",
"0.58651716",
"0.58651716",
"0.58651716",
"0.5864184",
"0.58595496",
"0.58319324",
"0.5823811",
"0.5813593",
"0.58073616",
"0.5804801",
"0.5792409",
"0.5790622",
"0.5790622",
"0.5786369",
"0.5783735",
"0.57833296",
"0.5765255",
"0.574929",
"0.57477725",
"0.574317",
"0.5741613",
"0.5735874",
"0.5731877",
"0.572901",
"0.5728747",
"0.5728194",
"0.5717204",
"0.5715827",
"0.5714485",
"0.5713203",
"0.5710617",
"0.57073754",
"0.5703091",
"0.56949687",
"0.5692855",
"0.56912",
"0.56909585",
"0.5690176",
"0.5689085",
"0.5686569",
"0.56808954",
"0.5672714",
"0.5666226",
"0.56588715",
"0.5651531",
"0.56320256",
"0.56320256",
"0.56320256",
"0.56302214"
] | 0.5661572 | 94 |
GET /sites/new GET /projects/:project_id/sites/new | def new
do_new_resource
get_project_if_exists
do_set_attributes
do_authorize_instance
# initialize lat/lng to Brisbane-ish
@site.longitude = 152
@site.latitude = -27
respond_to do |format|
format.html
format.json { respond_new }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\n @project = Project.find(params[:project_id])\n @site = @project.sites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def new\n @my_sites = current_user.sites.clone\n @site = current_user.sites.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def new_link\n @project = Project.new(user_id: current_user.id)\n fetch_projects\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @site = Site.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @project = Project.new\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n redirect_to project_path id: new_project_from_hash('transient' => true,\n 'name' => 'Untitled Project',\n 'default_workspace' => {\n 'name' => 'Untitled Workspace'\n }).id\n end",
"def new\n @project = Project.new\n @services = Service.find(:all)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n do_new_resource\n get_project_site\n do_set_attributes\n do_authorize_instance\n\n respond_new\n end",
"def new\n @project = current_user.projects.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @site = Site.new\n @site.url = 'http://'\n @site.creator = current_user.name if user_signed_in?\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @project = Project.new :company_id => params[:company_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n # Agrega el breadcrumb de la pagina new de proyecto\n add_breadcrumb I18n.t('project.new'), :controller => \"projects\", :action => \"new\"\n @project = Project.new\n end",
"def new\n @project = Project.new\n @title = \"New Project\"\n end",
"def new\n \t@pagenav = Page.find_all_by_published('true')\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n # build a 'temporary' post which is written to DB later (create-method)\n @project = Project.new\n end",
"def new_project\n @request = Request.new(data_type: :project)\n @request.build_contact\n @request.build_project\n @request.build_general_information\n\n render 'new'\n end",
"def create\n do_new_resource\n do_set_attributes(site_params)\n get_project_if_exists\n do_authorize_instance\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to [@project, @site], notice: 'Site was successfully created.' }\n format.json {\n if @project.nil?\n respond_create_success(shallow_site_path(@site))\n else\n respond_create_success(project_site_path(@project, @site))\n end\n }\n else\n format.html { render action: 'new' }\n format.json { respond_change_fail }\n end\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @project = @client.projects.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n # build a 'temporary' post which is written to DB later (create-method)\n @subproject = Subproject.new\n end",
"def new\n @project=Project.new\n end",
"def new\n @project = Project.create\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def project_new\n new_project.click\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @project }\n end\n end",
"def new\r\n # This can and probably SHOULD be replaced with some URL rewrite magic\r\n # now that the project loader is Redmine project based.\r\n find_project()\r\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n respond_with(@site = Site.new)\n end",
"def new\n @new_project = Project.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_project }\n end\n end",
"def new\n authenticate_user!\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html { render :template => \"admin_sites/new\" }\n format.xml { render :xml => @site }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.json { render json: @project }\n format.html # new.html.erb\n end\n end",
"def new\n @project = Project.new()\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html\n format.json { render json: @project }\n end\n end",
"def new\n @ourproject = Ourproject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ourproject }\n end\n end",
"def new\n @project = Project.new(user_id: current_user.id)\n find_people_list\n fetch_clients\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @past_project = PastProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @past_project }\n end\n end",
"def new\n propose_nr = Integer(Project.order(\"nr desc\").first.nr) + 1\n @project = Project.new(:nr => propose_nr, :active => true)\n @project.tasks.new(:name => \"Project Mgmt\", :description => \"\")\n @project.tasks.new(:name => \"Pre-P\", :description => \"Moodboards | Examining project data, plans, briefing, etc.\")\n @project.tasks.new(:name => \"Web\", :description => \"Flatfinder/Boligvelger (eve-Estate) | CMS/Website (eve-Publisher) | Landingpage\")\n @project.tasks.new(:name => \"Undividable 3D work for exteriors\", :description => \"Modeling/texturing of buildings and their surroundings. Populating/detailing with plants, outdoor furniture, traffic, etc.\")\n @project.tasks.new(:name => \"Undividable 3D work for interiors\", :description => \"Modeling/texturing of X apartments. Setting up furniture, accessories, decoration according to moodboards.\")\n @project.tasks.new(:name => \"#{propose_nr}-01_e\", :description => \"Scene setup, lighting and detail adjustments, rendering with subsequent post-production/compositing.\")\n @project.tasks.order(:name)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @campaign = Campaign.find(params[:campaign_id])\n @project = @campaign.projects.new(params[:project])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n session[:return_to] ||= request.referer\n @project = Project.new\n @project.user_id = current_user.id\n\n # we use list of projects and contexts on the view, need to prepare them\n @projects = Project.all_active_projects(params[:context_id],current_user.id )\n @contexts = Context.where(\"user_id = ?\",current_user.id)\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @site }\n format.xml { render :xml => @site }\n end\n end",
"def new\n @project = Project.new(:user_id => current_user[:id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new_site\n \n end",
"def new\n add_breadcrumb \"Nouveau\"\n @project = Project.new\n end",
"def new_project\n if current_admin.present? || current_client.present?\n @project = Project.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n else\n redirect_to new_admin_session_path and return\n end\n end",
"def new\n @site = Site.new\n respond_with @site\n end",
"def new_site_create(params={})\n study_study_sites.set params[:site_name]\n site_number.set params[:site_number]\n study_site_number.set params[:study_site_number]\n end",
"def new\n @project = Project.new\n\n \n 0.times do\n project_task = @project.project_tasks.build\n end\n render :layout => false\n end",
"def create\n params[:site][:virtualhost] = nil if params[:site][:virtualhost] =~ /^\\s*$/\n @site = current_user.sites.build(params[:site])\n\n respond_to do |format|\n if @site.save\n flash[:notice] = 'Site was successfully created.'\n format.html { redirect_to(@site) }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n authorize! :create, Project\n \n @project = Project.new\n puts @project\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @isgrey = true;\n @current_page = \"ADD PROJECT\"\n @project = Project.new\n @project_attachment = @project.project_attachments.build\n @slider_object = @project.slider_objects.build\n @project_field = @project.project_fields.build\n @project_other_field = @project.project_other_fields.build\n\n @types = Type.all\n @new_nav = true;\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n project = current_project\n\n # TODO: replace with project.dup ?\n @project = duplicate_project(project)\n respond_to do |format|\n if is_admin?\n format.html # new.html.erb\n format.xml { render xml: @project }\n else\n format.html { redirect_to projects_path }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end"
] | [
"0.8405857",
"0.7162858",
"0.7145906",
"0.7104214",
"0.7099238",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088588",
"0.706127",
"0.70456815",
"0.702826",
"0.70041823",
"0.6990554",
"0.69852847",
"0.69814724",
"0.6976526",
"0.6972893",
"0.6970059",
"0.69569635",
"0.69477254",
"0.69477254",
"0.69477254",
"0.69477254",
"0.6930974",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.69294125",
"0.6929019",
"0.6910177",
"0.6884826",
"0.68791384",
"0.6867172",
"0.68644935",
"0.68626523",
"0.6861735",
"0.6838143",
"0.68336993",
"0.68333066",
"0.68291676",
"0.6819671",
"0.6816662",
"0.68062025",
"0.6804781",
"0.68046385",
"0.68022555",
"0.6800223",
"0.6795611",
"0.6794986",
"0.6766158",
"0.6751095",
"0.674578",
"0.674298",
"0.6720083",
"0.6718252",
"0.67156166",
"0.670573",
"0.6699262",
"0.6698105",
"0.66901326",
"0.66889834",
"0.66889834",
"0.66889834",
"0.66889834",
"0.66889834",
"0.66889834",
"0.66889834",
"0.66889834",
"0.66889834",
"0.66889834",
"0.66889834",
"0.66889834"
] | 0.0 | -1 |
POST /sites POST /projects/:project_id/sites | def create
do_new_resource
do_set_attributes(site_params)
get_project_if_exists
do_authorize_instance
respond_to do |format|
if @site.save
format.html { redirect_to [@project, @site], notice: 'Site was successfully created.' }
format.json {
if @project.nil?
respond_create_success(shallow_site_path(@site))
else
respond_create_success(project_site_path(@project, @site))
end
}
else
format.html { render action: 'new' }
format.json { respond_change_fail }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\n @project = Project.find(params[:project_id])\n @site = @project.sites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def create\n @site = current_user.sites.build(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to root_url(subdomain: @site.subdomain), notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = current_user.sites.create(params[:site])\n respond_to do |format|\n if @site.save\n format.html { flash_and_redirect(\"successfully saved!\", sites_url) }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @site = Site.find(entity_id_from_params(:site))\n current_user.account.sites << @site\n format.html { redirect_to root_path, notice: \"The site #{@site.name} @ #{@site.companies.last.name} was successfully added.\" }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @institution = @navigation_context.institution\n return unless authorize_resource(@institution, CREATE_INSTITUTION_SITE)\n @site = @institution.sites.new(site_params(true))\n @sites = check_access(@institution.sites, READ_SITE)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to sites_path, notice: I18n.t('sites.create.success') }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @site = Site.new(params[:site])\n\n @site = current_user.sites.build(params[:site])\n # @site.lat = @lat\n # @site.long = @long\n # @site.save\n\n Rails.logger.debug 'User email is ' + @site.user.email.to_s\n Rails.logger.debug 'Site lat is ' + @site.lat.to_s\n Rails.logger.debug 'Site long is ' + @site.long.to_s\n\n # @project = Project.find(params[:project_id])\n # @site = @project.sites.build(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n # format.html { redirect_to project_site_path(@site.project_id, @site),\n # notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { flash.now[:error] = \"Error: See details below.\"\n render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:site][:virtualhost] = nil if params[:site][:virtualhost] =~ /^\\s*$/\n @site = current_user.sites.build(params[:site])\n\n respond_to do |format|\n if @site.save\n flash[:notice] = 'Site was successfully created.'\n format.html { redirect_to(@site) }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @site = current_user.sites.build(site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render :show, status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Xmt::Press::Site.new(site_params)\n respond_to do |format|\n if @site.save\n format.html { redirect_to xmt_press_sites_url, notice: '站点创建成功.' }\n format.json { render :show, status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @site = Site.new(params[:site])\n \n @project = Project.find(@site.project_id)\n # site_path is the destination path which store all of resource of this site\n # site_path should be the same as the path in capistrano file(cap file)\n # @site.path = \"/home/inice/InstantSOA/deploy_cap/inice/#{current_user.id}_#{params[:site][:name]}\"\n @site.path = \"/home/inice/users/#{current_user.id}/#{current_user.id}_#{params[:site][:name]}\"\n @site.status = \"Promt for Install\"\n @site.user = current_user\n respond_to do |format|\n \n if Site.find_by_name(@site.name) != nil\n flash[:error] = 'Site name is exist.'\n format.html { redirect_to(@site) }\n else\n if @site.validate_site_name(@site.name) \n if @site.save\n\n format.html { redirect_to @site }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n else\n flash[:warning] = 'Site name is incorrect'\n format.html { render :action => \"new\"}\n format.xml { render :xml => @site.errors, :status => :'Site name is incorrect' }\n end\n end\n end\n end",
"def create\n @site = @organization.sites.new(site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to after_create_path, notice: 'Site was successfully created.' }\n format.json { render :show, status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #render text: site_params.merge(user_id: current_user.id) and return\n\n @site = Site.new(site_params)\n\n respond_to do |format|\n if @site.save\n #build site_page via template_page\n Template::Page.where(template_id: @site.template_id).order(\"sort_id ASC\").each do |temp_page|\n @site.site_pages.create(user_id: current_user.id, \n site_id: @site.id, \n template_page_id: temp_page.id,\n short_title: get_short_title(@site),\n title: temp_page.title)\n end\n format.html { redirect_to edit_site_page_url(@site.site_pages.first), notice: 'Site was successfully created.' }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.create!(project_params)\n spartans_project_params[:spartan_ids].drop(1).each{ |s_id|\n spartan = Spartan.find(s_id)\n spartan.projects.push(@project)\n }\n \n redirect_to @project\n end",
"def create\n @site = Site.new(site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render :show, status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.create site_params\n respond_to do |format|\n if @site.errors.empty?\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @institution = Institution.find params[:site][:institution_id]\n return unless authorize_resource(@institution, CREATE_INSTITUTION_SITE)\n\n @site = @institution.sites.new(site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to sites_path, notice: 'Site was successfully created.' }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to edit_site_path(@site), notice: 'Site was successfully created.' }\n format.json { render :show, status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n Campsite.create(\n name: params[:name],\n location: params[:location],\n campsite_type: params[:campsite_type],\n max_people: params[:max_people],\n per_night: params[:per_night]\n )\n\n # CREATE has no template of its own:\n # redirect to index page\n redirect_to( campsites_path )\n\n end",
"def create\n @site = Site.new(site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @optimized_site = OptimizedSite.new(optimized_site_params)\n\n respond_to do |format|\n if @optimized_site.save\n format.html { redirect_to @optimized_site, notice: 'Optimized site was successfully created.' }\n format.json { render :show, status: :created, location: @optimized_site }\n else\n format.html { render :new }\n format.json { render json: @optimized_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if request.post? and params[:project]\n project = Project.new(params[:project])\n project.owner = @user.id\n project.save\n\n sprint = project.sprints.build\n sprint.name = \"Backlog\"\n sprint.status_id = 0\n sprint.created_by = @user.id\n sprint.save\n\n task = project.tasks.build\n task.name = \"General\"\n task.description = \"General Work\"\n task.type_id = 0\n task.sprint_id = sprint.id\n task.created_by = @user.id\n task.assigned_to = @user.id\n task.save\n\n flash[:message] = \"Project '#{project.name}' has been registered.\"\n else\n flash[:error] = \"No project data provided.\"\n end\n\n redirect_to :action => 'index'\n end",
"def create\n @subsite = Subsite.new(params[:subsite])\n\n respond_to do |format|\n if @subsite.save\n format.html { redirect_to @subsite, notice: 'Subsite was successfully created.' }\n format.json { render json: @subsite, status: :created, location: @subsite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subsite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @website = websites.new(website_params)\n\n respond_to do |format|\n if @website.save\n flash[:notice] = :success\n format.html { redirect_to @website, notice: 'Website was successfully created.' }\n format.json { render :show, status: :created, location: @website }\n else\n format.html { render :new }\n format.json { render json: @website.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(params[:site])\n flash[:notice] = \"Site was successfully created.\" if @site.save\n respond_with(@site)\n end",
"def create\n @site = Cms::Site.new(cms_site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to cms.sites_url, notice: '站点已创建.' }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_site_create(params={})\n study_study_sites.set params[:site_name]\n site_number.set params[:site_number]\n study_site_number.set params[:study_site_number]\n end",
"def create\n @site = Site.new(site_params)\n\n respond_to do |format|\n if @site.save\n flash[\"notice\"] = 'Site was successfully created.'\n format.html { redirect_to @site }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_site(params = {})\n site_name.set params['site_name']\n client_division_site_number.set params['client_division_site_number']\n site_number.set params['site_number']\n address_1.set params['address_1']\n address_2.set params['address_2'] if params['address_2']\n zip_code.set params['zip_code']\n city.set params['city']\n country.select(params['country'], match: :first)\n sleep 2 # Wait for the state to be active #TODO: find a way to remove this sleep ~MD\n state.select(params['state']) unless state.disabled?\n study_env.select(params['study_env'])\n pi_email.set params['pi_email']\n pi_first_name.set(params['pi_first_name'])\n pi_last_name.set(params['pi_last_name'])\n pi_role.select(params['pi_role'])\n add_site_submit.click\n sleep 10 # Wait to create a site\n end",
"def create\n @site = Site.new(site_params)\n @site.user_id = current_user.id\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render :show, status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(params[:site])\n \n # Domain Name\n re='((?:[a-z][a-z\\\\.\\\\d\\\\-]+)\\\\.(?:[a-z][a-z\\\\-]+))(?![\\\\w\\\\.])'\t\n @m=Regexp.new(re,Regexp::IGNORECASE)\n @host = @m.match(@site.linkws)[1] \n @site.host = @host\n \n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trial_site = TrialSite.new(trial_site_params)\n\n respond_to do |format|\n if @trial_site.save\n format.html { redirect_to @trial_site, notice: 'Trial site was successfully created.' }\n format.json { render :show, status: :created, location: @trial_site }\n else\n format.html { render :new }\n format.json { render json: @trial_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @parsed_site = ParsedSite.new(parsed_site_params)\n\n if @parsed_site.save\n render json: @parsed_site, status: :created, location: @parsed_site\n else\n render json: @parsed_site.errors, status: :unprocessable_entity\n end\n end",
"def create\n @study_site = StudySite.new(study_site_params)\n\n respond_to do |format|\n if @study_site.save\n format.html { redirect_to @study_site, notice: 'Study site was successfully created.' }\n format.json { render action: 'show', status: :created, location: @study_site }\n else\n format.html { render action: 'new' }\n format.json { render json: @study_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_site(n, site_name)\n site = Site.new(name: site_name, org_type: 'city', status: 'active')\n lat, lng = Geocoder.coordinates(@zip_xpath[n].text)\n site.contacts.build(city: @city_xpath[n].text, state: @state_xpath[n].text,\n zip: @zip_xpath[n].text, country: @country_xpath[n].text, lat: lat, lng: lng)\n site.save ? site.id : nil\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n\n @project.urls.each_line do |url|\n puts \"saving #{url}\"\n url.strip!\n page = Page.create(:schedule => @project.schedule, :runtime => @project.startdate, :url => url, :project => @project)\n end \n\n \n end\n end",
"def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to(@site) }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to(@site, :notice => 'Site was successfully created.') }\n format.json { render :json => @site, :status => :created, :location => @site }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @site.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @page = current_site.pages.new(params[:page])\n @site = @page.site\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to(root_url, :notice => 'Site was successfully created.') }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @my_sites = current_user.sites.clone\n @site = current_user.sites.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def create\n @site = Site.new(site_params)\n respond_to do |format|\n if @site.save\n format.html { redirect_to user_path(@user), notice: 'サイトを作成しました' }\n format.json { render user_path(@user), status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sproject = current_user.sprojects.new(params[:sproject])\n\n respond_to do |format|\n if @sproject.save\n format.html { redirect_to @sproject, notice: 'Sproject was successfully created.' }\n format.json { render json: @sproject, status: :created, location: @sproject }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sproject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n require 'open-uri'\n @site = Site.find_or_initialize_by(site_params)\n if @site.save\n #render text: @site\n redirect_to site_path(@site)\n else\n redirect_to :back, :flash => {:error => @site.errors[:url]}\n end\n end",
"def create\n @site = Site.new(site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to(root_url, :notice => 'Site was successfully created.') }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @orbituarysite = Orbituarysite.new(params[:orbituarysite])\n\n respond_to do |format|\n if @orbituarysite.save\n format.html { redirect_to @orbituarysite, notice: 'Orbituarysite was successfully created.' }\n format.json { render json: @orbituarysite, status: :created, location: @orbituarysite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orbituarysite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(site_params)\n @site.user_id = current_user.id\n\n if params[:site][:size_ids].present?\n sizesgroup = Size.find params[:site][:size_ids]\n @site.sizes = sizesgroup\n end\n\n respond_to do |format|\n if @site.save\n format.json { render :index, status: :created, location: @site }\n\t\t#format.json { head :no_content }\n\t\tformat.js\n else\n format.json { render json: @site.errors, status: :unprocessable_entity }\n\t\tformat.js { render 'shared/errors' }\n end\n end\n end",
"def create\n @site = Site.new(site_params)\n @site.agent = current_agent\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to site_path(@site), notice: t('.flash_created') }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @search_site = SearchSite.new(search_site_params)\n\n respond_to do |format|\n if @search_site.save\n format.html { redirect_to search_sites_url, notice: 'Search site was successfully created.' }\n format.json { render :show, status: :created, location: @search_site }\n else\n format.html { render :new }\n format.json { render json: @search_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to(@site, :notice => 'Site was successfully created.') }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to(@site, :notice => 'Site was successfully created.') }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to(@site, :notice => 'Site was successfully created.') }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def build_site_for_user\n #ditinguer nom et url\n create_site(params[:site][:url],params[:user][:site], current_user)\n end",
"def create\r\n @project = current_user.projects.new(project_params)\r\n new_page = @project.pages.new({ name: generate_new_page_name})\r\n @project.startpage = new_page\r\n @project.date_created = Time.now\r\n @project.last_modified = Time.now\r\n respond_to do |format|\r\n if @project.save\r\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: @project }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @project.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to sites_url, flash[:info]=\"Site was successfully created.\" }\n format.js { flash[:info]=\"Site was successfully created.\" }\n format.json { render json: @site, status: :created, location: @site }\n end\n end\n end",
"def create\n @site = Site.new(params[:site])\n @site.created_by = current_user\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, :notice => 'Site was successfully created.' }\n format.json { render :json => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\", :layout=>\"site\" }\n format.json { render :json => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @body_site = BodySite.new(body_site_params)\n\n respond_to do |format|\n if @body_site.save\n format.html { redirect_to @body_site, notice: 'Body site was successfully created.' }\n format.json { render :show, status: :created, location: @body_site }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @body_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n flash[:notice] = 'Site was successfully created.'\n Changelog.add(@current_user.login, \"Created the site #{@site.name}\")\n format.html { redirect_to(@site) }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @sproject = Sproject.new(sproject_params)\n\n respond_to do |format|\n if @sproject.save\n format.html { redirect_to @sproject, notice: 'Sproject was successfully created.' }\n format.json { render :show, status: :created, location: @sproject }\n else\n format.html { render :new }\n format.json { render json: @sproject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n puts \"===============================\".red\n puts \"#{params[:technologies]}\".red\n puts \"===============================\".red\n @technologies = params[:technologies]\n\n respond_to do |format|\n if @project.save\n @technologies.each do |t|\n linked = ProjectTechnology.new\n linked.project_id = @project.id\n linked.technology_id = t\n puts \"===============================\".yellow\n if linked.save\n puts \"Link saved with project_id => #{@project.id}, technology_id => #{t}\".green\n else\n puts \"Link don't save with project_id => #{@project.id}, technology_id => #{t}\".red\n end\n puts \"===============================\".yellow\n end\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @produktion_site = ProduktionSite.new(params[:produktion_site])\n\n respond_to do |format|\n if @produktion_site.save\n format.html { redirect_to @produktion_site, notice: 'Produktion site was successfully created.' }\n format.json { render json: @produktion_site, status: :created, location: @produktion_site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @produktion_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site_page = SitePage.new(site_page_params)\n\n respond_to do |format|\n if @site_page.save\n format.html { redirect_to @site_page, notice: 'Site page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @site_page }\n else\n format.html { render action: 'new' }\n format.json { render json: @site_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_site(params={name:random_string})\n\t\tnew_site = site[:new]\n\t\tparams[:site] = params[:name]\n\t\tnew_site[:params].merge!(params)\n\t\tnew_site[:params][:address] = append_ftp_value(new_site[:params][:address],new_site[:params][:ftp_type])\n\t\tpost(new_site)\n\tend",
"def create\n flash[:notice] = 'The website was successfully added.' if website.save\n respond_with(website)\n end",
"def create_site_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.create_site ...'\n end\n # resource path\n local_var_path = '/api/3/sites'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'site'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, 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 => 'ReferenceWithSiteIDLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#create_site\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_site\n \n district_id = District.find_by_name(params[:district]).district_id rescue nil\n\n site = Site.find_by_name(params[:sitename], :conditions => [\"district_id = ?\", district_id]) rescue nil\n\n type = SiteType.find_by_name(params[:sitetype]).id rescue nil\n \n longitude = params[:longitude] rescue nil\n \n latitude = params[:latitude] rescue nil\n \n if site.nil?\n\n @site = Site.new(:name => params[:sitename], :district_id => district_id, \n :longitude => longitude, :latitude => latitude, :site_type => type)\n \n @site.save\n\n flash[:notice] = \"Site #{params[:sitename]} created\"\n\n else\n flash[:error] = \"Site #{params[:sitename]} in #{params[:district]} already exists! Choose a different site name.\"\n end\n\n redirect_to \"/images/malawi/districts?district=#{params[:district]}\",\n :layout => \"application\" and return\n \n end",
"def create_site_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.create_site ...\"\n end\n # resource path\n local_var_path = \"/api/3/sites\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'site'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, 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 => 'ReferenceWithSiteIDLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#create_site\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @project = Project.new(project_params)\n @project.lead_id = current_user.id\n @project.workspace_id = params[:workspace_id]\n if @project.save\n 5.times do\n Task.create(name: \"New Task\", creator_id: current_user.id, workspace_id: current_user.homespace_id, project_id: @project.id)\n end\n\n render :show, status: :created\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def create\n set_cors_headers\n @site = Site.find(params[:site_id])\n if params[:base_url] == @site.base_url\n @visit = @site.visits.create(:url => params[:url], :duration => params[:duration])\n end\n\n respond_to do |format|\n if @visit.save\n format.html { redirect_to site_visit_path(@site, @visit), notice: 'Visit was successfully created.' }\n format.json { render json: @visit, status: :created, location: @visit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n flash[:notice] = 'Site was successfully created.'\n format.html { redirect_to(@site) }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(params[:site])\n @site.user_id = current_user.id\n respond_to do |format|\n if @site.save\n flash[:notice] = 'Site was successfully added to your permissions list.'\n format.html { redirect_to(user_site_url(:id => @site, :user_id => current_user.id)) }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(site_params.reject {|k,v|k==\"trade_items\"})\n respond_to do |format|\n if @site.save\n create_trade_items(@site, site_params[:trade_items])\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def create\n raise ArgumentError, \"Site already exists in Piwik, call 'update' instead\" unless new?\n raise ArgumentError, \"Name can not be blank\" if name.blank?\n raise ArgumentError, \"Main URL can not be blank\" if main_url.blank?\n xml = call('SitesManager.addSite', :siteName => name, :urls => main_url)\n result = XmlSimple.xml_in(xml, {'ForceArray' => false})\n @id = result.to_i\n @created_at = Time.current\n id && id > 0 ? true : false\n end",
"def create\n user_id = session[:user_id] \n if user_id \n all_params = site_params\n all_params[:date] = Date.strptime(all_params[:date],'%m/%d/%Y') \n site = Site.new(all_params)\n if site.valid?\n site.save\n redirect_to '/sites/' + site.id.to_s + '/upload'\n else\n err = site.errors.messages\n err_str = \"\\n\"\n err.each do |key, value|\n err_str += \"#{key}:#{value}\\n\"\n end\n flash[:danger] = \"Oooops - sorry, something went wrong while saving your new site: \" + err_str\n redirect_to '/'\n end\n else \n open_id = URI.encode(params[:open_id])\n tmp = Sitetmp.new(site_params)\n tmp.nonce = nonce\n tmp.save\n to_url = '/login?n=' + tmp.nonce + '&open_id=' + open_id\n redirect_to to_url \n end\n end",
"def create_site\n if params[:site]\n @site_url = TabSite.new(params[:site])\n flash[:notice]= @site_url.save ? \"Tab site created successfully.\" : \"Tab site not created.\"\n redirect_to \"/users/profile/#{@login_user.id}\"\n end\n end",
"def new_site\n newsite = Site.new()\n newsite.gid = params[:gid]\n newsite.name = params[:name]\n newsite.user_id = current_user.id\n newsite.save\n get_address(newsite.id)\n calculate_first_time(newsite.id)\n redirect_to :action => \"select\"\n end",
"def create\n @site = Site.new(site_params)\n @site.user_id = current_user.id if current_user\n @site.member_id = current_member.id if current_member\n @site.typo = ['personal', 'business'].delete(params[:typo].to_s.downcase) || 'personal'\n\n respond_to do |format|\n if @site.save!\n if params[:typo] == 'business'\n @site.site_payment.price = ENV[\"PRICE_BUSINESS\"]\n @site.site_payment.save!\n end\n if @site.template.property == 'free'\n @site.set_free\n end\n #build site_page via template_page\n Templates::Page.where(template_id: @site.template_id).order(\"position ASC\").each do |temp_page|\n @site.site_pages.create(\n site_id: @site.id, \n template_page_id: temp_page.id,\n title: temp_page.title)\n end\n #add a comment\n SiteComment.create(site_id: @site.id, name: '维斗喜帖', content: '小维斗来过,提前送上一声祝福~')\n \n #send notice to admin\n # if Rails.env == 'production'\n # SmsSendWorker.perform_async(ENV['ADMIN_PHONE'].split('|').join(','), \"#{@site.user.try(:email) || @site.member.try(:auth_id)}创建了应用:#{get_site_url(@site)}\")\n # end\n #redirect\n format.html { redirect_to site_site_steps_path(@site), notice: t('notice.site.created') }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @website = Website.new(website_params)\n\n if @website.save\n render json: @website, status: :created, location: @website\n else\n render json: @website.errors, status: :unprocessable_entity\n end\n end",
"def create\n @project = Project.new.new_project_steps @current_user, project_params\n respond_to do |format|\n if @project.save\n @current_user.projects << @project\n @current_user.save\n format.html { redirect_to root_path, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render partial: 'form' }\n format.js { render partial: 'dashboard_new' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @site = Site.new \n puts \"Got here\"\n #2.times { @site.connections.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def create\n @project = @client.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @client, notice: 'Project was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def create\n @anatomic_site = AnatomicSite.new(anatomic_site_params)\n\n respond_to do |format|\n if @anatomic_site.save\n format.html { redirect_to @anatomic_site, notice: 'Anatomic site was successfully created.' }\n format.json { render :show, status: :created, location: @anatomic_site }\n else\n format.html { render :new }\n format.json { render json: @anatomic_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = @sprint.projects.create(params[:project])\n\n respond_to do |format|\n if @project.valid?\n flash[:notice] = 'Project was successfully created.'\n format.html { redirect_to project_url(@sprint, @project) }\n format.xml { head :created, :location => project_url(@project) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors.to_xml }\n end\n end\n end",
"def create\n @urlroot = Designax::Application.config.urlroot\n if params[:pk] == \"new\" and params[:name] == \"project_name\"\n project_name = params[:value]\n @project = Project.new()\n @project.project_name = project_name\n else\n @project = Project.new(params[:project])\n end\n\n respond_to do |format|\n if @project.save\n redirect_url = @urlroot + \"/projects\"\n response_url = { \"url\" => redirect_url }\n format.json { render json: response_url, status: 200 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n @project.permalink = create_permalink(params[:project][:title])\n @project_membership = @project.project_memberships.build(:user_id => current_user.id, :role => \"founder\")\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params.merge(school_id: current_user.school_id))\n if @project.save\n render :show, status: :created, location: api_v1_project_url(@project)\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def create\n @projects = current_user.projects\n @project = current_user.projects.new(project_params)\n\n respond_to do |format|\n if @projects << @project\n format.html { redirect_to user_projects_path(current_user), notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(params[:site])\n @site.user_id = current_user.id if user_signed_in?\n respond_to do |format|\n if @site.save\n url = (user_signed_in?)? current_user_path : @site\n format.html { redirect_to url, notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @site_url = SiteUrl.new(site_url_params)\n\n respond_to do |format|\n if @site_url.save\n format.html { redirect_to @site_url, notice: \"Site url was successfully created.\" }\n format.json { render :show, status: :created, location: @site_url }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @site_url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@private_site = PrivateSite.new(private_site_params)\n\t\t@private_site.user = current_user\n respond_to do |format|\n if @private_site.save\n\t\t\t\tparams[:private_site][:floor_plans].reject! { |c| c.empty? }.each do |floor_plan|\n\t\t\t\t\t@private_site.floor_plans << FloorPlan.find(floor_plan)\n\t\t\t\tend\n\t\t\t\tparams[:private_site][:galleries].reject! { |c| c.empty? }.each do |gallery|\n\t\t\t\t\t@private_site.galleries << Gallery.find(gallery)\n\t\t\t\tend\n\t\t\t\tparams[:private_site][:private_videos].reject! { |c| c.empty? }.each do |p_video|\n\t\t\t\t\t@private_site.private_videos << PrivateVideo.find(p_video)\n\t\t\t\tend\n\n\t\t\t\tparams[:private_site][:si_details].reject! { |c| c.empty? }.each do |update|\n\t\t\t\t\tupdate_parsed = update.split(\"-\")\n\t\t\t\t\tsi = SiteItem.new\n\t\t\t\t\tsi.private_site = @private_site\n\t\t\t\t\tsi.si_detail = true\n\t\t\t\t\tif update_parsed[0] == \"g\"\n\t\t\t\t\t\tsi.si_item = Gallery.find(update_parsed[1])\n\t\t\t\t\telsif update_parsed[0] == \"p\"\n\t\t\t\t\t\tsi.si_item = Article.find(update_parsed[1])\n\t\t\t\t\tend\n\t\t\t\t\tsi.save\n\t\t\t\tend\n\t\t\t\tparams[:private_site][:si_updates].reject! { |c| c.empty? }.each do |update|\n\t\t\t\t\tupdate_parsed = update.split(\"-\")\n\t\t\t\t\tsi = SiteItem.new\n\t\t\t\t\tsi.private_site = @private_site\n\t\t\t\t\tsi.si_update = true\n\t\t\t\t\tif update_parsed[0] == \"g\"\n\t\t\t\t\t\tsi.si_item = Gallery.find(update_parsed[1])\n\t\t\t\t\telsif update_parsed[0] == \"v\"\n\t\t\t\t\t\tsi.si_item = PrivateVideo.find(update_parsed[1])\n\t\t\t\t\telsif update_parsed[0] == \"p\"\n\t\t\t\t\t\tsi.si_item = Article.find(update_parsed[1])\n\t\t\t\t\tend\n\t\t\t\t\tsi.save\n\t\t\t\tend\n\n format.html { redirect_to admin_private_sites_dashboard_path, notice: 'Site was successfully created.' }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def create\n @admin_site_structure = Admin::SiteStructure.new(admin_site_structure_params)\n\n respond_to do |format|\n if @admin_site_structure.save\n format.html { redirect_to @admin_site_structure, notice: 'Site structure was successfully created.' }\n format.json { render :show, status: :created, location: @admin_site_structure }\n else\n format.html { render :new }\n format.json { render json: @admin_site_structure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_site = StudentSite.new(student_site_params)\n\n respond_to do |format|\n if @student_site.save\n format.html { redirect_to @student_site, notice: 'Student site was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student_site }\n else\n format.html { render action: 'new' }\n format.json { render json: @student_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def site_params\n params.require(:site).permit(:name, :site_template_id,\n {user_ids: []}, site_routes_attributes: [:id, :host, :path], site_settings_attributes: [:id, :value, :name, :image])\n end",
"def create\n @site = Site.new(params[:site])\n @site.user = self.current_user \n \n respond_to do |format|\n if @site.save\n flash[:notice] = 'Site was successfully created.'\n format.html { redirect_to site_url(@site) }\n format.xml { head :created, :location => site_url(@site) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors.to_xml }\n end\n end\n end",
"def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: \"Project was successfully created.\" }\n User.find(current_user.id).projects << Project.find(@project.id)\n @projects_user = ProjectsUser.find_by(user_id: current_user.id, project_id: @project.id)\n format.json { render :show, status: :created, location: @project }\n\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @jobsite = Jobsite.new(jobsite_params)\n\n respond_to do |format|\n if @jobsite.save\n format.html { redirect_to @jobsite, notice: 'Jobsite was successfully created.' }\n format.json { render :show, status: :created, location: @jobsite }\n else\n format.html { render :new }\n format.json { render json: @jobsite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @sites = Site.all\n end",
"def index\n @sites = Site.all\n end"
] | [
"0.6808781",
"0.6653245",
"0.64772636",
"0.64595175",
"0.64161086",
"0.63823074",
"0.63426745",
"0.63059527",
"0.62254995",
"0.6201547",
"0.6134515",
"0.6037362",
"0.60171574",
"0.59973013",
"0.5966203",
"0.5966203",
"0.5966203",
"0.5954593",
"0.5935434",
"0.5932729",
"0.5917001",
"0.59147406",
"0.58644134",
"0.58629495",
"0.58627033",
"0.585767",
"0.5847855",
"0.58453476",
"0.5831101",
"0.58210915",
"0.5801227",
"0.5791581",
"0.5769023",
"0.576022",
"0.57461894",
"0.5745252",
"0.57364815",
"0.57309496",
"0.57188576",
"0.5700761",
"0.5698399",
"0.5695301",
"0.56817585",
"0.56811893",
"0.56806195",
"0.56770617",
"0.5676131",
"0.56719065",
"0.5660297",
"0.5654089",
"0.56377244",
"0.56359696",
"0.56359696",
"0.56359696",
"0.5630893",
"0.5617644",
"0.5616864",
"0.56146944",
"0.56145597",
"0.56135136",
"0.5611756",
"0.5606165",
"0.5601495",
"0.56002027",
"0.55831146",
"0.5556013",
"0.5554264",
"0.5552997",
"0.55501807",
"0.55454797",
"0.5541942",
"0.5541019",
"0.5537622",
"0.55318564",
"0.5516466",
"0.5502252",
"0.54934096",
"0.54917186",
"0.5490449",
"0.5468084",
"0.5467779",
"0.54647684",
"0.54560524",
"0.5451839",
"0.5451322",
"0.5446954",
"0.54444253",
"0.54383546",
"0.54343593",
"0.54318845",
"0.54236645",
"0.5420492",
"0.5414255",
"0.54142165",
"0.5405741",
"0.5391966",
"0.53885454",
"0.53794277",
"0.5377744",
"0.5377744"
] | 0.6576635 | 2 |
PUT|PATCH /sites/:id PUT|PATCH /projects/:project_id/sites/:id | def update
do_load_resource
get_project_if_exists
do_authorize_instance
@original_site_name = @site.name
respond_to do |format|
if @site.update(site_params)
format.html { redirect_to [@project, @site], notice: 'Site was successfully updated.' }
format.json { respond_show }
else
format.html do
render action: 'edit'
end
format.json { respond_change_fail }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to site_path(@site), notice: 'Site was successfully updated.' }\n # format.html { redirect_to project_site_path(@site.project, @site), notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { flash.now[:error] = \"Error: See details below.\"\n render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\t\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to admin_projects_url, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n \tset_site_entities @project\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = current_user.sites.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { flash_and_redirect(\"successfully updated!\", sites_url) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = current_user.sites.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(id_from_params)\n\n respond_to do |format|\n current_user.account.sites.delete(@site)\n current_user.account.sites << @site\n if current_user.account.sites.exists? @site\n format.html { redirect_to root_path, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find_by_site(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n redirect_to \"/sites\" and return\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n respond_to do |format|\n if @site.update(params)\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { render json: { result: :ok, notice: 'changes saved succesfully', site: @site } }\n else\n format.html { render :edit }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to @site, :notice => 'Site was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\", :layout=>\"site\"}\n format.json { render :json => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sproject = current_user.sprojects.find(params[:id])\n\n respond_to do |format|\n if @sproject.update_attributes(params[:sproject])\n format.html { redirect_to @sproject, notice: 'Sproject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sproject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize!(@site)\n\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to site_site_steps_path(@site), notice: t('notice.site.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find params[:id]\n return unless authorize_resource(@site, UPDATE_SITE)\n\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to sites_path, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:site][:virtualhost] = nil if params[:site][:virtualhost] =~ /^\\s*$/\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n flash[:notice] = 'Site was successfully updated.'\n format.html { redirect_to(@site) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find_by_slug(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = @user.projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to(project_path(@project, :subdomain => @user.subdomain)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to(@site, :notice => 'Site was successfully updated.') }\n format.json { head :ok }\n format.xml { head :ok }\n else\n format.html { render :action => '#edit' }\n format.json { render :json => @site.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html {redirect_to sites_url, flash[:info]='Site was successfully updated.' }\n format.js { flash[:info]='Site was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @workspaces = current_user.workspaces\n @project = Project.find(params[:id])\n @workspace = Workspace.find(params[:workspace_id])\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to workspace_project_tasks_path(@workspace , @project), notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to sites_path, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { render :show, status: :ok, location: @site }\n else\n format.html { render :edit }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { render :show, status: :ok, location: @site }\n else\n format.html { render :edit }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to sites_url, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to xmt_press_sites_url, notice: '站点更新成功.' }\n format.json { render :show, status: :ok, location: @site }\n else\n format.html { render :edit }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site.user_id = current_user.id\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { render :show, status: :ok, location: @site }\n else\n format.html { render :edit }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to edit_site_path(@site), notice: 'Site was successfully updated.' }\n format.json { render :show, status: :ok, location: @site }\n else\n format.html { render :edit }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sitecity = Sitecity.find_by_url(params[:id])\n\n respond_to do |format|\n if @sitecity.update_attributes(params[:sitecity])\n format.html { redirect_to @sitecity, notice: t(:sitecity_update_success) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitecity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #retrieve the site thanks to params[:id]\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update(site_params)\n #1st argument of redirect_to is an array, in order to build the correct route to the nested resource site\n format.html { redirect_to([@site.customer, @site], :notice => 'Site was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n if params[:site][:manager_ids]\n format.html { redirect_to sites_url(subdomain: \"www\"), notice: 'Site was successfully updated.' }\n else\n format.html { redirect_to edit_site_url(subdomain: @site.subdomain), notice: 'Site was successfully updated.' }\n end\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.first\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to(root_url, :notice => 'Site was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to(@site, :notice => 'Site was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to(@site, :notice => 'Site was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to(@site, :notice => 'Site was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to(@site, :notice => 'Site was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to(@site, :notice => 'Site was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @subsite = Subsite.find(params[:id])\n\n respond_to do |format|\n if @subsite.update_attributes(params[:subsite])\n format.html { redirect_to @subsite, notice: 'Subsite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subsite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:site_id])\n @visit = Visit.find(params[:id])\n\n respond_to do |format|\n if @visit.update_attributes(params[:visit])\n format.html { redirect_to site_visit_path(@site, @visit), notice: 'Visit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n flash[:notice] = \"Site was successfully updated.\" if @site.update_attributes(params[:site])\n respond_with(@site)\n end",
"def update\n @orbituarysite = Orbituarysite.find(params[:id])\n\n respond_to do |format|\n if @orbituarysite.update_attributes(params[:orbituarysite])\n format.html { redirect_to @orbituarysite, notice: 'Orbituarysite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orbituarysite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @signspot_project = Signspot::Project.find(params[:id])\n\n respond_to do |format|\n if @signspot_project.update_attributes(params[:signspot_project])\n format.html { redirect_to @signspot_project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @signspot_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n flash[:notice] = 'Site was successfully updated.'\n format.html { redirect_to(@site) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n flash[:notice] = 'Site was successfully updated.'\n format.html { redirect_to(@site) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n \n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n flash[:notice] = 'Site was successfully updated.'\n Changelog.add(@current_user.login, \"Updated the #{@site.name} site\")\n format.html { redirect_to(@site) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sproject.update(sproject_params)\n format.html { redirect_to @sproject, notice: 'Sproject was successfully updated.' }\n format.json { render :show, status: :ok, location: @sproject }\n else\n format.html { render :edit }\n format.json { render json: @sproject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put_update(options = {})\n options[:id] ||= @website.id\n options[:website] ||= @attributes\n\n put :update,options\n end",
"def new\n\n @project = Project.find(params[:project_id])\n @site = @project.sites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def project_updates\n @project = Project.find(params[:id])\n end",
"def update\n authorize!(@site_page.site)\n\n respond_to do |format|\n if @site_page.update(site_page_params)\n format.html { redirect_to @site_page, notice: 'Site page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to user_path(@user), notice: \"サイト[#{@site.name}]を編集しました\" }\n format.json { render :show, status: :ok, location: @site }\n else\n format.html { render :edit }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @anatomic_site.update(anatomic_site_params)\n format.html { redirect_to @anatomic_site, notice: 'Anatomic site was successfully updated.' }\n format.json { render :show, status: :ok, location: @anatomic_site }\n else\n format.html { render :edit }\n format.json { render json: @anatomic_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @environment = @project.environments.find_by_slug!(params[:id])\n\n respond_to do |format|\n if @environment.update_attributes(params[:environment])\n format.html { redirect_to @environment, notice: 'Environment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @environment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id], :conditions => ['user_id = ?', current_user.id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n flash[:notice] = 'Site was successfully updated.'\n format.html { redirect_to(user_site_url(:id => @site, :user_id => current_user.id)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_site\n @site = Site.find(params[:site_id])\n end",
"def update\n @site_config = SiteConfig.find(params[:id])\n\n respond_to do |format|\n if @site_config.update_attributes(site_config_params)\n format.html { redirect_to @site_config, notice: 'Site config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find_by(url: params[:id])\n\n respond_to do |format|\n if @project.update(permitted_params)\n format.html { redirect_to(@project, flash: { success: 'Project was successfully updated.' }) }\n format.xml { head :ok }\n else\n format.html { render action: :edit }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def gu_update_site_from_app\n @app = App.find(params[:app]) rescue nil\n @site = [email protected]? ? @app.site : nil\n\n respond_to do |format|\n format.html # gu_update_site_from_app.html.erb does not exist! JSON only\n format.json { render json: @site }\n end\n end",
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n flash[:notice] = 'Site was successfully updated.'\n format.html { redirect_to(@site) }\n format.xml { head :ok }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n \n return if !self.authorize?\n \n respond_to do |format|\n if @site.update_attributes(params[:site])\n flash[:notice] = 'Site was successfully updated.'\n format.html { redirect_to site_url(@site) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site.errors.to_xml }\n end\n end\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def update\n @parsed_site = ParsedSite.find(params[:id])\n\n if @parsed_site.update(parsed_site_params)\n head :no_content\n else\n render json: @parsed_site.errors, status: :unprocessable_entity\n end\n end",
"def update\t\t\t\t\t\t\t\t\t# Actually modifies the data and redirects (probably to index or show? depends)\n\t\t#@project = Project.find(params[:id])\t# Taken out because of the before action GENIUS!\n\n\t\trespond_to do |format|\n \t\t if @project.update(projects_params)\n \t\tformat.html { redirect_to @project, notice: 'Project was successfully updated.' }\n \t\tformat.json { render :show, status: :ok, location: @project }\n \t\telse\n \t\tformat.html { render :edit }\n \t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n\tend",
"def set_sproject\n @sproject = Sproject.find(params[:id])\n end",
"def set_site\n @site = current_account.sites.find(params[:site_id]) if params[:site_id]\n end",
"def update\n @watch_site = WatchSite.find(params[:id])\n\n respond_to do |format|\n if @watch_site.update_attributes(params[:watch_site])\n format.html { redirect_to @watch_site, notice: 'Watch site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @watch_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n<<<<<<< HEAD:app/controllers/projects_controller.rb\n handle_disciplines_projects\n \n=======\n\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/controllers/projects_controller.rb\n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to(@project) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n logger.debug \"debug_update:params=#{params.inspect}\"\n @m_site = MSite.where(id: params[:id].to_i).first\n @m_site.name = params['app_job_offer_name']\n @m_site.password = params['app_password'].nil? ? '' : params['app_password']\n @m_site.no_scraping_flg = params['app_no_scraping_flg']\n #@m_site.recruitment_site_id = params['app_site_id'].nil? ? '' : params['app_site_id']\n @m_site.user_id = params['app_user_id'].nil? ? '' : params['app_user_id']\n @m_site.extra1 = params['extra1'].nil? ? '' : params['extra1']\n @m_site.extra2 = params['extra2'].nil? ? '' : params['extra2']\n @m_site.extra3 = params['extra3'].nil? ? '' : params['extra3'].to_i\n @m_site.enterprise_cnt = params['enterprise_cnt'].nil? ? 0 : params['enterprise_cnt']\n\n respond_to do |format|\n if @m_site.valid? && @error_msg.blank?\n @m_site.save\n format.html { redirect_to '/m_sites', notice: 'Site was successfully updated.' }\n format.json { render :show, status: :ok, location: @m_site }\n else\n format.html { render :edit }\n format.json { render json: @m_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = @client.projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to([@client, @project], notice: 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_site_url\n @site_url = TabSite.find(params[:site][:id])\n @site_url.update_attributes(params[:site])\n flash[:notice]=\"Site updated successfully.\"\n redirect_to \"/users/profile/#{@login_user.id}\"\n end",
"def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to @site, notice: t('.flash_updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = @client.projects.find(params[:id])\n \n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to client_project_path(@project.client_id,@project), notice: 'Project was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @study_site.update(study_site_params)\n format.html { redirect_to @study_site, notice: 'Study site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @study_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to projects_path() }\n format.xml { head :ok }\n else\n @edit_mode = true\n @tasks = Task.find_all_by_project_id(@project.id)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n \n \n\n #puts '*****************cartodb22************************'\n #response = HTTParty.get('https://cantina23.cartodb.com/api/v2/sql?q=SELECT name FROM premas_projects&api_key=83a1b3e6c95613255bef720617d34adb0a7b87c1')\n #puts response\n #puts '*****************cartodb22************************'\n\n #puts '*****************cartodb22************************'\n #response = HTTParty.get(\"https://cantina23.cartodb.com/api/v2/sql?q=UPDATE premas_projects SET value=33333 WHERE cartodb_id=2&api_key=83a1b3e6c95613255bef720617d34adb0a7b87c1\")\n #puts response\n #puts '*****************cartodb22************************'\n\n \n \n \n \n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n params[:company][:projects_attributes][\"0\"].merge!(:user_id => current_user.id)\n respond_to do |format|\n if @company.update_attributes(params[:company])\n\tformat.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n\tformat.xml { head :ok }\n else\n\tformat.html { render :action => \"edit\" }\n\tformat.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_project\n @projects = Project.find(params[:id])\n end",
"def update\n @produktion_site = ProduktionSite.find(params[:id])\n\n respond_to do |format|\n if @produktion_site.update_attributes(params[:produktion_site])\n format.html { redirect_to @produktion_site, notice: 'Produktion site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @produktion_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n institution = @site.institution\n redirect_options = {}\n\n return unless authorize_resource(@site, UPDATE_SITE)\n\n @can_move = has_access?(institution, CREATE_INSTITUTION_SITE)\n\n respond_to do |format|\n update_or_save = false\n\n if site_params(@can_move).has_key?(:parent_id) && site_params(@can_move)[:parent_id].to_i != @site.parent_id\n new_site = institution.sites.new(site_params(true))\n begin\n Site.transaction do\n new_site.save!\n @site.devices.each do |device|\n device.site = new_site\n device.save!\n end\n @site.devices.clear\n\n @site.destroy\n update_or_save = true\n redirect_options = { context: new_site.uuid } if @navigation_context.entity.uuid == @site.uuid\n end\n rescue => e\n update_or_save = false\n # propagate errors from site to be created to original site\n new_site.errors.each do |k, m|\n @site.errors.add(k, m)\n end\n # mimic that attributes have been edited in the original site\n @site.assign_attributes(site_params)\n end\n else\n update_or_save = @site.update(site_params)\n end\n\n if update_or_save\n format.html { redirect_to sites_path(redirect_options), notice: I18n.t('sites.update.success') }\n format.json { head :no_content }\n else\n @sites = check_access(institution.sites, READ_SITE) if @can_move\n\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n @cliente = @project.cliente_id\n respond_to do |format|\n if @project.update(project_params)\n format.html { render :edit }\n format.json { render :index, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n do_new_resource\n do_set_attributes(site_params)\n get_project_if_exists\n do_authorize_instance\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to [@project, @site], notice: 'Site was successfully created.' }\n format.json {\n if @project.nil?\n respond_create_success(shallow_site_path(@site))\n else\n respond_create_success(project_site_path(@project, @site))\n end\n }\n else\n format.html { render action: 'new' }\n format.json { respond_change_fail }\n end\n end\n end",
"def update\n respond_to do |format|\n if @jobsite.update(jobsite_params)\n format.html { redirect_to @jobsite, notice: 'Jobsite was successfully updated.' }\n format.json { render :show, status: :ok, location: @jobsite }\n else\n format.html { render :edit }\n format.json { render json: @jobsite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to after_update_path, notice: 'Site was successfully updated.' }\n format.json { render :show, status: :ok, location: @site }\n else\n format.html { render :edit }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.68864995",
"0.6803217",
"0.6754956",
"0.6699364",
"0.6563257",
"0.64455116",
"0.6334341",
"0.63271093",
"0.6317401",
"0.6311834",
"0.6309317",
"0.6294351",
"0.628393",
"0.62765926",
"0.6250152",
"0.620043",
"0.61921304",
"0.61790377",
"0.61767364",
"0.6175501",
"0.61629957",
"0.616185",
"0.6154234",
"0.6154234",
"0.6143604",
"0.6130975",
"0.61225003",
"0.6117757",
"0.6117757",
"0.6112408",
"0.61014515",
"0.60923725",
"0.60842663",
"0.60778546",
"0.6068323",
"0.6061756",
"0.6061756",
"0.6061756",
"0.6061756",
"0.60563236",
"0.6053505",
"0.6044915",
"0.6038198",
"0.59955424",
"0.5989555",
"0.5989555",
"0.5979409",
"0.597599",
"0.59601146",
"0.5957081",
"0.59374434",
"0.59374434",
"0.59374434",
"0.59374434",
"0.59374434",
"0.59374434",
"0.59374434",
"0.59374434",
"0.59374434",
"0.59374434",
"0.59374434",
"0.59374434",
"0.59374434",
"0.59374434",
"0.59374434",
"0.5924308",
"0.5918943",
"0.5916669",
"0.59060645",
"0.58951026",
"0.5894527",
"0.5887706",
"0.5886962",
"0.5886515",
"0.5876045",
"0.5874097",
"0.5871812",
"0.587033",
"0.58653367",
"0.58588284",
"0.5858415",
"0.5858327",
"0.58539695",
"0.58500683",
"0.5846981",
"0.58449453",
"0.5844403",
"0.5843547",
"0.5842904",
"0.5840953",
"0.5830882",
"0.58225244",
"0.5821489",
"0.58202183",
"0.58177006",
"0.58131796",
"0.5800728",
"0.5796239",
"0.5794482",
"0.57922477"
] | 0.67603123 | 2 |
DELETE /sites/:id DELETE /projects/:project_id/sites/:id | def destroy
do_load_resource
get_project_if_exists
do_authorize_instance
@site.destroy
add_archived_at_header(@site)
respond_to do |format|
format.html { redirect_to project_sites_url(@project) }
format.json { respond_destroy }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @site = current_user.sites.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { flash_and_redirect(\"successfully deleted\", sites_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n @site = Site.find(id_from_params)\n\n respond_to do |format|\n if current_user.account.sites.delete(@site)\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @site = current_user.sites.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url, :notice => t('sites.destroy.completed') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site = Site.find_by_site(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = @user.projects.find(params[:id])\n @project.remove!\n\n respond_to do |format|\n format.html { redirect_to(projects_url(:subdomain => @user.subdomain)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_path, notice: 'Site was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n campsite = Campsite.find params[:id]\n campsite.destroy\n\n redirect_to( campsites_path )\n end",
"def destroy\n @site = Site.find(params[:site_id])\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.html { redirect_to site_visits_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orbituarysite = Orbituarysite.find(params[:id])\n @orbituarysite.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subsite = Subsite.find(params[:id])\n @subsite.destroy\n\n respond_to do |format|\n format.html { redirect_to subsites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sitecity = Sitecity.find_by_url(params[:id])\n @sitecity.destroy\n\n respond_to do |format|\n format.html { redirect_to sitecities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #[email protected]\n m_site = MSite.find(params[:id].to_i)\n m_site.del_flg = 1\n m_site.save\n\n respond_to do |format|\n format.html { redirect_to '/m_sites', notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # retrieve the site thanks to params[:id]\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def destroy\n return unless authorize_resource(@site, DELETE_SITE)\n\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_path, notice: I18n.t('sites.destroy.success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_path = ProjectPath.find(params[:id])\n @project_path.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_paths_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find_by_slug(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n \n @sites = Site.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html { redirect_to sites_url, flash[:info]='Site was successfully deleted.' }\n format.js { flash[:info]='Site was successfully deleted.' }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find_by_permalink(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site = Site.find params[:id]\n return unless authorize_resource(@site, DELETE_SITE)\n\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_path, notice: 'Site was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recycling_site = RecyclingSite.find(params[:id])\n @recycling_site.destroy\n\n respond_to do |format|\n format.html { redirect_to(recycling_sites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sproject = current_user.sprojects.find(params[:id])\n @sproject.destroy\n\n respond_to do |format|\n format.html { redirect_to sprojects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize!(@site)\n\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @website = Website.find(params[:id])\n @website.destroy\n\n head :no_content\n end",
"def destroy\n @project = @client.projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to @client }\n end\n end",
"def remove\n @site = Site.find(params[:id])\n @study.sites.delete(@site)\n\n respond_to do |format|\n format.xml { head :ok }\n format.js\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n format.js\n end\n end",
"def destroy\n @site_url.destroy\n respond_to do |format|\n format.html { redirect_to site_urls_url, notice: \"Site url was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @selector_site = SelectorSite.find(params[:id])\n @selector_site.destroy\n\n respond_to do |format|\n format.html { redirect_to(selector_sites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project.destroy\n head :no_content\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.delete\n\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_sites_url, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n\n head :no_content\n end",
"def destroy\n Project.destroy(params[:id])\n redirect_to '/'\n end",
"def destroy\n @website = Website.find(params[:id])\n @website.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_websites_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @study_site.destroy\n respond_to do |format|\n format.html { redirect_to study_sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Company.find(params[:company_id]).projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n standard_destroy(Project, params[:id])\n end",
"def destroy \n @project = Project.find(params[:id])\n @project.destroy\n redirect_to root_url\n end",
"def destroy\n @produktion_site = ProduktionSite.find(params[:id])\n @produktion_site.destroy\n\n respond_to do |format|\n format.html { redirect_to produktion_sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n redirect_to index_project_path\n end",
"def destroy\n @website = Website.find(params[:id])\n @website.destroy\n\n respond_to do |format|\n format.html { redirect_to(websites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site.destroy\n redirect_to admin_sites_url, notice: t('admin.destroy.success')\n end",
"def delete(connection)\n r = connection.execute(%(<SiteDeleteRequest session-id=\"#{connection.session_id}\" site-id=\"#{@id}\"/>))\n r.success\n end",
"def destroy\n @project = @sprint.projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { \n flash[:notice] = 'Site was successfully removed.'\n if current_user.admin? \n redirect_to admin_path\n else\n redirect_to(sites_url)\n end\n }\n format.xml { head :ok }\n end\n end",
"def destroy\n @signspot_project = Signspot::Project.find(params[:id])\n @signspot_project.destroy\n\n respond_to do |format|\n format.html { redirect_to signspot_projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to xmt_press_sites_url, notice: '站点删除成功.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, @project\n @project.destroy\n\n head :no_content\n end",
"def destroy\n @site = Site.find(params[:id])\n \n return if !self.authorize?\n \n @site.destroy\n \n respond_to do |format|\n format.html { redirect_to sites_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @statusproject = Statusproject.find(params[:id])\n @statusproject.destroy\n\n respond_to do |format|\n format.html { redirect_to(statusprojects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ourproject = Ourproject.find(params[:id])\n @ourproject.destroy\n\n respond_to do |format|\n format.html { redirect_to ourprojects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @anatomic_site.destroy\n respond_to do |format|\n format.html { redirect_to anatomic_sites_url, notice: 'Anatomic site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n links = ProjectTechnology.where(:project_id => @project.id)\n puts \"========================\".yellow\n links.each do |l|\n puts \"Destroy : #{l}\".red\n l.destroy\n end\n puts \"========================\".yellow\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n\n redirect_to user_projects_url(@user)\n end",
"def destroy\n # return if need_login true, true\n @site = Site.find params[:id]\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n end",
"def destroy\n @project = Admin::Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n redirect_to(projects_url)\n end",
"def destroy\n @watch_site = WatchSite.find(params[:id])\n @watch_site.destroy\n\n respond_to do |format|\n format.html { redirect_to watch_sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n \n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sproject.destroy\n respond_to do |format|\n format.html { redirect_to sprojects_url, notice: 'Sproject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # Se busca el proyecto por el id\n @project = Project.find(params[:id])\n # Se destruye\n @project.destroy\n redirect_to projects_url\n end",
"def destroy\n @optimized_site.destroy\n respond_to do |format|\n format.html { redirect_to optimized_sites_url, notice: 'Optimized site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n end\n end",
"def destroy\n @site_config = SiteConfig.find(params[:id])\n @site_config.destroy\n\n respond_to do |format|\n format.html { redirect_to site_configs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n \n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = @client.projects.find(params[:id])\n\n begin\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_projects_url(@client), notice: 'Project was deleted.') }\n format.xml { head :ok }\n end\n rescue ActiveRecord::DeleteRestrictionError\n redirect_to client_project_url(@client, @project), notice: \"Delete was restricted.\"\n end\n end",
"def destroy\n @past_project = PastProject.find(params[:id])\n @past_project.destroy\n\n respond_to do |format|\n format.html { redirect_to past_projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = @user.project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_projects_url) }\n format.xml { head :ok }\n end\n end"
] | [
"0.7523925",
"0.7515405",
"0.74884456",
"0.74365526",
"0.74279046",
"0.74185526",
"0.7413889",
"0.7412574",
"0.7405516",
"0.73911226",
"0.73911226",
"0.73911226",
"0.73911226",
"0.73911226",
"0.7365301",
"0.7365301",
"0.7365301",
"0.7365301",
"0.7365301",
"0.7365301",
"0.7365301",
"0.7365301",
"0.72997177",
"0.7281054",
"0.7252795",
"0.7238115",
"0.7236038",
"0.7227813",
"0.722776",
"0.7213687",
"0.72045445",
"0.72045445",
"0.72045445",
"0.72045445",
"0.72045445",
"0.7157083",
"0.7150348",
"0.7139609",
"0.7116196",
"0.7098568",
"0.7083229",
"0.7070767",
"0.70527536",
"0.7052328",
"0.7050867",
"0.7048323",
"0.70391524",
"0.70308965",
"0.70276713",
"0.70274085",
"0.7010286",
"0.70059896",
"0.7002485",
"0.69951373",
"0.6990866",
"0.6983751",
"0.6980706",
"0.69767565",
"0.6973819",
"0.6973819",
"0.6973819",
"0.6973819",
"0.6973819",
"0.6973819",
"0.6973819",
"0.6973301",
"0.6973209",
"0.69708306",
"0.69688",
"0.69637036",
"0.6949989",
"0.6944351",
"0.69425404",
"0.6933583",
"0.69318986",
"0.6931296",
"0.69107366",
"0.6908961",
"0.69005036",
"0.68995553",
"0.689306",
"0.6881222",
"0.6878843",
"0.68748826",
"0.68715274",
"0.6866798",
"0.68599117",
"0.68475324",
"0.68436515",
"0.6843106",
"0.68283033",
"0.682029",
"0.68155223",
"0.68129355",
"0.6809028",
"0.6805983",
"0.6803088",
"0.6795762",
"0.6792982",
"0.6787382"
] | 0.73844576 | 14 |
GET|POST /sites/filter GET|POST /projects/:project_id/sites/filter | def filter
do_authorize_class
get_project_if_exists
do_authorize_instance(:show, @project) unless @project.nil?
filter_response, opts = Settings.api_response.response_advanced(
api_filter_params,
list_permissions,
Site,
Site.filter_settings
)
respond_filter(filter_response, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @projects = Project.all\n \n filter = params[:filter]\n by = params[:by]\n \n if filter == 'all' or filter == 'New Posts'\n @projects = filter_projects(filter)\n elsif filter == 'Type' or filter == 'Region' or filter == 'Budget' or filter == 'Popular'\n @projects = filter_projects_by(filter, by)\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def apply_project_filters(project)\n handle_action_exceptions(__method__) do\n cmd_line = [\"applyprojectfilters '#{project}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def index\n \n binary_select_options = [['Yes', true], ['No', false]]\n status_of_project = [['Open', 'open'], ['In Process', 'in process'], ['Complete', 'complete']]\n\n @filterrific = initialize_filterrific(\n Project,\n params[:filterrific],\n select_options: {\n project_status: status_of_project,\n plattform_mobile: binary_select_options,\n plattform_desktop: binary_select_options,\n platform_tablet: binary_select_options,\n assets_text: binary_select_options,\n assets_images: binary_select_options,\n assets_videos: binary_select_options,\n assets_audio: binary_select_options,\n assets_database: binary_select_options,\n due_date_less_then_month: binary_select_options,\n due_date_one_month: binary_select_options,\n due_date_three_month: binary_select_options,\n due_date_plus_three_month: binary_select_options,\n pages_landing_pages: binary_select_options,\n pages_two_pages: binary_select_options,\n\n },\n default_filter_params: {},\n sanitize_params: false,\n ) or return\n @projects = @filterrific.find.order(created_at: :desc)\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def filter_projects\n respond_to do |format|\n format.json {\n @projects = Project.all\n param = params[:payload]\n\n # go through each filter and get projects matching all filters\n if param[:filter]\n for filter in param[:filter]\n\n # get projects matching current filter\n if filter[:name] == 'In-progress'\n @filter_project = Project.where(:completed => false)\n elsif filter[:name] == 'Completed'\n @filter_project = Project.where(:completed => true)\n else\n @project_requirements = ProjectRequirement.where(:requirement_subcategory_id => filter[:id])\n @filter_project = Array.new\n for req in @project_requirements\n @filter_project.push(Project.find_by_id(req.project_id))\n end\n end\n\n # exclude projects\n # that don't have current filter from list\n @new_project_list = Array.new\n for item in @filter_project\n if @projects.include?(item)\n @new_project_list.push(item)\n end\n end\n @projects = @new_project_list\n end\n end\n\n # grab a page of projects (10)\n direction = param[:direction]\n current_offset = (params[:payload][:pagenumber] - 1)*10\n\n if @projects and current_offset + direction < @projects.length && current_offset + direction >= 0\n offset = current_offset + direction\n @return_projects = @projects.offset(offset).take(10)\n\n render :json => @return_projects\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def filter\n setup_instance_variables\n render 'index'\n end",
"def filters\n end",
"def filter\n @filter = params[:q]\n end",
"def select\n @filter = current_user.company.task_filters.find(params[:id])\n\n if @filter.user == current_user or @filter.shared?\n target_filter = current_task_filter\n target_filter.qualifiers.clear\n target_filter.keywords.clear\n target_filter.unread_only = @filter.unread_only\n\n @filter.qualifiers.each { |q| target_filter.qualifiers << q.clone }\n @filter.keywords.each do |kw|\n # N.B Shouldn't have to pass in all these values, but it\n # doesn't work when we don't, so...\n target_filter.keywords.build(:task_filter => target_filter,\n :company => current_user.company,\n :word => kw.word)\n end\n target_filter.save!\n else\n flash[:notice] = _\"You don't have access to that task filter\"\n end\n if request.xhr?\n render :partial => \"search_filter_keys\"\n else\n redirect_to '/tasks/list'\n end\n end",
"def sitefilter(*values)\n values.inject(self) { |res, val| res._sitefilter(val) or fail ArgumentError, \"Unknown value for sitefilter: #{val}\" }\n end",
"def index\n cookies.to_hash.each_pair do |k, v|\n if cookies[k.to_sym].split('_')[0] == \"field\"\n cookies.delete(k.to_sym)\n end\n end\n cookies.delete(:filter)\n @these_projects = Project.find(:all)\n end",
"def index\n @runs = policy_scope(Run)\n filtering_service = FilterRunsService.new from: params[:from], to: params[:to], runs: @runs\n\n # making a readable description to user filter\n @desc = filtering_service.description\n @runs = filtering_service.filter \n end",
"def filters; end",
"def filters; end",
"def filter\n end",
"def index\n do_authorize_class\n get_project_if_exists\n do_authorize_instance(:show, @project) unless @project.nil?\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json do\n @sites, opts = Settings.api_response.response_advanced(\n api_filter_params,\n list_permissions,\n Site,\n Site.filter_settings\n )\n respond_index(opts)\n end\n end\n end",
"def index\n authorize TransportCompany\n @filterrific = initialize_filterrific(\n TransportCompany,\n params[:filterrific],\n select_options: {\n }\n ) or return\n\n @transport_companies = @filterrific.find.page(params[:page])\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def index\n authorize Project\n ## TODO: Is this A magic String? the \"Show_shib_link?\" as we define it and users dont see cookies\n\t\tif user_signed_in? then\n\t\t\tif (current_user.shibboleth_id.nil? || current_user.shibboleth_id.length == 0) && !cookies[:show_shib_link].nil? && cookies[:show_shib_link] == \"show_shib_link\" then\n\t\t\t\tflash.notice = \"Would you like to #{view_context.link_to I18n.t('helpers.shibboleth_to_link_text'), user_omniauth_shibboleth_path}\".html_safe\n\t\t\tend\n\n\t\t\t@projects = current_user.projects.filter(params[:filter])\n\t\t\t@has_projects = current_user.projects.any? # unfiltered count\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # index.html.erb\n\t\t\tend\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to edit_user_registration_path }\n\t\t\tend\n\t\tend\n\tend",
"def index\n @project = Project.find_by_permalink(params[:project_id])\n @user = get_current_user\n\n respond_to do |format|\n if @project and @project.users.exists?(@user)\n\n params[:state] = \"active\" unless params[:state]\n @bugs = Bug.filter(params, {:project => @project})\n\n format.html # show.html.erb\n format.xml { render :xml => @project }\n else\n format.html { redirect_to(projects_url, :notice => 'Specified project does not exist') }\n end\n end\n end",
"def index\n authorize Project\n @projects = Project.filter(params.slice(:organization_id, :status)).includes([:commodity, :organization, :commodity_source, :unit_of_measure]) \n end",
"def index\n @sites = current_user.sites\n @posts = current_user.posts.filter_post_type(params[:post_type]).filter_site(params[:site]).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @posts }\n end\n end",
"def index\n filter = params.permit(:id, :category_id)\n @projects = Project.plusminus_tally.where(filter)\n #authorize! :show, @projects\n end",
"def index\n render_collection filter_reports(filter_params), status: :ok\n end",
"def index\n render_collection filter_reports(filter_params), status: :ok\n end",
"def filter\n\t\t@tours = Tour.all.order('created_at ASC').where(country: params[:country]).page(params[:page]).per(4)\n\t\trender :index\n\tend",
"def apply_filter\n end",
"def openqa_filter(project)\n return strategy.openqa_filter(project)\n end",
"def index\n @complete = params[:complete]\n\n projects = []\n unless params[:filter].blank?\n projects = Project.all(:conditions => [\"UPPER(name) like ?\",params[:filter].upcase+'%']).inject([]) {|tab, val| tab << val.id }\n end\n\n if @complete.blank? or @complete == 'false'\n @complete = false\n if params[:filter].blank?\n @tasks = Task.paginate(:page => params[:page], :conditions => [\"complete = ?\", @complete],:order => \"priority ASC, created_at ASC\" )\n else\n @tasks = Task.paginate(:page => params[:page], :conditions => [\"complete = ? AND project_id in (?)\", @complete, projects],:order => \"priority ASC, created_at ASC\" )\n end\n else\n @complete = true\n if params[:filter].blank?\n @tasks = Task.paginate(:page => params[:page], :conditions => [\"complete = ?\", @complete],:order => \"updated_at DESC\")\n else\n @tasks = Task.paginate(:page => params[:page], :conditions => [\"complete = ? AND project_id in (?)\", @complete, projects],:order => \"updated_at DESC\")\n end\n end\n\n end",
"def filter\n tag_list=params[:tags].split(/,/)\n @projects = Project.visible.find_all_for_all_tags(tag_list)\n @tags = Tag.\n for_projects(@projects).\n reject { |tag| tag_list.include?(tag.name) }\n @tag_count = Hash.new(0)\n @projects.each do |project|\n project.tags.each do |tag|\n @tag_count[tag.name] += 1\n end\n end\n @tag_sum = 0\n @tags.each { |tag| @tag_sum += @tag_count[tag.name] }\n render :layout => 'base'\n end",
"def filter\n do_authorize_class\n\n filter_response, opts = Settings.api_response.response_advanced(\n api_filter_params,\n Access::ByPermission.dataset_items(current_user, dataset_id: params[:dataset_id]),\n DatasetItem,\n DatasetItem.filter_settings(:reverse_order)\n )\n\n respond_filter(filter_response, opts)\n end",
"def index\n @projects = Project.all\n if params[:filtered]\n @custom_search = true\n end\n if params[:search]\n @projects = Project.search(params[:search]).order(\"created_at DESC\")\n else\n @projects = Project.all.order(\"created_at DESC\")\n end\n end",
"def index\r\n #front end view used\r\n\r\n session[:filter_type] = nil\r\n session[:filter_query] = nil\r\n Rails.cache.delete('total_stats')\r\n\r\n #randomize what project a user sees when first going to the website\r\n #changes everyday at midnight\r\n @project = []\r\n\r\n if cookies[:landing_project].blank?\r\n rand_command = ActiveRecord::Base.connection.adapter_name.downcase.include?('mysql') ? \"RAND()\" : \"RANDOM()\" #RAND() for MySQL; RANDOM() for sqlite3\r\n @project = Project.exclude_multi_project.has_outreach.published.first(:order => rand_command)\r\n cookies[:landing_project] = { :value => @project.name, :expires => Time.now.midnight + 1.day} if @project\r\n else\r\n @project = Project.find_by_name(cookies[:landing_project])\r\n end\r\n\r\n if @project\r\n results = get_project_slider_info(@project.name)\r\n @project_slider_html = results\r\n @formatted_project_name = @project.name.gsub(' ','_')\r\n end\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(:controller => 'projects', :action => 'show', :id => @formatted_project_name) }\r\n format.xml { render :xml => @project }\r\n end\r\n end",
"def index\n @grouped_companies = Company.all.group_by(&:geography) \n @companies = params[:q] ? company_filteration(params[:q],params[:region]) : Company.all\n render layout: \"browse\"\n end",
"def filter(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"filters/#{id}\", params)\n end",
"def filter(results)\n if params[:q].present?\n results = Project.search(results, params[:q])\n end\n \n if params[:tag].present?\n results = Project.match_tag(results, params[:tag])\n end\n \n return results\n end",
"def query\n respond_to do |format|\n format.html{ redirect_to root_path }\n format.json{\n render :json => @filter.run(params)\n }\n end\n end",
"def filter\n query = build_query()\n @lancamentos = query\n\n\n render :layout => nil\n end",
"def filter_by_schedule()\n return if authorise_for_web(program_name?,'read') == false\n render_filter_by_schedule\n end",
"def index\n @activities = Activity.scheduled( current_user ).joins( :project ).where( 'projects.completed' => false ).paginate( :page => params[:page], :conditions => search_conditions )\n\n filter_by_tags\n user_sorting\n \n respond_to do |format|\n format.js { }\n format.html { }\n format.xml { render :xml => @activities }\n format.json { render :json => @activities }\n end\n end",
"def index\n if admin?\n if params[:search].present?\n @search = params[:search]\n @projects = Project.where('title ILIKE ? OR students ILIKE ? OR semester ILIKE ? OR description ILIKE ?', \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\" , \"%#{params[:search]}%\").order('created_at DESC')\n else\n @projects = Project.all.order('created_at DESC')\n end\n else\n if params[:search].present?\n @search = params[:search]\n @projects = Project.where(approved: true).where('title ILIKE ? OR students ILIKE ? OR semester ILIKE ? OR description ILIKE ?', \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\" , \"%#{params[:search]}%\").order('created_at DESC')\n else\n @projects = Project.where(approved: true).order('title')\n end\n end\n end",
"def filter\n filter = \"\"\n\n if session[:filter_user].to_i > 0\n task_ids = User.find(session[:filter_user].to_i).tasks.collect { |t| t.id }.join(',')\n if task_ids == ''\n filter = \"tasks.id IN (0) AND \"\n else\n filter = \"tasks.id IN (#{task_ids}) AND \"\n end\n elsif session[:filter_user].to_i < 0\n not_task_ids = Task.find(:all, :select => \"tasks.*\", :joins => \"LEFT OUTER JOIN task_owners t_o ON tasks.id = t_o.task_id\", :readonly => false, :conditions => [\"tasks.company_id = ? AND t_o.id IS NULL\", current_user.company_id]).collect { |t| t.id }.join(',')\n if not_task_ids == ''\n filter = \"tasks.id = 0 AND \"\n else\n filter = \"tasks.id IN (#{not_task_ids}) AND \" if not_task_ids != \"\"\n end\n end\n\n if session[:filter_milestone].to_i > 0\n filter << \"tasks.milestone_id = #{session[:filter_milestone]} AND \"\n elsif session[:filter_milestone].to_i < 0\n filter << \"(tasks.milestone_id IS NULL OR tasks.milestone_id = 0) AND \"\n end\n\n unless session[:filter_status].to_i == -1 || session[:filter_status].to_i == -2\n if session[:filter_status].to_i == 0\n filter << \"(tasks.status = 0 OR tasks.status = 1) AND \"\n elsif session[:filter_status].to_i == 2\n filter << \"(tasks.status > 1) AND \"\n else\n filter << \"tasks.status = #{session[:filter_status].to_i} AND \"\n end\n end\n\n if session[:filter_status].to_i == -2\n filter << \"tasks.hidden = 1 AND \"\n else\n filter << \"(tasks.hidden = 0 OR tasks.hidden IS NULL) AND \"\n end\n\n if session[:hide_deferred].to_i > 0\n filter << \"(tasks.hide_until IS NULL OR tasks.hide_until < '#{@tz.now.utc.to_s(:db)}') AND \"\n end \n\n unless session[:filter_customer].to_i == 0\n filter << \"tasks.project_id IN (#{current_user.projects.find(:all, :conditions => [\"customer_id = ?\", session[:filter_customer]]).collect(&:id).compact.join(',') }) AND \"\n end\n\n filter << \"(tasks.milestone_id NOT IN (#{@completed_milestone_ids}) OR tasks.milestone_id IS NULL) \"\n\n return filter\n end",
"def keyword_filter\n @keyword = params[:keyword]\n @destination = params[:destination]\n @urls = Url\n .by_keyword(@keyword)\n .created_by_id(current_user.context_group_id)\n end",
"def index\n get_posts_with_filter\n end",
"def schedule_filter\n redirect_params = {}\n redirect_params[:month] = params[:month] if params[:month]\n redirect_params[:year] = params[:year] if params[:year]\n\n render(:partial => \"tasks/filter\", \n :locals => { \n :redirect_params => redirect_params,\n :hide_grouping => true,\n :hide_colors => true,\n :hide_icons => true,\n :hide_sorting => true,\n :hide_organize => true,\n :hide_hide_dependencies => true\n })\n end",
"def filter\n filter_type = params[:filter][:type]\n case filter_type\n when \"last_seven\", \"weekly\"\n @filter = \"Weekly\"\n @filtered_runs = current_user.runs.in_the_last_week\n when \"last_thirty\", \"monthly\"\n @filter = \"Monthly\"\n @filtered_runs = current_user.runs.in_the_last_thirty_days\n when \"year\", \"yearly\"\n @filter = \"Yearly\"\n @filtered_runs = current_user.runs.in_the_last_year\n when \"lifetime\"\n @filter = \"Lifetime\"\n @filtered_runs = current_user.runs.most_recent_by_date\n end\n\n respond_to do |format|\n format.js\n end\n\n end",
"def apply_filter(rel)\n if filter.present?\n Response.do_search(rel, filter, :mission => mission)\n else\n rel\n end\n end",
"def apply_filter\n offset = (params[:page].to_i - 1) * params[:perpage].to_i\n limit = params[:perpage]\n\n results = get_results(offset, limit)\n result_list = get_fields_to_show(results['elements'])\n \n data = Hash.new\n data['total'] = results['total']\n data['result'] = result_list\n respond_to do |format|\n format.json { render :json => data.to_json }\n end\n end",
"def filter\n\n query = params[:query]\n orgs = params[:organization_id] ? [params[:organization_id].to_i] : @organization_list\n query_str = \"%\" + query + \"%\"\n Rails.logger.debug query_str\n\n matches = []\n assets = Asset.where(\"organization_id in (?) AND (asset_tag LIKE ? OR object_key LIKE ? OR description LIKE ?)\", orgs, query_str, query_str, query_str)\n if params[:allow_parent].to_i == 1 # only allow assets of types that allow parents and dont already have parents\n assets = assets.where(asset_type: AssetType.where(allow_parent: true), parent_id: nil)\n end\n assets.each do |asset|\n matches << {\n \"id\" => asset.object_key,\n \"name\" => \"#{asset.name}: #{asset.description}\"\n }\n end\n\n respond_to do |format|\n format.js { render :json => matches.to_json }\n format.json { render :json => matches.to_json }\n end\n\n end",
"def index\n render_collection filter_labels(filter_params), status: :ok\n end",
"def index\n if params.has_key?(:filters) && (params[:filters].has_key?(:with_category) || params[:filters].has_key?(:with_filter_category)) \n if params[:filters].has_key?(:with_category)\n approved_posts = Category.find(params[:filters][:with_category]).posts.approved\n else\n approved_posts = Category.find(params[:filters][:with_filter_category]).posts.approved\n end\n else \n approved_posts = Post.approved\n end\n if params.has_key?(:sort) && params[:sort] == 'asc'\n approved_posts = approved_posts.asc\n else\n approved_posts = approved_posts.desc\n end\n approved_posts = filtrate(approved_posts)\n @pagy, @posts = pagy(approved_posts)\n @categories = Category.all\n if params[:filters]\n @search_text = params[:filters][:with_text]\n end\n end",
"def filter\n params.merge!(user_id: session[:user_id])\n case params[:filter_select]\n when gender_and_location_filter\n @posts = Post.filter_by_gender(post_filter_params).filter_by_location(post_filter_params)\n when pace_filter\n @posts = Post.filter_by_pace(post_filter_params)\n when age_filter\n @posts = Post.filter_by_age(post_filter_params)\n when time_filter\n @posts = Post.filter_by_time(post_filter_params)\n when commitment_filter\n @posts = Post.filter_by_commitment(post_filter_params)\n end\n\n render json: @posts, each_serializer: PostSerializer\n end",
"def index\n\n if ! params[\"template_id\"].nil?\n\n @template = Template.find(params[\"template_id\"])\n\n if ! @template.nil?\n\n @filters= Filter.where(\"template = ?\",params[\"template_id\"])\n\n end\n\n end\n\n if @filters.nil?\n\n @filters = Filter.all\n\n end\n\n end",
"def index\n \n if params[:filter] === 'not published'\n @puns = Pun.all.where(is_published: false).order(:publication_date)\n elsif params[:filter] === 'published'\n @puns = Pun.all.where(is_published: true).order(:publication_date)\n else\n @puns = Pun.all.order(:publication_date)\n end\n \n respond_to do |format|\n # debugger\n format.html\n format.json { render json: @puns, status: 201 } \n end\n\n end",
"def filter\n\t\tchain(\n\t\t\tsuper, # Use automatic filter switching, i.e. use params[:filter] and #filter_options\n\t\t\t{:published => true}, # Only find published tags\n\t\t\tlambda { |tag| !tag.active_businesses_in_city(@city).empty? } # Only find tags with at least one active business\n\t\t)\n\tend",
"def update_filters\n @pipeline_course_filter = PipelineCourseFilter.find_by_service_learning_course_id params[:id]\n \n @pipeline_course_filter.filters = params[\"search\"]\n @pipeline_course_filter.save\n \n @service_learning_course = @pipeline_course_filter.service_learning_course\n \n @filters = @pipeline_course_filter.filters\n \n filter_search\n \n respond_to do |format|\n format.js\n format.html { redirect_to(service_learning_course_path(@unit, @quarter, @service_learning_course)) }\n end\n end",
"def filter_search\n @subjects = PipelinePositionsSubject.find(:all,:order=>\"name\")\n @grades = PipelinePositionsGradeLevel.all\n @formats = PipelinePositionsTutoringType.find(:all,:order=>\"name\")\n \n @schools = School.find(:all,:order => \"organizations.name\")\n\n @neighborhoods = @schools.collect{|school| school.locations[0].neighborhood rescue nil}.compact.uniq.sort\n \n @pipeline_positions = generate_pipeline_search(true)\n end",
"def index\n @filters = Filter.all\n end",
"def index\n if params[:query].present?\n @projects = Project.global_search(params[:query]).limit(12)\n else\n if user_signed_in? || params[:all]\n @projects = Project.where(status: \"Started\").where.not(user_id: current_user.id).limit(12)\n else\n @projects = Project.where(status: \"Started\").limit(12)\n end\n end\n end",
"def stories(project, api_key, filter='')\n\treq = Net::HTTP::Get.new(\n \"/services/v3/projects/#{project}/stories?filter=#{filter}\",\n {'X-TrackerToken'=>api_key}\n )\n res = Net::HTTP.start(@pt_uri.host, @pt_uri.port) {|http|\n http.request(req)\n }\n\n return res.body\nend",
"def show\r\n @filter_type = session[:filter_type]\r\n @filter_query = session[:filter_query]\r\n\r\n params[:id] = params[:name] if params[:name]\r\n\r\n @project = Project.first(:conditions => [\"lower(name) = ?\", params[:id].downcase.gsub(\"_\",\" \").gsub(\"/\",\"\")])\r\n\r\n if @project.blank?\r\n respond_to do |format|\r\n format.html { render :file => \"#{Rails.root}/public/404.html\", :status => :not_found }\r\n format.xml { head :not_found }\r\n format.any { head :not_found }\r\n end\r\n return\r\n end\r\n\r\n results = get_project_slider_info(@project.name)\r\n @project_slider_html = results\r\n @formatted_project_name = @project.name.gsub(' ','_')\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @project }\r\n end\r\n end",
"def select_filters\n @screen = session.active_screen\n @report = Report.find(params[:id])\n @available_field_filters = @report.fields_for_filters\n @set_field_filters = {}\n @report.field_report_filters.each{|frf|\n @set_field_filters[frf.reference_screen_index] ||= {}\n @set_field_filters[frf.reference_screen_index][frf.field_id] = frf\n }\n\n respond_to do |format|\n format.html # formats.html.erb\n format.xml { render :xml => @report }\n end\n end",
"def apply_filters(query)\n query\n end",
"def filter_by_city\n @restaurants = @restaurants.where(city: params[:city])\n end",
"def filtered(env)\n @filter ||= ActionDispatch::Http::ParameterFilter.new(Rails.application.config.filter_parameters)\n @filter.filter(env)\n end",
"def apply_filters(results:)\n return results unless filter_params.present?\n\n if filter_params[:organization_id].present? && !filter_params[:funder_id].present?\n return DataManagementPlan.find_by_organization(\n organization_id: filter_params[:organization_id]\n )\n end\n\n if filter_params[:funder_id].present? && !filter_params[:organization_id].present?\n return DataManagementPlan.find_by_funder(\n organization_id: filter_params[:funder_id]\n )\n end\n\n DataManagementPlan.find_by_organization(organization_id: filter_params[:organization_id])\n .find_by_funder(organization_id: filter_params[:funder_id])\n end",
"def index\n #return unless only_admin 'see all tasks'\n #@tasks = Task.all\n @q = Task.ransack(params[:q])\n @tasks = @q.result.page(params[:page])\n # raise '999'\n if params[:q].has_key? :project_id_eq\n render \"projects/show\", project: @project = Project.find(params[:q][:project_id_eq]), tasks: @tasks, q: @q, id: params[:q][:project_id_eq]\n end\n # Parameters: {\"utf8\"=>\"✓\", \"q\"=>{\"title_cont\"=>\"T\", \"project_id_eq\"=>\"4\"}, \"commit\"=>\"Search\"}\n end",
"def index \n @source_webs = SourceWeb.websources(params[:project_id]) \n end",
"def index\n @categories = Category.all\n if params[:my_projects] && params[:search].present?\n @projects = Project.where(\"user_id = ?\", current_user.id).where('title LIKE ?', \"%#{params[:search]}%\")\n elsif params[:search].present?\n @projects = Project.where('title LIKE ?', \"%#{params[:search]}%\")\n elsif params[:my_projects] && params[:category].present?\n @projects = Project.where(\"user_id = ?\", current_user.id).where(\"category_id= ?\", params[:category])\n elsif params[:my_projects] && params[:outstanding]\n @projects = Project.where(\"user_id = ?\", current_user.id).where(outstanding: true)\n elsif params[:my_projects] && params[:funded]\n @allprojects = Project.where(\"user_id = ?\", current_user.id)\n\t @projects = []\n\t @allprojects.each do |project|\n\t @sum = ProjectFunding.where(\"project_id= ?\",project.id).sum(:amount)\n \t if @sum >= project.goal_amount\n \t @projects<<(project)\n \t end\n end\n elsif params[:my_projects]\n @projects = Project.where(\"user_id = ?\", current_user.id)\n elsif params[:funded]\n @allprojects = Project.all\n\t @projects = []\n\t @allprojects.each do |project|\n\t @sum = ProjectFunding.where(\"project_id= ?\",project.id).sum(:amount)\n \t if @sum >= project.goal_amount\n \t @projects<<(project)\n \t end\n end\n elsif params[:outstanding]\n @projects = Project.where(outstanding: true)\n elsif params[:category].present?\n @projects = Project.where(\"category_id= ?\", params[:category])\n else\n @projects = Project.all\n end \n end",
"def filter_data\n case params[:filter][:info]\n when 'Public'\n @tag = Tag.find_by(tag: 'Public')\n when 'Basketball Courts'\n @tag = Tag.find_by(tag: 'Basketball Courts')\n when 'Book Store'\n @tag = Tag.find_by(tag: 'Book Store')\n end\n\n @joins = Tagtoilet.where('tag_id = ?', @tag.id)\n @toilets = @joins.map{|join| Toilet.find(join.toilet_id)}\n @toilets.to_json\n end",
"def index\n @cell_filterings = []\n @project = Project.where(:key => params[:project_key]).first\n\n @cell_filterings = CellFiltering.where(:project_id => @project.id).all\n # get_cluster_data() \n render :partial => 'index'\n end",
"def filters=(_arg0); end",
"def filters=(_arg0); end",
"def index\n @restaurants = Restaurant.all\n filter_by_query if params[:q]\n filter_by_city if params[:city]\n filter_by_category if params[:category]\n end",
"def filter_params\n params.permit(\n type: [],\n id: []\n ).to_h.symbolize_keys.merge!(project_id: sessions_current_project_id)\n end",
"def get_by_show_filter(filter_by)\n filters = Constants::ProjectsIndexFilters\n filters = filters.merge(Constants::AdminProjectsIndexFilters) if current_user.role? :booktrope_staff\n @grid_title = \"The Grid\"\n\n unless filter_by.nil? || !filters.has_key?(filter_by.to_sym)\n if filter_by.to_sym == :all\n @projects = ProjectGridTableRow.includes(project: [:cover_template])\n .not_archived\n .all\n elsif filter_by.to_sym == :my_books\n get_my_projects\n elsif filter_by.to_sym == :not_published\n get_unpublished_books\n else\n @grid_title = filters[filter_by.to_sym][:label]\n @grid_title = filters[filter_by.to_sym][:task_name] if @grid_title.empty?\n pgtr_meta_hash = filters[filter_by.to_sym]\n @projects = ProjectGridTableRow.includes(project: [:cover_template])\n .where(\"#{pgtr_meta_hash[:workflow_name]}_task_name = ?\", pgtr_meta_hash[:task_name])\n .not_archived\n end\n end\n end",
"def global_filter; end",
"def index\n page = Integer(params[:page]) rescue 1\n @offset = (page - 1)*PER_PAGE\n offset = @offset\n\n # Filter by status\n @status = if params[:status].present?\n params[:status]\n elsif cookies[:home_status_filter].present?\n cookies[:home_status_filter]\n else\n 'uncompleted'\n end\n\n unless %w(uncompleted completed all).include?(@status)\n @status = 'uncompleted'\n end\n status = @status\n\n limit = params.fetch(:limit, PER_PAGE).to_i\n\n exported = if params[:exported].present?\n params[:exported] == 'true'\n elsif cookies[:home_email_filter].present?\n cookies[:home_exported_filter] == 'true'\n else\n false\n end\n\n show_autoimport = if params[:show_autoimport].present?\n params[:show_autoimport] == 'true'\n elsif cookies[:home_autoimport_filter].present?\n cookies[:home_autoimport_filter] == 'true'\n else\n false\n end\n\n case\n when (exported and show_autoimport) then @filters = ''\n when (exported) then @filters = '(Hiding auto-imported commits)'\n when (show_autoimport) then @filters = '(Hiding exported commits)'\n else @filters = '(Hiding exported and auto-imported commits)'\n end\n\n # Filter by project\n projects = if params[:project_id].present?\n params[:project_id]\n elsif cookies[:home_project_filter].present?\n cookies[:home_project_filter]\n else\n nil\n end\n\n projects = if projects == 'my-locales'\n Project.scoped.to_a.select do |project|\n (project.targeted_locales & current_user.approved_locales).any?\n end\n else\n [Project.find_by_id(projects)].compact\n end\n\n @project = projects.first if projects.length == 1\n\n # Filter by SHA\n sha = params[:sha].presence\n @sha = sha = (sha =~ /^[0-9A-F]+$/i ? sha.downcase : nil)\n\n # Filter by user\n # Changed for Jim Kingdon. Testing feature. Make it such that all users can see all commits.\n # params[:email] ||= current_user.email if current_user.monitor? && !current_user.admin?\n user = if params[:email].present?\n User.find_by_email(params[:email])\n elsif cookies[:home_email_filter].present? and cookies[:home_email_filter] != 'false'\n User.find_by_email(cookies[:home_email_filter])\n else\n nil\n end\n @filters = '(Only showing my commits)' if user\n\n @sort_order = sort_order = params[:sort].present? ? params[:sort] : cookies[:home_sort]\n @direction = direction = params[:direction].present? ? params[:direction] : cookies[:home_direction]\n\n @locales = locales = if params[:locales].present?\n params[:locales].split(',').map { |l| Locale.from_rfc5646 l }.compact\n else\n []\n end\n\n if @locales.present? && (status == 'uncompleted')\n uncompleted_key_ids_in_locales = uncompleted_key_ids_in_locales(@locales)\n end\n\n @commits = Commit.search(load: {include: [:user, project: :slugs]}) do\n filter :prefix, revision: sha if sha\n filter :term, project_id: projects.map(&:id) if projects.any?\n filter :term, user_id: user.id if user\n filter :term, exported: false unless exported\n\n filter :exists, field: :user_id unless show_autoimport\n\n case status\n when 'uncompleted'\n if locales.present?\n filter :terms, key_ids: uncompleted_key_ids_in_locales\n else\n filter :term, ready: false\n end\n when 'completed'\n filter :term, ready: true\n end\n\n from offset\n size limit\n\n sort do\n case sort_order\n when 'due'\n by :due_date, (direction.nil? ? 'asc' : direction)\n by :priority, 'asc'\n by :created_at, 'desc'\n when 'create'\n by :created_at, (direction.nil? ? 'desc' : direction)\n by :priority, 'asc'\n by :due_date, 'asc'\n else\n by :priority, (direction.nil? ? 'asc' : direction)\n by :due_date, 'asc'\n by :created_at, 'desc'\n end\n end\n end\n\n @home_presenter = HomePresenter.new(@commits, @locales)\n end",
"def cost_filters\n get('/1/reporting/cost/filters').to_a\n end",
"def index\n if filter_categories.blank?\n @pins = Pin.page(params[:page]).per_page(20).where(:publicgear => true).search(params[:search])\n else\n @pins = Pin.page(params[:page]).per_page(20).where(category: filter_categories, :publicgear => true).search(params[:search])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pins }\n end\n end",
"def index\n @search_projects = SearchProject.all\n end",
"def gantt_filter\n render(:partial => \"tasks/filter\", \n :locals => { \n :redirect_action => \"gantt\",\n :hide_grouping => true,\n :hide_colors => true,\n :hide_icons => true,\n :hide_organize => true,\n :hide_hide_dependencies => true\n })\n end",
"def index\n\n if current_user.profile.is_client?\n @projects = Project.where(:client_id => current_user.profile.client_id).order(sort_column + ' ' + sort_direction).page(params[:page])\n render :action => 'client_index'\n else\n @projects = Project.search(params[:search]).order(sort_column + ' ' + sort_direction).page(params[:page])\n end\n \n end",
"def index\n if params[:cluster_id]\n @cluster_projects = @projectable.projects\n @group_projects = @projectable.group_projects\n @all_projects = Project.where(id: (@[email protected]_project_ids)).order('name asc')\n\n if params[:state] == 'group'\n @projects = @group_projects\n elsif params[:state] == 'module'\n @projects = @projectable.projects\n else\n @projects = @all_projects\n end\n elsif params[:group_id]\n @projects = Group.find(params[:group_id]).projects\n @all_projects = @projects\n end\n\n @current_user_projects = @projects.with_user(current_user)\n if params[:ufilter] == 'you-are-in'\n @projects = @current_user_projects\n end\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @projects }\n end\n end",
"def apply_global_filters(query, filter_params)\n value = filter_params[:filter][999.to_s] rescue nil\n\n return query if value.blank?\n\n queries = []\n values = []\n\n # iterate over all filter inputs\n ajax_filters.each do |filter|\n next if filter.blank?\n next if filter.having.present?\n\n query, q, v = apply_filter(query, filter, value)\n\n next if q.blank?\n\n queries += Array(q)\n values += Array(v) unless v.nil?\n end\n\n query.where(queries.join(' OR '), *values)\n end",
"def index\n index_filter\n end",
"def index\n authorize Task\n @filterrific = initialize_filterrific(\n Task,\n params[:filterrific],\n select_options: {\n with_task_status_id: TaskStatus.options_for_select,\n with_assigned_to_id: User.options_for_select\n },\n ) or return\n\n #@filterrific.sorted_by = 'task_status_asc' if @filterrific.sorted_by.blank?\n\n @selected_per_page = get_session_per_page(Task.per_page)\n if @filterrific.with_task_status_id.nil?\n @tasks = @filterrific.find.for_user(current_user).not_closed.page(params[:page]).per_page(@selected_per_page)\n else\n @tasks = @filterrific.find.for_user(current_user).page(params[:page]).per_page(@selected_per_page)\n end\n respond_to do |format|\n format.html\n format.js\n end\n\n rescue ActiveRecord::RecordNotFound => e\n puts \"Had to reset filterrific params: #{ e.message }\"\n redirect_to(reset_filterrific_url(format: :html)) and return\n\nend",
"def filter; end",
"def filter; end",
"def filter; end",
"def show\r\n \r\n @free_filter = params[:freefilter]\r\n @uhd_filter = params[:uhdfilter]\r\n @search_string = params[:search] \r\n @start_dates = BroadcastEvent.current.distinct.pluck(:formatted_local_start_date).sort\r\n\r\n if params[:sport_name] && params[:sport_name] != params[:sport_name].downcase\r\n # handle URLs with uppercase sport name\r\n new_downcase_path = (\"/\" + params[:region_name] + \"/\" + params[:sport_name]).downcase\r\n redirect_to new_downcase_path, status: 301\r\n\r\n elsif params[:region_name] && params[:region_name] != params[:region_name].downcase\r\n # handle URLs with uppercase region name \r\n new_downcase_path = (\"/\" + params[:region_name]).downcase\r\n redirect_to new_downcase_path, status: 301\r\n\r\n elsif @search_string && @search_string != \"\"\r\n # GET /guides/:region_name/?search=:search\r\n @broadcast_events = @region.broadcast_events.joins(:program).where(formatted_local_start_date: @start_dates).where(\"programs.title like ? or programs.episode_title like ?\", \"%#{@search_string}%\", \"%#{@search_string}%\").includes(:program, :broadcast_service, :region, :channel, :keyword, :sport).ordered_for_tv_guide\r\n \r\n elsif @sport\r\n # GET /guides/:region_name/:sport_name \r\n @broadcast_events = @region.broadcast_events.where(formatted_local_start_date: @start_dates).where(sports: {id: @sport.id}).includes(:program, :broadcast_service, :region, :channel, :keyword, :sport).ordered_for_tv_guide\r\n \r\n else\r\n # GET /guides/:region_name\r\n @broadcast_events = @region.broadcast_events.where(formatted_local_start_date: @start_dates).includes(:program, :broadcast_service, :region, :channel, :keyword, :sport).ordered_for_tv_guide\r\n \r\n end \r\n \r\n if @free_filter && (@free_filter == \"true\")\r\n # GET /guides/:region_name/?freefilter=:freefilter\r\n # GET /guides/:region_name/:sport_name/?freefilter=:freefilter\r\n @broadcast_events = @broadcast_events.joins(:channel => :provider).where(channels: {providers: {service_tier: \"Free\"}})\r\n end\r\n if @uhd_filter && (@uhd_filter == \"true\")\r\n # GET /guides/:region_name/?uhd_filter=:uhd_filter\r\n # GET /guides/:region_name/:sport_name/?uhd_filter=:uhd_filter\r\n @broadcast_events = @broadcast_events.where(channels: {four_k_flag: true})\r\n end\r\n\r\n end",
"def filter\n @filter\n end",
"def index\n @selected_filters = Hash.new\n @events = Event.all\n if params[:filter]\n if params[:filter][:my]\n @events = @events.user_events current_user\n @selected_filters[:my] = 1\n end\n if params[:filter][:all]\n @selected_filters[:all] = 1 \n else\n @selected_filters[:recent] = 1 \n @events = @events.after\n end \n else\n @events = @events.after\n end\n end",
"def filter\n params['filter_field'] || '*'\n end",
"def search\n\n @searching = true\n results = Project.includes(:images, :videos, :account, :invoice).user_readable(current_user).search_for(params['search-string'])\n @projects = results.page(params[:page]).per(@@results_per_page)\n\n respond_to do |format|\n format.html { render action: \"index\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n\n end",
"def projects_matching_filter\n # rubocop: disable CodeReuse/Finder\n projects_nested_in_group = Project.where(namespace_id: hierarchy_for_parent.base_and_descendants.select(:id))\n params_with_search = params.merge(search: params[:filter])\n\n ProjectsFinder.new(params: params_with_search,\n current_user: current_user,\n project_ids_relation: projects_nested_in_group).execute\n # rubocop: enable CodeReuse/Finder\n end",
"def index\n feeds = []\n\n @blogs_filter = params[:filter].blank? ? \"All\" : params[:filter]\n\n @feeds = case @blogs_filter\n when \"All\" then UserFeed\n when \"Politics\" then UserFeed.politics\n when \"Technology\" then UserFeed.technology\n when \"Science\" then UserFeed.science\n when \"Sports\" then UserFeed.sports\n when \"Health\" then UserFeed.health\n when \"Art_Design\" then UserFeed.art\n when \"Finance\" then UserFeed.finance\n when \"US\" then UserFeed.us\n when \"Business\" then UserFeed.business\n when \"Travel\" then UserFeed.travel\n when \"Entertainment\" then UserFeed.entertainment\n when \"World\" then UserFeed.world\n end\n\n @feeds.where(:user_id => current_user.id).each do |feed|\n feeds << feed.feed_id unless feeds.include?(feed.feed_id)\n end\n\n @blogs = EntryFeed.where(:feed_id => feeds)\n\n if !params[:date_selected].blank?\n selected_dates = params[:date_selected].split(\",\").first\n date_1 = selected_dates.first\n date_2 = selected_dates.last\n @blogs = @blogs.where('published_at >= ? and published_at <= ?', date_1, date_2)\n end\n\n @blogs = @blogs.order(\"created_at DESC\").page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @blogs }\n end\n end",
"def index\n if params[:project_id]\n @stages = Stage.where(project_id: params[:project_id])\n .paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc).all\n render json: @stages\n else\n @stages = Stage.paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc).all\n render json: @stages\n end\n end",
"def index\n @sites = Site.order('updated_at DESC')\n @sites = @sites.search(params[:keyword]) if params[:keyword]\n @sites = @sites.please_designed if params[:please_design]\n @sites = @sites.page(params[:page]).per(15)\n \n @pickups = Site.pickups\n respond_to do |format|\n format.html\n format.js\n format.atom\n end\n end",
"def index\n @project = Project.where(:key => params[:project_key]).first\n @diff_exprs= @project.diff_exprs\n @h_diff_expr_filters = JSON.parse(@project.diff_expr_filter_json) \n get_norm_results()\n \n render :partial => 'index'\n end",
"def index\n# filter = \"\"\n session[:referer] = request.env[\"PATH_INFO\"] + \"?\" + request.env[\"QUERY_STRING\"]\n @task = if params[:cl_id].nil?\n Task.search(params[:search])\n elsif params[:search]\n Task.where([\"cl_id=? AND name LIKE ?\",params[:cl_id],\"%#{params[:search]}%\"]).order(\"zapros_gid desc,point_group desc,idtask asc\").paginate(:per_page => 30, :page => params[:page])\n else\n Task.where([\"cl_id=?\",params[:cl_id]]).order(\"zapros_gid desc,point_group desc,idtask asc\").paginate(:per_page => 30, :page => params[:page])\n end\n @client = Client.find(params[:cl_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def run_filters\n set_user\n authorize\n end"
] | [
"0.6695942",
"0.65546066",
"0.6224362",
"0.62091506",
"0.61379486",
"0.61110914",
"0.60876745",
"0.6036601",
"0.6003981",
"0.59945613",
"0.59913814",
"0.59524214",
"0.59524214",
"0.5950059",
"0.59470063",
"0.58867913",
"0.5873827",
"0.5869289",
"0.58607066",
"0.58587646",
"0.5856996",
"0.5837603",
"0.5837603",
"0.5830241",
"0.58094853",
"0.5797262",
"0.57964057",
"0.579194",
"0.57635814",
"0.5759302",
"0.57477295",
"0.5704732",
"0.56953174",
"0.5682653",
"0.5680731",
"0.5666113",
"0.5643378",
"0.564244",
"0.563333",
"0.56211233",
"0.56129473",
"0.56007516",
"0.55960435",
"0.55810136",
"0.5580865",
"0.5570884",
"0.55597705",
"0.55518556",
"0.5534518",
"0.55282295",
"0.551706",
"0.5502961",
"0.5485741",
"0.54839736",
"0.54826295",
"0.5473724",
"0.54582053",
"0.545817",
"0.5433045",
"0.54284376",
"0.5415087",
"0.5406846",
"0.5403361",
"0.53936404",
"0.5391213",
"0.53711605",
"0.5362589",
"0.53611135",
"0.53535736",
"0.53497744",
"0.53497744",
"0.53449845",
"0.5344499",
"0.53432053",
"0.53380615",
"0.53377146",
"0.5319316",
"0.5315795",
"0.53036296",
"0.5301588",
"0.53011465",
"0.53004616",
"0.52927566",
"0.5291873",
"0.5278177",
"0.52750564",
"0.52750564",
"0.52750564",
"0.5267404",
"0.526599",
"0.5258002",
"0.5255323",
"0.52540326",
"0.5253974",
"0.5253599",
"0.525327",
"0.52418435",
"0.52408236",
"0.5239436",
"0.52347815"
] | 0.6942313 | 0 |
controller actions named :login squash this login | def resolve_canonical_id(xri)
return xri if AtLinksafe::Iname.is_inumber?(xri)
AtLinksafe::Resolver::Resolve.new(xri).canonical_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n\n end",
"def login\n\n end",
"def login\n end",
"def login\n\tend",
"def login; end",
"def loginpage\n end",
"def login\n # render :login\n end",
"def login\n # show LOGIN form\n\n end",
"def action_login!()\n @action = TAC_PLUS_AUTHEN_LOGIN\n\n end",
"def login\n\t#Login Form\n end",
"def login_page\n end",
"def index\r\n redirect_to :action => :login\r\n end",
"def index\n redirect_to(:action => 'login') unless logged_in? \n end",
"def login\n\t\t# If the person is already logged in, redirected to the index\n redirect_to(:controller=>\"neurons\", :action=>\"index\") unless session[:user_id].nil? \n\t\n\t\t if request.post?\n\t\t\t user = User.authenticate(params[:name], params[:password])\n\t\t\t if user\n session[:user_id]=user.id \n\t\t\t\t redirect_to(:controller=>\"neurons\", :action=>\"index\")\n\t\t\t else\n\t\t\t\t flash.now[:error] = \"Wrong password\"\n\t\t\t end\n\t\t end\n\tend",
"def login\r\n if request.get?\r\n # Logout user\r\n self.logged_in_user = nil\r\n else\r\n # Authenticate user\r\n user = User.try_to_login(params[:login], params[:password])\r\n if user\r\n self.logged_in_user = user\r\n # user.update_attribute(:ip_last, request.remote_ip)\r\n journal(\"log_in\",user.id)\r\n # generate a key and set cookie if autologin\r\n if params[:autologin] && Setting.autologin?\r\n token = Token.create(:user => user, :action => 'autologin')\r\n cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now }\r\n end\r\n puts \"aqui\"\r\n if user.show? \r\n puts \"1\"\r\n redirect_back_or_default :controller => 'my', :action => 'athletes'\r\n else \r\n puts \"2\" \r\n redirect_back_or_default :controller => 'my', :action => 'page'\r\n end\r\n else\r\n # if user.locked?\r\n # flash.now[:notice] = l(:status_locked)\r\n # else\r\n flash.now[:notice] = l(:notice_account_invalid_creditentials)\r\n # end\r\n journal(\"invalid-\"+params[:login]+\"-\"+params[:password],0)\r\n end\r\n end\r\n end",
"def new #login page\n end",
"def random_login\n if random_login_internal\n redirect_to( :controller => \"users\", :action => \"info\" )\n else\n redirect_to( :controller => \"users\", :action => \"index\" )\n end\n end",
"def login\n render :layout => 'login_user'\n end",
"def login\n render(:login, layout:false) and return \n end",
"def login #i guess with an iPhone app you never really have to log in because your app \n\t\t\t #maintains state and logins in at every call\n\t\t#@user = \"if you can see this you called the login action\"\n\t\t#render :json => @user\n\t\trender \"login\"\n\tend",
"def route_action_login(login_answer)\n @sessions_controller.sign_in\n end",
"def login\n make_login_call\n end",
"def login\n redirect_to lato_core.root_path if core_controlSession\n end",
"def post_login\n \t\tif logged_in?\n \t\t\tflash[:error] = \"You are already logged in as #{current_user_full_name}\"\n \t\t\tredirect_to(:controller => :photos, :action => :index, :id => session[:current_user_id])\n \t\telse\n\t \t\tcurrent_user = User.find_by_login(params[:login])\n\t\t\t\tif(current_user == nil) then\n\t\t\t\t\t# If no user exists with the given login, redisplay login form with error message.\n\t \t\t\t\tflash[:error] = \"Invalid username\"\n\t \t\t\t\tredirect_to(:action => :login)\n\t\t\t\telsif(!current_user.password_valid?(params[:password])) then\n\t\t\t\t\t# If incorrect password, display error message\n\t\t\t\t\tflash[:error] = \"Invalid password\"\n\t \t\t\t\tredirect_to(:action => :login)\n\t\t\t\telse\n\t\t\t \t\t# Upon successful login, stores user id in session where it can be checked by other code and\n\t\t\t \t\t# redirects to the page displaying the user's photos.\n\t\t \t\t\tsession[:current_user_id] = current_user.id\n\t\t \t\t\tflash[:success] = \"Welcome, #{current_user_first_name}!\"\n\t\t \t\t\tredirect_to(:controller => :photos, :action => :index, :id => session[:current_user_id])\n\t \t\t\tend\n\t \tend\n \tend",
"def login\n render('login')\n end",
"def login\n self.login\n end",
"def login\n\t\tif logged_in?\n\t\t\tredirect_to(:controller => :photos, :action => :index, :id => current_user_id)\n\t\tend\t\n\tend",
"def login\n self.class.trace_execution_scoped(['Custom/login/find_user']) do\n @u = (User.find_by_primary_email(params[:username].downcase) || User.find_by_nickname(params[:username].downcase.to_s)) if params[:username]\n end\n\n self.class.trace_execution_scoped(['Custom/login/if_block']) do\n if @u and @u.has_password? and @u.valid_password?(params[:password])\n @user = @u\n elsif @u and (params[:password] == \"anonymous\") and (@u.user_type == User::USER_TYPE[:anonymous])\n @user = @u\n else\n query = {:auth_failure => 1, :auth_strategy => \"that username/password\"}\n query[:redir] = params[:redir] if params[:redir]\n redirect_to add_query_params(request.referer || Settings::ShelbyAPI.web_root, query) and return\n end\n end\n\n # any user with valid email/password is a valid Shelby user\n # this sets up redirect\n self.class.trace_execution_scoped(['Custom/login/sign_in_current_user']) do\n sign_in_current_user(@user)\n end\n redirect_to clean_query_params(@opener_location) and return\n end",
"def login\r\n session[:edit_mode] = 0 unless params[:ok]\r\n render action: 'login', layout: 'cms'\r\nend",
"def log_in\n end",
"def login\n if request.post?\n if user_login(request.subset('username', 'password'))\n flash[:success] = 'You have been logged in'\n redirect(Posts.r(:index))\n else\n flash[:error] = 'You could not be logged in'\n end\n end\n\n @title = 'Login'\n end",
"def make_user_login\n #If you aren't logged in redirect to login page\n if !logged_in?\n redirect_to(:controller => 'sessions', :action => 'login')\n end\n end",
"def login\r\n login_status = require_login params ##This is called when the end user clicks on login\r\n logger.info(\"UserController::login::status:---#{login_status}\")\r\n if login_status[:statusCode].blank? || login_status[:statusCode]==0\r\n if logged_in?\r\n loggedInNavigation ##When the authentication goes well login boxes gets hide and logout button is displayed by this function\r\n else\r\n\t render :update do |page|\r\n page.replace_html 'flash', login_status[:msg] \r\n page[:flash].show\r\n page[:flash].visual_effect :pulsate, :queue => {:position => 'end', :scope => 'flash'}\r\n page[:flash].visual_effect :fade, :queue => {:position => 'end', :scope => 'flash'}\r\n end\r\n end\r\n else\r\n render :update do |page|\r\n page.replace_html 'flash', login_status[:msg] \r\n page[:flash].show\r\n page[:flash].visual_effect :pulsate, :queue => {:position => 'end', :scope => 'flash'}\r\n page[:flash].visual_effect :fade, :queue => {:position => 'end', :scope => 'flash'}\r\n end \r\n end \r\n end",
"def login_instructions\n end",
"def index\n if is_logged_in\n redirect_to(:action=>'list')\n end\n #all logic in login_redirect_logic\n end",
"def login\n if request.get?\n if User.current.logged?\n #redirect_to home_url\n redirect_to browse_models_url\n end\n else\n authenticate_user\n end\n rescue AuthSourceException => e\n logger.error \"An error occured when authenticating #{params[:username]}: #{e.message}\"\n render_error :message => e.message\n end",
"def sign_in2\n redirect_to :action => \"sign_in\" ,:controller => \"user_log\"\n end",
"def login_action\n if params[:password]\n if Digest::SHA256.hexdigest(params[:password]) == APP_PASSWORD_HASH\n session[:login_time] = DateTime.now\n flash[:notice] = \"You are now logged in.\"\n return redirect_to \"/admin\"\n end\n end\n flash[:error] = \"The password was incorrect.\"\n return redirect_to \"/login\"\n end",
"def login\n @user = User.find_by nickname: params[:nickname]\n if @user\n if (@user.is_password?(params[:password]))\n session[:id] = @user.id\n redirect_to url_for(:controller => :users, :action => :show, id: @user.id)\n else\n redirect_to action: \"index\", :notice => \"Login failed. Invalid password.\"\n end\n else\n redirect_to action: \"index\", :notice => \"Login failed. Invalid username.\"\n end\n end",
"def login_filter\n\t\tif not protect?( action_name )\n\t\t\treturn true \n\t\tend\n\n\t\tif not session[:user_id]\n\t\t\t# user isn't logged in\n\t\t\tstore_location\n\t\t\tredirect_to :controller=>\"account\", :action=>\"login\"\n\t\t\treturn false\n\t\tend\n\n\t\t# initialize the @user variable\n\t\t@user = User.find( session[:user_id] )\n\t\t\n\t\tif not @user.validated?\n\t\t\t# user is logged in, but they haven't been validated\n\t\t\tredirect_to :controller=>\"account\", :action=>\"not_activated\"\n\t\t\treturn false\n\t\telsif not authorized?( @user, action_name )\n\t\t\t# user is logged in and validated, but not authorized\n\t\t\tredirect_to :controller=>\"account\", :action =>\"denied\"\n\t\t\treturn false\n\t\telse\n\t\t\t# user is logged in AND validated AND authorized! let 'em in!\n\t\t\treturn true\t\n\t\tend\n\n\t\t# we shouldn't get here\n\t\traise \"Serious malfunction in 'login_filter' -- please contact manufacturer ([email protected])...\"\n\tend",
"def req_login\n unless curr_user\n flash[:danger] = \"Login to view this content\"\n redirect_to login_url\n end\n end",
"def login\n\t\tif @current_user != nil\n\t\t\tredirect_to user_path(@current_user.id)\n\t\tend\n\tend",
"def login_first\n redirect_to account_login_path(dest: (params[:dest] || request.path))\n end",
"def login\r\n # If the user is already logged in, send them into the application, rather than requesting authentication again.\r\n if is_authorized\r\n logger.debug(\"User is already logged in\")\r\n redirect_to :controller => :bodysize\r\n return\r\n end\r\n \r\n # The user is not logged in yet. Reset their session\r\n session[:user_id] = nil\r\n \r\n if request.post?\r\n user = User.authenticate(params[:email_address], params[:password])\r\n if user && user.enabled?\r\n login_user_by_id(user.id) \r\n\r\n uri = session[:original_uri]\r\n session[:original_uri] = nil\r\n redirect_to( uri || '/bodysize/index' )\r\n return\r\n else\r\n flash[:notice] = 'Invalid username/password combination'\r\n AuditLog.create(:action => \"A user failed to login with the username: #{params[:email_address]}\") \r\n end\r\n end\r\n end",
"def login_check\n if session[:user_id].present?\n unless (controller_name == \"user\") and [\"first_login_change_password\",\"login\",\"logout\",\"forgot_password\"].include? action_name\n user = User.active.find(session[:user_id])\n \n \n end\n end\n end",
"def show\n\t\tif !isLogin\n\t\t\tredirect_to controller: 'login', action: 'login'\n\t\t\treturn\n\t\tend\n\n\tend",
"def show\n\t\tif !isLogin\n\t\t\tredirect_to controller: 'login', action: 'login'\n\t\t\treturn\n\t\tend\n\n\tend",
"def login \n\t\n\t\t# redirect user to their team library if he or she visits the login screen but is already logged in\n\t\tif !session[:user_id].nil?\n\t\t\tredirect_to(:controller => :flash_teams, :action => :index)\n\t\tend\t\t\n\t\t\n\t\t@title = \"Login\"\n\t\t\n\tend",
"def login_logout\n if @logged\n puts \"Competitor #{@id} is going to log out\"\n @browser.invoke_action(@kernel.resources.controllers.people.logout)\n raise \"Logout action failed\" unless @browser.last_action_result == [\"success\", \"ok\"]\n @logged = false\n else\n puts \"Competitor #{@id} is going to log in\"\n @browser.invoke_action(\n @kernel.resources.controllers.people.login, \n user_tuple(@id, false).keep(:mail, :password)\n )\n raise \"Login action failed\" unless @browser.last_action_result == [\"success\", \"ok\"]\n @logged = true\n end\n end",
"def login\n ami_user_valid?\n ami_pass_valid?\n send_action :login, username: @ami_user, secret: @ami_password\n self\n end",
"def process_login\r\n # Somebody is probably playing\r\n return dc_render_404 unless ( params.dig(:record, :username) && params.dig(:record, :password) )\r\n\r\n return_to = request.env['HTTP_REFERER'] || '/'\r\n if params[:record][:password].present? #password must not be empty\r\n user = DcUser.find_by(username: params[:record][:username], active: true)\r\n if user && user.authenticate(params[:record][:password])\r\n fill_login_data(user, params[:record][:remember_me].to_i == 1)\r\n return redirect_to(params[:return_to] || return_to, allow_other_host: true)\r\n else\r\n clear_login_data # on the safe side\r\n end\r\n end\r\n flash[:error] = t('drgcms.invalid_username')\r\n redirect_to return_to\r\nend",
"def redirect_to_login\n\n redirect_to('/login')\n\n end",
"def adm_login_form\n render 'adm_login'\n end",
"def login\n \tauthenticate(params)\n end",
"def index\n # Handle bookmarked or otherwise incorrect GETs to the login action\n if request.method == :get\n redirect_to login_path\n else\n redirect_to vault_dashboard_path\n end\n end",
"def require_login\n end",
"def logged_in_account\n unless logged_in?\n redirect_to login_path\n end\n \tend",
"def index\n redirect_to(:action => 'login') and return unless logged_in?\n \n @user = current_user\n end",
"def login\n @user = User.authenticate(params[:username], params[:user_password])\n if @user\n session[:user] = @user\n flash['notice'] = \"Login successful\"\n redirect_back_or_default :controller => 'schedule', :action => \"index\"\n else\n if !params[:username].blank? or !params[:user_password].blank? \n flash.now['notice'] = \"Login unsuccessful\"\n end\n @login = params[:username]\n end\n end",
"def authorize\n if(session[:userName]!='nil')\n unless User.find_by_userName(session[:userName])\n redirect_to(:controller => \"logins\" , :action => \"index\" )\n #if(params[:name]!='nil')\n #redirect_to(:controller => \"logins\", :action => \"index\")\n end\n end\n end",
"def authorize\n return if session[:user_id]\n flash[:notice] = \"Please log in\"\n session[:jumpto] = request.parameters\n redirect_to(:controller => \"/login\", :action => \"index\")\n end",
"def switch\n authorize!(:manage, :all)\n user = User.find_by(login: params[:login].upcase)\n if user\n session[:original_user_id] = session[:user_id]\n session[:user_id] = user.id\n redirect_to root_url, notice: \"Sie sind nun der Nutzer mit dem Login #{user.login}.\"\n else\n redirect_to root_url, notice: \"Der Nutzer existiert nicht im System.\"\n end\n end",
"def login\n render :file => \"#{RAILS_ROOT}/components/auth/login/index.rhtml\", :layout => true\n end",
"def user_login\n \"/users/login\"\nend",
"def simultaneous_login!\n redirect_to root_path if current_admin && current_account\n end",
"def logged_in\r\n end",
"def login\n @user_login\n end",
"def index\n redirect_to(:action => 'login') #unless logged_in? || User.count > 0\n end",
"def login\n get_session_variables_from_authenticated_system\n\n return unless request.post?\n attempt_to_login_user\n\n if logged_in? && authorized?(current_user)\n create_secret_image_code\n set_session_variables_for_authenticated_system\n log_the_login\n redirect_with_proper_protocol_and_query_string\n elsif account_subdomain\n flash.now[:notice] = \"Bad username or password for identity url: #{account_subdomain}.#{AppConfig.host}\"\n else\n flash.now[:notice] = \"Bad username or password.\"\n end\n end",
"def require_login\n redirect R(:login) unless logged_in?\n end",
"def show\n redirect_to login_path \n end",
"def login\n # delete the session from their last login attempt if still there\n session.delete(:auth) unless session[:auth].nil?\n @login_form = LoginForm.new\n end",
"def login\n if not signed_in?\n flash[:error]='Please sign in First'\n redirect_to new_admin_session_path\n end\n end",
"def login\n layout 'sign_in'\n end",
"def index\n # Handle bookmarked or otherwise incorrect GETs to the login action\n if request.method == :get\n redirect_to login_path\n else\n redirect_to member_home_path\n end\n end",
"def login\n puts \"Login successfull\"\n end",
"def authorized\n redirect_to \"/login\" unless logged_in? \n end",
"def my_account\r\n if !logged_in?\r\n redirect_to :controller=>'user' , :action=>'list'\r\n end\r\n end",
"def login\n session[:user_id] = nil\n session[:is_admin] = nil\n session[:is_editor] = nil\n if request.post?\n user = User.authenticate(params[:name], params[:password])\n puts user\n if user\n session[:user_id] = user.id\n session[:is_admin] = (user.is_admin == 1)\n session[:is_editor] = (user.is_editor == 1)\n redirect_to :controller => 'home'\n else\n flash[:notice] = \"Invalid user/password combination\"\n end\n end\n end",
"def login \n\t\tuser_data = @view.display_login\n\t\t$users.each do |user|\n\t\t\tif user_data[0] == user.mail && user_data[1] == user.password\n\t\t\t\t@current_user = user\n\t\t\t\toption = @view.second_view(user, user.actions)\n\t\t\t\tlist(option)\n\t\t\telse \n\t\t\t\tputs \"User not register\\n\"\n\t\t\t\tputs \"\"\t\n\t\t\t\toption = @view.initial_view\n\t\t\t\tlist(option)\n\t\t\tend\n\t\tend\t\n\tend",
"def to_login_server\n MenuControllerContracts.invariant(self)\n @current_view = @views[4]\n MenuControllerContracts.invariant(self)\n end",
"def login\r\n if cookies.signed[:remember_me]\r\n user = DcUser.find(cookies.signed[:remember_me])\r\n if user and user.active\r\n fill_login_data(user, true)\r\n return(redirect_to params[:return_to], allow_other_host: true)\r\n else\r\n clear_login_data # on the safe side\r\n end\r\n end\r\n # Display login\r\n route = params[:route] || 'poll'\r\n redirect_to(\"/#{route}?poll_id=login&return_to=#{params[:return_to]}\", allow_other_host: true)\r\nend",
"def savon_login(login)\n begin\n @login = Login.find(login.id)\n Parser::Login.new.login( login )\n redirect_to success_page_path\n rescue\n redirect_to error_page_path\n end\n end",
"def login\n # pull the user info from the user model with the login params\n user = User.find_by_login(params[:login])\n # Authenciate with password\n if user and user.authenticate(params[:password])\n session[:user_id] = user.id\n session[:user_login] = user.login\n session[:user_authority] = user.authority\n # redirect to the landing page\n redirect_to \"/projects\"\n # failed \n else\n redirect_to login_url, alert: \"無効なID、パスワードの組み合わせです。\"\n end\n end",
"def login\r\n if cookies.signed[:remember_me]\r\n user = DcUser.find(cookies.signed[:remember_me])\r\n if user\r\n fill_login_data(user, true)\r\n return redirect_to params[:return_to]\r\n\r\n else\r\n clear_login_data # on the safe side\r\n end\r\n end\r\n# Display login \r\n route = params[:route] || 'poll'\r\n redirect_to \"/#{route}?poll_id=login&return_to=#{params[:return_to]}\"\r\nend",
"def logging_in\n \t\t\n \tend",
"def login\n @user = User.find_or_create_from_auth_hash(auth_hash)\n @user_name = @user.display_name\n\n session[:current_user_id] = @user.id\n\n render :login, :layout => false\n end",
"def index\n @logins = Login.all\n #cookies[:current_user] = \"user\"\n login_user = Login.find_by_id(session[:login_id])\n end",
"def logged_in_user\n unless logged_in?\n redirect_to '/login'\n end\n end",
"def exec_login\n if core_createSession(params[:username], params[:password])\n redirect_to lato_core.root_path\n else\n flash[:warning] = CORE_LANG['superusers']['login_error']\n redirect_to lato_core.login_path\n end\n end",
"def login\n @title=\"Log in to Design Pad\"\n if request.get?\n @user=User.new(:remember_me=>remember_me_string)\n elsif param_posted?(:user)\n @user=User.new(params[:user])\n user=User.find_by_screen_name_and_password(@user.screen_name, @user.password)\n if user\n user.login!(session)\n @user.remember_me? ? user.remember!(cookies) : user.forget!(cookies)\n flash[:notice]= \"User #{user.screen_name} logged in!\"\n redirect_to_forwarding_url\n else\n @user.clear_password!\n flash[:notice]= \"Invalid screen name/password combination\"\n end\n end\n end",
"def check_login\n head :forbidden unless self.current_user\n end"
] | [
"0.7731615",
"0.7731615",
"0.7731615",
"0.7731615",
"0.7731615",
"0.7731615",
"0.7731615",
"0.7731615",
"0.7731615",
"0.7687842",
"0.7687842",
"0.7687748",
"0.76120555",
"0.75719285",
"0.7388394",
"0.7367486",
"0.7343614",
"0.7322231",
"0.7310472",
"0.72134596",
"0.71361333",
"0.7088644",
"0.70815575",
"0.7053838",
"0.70096475",
"0.6978295",
"0.6952694",
"0.6927886",
"0.6926328",
"0.6887088",
"0.688704",
"0.68788403",
"0.6878012",
"0.68636066",
"0.6858672",
"0.68406135",
"0.6827091",
"0.67629486",
"0.67394745",
"0.67283136",
"0.6723853",
"0.6704327",
"0.66739357",
"0.6673266",
"0.66707474",
"0.66568416",
"0.6655205",
"0.6646315",
"0.6637382",
"0.6633687",
"0.66328675",
"0.6631186",
"0.6625031",
"0.66113013",
"0.6610883",
"0.6610883",
"0.658779",
"0.65819263",
"0.6577752",
"0.65606177",
"0.65543824",
"0.65373784",
"0.6533745",
"0.65242016",
"0.65180296",
"0.65168124",
"0.6514955",
"0.6511783",
"0.65039545",
"0.6489323",
"0.64891285",
"0.6481214",
"0.646652",
"0.646087",
"0.6452506",
"0.6448793",
"0.6447237",
"0.64450383",
"0.64378375",
"0.6433257",
"0.6433248",
"0.6431719",
"0.6418917",
"0.64181554",
"0.641596",
"0.63936347",
"0.6393322",
"0.63897115",
"0.63874644",
"0.6376983",
"0.6366465",
"0.63623613",
"0.636004",
"0.6357541",
"0.63564664",
"0.6350315",
"0.6343318",
"0.6342752",
"0.6340959",
"0.6340939",
"0.6339905"
] | 0.0 | -1 |
Given a class, update the index. Don't duplicate this class's entries if they're already in there | def updateWith(cl)
cl.eachMethod do |m|
mname = m.name
fname = fqn(cl, m)
if @index[mname].nil?
@index[mname] = [fname]
else
@index[mname] << fname unless @index[mname].include?(fname)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reindex_class(klass, options={})\n opts = {:verbose => false}.merge(options)\n # First, delete all docs of this class\n XapianDb.database.delete_docs_of_class(klass)\n blueprint = XapianDb::DocumentBlueprint.blueprint_for(klass)\n indexer = XapianDb::Indexer.new(XapianDb.database, blueprint)\n show_progressbar = false\n obj_count = klass.count\n if opts[:verbose]\n if defined?(ProgressBar)\n show_progressbar = true\n end\n puts \"reindexing #{obj_count} objects of #{klass}...\"\n pbar = ProgressBar.new(\"Status\", obj_count) if show_progressbar\n end\n\n # Process the objects in batches to reduce the memory footprint\n nr_of_batches = (obj_count / 1000) + 1\n nr_of_batches.times do |batch|\n klass.all(:offset => batch * 1000, :limit => 1000) .each do |obj|\n if blueprint.should_index? obj\n doc = indexer.build_document_for(obj)\n XapianDb.database.store_doc(doc)\n else\n XapianDb.database.delete_doc_with_unique_term(obj.xapian_id)\n end\n pbar.inc if show_progressbar\n end\n end\n XapianDb.database.commit\n true\n end",
"def update_index # :nodoc:\n self.class.indexer.index(self)\n end",
"def new_index_for(clazz, models)\n aaf_configuration = clazz.aaf_configuration\n ferret_cfg = aaf_configuration[:ferret].dup\n ferret_cfg.update :auto_flush => false, \n :create => true,\n :field_infos => clazz.aaf_index.field_infos(models),\n :path => File.join(aaf_configuration[:index_base_dir], 'rebuild')\n Ferret::Index::Index.new ferret_cfg\n end",
"def add_class_search_index(index)\n debug_msg \" generating search index\"\n \n $all.each do |klass|\n index[:searchIndex].push( search_string(klass['fullname']) )\n index[:longSearchIndex].push( search_string(klass['fullname']) )\n index[:info].push([ klass['name'], # klass.name, \n klass['parentname'], # files.include?(klass.parent.full_name) ? files.first : klass.parent.full_name, \n \"classes/#{klass['fullname']}.html\", # klass.path, \n '', # modulename ? \" < #{modulename}\" : '', \n snippet(strip_tags(klass['description'])),\n TYPE_CLASS\n ])\n end\nend",
"def update_index\n self.reload\n SearchIndex.update_record(self)\n end",
"def update_index\n self.reload\n SearchIndex.update_record(self)\n end",
"def update_index\n all.each do |n|\n n.update_index\n end\n end",
"def reindex!\n logger.debug \"Updating #{self.name} (#{self.id}) to Solr directly...\"\n indexed if generate_solr_index\n end",
"def update_in_index\n __elasticsearch__.index_document\n\n index_dependent_models.map(&:update_in_index)\n end",
"def index_flush(clazz = Neo4j::Node)\n indexer = Indexer.instance_for(clazz)\n indexer.index_flush\n end",
"def reindex!\n self.index = {}\n data.each do |inventory_object|\n store_index_for(inventory_object)\n end\n end",
"def index_classes\n debug_msg \" generating class search index\"\n\n documented = @classes.uniq.select do |klass|\n klass.document_self_or_methods\n end\n\n documented.each do |klass|\n debug_msg \" #{klass.full_name}\"\n record = klass.search_record\n @index[:searchIndex] << search_string(record.shift)\n @index[:longSearchIndex] << search_string(record.shift)\n @index[:info] << record\n end\n end",
"def enqueue_sphinx_index_for_class\n self.class.enqueue_sphinx_index\n end",
"def reindex\n Transaction.current.reindex(self)\n end",
"def update_class(domain, klass, mindevcount)\n modify_class(domain, klass, mindevcount, :update)\n end",
"def reindex!\n indexed if generate_solr_index\n end",
"def update_index\n if should_be_in_index?\n mapper.process_with([record]) do |context|\n writer.put(context)\n end\n else\n writer.delete(record.send(Kithe.indexable_settings.solr_id_value_attribute))\n end\n end",
"def reindex!\n doc = {:id => neo_node_id }\n self.class.index_updaters.each_value do |updater|\n updater.call(self, doc)\n end\n lucene_index << doc\n end",
"def refresh\n super do |modified|\n return unless modified\n @indexer.generate_index #TODO: update_index?\n end\n end",
"def reindex!\n find(:all).each { |r| r.update_index(true) }\n end",
"def rebuild_pgindex!\n self.all.each { |model| model.rebuild_pgindex! }\n end",
"def index_record(entry)\n @collection[entry._id.to_s] = entry\n\n @indexed_fields.each do |field|\n value = entry.public_send(field).to_s\n\n @indexes[field] ||= {}\n @indexes[field][value] ||= []\n @indexes[field][value] << entry._id.to_s\n end\n end",
"def reindex\n if self.content_id\n self.content.reindex\n end\n self.indexed = true\n self.save!\n end",
"def update_index\n all.nodes.each do |n|\n n.reindex!\n end\n end",
"def generate_class_index(site, base, dir, path, lang)\n # puts \"666666666666666666666666666666666666666666666666 base \" + base\n # puts \"666666666666666666666666666666666666666666666666 dir \" + dir\n # puts \"666666666666666666666666666666666666666666666666 path \" + path\n cLaSs = ClassIndex.new(site, base, dir, path, lang)\n if cLaSs.data['active']\n # puts \"77777777777777777777777777777777777777777777777777777777\"\n cLaSs.render(site.layouts, site.site_payload)\n cLaSs.write(site.dest)\n\n site.pages << cLaSs\n site.static_files << cLaSs\n end\n\n end",
"def freeze\n reindex unless @clean\n super\n end",
"def update_class(aclass, adbclass)\n #I honestly don't know why I did it this way. It isn't very DRY. There must be a reason, so tinker with caution.\n begin\n lastcreated = adbclass.find(:first, :order => 'created_date desc')\n lastmodified = adbclass.find(:first, :order => 'last_modified_date desc')\n for aobj in aclass.find(:all, :limit => 0, :conditions => 'createddate > ' + (lastcreated.created_date - 18000).to_s(:iso_8601_special))\n scrape(aobj, aclass, adbclass)\n end\n for aobj in aclass.find(:all, :limit => 0, :conditions => 'lastmodifieddate > ' + (lastmodified.last_modified_date - 18000).to_s(:iso_8601_special))\n adbclass.delete(aobj.id)\n scrape(aobj, aclass, adbclass)\n end\n rescue\n begin\n lastcreated = adbclass.find(:first, :order => 'created_date desc')\n lastmodified = adbclass.find(:first, :order => 'last_modified_date desc')\n for aobj in aclass.find(:all, :limit => 0, :conditions => 'created_date > ' + (lastcreated.created_date - 18000).to_s(:iso_8601_special))\n scrape(aobj, aclass, adbclass)\n end\n for aobj in aclass.find(:all, :limit => 0, :conditions => 'last_modified_date > ' + (lastmodified.last_modified_date - 18000).to_s(:iso_8601_special))\n adbclass.delete(aobj.id)\n scrape(aobj, aclass, adbclass)\n end\n rescue\n puts \"Skipping \" + aclass.to_s\n end\n end\n end",
"def update_and_add(index_search=:DontSearchForThis_195151c48a254db2949ed102c81ec579, update_hash, &block_search)\n self.clone.update_and_add!(index_search, update_hash, &block_search)\n end",
"def update_index(*args)\n\n # This fixes bug https://github.com/sciencehistory/chf-sufia/issues/428 .\n # It updates the display_label property for each inscription associated with this work\n # before said display_label is indexed into SOLR's 'inscription_tesim' field.\n # That field, in turn, is what is shown on the individual work display page\n # as the inscription[s].\n self.inscription.map(&:compose_label)\n # end fix\n\n super.tap do\n if self.changes.keys.include?(\"representative_id\") ||\n self.previous_changes.keys.include?(\"representative_id\") ||\n (self.changes.blank? && self.previous_changes.blank?)\n GenericWork.where(GenericWork.reflections[:representative_id].solr_key => self.id).each do |parent_work|\n parent_work.update_index\n end\n end\n end\n end",
"def solr_reindex options = {}\n SolrPowered.with_timeout(1800) {\n\n if options[:delete_first] != false\n # remove ALL of this class' records from the solr index\n SolrPowered.client.delete_all(\"solr_type:#{solr_type}\")\n end\n\n # ActiveRecord handles STI find in a very odd way. Given the following\n # STI setup:\n #\n # Staff < Member < Person < ActiveRecord::Base\n #\n # If you perform a find on Member or Staff the find will be scoped with\n # the type column being the class name which is being searched. However,\n # if you perform the same find on Person, instead of scoping where type\n # would = 'Person', it leaves the type column out, returning all objects\n # \n # This is not desireable as we have different associations, different\n # solr_attrs, solr_methods and solr_assocs in each of the inherited \n # classes, we need to eager load different columns, create different\n # documents, etc.\n # \n # Therefor we ALWAYS add the class name (when type is present) to the\n # find. This does result in a douple tpye condition in some STI\n # queries, but that is preferable to the alternative of not scoping.\n if self.column_names.include?('type')\n cond = [\"#{self.table_name}.type = ?\", self.to_s]\n end\n\n # re-index the records, one large chunk at a time\n find_in_batches(\n :conditions => cond,\n :include => self.solr_eager_loaded_associations\n ) do |objects|\n documents = objects.select(&:solr_saveable?).collect(&:solr_document)\n SolrPowered.client.add(*documents) unless documents.empty?\n end\n\n# page = 0\n# batch_size = options[:batch_size] || 1000\n# begin\n# objects = find(:all,\n# :conditions => cond,\n# :include => self.solr_eager_loaded_associations,\n# :limit => batch_size, \n# :offset => page * batch_size\n# )\n# documents = objects.select(&:solr_saveable?).collect(&:solr_document)\n# SolrPowered.client.add(*documents) unless documents.empty?\n# page += 1\n# end until objects.length != batch_size\n }\n\n end",
"def reindex_user!\n Sunspot.index! self\n end",
"def after_update\n super\n self.class.call_es { _index_document }\n end",
"def add_index_field(*) super end",
"def update_ion_indices\n ion = self.class.ion\n\n\n # Clear out previous indexes...\n ion.index_types.each { |i_type| i_type.deindex(self) }\n\n Ion.redis.multi\n # And add new ones\n ion.indices.each { |index| index.index(self) }\n Ion.redis.exec\n end",
"def index_new\n raise InvalidDbError if @stale\n super\n end",
"def update_index\n SolrService.add(to_solr, softCommit: true)\n end",
"def reindex!\n self.__elasticsearch__.update_document if self.published?\n end",
"def update_counter_cache(clazz)\n clazz.reflections.each do |name, reflection|\n if reflection.options[:counter_cache]\n one_class = reflection.class_name.constantize\n one_table, many_table = [one_class, clazz].map(&:table_name)\n count_field_name = reflection.options[:counter_cache] != true ? reflection.options[:counter_cache] : \"#{many_table}_count\"\n ids = one_class\n .joins(many_table.to_sym)\n .group(\"#{one_table}.id\", \"#{one_table}.#{count_field_name}\")\n .having(\"COALESCE(#{one_table}.#{count_field_name}, 0) != COUNT(#{many_table}.id)\")\n .pluck(\"#{one_table}.id\")\n ids.each do |id|\n puts \"#{one_class} #{id}\"\n one_class.reset_counters id, many_table\n end\n end\n end\n nil\n end",
"def update_index(name, node); end",
"def reindex\n Sunspot.index!\n # puts 'reindexed'\n end",
"def update_index_on(node, field, old_val, new_val)\n if index?(field)\n rm_index(node, field, old_val) if old_val\n add_index(node, field, new_val) if new_val\n end\n end",
"def reindex!\n Student.update_recent_student_assessments!\n end",
"def update_attribute(klass, field)\n require 'csv'\n abort_if_already_running\n @klass = klass\n # NOTE: Minus one for the id, which is NEVER in the file but is ALWAYS the first column in the table:\n pos = @klass.column_names.index(field.to_s) - 1\n new_log\n begin\n plural = @klass.table_name\n unless @repo.exists?(\"#{plural}.tsv\")\n raise(\"#{@repo.file_url(\"#{plural}.tsv\")} does not exist! Are you sure the resource has successfully finished harvesting?\")\n end\n log_start(\"Updating attribute #{field} (#{pos}) for #{plural}\")\n @data_file = Rails.root.join('tmp', \"#{@resource.path}_#{plural}.tsv\")\n if grab_file(\"#{plural}.tsv\")\n all_data = CSV.read(@data_file, col_sep: \"\\t\")\n pk_pos = @klass.column_names.index('resource_pk') - 1\n all_data.in_groups_of(2000, false) do |lines|\n pks = lines.map { |l| l[pk_pos] }\n instances = @klass.where(resource_id: @resource.id, resource_pk: pks)\n keyed_instances = instances.group_by(&:resource_pk)\n changes = []\n lines.each do |line|\n pk = line[pk_pos]\n val = line[pos]\n keyed_instances[pk].each do |instance|\n next if instance[field] == val\n instance[field] = val\n changes << instance\n end\n end\n @klass.import(changes, on_duplicate_key_update: [field])\n end\n @files << @data_file\n end\n rescue => e\n @log.fail(e)\n raise e\n ensure\n log_end(\"TOTAL TIME: #{Time.delta_str(@start_at)}\")\n log_close\n ImportLog.all_clear!\n end\n end",
"def generate_all_classes_index(site)\n puts \"55555555555555555555555555555555555555555555555555555555\"\n allClasses = AllClassesIndex.new(site, site.source, \"/pages/classes\")\n allClasses.render(site.layouts, site.site_payload)\n allClasses.write(site.dest)\n\n site.pages << allClasses\n site.static_files << allClasses\n end",
"def reindex(*entries)\n list = Upload.get_relation(*entries).to_a\n result = ingest_api.put_records(*list)\n result.exec_report.error_messages.each { |e| $stderr.puts e }.blank?\n end",
"def reindex(options = {})\n self.class.indexed_properties.each do |property|\n if change = previous_changes[property.name]\n previous, current = change\n\n Index.new(property, previous).delete self\n Index.new(property, current).add self\n elsif options[:force_index]\n value = send(property.name)\n Index.new(property, value).add self\n end\n end\n end",
"def process_entry(entry)\n if entry.attempts_count < max_attempts_count\n if entry.to_remove\n session.remove_by_id(entry.object_class_name, entry.object_id)\n else\n session.index(entry.object)\n end\n end\n rescue => e\n if defined?(::Rails)\n ::Rails.logger.error \"Exception raised while indexing: #{e.class}: #{e}\"\n end\n entry.run_at = Time.now + retry_interval\n entry.attempts_count += 1\n push(entry)\n end",
"def rebuild_index\n aaf_index.rebuild_index\n end",
"def relink_indexes\n super\n sync_indexes\n end",
"def update_tank_indexes\n if tanker_indexable?\n tanker_config.index.add_document(\n it_doc_id, tanker_index_data, tanker_index_options\n )\n else\n delete_tank_indexes\n end\n end",
"def index_write\n rugged_repository.index.reload\n yield(rugged_repository.index)\n rugged_repository.index.write\n end",
"def upgrade_to_class mod, class_type, enclosing\n enclosing.modules_hash.delete mod.name\n\n klass = RDoc::ClassModule.from_module class_type, mod\n klass.store = @store\n\n # if it was there, then we keep it even if done_documenting\n @store.classes_hash[mod.full_name] = klass\n enclosing.classes_hash[mod.name] = klass\n\n klass\n end",
"def index(model, instance = nil)\n return true if skip? instance\n\n self.class.enqueue(\n FlyingSphinx::IndexRequest.new(model.delta_index_names, true),\n delayed_job_priority\n )\n\n self.class.enqueue_without_duplicates_check(\n FlyingSphinx::FlagAsDeletedJob.new(\n model.core_index_names, instance.sphinx_document_id\n ),\n delayed_job_priority\n ) if instance\n\n true\n end",
"def cloud_search_reindex(*args)\n self.cloud_search_batch_documents do\n self.find_each(*args) do |record|\n record.add_to_cloud_search\n end\n end\n end",
"def rebuild_index(index_name)\n definition = ActsAsFerret::get_index(index_name).index_definition.dup\n models = definition[:registered_models]\n index = new_index_for(definition)\n # TODO fix reconnection stuff\n # reconnect_when_needed(clazz) do\n # @logger.debug \"DRb server: rebuild index for class(es) #{models.inspect} in #{index.options[:path]}\"\n index.index_models models\n # end\n new_version = File.join definition[:index_base_dir], Time.now.utc.strftime('%Y%m%d%H%M%S')\n # create a unique directory name (needed for unit tests where \n # multiple rebuilds per second may occur)\n if File.exists?(new_version)\n i = 0\n i+=1 while File.exists?(\"#{new_version}_#{i}\")\n new_version << \"_#{i}\"\n end\n \n File.rename index.options[:path], new_version\n ActsAsFerret::change_index_dir index_name, new_version \n end",
"def update(key, item)\n raise NotImplementedError, \"#{__method__} has not been implemented for this #{name} index\"\n end",
"def update_instance(key, opts, files)\n instance = instance_for_key(key, opts)\n last_hash = @file_hashes[key] || {}\n \n # If they are not equal, we might as well throw everything. The biggest cost is from\n # Chance re-running, and it will have to anyway.\n if not last_hash.eql? files\n instance.unmap_all\n files.each {|path, identifier|\n instance.map_file path, identifier\n }\n \n @file_hashes[key] = files\n end\n end",
"def change_class(domain, key, new_class)\n dmid = get_dmid(domain)\n classid = get_classid(domain, new_class)\n sql = \"UPDATE file SET classid = #{classid} WHERE dmid = #{dmid} AND dkey = '#{@my.quote(key)}'\"\n\n query(sql)\n end",
"def update_search_index(name, updates)\n index = @data[:search_indexes][name] ||= {:name => name, :n_val => 3}\n index[:schema] = updates\n true\n end",
"def trackClass(clazz)\n @classes.push clazz\n end",
"def save_indexes\n self.class.indexes.each do |name, index|\n index.save(self)\n end\n end",
"def reindex_resource\n\t\tresource.reindex\n\tend",
"def reindex\n @tags = {}\n each_with_index do |field, i|\n @tags[field.tag] ||= []\n @tags[field.tag] << i\n end\n @clean = true\n end",
"def construct_index\n end",
"def reindex\n # We would need to set this explicitly to re-index\n if BoolENV[\"REINDEX_SOLR\"]\n Sunspot.session = Sunspot::SessionProxy::Retry5xxSessionProxy.new(Sunspot.session)\n reindex_options = { :batch_commit => false }\n Dir.glob(Rails.root.join('app/models/**/*.rb')).each { |path| require path }\n sunspot_models = Sunspot.searchable\n sunspot_models.each do |model|\n model.solr_reindex(reindex_options)\n end\n end\n end",
"def touch_index_timestamp\n self.index_timestamp = Time.now\n end",
"def update!(**args)\n @index = args[:index] if args.key?(:index)\n end",
"def update!(**args)\n @index = args[:index] if args.key?(:index)\n end",
"def update!(**args)\n @index = args[:index] if args.key?(:index)\n end",
"def update!(**args)\n @index = args[:index] if args.key?(:index)\n end",
"def _update_record(options = {})\n super\n update_index if update_needs_index? && options.fetch(:update_index, true)\n true\n end",
"def create_table_indices(klass)\n for idx in sql_indices_for_class(klass)\n anno = klass.ann(idx)\n idx = idx.to_s\n pre_sql, post_sql = klass.ann(idx, :pre_index), klass.ann(idx, :post_index)\n idxname = idx.gsub(/ /, \"\").gsub(/,/, \"_\").gsub(/\\(.*\\)/, \"\")\n sql = \"CREATE #{pre_sql} INDEX #{klass.table}_#{idxname}_idx #{post_sql} ON #{klass.table} (#{idx})\"\n exec(sql)\n end\n end",
"def create_or_update_index\n # check if index is created\n if index_exists?\n IndexJob.perform_later(self.class.name, 'update', id)\n else\n IndexJob.perform_later(self.class.name, 'index', id)\n end\n end",
"def index_old\n @ontologies = LinkedData::Client::Models::Ontology.all(include: LinkedData::Client::Models::Ontology.include_params)\n @submissions = LinkedData::Client::Models::OntologySubmission.all\n @submissions_map = Hash[@submissions.map {|sub| [sub.ontology.acronym, sub] }]\n @categories = LinkedData::Client::Models::Category.all\n @groups = LinkedData::Client::Models::Group.all\n\n # Count the number of classes in each ontology\n metrics_hash = get_metrics_hash\n @class_counts = {}\n @ontologies.each do |o|\n @class_counts[o.id] = metrics_hash[o.id].classes if metrics_hash[o.id]\n @class_counts[o.id] ||= 0\n end\n\n @mapping_counts = {}\n @note_counts = {}\n respond_to do |format|\n format.html # index.rhtml\n end\n end",
"def update_index(policy = nil)\n policy ||= self.class.update_index_policy\n case policy\n when :immediate_with_refresh\n local_index_in_elastic_search(:refresh => true)\n when :enqueue\n DistributedIndexing::ReIndexDocuments.perform_in(1.seconds, self.class.to_s, [self.id.to_s])\n else\n local_index_in_elastic_search\n end\n end",
"def add( resource )\n entries.merge!( resource.index_dump )\n mark_modified\n end",
"def save(*args)\n super(*args)\n index\n self\n end",
"def update_component_attr_index!(_component_attr_index)\n end",
"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 index(obj)\n if @index && !loaded?\n @index.call(obj)\n else\n super\n end\n end",
"def inherited(subclass)\n super\n subclass.instance_variable_set(\"@collection\", {})\n subclass.instance_variable_set(\"@indexed_fields\", [])\n subclass.instance_variable_set(\"@indexes\", {})\n end",
"def index_new\n Index.new(self)\n end",
"def create_index o_class, name:, on: :automatic, type: :unique\n logger.progname = 'RestCreate#CreateIndex'\n begin\n c = classname o_class\n execute transaction: false do\n \t command = if on == :automatic\n \t\t \"CREATE INDEX #{c}.#{name} #{type.to_s.upcase}\"\n \t\telsif on.is_a? Array\n \t\t \"CREATE INDEX #{name} ON #{classname(o_class)}(#{on.join(', ')}) #{type.to_s.upcase}\"\n \t\telse\n \t\t nil\n \t\tend\n \t [{type: \"cmd\", language: 'sql', command: command}]\n end\n logger.info{\"Index on #{c} based on #{name} created.\"}\n rescue RestClient::InternalServerError => e\n response = JSON.parse(e.response)['errors'].pop\n \t error_message = response['content'].split(':').last\n logger.error{\"Index not created.\"}\n logger.error{\"Error-code #{response['code']} --> #{response['content'].split(':').last }\"}\n nil\n end\n end",
"def index(model)\n model.index\n ElasticMapper.index.refresh\nend",
"def update!(**args)\n @class_label = args[:class_label] if args.key?(:class_label)\n @csv_instance = args[:csv_instance] if args.key?(:csv_instance)\n end",
"def _index(entity, props, clazz = Neo4j::Node) #:nodoc:\n indexer = Indexer.instance_for(clazz)\n indexer.index_entity(entity, props)\n end",
"def reindex\n collection = Collection.find(params[:id])\n EOL::Solr::CollectionItemsCoreRebuilder.reindex_collection(collection)\n collection.update_attribute(:collection_items_count,\n collection.collection_items.count)\n redirect_to collection, notice: I18n.t(:collection_redindexed)\n end",
"def index_keywords!\n update_attribute(:_keywords, set_keywords)\n end",
"def add_all\n helper.index_write do |index|\n index.add_all\n index.update_all\n end\n\n self\n end",
"def index\n self.class.all.index(self)\n end",
"def update!(**args)\n @classes = args[:classes] if args.key?(:classes)\n @scores = args[:scores] if args.key?(:scores)\n end",
"def set(instance)\n # TODO could we not cause a nasty bug by dropping nil value keys when the \n # user is using composite keys? Should we not rather raise an error if\n # the value is nil?\n key = instance.key\n \n raise ArgumentError.new(\"+key+ must be an Array, and can not be empty\") if key.empty? \n @cache[instance.class][key] = instance \n end",
"def add_to_index posts\n indexDir = java.io.File.new(@index_dir);\n writer = IndexWriter.new(indexDir, StandardAnalyzer.new, !File.exists?(indexDir.absolute_path))\n posts.each do |post|\n writer.updateDocument(Term.new(\"id\",post[:id]),create_lucene_document(post))\n @last_id = post[:id]\n @log.debug \"added post ##{post[:id]}\"\n end \n writer.optimize\n writer.close\n @log.info \"added #{posts.size} documents to index\"\n end",
"def reindex_article\n Article.reindex\n end",
"def set_incremental_index_on_field_types\n field_types.each_with_index do |field_type, index|\n field_type.index = index\n end\n end",
"def update\n # don't need to update; hash is shared\n end",
"def delete_from_index\n mapping_name = self.class.instance_variable_get(:@_mapping_name)\n\n ElasticMapper.index.type(mapping_name).delete(self.id)\n end",
"def update_aggregates\n es_client.indices.refresh index: index_name\n self.update_attributes(\n num_users: sample_users.length,\n num_tweets: es_client.count(index: index_name)['count'],\n num_retweets: count_retweets,\n hashtags: MetadataHarvester.new(:hashtags, all_tweets).harvest,\n top_urls: MetadataHarvester.new(:urls, all_tweets).harvest,\n top_words: MetadataHarvester.new(:words, all_tweets).harvest,\n top_mentions: MetadataHarvester.new(:mentions, all_tweets).harvest,\n top_sources: MetadataHarvester.new(:sources, all_tweets).harvest,\n top_retweets: MetadataHarvester.new(:retweets, all_tweets).harvest\n )\n end",
"def elastic_index(options = {})\n \n options.symbolize_keys!\n Escargot.register_model(self)\n \n if respond_to?('single_collection_inherited?') and single_collection_inherited?\n ivars = %w[@index_name @update_index_policy @index_options @indexing_options @mapping @current_schema_version @previous_schema_version]\n ivars.each do |ivar|\n if passed_option = options[ivar[1..-1].to_sym]\n instance_variable_set ivar, passed_option\n else\n instance_variable_set ivar, superclass.instance_variable_get(ivar)\n end\n end\n else\n @index_name = options[:index_name] || self.name.underscore.gsub(/\\//,'-')\n @update_index_policy = options.include?(:updates) ? options[:updates] : :immediate\n \n if @update_index_policy\n after_save :update_index\n after_destroy :delete_from_index\n end\n \n @index_options = options[:index_options] || {}\n @indexing_options = options[:indexing_options] || {}\n @mapping = options[:mapping] || false\n @current_schema_version = options[:current_schema_version] || \"0\"\n @previous_schema_version = options[:previous_schema_version] || \"0\"\n end\n \n end",
"def indexed=(val)\n self['indexed'] = 'val'\n end"
] | [
"0.74796563",
"0.6981333",
"0.6598288",
"0.655213",
"0.6408979",
"0.6408979",
"0.6399122",
"0.6279504",
"0.6270902",
"0.6145742",
"0.613652",
"0.61317766",
"0.60936815",
"0.600133",
"0.59957445",
"0.5913338",
"0.5892912",
"0.5859924",
"0.5856618",
"0.5841925",
"0.57764846",
"0.57642287",
"0.5752258",
"0.5741801",
"0.5730936",
"0.57296044",
"0.5700272",
"0.5672938",
"0.56535435",
"0.5642211",
"0.56404805",
"0.5634717",
"0.5617953",
"0.56007177",
"0.5576753",
"0.5570369",
"0.55393475",
"0.5537736",
"0.55196375",
"0.55166364",
"0.5514684",
"0.54841226",
"0.5476668",
"0.54718196",
"0.54692036",
"0.5463066",
"0.5459336",
"0.54369825",
"0.5425823",
"0.53973883",
"0.53749627",
"0.53702116",
"0.53696156",
"0.5344011",
"0.53328305",
"0.5332098",
"0.5327319",
"0.52746135",
"0.527389",
"0.52563024",
"0.5254698",
"0.52414787",
"0.5234941",
"0.52152115",
"0.5210228",
"0.5209731",
"0.5207891",
"0.5207891",
"0.5207891",
"0.5207891",
"0.52058536",
"0.5199057",
"0.5192572",
"0.5172623",
"0.5166394",
"0.51516044",
"0.5151373",
"0.5150723",
"0.5149815",
"0.5142534",
"0.5135805",
"0.5130937",
"0.51276237",
"0.51218575",
"0.51156616",
"0.51114804",
"0.5107028",
"0.50994194",
"0.5095354",
"0.5094943",
"0.50931126",
"0.50915563",
"0.50849384",
"0.5076064",
"0.5071857",
"0.5069554",
"0.5063747",
"0.50617653",
"0.50601435",
"0.5052696"
] | 0.5817954 | 20 |
This who is following the user | def followers
list = service.find_followers(user).map {|data| build_object(data)}
followers = list.map {|follower| follower.login}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def follower_username\n self.following_user.username\n end",
"def following\n return @following\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following_user?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n\t following.include?(other_user)\n \tend",
"def following?\n user.present?\n end",
"def following?(other_user)\n\t following.include?(other_user)\n\tend",
"def following?( other_user )\n followings.include?( other_user )\n end",
"def following? (other_user)\n following.include?(other_user)\n end",
"def following? other_user\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following_user?(other_user)\n following_users.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end"
] | [
"0.7837616",
"0.7482533",
"0.7300668",
"0.7283128",
"0.72566235",
"0.7223081",
"0.722218",
"0.72082865",
"0.7203265",
"0.7199945",
"0.71920174",
"0.71920174",
"0.71920174",
"0.7174599",
"0.7174599",
"0.7174599",
"0.7174599",
"0.7170681",
"0.7148585",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278",
"0.7145278"
] | 0.0 | -1 |
This is who the user follows | def followees
list = service.find_user_follows(user).map {|data| build_object(data)}
followees = list.map {|followee| followee.login}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def follower_username\n self.following_user.username\n end",
"def following\n return @following\n end",
"def who\n\t\t\t@username\n\t\tend",
"def users_messaged_by\r\n self.users_who_messaged_me\r\n end",
"def users_messaged_by\r\n self.users_who_messaged_me\r\n end",
"def follow_user(user)\n return @mouth.follow(user)\n end",
"def followed\n Follower.where(\"follower_id=?\", self.id).map{|f| f.user}\n end",
"def following?\n user.present?\n end",
"def following\n @following = @current_user.friends\n end",
"def user_followed\n amigos = self.friends.pluck(:friend_id)\n User.find(amigos)\n end",
"def father_name\n \n Tweet.find(self.tweet_id).user.username\n \n end",
"def prev_follow\n end",
"def following_record(user)\n followings_as_follower.find_by(user: user)\n end",
"def wall\n Micropost.from_users_followed_by(self)\n end",
"def me_and_followings\n self.followings+[self]\n end",
"def message_user\n return self.username\n end",
"def following\n data['plans'][me]['following']\n end",
"def whoami\n ancestors.first.to_s\n end",
"def sender\n user = User.find_by_id(sent_by)\n \"#{user.first_name} #{user.last_name}\"\n end",
"def follow\n who = User.find(params[:id])\n @current_user.follow(who)\n render :text => \"you are now following #{who.username}\"\n end",
"def sender_user_name_of_recent_message\n message = self.messages.last \n user = message.sender_id\n name = User.find_by(id: user)\n if name\n \"#{name.first_name} #{name.last_name}\"\n end\n end",
"def cur_followers\n self.cur_oaths.map {|bloodoath| bloodoath.follower}\n end",
"def owner\n self.user.screenname\n end",
"def following\n @following||= get(\"/user/show/#{login}/following\")['users'].map { |u| User.new(connection, :login => u) }\n end",
"def following_user?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n\t following.include?(other_user)\n \tend",
"def on_behalf_of_user_id\n return @on_behalf_of_user_id\n end",
"def user\n owner\n end",
"def follows_given(user_id)\n follows = Follow.where(user_id: user_id)\n end",
"def following? (other_user)\n following.include?(other_user)\n end",
"def follow_x\n @last_follow[0]\n end",
"def created_by\n user\n end",
"def following?(other_user)\n\t following.include?(other_user)\n\tend",
"def following\n Follow.where(\"follower_id = ?\", self.id)\n end",
"def following_user?(other_user)\n following_users.include?(other_user)\n end",
"def sent_to_me\n return @sent_to_me\n end",
"def in_reply_to_user\n previous_tweet.try(:author).try(:screen_name) || params[:in_reply_to_user]\n end",
"def following? other_user\n following.include?(other_user)\n end",
"def followerss\n followers = relationships.find_by_followed_id(self.id)\n return followers\n end",
"def replying_to\n return nil unless self.reply?\n user = self.text[0...self.text.index(\" \")]\n return nil unless user[0...1] == \"@\"\n user\n end",
"def replying_to\n return nil unless self.reply?\n user = self.text[0...self.text.index(\" \")]\n return nil unless user[0...1] == \"@\"\n user\n end",
"def username\n self.trip.user.username\n end",
"def following?( other_user )\n followings.include?( other_user )\n end",
"def follow(other_user)\n following << other_user\n end",
"def follow(other_user)\n following << other_user\n end",
"def follow(other_user)\n following << other_user\n end",
"def follow(other_user)\n following << other_user\n end",
"def follow(other_user)\n following << other_user\n end",
"def follow(other_user)\n following << other_user\n end",
"def follows?(user)\n user.followers.include?(self)\n end",
"def following?(other_user)\n followeds.include?(other_user)\n end",
"def follow(other_user)\n following << other_user\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user) \n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end"
] | [
"0.8019525",
"0.7187833",
"0.7135876",
"0.6875988",
"0.6875988",
"0.6842539",
"0.6775694",
"0.6721884",
"0.66867524",
"0.6683983",
"0.66752815",
"0.6672738",
"0.6644547",
"0.66426426",
"0.6638271",
"0.6636472",
"0.6594985",
"0.65875506",
"0.65814644",
"0.6529242",
"0.6522476",
"0.6513894",
"0.65065575",
"0.6499776",
"0.6498532",
"0.64691913",
"0.64542526",
"0.6451135",
"0.6433146",
"0.64283943",
"0.64274764",
"0.6423729",
"0.64236027",
"0.6420027",
"0.64197844",
"0.6407994",
"0.6406219",
"0.64046663",
"0.6399696",
"0.6393005",
"0.63802844",
"0.63802844",
"0.6378713",
"0.6373922",
"0.63710445",
"0.63710445",
"0.63710445",
"0.63710445",
"0.63710445",
"0.63710445",
"0.6370815",
"0.6362009",
"0.6357541",
"0.6352063",
"0.6352063",
"0.6352063",
"0.6352063",
"0.63510835",
"0.63510835",
"0.63510835",
"0.6349156",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161",
"0.6339161"
] | 0.0 | -1 |
adding and removing sizes | def add_size( size )
@size << size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size\n @sizes ||= strip(:size)\n end",
"def remove_size(size)\n @size.delete(size)\n end",
"def interpret_size(size); end",
"def add_size (size)\n @size << size\n end",
"def update_size(width, height) \n if @vertical\n @height += height\n @width = width if width > @width\n else\n @width += width\n @height = height if height > @height\n end\n end",
"def incSize\n if ((@y + @size) < 254) & ((@x + @size) < 510)\n call erase\n let @size = @size + 2\n call draw\n end\n end",
"def update_size(x,y)\n @width = x if x > @width\n @height = y if y > @height\n end",
"def decSize\n if @size > 2\n call erase\n let @size = @size - 2\n call draw\n end\n end",
"def size=(size)\n dif = size - @size\n dif < 0 ? @weights.pop(-dif) : @weights.push(Array.new(dif, 0)).flatten!\n dif < 0 ? @inputs.pop(-dif) : @inputs.push(Array.new(dif, 0)).flatten!\n @size = size\n end",
"def set_size!(size) \n @transforms << SIZES[size]\n self \n end",
"def size!\n @size = nil\n self.size\n end",
"def add_size!\n input_html_options[:size] ||= nil\n end",
"def size\n super\n end",
"def size\n super\n end",
"def sizes\n @sizes ||= self.class.image_sizes.dup\n end",
"def validate_entry_sizes; end",
"def size\nend",
"def resize(size)\n @size = size\n new_slots = Array.new(@size).map { 0 }\n new_slots.each_with_index do |slot, i|\n new_slots[i] = @slots[i]\n end\n @slots = new_slots\n end",
"def size(*) end",
"def size(*) end",
"def normalize_size(height:, width:)\n [\n normalize_single_size(height, ref_size: base_height),\n normalize_single_size(width, ref_size: base_width),\n ]\n end",
"def calc_size(size)\n eax = size\n edx = size + 0xf\n eax = 0x10\n eax -= 1\n eax += edx\n var_390 = 0x10\n edx = 0\n eax = eax / var_390\n eax *= 0x10\n\n return eax + 0x1c\nend",
"def size\n\n end",
"def size\n width * height\n end",
"def size\n @front.size + @rear.size\n end",
"def size(x, y=nil)\n settings.size = [x, y || x]\n end",
"def size\n 4\n end",
"def size\n\t\t7500\n\tend",
"def size(w,h)\n @size = \"#{w}x#{h}\"\n end",
"def setSize _obj, _args\n \"_obj setSize _args;\" \n end",
"def size\n\tend",
"def validate_entry_sizes=(_arg0); end",
"def size=(size)\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size=(dimension); end",
"def resize!\n end",
"def size!\n @elements.values.map(&:size!).inject(0) {|total,size| total + size}\n end",
"def size() end",
"def size() end",
"def size() end",
"def size() end",
"def size() end",
"def size() end",
"def size\n\n\n end",
"def +(other)\n if Size === other\n Size.new(value + other.value, @parts + other.parts)\n else\n Size.new(value + other, @parts + [[:halfpts, other]])\n end\n end",
"def attach_sizes\n unless self.sizes_added\n rsp = @flickr.send_request('flickr.photos.getSizes', :photo_id => self.id)\n\n self.sizes_added = true\n self.sizes = []\n\n # TODO: investigate the new video features and integrate better\n rsp.sizes.size.each do |size|\n method = \"url_#{size[:label].downcase}=\"\n next unless respond_to? method\n send(method, size[:source])\n \n # send(\"url_#{size[:label].downcase}=\", size[:source])\n\n self.sizes << Flickr::Photos::Size.new(:label => size[:label],\n :width => size[:width],\n :height => size[:height],\n :source => size[:source],\n :url => size[:url])\n end\n end\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size=(size)\n self.width = self.height = @size = size\n end",
"def size\n\t\tlast - first + (exclude_end? ? 0 : 1)\n\tend",
"def resize\n # TODO\n # if aray is 75% full, double the array and copy all items over\n end",
"def check_for_resize; end",
"def all_sizes\n [0.1, 0.5, 1, 5, 10]\n end",
"def normalize_size_to(integer)\n until size >= integer\n unshift 0\n end\n self\n end",
"def sizes\n h_sizes = [@size]\n prog = @prog\n add_sizes = proc { h_sizes << h_sizes.last / prog.to_f**(1.0 / 48) }\n nb_notes = notes_range.to_a.size\n\n if @prog_change.nil?\n (nb_notes - 1).times(&add_sizes)\n elsif !@prog_change[:note].nil?\n nb_notes = (notes_range.min.succ..@prog_change[:note]).to_a.size\n nb_notes.times(&add_sizes)\n\n prog = @prog_change[:prog].to_f\n unless @prog_change[:size].nil?\n h_sizes.pop\n h_sizes << @prog_change[:size]\n end\n nb_notes = (@prog_change[:note].succ..notes_range.max).to_a.size\n nb_notes.times(&add_sizes)\n end\n h_sizes.map { |size| size.round(0) }\n end",
"def size=(width, height)\n end",
"def size(size)\n @value[:size] = size\n self\n end",
"def size=(size)\n @size = size\n resize\n end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size\n\t\t@w * @h\n\tend",
"def available_sizes\n\t\tsizes =[]\n\t\tif self.inventory.xsmall > 0\n\t\t\tsizes << ['XS', 1]\n\t\tend\n\t\tif self.inventory.small > 0\n\t\t\tsizes << ['S', 2]\n\t\tend\n\t\tif self.inventory.medium > 0\n\t\t\tsizes << ['M', 3]\n\t\tend\n\t\tif self.inventory.large > 0\n\t\t\tsizes << ['L', 4]\n\t\tend\n\t\tif self.inventory.xlarge > 0\n\t\t\tsizes << ['XL', 5]\n\t\tend\n\t\tif self.inventory.xxlarge > 0\n\t\t\tsizes << ['XXL', 6]\n\t\tend\n\t\tsizes\n\tend",
"def set_sizes\n @size = Size.find(params[:id])\n end",
"def size=(size='300x200')\n @width, @height = size.split(\"x\").map { |dimension| dimension.to_i }\n end",
"def change_size(size)\n return false if size == current_image_size\n\n if size == 'auto'\n new_column, new_row, new_extra_lines = working_article.calculate_fitting_image_size(column, row, extra_height_in_lines)\n if column == new_column && row == new_row && extra_height_in_lines == new_extra_lines\n return false\n end\n\n self.column = new_column\n self.row = new_row\n self.extra_height_in_lines = new_extra_lines\n save\n true\n elsif size.include?('x')\n size_array = size.split('x')\n self.column = size_array[0].to_i\n self.row = size_array[1].to_i\n save\n true\n else\n puts 'wrong size format!!!'\n return false\n end\n end",
"def resize!\n #dobule capacity\n #new store\n #place existing elements into new store\n capacity2 = @capacity * 2\n store2 = StaticArray.new(capacity2)\n @length.times { |i| store2[i] = @store[i] }\n @capacity = capacity2\n @store = store2\n end",
"def size\n label.to_s.downcase.sub(/\\s+/,'_')\n end",
"def extract_size(size)\n unless size.nil?\n size = OpenStruct.new(size)\n \"#{size.width}x#{size.height}\"\n end\n end",
"def size\n children_size + my_size\n end",
"def size= (x)\n change_options({\"size\" => x})\n end",
"def delete_small!\n @contents.delete_if do |c|\n# ((c[1] - c[0]) < @image.min_content_size*0.6) or\n ((c[1] - c[0]) < @image.min_obj_size) or\n ((c[0] - @image.min_obj_size <= 0) and (c[2]<@image.min_content_size)) or\n ((c[1] + @image.min_obj_size >= @projection.size) and (c[2]<@image.min_content_size))\n end\n end",
"def size=(val)\n if @size > val\n @elements.keys.each do |k|\n @elements.delete(k) if k >= val\n end\n end\n @size = val\n end",
"def size_header\n 2 + 2 + 1\n end"
] | [
"0.68593484",
"0.6683275",
"0.6670001",
"0.6587559",
"0.64204353",
"0.6319315",
"0.6290475",
"0.62815124",
"0.62740856",
"0.621347",
"0.6175416",
"0.61624885",
"0.6152782",
"0.6152782",
"0.6130159",
"0.6120918",
"0.6100449",
"0.60730606",
"0.60303694",
"0.60303694",
"0.59596956",
"0.59526724",
"0.5945538",
"0.59442043",
"0.593615",
"0.5927665",
"0.5911801",
"0.5909951",
"0.5908779",
"0.5894416",
"0.587594",
"0.58730793",
"0.5872076",
"0.5872023",
"0.5872023",
"0.5872023",
"0.5870567",
"0.5866334",
"0.5860554",
"0.58573055",
"0.58573055",
"0.58573055",
"0.58573055",
"0.58573055",
"0.58573055",
"0.5856984",
"0.58532554",
"0.58485377",
"0.5835476",
"0.5835476",
"0.5835476",
"0.5835476",
"0.5835476",
"0.5835476",
"0.5835476",
"0.58082545",
"0.57988083",
"0.57946885",
"0.5793127",
"0.5791256",
"0.57860327",
"0.57728887",
"0.57644063",
"0.5740007",
"0.5734545",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.5733503",
"0.57249063",
"0.5723363",
"0.5716486",
"0.5711563",
"0.57087964",
"0.5705276",
"0.5699284",
"0.5686708",
"0.5684891",
"0.5681373",
"0.56805766",
"0.56713086",
"0.5662185"
] | 0.6572914 | 5 |
Overwriting the string method to apply to this Class/object | def to_s
return "#{@id}\t #{@description}\t #{@price}\t Sizes: #{@size.join(", ")}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string() end",
"def str; end",
"def str; end",
"def string\n @string\n end",
"def string\n @string\n end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string\n end",
"def string\n end",
"def string\n end",
"def string()\n #This is a stub, used for indexing\n end",
"def string(*) end",
"def string(t)\n @@string_visitor.visit_this(self, t)\n end",
"def to_s\n self.name.to_s || super\n end",
"def to_str() end",
"def to_str() end",
"def to_str\n self.to_s\n end",
"def to_s\n raise 'To be implemented in child classes'\n end",
"def string?; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_s\n if self.class._equal?(String)\n self\n else\n String.new(self)\n end\n end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def method_missing(method_name, *args, &block)\n if (string = to_s).respond_to?(method_name)\n string.__send__(method_name, *args, &block)\n else\n super\n end\n end",
"def to_s\n super\n end",
"def String(p0) end",
"def to_s\n @string ||= Builder::ToString.new(self).string\n end",
"def to_s\n\t\t\traise NotImplementedError, \"%s does not provide an implementation of #to_s\" %\n\t\t\t\t[ self.class.name ]\n\t\tend",
"def to_s\n nil? ? '' : super\n end",
"def string= string\n #This is a stub, used for indexing\n end",
"def to_s\n\t\tsuper\n\tend",
"def to_s\n super\n end",
"def to_str\n end",
"def to_str\n end",
"def get_string(attr); end",
"def to_s\n\t\t\t@to_s_sym ? self.__send__(@to_s_sym) : super\n\t\tend",
"def to_str\n end",
"def to_s\n raise NotImplementedError.new(\"#{self.class}#to_s\")\n end",
"def str2; end",
"def str2; 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 return super\n end",
"def to_s\n c = self.class.to_s\n super.sub(c, c + \"+Bondage\")\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; 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"
] | [
"0.74949",
"0.731909",
"0.731909",
"0.73020196",
"0.73020196",
"0.728641",
"0.728641",
"0.728641",
"0.728641",
"0.728641",
"0.728641",
"0.728641",
"0.728641",
"0.728641",
"0.72782105",
"0.72782105",
"0.72782105",
"0.71594965",
"0.71268743",
"0.70789886",
"0.69821966",
"0.69447833",
"0.69447833",
"0.6889813",
"0.6883239",
"0.6872399",
"0.6870778",
"0.6870778",
"0.6870778",
"0.6870778",
"0.6870778",
"0.6870778",
"0.6870778",
"0.6870778",
"0.6870778",
"0.6869679",
"0.68491673",
"0.6840187",
"0.6835512",
"0.6803274",
"0.6787202",
"0.67829025",
"0.6768061",
"0.675057",
"0.6737319",
"0.6723827",
"0.6716334",
"0.6716334",
"0.67140204",
"0.6711965",
"0.6701485",
"0.66785824",
"0.6663796",
"0.6663796",
"0.6651499",
"0.6651499",
"0.6651499",
"0.6651499",
"0.6651499",
"0.6651499",
"0.6651499",
"0.6651499",
"0.6651499",
"0.6651499",
"0.6651499",
"0.6651499",
"0.6651499",
"0.6651499",
"0.6651499",
"0.6651499",
"0.6651499",
"0.6651499",
"0.66438645",
"0.66425645",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605",
"0.66294605"
] | 0.0 | -1 |
include Override Objectinclude so that modules extending Module instance can define include. | def include( *modules )
super if defined?( super )
original_include( *modules )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_include(include)\n object_class.record_location self\n return include unless @document_self\n object_class.add_include include\n end",
"def add_include include\n add_to @includes, include\n\n include\n end",
"def include; end",
"def include; end",
"def include(mod)\n mod.included(self)\n end",
"def link_include_object(obj); end",
"def link_include_object(obj); end",
"def include(*args)\n include_or_extend(:include, *args)\n end",
"def add_include(include)\n add_to @includes, include\n end",
"def add_include(include)\n @includes << include\n end",
"def included(othermod) end",
"def included(mod); end",
"def included; end",
"def do_includes\n @body.scan(/rb_include_module\\s*\\(\\s*(\\w+?),\\s*(\\w+?)\\s*\\)/) do |c,m|\n if cls = @classes[c]\n m = @known_classes[m] || m\n cls.add_include(Include.new(m, \"\"))\n end\n end\n end",
"def include(mod,*more) end",
"def included(a_module)\n end",
"def on_include(&block)\n self.inclusion = block\n self\n end",
"def include inc\n @includes << inc\n end",
"def include(mod)\n mod.append_features(self)\n Rubinius.privately do\n mod.included self\n end\n self\n end",
"def include(*args)\n include_private(*args)\n end",
"def set_include_statement\n super\n end",
"def included(base)\n base.extend(ClassMethods)\n base.extend(ModuleMethods) unless base.is_a?(Class)\n end",
"def include(arg)\n Object.module_eval \"include #{arg}\"\n end",
"def included(klass); end",
"def included(klass); end",
"def included_modules() end",
"def include_into(klass)\n unless klass.kind_of? Module\n raise TypeError, \"invalid argument class #{klass.class}, expected Module\"\n end\n\n # check other.frozen\n # taint other from self\n\n insert_at = klass\n mod = self\n changed = false\n\n while mod\n\n # Check for a cyclic include\n if mod == klass\n raise ArgumentError, \"cyclic include detected\"\n end\n\n # Try and detect check_mod in klass's heirarchy, and where.\n #\n # I (emp) tried to use Module#< here, but we need to also know\n # where in the heirarchy the module is to change the insertion point.\n # Since Module#< doesn't report that, we're going to just search directly.\n #\n superclass_seen = false\n add = true\n\n k = klass.direct_superclass\n while k\n if k.kind_of? Rubinius::IncludedModule\n # Oh, we found it.\n if k == mod\n # ok, if we're still within the directly included modules\n # of klass, then put future things after mod, not at the\n # beginning.\n insert_at = k unless superclass_seen\n add = false\n break\n end\n else\n superclass_seen = true\n end\n\n k = k.direct_superclass\n end\n\n if add\n if mod.kind_of? Rubinius::IncludedModule\n original_mod = mod.module\n else\n original_mod = mod\n end\n\n im = Rubinius::IncludedModule.new(original_mod).attach_to insert_at\n insert_at = im\n\n changed = true\n end\n\n mod = mod.direct_superclass\n end\n\n if changed\n method_table.each do |meth, obj, vis|\n Rubinius::VM.reset_method_cache meth\n end\n end\n\n return self\n end",
"def do_includes\n @content.scan(/rb_include_module\\s*\\(\\s*(\\w+?),\\s*(\\w+?)\\s*\\)/) do |c,m|\n next unless cls = @classes[c]\n m = @known_classes[m] || m\n\n comment = new_comment '', @top_level, :c\n incl = cls.add_include RDoc::Include.new(m, comment)\n incl.record_location @top_level\n end\n end",
"def add_includes out, includes\n add_extension_modules out, 'Includes', includes\n end",
"def included(base)\n base.send :include, self::InstanceMethods\n end",
"def include(*others)\n IncludesTracker.reset!\n __orig_include(*others)\n end",
"def included(*args)\n quando_incluso *args\n end",
"def included_modules; end",
"def include_strategy\n :includes\n end",
"def redo_include_and_extend\n reinclude + reextend\n end",
"def include(header)\n @inc << \"#include #{header}\"\n end",
"def extend(module1, *smth)\n IncludeWithRespect.extend_with_respect(self, module1, *smth)\n end",
"def include( *modules, & block )\n\n new_stack_frame( :include, *modules, & block )\n \n return self\n \n end",
"def include(mod, opts = {})\n inclusions << Inclusion.new(mod, opts)\n end",
"def add_include(path)\n @includes << path\n end",
"def add_include(path)\n @includes << path\n end",
"def include(*a)\n res = super\n def_roda_before\n def_roda_after\n res\n end",
"def included( mod )\n\t\tsuper\n\t\tself.log.debug \"Including %d components in %p\" % [ self.components.length, mod ]\n\t\tself.components.each do |component_type, args|\n\t\t\tself.log.debug \"Adding %p to %p from %p\" % [ component_type, mod, self ]\n\t\t\tmod.add( component_type, *args )\n\t\tend\n\tend",
"def include(*modules)\n modules.reverse_each do |mod|\n if !mod.kind_of?(Module) or mod.kind_of?(Class)\n raise TypeError, \"wrong argument type #{mod.class} (expected Module)\"\n end\n\n Rubinius.privately do\n mod.append_features self\n end\n\n Rubinius.privately do\n mod.included self\n end\n end\n self\n end",
"def include(*modules)\n modules.reverse_each do |mod|\n if !mod.kind_of?(Module) or mod.kind_of?(Class)\n raise TypeError, \"wrong argument type #{mod.class} (expected Module)\"\n end\n\n Rubinius.privately do\n mod.append_features self\n end\n\n Rubinius.privately do\n mod.included self\n end\n end\n self\n end",
"def do_xinclude(options = T.unsafe(nil)); end",
"def do_xinclude(options = T.unsafe(nil)); end",
"def included(model_class); end",
"def before_include_or_extend( & block )\n \n add_hook_context( :before_include )\n add_hook_context( :before_extend )\n action( & block ) if block_given?\n \n return self\n \n end",
"def include_above(mod1, mod) end",
"def included(object)\n super\n\n Flaggable.setup_flaggable_object(object)\n\n # Add the feature check methods to the object's internal feature class.\n #\n object.instance_feature_class.internal_feature_checks_module.include internal_feature_checks_module\n\n # Because we added feature check methods above, include again to make them available.\n #\n object.instance_feature_class.include object.instance_feature_class.internal_feature_checks_module\n\n # Add the feature methods to the object's internal feature class.\n #\n object.instance_feature_class.internal_feature_module.include internal_feature_module\n\n # Add our feature flags to the object's feature flags.\n #\n object.instance_feature_class.feature_flags.concat(feature_flags)\n end",
"def send_include(target_cls, cls)\n target_cls.send(:include, cls) if defined?(target_cls)\n end",
"def included_modules\n end",
"def include item\n\tend",
"def before_include( *contexts, & block )\n \n add_execution_context( *contexts )\n add_hook_context( :before_include )\n action( & block ) if block_given?\n \n return self\n \n end",
"def includes(*args)\n @options[:include] ||= []\n @options[:include] |= args\n end",
"def modulize_include(*mod_consts)\n mod_consts.each do |mod_const|\n modulize *(mod_const.instance_methods)\n include mod_const\n end\n end",
"def include_into(klass)\n unless klass.kind_of? Module\n raise TypeError, \"invalid argument class #{klass.class}, expected Module\"\n end\n\n if kind_of? Class\n raise TypeError, \"invalid receiver class #{__class__}, expected Module\"\n end\n\n Rubinius::Type.include_modules_from(self, klass.origin)\n Rubinius::Type.infect(klass, self)\n\n self\n end",
"def includes\n end",
"def includes\n end",
"def include=(_arg0); end",
"def __included(base, mod, tag = nil)\n __trace { \"... including #{tag || mod.try(:name) || mod} in #{base}\" }\nend",
"def before_include( *contexts, & block )\n \n return frame_definer.before_include( *contexts, & block )\n \n end",
"def included(base)\n install_configure_in(base)\n base.class_eval do\n extend ClassMethods\n end\n end",
"def auto_include!\n mixins = @@class_mixins[name]\n send(:include, *mixins) if mixins\n end",
"def included(submodule)\n super\n submodule.instance_eval { extend Mixin }\n submodule\n end",
"def included( hooked_instance )\n \n super if defined?( super )\n \n end",
"def included(base)\n super(base)\n base.extend(ClassMethods)\n base.extend(ClassScope)\n end",
"def add_includes(inc)\r\n return if inc.nil?\r\n \r\n inc = [inc] if (!inc.respond_to?(:each) || inc.kind_of?(String))\r\n \r\n if inc.include?(:all)\r\n ole_methods.each do |m|\r\n m = m.to_s\r\n if m =~ /\\AInclude/ && m != 'IncludeRetElementList'\r\n @request.__send__(\"#{m.underscore}=\", true)\r\n end\r\n end\r\n return\r\n end\r\n \r\n inc.each do |item|\r\n cam_item = item.to_s.camelize.gsub(/Id/, \"ID\")\r\n if @request.respond_to_ole?(\"Include#{cam_item}\")\r\n @request.__send__(\"include_#{item}=\", true)\r\n else\r\n @request.IncludeRetElementList.Add(cam_item)\r\n end\r\n end\r\n end",
"def included(base)\n [\n Celluloid,\n Celluloid::IO,\n CelluloidPubsub::Helper,\n config['logger_class']\n ].each do |module_name|\n base.send(:include, module_name)\n end\n end",
"def extend_object obj\n mod = Module.new\n mod.send :include, Haml::Helpers\n render mod\n method = obj.is_a?(Module) ? :include : :extend\n obj.send method, mod\n end",
"def include_at_top(mod) end",
"def include(mod)\n Dsl::Controller.include(mod)\n Dsl::Edge.include(mod)\n end",
"def add_includes(&block)\n if include_associations = options.delete(:include)\n base_only_or_except = { :except => options[:except],\n :only => options[:only] }\n\n include_has_options = include_associations.is_a?(Hash)\n associations = include_has_options ? include_associations.keys : Array(include_associations)\n\n for association in associations\n records = case @record.class.reflect_on_association(association).macro\n when :has_many, :has_and_belongs_to_many\n @record.send(association).to_a\n when :has_one, :belongs_to\n @record.send(association)\n end\n\n unless records.nil?\n association_options = include_has_options ? include_associations[association] : base_only_or_except\n opts = options.merge(association_options)\n yield(association, records, opts)\n end\n end\n\n options[:include] = include_associations\n end\n end",
"def add_includes(&block)\n if include_associations = options.delete(:include)\n base_only_or_except = { :except => options[:except],\n :only => options[:only] }\n\n include_has_options = include_associations.is_a?(Hash)\n associations = include_has_options ? include_associations.keys : Array(include_associations)\n\n for association in associations\n records = case @record.class.reflect_on_association(association).macro\n when :has_many, :has_and_belongs_to_many\n @record.send(association).to_a\n when :has_one, :belongs_to\n @record.send(association)\n end\n\n unless records.nil?\n association_options = include_has_options ? include_associations[association] : base_only_or_except\n opts = options.merge(association_options)\n yield(association, records, opts)\n end\n end\n\n options[:include] = include_associations\n end\n end",
"def add_includes(&block)\n if include_associations = options.delete(:include)\n base_only_or_except = { :except => options[:except],\n :only => options[:only] }\n\n include_has_options = include_associations.is_a?(Hash)\n associations = include_has_options ? include_associations.keys : Array.wrap(include_associations)\n\n for association in associations\n records = case @serializable.class.reflect_on_association(association).macro\n when :has_many, :has_and_belongs_to_many\n @serializable.send(association).to_a\n when :has_one, :belongs_to\n @serializable.send(association)\n end\n\n unless records.nil?\n association_options = include_has_options ? include_associations[association] : base_only_or_except\n opts = options.merge(association_options)\n yield(association, records, opts)\n end\n end\n\n options[:include] = include_associations\n end\n end",
"def add_include_to_node(node, corrector)\n if node.class_type? || node.module_type?\n # indent the include statement\n corrector.insert_after(class_logger_pos(node),\n logger_include_code(node.loc.keyword.column))\n else\n # otherwise put it at the top\n corrector.insert_before(node.loc.expression, logger_include_code)\n end\n end",
"def module_include(base, mod)\n old_methods = {}\n\n mod.instance_methods.each do |sym|\n old_methods[sym] = base.instance_method(sym) if base.method_defined?(sym)\n end\n\n unless UNBOUND_METHODS_BIND_TO_ANY_OBJECT\n base.send(:include, mod) unless base < mod\n end\n\n mod.instance_methods.each do |sym|\n method = mod.instance_method(sym)\n base.send(:define_method, sym, method)\n end\n\n yield\n ensure\n mod.instance_methods.each do |sym|\n base.send(:undef_method, sym) if base.method_defined?(sym)\n end\n old_methods.each do |sym, method|\n base.send(:define_method, sym, method)\n end\n end",
"def include(*args)\n args << {} unless Hash === args.last\n modules, options = args_and_options(*args)\n required_example_group = get_type_from_options(options)\n required_example_group = required_example_group.to_sym if required_example_group\n modules.each do |mod|\n ExampleGroupFactory.get(required_example_group).send(:include, mod)\n end\n end",
"def included(submodule)\n super\n submodule.instance_eval { extend Extension }\n submodule\n end",
"def extend_and_include( *modules, & block )\n \n return new_stack_frame( :extend_and_include, *modules, & block )\n \n end",
"def change_include_possible(include,user)\n\t\t\n \tend",
"def included(descendant)\n super\n descendant.extend ClassMethods\n end",
"def included(descendant)\n super\n descendant.extend ClassMethods\n end",
"def before_include_or_extend( *contexts, & block )\n\n return frame_definer.before_include_or_extend( *contexts, & block )\n\n end",
"def include_modules\n @mods = Devium::PageBuilder.new(page, details).parse_page_modules\n mods.map do |mod|\n extend Object.const_get(\"#{self.class}::#{mod}\")\n end\n end",
"def include_options\n { include: parsed_associations || [], methods: parsed_methods || [] }\n end",
"def includes(options)\n @includes = options\n end",
"def extend(*args)\n include_or_extend(:extend, *args)\n end",
"def modify_model_extension_include(objname, extname)\n passtarget = \"< ActiveRecord::Base\\n\"\n passinsert = \" include Extensions::#{extname}\\n\"\n passpath = \"app/models/#{objname}.rb\"\n insert_into_file passpath, passinsert, :after => passtarget\n end",
"def include(*files)\n @include += files.flatten\n self\n end",
"def included(host)\n host.instance_exec(@modules, @body) do |modules, body|\n include(*modules)\n define_method(:each, &body)\n end\n end",
"def process_include anElement\r\n self.transform_include anElement.content\r\n end",
"def new_include_cmd\n super(apt_site: apt_site.actor)\n end",
"def include!(container)\n container_modules = container.singleton_class.included_modules\n\n # If the container is an EventContainer and we can include it, then do that\n include_events(container) if container_modules.include?(Discordrb::EventContainer) && respond_to?(:include_events)\n\n if container_modules.include? Discordrb::Commands::CommandContainer\n include_commands(container)\n include_buckets(container)\n elsif !container_modules.include? Discordrb::EventContainer\n raise \"Could not include! this particular container - ancestors: #{container_modules}\"\n end\n end",
"def gen_extend(*objs)\n singleton_class.__gen_extend_or_include__(:gen_include_one, *objs)\n end",
"def set_Include(value)\n set_input(\"Include\", value)\n end",
"def set_Include(value)\n set_input(\"Include\", value)\n end",
"def set_Include(value)\n set_input(\"Include\", value)\n end",
"def include_and_extend( *modules, & block )\n \n return new_stack_frame( :include_and_extend, *modules, & block )\n \n end"
] | [
"0.77406377",
"0.76823545",
"0.76145893",
"0.76145893",
"0.75136584",
"0.748567",
"0.748567",
"0.7480797",
"0.73424315",
"0.7187626",
"0.71865445",
"0.7132548",
"0.70626134",
"0.70600283",
"0.70591635",
"0.70266175",
"0.70034164",
"0.69935614",
"0.69613117",
"0.6959581",
"0.69528973",
"0.6910953",
"0.6907581",
"0.68978995",
"0.68978995",
"0.6866151",
"0.6860872",
"0.67689425",
"0.67412186",
"0.6707444",
"0.66866744",
"0.66864103",
"0.6671895",
"0.66425395",
"0.66391337",
"0.6633369",
"0.6618432",
"0.6594835",
"0.6581598",
"0.6558833",
"0.6558833",
"0.6549184",
"0.654671",
"0.6540255",
"0.6540255",
"0.653315",
"0.653315",
"0.64958173",
"0.6492342",
"0.6477773",
"0.6476423",
"0.64512384",
"0.644948",
"0.64431244",
"0.64364904",
"0.6434719",
"0.6418172",
"0.6416661",
"0.6415248",
"0.6415248",
"0.6403299",
"0.6400293",
"0.63801634",
"0.6374761",
"0.6369827",
"0.63667",
"0.6329623",
"0.6310158",
"0.6283698",
"0.6272068",
"0.62699604",
"0.62687194",
"0.625634",
"0.62476647",
"0.62476647",
"0.6232322",
"0.62304276",
"0.62289965",
"0.6222729",
"0.62224036",
"0.6212031",
"0.6209397",
"0.619729",
"0.619729",
"0.6197106",
"0.6186688",
"0.6165958",
"0.6153048",
"0.61507034",
"0.61412764",
"0.61291784",
"0.6124469",
"0.61148137",
"0.6091522",
"0.60805374",
"0.6079924",
"0.6068663",
"0.6068663",
"0.6068663",
"0.6067172"
] | 0.782343 | 0 |
append_features Override Module.included so that modules extending Module can define append_features. | def append_features( hooked_instance )
original_append_features( hooked_instance )
super if defined?( super )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_features(mod)\n im = Rubinius::IncludedModule.new(self)\n im.attach_to mod\n end",
"def append_features(other)\n if other.__check_include(self)\n other.__include_module(self)\n end\n self\n end",
"def append_features(mod) end",
"def include(mod)\n mod.append_features(self)\n Rubinius.privately do\n mod.included self\n end\n self\n end",
"def append_features(other)\n hierarchy = other.ancestors\n\n superclass_chain.reverse_each do |ancestor|\n if ancestor.instance_of? IncludedModule and not hierarchy.include? ancestor.module\n IncludedModule.new(ancestor.module).attach_to other\n end\n end\n\n IncludedModule.new(self).attach_to other\n end",
"def included(object)\n super\n\n Flaggable.setup_flaggable_object(object)\n\n # Add the feature check methods to the object's internal feature class.\n #\n object.instance_feature_class.internal_feature_checks_module.include internal_feature_checks_module\n\n # Because we added feature check methods above, include again to make them available.\n #\n object.instance_feature_class.include object.instance_feature_class.internal_feature_checks_module\n\n # Add the feature methods to the object's internal feature class.\n #\n object.instance_feature_class.internal_feature_module.include internal_feature_module\n\n # Add our feature flags to the object's feature flags.\n #\n object.instance_feature_class.feature_flags.concat(feature_flags)\n end",
"def include(*modules)\n modules.reverse_each do |mod|\n if !mod.kind_of?(Module) or mod.kind_of?(Class)\n raise TypeError, \"wrong argument type #{mod.class} (expected Module)\"\n end\n\n Rubinius.privately do\n mod.append_features self\n end\n\n Rubinius.privately do\n mod.included self\n end\n end\n self\n end",
"def include(*modules)\n modules.reverse_each do |mod|\n if !mod.kind_of?(Module) or mod.kind_of?(Class)\n raise TypeError, \"wrong argument type #{mod.class} (expected Module)\"\n end\n\n Rubinius.privately do\n mod.append_features self\n end\n\n Rubinius.privately do\n mod.included self\n end\n end\n self\n end",
"def included_modules() end",
"def append_features(base)\n puts \"#{base} is appended with new features\"\n end",
"def extended(object)\n super\n\n case object\n when Class\n raise RuntimeError, \"extending classes with feature flags is not currently supported\"\n when Module\n Flaggable.setup_flaggable_object(object)\n\n # Add the feature check methods to the module that was extended.\n #\n object.internal_feature_checks_module.include internal_feature_checks_module\n\n # Because we added feature check methods above, extend again to make them available.\n #\n object.extend internal_feature_checks_module\n\n # Add the feature methods to the module's internal feature module.\n #\n object.internal_feature_module.include internal_feature_module\n\n # Add our feature flags to the object's feature flags.\n #\n object.feature_flags.concat(feature_flags)\n end\n end",
"def add_includes out, includes\n add_extension_modules out, 'Includes', includes\n end",
"def add_feature\n $LOADED_FEATURES << @feature\n end",
"def included(mod); end",
"def include( *modules )\n \n super if defined?( super )\n original_include( *modules )\n \n end",
"def add_include include\n add_to @includes, include\n\n include\n end",
"def feature_module\n unless defined?(@feature_module)\n @features ||= {}\n @feature_module = ::Module.new\n const_set(\"FeatureModule\", @feature_module)\n features = @features\n # Create a feature? method that can be passed a feature name and\n # determine if the feature is present.\n @feature_module.send(:define_method, :feature?) do |name|\n method = name.to_s + \"?\"\n return !!(respond_to?(method) and send(method))\n end\n\n # Create a method that will list all functional features.\n @feature_module.send(:define_method, :features) do\n return false unless defined?(features)\n features.keys.find_all { |n| feature?(n) }.sort { |a,b|\n a.to_s <=> b.to_s\n }\n end\n\n # Create a method that will determine if a provided list of\n # features are satisfied by the curred provider.\n @feature_module.send(:define_method, :satisfies?) do |*needed|\n ret = true\n needed.flatten.each do |feature|\n unless feature?(feature)\n ret = false\n break\n end\n end\n ret\n end\n\n # Create a boolean method for each feature so you can test them\n # individually as you might need.\n @features.each do |name, feature|\n method = name.to_s + \"?\"\n @feature_module.send(:define_method, method) do\n (is_a?(Class) ? declared_feature?(name) : self.class.declared_feature?(name)) or feature.available?(self)\n end\n end\n\n # Allow the provider to declare that it has a given feature.\n @feature_module.send(:define_method, :has_features) do |*names|\n @declared_features ||= []\n names.each do |name|\n @declared_features << name.intern\n end\n end\n # Aaah, grammatical correctness\n @feature_module.send(:alias_method, :has_feature, :has_features)\n end\n @feature_module\n end",
"def append_features(context) # :nodoc:\n context.class_eval do\n context_methods = context.instance_methods(false)\n Helpers.public_instance_methods.each do |method|\n remove_method(method) if context_methods.include?(method)\n end\n end\n\n super(context)\n end",
"def included_modules; end",
"def add_loaded_features(loaded_features); end",
"def add_included_hook\n with_hook_context do |context, builder|\n mod.define_singleton_method :included do |object|\n super(object)\n Builder.pending << object unless context.finalize?\n builder.core_extensions.each { |mod| object.extend(mod) }\n builder.core_inclusions.each { |mod| object.send(:include, mod) }\n object.send(:include, Model::Constructor) if context.constructor?\n object.send(:include, Model::MassAssignment) if context.mass_assignment?\n object.define_singleton_method(:attribute, context.attribute_method)\n end\n end\n end",
"def included(base)\n base.extend(ClassMethods)\n base.extend(ModuleMethods) unless base.is_a?(Class)\n end",
"def load_features\n unless $LOADED_FEATURES == @loaded_features\n new_features = $LOADED_FEATURES - @loaded_features\n new_features.each do |feature|\n @proxy.proxy Kernel, :require, feature\n @loaded_features << feature\n end\n #@loaded_features += new_features\n end\n end",
"def include(mod)\n mod.included(self)\n end",
"def add_feature\n name = @feature.suffix?(\".rbc\") ? @feature[0..-2] : @feature\n $LOADED_FEATURES << name\n end",
"def include(mod,*more) end",
"def add_included_hook\n attribute_proc = attribute_method(configuration)\n constructor = configuration.constructor\n mass_assignment = configuration.mass_assignment\n extensions = core_extensions\n inclusions = core_inclusions\n\n self.module.define_singleton_method :included do |object|\n super(object)\n extensions.each { |mod| object.extend(mod) }\n inclusions.each { |mod| object.send(:include, mod) }\n object.send(:include, Model::Constructor) if constructor\n object.send(:include, Model::MassAssignment) if mass_assignment\n object.send(:define_singleton_method, :attribute, attribute_proc)\n end\n end",
"def included(othermod) end",
"def add_include(include)\n add_to @includes, include\n end",
"def included_modules\n end",
"def before_include_or_extend( *contexts, & block )\n\n return frame_definer.before_include_or_extend( *contexts, & block )\n\n end",
"def extend(mod)\n @modules << mod\n super(mod)\n end",
"def included(submodule)\n super\n submodule.instance_eval { extend Extension }\n submodule\n end",
"def extend(module1, *smth)\n IncludeWithRespect.extend_with_respect(self, module1, *smth)\n end",
"def extended_modules; end",
"def included(a_module)\n end",
"def include_extensions\n @included_extensions ||= include_extensions!\n end",
"def before_include_or_extend( & block )\n \n add_hook_context( :before_include )\n add_hook_context( :before_extend )\n action( & block ) if block_given?\n \n return self\n \n end",
"def before_features(_features)\n raise NotImplementedError.new \\\n \"#{self.class.name}#before_features must be implemented in subclass.\"\n end",
"def add_include(include)\n @includes << include\n end",
"def included( mod )\n\t\tsuper\n\t\tself.log.debug \"Including %d components in %p\" % [ self.components.length, mod ]\n\t\tself.components.each do |component_type, args|\n\t\t\tself.log.debug \"Adding %p to %p from %p\" % [ component_type, mod, self ]\n\t\t\tmod.add( component_type, *args )\n\t\tend\n\tend",
"def included; end",
"def __included(base, mod, tag = nil)\n __trace { \"... including #{tag || mod.try(:name) || mod} in #{base}\" }\nend",
"def extend_and_include( *modules, & block )\n \n return new_stack_frame( :extend_and_include, *modules, & block )\n \n end",
"def mark_includes_modules\n check_definition_state\n @includes_modules = true\n self\n end",
"def start_features(_features)\n raise NotImplementedError.new \\\n \"#{self.class.name}#before_features must be implemented in subclass.\"\n end",
"def included(base)\n super(base)\n base.extend(ClassMethods)\n base.extend(ClassScope)\n end",
"def included(base)\n install_configure_in(base)\n base.class_eval do\n extend ClassMethods\n end\n end",
"def before_include( *contexts, & block )\n \n return frame_definer.before_include( *contexts, & block )\n \n end",
"def extend(*args)\n include_or_extend(:extend, *args)\n end",
"def consul_features_module\n name = :ConsulFeatures\n # Each controller class should get its own FeatureModule, even when\n # we already inherit one from our parent.\n if const_defined?(name, (_search_ancestors = false))\n const_get(name, _search_ancestors = false)\n else\n mod = Module.new\n const_set(name, mod)\n include(mod)\n mod\n end\n end",
"def include_and_extend( *modules, & block )\n \n return new_stack_frame( :include_and_extend, *modules, & block )\n \n end",
"def include(*args)\n include_or_extend(:include, *args)\n end",
"def prepended_modules; end",
"def include(mod, opts = {})\n inclusions << Inclusion.new(mod, opts)\n end",
"def extended( instance )\n \n super if defined?( super )\n \n configuration_modules.each { |this_member| instance.extend( this_member ) }\n \n end",
"def include; end",
"def include; end",
"def included(submodule)\n super\n submodule.instance_eval { extend Mixin }\n submodule\n end",
"def include_above(mod1, mod) end",
"def do_includes\n @body.scan(/rb_include_module\\s*\\(\\s*(\\w+?),\\s*(\\w+?)\\s*\\)/) do |c,m|\n if cls = @classes[c]\n m = @known_classes[m] || m\n cls.add_include(Include.new(m, \"\"))\n end\n end\n end",
"def include_modules\n @mods = Devium::PageBuilder.new(page, details).parse_page_modules\n mods.map do |mod|\n extend Object.const_get(\"#{self.class}::#{mod}\")\n end\n end",
"def before_include( *contexts, & block )\n \n add_execution_context( *contexts )\n add_hook_context( :before_include )\n action( & block ) if block_given?\n \n return self\n \n end",
"def included( hooked_instance )\n \n super if defined?( super )\n \n end",
"def enable_features(feature_names)\n self.enabled_features = feature_names\n end",
"def redo_include_and_extend\n reinclude + reextend\n end",
"def after_include_or_extend( & block )\n\n add_hook_context( :after_include )\n add_hook_context( :after_extend )\n action( & block ) if block_given?\n \n return self\n\n end",
"def include_new_module(module_name, &content)\n include Named::Module.new(module_name, &content)\n end",
"def including_modules\n if block_given?\n ::Module.instances do |m|\n yield m if m.included_modules.include? self\n end\n else\n enum_for :including_modules\n end\n end",
"def on_include(&block)\n self.inclusion = block\n self\n end",
"def after_include_or_extend( *contexts, & block )\n\n return frame_definer.after_include_or_extend( *contexts, & block )\n\n end",
"def include_helpers(scope); end",
"def extended(a_module)\n end",
"def included(base)\n [\n Celluloid,\n Celluloid::IO,\n CelluloidPubsub::Helper,\n config['logger_class']\n ].each do |module_name|\n base.send(:include, module_name)\n end\n end",
"def before_extend( *contexts, & block )\n \n return frame_definer.before_extend( *contexts, & block )\n \n end",
"def include_strategy\n :includes\n end",
"def included(klass); end",
"def included(klass); end",
"def include inc\n @includes << inc\n end",
"def helpers_including_recipes(included_recipes)\n @known_helpers_including_recipes.merge!(included_recipes)\n end",
"def included(base)\n base.send :include, self::InstanceMethods\n end",
"def include?(feature)\n # Assume backported features are Ruby libraries (i.e. not C)\n $LOADED_FEATURES.include?(\"#{File.basename(feature, '.rb')}.rb\")\n end",
"def include?(feature)\n # Assume backported features are Ruby libraries (i.e. not C)\n $LOADED_FEATURES.include?(\"#{File.basename(feature, '.rb')}.rb\")\n end",
"def when_included(&block)\n @cautious_included_block = block\n end",
"def includes_modules?\n @includes_modules\n end",
"def include_at_top(mod) end",
"def collect_loaded_features\n @loaded_features = []\n $LOADED_FEATURES.each {|file|\n $LOAD_PATH.each {|dir|\n file_path = File.join(dir, file)\n if File.identical?(file_path, @me)\n next\n end\n if File.file?(file_path)\n @loaded_features << file_path\n next\n end\n }\n }\n end",
"def module_include(base, mod)\n old_methods = {}\n\n mod.instance_methods.each do |sym|\n old_methods[sym] = base.instance_method(sym) if base.method_defined?(sym)\n end\n\n unless UNBOUND_METHODS_BIND_TO_ANY_OBJECT\n base.send(:include, mod) unless base < mod\n end\n\n mod.instance_methods.each do |sym|\n method = mod.instance_method(sym)\n base.send(:define_method, sym, method)\n end\n\n yield\n ensure\n mod.instance_methods.each do |sym|\n base.send(:undef_method, sym) if base.method_defined?(sym)\n end\n old_methods.each do |sym, method|\n base.send(:define_method, sym, method)\n end\n end",
"def included?\n @_included\n end",
"def feature_setup\n raise NotImplementedError\n end",
"def after_features(_features)\n raise NotImplementedError.new \\\n \"#{self.class.name}#after_features must be implemented in subclass.\"\n end",
"def include( *modules, & block )\n\n new_stack_frame( :include, *modules, & block )\n \n return self\n \n end",
"def extension_strategy\n mixin? ? '@include ' : '@extend %'\n end",
"def included(descendant)\n super\n descendant.extend ClassMethods\n end",
"def included(descendant)\n super\n descendant.extend ClassMethods\n end",
"def add_hook_context( context )\n\n case context\n when :before_include, :before_extend, :after_include, :after_extend\n case @cluster.instance\n when ::Class\n unless @cluster.instance <= ::Module\n raise ::RuntimeError, 'Include/Extend execution hooks cannot be created for classes.'\n end\n end\n when :subclass\n case @cluster.instance\n when ::Class\n when ::Module\n raise ::RuntimeError, 'Subclass execution hooks cannot be created for modules.'\n end\n end\n \n @hook_contexts[ context ] = true\n \n return self\n \n end",
"def after_include( *contexts, & block )\n\n add_execution_context( *contexts )\n add_hook_context( :after_include )\n action( & block ) if block_given?\n \n return self\n\n end",
"def included(model_class)\n names = @attribute_names\n method_name_regex = /\\A(#{names.join('|'.freeze)})_([a-z]{2}(_[a-z]{2})?)(=?|\\??)\\z/.freeze\n has_attribute = Module.new do\n define_method :has_attribute? do |attr_name|\n super(attr_name) || !!method_name_regex.match(attr_name)\n end\n end\n model_class.extend has_attribute\n end",
"def include(mod)\n Dsl::Controller.include(mod)\n Dsl::Edge.include(mod)\n end",
"def __included(base, concern)\n $stderr.puts \"... including #{concern} in #{base}\"\n end"
] | [
"0.81698424",
"0.7929921",
"0.7605099",
"0.7407746",
"0.7233596",
"0.71166867",
"0.70085",
"0.70085",
"0.6687014",
"0.65890837",
"0.6556314",
"0.65128714",
"0.65041614",
"0.6499552",
"0.648103",
"0.6465637",
"0.6458739",
"0.6426297",
"0.6415078",
"0.6394641",
"0.63808316",
"0.63557863",
"0.6342746",
"0.63188696",
"0.63020545",
"0.62907535",
"0.62641",
"0.6257504",
"0.6247524",
"0.6245957",
"0.6243368",
"0.622253",
"0.6194601",
"0.6140888",
"0.6139311",
"0.6103094",
"0.6097594",
"0.609057",
"0.6090482",
"0.6080166",
"0.60623443",
"0.60538805",
"0.6051821",
"0.60329366",
"0.6008562",
"0.5988322",
"0.5976023",
"0.5959337",
"0.59543866",
"0.5952548",
"0.5950971",
"0.5947117",
"0.5939272",
"0.59231716",
"0.5910416",
"0.5899385",
"0.58259106",
"0.58259106",
"0.5824792",
"0.5821249",
"0.5820442",
"0.5802935",
"0.5751809",
"0.5731722",
"0.57043606",
"0.56943464",
"0.5690352",
"0.5664427",
"0.5660895",
"0.56406426",
"0.56334144",
"0.56167156",
"0.5598852",
"0.55981296",
"0.55940235",
"0.5581172",
"0.55741423",
"0.55741423",
"0.55665714",
"0.5562134",
"0.55577797",
"0.55558026",
"0.55558026",
"0.55492246",
"0.55351156",
"0.55349773",
"0.5529348",
"0.55160505",
"0.5514022",
"0.55117077",
"0.551102",
"0.5503664",
"0.55027074",
"0.5499897",
"0.5499897",
"0.5477379",
"0.5477005",
"0.54743755",
"0.54717964",
"0.5470168"
] | 0.67549074 | 8 |
included Override Module.included so that modules extending Module can define included. | def included( hooked_instance )
super if defined?( super )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def included(mod); end",
"def included(a_module)\n end",
"def include(mod)\n mod.included(self)\n end",
"def included(othermod) end",
"def included_modules() end",
"def included; end",
"def included_modules; end",
"def included_modules\n end",
"def included?\n @_included\n end",
"def include( *modules )\n \n super if defined?( super )\n original_include( *modules )\n \n end",
"def included\n @included.uniq! if @included.respond_to?(:uniq!)\n @included\n end",
"def included_in\n @included_in ||= []\n end",
"def included(base)\n base.extend(ClassMethods)\n base.extend(ModuleMethods) unless base.is_a?(Class)\n end",
"def __included(base, mod, tag = nil)\n __trace { \"... including #{tag || mod.try(:name) || mod} in #{base}\" }\nend",
"def when_included(&block)\n @cautious_included_block = block\n end",
"def being_included?\n @being_included || false\n end",
"def included(klass); end",
"def included(klass); end",
"def include; end",
"def include; end",
"def included(base)\n base.send :include, self::InstanceMethods\n end",
"def included( mod )\n\t\tsuper\n\t\tself.log.debug \"Including %d components in %p\" % [ self.components.length, mod ]\n\t\tself.components.each do |component_type, args|\n\t\t\tself.log.debug \"Adding %p to %p from %p\" % [ component_type, mod, self ]\n\t\t\tmod.add( component_type, *args )\n\t\tend\n\tend",
"def including_modules\n if block_given?\n ::Module.instances do |m|\n yield m if m.included_modules.include? self\n end\n else\n enum_for :including_modules\n end\n end",
"def __included(base, concern)\n $stderr.puts \"... including #{concern} in #{base}\"\n end",
"def add_included_hook\n attribute_proc = attribute_method(configuration)\n constructor = configuration.constructor\n mass_assignment = configuration.mass_assignment\n extensions = core_extensions\n inclusions = core_inclusions\n\n self.module.define_singleton_method :included do |object|\n super(object)\n extensions.each { |mod| object.extend(mod) }\n inclusions.each { |mod| object.send(:include, mod) }\n object.send(:include, Model::Constructor) if constructor\n object.send(:include, Model::MassAssignment) if mass_assignment\n object.send(:define_singleton_method, :attribute, attribute_proc)\n end\n end",
"def add_included_hook\n with_hook_context do |context, builder|\n mod.define_singleton_method :included do |object|\n super(object)\n Builder.pending << object unless context.finalize?\n builder.core_extensions.each { |mod| object.extend(mod) }\n builder.core_inclusions.each { |mod| object.send(:include, mod) }\n object.send(:include, Model::Constructor) if context.constructor?\n object.send(:include, Model::MassAssignment) if context.mass_assignment?\n object.define_singleton_method(:attribute, context.attribute_method)\n end\n end\n end",
"def included(base)\n super(base)\n base.extend(ClassMethods)\n base.extend(ClassScope)\n end",
"def on_include(&block)\n self.inclusion = block\n self\n end",
"def include(mod)\n mod.append_features(self)\n Rubinius.privately do\n mod.included self\n end\n self\n end",
"def included(base = nil, &block)\n if base.nil?\n if instance_variable_defined?(:@_included_block)\n if @_included_block.source_location != block.source_location\n raise MultipleIncludedBlocks\n end\n else\n @_included_block = block\n end\n else\n super\n end\n end",
"def do_includes\n @body.scan(/rb_include_module\\s*\\(\\s*(\\w+?),\\s*(\\w+?)\\s*\\)/) do |c,m|\n if cls = @classes[c]\n m = @known_classes[m] || m\n cls.add_include(Include.new(m, \"\"))\n end\n end\n end",
"def add_include include\n add_to @includes, include\n\n include\n end",
"def included(base)\n install_configure_in(base)\n base.class_eval do\n extend ClassMethods\n end\n end",
"def included\n included_resource_models\n end",
"def included(host)\n host.instance_exec(@modules, @body) do |modules, body|\n include(*modules)\n define_method(:each, &body)\n end\n end",
"def included(submodule)\n super\n submodule.instance_eval { extend Extension }\n submodule\n end",
"def included(*args)\n quando_incluso *args\n end",
"def includes\n end",
"def includes\n end",
"def include(*args)\n include_or_extend(:include, *args)\n end",
"def before_include( *contexts, & block )\n \n return frame_definer.before_include( *contexts, & block )\n \n end",
"def included(base)\n [\n Celluloid,\n Celluloid::IO,\n CelluloidPubsub::Helper,\n config['logger_class']\n ].each do |module_name|\n base.send(:include, module_name)\n end\n end",
"def include_above(mod1, mod) end",
"def include(mod,*more) end",
"def include(arg)\n Object.module_eval \"include #{arg}\"\n end",
"def included_files; end",
"def include_strategy\n :includes\n end",
"def include(*args)\n include_private(*args)\n end",
"def add_includes out, includes\n add_extension_modules out, 'Includes', includes\n end",
"def included(submodule)\n super\n submodule.instance_eval { extend Mixin }\n submodule\n end",
"def include_extensions\n @included_extensions ||= include_extensions!\n end",
"def include_into(klass)\n unless klass.kind_of? Module\n raise TypeError, \"invalid argument class #{klass.class}, expected Module\"\n end\n\n # check other.frozen\n # taint other from self\n\n insert_at = klass\n mod = self\n changed = false\n\n while mod\n\n # Check for a cyclic include\n if mod == klass\n raise ArgumentError, \"cyclic include detected\"\n end\n\n # Try and detect check_mod in klass's heirarchy, and where.\n #\n # I (emp) tried to use Module#< here, but we need to also know\n # where in the heirarchy the module is to change the insertion point.\n # Since Module#< doesn't report that, we're going to just search directly.\n #\n superclass_seen = false\n add = true\n\n k = klass.direct_superclass\n while k\n if k.kind_of? Rubinius::IncludedModule\n # Oh, we found it.\n if k == mod\n # ok, if we're still within the directly included modules\n # of klass, then put future things after mod, not at the\n # beginning.\n insert_at = k unless superclass_seen\n add = false\n break\n end\n else\n superclass_seen = true\n end\n\n k = k.direct_superclass\n end\n\n if add\n if mod.kind_of? Rubinius::IncludedModule\n original_mod = mod.module\n else\n original_mod = mod\n end\n\n im = Rubinius::IncludedModule.new(original_mod).attach_to insert_at\n insert_at = im\n\n changed = true\n end\n\n mod = mod.direct_superclass\n end\n\n if changed\n method_table.each do |meth, obj, vis|\n Rubinius::VM.reset_method_cache meth\n end\n end\n\n return self\n end",
"def included(descendant)\n super\n descendant.extend ClassMethods\n end",
"def included(descendant)\n super\n descendant.extend ClassMethods\n end",
"def include inc\n @includes << inc\n end",
"def before_include( *contexts, & block )\n \n add_execution_context( *contexts )\n add_hook_context( :before_include )\n action( & block ) if block_given?\n \n return self\n \n end",
"def include(mod, opts = {})\n inclusions << Inclusion.new(mod, opts)\n end",
"def included\n return [] if directory.empty? || directory == '*'\n @included ||= process_globs(@raw_data['include'])\n end",
"def mark_includes_modules\n check_definition_state\n @includes_modules = true\n self\n end",
"def include(*others)\n IncludesTracker.reset!\n __orig_include(*others)\n end",
"def includes() return @includes end",
"def set_include_statement\n super\n end",
"def extend(module1, *smth)\n IncludeWithRespect.extend_with_respect(self, module1, *smth)\n end",
"def include?(arg)\n arg.is_a?(Module) ? !!included_modules.detect{ |m| m === arg } : store.include?(arg)\n end",
"def included(model_class); end",
"def includes\n includes = @spec['includes'].dup\n\n includes.concat(@error_action.includes) if error_check?\n\n includes\n end",
"def included_in_modules\n modules = []\n ObjectSpace.each_object(Module) { |k| modules << k if k.included_modules.include?(self) }\n\n modules.reverse.inject([]) do |unique_modules, klass|\n unique_modules << klass unless unique_modules.collect { |k| k.to_s }.include?(klass.to_s)\n unique_modules\n end\n end",
"def do_includes\n @content.scan(/rb_include_module\\s*\\(\\s*(\\w+?),\\s*(\\w+?)\\s*\\)/) do |c,m|\n next unless cls = @classes[c]\n m = @known_classes[m] || m\n\n comment = new_comment '', @top_level, :c\n incl = cls.add_include RDoc::Include.new(m, comment)\n incl.record_location @top_level\n end\n end",
"def included_methods\n included_modules.map(&:instance_methods).flatten\n end",
"def before_include_or_extend( *contexts, & block )\n\n return frame_definer.before_include_or_extend( *contexts, & block )\n\n end",
"def before_include_or_extend( & block )\n \n add_hook_context( :before_include )\n add_hook_context( :before_extend )\n action( & block ) if block_given?\n \n return self\n \n end",
"def included_sources\n return @included_sources\n end",
"def modulize_include(*mod_consts)\n mod_consts.each do |mod_const|\n modulize *(mod_const.instance_methods)\n include mod_const\n end\n end",
"def included(m)\n @_modular_saved && @_modular_saved.each do |meth, args, block, where|\n begin\n m.send(meth, *args, &block)\n rescue => ex\n ex.set_backtrace where\n ex.message << \" while applying methods from #{self}\"\n raise ex\n end\n end\n end",
"def owners_included; end",
"def add_include(include)\n add_to @includes, include\n end",
"def set_Included(value)\n set_input(\"Included\", value)\n end",
"def includes\n @spec['includes'].dup.concat(@type.includes)\n end",
"def include( *modules, & block )\n\n new_stack_frame( :include, *modules, & block )\n \n return self\n \n end",
"def include_modules\n @mods = Devium::PageBuilder.new(page, details).parse_page_modules\n mods.map do |mod|\n extend Object.const_get(\"#{self.class}::#{mod}\")\n end\n end",
"def included_in_class_callbacks(base)\n if base.is_a?(Class)\n included_modules.each { |m| m.try.included_in_class(base) }\n end\n end",
"def includes(*paths)\n self.included_files.concat(expand_globs(paths))\n end",
"def inclusions; end",
"def each_include # :yields: include\n @includes.each do |i| yield i end\n end",
"def each_include # :yields: include\n @includes.each do |i| yield i end\n end",
"def prepended_modules; end",
"def included\n included = @objects.try(:map) { |o| o.try(:included) }\n included.try(:flatten!)\n included.try(:compact!) || included\n end",
"def add_include(include)\n @includes << include\n end",
"def ==(other)\n if other.kind_of? IncludedModule\n super || other.module == @module\n else\n super || other == @module\n end\n end",
"def include(*modules)\n modules.reverse_each do |mod|\n if !mod.kind_of?(Module) or mod.kind_of?(Class)\n raise TypeError, \"wrong argument type #{mod.class} (expected Module)\"\n end\n\n Rubinius.privately do\n mod.append_features self\n end\n\n Rubinius.privately do\n mod.included self\n end\n end\n self\n end",
"def include(*modules)\n modules.reverse_each do |mod|\n if !mod.kind_of?(Module) or mod.kind_of?(Class)\n raise TypeError, \"wrong argument type #{mod.class} (expected Module)\"\n end\n\n Rubinius.privately do\n mod.append_features self\n end\n\n Rubinius.privately do\n mod.included self\n end\n end\n self\n end",
"def included_constants; end",
"def include_at_top(mod) end",
"def included(base)\n base.instance_variable_get(:@dsl).deep_merge!(@dsl)\n end",
"def included(base)\n base.instance_variable_get(:@dsl).deep_merge!(@dsl)\n end",
"def include_helpers(scope); end",
"def include!(container)\n container_modules = container.singleton_class.included_modules\n\n # If the container is an EventContainer and we can include it, then do that\n include_events(container) if container_modules.include?(Discordrb::EventContainer) && respond_to?(:include_events)\n\n if container_modules.include? Discordrb::Commands::CommandContainer\n include_commands(container)\n include_buckets(container)\n elsif !container_modules.include? Discordrb::EventContainer\n raise \"Could not include! this particular container - ancestors: #{container_modules}\"\n end\n end",
"def index\n @included_ins = IncludedIn.all\n end",
"def includes\n @spec['includes'].dup\n end",
"def includes_modules?\n @includes_modules\n end"
] | [
"0.774958",
"0.7700335",
"0.76510525",
"0.7555904",
"0.7514503",
"0.74625325",
"0.74324864",
"0.74024594",
"0.7292493",
"0.72560894",
"0.71499944",
"0.71231526",
"0.70918006",
"0.6882734",
"0.68352604",
"0.6823955",
"0.6736286",
"0.6736286",
"0.6706164",
"0.6706164",
"0.6681638",
"0.6681089",
"0.66528296",
"0.66406685",
"0.6638462",
"0.6582131",
"0.6562749",
"0.65617293",
"0.65407103",
"0.6527767",
"0.65203905",
"0.65196943",
"0.6490921",
"0.6487713",
"0.6471631",
"0.6467147",
"0.6460482",
"0.6442505",
"0.6442505",
"0.6431232",
"0.64272094",
"0.639181",
"0.637285",
"0.6359562",
"0.63555795",
"0.6343345",
"0.63390416",
"0.6326004",
"0.63242996",
"0.63188463",
"0.6311177",
"0.6261325",
"0.6238542",
"0.6238542",
"0.6230337",
"0.622794",
"0.6209695",
"0.6208461",
"0.6196078",
"0.61911863",
"0.61900145",
"0.6178651",
"0.61783355",
"0.61572015",
"0.6148391",
"0.6115363",
"0.6095243",
"0.6091614",
"0.6086696",
"0.6071491",
"0.6049175",
"0.6027528",
"0.601726",
"0.6000887",
"0.5998508",
"0.5986482",
"0.59837586",
"0.5954376",
"0.59335667",
"0.593063",
"0.59291196",
"0.58956504",
"0.5884974",
"0.58830076",
"0.58830076",
"0.58760536",
"0.58700544",
"0.5862179",
"0.5841577",
"0.58280265",
"0.58280265",
"0.58175004",
"0.5810144",
"0.5802986",
"0.5802986",
"0.57975525",
"0.57882345",
"0.5784033",
"0.57774204",
"0.5776014"
] | 0.651915 | 32 |
extend_object Override Module.extended so that modules extending Module can define extend_object. | def extend_object( hooked_instance )
original_extend_object( hooked_instance )
super if defined?( super )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extend_object(obj) end",
"def representer_module_for(object, *args)\n evaluate_option(:extend, object) # TODO: pass args? do we actually have args at the time this is called (compile-time)?\n end",
"def extended(object)\n super\n\n case object\n when Class\n raise RuntimeError, \"extending classes with feature flags is not currently supported\"\n when Module\n Flaggable.setup_flaggable_object(object)\n\n # Add the feature check methods to the module that was extended.\n #\n object.internal_feature_checks_module.include internal_feature_checks_module\n\n # Because we added feature check methods above, extend again to make them available.\n #\n object.extend internal_feature_checks_module\n\n # Add the feature methods to the module's internal feature module.\n #\n object.internal_feature_module.include internal_feature_module\n\n # Add our feature flags to the object's feature flags.\n #\n object.feature_flags.concat(feature_flags)\n end\n end",
"def extend_object obj\n mod = Module.new\n mod.send :include, Haml::Helpers\n render mod\n method = obj.is_a?(Module) ? :include : :extend\n obj.send method, mod\n end",
"def extended(a_module)\n end",
"def add_extend ext\n add_to @extends, ext\n\n ext\n end",
"def extend(mod)\n @modules << mod\n super(mod)\n end",
"def extended_modules; end",
"def extended( instance )\n \n super if defined?( super )\n \n configuration_modules.each { |this_member| instance.extend( this_member ) }\n \n end",
"def extend(*args)\n include_or_extend(:extend, *args)\n end",
"def add_extends out, extends\n add_extension_modules out, 'Extended by', extends\n end",
"def extended_by(mod)\n @expected_options[:extend] = mod\n self\n end",
"def extend(*rest) end",
"def write_object(object)\n extend_for(super)\n end",
"def extended(*) end",
"def extend( *modules, & block )\n\n new_stack_frame( :extend, *modules, & block )\n \n return self\n \n end",
"def included(submodule)\n super\n submodule.instance_eval { extend Extension }\n submodule\n end",
"def add(module_object)\n @additional_modules << module_object\n end",
"def each_extend # :yields: extend\n @extends.each do |e| yield e end\n end",
"def extended( hooked_instance )\n\n super if defined?( super )\n \n end",
"def extend(module1, *smth)\n IncludeWithRespect.extend_with_respect(self, module1, *smth)\n end",
"def dynamic_extend(m, lib)\n if m.library != lib\n message = \"dynamically extended module #{m.name} should be defined in the module #{lib.name}\"\n raise InvalidLibrary, message\n end\n dynamically_extended().push m\n end",
"def gen_extend(*objs)\n singleton_class.__gen_extend_or_include__(:gen_include_one, *objs)\n end",
"def register_module_function(object); end",
"def extend_item(field)\n item = super\n is_field_config?(item) ? extend_field(item) : item\n end",
"def link_include_object(obj); end",
"def link_include_object(obj); end",
"def extend( *modules )\n\t\tsuper\n\t\tmodules.each do |mod|\n\t\t\tmod.instance_method( :initialize ).bind( self ).call if\n\t\t\t\tmod.private_instance_methods.map( &:to_sym ).include?( :initialize )\n\t\tend\n\tend",
"def extension_of(extended_from, extended_by = Rails.application.class)\n # check & normalize arguments\n extended_from, extended_by = *[extended_from, extended_by].map do |mod|\n raise \"expected a Module, got #{mod.inspect}\" unless mod.is_a?(Module)\n\n if mod < Rails::Engine\n mod\n elsif mod.const_defined?('Engine') and (mod.const_get('Engine')) < Rails::Engine\n mod.const_get('Engine')\n else\n raise \"expected #{mod} to be a subclass of Rails::Engine or to have a namespace-child 'Engine' that is a subclass of Rails::Engine\"\n end\n end\n\n # get the path in the current engine\n path_in_engine = caller.first[/^#{Regexp.escape(extended_by.root.to_s)}\\/([^:]*)/, 1]\n\n # raise if not found\n unless path_in_engine\n raise \"cannot determine the path of the file you want to extend within your engine's root. Your path: #{caller.first[/^[^:]*/]}, Your engine's root: #{extended_by.root}\"\n end\n\n # load the file in the engine we are extending\n require_dependency (extended_from.root + path_in_engine).to_s\n end",
"def extended\n @extended ||= process_text(@raw_extended) if @raw_extended\n end",
"def extend_from_module base_name, *module_names, options\n raise ArgumentError, \"You must specify an options Hash as the last argument for #extend_from_module\" if !options.kind_of? Hash \n module_names.each do |name|\n extend_with get_constant(base_name, name), options\n end\n end",
"def extend_class(class_, module_)\n class_.class_eval do\n include module_\n extend module_.const_get(:ClassMethods) if module_.const_defined?(:ClassMethods, false)\n prepend module_.const_get(:PrependMethods) if module_.const_defined?(:PrependMethods, false)\n end\n end",
"def before_extend( *contexts, & block )\n \n return frame_definer.before_extend( *contexts, & block )\n \n end",
"def include_and_extend( *modules, & block )\n \n return new_stack_frame( :include_and_extend, *modules, & block )\n \n end",
"def before_extend( *contexts, & block )\n \n add_execution_context( *contexts )\n add_hook_context( :before_extend )\n action( & block ) if block_given?\n \n return self\n \n end",
"def extend_and_include( *modules, & block )\n \n return new_stack_frame( :extend_and_include, *modules, & block )\n \n end",
"def when_extended(&block)\n @cautious_extended_block = block\n end",
"def add_extension(mod, options = {})\n self.extend(mod)\n options = mod.send(:prepare_options, options || {}) if mod.respond_to?(:prepare_options)\n extension_options[mod] = options\n self\n end",
"def initialize(extensions = [], parent = nil)\n @extensions = [ OwnMethods ] + extensions\n @extensions.each do |ext|\n ext.send(:extend_object, self)\n end\n @parent = parent\n end",
"def module_include(base, mod)\n old_methods = {}\n\n mod.instance_methods.each do |sym|\n old_methods[sym] = base.instance_method(sym) if base.method_defined?(sym)\n end\n\n unless UNBOUND_METHODS_BIND_TO_ANY_OBJECT\n base.send(:include, mod) unless base < mod\n end\n\n mod.instance_methods.each do |sym|\n method = mod.instance_method(sym)\n base.send(:define_method, sym, method)\n end\n\n yield\n ensure\n mod.instance_methods.each do |sym|\n base.send(:undef_method, sym) if base.method_defined?(sym)\n end\n old_methods.each do |sym, method|\n base.send(:define_method, sym, method)\n end\n end",
"def extend_plugins(extends)\n extensions_matching(extends).each do |plugin|\n extend plugin\n end\n end",
"def extend(mod)\n @singleton_setter_added = true\n super\n end",
"def extend(mod)\n @singleton_setter_added = true\n super\n end",
"def generate_extra_objects(object)\n # if payload_key.pluralize == 'inventories'\n # object_aux = object.dup\n # object_aux['id'] = object_aux['product_id']\n # object_aux['active'] = true\n\n # save_pending_file(object_aux['id'], 'products', object_aux)\n # end\n end",
"def before_include_or_extend( & block )\n \n add_hook_context( :before_include )\n add_hook_context( :before_extend )\n action( & block ) if block_given?\n \n return self\n \n end",
"def method_missing(sym, *args)\n # Extend this object only when needed and immediately redefine\n # #method_missing so that the new version is used on all future calls.\n extensions.each {|e| extend(e) } if @extensions\n redefine_method_missing!\n __send__(sym, *args)\n end",
"def modify_model_extension_include(objname, extname)\n passtarget = \"< ActiveRecord::Base\\n\"\n passinsert = \" include Extensions::#{extname}\\n\"\n passpath = \"app/models/#{objname}.rb\"\n insert_into_file passpath, passinsert, :after => passtarget\n end",
"def helper(*helpers)\r\n helper_object.extend *helpers\r\n end",
"def magic_mixin(mod)\n # Add the passed module to the inherits_from class variable\n inherits_from = nil\n begin\n inherits_from = self.class_variable_get(\"@@inherits_from\")\n rescue NameError\n inherits_from ||= []\n end\n inherits_from << mod.to_sym\n self.class_variable_set(:@@inherits_from,inherits_from)\n \n # Do the actually class extension using class_exec\n self.class_exec do\n # Grab the module name from the last entry of inherits_from\n # class variable. This is done because class_exec doesn't\n # include the calling methods local variables.\n @@current_mod = @@inherits_from.last\n @@current_mod.to_s.classify.constantize.extend_class(self)\n end\n end",
"def after_include_or_extend( & block )\n\n add_hook_context( :after_include )\n add_hook_context( :after_extend )\n action( & block ) if block_given?\n \n return self\n\n end",
"def relation # :nodoc:\n modules = [\n ActiveSfdc::AggregateHandlers,\n ActiveSfdc::ProjectionNormalization,\n ActiveSfdc::CreateUpdateHooks,\n ActiveSfdc::StructuralCompatibility\n ]\n super.extending!(*modules)\n end",
"def attach(object, opts={})\n name = opts.delete(:as)\n group = opts.delete(:group)\n\n class_components[name] = object\n define_method_for_object(object, name, opts)\n\n define_method_for_group(group)\n add_to_group(name, group) if group\n end",
"def update_extends\n extends.reject! do |ext|\n mod = ext.module\n\n !(String === mod) && @store.modules_hash[mod.full_name].nil?\n end\n\n extends.uniq!\n end",
"def extend(mod)\n super\n class << self\n include(RobotDisabler.dup) unless defined?(mod::SELF) && mod::SELF == RobotDisabler\n end\n end",
"def add_included_hook\n with_hook_context do |context, builder|\n mod.define_singleton_method :included do |object|\n super(object)\n Builder.pending << object unless context.finalize?\n builder.core_extensions.each { |mod| object.extend(mod) }\n builder.core_inclusions.each { |mod| object.send(:include, mod) }\n object.send(:include, Model::Constructor) if context.constructor?\n object.send(:include, Model::MassAssignment) if context.mass_assignment?\n object.define_singleton_method(:attribute, context.attribute_method)\n end\n end\n end",
"def extended_with(hash)\n hash.__angry_hash_extension if hash.respond_to?(:__angry_hash_extension)\n end",
"def redo_include_and_extend\n reinclude + reextend\n end",
"def extended(*args)\n quando_esteso *args\n end",
"def included(object)\n super\n\n Flaggable.setup_flaggable_object(object)\n\n # Add the feature check methods to the object's internal feature class.\n #\n object.instance_feature_class.internal_feature_checks_module.include internal_feature_checks_module\n\n # Because we added feature check methods above, include again to make them available.\n #\n object.instance_feature_class.include object.instance_feature_class.internal_feature_checks_module\n\n # Add the feature methods to the object's internal feature class.\n #\n object.instance_feature_class.internal_feature_module.include internal_feature_module\n\n # Add our feature flags to the object's feature flags.\n #\n object.instance_feature_class.feature_flags.concat(feature_flags)\n end",
"def extension=(mod)\n mod = Module.new(&mod) if Proc === mod\n @extension = mod\n end",
"def each_extend(into, *names, &block)\n return if names.empty?\n into.extend(*each(*names, &block))\n end",
"def include_extensions\n @included_extensions ||= include_extensions!\n end",
"def after_extend( *contexts, & block )\n\n return frame_definer.after_extend( *contexts, & block )\n\n end",
"def extend_from(path)\n mod = import(path, caller(1..1).first)\n add_module_methods(mod, self.class)\n add_module_constants(mod, self)\n end",
"def extend_model(model, extension)\n @model_extensions ||= {}\n @model_extensions[model] ||= []\n @model_extensions[model] << extension\n end",
"def as_extended_json(**options)\n map do |item|\n item.as_extended_json(**options)\n end\n end",
"def init_ext()\n \n end",
"def extend_user(module_name, init_method = nil)\n @user_extensions << module_name\n @user_init_methods << init_method unless init_method.nil?\n end",
"def extends!(spec)\r\n @extended_spec.clear.push(spec)\r\n end",
"def included(submodule)\n super\n submodule.instance_eval { extend Mixin }\n submodule\n end",
"def extended(mod)\n mod.extend(RSpec::Matchers)\n end",
"def extension; end",
"def extension; end",
"def extension; end",
"def extension; end",
"def prepended_modules; end",
"def after_extend( *contexts, & block )\n\n add_execution_context( *contexts )\n add_hook_context( :after_extend )\n action( & block ) if block_given?\n \n return self\n\n end",
"def attachObject _obj, _args\n \"_obj attachObject _args;\" \n end",
"def extension?\n node.name == \"extend\"\n end",
"def helpers(*extensions, &block)\n instance_eval(&block) if block\n extend(*extensions) if extensions.any?\n end",
"def included(base)\n base.extend(ClassMethods)\n base.extend(ModuleMethods) unless base.is_a?(Class)\n end",
"def send_extend(target_cls, cls)\n target_cls.send(:extend, cls) if defined?(target_cls)\n end",
"def extension_modules\n local_extensions =\n class <<self\n included_modules-Object.included_modules\n end\n if local_extensions.size > 0\n local_extensions\n else\n [] # There weren't any; must be a literal node\n end\n end",
"def register(&block)\n extend Module.new(&block)\n end",
"def append_features(mod)\n im = Rubinius::IncludedModule.new(self)\n im.attach_to mod\n end",
"def included(othermod) end",
"def extension_strategy\n mixin? ? '@include ' : '@extend %'\n end",
"def extended_interfaces; end",
"def decorated_object_behavior\n #code\n end",
"def import(object)\n if proxy = deref(@ext2int, object)\n return proxy\n end\n cls = object.class\n while cls do\n if internal_class = @@extcls2intcls[cls]\n internal = internal_class.new(object)\n linkin(internal, object)\n return internal\n end\n cls = cls.superclass\n end\n internal = OpaqueJavaObject.new(object)\n linkin(internal, object)\n return internal\n end",
"def before_include_or_extend( *contexts, & block )\n\n return frame_definer.before_include_or_extend( *contexts, & block )\n\n end",
"def extend_options\n options.each do |option|\n klass = Post::Extension.const_get(option.camelize)\n self.extend klass\n end\n end",
"def extend_for_custom_fields(name)\n class_eval do\n field :\"#{name}_custom_fields_version\", type: ::Integer, default: 0\n\n embeds_many :\"#{name}_custom_fields\", class_name: dynamic_custom_field_class_name(name) # , cascade_callbacks: true # FIXME ?????\n\n accepts_nested_attributes_for :\"#{name}_custom_fields\", allow_destroy: true\n end\n\n class_eval <<-EOV, __FILE__, __LINE__ + 1\n after_initialize :refresh_#{name}_metadata\n before_update :bump_#{name}_custom_fields_version\n before_update :collect_#{name}_custom_fields_diff\n after_update :apply_#{name}_custom_fields_diff\n after_update :apply_#{name}_custom_fields_localize_diff\n\n def ordered_#{name}_custom_fields\n self.ordered_custom_fields('#{name}')\n end\n\n protected\n\n def refresh_#{name}_metadata\n self.refresh_metadata_with_custom_fields('#{name}')\n end\n\n def bump_#{name}_custom_fields_version\n self.bump_custom_fields_version('#{name}')\n end\n\n def collect_#{name}_custom_fields_diff\n self.collect_custom_fields_diff(:#{name}, self.#{name}_custom_fields)\n end\n\n def apply_#{name}_custom_fields_diff\n self.apply_custom_fields_diff(:#{name})\n end\n\n def apply_#{name}_custom_fields_localize_diff\n self.apply_custom_fields_localize_diff(:#{name})\n end\n\n EOV\n end",
"def extended_validator=(obj)\n @extended_validator = obj if obj.respond_to?(:validate)\n end",
"def callExtension _obj, _args\n \"_obj callExtension _args;\" \n end",
"def extended(submodule)\n super\n submodule.instance_eval { @__mtrack__ ||= State.new }\n submodule\n end",
"def include( *modules )\n \n super if defined?( super )\n original_include( *modules )\n \n end",
"def perform_extend(subtype)\n Domgen.error(\"#{container_kind} #{name} attempting to extend final #{container_kind} #{extends}\") if self.final?\n self.mark_subtypes_as_obsolete\n self.direct_subtypes << subtype\n end",
"def included(descendant)\n super\n descendant.extend ClassMethods\n end",
"def included(descendant)\n super\n descendant.extend ClassMethods\n end"
] | [
"0.8195318",
"0.7320905",
"0.7275163",
"0.7273842",
"0.72107977",
"0.69822526",
"0.6912915",
"0.68997276",
"0.680728",
"0.680653",
"0.6763356",
"0.6682619",
"0.6562188",
"0.6475795",
"0.64347625",
"0.63667876",
"0.6320993",
"0.6162019",
"0.6150696",
"0.6064884",
"0.60126346",
"0.6012054",
"0.59799784",
"0.57499844",
"0.5676107",
"0.56722146",
"0.56722146",
"0.5668447",
"0.56646913",
"0.56396776",
"0.5610823",
"0.55876684",
"0.5586324",
"0.55852085",
"0.557875",
"0.55670714",
"0.5548527",
"0.5531472",
"0.5524142",
"0.5486837",
"0.54824966",
"0.5464581",
"0.5464581",
"0.5457127",
"0.5432807",
"0.5419909",
"0.5404459",
"0.5390908",
"0.53874296",
"0.53769356",
"0.53623754",
"0.5351622",
"0.53428674",
"0.53359056",
"0.532091",
"0.53016585",
"0.5297545",
"0.52890974",
"0.5275016",
"0.52497214",
"0.52390707",
"0.52368855",
"0.5221121",
"0.5217999",
"0.52072704",
"0.52022535",
"0.52001005",
"0.51981694",
"0.5196617",
"0.5195158",
"0.5180947",
"0.5166836",
"0.5166836",
"0.5166836",
"0.5166836",
"0.5159914",
"0.514859",
"0.51422745",
"0.51409197",
"0.5138012",
"0.5127111",
"0.5117037",
"0.5108604",
"0.51050735",
"0.51015455",
"0.5080707",
"0.5075564",
"0.5062614",
"0.5056664",
"0.50548697",
"0.5053543",
"0.50502104",
"0.5048079",
"0.5042338",
"0.49986365",
"0.49789822",
"0.49676102",
"0.49631935",
"0.49584958",
"0.49584958"
] | 0.7342474 | 1 |
extended Override Module.extended so that modules extending Module can define extended. | def extended( hooked_instance )
super if defined?( super )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extended_modules; end",
"def extended(a_module)\n end",
"def extend(mod)\n @modules << mod\n super(mod)\n end",
"def extended(*) end",
"def extended( instance )\n \n super if defined?( super )\n \n configuration_modules.each { |this_member| instance.extend( this_member ) }\n \n end",
"def extended_by(mod)\n @expected_options[:extend] = mod\n self\n end",
"def add_extend ext\n add_to @extends, ext\n\n ext\n end",
"def extend( *modules, & block )\n\n new_stack_frame( :extend, *modules, & block )\n \n return self\n \n end",
"def add_extends out, extends\n add_extension_modules out, 'Extended by', extends\n end",
"def extend(*args)\n include_or_extend(:extend, *args)\n end",
"def extend(*rest) end",
"def extended\n @extended ||= process_text(@raw_extended) if @raw_extended\n end",
"def included(submodule)\n super\n submodule.instance_eval { extend Extension }\n submodule\n end",
"def extended(object)\n super\n\n case object\n when Class\n raise RuntimeError, \"extending classes with feature flags is not currently supported\"\n when Module\n Flaggable.setup_flaggable_object(object)\n\n # Add the feature check methods to the module that was extended.\n #\n object.internal_feature_checks_module.include internal_feature_checks_module\n\n # Because we added feature check methods above, extend again to make them available.\n #\n object.extend internal_feature_checks_module\n\n # Add the feature methods to the module's internal feature module.\n #\n object.internal_feature_module.include internal_feature_module\n\n # Add our feature flags to the object's feature flags.\n #\n object.feature_flags.concat(feature_flags)\n end\n end",
"def extended(mod)\n mod.extend(RSpec::Matchers)\n end",
"def before_extend( *contexts, & block )\n \n return frame_definer.before_extend( *contexts, & block )\n \n end",
"def extend(module1, *smth)\n IncludeWithRespect.extend_with_respect(self, module1, *smth)\n end",
"def prepended_modules; end",
"def extend_and_include( *modules, & block )\n \n return new_stack_frame( :extend_and_include, *modules, & block )\n \n end",
"def extended(*args)\n quando_esteso *args\n end",
"def when_extended(&block)\n @cautious_extended_block = block\n end",
"def before_extend( *contexts, & block )\n \n add_execution_context( *contexts )\n add_hook_context( :before_extend )\n action( & block ) if block_given?\n \n return self\n \n end",
"def include_and_extend( *modules, & block )\n \n return new_stack_frame( :include_and_extend, *modules, & block )\n \n end",
"def extend_from_module base_name, *module_names, options\n raise ArgumentError, \"You must specify an options Hash as the last argument for #extend_from_module\" if !options.kind_of? Hash \n module_names.each do |name|\n extend_with get_constant(base_name, name), options\n end\n end",
"def representer_module_for(object, *args)\n evaluate_option(:extend, object) # TODO: pass args? do we actually have args at the time this is called (compile-time)?\n end",
"def each_extend # :yields: extend\n @extends.each do |e| yield e end\n end",
"def extend( *modules )\n\t\tsuper\n\t\tmodules.each do |mod|\n\t\t\tmod.instance_method( :initialize ).bind( self ).call if\n\t\t\t\tmod.private_instance_methods.map( &:to_sym ).include?( :initialize )\n\t\tend\n\tend",
"def extend(mod)\n super\n class << self\n include(RobotDisabler.dup) unless defined?(mod::SELF) && mod::SELF == RobotDisabler\n end\n end",
"def included_modules() end",
"def extension; end",
"def extension; end",
"def extension; end",
"def extension; end",
"def include_modules\n @mods = Devium::PageBuilder.new(page, details).parse_page_modules\n mods.map do |mod|\n extend Object.const_get(\"#{self.class}::#{mod}\")\n end\n end",
"def extension_of(extended_from, extended_by = Rails.application.class)\n # check & normalize arguments\n extended_from, extended_by = *[extended_from, extended_by].map do |mod|\n raise \"expected a Module, got #{mod.inspect}\" unless mod.is_a?(Module)\n\n if mod < Rails::Engine\n mod\n elsif mod.const_defined?('Engine') and (mod.const_get('Engine')) < Rails::Engine\n mod.const_get('Engine')\n else\n raise \"expected #{mod} to be a subclass of Rails::Engine or to have a namespace-child 'Engine' that is a subclass of Rails::Engine\"\n end\n end\n\n # get the path in the current engine\n path_in_engine = caller.first[/^#{Regexp.escape(extended_by.root.to_s)}\\/([^:]*)/, 1]\n\n # raise if not found\n unless path_in_engine\n raise \"cannot determine the path of the file you want to extend within your engine's root. Your path: #{caller.first[/^[^:]*/]}, Your engine's root: #{extended_by.root}\"\n end\n\n # load the file in the engine we are extending\n require_dependency (extended_from.root + path_in_engine).to_s\n end",
"def extend_object( hooked_instance )\n\n original_extend_object( hooked_instance )\n super if defined?( super )\n \n end",
"def add_extension(mod, options = {})\n self.extend(mod)\n options = mod.send(:prepare_options, options || {}) if mod.respond_to?(:prepare_options)\n extension_options[mod] = options\n self\n end",
"def dynamic_extend(m, lib)\n if m.library != lib\n message = \"dynamically extended module #{m.name} should be defined in the module #{lib.name}\"\n raise InvalidLibrary, message\n end\n dynamically_extended().push m\n end",
"def included(othermod) end",
"def relation # :nodoc:\n modules = [\n ActiveSfdc::AggregateHandlers,\n ActiveSfdc::ProjectionNormalization,\n ActiveSfdc::CreateUpdateHooks,\n ActiveSfdc::StructuralCompatibility\n ]\n super.extending!(*modules)\n end",
"def included_modules; end",
"def included(base)\n base.extend(ClassMethods)\n base.extend(ModuleMethods) unless base.is_a?(Class)\n end",
"def extensions; end",
"def extensions; end",
"def extensions; end",
"def extend(mod)\n @singleton_setter_added = true\n super\n end",
"def extend(mod)\n @singleton_setter_added = true\n super\n end",
"def extend_from(path)\n mod = import(path, caller(1..1).first)\n add_module_methods(mod, self.class)\n add_module_constants(mod, self)\n end",
"def extended_interfaces; end",
"def extension_modules\n local_extensions =\n class <<self\n included_modules-Object.included_modules\n end\n if local_extensions.size > 0\n local_extensions\n else\n [] # There weren't any; must be a literal node\n end\n end",
"def included_modules\n end",
"def before_include_or_extend( & block )\n \n add_hook_context( :before_include )\n add_hook_context( :before_extend )\n action( & block ) if block_given?\n \n return self\n \n end",
"def include_extensions\n @included_extensions ||= include_extensions!\n end",
"def update_extends\n extends.reject! do |ext|\n mod = ext.module\n\n !(String === mod) && @store.modules_hash[mod.full_name].nil?\n end\n\n extends.uniq!\n end",
"def extension=(mod)\n mod = Module.new(&mod) if Proc === mod\n @extension = mod\n end",
"def include(mod)\n mod.included(self)\n end",
"def included(mod); end",
"def after_extend( *contexts, & block )\n\n return frame_definer.after_extend( *contexts, & block )\n\n end",
"def append_features(mod)\n im = Rubinius::IncludedModule.new(self)\n im.attach_to mod\n end",
"def extra; end",
"def init_ext()\n \n end",
"def include( *modules )\n \n super if defined?( super )\n original_include( *modules )\n \n end",
"def extended(submodule)\n super\n submodule.instance_eval { @__mtrack__ ||= State.new }\n submodule\n end",
"def register(&block)\n extend Module.new(&block)\n end",
"def rygsaek_modules_hook!\n yield\n end",
"def modules; end",
"def modules; end",
"def modules; end",
"def enable_extension(name)\n end",
"def include_new_module(module_name, &content)\n include Named::Module.new(module_name, &content)\n end",
"def expanded; end",
"def ext; end",
"def ext; end",
"def included(base)\n super(base)\n base.extend(ClassMethods)\n base.extend(ClassScope)\n end",
"def method_missing(method, *args)\n add_module(method, *args)\n end",
"def before_include_or_extend( *contexts, & block )\n\n return frame_definer.before_include_or_extend( *contexts, & block )\n\n end",
"def extend_object(obj) end",
"def acts_as_msfte\n extend ClassMethods\n end",
"def after_extend( *contexts, & block )\n\n add_execution_context( *contexts )\n add_hook_context( :after_extend )\n action( & block ) if block_given?\n \n return self\n\n end",
"def enable_extension(name, **)\n end",
"def extend_item(field)\n item = super\n is_field_config?(item) ? extend_field(item) : item\n end",
"def after_include_or_extend( & block )\n\n add_hook_context( :after_include )\n add_hook_context( :after_extend )\n action( & block ) if block_given?\n \n return self\n\n end",
"def ext(*args, **_arg1, &block); end",
"def extension?\n node.name == \"extend\"\n end",
"def extension_strategy\n mixin? ? '@include ' : '@extend %'\n end",
"def __phi_extended_methods\n self.class.__phi_extend_methods.to_a\n end",
"def extension_methods\n @@extension_methods\n end",
"def extends!(spec)\r\n @extended_spec.clear.push(spec)\r\n end",
"def include(mod)\n mod.append_features(self)\n Rubinius.privately do\n mod.included self\n end\n self\n end",
"def extra; @extra; end",
"def interpret(mods)\n @_extensions ||= []\n [mods].flatten.compact.uniq.each { |mod|\n next if @_extensions.include?(mod)\n @_extensions << mod\n extend(mod)\n }\n self\n end",
"def dynamic_loadable_module\n super\n end",
"def extension_methods\n @@extension_methods\n end",
"def extend_plugins(extends)\n extensions_matching(extends).each do |plugin|\n extend plugin\n end\n end",
"def set_cycle_extended_support_fields(cycle)\n explode_date_or_boolean_field(cycle, 'extendedSupport', 'is_extended_support_over', 'extended_support_until', true)\n end",
"def get_module()\n raise NoMethodError, 'This method needs to be overridden'\n end",
"def interesting_methods\n em = extension_modules\n methods-[em.last ? em.last.methods : nil]-self.class.instance_methods\n end",
"def helpers(*extensions, &block)\n instance_eval(&block) if block\n extend(*extensions) if extensions.any?\n end",
"def extended_with(hash)\n hash.__angry_hash_extension if hash.respond_to?(:__angry_hash_extension)\n end",
"def extend_class(class_, module_)\n class_.class_eval do\n include module_\n extend module_.const_get(:ClassMethods) if module_.const_defined?(:ClassMethods, false)\n prepend module_.const_get(:PrependMethods) if module_.const_defined?(:PrependMethods, false)\n end\n end"
] | [
"0.8267796",
"0.811399",
"0.75415605",
"0.7526507",
"0.7282426",
"0.7185247",
"0.71126276",
"0.7076048",
"0.7071892",
"0.69632757",
"0.6788207",
"0.6709228",
"0.67009974",
"0.6562005",
"0.6377122",
"0.63437635",
"0.63381594",
"0.6266463",
"0.62174517",
"0.61916184",
"0.6179734",
"0.6175949",
"0.6170532",
"0.61551625",
"0.6112779",
"0.61033064",
"0.6064816",
"0.60606587",
"0.60411483",
"0.59994376",
"0.59994376",
"0.59994376",
"0.59994376",
"0.59796",
"0.5977665",
"0.5958301",
"0.59540826",
"0.5930522",
"0.59255743",
"0.5900547",
"0.58627826",
"0.58583224",
"0.58516556",
"0.58516556",
"0.58516556",
"0.5849745",
"0.5849745",
"0.5840894",
"0.5831164",
"0.5814168",
"0.5795889",
"0.5781716",
"0.5780155",
"0.57623893",
"0.5736597",
"0.5732593",
"0.5731576",
"0.57221687",
"0.5712539",
"0.5710522",
"0.57048476",
"0.5701278",
"0.5701175",
"0.569749",
"0.56974435",
"0.5681374",
"0.5681374",
"0.5681374",
"0.5676941",
"0.56695014",
"0.56549877",
"0.5654538",
"0.5654538",
"0.56539553",
"0.5628345",
"0.5622602",
"0.5602629",
"0.5592677",
"0.55807793",
"0.5579658",
"0.55752707",
"0.5568041",
"0.5556833",
"0.5549131",
"0.55312115",
"0.55173934",
"0.55153626",
"0.54992115",
"0.5497142",
"0.5487353",
"0.5485568",
"0.54769754",
"0.5476103",
"0.5471265",
"0.54666007",
"0.54520077",
"0.543276",
"0.54176164",
"0.5414402",
"0.54000884"
] | 0.646909 | 14 |
== INVENTORY METHOD ========================================= | def bind_items_to_survivors
InventoryItem.create(context[:items_attributes].map { |item|
{ survivor_id: context.survivor.id, item_id: item[:item_id], quantity: item[:quantity] }
})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop_inv(inv, size) \n\n items = Array.new;\n\n # Populate with size\n case size\n when :pocket\n @book = Item.new([\"book\", \"novel\"], \"1984\", \"An Orwellian Nightmare\")\n @pen = Item.new([\"pen\", \"biro\"], \"4-Pen\", \"A four pen with red, green, blue and black inks\")\n @phone = Item.new([\"phone\", \"cell\"], \"iPhone\", \"An iPhone 5\") \n items.push(@book, @pen, @phone)\n \n when :wallet\n @myki = Item.new([\"myki\", \"travelcard\"], \"Myki\", \"An consession myki card\")\n @idcard = Item.new([\"id\", \"card\"], \"ID card\", \"Swinny ID card\")\n @cash = Item.new([\"cash\", \"money\"], \"$20 banknote\", \"A 20 dollar banknote\") \n items.push(@myki, @idcard, @cash)\n end\n \n #put the items in\n items.each do |item|\n inv.put(item)\n end\nend",
"def build_inventory\n add_to_inventory(\"cats\", 4, 50.0)\n add_to_inventory(\"dogs\", 10, 150.0)\n add_to_inventory(\"unicorn\", 1, 1000.0)\nend",
"def GetAllItemsFromCart\n @@db.results_as_hash = true\n # fetch inventory items...\n return @@db.execute \"SELECT p.name ,i.price, b.item_id, b.quantity FROM \" +\n \" Basket b INNER JOIN Product p on p.item_id = b.item_id \" +\n \" INNER JOIN Inventory i on i.item_id = p.item_id \" +\n \" ORDER BY b.item_id asc\"\n #\" Basket b, Product p, Inventory i \" +\n #\" WHERE b.item_id = i.item_id AND i.item_id = p.item_id\"\n end",
"def loot\r\n\t@@item_number += 1\r\n\t$items = @@item_number\r\n\treturn\r\n\tend",
"def purchase_books(newbooks)\n\t\tnewbooks.each {|book, number| inventory[book] = number}\n\tend",
"def add_to_inventory(item)\n @items << item\n equip(item)\n items_weight\n end",
"def lets_go_shopping\r\n\r\n current_list = new_grocery_list\r\n add_new_item(current_list)\r\n remove_an_item(current_list)\r\n update_item_quantity(current_list)\r\n \r\n current_list.each do |key, value|\r\n puts \"Food: #{key}\"\r\n puts \"Qty: #{value}\" \r\n end\r\nend",
"def add_item(item_list, item, qty)\r\n item_list[item] = qty\r\n item_list\r\nend",
"def new_quantity(list, item, qty)\n list[item] += qty\n p list\nend",
"def inventory_array(older, newer)\n newer.each do |item|\n name, quantity = item\n older.reject! { |olditem| olditem[0] == name }\n older << item\n end\n\n older.sort { |item_a, item_b| item_a[0] <=> item_b[0] }\nend",
"def list_inventory\n\n # print the table header\n @gc.d_print(\"Inventory:\")\n\n # print each item with some indent\n @inventory.each do |object|\n @gc.display(\" > #{object.get_name}\")\n end\n\n # if there is nothing in the player's inventory, say so\n if @inventory.length == 0\n @gc.display(\" - Nothing\")\n end\n\n end",
"def fetch_inventory\n @offer[:records] ||= Item.where(survivor_id: @offer[:survivor_id]).to_a\n @for[:records] ||= Item.where(survivor_id: @for[:survivor_id]).to_a\n end",
"def add_item(inventory, item, quantity)\n\tinventory[item] = quantity\n\t@full_inventory = inventory\n\t#this is what updates your inventory with the new item & quantity.\nend",
"def add_item(list, item, quantity)\n #list = item.push\n list[item] = quantity.to_i\n list\nend",
"def avail_products\n @products.each_with_index do |product, index|\n print \"#{index + 1}. #{product[:product]} - \"\n puts \"$#{product[:price]}\"\n end\n puts \"----------------\"\n add_to_cart\nend",
"def avail_products\n @products.each_with_index do |product, index|\n print \"#{index + 1}. #{product[:product]} - \"\n puts \"$#{product[:price]}\"\n end\n puts \"----------------\"\n add_to_cart\nend",
"def inventory\n @game.state = BuyingState.new @game\n\n @game.state.handle\n end",
"def inventory\n\t\tputs \"Items: #{@player.getItemsName}\" \n\t\tputs \"Food: #{@player.getFoodName}\" \n\tend",
"def loot\r\n\t@@item_number += 1\r\n\tend",
"def print_inventory inventory\n\tinventory.each_with_index do |items, index|\n\tputs \"#{index+1}\" + \".\" + \"#{items[0]}\" + \"-\" + \"#{items[1]}\"\nend\nend",
"def update_qty(item_list, item, qty)\r\n item_list[item] = qty\r\n item_list\r\nend",
"def shared_inventory\n @weapons + @armors + items_to_obj\n end",
"def item_totals_for_inventories\n\t\tresult = []\n\t\tInventory.includes(:items).all.each do |i|\n\t\t\tentry = { :name => i.name, :data => { } }\n\t\t\ti.holdings.each { |h| entry[:data] = entry[:data].merge({ h.item.name => h.quantity }) }\n\t\t\tresult << entry\n\t\tend\n\t\tresult\n\tend",
"def inventory()\n\t\tInventory.new(@db, 'sgt-structure:' + @id + ':inv')\n\tend",
"def item_and_qty(list, item, qty)\n list[item] = qty\n list\nend",
"def items\n instance_item_display = []\n @instance_items.each do |entry|\n quantity = entry[2]\n item = entry[0]\n quantity.times{instance_item_display << item} \n end \n instance_item_display\nend",
"def consume_items(item_quantities)\n item_quantities.each do |ingredient_name, quantity|\n @ingredients[ingredient_name] = @ingredients[ingredient_name] - quantity\n end\n end",
"def initialize\n #each item has name and inventory number\n @inventory_list = {strawberry: 6, raspberry: 4, blueberry: 8}\n end",
"def inventory()\n\tputs \"Je hebt de volgende items:\"\n\tputs @inventory\nend",
"def inventorycheck(args)\n #find inventory item by id\n Inventory.find(args) do |item|\n arr = []\n #capture stock item qty into variable\n stock = item.qty\n #loop into each item and check the existing appointments per item\n item.clinic.surgery_appts.each do |recipe|\n #check the surgery recipe requirements per appointment\n #check ONLY the items that pertain the the supply list item that was declared above\n recipe.surgery_type.surgery_recipe_reqs.where(supply_list_id:args).each do |req|\n #store those recipe requirements into the array\n arr << req.qty\n end\n end\n #sum all the items in the array together\n arr = arr.sum\n p arr\n #subract the appointment totals from the Inventory stock qty\n stock = stock - arr\n #update the Inventory stock qty\n Inventory.find(args).update(qty:stock)\n end\nend",
"def put_item_in_inventory(input)\n\n if find_item_by_id(input).canBePickedUp\n unless @inventory.include?(input)\n @inventory << input\n slow_type(\"\\nYou have picked up the #{find_item_by_id(input).name}.\")\n end\n\n else\n slow_type(\"You cannot pick up this item\")\n end\n end",
"def new_qty(list, item, qty)\n list[item] = qty\n return list\nend",
"def update_quantity(list, item, qty)\n list[item] = qty\n list\nend",
"def inventory_to_s\n\t\tputs \"------------------inventory----------------\"\n\t\tinventory.each {|book, number| puts \"Remain #{number} for <#{book.title}>\"}\n\t\tputs \"-------------------------------------------\"\n\tend",
"def item_list_adder(list, items, quantity)\n list[items] = quantity\n list\nend",
"def print_inventory\n @inventory.each do |couple|\n puts couple.first.name + \" (#{couple.second})\"\n end\n print \"\\n\"\n end",
"def add_item(item, qty)\n for ele in @order do\n order_item = ele.keys[0]\n if order_item.name == item.name\n ele[order_item] += qty\n return \n end\n end\n @order.push({item => qty})\n \n end",
"def add_item(list, item, qty)\n list[item] = qty\n list\nend",
"def update_quantity (item,list, quantity)\n list[item] = quantity\nlist\nend",
"def add_item(grocery_list, item, qty)\n grocery_list[item] = qty \n grocery_list\nend",
"def inventory\n\tputs \"you have the following items: \"\n\tputs @inventory\nend",
"def change_quantity(list, item, qty)\n list[item] = qty\n list\nend",
"def withInventory\n\t\t@inventoryItems = Item.where(:inventory > 0)\n\tend",
"def change_inventory\n order_item_obj = OrderItem.last\n product_id = order_item_obj.product_id\n inventory_of_ordered_product = InventoryStock.where(product_id:product_id)\n quantity_in_inventory = inventory_of_ordered_product[0].quantity\n quantity_in_ordered_item = order_item_obj.quantity\n updated_quantity_in_inventory = quantity_in_inventory.to_i-quantity_in_ordered_item.to_i\n InventoryStock.where(product_id:product_id).update(quantity: updated_quantity_in_inventory)\n end",
"def current_list(grocery_list, item, qty)\n grocery_list[item] = qty\n grocery_list\nend",
"def sepitem_quantity(counts)\n puts 'item ---- quantity'\n counts.each do |key, value|\n puts \"#{key} : #{value}\"\n\n item=Item.new\n v=item.pick_line(key)\n total_with_disc=discount_bill(key,value,v)\n without_disc_bill(key,value,v,total_with_disc)\n end\n end",
"def quantity_by_item_id(hash)\n hash.each { |item_id, inv_items|\n hash[item_id] = sum(inv_items, :quantity)\n }; return hash\n end",
"def update_item_quantity(list, item, quantity)\n list[item] = quantity\n list\nend",
"def buy_fruit(list)\n list.each_with_object([]) do |fruit_info, shopping_list|\n fruit, quantity = fruit_info[0], fruit_info[1]\n quantity.times {shopping_list << fruit}\n end \nend",
"def add_item (list, item, qty)\n list[item]=qty\nend",
"def index_for_item(item)\n for x in INVENTORY\n if x.has_value?(item)\n return index = INVENTORY.index(x)\n end\n end\n return index\nend",
"def update_quantity(item, list, quantity)\n list[item] = quantity\n return list\nend",
"def add_item(list, item, qty)\n list[item] = qty\n p list\nend",
"def update_inventory\n response = LcboApiHelper.get_all \"inventories\", [\"product_id=#{number}\", \"where_not=is_dead\"]\n\n response.each do |inventory|\n lcbo_updated_on = inventory[\"updated_on\"].to_date\n next if Inventory.exists?(lcbo_updated_on: lcbo_updated_on, store_id: inventory['store_id'], product: self)\n Inventory.create(\n product: self,\n store_id: inventory['store_id'],\n quantity: inventory[\"quantity\"],\n lcbo_updated_on: lcbo_updated_on,\n lcbo_updated_at: Time.parse(inventory[\"updated_at\"]).getutc\n )\n end\n end",
"def update_quantity (grocery_list, item, quantity)\n if grocery_list[item] == nil\n \tputs \"Item not on list.\"\n else\n \tadd_item(grocery_list,item,quantity)\n end\n return grocery_list\n print_list(grocery_list)\nend",
"def total_inventory\n inventory = Hash.new(0)\n @vendors.each do |vendor|\n vendor.inventory.keys.each do |item|\n inventory[item] += vendor.inventory[item]\n end\n end\n inventory\n end",
"def inventory_data\n {}\n end",
"def inventory_data\n {}\n end",
"def add_to_inventory(price, description)\n\t\tself.items << Item.new(price, description)\n\tend",
"def update_quantity(list, item, quantity)\nlist[item] = quantity\nlist\nend",
"def update_qty!(list, item, qty)\r\n counter = 0\r\n if list.include?(item)\r\n list[item] = qty\r\n else\r\n puts \"Sorry, that item isn't in the list\"\r\n end\r\n list\r\nend",
"def make_item_list\n @data = equips_for_enchant\n end",
"def menu_1\n [{ name: :Durain, price: 1200, quantity: 10 },\n { name: :Escargot, price: 1500, quantity: 9 },\n { name: :Offle, price: 2000, quantity: 10 },\n { name: :Asparagus, price: 900, quantity: 15 },\n { name: :Birdsnest, price: 2500, quantity: 4 }]\nend",
"def update_quantity(list,item,quantity)\nlist[item]= quantity\n p list\nend",
"def add_to_list(item,quantity,list)\n list[item]=quantity\nend",
"def worthInventory\n total_worth = 0\n @@products.each_with_index { |p, i|\n prod_worth = (p.price * p.units)\n total_worth = total_worth + prod_worth\n\n puts \"#{i + 1} : #{p.name} - #{p.units} at INR Rs.#{p.price} each : INR Rs.#{prod_worth}\"\n }\n\n puts \"--\" * 20\n puts \"Total Inventory Worth : INR Rs.#{total_worth}\"\n puts \"--\" * 20\n end",
"def add_item!(list, item, qty=1)\r\n list[item] = qty\r\n list\r\nend",
"def buy_fruit(list)\n expanded_list = []\n\n list.each do |item|\n fruit, quantity = item[0], item[1]\n quantity.times { expanded_list << fruit }\n end\n\n expanded_list\nend",
"def add_item(grocery_list,item_name,quantity)\r\n\t \r\n\t grocery_list[item_name] = quantity\r\n\t \r\n\r\nend",
"def each(&block)\n @inventory.each(&block)\n end",
"def add_to_inventory(category, product, quantity, price, refid)\n @inventory = {\n category => [\n product: product,\n quantity: quantity,\n price: price,\n refid: refid\n ]\n}\nend",
"def sell(item, quantity)\n if total_inventory.has_key?(item) && quantity < total_inventory[item]\n @vendors.each do |vendor|\n if vendor.inventory.has_key?(item)\n if vendor.inventory[item] >= quantity\n vendor.inventory[item] -= quantity\n else\n vendor.inventory[item] -= quantity\n diff = vendor.inventory[item].abs\n vendor.inventory[item] = 0\n @vendors.each do |vendor|\n if vendor.inventory.has_key?(item)\n if vendor.inventory[item] != 0\n require \"pry\"\n binding.pry\n vendor.inventory[item] - diff\n end\n end\n end\n end\n end\n end\n return true\n else\n return false\n end\n end",
"def add_item(item, quantity, list)\r\n list[item] = quantity\r\n p list\r\n list\r\nend",
"def total_inventory\n list = Hash.new([])\n @food_trucks.each do |truck|\n truck.inventory.each do |item|\n list[item[0].name] = []\n end\n end\n list.each do |k, v|\n @food_trucks.each do |truck|\n truck.inventory.each do |item|\n if item[0].name == k\n list[k] << truck\n end\n end\n end\n end\n list\n end",
"def add_to_inventory(item)\n @inventory.push(item)\n update\n end",
"def update_quantity(list, item, quantity)\n list[item] = quantity\n p list\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 add_item(list,item_name, qty)\n list[item_name] = qty\nend",
"def add_item(item,quantity,list)\n\tlist[item] = quantity\nend",
"def inventory(card)\n unless current_user \n '0'\n else \n Card.last(scryfall_id: card['id'], user_id: current_user.id)\n end\n end",
"def updated_quantity(list, item_name, quantity)\r\n\tlist[item_name] = quantity\r\n\tlist\r\nend",
"def total_inventory\n totes_hash = {}\n vendors.each do |vendor|\n vendor.inventory.each do |item, quantity|\n if totes_hash[item].nil?\n totes_hash[item] = { quantity: quantity, vendors: [vendor] }\n else\n totes_hash[item][:quantity] += quantity\n totes_hash[item][:vendors] << vendor\n end\n end\n end\n totes_hash\n end",
"def add_item(item, grocery_bag, quantity = 1)\n grocery_bag[item] = quantity\n print grocery_bag\nend",
"def add_inventory(product_name, quantity)\n @products.each do |product|\n if product.name == product_name.upcase\n product.quantity += quantity\n end\n end\n end",
"def buyable_items(_entity)\n []\n end",
"def change_qty(list, item, qty)\n if list.has_key?(item) == false\n puts \"Item not found\"\n else\n qty.to_i\n list[item] = qty\n end\n list\nend",
"def inventory_without_hiting_the_database\n variants.inject(0) {|total, variant| total += variant.inventory}\n end",
"def adding_item(list,item,quantity = 1)\r\n# if quantity == nil\r\n# quantity = 1\r\n# end\r\n list[item] = quantity\r\n list\r\nend",
"def bay_for_item(item)\n for x in INVENTORY\n if x.has_value?(item)\n return key = x.key(item).to_s\n end\n end\n return key\nend",
"def inventory_screen\n setup_location if !@location_id || !@location_name\n clear_screen\n puts \"Inventory mode | #{@location_name} | #{@product_type} \"\n puts \"\"\n puts \"\"\n @items.each do |i|\n puts \"#{i.amount}\\t#{i.barcode}\\t#{i.name}\\t#{i.best_before_date}\\t#{i.price}\\t#{i.open_string}\"\n end\n puts \"\"\n puts \"Scan barcode (b for edit last best before, c for commit, l for locations, p for price, o open amount, r for remove last row, q for quantity of last, q! for quit)\"\n case input = gets.strip\n when \"\"\n when \"b\"\n @items.last.query_best_before unless @items.size == 0\n when \"c\"\n @items.each do |i|\n commit(i)\n end\n @items = []\n when \"l\"\n setup_location\n when \"m\"\n @items.last.query_price unless @items.size == 0\n when \"o\"\n @items.last.toggle_open unless @items.size == 0\n when \"r\"\n @items.pop\n when \"q\"\n @items.last.query_quantity unless @items.size == 0\n when \"q!\"\n exit\n else\n check(input)\n end\n end",
"def add(list, item, quantity)\r\n list[item] = quantity\r\n list\r\n\r\nend",
"def add_item(list, item, quantity)\n\n\tlist[item] = quantity\n\tlist\n\nend",
"def add_item(list, item, quantity)\n list[item] = quantity\n list\nend",
"def update_qty(item, item_qty, grocery_list)\n grocery_list[item] = item_qty\n # print_list(grocery_list)\n grocery_list\nend",
"def add_item(current_list, item_added, quantity)\n current_list[item_added] = quantity\n current_list\nend",
"def input (list, item, quantity)\n\tlist[item] = quantity\nend",
"def add_item(item, item_qty, grocery_list)\n grocery_list[item] = item_qty\n # print_list(grocery_list)\n grocery_list\nend",
"def show_store_inventory_item(locations,products,itemid)\n #Loop through Stores Location Id List\n puts \"====== STORE INVENTORY CHECK ===Id: #{itemid}=====\"\n ind = 0\n for locid in @location_list\n prod_list = locations[ind][1].product_list\n prod_list.each do | product_id, quantity |\n pquery = Utils::product_name_query(product_id,products)\n pname = pquery[0]\n price = pquery[1]\n if (itemid == product_id)\n puts \"Location: #{locid}, Product Id: #{product_id}, Product Name: #{pname}, Price: $#{price}, Quantity: #{quantity}\"\n end\n end\n ind += 1 #update index\n end #for\n end",
"def update_quantity(item, grocery_bag, quantity)\n grocery_bag[item] = quantity\n p grocery_bag\nend",
"def buy_fruit(list)\n quantities = []\n list.each { |item| item[1].times { quantities << item[0] } }\n quantities\nend"
] | [
"0.6821982",
"0.66276956",
"0.6320307",
"0.6313477",
"0.62878585",
"0.6253014",
"0.6206846",
"0.61971015",
"0.6187541",
"0.61797774",
"0.61649215",
"0.6138619",
"0.6130737",
"0.6110542",
"0.6107317",
"0.6107317",
"0.609714",
"0.60952634",
"0.6090643",
"0.6085588",
"0.6083163",
"0.6071914",
"0.6065641",
"0.6055171",
"0.60539985",
"0.6047427",
"0.6032286",
"0.603077",
"0.59983665",
"0.59950167",
"0.5987294",
"0.5984825",
"0.5982002",
"0.59717697",
"0.5965647",
"0.5963408",
"0.5960864",
"0.59538686",
"0.5952272",
"0.5934666",
"0.59290355",
"0.59277326",
"0.59259033",
"0.5916268",
"0.59062344",
"0.5895707",
"0.5881772",
"0.5876125",
"0.586612",
"0.58644086",
"0.5864004",
"0.58583397",
"0.585239",
"0.5851909",
"0.5850051",
"0.5848102",
"0.58475655",
"0.58475655",
"0.58418334",
"0.5841721",
"0.5839696",
"0.583954",
"0.58356744",
"0.5833865",
"0.5830374",
"0.58258945",
"0.58234733",
"0.5818588",
"0.58120275",
"0.5805249",
"0.5800386",
"0.5798007",
"0.57977855",
"0.57959074",
"0.57957435",
"0.57906675",
"0.57894313",
"0.57894313",
"0.5783919",
"0.57828546",
"0.57808924",
"0.57804936",
"0.5779483",
"0.57793105",
"0.5777445",
"0.57759416",
"0.57751036",
"0.5774097",
"0.5772042",
"0.5771947",
"0.57684344",
"0.5767535",
"0.57661015",
"0.57583636",
"0.57552147",
"0.575075",
"0.5750413",
"0.5748553",
"0.5747061",
"0.5746371",
"0.57441556"
] | 0.0 | -1 |
Ensure supplied GitHub usernames are real | def test_github_profile_exists
people.each do |name, info|
github_username = info.fetch("github", false)
if github_username
assert_kind_of Sawyer::Resource, octokit.user(github_username), "#{github_username} is not a real GitHub account"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def username_exists?(github_username)\n !!User.all.find_by(github_username: github_username)\n end",
"def test_username_with_invalid_examples\n person = @valid_person\n invalid_usernames = %w{rails/rocks web2.0 javscript:something ME}\n invalid_usernames.each do |username|\n person.username = username\n assert !person.valid?, \"#{username} shouldn't pass validation, but does\"\n end\n end",
"def test_input_username_retrieves_info_from_github\n skip\n # get \"/\"\n # post \"/profile\"\n assert_equal \"https://api.github.com/users/stevefake/repos\", \"\"\n end",
"def translate_github_user_to_jira_user (github_user_object)\n #Example: [email protected]\n #user_email_domain = thrillist.com\n #user_email_prefix = msolomon\n if github_user_object[\"email\"] != nil\n user_email_domain = github_user_object[\"email\"].split('@')[1]\n user_email_prefix = github_user_object[\"email\"].split('@')[0]\n\n #convert prefix to JIRA markdown or a link to github name if email domain is not thrillist\n if user_email_domain == \"thrillist.com\"\n user = user_email_prefix.insert(0, \"[~\") + \"]\"\n end\n else\n user = \"[\"+github_user_object[\"login\"]+\"|\"+github_user_object[\"html_url\"]+\"]\"\n end\n\n #overwrite special cases\n case github_user_object[\"login\"]\n when \"kpeltzer\"\n user = \"[~kpeltzer]\"\n when \"ken\"\n user = \"[~kpeltzer]\"\n when \"kwadwo\"\n user = \"[~kboateng]\"\n when \"tarasiegel\"\n user = \"[~tsiegel]\"\n when \"samiamorwas\"\n user = \"[~mhaarhaus]\"\n when \"patrick\"\n user = \"[~plange]\"\n when \"pfunklange\"\n user = \"[~plange]\"\n when \"stefsic\"\n user = \"[~ssicurelli]\"\n when \"lmon\"\n user = \"[~lukemonaco]\"\n when \"schuylerpenny\"\n user = \"[~spenny]\"\n when \"khalid-richards\"\n user = \"[~krichards]\"\n when \"THRILL-jacinto\"\n user = \"[~jacinto]\"\n when \"emchale\"\n user = \"[~emchale]\"\n when \"mpriscella\"\n user = \"[~mpriscella]\"\n when \"vtapia5070\"\n user = \"[~vtapia]\"\n when \"bethannezink\"\n user = \"[~bzink]\"\n when \"boskonyc\"\n user = \"[~bblagojevic]\"\n when \"fabriceTOUSSAINT\"\n user = \"[~ftoussaint]\"\n when \"mdgreenwald\"\n user = \"[~mgreenwald]\"\n when \"morelme\"\n user = \"[~mmorel]\"\n when \"vitaly-rozman\"\n user = \"[~vrozman]\"\n end\n\n return user\nend",
"def ensure_user(user, followers = true, orgs = true)\n # Github only supports alpa-nums and dashes in its usernames.\n # All other sympbols are treated as emails.\n if not user.match(/^[\\w\\-]*$/)\n begin\n name, email = user.split(\"<\")\n email = email.split(\">\")[0]\n name = name.strip unless name.nil?\n email = email.strip unless email.nil?\n rescue StandardError\n warn \"Not a valid email address: #{user}\"\n return\n end\n\n unless is_valid_email(email)\n warn \"Extracted email(#{email}) not valid for user #{user}\"\n end\n u = ensure_user_byemail(email, name)\n else\n u = ensure_user_byuname(user)\n ensure_user_followers(user) if followers\n ensure_orgs(user) if orgs\n end\n return u\n end",
"def valid_user_name(login, name)\n valid = false\n imperfect = false\n email = email(name, login, false)\n if email\n valid, imperfect = true, false\n else\n email = email(name, login, false, true)\n valid, imperfect = true, true if email\n end\n [valid, imperfect]\n end",
"def github_check\n begin\n unless github.blank?\n RestClient.get \"https://github.com/#{github}\"\n end\n rescue\n errors.add :base, \"Invalid Github account.\"\n end\n end",
"def test_username_with_valid_examples\n person = @valid_person\n valid_usernames = %w{juho kusti juho_kusti enu}\n valid_usernames.each do |username|\n person.username = username\n assert person.valid?, \"#{username} should pass validation, but doesn't\"\n end\n end",
"def github(name: T.unsafe(nil), email: T.unsafe(nil), uid: T.unsafe(nil)); end",
"def github_user_and_project(github_url)\n matches = /github\\.com.(.*?)\\/(.*)/.match(github_url)\n matches ? [matches[1], matches[2].sub(/\\.git\\z/, '')] : [nil, nil]\n end",
"def test_ID_25847_edit_profile_name_limit\n login_as_user1\n go_to_edit_profile_page\n verify_user_names_are_not_required_to_be_unique \"Jame Smith\"\n end",
"def test_ID_25847_edit_profile_name_limit\n login_as_user1\n go_to_edit_profile_page\n verify_user_names_are_not_required_to_be_unique \"Jame Smith\"\n end",
"def ensure_username\n return unless username.blank?\n\n self.username = email.gsub(/@.*$/, '')\n end",
"def ensure_username\n if self.username != \"\"\n self.username \n else\n self.username = \"user#{((self.email).hash).to_s[0,6]}\"\n end\n end",
"def check_username username\n\t\t\traise 'Username must be a String' unless username.is_a?(String)\n\t\t\traise 'Username must be >= 10 characters.' unless username.to_s.length >= 10\n\t\t\traise 'Spaces are not permitted in usernames.' if username =~ /[[:space:]]/\n\t\tend",
"def find_by_username_menu\n puts\n puts \"Enter a GitHub username with *EXACT* capitalization to list that user's repos:\"\n input = gets_user_input\n #if username exists in our DB, don't make API call.\n if !username_exists?(input)\n #making an API call\n get_data(input)\n end\n if find_user(input) == false\n puts \"That user doesn't exist or doesn't have any public repos\"\n menu\n else\n @user = find_user(input)\n end\n @repos = find_repos(@user)\n if show_repos(@repos) == false\n puts \"User has no repos\"\n menu\n end\n find_by_username_sub_menu\n end",
"def get_username_and_test_validity(company)\n prompt = TTY::Prompt.new\n username = prompt.ask(\"Please enter your username:\")\n company.username == username\n end",
"def test_is_username\n assert(StringChecker.is_valid_username?(\"ese\"))\n assert(!StringChecker.is_valid_username?(\"e se\"))\n assert(!StringChecker.is_valid_username?(\"<script>alert()</script>\"))\n assert(!StringChecker.is_valid_username?(\"happy-emu\"))\n assert(StringChecker.is_valid_username?(\"happy_emu\"))\n assert(!StringChecker.is_valid_username?(\"happy-\"))\n end",
"def assert_correct_username(mandate)\n within('push-notification-splash__intro') do\n assert_text(\"#{I18n.t('push_notification_splash.intro', user_name: mandate.first_name)}\")\n end\n end",
"def check_username_format\n errors.add(:username, \"is not a valid username\") unless username =~ Handle.validation_regex\n end",
"def org_member?(client)\n begin\n client.user # Authenticate User.\n if client.org_member?(GITHUB_ORG, client.user.login)\n return true\n else\n return false\n end\n rescue Octokit::OneTimePasswordRequired => e\n GitLfsS3::Application.settings.logger.warn\\\n 'Octokit::OneTimePasswordRequired exception raised for username #{client.user.login}. '\\\n 'Please use a personal access token.'\n return false\n rescue Octokit::Unauthorized\n return false\n end\nend",
"def is_yours?\n @repo[:name].include?(\"#{@user.username}/\")\n end",
"def validate_username_reserved\n return unless username_reserved?\n\n errors.add(:username, :exclusion)\n end",
"def github_url\n github_user.blank? ? nil : \"#{GITHUB_URL}#{github_user}\"\n end",
"def display_name\n if name.blank?\n github_username\n else\n name\n end\n end",
"def validate_username_format\n return if valid_username_format?\n\n errors.add(:username, :invalid_characters)\n end",
"def find_all_collabs_for_repo\n puts \"Enter a repo name with *EXACT* spelling and capitalization:\"\n input = gets_user_input\n repo_by_project_name = find_repo_by_project_name(input)\n if repo_by_project_name == nil\n puts \"No repo found\"\n else\n repo_by_project_name.users.each do |user|\n puts user.github_username\n end\n end\n menu\n end",
"def valid_username?(name)\n\t\t$users_and_passwords.each do |element|\n\t\t\tif element[USERNAME] == name\n\t\t\t\t@username=name\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\t\t\t\n\t\treturn false\n\tend",
"def username_reserved?\n ReservedUsernames.include?(username)\n end",
"def find_user(github_username)\n if username_exists?(github_username)\n User.all.find_by(github_username: github_username)\n else\n false\n end\n end",
"def user_name (name, password)\n if name == password\n 'name and password cannot be the same.'\n elseif name.length < 6 && password.length < 6\n \"names and passwords must be atleast 6 characters long\"\n elseif password.include? ('!''#''$') == false \n 'password must contain at least one of the following \"!, #, $\"'\n elseif name.include? ('!''#''$'' ') == true\n \"ID's connot contain '!, #, $, '\"\n elseif password == 'password'\n 'your password cannot be password'\n end\nend",
"def default_value_for_author\n git_global_config_for(\"user.name\") do |author_val|\n warn(\"Using author from git as: #{author_val}\")\n end\n end",
"def selection(github_url = nil)\n puts 'please enter a Github user name or a Github url'.light_green\n github_url = if github_url.nil?\n gets.chomp.downcase\n else\n github_url.downcase\n end\n # in case that the input is the full url extract only the username\n return github_url.split('m/')[1] if\n github_url.include? 'https://github.com/'\n\n github_url\nend",
"def validate_username(username)\n return false unless username != nil\n if username.length > 19\n return false\n end\n stripped = username.gsub(/[ \\&\\=\\+\\-\\?]/,'')\n return username == stripped\n end",
"def check_create_user_name_is_valid\n return self.name != \"\" ? true : false\n end",
"def test_authors\n auths = [\n \"Jepson, J.E.,Makarkin, V.N., & Jarzembowski, E.A.\", # 0\n \"Ren, D & Meng, X-m.\", # 1\n \"Ren, D and Meng, X-m.\", # 2\n \"Smith, J.H. and Jones, Y.K.\", # 3 \n \"Thomas jr. D.B.\", # 4\n \"Wighton, D.C., & Wilson, M.V.H.\", # 5\n \"Heyden, C.H.G. von & Heyden, L.F.J.D. von\", # 6 \n \"Zhang, B., et al.\", # 7\n \" Zhang, J.F. \", # 8\n \"Hong, Y-C.\", # 9 \n \"Yan, E.V.\", # 10\n \"Foo A, Bar ZA, Smith-Blorf A\", # 11\n \"Smith and Barnes\", # 12\n \"Smith & Barnes\", # 13 \n \"Smith\", # 14 \n \"Smith, Jones and Simon\", # 15\n \"Van Duzee\", # 16\n \"Walker, F.\", # 17\n \"Watson, T. F., D. Langston, D. Fullerton, R. Rakickas, B. Engroff, R. Rokey, and L. Bricker\", # 18\n \"Wheeler, A. G., Jr. and T. J. Henry.\", # 19\n \"Wheeler, A. G., Jr., B. R. Stinner, and T. J. Henry\", # 20\n \"Wilson, L. T. and A. P. Gutierrez\", # 21\n \"Torre-Bueno, J. R. de la\", # 22\n \"Vollenhoven, S. C. S.\", # 23\n \"Usinger, R. L. and P. D. Ashlock\", # 24\n \"van den Bosch, R. and K. Hagen\", # 25\n \"Slater, J. A. and J. E. O'Donnell\", # 26\n \"O'Donnell, J.E. and Slater, J. A.\", # 27\n \"Van Steenwyk, R. A., N. C. Toscano, G. R. Ballmer, K. Kido, and H. T. Reynolds\", # 28\n \"Ward, C. R., C. W. O'Brien, L. B. O'Brien, D. E. Foster, and E. W. Huddleston\", # 29\n \"McPherson, R. M., J. C. Smith, and W. A. Allen\", # 30\n \"Oatman, E. R., J. A. McMurty, H. H. Shorey, and V. Voth\", # 31\n \"Ferrari, E. von \", # 32\n \"Whitaker J. O., Jr., D. Rubin and J. R. Munsee\", # 33\n \"Palisot de Beauvois, A. M. F. J.\", # 34\n \"Maa, T.-C. and K.-S. Lin\", # 35\n \"Costa Lima, A. M. da, C. A. Campos Seabra, and C. R. Hathaway\", # 36\n \"Falcon, L. A., R. van den Bosch, C. A. Ferris, L. K. Stromberg, L. K. Etzel, R. E. Stinner, and T. F. Leigh\", # 37\n \"Kinzer, R. E., J. W. Davis, Jr., J. R. Coppedge, and S. L. Jones\", # 38\n \"Doesburg, P. H. van, Jr. \", # 39\n \"Arias J. R., Young D. G.\" # 40 \n ]\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[40])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal ['Arias', 'Young'], t.names.collect{|n| n[:last_name] }\n assert_equal [%w{J R}, %w{D G}] , t.names[0..1].collect{|n| n[:initials] }\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[39])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal ['Doesburg'], t.names.collect{|n| n[:last_name] }\n assert_equal \"van Jr.\", t.names[0][:suffix]\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[38])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal ['Kinzer', 'Davis', 'Coppedge', 'Jones'], t.names.collect{|n| n[:last_name] }\n assert_equal \"Jr.\", t.names[1][:suffix]\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[37])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal ['Falcon', 'van den Bosch', 'Ferris', 'Stromberg', 'Etzel', 'Stinner', 'Leigh'], t.names.collect{|n| n[:last_name] }\n assert_equal [%w{L A}, %w{R}, %w{C A}] , t.names[0..2].collect{|n| n[:initials] }\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[36])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal ['Costa Lima', 'Campos Seabra', 'Hathaway'], t.names.collect{|n| n[:last_name] }\n assert_equal [%w{A M}, %w{C A}, %w{C R}] , t.names.collect{|n| n[:initials] }\n assert_equal \"da\" , t.names.first[:suffix]\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[35])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal ['Maa', 'Lin'], t.names.collect{|n| n[:last_name] }\n assert_equal [%w{T -C}, %w{K -S}] , t.names.collect{|n| n[:initials] }\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[32])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal ['Ferrari'], t.names.collect{|n| n[:last_name] }\n assert_equal [%w{E}] , t.names.collect{|n| n[:initials] }\n assert_equal ['von'] , t.names.collect{|n| n[:suffix] }\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[31])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal ['Oatman', 'McMurty', 'Shorey', 'Voth'], t.names.collect{|n| n[:last_name] }\n assert_equal [%w{E R}, %w{J A}, %w{H H}, %w{V}] , t.names.collect{|n| n[:initials] }\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[30])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal [\"McPherson\", \"Smith\", \"Allen\"], t.names.collect{|n| n[:last_name] }\n assert_equal [%w{R M}, %w{J C}, %w{W A}] , t.names.collect{|n| n[:initials] }\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[29])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal [\"Ward\", \"O'Brien\", \"O'Brien\", \"Foster\", \"Huddleston\" ], t.names.collect{|n| n[:last_name] }\n assert_equal [%w{C R}, %w{C W}, %w{L B}, %w{D E}, %w{E W}] , t.names.collect{|n| n[:initials] }\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[28])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal [\"Van Steenwyk\", \"Toscano\", \"Ballmer\", \"Kido\", \"Reynolds\" ], t.names.collect{|n| n[:last_name] }\n assert_equal [%w{R A}, %w{N C}, %w{G R}, %w{K}, %w{H T}] , t.names.collect{|n| n[:initials] }\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[27])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal [\"O'Donnell\", \"Slater\" ], t.names.collect{|n| n[:last_name] }\n assert_equal [[\"J\", \"E\"],[\"J\", \"A\"]] , t.names.collect{|n| n[:initials] }\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[26])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal [\"Slater\", \"O'Donnell\"], t.names.collect{|n| n[:last_name] }\n assert_equal [[\"J\", \"A\"],[\"J\", \"E\"]] , t.names.collect{|n| n[:initials] }\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[25])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal [\"van den Bosch\", \"Hagen\"], t.names.collect{|n| n[:last_name] }\n assert_equal [[\"R\"],[\"K\"]] , t.names.collect{|n| n[:initials] }\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[24])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal [\"Usinger\", \"Ashlock\"], t.names.collect{|n| n[:last_name] }\n assert_equal [[\"R\", \"L\"],[\"P\", \"D\"]] , t.names.collect{|n| n[:initials] }\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[23])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal [\"Vollenhoven\"], t.names.collect{|n| n[:last_name] }\n assert_equal [[\"S\", \"C\", \"S\"]] , t.names.collect{|n| n[:initials] }\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[22])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal [\"Torre-Bueno\"], t.names.collect{|n| n[:last_name] }\n assert_equal [[\"J\", \"R\"]] , t.names.collect{|n| n[:initials] }\n assert_equal \"de la\", t.names.first[:suffix]\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[21])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal [\"Wilson\", \"Gutierrez\"], t.names.collect{|n| n[:last_name] }\n assert_equal [[\"L\", \"T\"], [\"A\", \"P\"]] , t.names.collect{|n| n[:initials] }\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[20])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal [\"Wheeler\", \"Stinner\", \"Henry\"], t.names.collect{|n| n[:last_name] }\n assert_equal [[\"A\", \"G\"], [\"B\", \"R\"], [\"T\", \"J\"]] , t.names.collect{|n| n[:initials] }\n assert_equal \"Jr.\", t.names.first[:suffix]\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[19])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal [\"Wheeler\", \"Henry\"], t.names.collect{|n| n[:last_name] }\n assert_equal [[\"A\", \"G\"], [\"T\", \"J\"]] , [t.names.first[:initials], t.names.last[:initials]]\n assert_equal \"Jr.\", t.names.first[:suffix]\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[18])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal [\"Watson\", \"Langston\", \"Fullerton\", \"Rakickas\", \"Engroff\", \"Rokey\", \"Bricker\"], t.names.collect{|n| n[:last_name] }\n assert_equal [[\"T\", \"F\"], [\"L\"]] , [t.names.first[:initials], t.names.last[:initials]]\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[17])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal 1, t.names.size\n assert_equal \"Walker\", t.names[0][:last_name]\n assert_equal [\"F\"], t.names[0][:initials]\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[16])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal 1, t.names.size\n assert_equal \"Van Duzee\", t.names[0][:last_name]\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[15])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal 3, t.names.size\n assert_equal \"Smith\", t.names[0][:last_name]\n assert_equal \"Jones\", t.names[1][:last_name]\n assert_equal \"Simon\", t.names[2][:last_name]\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[14])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal 1, t.names.size\n assert_equal \"Smith\", t.names[0][:last_name]\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[13])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal 2, t.names.size\n assert_equal \"Smith\", t.names[0][:last_name]\n assert_equal \"Barnes\", t.names[1][:last_name]\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[12])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal 2, t.names.size\n assert_equal \"Smith\", t.names[0][:last_name]\n assert_equal \"Barnes\", t.names[1][:last_name]\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[0])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal 3, t.names.size\n assert_equal \"Jepson\", t.names[0][:last_name]\n assert_equal \"JE\", t.names[0][:initials].join\n assert_equal \"Jarzembowski\", t.names[2][:last_name]\n assert_equal \"EA\", t.names[2][:initials].join\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[1])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal 2, t.names.size\n assert_equal \"Ren\", t.names[0][:last_name]\n assert_equal \"D\", t.names[0][:initials].join\n assert_equal \"Meng\", t.names[1][:last_name]\n assert_equal \"X-m\", t.names[1][:initials].join\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[9])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal 1, t.names.size\n assert_equal \"Hong\", t.names[0][:last_name]\n assert_equal \"Y-C\", t.names[0][:initials].join\n\n lexer = Taxonifi::Splitter::Lexer.new(auths[11])\n assert t = lexer.pop(Taxonifi::Splitter::Tokens::Authors)\n assert_equal 3, t.names.size\n assert_equal \"Foo\", t.names[0][:last_name]\n assert_equal \"A\", t.names[0][:initials].join\n assert_equal \"Bar\", t.names[1][:last_name]\n assert_equal \"ZA\", t.names[1][:initials].join\n assert_equal \"Smith-Blorf\", t.names[2][:last_name]\n assert_equal \"A\", t.names[2][:initials].join\n end",
"def same_visible_username?(username)\n real_username.downcase == username.downcase\n end",
"def commit_user(githubuser, commituser)\n\n users = db[:users]\n\n name = commituser['name']\n email = commituser['email'] #if is_valid_email(commituser['email'])\n # Github user can be null when the commit email has not been associated\n # with any account in Github.\n login = githubuser['login'] unless githubuser.nil?\n\n # web-flow is a special user reserved for web-based commits:\n # https://api.github.com/users/web-flow\n # We do not follow the process below as this user's email\n # ([email protected]) clashes other existing users' emails.\n if login == 'web-flow'\n return ensure_user_byuname('web-flow')\n end\n\n return ensure_user(\"#{name}<#{email}>\", false, false) if login.nil?\n\n dbuser = users.first(:login => login)\n byemail = users.first(:email => email)\n\n if dbuser.nil?\n # We do not have the user in the database yet\n added = ensure_user(login, false, false)\n\n # A commit user can be found by email but not\n # by the user name he used to commit. This probably means that the\n # user has probably changed his user name. Treat the user's by-email\n # description as valid.\n if added.nil? and not byemail.nil?\n warn \"Found user #{byemail[:login]} with same email #{email} as non existing user #{login}. Assigning user #{login} to #{byemail[:login]}\"\n return users.first(:login => byemail[:login])\n end\n\n # This means that the user's login has been associated with a\n # Github user by the time the commit was done (and hence Github was\n # able to associate the commit to an account), but afterwards the\n # user has deleted his account (before GHTorrent processed it).\n # On absense of something better to do, try to find the user by email\n # and return a \"fake\" user entry.\n if added.nil?\n warn \"User account for user #{login} deleted from Github\"\n return ensure_user(\"#{name}<#{email}>\", false, false)\n end\n\n if byemail.nil?\n users.filter(:login => login).update(:name => name) if added[:name].nil?\n users.filter(:login => login).update(:email => email) if added[:email].nil?\n else\n # There is a previous entry for the user, currently identified by\n # email. This means that the user has updated his account and now\n # Github is able to associate his commits with his git credentials.\n # As the previous entry might have already associated records, just\n # delete the new one and update the existing with any extra data.\n users.filter(:login => login).delete\n users.filter(:email => email).update(\n :login => login,\n :company => added[:company],\n :location => added[:location],\n :created_at => added[:created_at]\n )\n end\n else\n users.filter(:login => login).update(:name => name) if dbuser[:name].nil?\n users.filter(:login => login).update(:email => email) if dbuser[:email].nil?\n end\n users.first(:login => login)\n\n end",
"def extract_author_name\n `git config user.name`.strip\n end",
"def valid_user?(repo, options = {})\n response = get(repo.public_users_path, options)\n if response[:id].present?\n true\n else\n raise Github::UserNotFound, [NO_USER,\n '[',\n response[:message].to_s,\n ']'].join\n end\n end",
"def valid_username?(username)\n url = URI.parse(\"https://auth.roblox.com/v1/usernames/validate?context=UsernameChange&username=#{username}\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n req = Net::HTTP::Get.new(url.request_uri)\n req[\"Accept-Encoding\"] = \"gzip, deflate, br\"\n req[\"Cookie\"] = \".ROBLOSECURITY=#{ROBLO_SECURITY}\"\n\n begin\n response = http.request(req)\n rescue\n retry\n end\n\n gz = Zlib::GzipReader.new(StringIO.new(response.body.to_s))\n JSON.parse(gz.read)['data'] == 0\nend",
"def username_arg_ok? username\n return false if username.nil?\n return false unless (1..16) === username.length\n return false unless username.match /\\A[0-9a-zA-Z]*\\z/\n \n # oh? okay, all good.\n true\n end",
"def test_check_user_name\n user = User.named(\"HansliCaramell\")\n\n assert(!user.name.nil? ,\"No User Name\")\n assert_equal(\"HansliCaramell\", user.name, \"Wrong User name\")\n end",
"def steal_username\n\t[\n\t\t# the user's .hgrc file for a username field\n\t\t['~/.hgrc', /^\\s*username\\s*=\\s*([\"'])?(.*)\\1$/, 2],\n\t\t# the user's .(g)vimrc for a changelog_username setting\n\t\t['~/.vimrc', /changelog_username\\s*=\\s*([\"'])?(.*)\\1$/, 2],\n\t\t['~/.gvimrc', /changelog_username\\s*=\\s*([\"'])?(.*)\\1$/, 2],\n\t].each do |fn, rx, idx|\n\t\tfile = File.expand_path fn\n\t\tif File.readable?(file) and File.read(file) =~ rx\n\t\t\tparse_options[:authors][user] = Regexp.last_match(idx).strip\n\t\t\tbreak\n\t\tend\n\tend\nend",
"def check_if_input_is_valid\n if params[:user] && warn_for_special_chars(params[:user][:name], 'Username')\n flash[:error] = 'Please enter valid user name'\n redirect_back fallback_location: root_path\n elsif params[:impersonate] && warn_for_special_chars(params[:impersonate][:name], 'Username')\n flash[:error] = 'Please enter valid user name'\n redirect_back fallback_location: root_path\n end\n end",
"def check_user_github_organizations\n if Figaro.env.respond_to?(:github_organization)\n github_orgs_url = auth_hash.extra.raw_info.organizations_url + '?access_token=' + auth_hash.credentials.token\n user_organizations = get_user_github_organizations(github_orgs_url)\n unless user_organizations.include?(Figaro.env.github_organization)\n flash[:error] = \"You are not a member of the github organization '#{Figaro.env.github_organization}'\"\n logger.error \"User email '#{get_user_email}' is not in github organization '#{Figaro.env.github_organization}'\"\n return false\n end\n end\n\n true\n end",
"def check_username\n @user=User.where('username=?',params[:username])\n @user=[] if user_signed_in? && @user && @user.first==current_user # this means they are editing their username and its themselves, that is ok\n end",
"def validate_name?\n # if you create user from admin interface(or as a team member), then \"name\" param is provided, it is present or blank - not nil\n !name.nil?\n end",
"def user_exists?(username)\n !!Etc.getpwnam(username) rescue false\nend",
"def show\n @user = User.find_by_github_name params[:github_name]\n end",
"def github_account?\n !github_user.nil? and !github_token.nil?\n end",
"def github_user(fatal = true)\n if user = GIT_CONFIG['config github.user']\n user\n elsif fatal\n abort(\"** No GitHub user set. See #{LGHCONF}\")\n end\n end",
"def github_user(fatal = true)\n if user = GIT_CONFIG['config github.user']\n user\n elsif fatal\n abort(\"** No GitHub user set. See #{LGHCONF}\")\n end\n end",
"def validate_username\n if User.where(email: username).exists? || User.where(username: username).exists? \n errors.add(:username, :invalid)\n end\n end",
"def authorized_for_github?\n !github.nil?\n end",
"def validate_name(arg = nil)\n set_or_return(:name, arg, :kind_of => String, :callbacks => {\n \"user must be string of word characters and Engine ID should be either empty string or 5 to 32 octets separated by colons\" => lambda {\n |name| !@@title_pattern.match(name).nil?\n }\n })\n end",
"def check_username\n if /[a-zA-Z0-9_-]/.match(params[:username])\n user = User.username(params[:username])\n if user.blank?\n render :json => [\"free\", \":)\"]\n else\n render :json => [\"taken\", \"Sorry, username exists!\"]\n end\n else\n render :json => [\"Letters, numbers, dashes and underscores only please :)\"]\n end\n end",
"def validate_options\n if @username == nil or @username.empty?\n raise \"You need to provide a Delicious username\"\n end\n end",
"def guess_maintainer\n text = File.read(File.join(ENV['HOME'], \".gitconfig\"))\n name = text.match(/name = (.*)$/)[1]\n email = text.match(/email = (.*)$/)[1]\n\n \"#{name} <#{email}>\"\n rescue Errno::ENOENT\n return \"\"\n end",
"def test_ID_25846_edit_profile_name_validation\n login_as_user1\n go_to_edit_profile_page\n verify_name_change_is_saved \"test_ID_25835_edit_profile_desc\", \"Jamie Smith\", \"Temp name\"\n verify_name_validation \"test_ID_25835_edit_profile_desc\", \"Jamie Smith\", \"%$#%<html>\"\n end",
"def github_repo\n # GitHub allows underscores, hyphens and dots in repo names\n # but only hyphens in user/organisation names (as well as alphanumeric).\n repository_url.scan(/:([A-Za-z0-9-]+\\/[\\w.-]+)\\.git$/).join\n end",
"def get_username\n user_response = Faraday.get \"https://api.github.com/user\", {}, {'Authorization'=>\"token #{self.access_token}\", 'Accept' => 'application/json'}\n user_json = JSON.parse(user_response.body)\n user_json[\"login\"]\n end",
"def username_is_allowed\n\t\tif FORBIDDEN_USERNAMES.include?(username)\n\t\t\terrors.add(:username, \"has been restricted from use.\")\n\t\tend\n\tend",
"def username_complexity\n if username.present? and not username.match(/^(\\w){2,15}$/)\n errors.add :username, 'can only contain alphanumeric characters (letters A-Z, numbers 0-9) and underscores'\n end\n if username.present? and username.match(/^(.*admin.*)$/i)\n errors.add :username, 'cannot contain the word Admin'\n end\n end",
"def validate_username\n if User.where(email: username).exist?\n errors.add(:username, :invalid)\n end\n end",
"def update_or_create_author_from_github(author, github_issue)\n if author\n update_author_from_github(author, github_issue)\n else\n Rails.logger.warn \"Author for edited issue #{github_issue[\"number\"]} doesn't exist. Creating it\"\n create_author_for github_issue\n end\n end",
"def username_is_allowed #same as 'validates_exclusion_of' method\n if FORBIDDEN_USERNAMES.include?(username) # checking to see if the username is in FORBIDDEN_USERNAMES\n errors.add(:username, \"has been restricted from use.\") # if the username is in FORBIDDEN_USERNAMES, it will add an error to the errors array\n end\n end",
"def validate_username_is_unique(username)\n return false unless username != nil\n return !User.username_exists?(username)\n end",
"def test_ID_25846_edit_profile_name_validation\n login_as_user1\n go_to_edit_profile_page\n verify_name_change_is_saved \"test_ID_25835_edit_profile_desc\", \"Jame Smith\", \"Temp name\"\n verify_name_validation \"test_ID_25835_edit_profile_desc\", \"Jame Smith\", \"%$#%<html>\"\n end",
"def validate_username\n if User.where(email: username).exists?\n errors.add(:username, :invalid)\n end\n end",
"def validate_username\n if User.where(email: username).exists?\n errors.add(:username, :invalid)\n end\n end",
"def create_or_update_author_from_github(author, github_issue)\n if author\n Rails.logger.warn \"Opened issue has an existing author in the DB. How is this possible?. Updating it\"\n update_author_from_github(author, github_issue)\n else\n create_author_for github_issue\n end\n end",
"def check_name_links!\n @@name_lookup ||= {}\n\n # Look for __Name__ turn into \"Name\":name_id. Look for \"Name\":name and\n # fill in id. Look for \"Name\":name_id and make sure id matches name just\n # in case the user changed the name without updating the id.\n self.gsub!(NAME_LINK_PATTERN) do |orig_str|\n prefix = $1\n label = remove_formatting($2)\n name = expand_genus_abbreviation(label)\n name = supply_implicit_species(name)\n name = strip_out_sp_cfr_and_sensu(name)\n if (parse = Name.parse_name(name)) &&\n # Allowing arbitrary authors on Genera and higher makes it impossible to\n # distinguish between publication titles and taxa, e.g., \"Lichen Flora\n # of the Greater Sonoran Region\". I'm sure it can still break with species\n # but it should be very infrequent (I don't see it in current tests). -JPH\n (parse.author.blank? || parse.rank != :Genus)\n Textile.private_register_name(parse.real_text_name, parse.rank)\n prefix + \"x{NAME __#{label}__ }{ #{name} }x\"\n else\n orig_str\n end\n end\n end",
"def build_from_github_user( user )\n # name\n # email\n # blog\n # company\n # location\n # bio\n end",
"def user_exists?(name)\n Etc.getpwnam(name).name == name\n rescue ArgumentError\n false\n end",
"def validate!\n super\n unless @name && @username && @password\n help! 'Adding a Square SDK repository needs a `NAME`, `USERNAME` and a `PASSWORD`.'\n end\n end",
"def name_or_username\n name || username\n end",
"def validate_name(arg=nil)\n set_or_return(:name, arg, kind_of: String, callbacks: {\n 'user must be string of word characters and ' \\\n 'Engine ID should be either empty string or ' \\\n '5 to 32 octets separated by colons' => lambda do |name|\n !@@title_pattern.match(name).nil?\n end,\n })\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 github_handle\n user.try(:github_handle)\n end",
"def create_git_user(user_name, name)\n # self.class.require_token\n\n response = HTTParty.post(\n GitToolkit::GIT_BASE_URL + 'users',\n :headers => {\n 'PRIVATE-TOKEN' => GIT_TOKEN\n },\n :body => {\n :email => self.mail_address,\n :password => 'pass4git',\n :username => user_name,\n :name => name\n }\n )\n Rails.logger.info \"Git server response (create user): #{response}\"\n self.git_id = response['id']\n get_token\n end",
"def github\n self.account.blank? ? nil : GitHub::API.user(self.account)\n end",
"def username_and_password_check\n company = get_company\n if company == nil\n exit\n end\n if get_username_and_test_validity(company)\n if get_password_and_test_validity(company)\n else\n puts \"That is not the correct password, please try again.\"\n entry_menu\n end\n else \n puts \"That is not the correct username, please try again.\"\n entry_menu\n end\n end",
"def pointed_to_github_user_domain?\n dns.first.class == Net::DNS::RR::CNAME && pages_domain?(dns.first.cname.to_s) if dns?\n end",
"def test_assert_that_5_character_username_is_invalid\n\t\tusername = 12345\n\t\tassert_equal(\"invalid\", set_up_username(username))\n\tend",
"def guess_email\n @guessed_email ||= begin\n e = `git config user.email`.strip\n # TODO: Guess based on hg and other possibile tools\n raise UnknownEmail, \"Email could not be obtained via git settings\" if e.empty?\n e\n end\n end",
"def github_user_params\n params.require(:github_user).permit(:name, :github_id, :avatar_url)\n end",
"def test_login_username_password_duplicate\n # Attempt to log in as one user, it should work\n user = create(:user)\n _uppercase_user = build(:user, :display_name => user.display_name.upcase).tap { |u| u.save(:validate => false) }\n\n try_password_login user.display_name, \"test\"\n\n assert_template \"changeset/history\"\n assert_select \"span.username\", user.display_name\n end",
"def username_is_acceptable\n errors.add(:username, \"^That username is unacceptable\") unless User.verify_username_is_acceptable(self.username)\n end",
"def try_display_name\n [display_name, username].find(&:present?)\n end",
"def authorized? name\n\t$master_regex ||= /^#{$master.gsub('.','\\.')}(\\/.*)?$/\n\tname.to_s =~ $master_regex\nend",
"def already_on_repo?(user, repo)\n repo.users.include?(user)\n end",
"def username_exists?(username)\n return User.find_by_username(username.downcase) != nil\nend",
"def org?(user)\n response = Typhoeus.head \"https://github.com/orgs/#{user}/people\", accept_encoding: 'gzip'\n response.success? || response.response_code == 429\nend",
"def userlogin_valid?\n if User.find_by(name: userlogin_input) != nil\n if User.find_by(name: userlogin_input).name == self.userlogin_input #########put in custom error catch\n self.active_user = User.find_by(name: userlogin_input) ### if you use this method.name it dies if there isn't a match\n self.welcome_user\n end\n else\n puts Rainbow (\"\\n\\nI'm sorry that's not a valid username.\\n\").bright.red\n puts \"I'll let you try again.\\n\"\n self.userquery_prompt\n end\nend",
"def test_12_accepts_doesnt_include_password\n result = not_including_username?(\"HatBox1992!\", \"gdavida\")\n assert(result, \"HatBox1992! does not include your username, should be valid\")\n end",
"def check_name(new_username)\n db = connect_to_database()\n if db.execute(\"SELECT * FROM users WHERE Username =?\", new_username) != []\n return true\n else \n return false\n end \n end",
"def username_is_email\n errors.add(:userName,'is not in email format') unless userName=~ /^([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})$/i\n end",
"def isValidUserName?(userName)\n\t\tuserName =~ /^[a-z_][a-z0-9_-]*$/\n\tend",
"def configure_git\n run_simple 'git config user.name Cucumber'\n run_simple 'git config user.email cucumber@`hostname --fqdn`'\nend"
] | [
"0.64287794",
"0.6357639",
"0.6189124",
"0.61513263",
"0.6128418",
"0.59871584",
"0.5966224",
"0.59537137",
"0.59128714",
"0.5866562",
"0.5853227",
"0.5853227",
"0.5822763",
"0.5805044",
"0.5790539",
"0.57476133",
"0.57420015",
"0.5684714",
"0.56837326",
"0.5681776",
"0.5673663",
"0.566586",
"0.5654681",
"0.5638798",
"0.56357783",
"0.56322694",
"0.5605696",
"0.56004167",
"0.5598236",
"0.558794",
"0.55806816",
"0.5561212",
"0.5559538",
"0.5554102",
"0.5553139",
"0.5517272",
"0.5511188",
"0.5501289",
"0.5489409",
"0.54847795",
"0.54797053",
"0.5462497",
"0.5459472",
"0.54513735",
"0.5445327",
"0.5430436",
"0.5418001",
"0.54165226",
"0.5416302",
"0.5408656",
"0.53989506",
"0.5395772",
"0.5395772",
"0.5377994",
"0.53710914",
"0.53676635",
"0.53618026",
"0.5348322",
"0.5331193",
"0.5324949",
"0.5320453",
"0.53165776",
"0.5309321",
"0.5305742",
"0.5300689",
"0.5298551",
"0.52902555",
"0.5290043",
"0.5286412",
"0.52839303",
"0.52839303",
"0.5273364",
"0.5262622",
"0.52618146",
"0.52572155",
"0.52562207",
"0.5249535",
"0.524668",
"0.5246574",
"0.5243885",
"0.5243",
"0.5241806",
"0.52404195",
"0.5238792",
"0.5237978",
"0.52353466",
"0.52275765",
"0.5218289",
"0.5216759",
"0.5214164",
"0.5213848",
"0.5212022",
"0.5209461",
"0.5197529",
"0.51893395",
"0.5183739",
"0.5182633",
"0.51824975",
"0.5182438",
"0.51801765"
] | 0.6685057 | 0 |
Return the next lower item in the list. | def lower_item
return nil unless in_list?
acts_as_list_class.find(:first, :conditions =>
"position = #{(send(:position).to_i + 1).to_s}"
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lower_item\n return nil unless in_list?\n lower_items(1).first\n end",
"def move_lower\n return if self == self_and_siblings(true).last\n move_to(position_in_list + 1)\n end",
"def find_lt(list, item, &block)\r\n\t\ti = bisect_left(list, item, &block)\r\n\t\treturn list[i - 1] unless 0 == i\r\n\tend",
"def lower_item\n return nil unless in_list?\n\n conditions = scope_condition.merge!(greater_than_me)\n order_by_position(conditions).first\n end",
"def find_le(list, item, &block)\r\n\t\ti = bisect_right(list, item, &block)\r\n\t\treturn list[i - 1] unless 0 == i\r\n\tend",
"def lower_item\n return nil unless in_list?\n\n conditions = scope_condition.merge!( greater_than_me )\n order_by_position(conditions).first\n end",
"def move_lower\n low_item = lower_item\n return unless low_item\n\n low_item.decrement_position\n increment_position\n end",
"def move_lower\n low_item = lower_item\n return unless low_item\n\n low_item.decrement_position\n increment_position\n end",
"def next\n if self.last?\n first_in_section\n else lower_item\n end\n end",
"def move_lower\n return unless lower_item\n\n acts_as_list_class.transaction do\n if lower_item.current_position != current_position\n swap_positions_with(lower_item)\n else\n lower_item.decrement_position\n increment_position\n end\n end\n end",
"def lower_item\n # return nil unless in_list?\n # acts_as_list_class.find(:first, :conditions => \"#{scope_condition} AND #{position_column} > #{send(position_column).to_s}\", :order => \"#{position_column} ASC\")\n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n where(\"#{position_column} = #{(send(position_column).to_i + 1).to_s}\").first\n end \n end",
"def higher_item\n return nil unless in_list?\n higher_items(1).first\n end",
"def move_lower\n next_sib = next_sibling\n move_to_right_of(next_sib) if next_sib\n end",
"def swap_with_next i\n #if first_item >= first_item.next_list_item\n\n end",
"def next_item\n index = self.simple_acts_as_list_scope.index(self)\n self.simple_acts_as_list_scope[index + 1]\n end",
"def item_at_head\n\t\t\[email protected]\n\t\tend",
"def lower_item\n return nil unless list_id\n Card.find :first,\n :conditions => \"list_id = #{list_id} AND list_position < #{list_position}\",\n :order => \"list_position DESC\"\n end",
"def succ(value)\n index = self[value].to_i + 1\n (index >= size) ? first : @ordered_elements[index]\n end",
"def min_item\n list.min do |a, b|\n return -1 if a[0].null_item?\n return 1 if b[0].null_item?\n a[1] <=> b[1]\n end\n end",
"def next_item(item, options = {})\n options ||= {}\n items = filter_items(Items.new, opt: options)\n\n idx = items.index(item)\n\n idx.positive? ? items[idx - 1] : nil\n end",
"def prev_item\n @current -= 1 if @current > 0\n\n items\n end",
"def my_min(list)\n min = list[0]\n\n list.each do |ele| \n case min <=> ele\n when 1\n min = ele\n when 0\n next\n when -1\n min = min \n end\n end\n\n min\nend",
"def find_min\r\n return nil if !@head\r\n cursor = @head\r\n min = cursor.data\r\n while cursor\r\n if cursor.data < min\r\n min = cursor.data\r\n end\r\n cursor = cursor.next\r\n end\r\n return min\r\n end",
"def move_lower\n lower = lower_item\n return unless lower\n acts_as_list_class.transaction do\n self.update_attribute(position_column, lower.send(position_column))\n lower.decrement_position\n end\n end",
"def find_ge(list, item, &block)\r\n\t\ti = bisect_left(list, item, &block)\r\n\t\treturn list[i] unless list.size == i\r\n\tend",
"def next\n units_sorted = self.order.units.sort_by {|unit| unit.id}\n if units_sorted.find_index(self) < units_sorted.length\n return units_sorted[units_sorted.find_index(self)+1]\n else\n return nil\n end\n end",
"def next_item\n @current += 1 if @current < last\n\n items\n end",
"def left_sibling\n list.reverse.first(:position.lt => position)\n end",
"def first_sibling_in_list\n self.class.asc(:position).first\n end",
"def next\n index = @@list.index(self)\n if (!index)\n raise \"ERROR: Can't find given player\"\n end\n\n return index + 1 < @@list.length ? @@list[index + 1] : @@list[0]\n end",
"def my_min(list)\n i = 0\n min = list[0]\n while i < list.length - 1\n if list[i + 1] < min\n min = list[i + 1]\n end\n i += 1\n end\n min\nend",
"def my_min_fast(list)\n smallest = list.first\n\n list[1..-1].each { |n| smallest = n if n < smallest }\n smallest\nend",
"def left_sibling\n higher_items.last\n end",
"def find_min\r\n return nil if !@head\r\n\r\n min = @head.data\r\n curr = @head \r\n \r\n while curr \r\n min = curr.data if curr.data < min \r\n curr = curr.next\r\n end\r\n\r\n return min\r\n end",
"def my_min_better(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def next_lowest_node\n ary = ordered_lock_children()\n my_idx = ary.index(lock_basename)\n\n raise WeAreTheLowestLockNumberException if my_idx == 0\n\n ary[(my_idx - 1)] \n end",
"def my_min2(list)\n min = list[0]\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def first\n @head.lru_next\n end",
"def my_min(list)\n min = list.first \n\n list.each do |el|\n if el < min \n min = el \n end\n end\n min\nend",
"def my_min2(list)\n result = list.first\n list.each do |el|\n result = el if el < result\n end\n result\n\nend",
"def my_second_min(list)\n smallest = list[0]\n list.each do |el|\n next if el == smallest\n if el < smallest\n smallest = el\n end\n end\n return smallest\nend",
"def get_next list\n if list.length < 1 then nil end\n\n nxt = list[0]\n list.each do |item|\n if item[:score] < nxt[:score] then\n nxt = item\n end\n end\n\n nxt\nend",
"def next\n master_files_sorted = self.sorted_set\n if master_files_sorted.find_index(self) < master_files_sorted.length\n return master_files_sorted[master_files_sorted.find_index(self)+1]\n else\n return nil\n end\n end",
"def my_min_ii(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def find_min\n if @head == nil # empty list case\n # puts \"Error: The linked list is empty. Cannot compute min.\"\n return nil\n end\n\n current = @head\n min = current.data\n current = current.next\n while current != nil\n if current.data < min\n min = current.data\n end\n current = current.next\n end\n return min\n end",
"def next\n master_files_sorted = self.sorted_set\n if master_files_sorted.find_index(self) < master_files_sorted.length\n return master_files_sorted[master_files_sorted.find_index(self)+1]\n else\n return nil\n end\n end",
"def my_min(list)\r\n smallest = list.first\r\n list.each do |ele|\r\n smallest = ele if ele < smallest\r\n end\r\n return smallest\r\nend",
"def higher_item\n return nil unless in_list?\n conditions = scope_condition.merge!( less_than_me )\n order_by_position(conditions).last\n end",
"def higher_item\n return nil unless in_list?\n conditions = scope_condition.merge!(less_than_me)\n order_by_position(conditions).last\n end",
"def my_min(list)\n smallest = list.first\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def next\n last? ? nil : @collection[index + 1]\n end",
"def lower_items(limit=nil)\n limit ||= acts_as_list_list.count\n acts_as_list_list.\n where(\"#{quoted_position_column_with_table_name} >= ?\", current_position).\n where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", self.send(self.class.primary_key)).\n reorder(acts_as_list_order_argument(:asc)).\n limit(limit)\n end",
"def find_min\r\n \r\n if @head.nil?\r\n return nil \r\n end\r\n \r\n # current = @head\r\n min = @head.data\r\n current = @head\r\n \r\n # was failing tests until I realized stop condition for min/max traverse needs to be AFTER the end of list (current.nil?) not last node in list (current.next.nil?)\r\n until current.nil?\r\n if current.data < min \r\n min = current.data\r\n end\r\n current = current.next\r\n end\r\n \r\n return min\r\n end",
"def min\n empty? ? Float::INFINITY : @list.head.value[1]\n end",
"def min\n empty? ? Float::INFINITY : @list.head.value[1]\n end",
"def first ; list.first ; end",
"def min(list)\n tiny = list[0]\n list.each do |n|\n if n < tiny\n tiny = n\n end\n end\n puts tiny\nend",
"def my_min(list)\n\n # phase 1\n # min = list.first\n # list.each_with_index do |ele_1, i_1|\n # list.each_with_index do |ele_2, i_2|\n # if i_2 != i_1\n # if min > ele_2\n # min = ele_2\n # end\n # end\n # end\n # end\n # min\n\n # phase 2\n min = list.first\n list[1..-1].each do |ele|\n if min > ele\n min = ele\n end\n end\n min\nend",
"def next\n @mut.synchronize{@array.sort![-1]}\n end",
"def peek_min\n if next_head = self.head.sibling\n current_head = self.head\n while next_head \n next_head < current_head ? @min = next_head : @min = current_head\n current_head = next_head\n next_head = next_head.sibling \n end\n else\n @min = self.head\n end\n @min\n end",
"def index(list, item, &block)\r\n\t\ti = bisect_left(list, item, &block)\r\n\t\treturn list[i] == item ? i : nil\r\n\tend",
"def next\n after.ascending.first\n end",
"def next\n next? ? @current + 1 : nil\n end",
"def next(name = nil)\n elements = self.class.all_siblings(self)\n elements = elements.where(:name => name) if name\n elements.where(\"position > ?\", self.position).order(\"position ASC\").limit(1)\n end",
"def next_item\n return nil if @link == nil\n link.kernel.select {|item| item.rule == @rule}.first\n end",
"def next\n last? ? nil : locate + 1\n end",
"def higher_item\n # return nil unless in_list? # http://github.com/brightspark3/acts_as_list/commit/8e55352aaa437d23a1ebdeabd5276c6dd5aad6a1\n \n # acts_as_list_class.find(:first, :conditions =>\n # \"#{scope_condition} AND #{position_column} < #{send(position_column).to_s}\", :order => \"#{position_column} DESC\"\n # ) \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n where(\"#{position_column} = #{(send(position_column).to_i - 1).to_s}\").first\n end \n end",
"def peek()\n if @items.empty?\n return nil\n end\n return @items[-1]\n end",
"def peek()\n if @items.empty?\n return nil\n end\n return @items[-1]\n end",
"def peek()\n if @items.empty?\n return nil\n end\n return @items[-1]\n end",
"def next_task\n if last?\n return self.episode.lower_item.tasks.first unless self.episode.lower_item.nil?\n else\n return self.lower_item\n end\n end",
"def next\n parent[parent.place(self) + 1]\n end",
"def peek()\n return nil if @items.empty?\n return @items[-1]\n end",
"def my_min_linear(list)\n smallest_number = list.first\n \n list.each do |num|\n smallest_number = num if num < smallest_number\n end\n\n smallest_number\nend",
"def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end",
"def before(single)\n self[index(single) - 1]\n end",
"def find_gt(list, item, &block)\r\n\t\ti = bisect_right(list, item, &block)\r\n\t\treturn list[i] unless list.size == i\r\n\tend",
"def my_min_2(list)\n min = list.first\n list.each do |num|\n if num < min \n min = num\n end\n end\n min\nend",
"def min()\n return \"Stack is empty.\" if is_empty\n\n current = @head\n min = current.value\n\n while current != nil\n if current.value < min\n min = current.value\n end\n\n current = current.next\n end\n\n return min\n end",
"def succ\n @nxt || self\n end",
"def previous_item\n index = self.simple_acts_as_list_scope.index(self)\n index == 0 ? nil : self.simple_acts_as_list_scope[index - 1]\n end",
"def my_min2(list)\n smallest_number = list.first\n list.each do |num|\n smallest_number = num if num <= smallest_number\n end\n smallest_number\nend",
"def my_min(list)\n min = list[0]\n (0...list.length).each do |i| \n min = list[i] if list[i] < min\n end\n min\nend",
"def see_next\n if @index >= @normalized_numbers.length\n return -1\n else\n return @normalized_numbers[@index]\n end\n end",
"def first\n @current = self.head if self.head\n @current.value rescue nil\n end",
"def lower_item_in_queue\n return nil unless in_queue?\n acts_as_queue_class.find(:first, :conditions =>\n \"#{queue_scope_condition} AND #{queue_position_column} = #{(send(queue_position_column).to_i + 1).to_s}\"\n )\n end",
"def my_min2(list)\n min = 0\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def index_of_smallest\n value, index = self.first, 0\n self.each_with_index {| obj, i | value, index = obj, i if obj<value }\n index\n end",
"def my_min_2(list)\n smallest = 0\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n higher_item.increment_position\n decrement_position\n end\n end",
"def my_min(list)\n list.each do |el|\n equal_or_smaller = []\n list.each do |el2|\n equal_or_smaller << el2 if el2 < el\n end\n return el if equal_or_smaller.empty?\n end\nend",
"def prev\n prev? ? @current - 1 : nil\n end",
"def move_lower_in_queue\n return unless lower_item_in_queue\n\n acts_as_queue_class.transaction do\n lower_item_in_queue.decrement_queue_position\n increment_queue_position\n end\n end",
"def my_min(list)\n min = list[0]\n (1...list.length).each do |i| \n min = list[i] if list[i] < min \n end\n min\nend",
"def find_subsequent()\n curr = self\n while !curr.next.nil?\n curr = curr.next \n return curr if yield curr\n end\n\n return nil\n end",
"def find_best_next(current, allowed, dir)\n if dir == :next\n allowed.sort.find { |val| val > current }\n else\n allowed.sort.reverse.find { |val| val < current }\n end\n end",
"def next_item(column=nil)\n column = column || default_orderable_column\n orderable_scoped(column).where(orderable_column(column) => send(column) + 1).first\n end",
"def my_min2(array)\n lowest_num = array.first\n array.each do |el1|\n next if lowest_num == el1\n if el1 < lowest_num\n lowest_num = el1\n end\n end\n lowest_num\nend",
"def next\n begin\n self.band.levels[band.levels.index(self) + 1]\n rescue\n return nil\n end\n end",
"def my_min_2(list) \n min = list.first \n list.each {|num| min = num if min > num }\n min\nend"
] | [
"0.7830517",
"0.728753",
"0.72604984",
"0.7019275",
"0.6981675",
"0.6970054",
"0.68971944",
"0.68971944",
"0.6853704",
"0.67496645",
"0.6717482",
"0.67153007",
"0.67058164",
"0.6630305",
"0.65746784",
"0.6537143",
"0.651084",
"0.6452789",
"0.64444345",
"0.6438452",
"0.64255655",
"0.6399147",
"0.63846165",
"0.6370117",
"0.63700294",
"0.6367857",
"0.6311644",
"0.63017255",
"0.629143",
"0.62159103",
"0.62131155",
"0.61421317",
"0.6116351",
"0.61076343",
"0.61046594",
"0.6097888",
"0.6058635",
"0.6044439",
"0.60233223",
"0.60095876",
"0.5989315",
"0.5987375",
"0.5982769",
"0.5962291",
"0.5959792",
"0.5953776",
"0.59529656",
"0.5939783",
"0.593782",
"0.58981603",
"0.5885811",
"0.58757526",
"0.5870468",
"0.586548",
"0.586548",
"0.5856381",
"0.58487475",
"0.58485764",
"0.58400154",
"0.5831618",
"0.5830874",
"0.582543",
"0.5822703",
"0.5819271",
"0.5815825",
"0.5807821",
"0.5806476",
"0.5795891",
"0.5795891",
"0.579013",
"0.5766948",
"0.5761031",
"0.57532394",
"0.5752231",
"0.5737923",
"0.5732238",
"0.572991",
"0.57292485",
"0.57220244",
"0.5714369",
"0.5713588",
"0.5692867",
"0.5666738",
"0.5666382",
"0.5660741",
"0.5659062",
"0.56563365",
"0.5652545",
"0.56372046",
"0.56322324",
"0.563053",
"0.56254524",
"0.5623877",
"0.5618689",
"0.56172717",
"0.5616041",
"0.56151426",
"0.5611043",
"0.56016344",
"0.5599352"
] | 0.7377293 | 1 |
Swap positions with the next higher item, if one exists. | def move_higher
return unless higher_item
acts_as_list_class.transaction do
higher_item.increment_position
decrement_position
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n if higher_item.current_position != current_position\n swap_positions_with(higher_item)\n else\n higher_item.increment_position\n decrement_position\n end\n end\n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.increment_position\n decrement_position\n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.increment_position\n decrement_position\n end",
"def move_higher\n higher = higher_item\n return unless higher\n acts_as_list_class.transaction do\n self.update_attribute(position_column, higher.send(position_column))\n higher.increment_position\n end\n end",
"def swap_with_next i\n #if first_item >= first_item.next_list_item\n\n end",
"def move_higher\n return if position_in_list == 1\n move_to(position_in_list - 1)\n end",
"def swap\n @store[-1], @store[-2] = @store[-2], @store[-1] if size > 1\n end",
"def move_higher \n prev_sib = previous_sibling\n move_to_left_of(prev_sib) if prev_sib\n end",
"def move_higher_in_queue\n return unless higher_item_in_queue\n\n acts_as_queue_class.transaction do\n higher_item_in_queue.increment_queue_position\n decrement_queue_position\n end\n end",
"def swap_with_next(n)\n raise IndexError if n < 0 || n >= (@size - 1)\n\n if n == 0\n first = @first_item\n second = first.next_item\n\n first.next_item = second.next_item\n second.next_item = first\n @first_item = second\n else\n current_item = @first_item\n count = n - 1\n count.times do\n current_item = current_item.next_item\n end\n previous = current_item\n first = previous.next_item\n second = first.next_item\n\n previous.next_item = second\n first.next_item = second.next_item\n second.next_item = first\n end\n end",
"def swap\n us = self.pop(true,false)\n them = self.pop(false,false)\n self.push(us,false,false)\n self.push(them,false,true)\n end",
"def swap #\\\n a = pop\n b = pop\n push a\n push b\n end",
"def move_to_top\n self.class.transaction do\n increment_position_of_higher_items\n set_top_position\n end\n end",
"def swap\n\t\t\ta = pop\n\t\t\tb = pop\n\t\t\tpush a\n\t\t\tpush b\n\t\tend",
"def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end",
"def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end",
"def swap(v)\n r = pop\n push(v)\n r\n end",
"def reorder\n sibs = siblings\n return if sibs.empty?\n sibs.each do |s|\n if self.ranking >= s.ranking\n self.move_to_left_of(s) and return\n end\n end\n self.move_to_right_of(sibs.last)\n end",
"def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} + 1)\", \"#{:position} < #{send(:position).to_i}\"\n )\n end",
"def move_next\n\t\tself.current = self.current&.next\n\tend",
"def move_next\n\t\tself.current = self.current&.next\n\tend",
"def move_lower\n return unless lower_item\n\n acts_as_list_class.transaction do\n if lower_item.current_position != current_position\n swap_positions_with(lower_item)\n else\n lower_item.decrement_position\n increment_position\n end\n end\n end",
"def move_later\n nekst = self.next\n self.append_to(nekst) if nekst\n end",
"def move_to_top\n # return unless in_list?\n acts_as_list_class.transaction do\n # increment_positions_on_higher_items\n in_list? ? increment_positions_on_higher_items : increment_positions_on_all_items\n assume_top_position\n end\n end",
"def sift_down(current_idx, end_idx, heap)\n child_one_idx = current_idx * 2 + 1\n while child_one_idx <= end_idx\n child_two_idx = -1\n if (current_idx * 2 + 2) <= end_idx\n child_two_idx = current_idx * 2 + 2\n end\n\n if child_two_idx != -1 && heap[child_two_idx] < heap[child_one_idx]\n idx_to_swap = child_two_idx\n else\n idx_to_swap = child_one_idx\n end\n\n if heap[idx_to_swap] < heap[current_idx]\n self.swap(current_idx, idx_to_swap, heap)\n current_idx = idx_to_swap\n child_one_idx = current_idx * 2 + 1\n else\n break\n end\n end\n \n end",
"def down!\n swap_with(self.next) unless last?\n end",
"def move_lower\n low_item = lower_item\n return unless low_item\n\n low_item.decrement_position\n increment_position\n end",
"def move_lower\n low_item = lower_item\n return unless low_item\n\n low_item.decrement_position\n increment_position\n end",
"def decrement_positions_on_lower_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} - 1)\", \"#{:position} > #{send(:position).to_i}\"\n )\n end",
"def sift_down(array, index, order)\n value = array[index]\n while order > 1\n right_index = index - 1\n left_index = right_index - LEONARDO_NUMS[order - 2]\n break if value >= array[left_index] && value >= array[right_index]\n\n if array[left_index] <= array[right_index]\n array[index] = array[right_index]\n index = right_index\n order -= 2\n else\n array[index] = array[left_index]\n index = left_index\n order -= 1\n end\n end\n array[index] = value\nend",
"def method(x)\r\n swapped = true\r\n while swapped == true\r\n swapped = false\r\n (x.length-1).times do |i|\r\n if x[i] > x[i+1]\r\n x[i], x[i+1] = x [i+1], x[i]\r\n swapped = true\r\n end\r\n end \r\n end \r\n x \r\nend",
"def swap\n push(pop, pop)\n end",
"def swap_node_position(higher_node, lower_node)\n temp_element_title = higher_node.title\n temp_element_rating = higher_node.rating\n higher_node.title = lower_node.title\n higher_node.rating = lower_node.rating\n lower_node.title = temp_element_title\n lower_node.rating = temp_element_rating\n lower_node\n end",
"def move_to_top\n return unless in_list?\n acts_as_list_class.transaction do\n increment_positions_on_higher_items\n assume_top_position\n end\n end",
"def move_lower\n lower = lower_item\n return unless lower\n acts_as_list_class.transaction do\n self.update_attribute(position_column, lower.send(position_column))\n lower.decrement_position\n end\n end",
"def pop\n @insert_point -= 1\n if (@insert_point < 0)\n return nil\n end\n check = @items[0]\n\n rc = pop_sync(check)\n new_head = @items[@insert_point]\n new_head.index = 0\n @items[0] = new_head\n @items[@insert_point] = nil\n\n # Rearrange the neighbor nodes and recalculate their attribs\n check.next_link.prev_link = check.prev_link\n check.prev_link.next_link = check.next_link\n check.next_link.recalculate\n check.prev_link.recalculate\n\n # Rearrange the heap\n heapify(0)\n heapify(check.next_link.index)\n heapify(check.prev_link.index)\n\n return rc\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end",
"def shuffle_positions_on_intermediate_items(old_position, new_position, avoid_id = nil)\n return if old_position == new_position\n scope = acts_as_list_list\n\n if avoid_id\n scope = scope.where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", avoid_id)\n end\n\n if old_position < new_position\n # Decrement position of intermediate items\n #\n # e.g., if moving an item from 2 to 5,\n # move [3, 4, 5] to [2, 3, 4]\n items = scope.where(\n \"#{quoted_position_column_with_table_name} > ?\", old_position\n ).where(\n \"#{quoted_position_column_with_table_name} <= ?\", new_position\n )\n\n if sequential_updates?\n items.reorder(acts_as_list_order_argument(:asc)).decrement_sequentially\n else\n items.decrement_all\n end\n else\n # Increment position of intermediate items\n #\n # e.g., if moving an item from 5 to 2,\n # move [2, 3, 4] to [3, 4, 5]\n items = scope.where(\n \"#{quoted_position_column_with_table_name} >= ?\", new_position\n ).where(\n \"#{quoted_position_column_with_table_name} < ?\", old_position\n )\n\n if sequential_updates?\n items.reorder(acts_as_list_order_argument(:desc)).increment_sequentially\n else\n items.increment_all\n end\n end\n end",
"def move_to_bottom\n # return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items if in_list?\n assume_bottom_position\n end\n end",
"def shift_down\n @question = Question.find(params[:id])\n if @question == @question.survey.questions.order('arbitrary_sort DESC').first\n # already the lowest it can be\n else\n @swapped_question = @question.survey.questions.where(['arbitrary_sort > :arbitrary_id', { arbitrary_id: @question.arbitrary_sort }]).order('arbitrary_sort ASC').first\n # 3 place swap\n @temp = @swapped_question.arbitrary_sort\n @swapped_question.arbitrary_sort = @question.arbitrary_sort\n @question.arbitrary_sort = @temp\n\n @question.save\n @swapped_question.save\n end\n redirect_to @question.survey\n end",
"def move_lower_in_queue\n return unless lower_item_in_queue\n\n acts_as_queue_class.transaction do\n lower_item_in_queue.decrement_queue_position\n increment_queue_position\n end\n end",
"def move_higher\n movement { self.position -= 1 }\n end",
"def sift_down(current_index, end_index, heap)\n child_one_index = current_index * 2 + 1\n while child_one_index <= end_index\n child_two_index = current_index * 2 + 1 if current_index * 2 + 2 <= end_index\n if child_two_index != -1 && heap[child_two_index] < heap[child_one_index]\n index_to_swap = child_two_index\n else\n index_to_swap = child_one_index\n end\n if heap[index_to_swap] < heap[current_index]\n swap(current_index, index_to_swap, heap)\n current_index = index_to_swap\n child_one_index = current_index * 2 + 1\n else\n break\n end\n end\n end",
"def prioritize(index, position = 1)\n\[email protected](position-1, @items.delete_at(index.to_i-1))\n\t@items[position.to_i-1]\n\t\t\n\tend",
"def go_to_next(base_ary, position)\n ary = (base_ary + [position]).sort.reverse\n idx = ary.index(position)\n base_ary.reverse[idx]\n end",
"def move_up_in_collection!\n weight = self.weight\n\n if previous_item = self.prioritizable_collection.where(['weight > ?', weight]).last\n swap_weight_with_other_item!(previous_item)\n end\n end",
"def decrement_position\n return unless in_list?\n set_list_position(current_position - 1)\n end",
"def swap_order(index1, index2)\n @positions[index1], @positions[index2] = @positions[index2], @positions[index1]\n $game_player.refresh\n end",
"def shift_up\n @question = Question.find(params[:id])\n if @question == @question.survey.questions.order('arbitrary_sort ASC').first\n # already the highest it can be\n else\n @swapped_question = @question.survey.questions.where(['arbitrary_sort < :arbitrary_id', { arbitrary_id: @question.arbitrary_sort }]).order('arbitrary_sort DESC').first\n # 3 place swap\n @temp = @swapped_question.arbitrary_sort\n @swapped_question.arbitrary_sort = @question.arbitrary_sort\n @question.arbitrary_sort = @temp\n\n @question.save\n @swapped_question.save\n end\n redirect_to @question.survey\n end",
"def flipflop!\n\t\tif size > 1\n\t\t\ta, b = shift, pop\n\t\t\tunshift(b); push(a)\n\t\tend\n\tend",
"def move_to_bottom\n self.class.transaction do\n decrement_position_of_lower_items\n set_bottom_position\n end\n end",
"def swap; end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position\n end",
"def reposition_queue\n task_queue = TaskQueue.where(user_id: user_id, task_type_id: task_type_id)\n if task_queue.pluck(:position).any? {|pos| pos > position}\n task_queue.where(\"position > ?\", position).each do |queue_item|\n queue_item.update(:position => (queue_item.position - 1))\n end\n end\n end",
"def decrement_positions_on_higher_items(position)\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} <= ?\", position).decrement_all\n end",
"def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} < ?\", current_position).increment_all\n end",
"def test_swap_with_next\n element_d = @rbtree.fetch_element(\"d\")\n assert_equal(\"d\", element_d.key)\n assert_equal(\"D\", element_d.value)\n assert_equal false, element_d.swap_with_next # Fail - no successor\n assert_equal(\"d\", element_d.key) # unchanged\n assert_equal(\"D\", element_d.value) # unchanged\n assert_equal 4, @rbtree.size\n assert_equal %w{a b c d}, @rbtree.keys\n assert_equal %w{A B C D}, @rbtree.values\n \n element_c = @rbtree.fetch_element(\"c\")\n assert_equal(\"c\", element_c.key)\n assert_equal(\"C\", element_c.value)\n assert_equal true, element_c.swap_with_next # Success\n assert_equal(\"d\", element_c.key) # swapped\n assert_equal(\"D\", element_c.value) # swapped\n element_d = element_c.next\n assert_equal(\"c\", element_d.key) # swapped\n assert_equal(\"C\", element_d.value) # swapped\n assert_nil element_d.next\n element_b = element_c.prev\n assert_equal(\"b\", element_b.key) # still there\n assert_equal(\"B\", element_b.value) # still there\n assert_equal 4, @rbtree.size\n assert_equal %w{a b d c}, @rbtree.keys\n assert_equal %w{A B D C}, @rbtree.values\n # NOTE: tree is now totally screwed up. If you try to search on C, you won't find it!\n \n element_a = @rbtree.fetch_element(\"a\")\n assert_equal(\"a\", element_a.key)\n assert_equal(\"A\", element_a.value)\n assert_equal true, element_a.swap_with_next # Success\n assert_equal(\"b\", element_a.key) # swapped\n assert_equal(\"B\", element_a.value) # swapped\n element_b = element_a.next\n assert_equal(\"a\", element_b.key) # swapped\n assert_equal(\"A\", element_b.value) # swapped\n assert_nil element_a.prev\n element_c = element_b.next\n assert_equal(\"d\", element_c.key) # still there; value changed because of the swap we did above\n assert_equal(\"D\", element_c.value) # still there; value changed because of the swap we did above\n assert_equal 4, @rbtree.size\n assert_equal %w{b a d c}, @rbtree.keys\n assert_equal %w{B A D C}, @rbtree.values\n # NOTE: tree is now totally screwed up. If you try to search on A, you won't find it!\n end",
"def swap_elements_from_to(array, index, destination_index)\n array[index], array[destination_index] = array[destination_index], array[index]\n array\nend",
"def decrement_positions_on_lower_items(position=current_position)\n return unless in_list?\n\n if sequential_updates?\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} > ?\", position).reorder(acts_as_list_order_argument(:asc)).decrement_sequentially\n else\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} > ?\", position).decrement_all\n end\n end",
"def swap_elements_from_to(array, index, destination_index)\n array[index], array[destination_index] = array[destination_index], array[index]\n array\nend",
"def swap_elements(array)\n move = array[1]\n array[1] = array[2]\n array[2] = move\n array\nend",
"def swap_pass\n self.to_enum.with_index.each do |elt, index|\n best_swap_index = index\n best_interval_length = self.interval_length\n self.to_enum.with_index.each do |swapper, swapdex|\n # Test the array out with the current element ``elt`` and ``swapper`` switched\n self[index] = swapper\n self[swapdex] = elt\n interval_length = self.interval_length\n\n if interval_length < best_interval_length\n best_interval_length = interval_length\n best_swap_index = swapdex\n end\n\n # change the array back to how it originally was\n self[index] = elt\n self[swapdex] = swapper\n end\n # Having tested every element, we know where to place ``elt`` to minimize the interval\n self[index] = self[best_swap_index]\n self[best_swap_index] = elt\n end\n end",
"def move_to_bottom\n return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end",
"def swap_elements(array, index = 1, destination_index = 2)\n array[index], array[destination_index] = array[destination_index], array[index]\n\n array\nend",
"def swap(arr, x, y)\n aux = arr[x]\n arr[x] = arr[y]\n arr[y] = aux\n nil\nend",
"def swap_elements(array)\n array.insert(1, array.delete_at(2))\nend",
"def swap_elements(array)\n array.insert(1,array.delete_at(2))\nend",
"def place!(val, &block)\n pos = nil\n orig_size = self.size\n block ||= lambda{|a, b| a <=> b}\n self.each_with_index do |e, i|\n if block.call(e, val) == 1\n pos = i\n break\n end\n end\n return nil unless pos\n self.insert(pos, val)\n while self.size > orig_size\n self.pop\n end\n val\n end",
"def decrement_positions_on_higher_items(position)\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} - 1)\", \"#{scope_condition} AND #{position_column} <= #{position}\") \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} - 1)\", \"#{position_column} <= #{position}\")\n end \n end",
"def swap!(a, b) self[a], self[b] = self[b], self[a]; self; end",
"def swapper(arr, idx_1, idx_2)\n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend",
"def swap_if_needed(value, bucket)\n return value if table[bucket] == TOMBSTONE_MARKER\n\n if amount_displaced(value, bucket) < amount_displaced(table[bucket], bucket)\n puts \"Doing Robin Hood swapping.\"\n value, table[bucket] = table[bucket], value\n end\n\n value\n end",
"def bubble_up(index, node)\n while (index!=0 && @ary[(index-1)/2].key > node.key) #while parent is bigger,\n @ary[index], @ary[(index-1)/2] = @ary[(index-1)/2], @ary[index] #swap\n index = (index-1)/2\n end\n end",
"def bubble_sort_by items\n\tn = items.length\n\tswaped = true\n\twhile swaped do\n\t\tswaped = false\n for i in (1..n-1)\n \tif yield(items[i], items[i-1])\n \t\titems = swap items, i-1, i\n \t\tswaped = true\n \tend # end if\n end# end for\n n-=1\n end #end until\n items\nend",
"def decrement_position\n return unless in_list?\n update_attribute :position, self.send(:position).to_i - 1\n end",
"def sift_up(current_idx, heap)\n parent_idx = (current_idx - 1) / 2\n while current_idx > 0 && heap[current_idx] < heap[parent_idx]\n self.swap(current_idx, parent_idx, heap)\n current_idx = parent_idx\n parent_idx = (current_idx - 1) / 2\n end\n end",
"def reverse!\n low = 0\n high = self.__size - 1\n while low < high\n a = self.__at(low)\n b = self.__at(high)\n self.__at_put(high, a)\n self.__at_put(low, b)\n low = low + 1\n high = high - 1\n end\n self\n end",
"def pop\n\t\tif @pos <= 0\n\t\t\traise RuntimeError.exception @errormessage\n\t\tend\n\t\t\n\t\tret = values[0]\n\t\t\n\t\t@pos -= 1\n\t\tx = values[@pos]\n\t\t\n\t\ti = 0\n\t\twhile i*2+1 < @pos\n\t\t\tl, r = i*2+1, i*2+2\n\t\t\t\n\t\t\tl = r if r < @pos and values[r] < values[l]\n\t\t\t\n\t\t\tbreak if values[l] >= x\n\t\t\t\n\t\t\tvalues[i] = values[l]\n\t\t\ti = l\n\t\tend\n\t\t\n\t\tvalues[i] = x\n\t\tret\n\tend",
"def moveto_next\n return if @range.empty?\n if index = @range.index(self.pos)\n @index = index\n end\n @index += 1\n @index %= @range.size\n moveto @range[@index]\n end",
"def bump(index, position = 1)\n @items.insert(position-1, @items.delete_at(index.to_i-1))\n save\n @items[position.to_i-1]\n end",
"def move_up\n @array[0...XSIZE].each_with_index { |e, x| yield e } if block_given?\n @array = @array[XSIZE..-1].concat(@array[0...XSIZE])\n end",
"def swapper(arr, idx_1, idx_2)\n \n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend",
"def swapper(arr, idx_1, idx_2)\n \n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend",
"def shift_right\n self.unshift(self.pop)\n end",
"def swapper(arr, idx1, idx2)\n arr[idx1], arr[idx2] = arr[idx2], arr[idx1]\n arr\nend",
"def heapify_down(custom_start_index = 0)\n current_index = custom_start_index\n next_index = nil\n while(self.has_left_child(current_index))\n if(\n self.has_right_child(current_index) && \n self.pair_is_in_correct_order(self.get_right_child_index(current_index), self.get_left_child_index(current_index)))\n \n next_index = self.get_right_child_index(current_index)\n else\n next_index = self.get_left_child_index(current_index)\n end\n \n break if(self.pair_is_in_correct_order(current_index, next_index))\n self.swap(current_index, next_index)\n current_index = next_index\n end\n end",
"def swap_values_at i, j\n value_i = @heap[i]\n value_j = @heap[j]\n\n @heap[i] = value_j\n @heap[j] = value_i\n\n map_swap(value_i, value_j, i, j)\n end",
"def swap_elements_from_to(array, index, destination_index)\n array[index], array[destination_index] = array[destination_index], array[index]\n return array\nend",
"def sift_up(current_index, heap)\n parent_index = (current_index - 1) / 2\n while current_index > 0 && heap[current_index] < heap[parent_index]\n self.swap(current_index, parent_index, heap)\n current_index = parent_index\n parent_index = (current_index - 1) / 2\n end\n end",
"def bubble_down(index)\n left = index*2+1 #left child\n right = index*2+2 #right child\n\n smaller_child_index = pick_smaller(left, right)\n\n while (smaller_child_index!=nil && @ary[smaller_child_index].key < @ary[index].key)\n\n @ary[index], @ary[smaller_child_index] = @ary[smaller_child_index], @ary[index] #swap\n\n index = smaller_child_index\n left = index*2+1 #left child\n right = index*2+2 #right child\n smaller_child_index = pick_smaller(left, right)\n\n end\n end",
"def move_to_bottom\n return unless in_list?\n insert_at_position bottom_position_in_list.to_i\n end",
"def sift_down(i)\n child = (i * 2) + 1\n return if child >= @heap.length\n child += 1 if child + 1 < @heap.length and @heap[child] > @heap[child+1]\n if @heap[i] > @heap[child]\n @heap[child], @heap[i] = @heap[i], @heap[child]\n sift_down(child)\n end\n end",
"def swapper(arr, idx_1, idx_2)\n temp = arr[idx_1]\n arr[idx_1] = arr[idx_2] # as soon as I execute this line, it will be [\"c\", \"b\", \"c\", \"d\"]\n arr[idx_2] = temp # then, I excute this line, then it will be [\"c\", \"b\", \"c\", \"d\"], which is wrong!\n arr\n\nend",
"def swap_elements(a)\n a[0], a[1], a[2] = a[0], a[2], a[1]\nend",
"def swap_elements_from_to(arr, index, dest_index)\n arr[index], arr[dest_index] = arr[dest_index], arr[index] \n arr\nend",
"def rank_up\n current_belt_idx = POSSIBLE_BELTS.find_index(@belt)\n @belt = POSSIBLE_BELTS[current_belt_idx + 1]\n end",
"def bubble_up(i)\n while i > 0\n parent = (i+1) / 2 - 1\n if @contents[parent].key >= @contents[i].key then\n @contents[parent],@contents[i] = @contents[i],@contents[parent]\n i = parent\n else return\n end\n end\n end",
"def bubble_sort_by(arr)\n loop do\n swapped = false; index = 0\n while index < arr.length - 1\n first = arr[index]; second = arr[index + 1]; swap = yield(first, second)\n (swap_var = arr[index]; arr[index] = arr[index + 1];\n arr[index + 1] = swap_var; swapped = true) if swap.positive?; index += 1\n end\n break if swapped == false\n end\n arr\nend",
"def shift_down_next_tasks\n return if next_associated_tasks.empty?\n\n # Shift down next task order_index starting\n # from the current index if the current object is deleted\n # from the next index if the current object exists\n new_order = destroyed? ? order_index : order_index + 1\n\n next_associated_tasks.each do |task|\n task.update_columns(order_index: new_order)\n new_order += 1\n end\n end",
"def pop\n item = @first.val\n @first = @first.next\n @last = nil if(@first == nil)\n @size -= 1\n item\n end"
] | [
"0.768778",
"0.75485796",
"0.75485796",
"0.7510956",
"0.7440676",
"0.6979976",
"0.67730665",
"0.6720234",
"0.66571563",
"0.66489387",
"0.6485785",
"0.63742876",
"0.63581955",
"0.63233906",
"0.6306851",
"0.6306851",
"0.6295075",
"0.62842023",
"0.627841",
"0.6263418",
"0.6263418",
"0.61837626",
"0.6176291",
"0.6162315",
"0.61600137",
"0.6158733",
"0.61537075",
"0.61537075",
"0.6150686",
"0.6131148",
"0.6125097",
"0.61033785",
"0.6099307",
"0.6067986",
"0.605838",
"0.6032478",
"0.6018344",
"0.6000973",
"0.5991138",
"0.59898114",
"0.5974424",
"0.59716",
"0.5948745",
"0.59473825",
"0.59143794",
"0.59113324",
"0.59044456",
"0.5902658",
"0.58730984",
"0.58698976",
"0.5867915",
"0.5863828",
"0.585908",
"0.5858852",
"0.58535177",
"0.5849566",
"0.58474684",
"0.5843671",
"0.58354354",
"0.5833526",
"0.58312404",
"0.5827602",
"0.58068806",
"0.5806396",
"0.58034664",
"0.5801959",
"0.5800956",
"0.58001",
"0.5790292",
"0.57859224",
"0.5784137",
"0.5781652",
"0.5773341",
"0.57728875",
"0.57641894",
"0.57638836",
"0.5760461",
"0.5759172",
"0.5751741",
"0.574728",
"0.5743179",
"0.57400787",
"0.57400787",
"0.57397556",
"0.57376236",
"0.5730071",
"0.57299674",
"0.5727548",
"0.5723643",
"0.5721155",
"0.5720888",
"0.5712721",
"0.57037115",
"0.5699036",
"0.56859726",
"0.56809",
"0.56799644",
"0.5679862",
"0.5671623",
"0.5669826"
] | 0.752773 | 3 |
Move to the bottom of the list. If the item is already in the list, the items below it have their position adjusted accordingly. | def move_to_bottom
return unless in_list?
acts_as_list_class.transaction do
decrement_positions_on_lower_items
assume_bottom_position
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end",
"def move_to_bottom\n # return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items if in_list?\n assume_bottom_position\n end\n end",
"def move_to_bottom\n return unless in_list?\n insert_at_position bottom_position_in_list.to_i\n end",
"def move_to_bottom\n self.class.transaction do\n decrement_position_of_lower_items\n set_bottom_position\n end\n end",
"def move_to_bottom\n return true if at_bottom?\n move_below(last_sibling_in_list)\n end",
"def assume_bottom_position\n set_list_position(bottom_position_in_list(self).to_i + 1)\n end",
"def move_to_bottom\n return if self == self_and_siblings(true).last\n move_to(self_and_siblings.last.position_in_list)\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1 \n set_my_position(pos)\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1\n set_my_position(pos)\n end",
"def add_to_bottom\n self.position = bottom + 1\n end",
"def assume_bottom_position\n update_attribute(:position, bottom_position_in_list(self).to_i + 1)\n end",
"def move_to_bottom\n last_sib = last_sibling\n move_to_right_of(last_sib) if last_sib && self != last_sib\n end",
"def bottom_item\n @current = last\n\n items\n end",
"def move_to_bottom_in_queue\n return unless in_queue?\n acts_as_queue_class.transaction do\n decrement_queue_positions_on_lower_items\n assume_bottom_queue_position\n end\n end",
"def move_to_bottom\n @item.move_to_bottom\n flash[:notice] = t(:moved_to_bottom, :thing => \"item\")\n redirect\n end",
"def move_higher\n return if position_in_list == 1\n move_to(position_in_list - 1)\n end",
"def insert_at_bottom\n assume_bottom_position\n end",
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n higher_item.increment_position\n decrement_position\n end\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.current_position : acts_as_list_top - 1\n end",
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n if higher_item.current_position != current_position\n swap_positions_with(higher_item)\n else\n higher_item.increment_position\n decrement_position\n end\n end\n end",
"def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end",
"def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end",
"def move_to_top\n return unless in_list?\n acts_as_list_class.transaction do\n increment_positions_on_higher_items\n assume_top_position\n end\n end",
"def assume_bottom_position\n update_attribute(position_column, bottom_position_in_list(self).to_i + 1)\n end",
"def move_to_bottom(klass)\n remove(klass)\n self.instance.add(klass)\n end",
"def move_to_top\n return unless in_list?\n insert_at_position acts_as_list_top\n end",
"def move_higher\n higher = higher_item\n return unless higher\n acts_as_list_class.transaction do\n self.update_attribute(position_column, higher.send(position_column))\n higher.increment_position\n end\n end",
"def move_to_bottom(tag, klass)\n remove(tag, klass)\n self.instance.add(tag, klass)\n end",
"def move_to_top\n # return unless in_list?\n acts_as_list_class.transaction do\n # increment_positions_on_higher_items\n in_list? ? increment_positions_on_higher_items : increment_positions_on_all_items\n assume_top_position\n end\n end",
"def move_to_top\n return if position_in_list == 1\n move_to(1)\n end",
"def move_down\n return if at_bottom?\n self.class.where(:position => self.position + 1).first.inc(:position, -1)\n inc(:position, 1)\n end",
"def move_to_bottom_of(node)\n movement(node, :strict => true) do |to|\n self.left_sibling = to.target.record\n end\n end",
"def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} + 1)\", \"#{:position} < #{send(:position).to_i}\"\n )\n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.increment_position\n decrement_position\n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.increment_position\n decrement_position\n end",
"def bottom_position_in_list(_except = nil)\n item = bottom_item # (except)\n item ? item.my_position : 0\n end",
"def move_to_top\n self.class.transaction do\n increment_position_of_higher_items\n set_top_position\n end\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.send(:position) : 0\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item #(except)\n item ? item.my_position : 0\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.send(position_column) : 0\n end",
"def add_card_to_bottom(card)\n unless self.id.nil? or (card.deck_id == self.id and card.card_order == 1)\n # Decrese the orders for the cards above in the old deck\n if card.deck_id\n card.deck.cards.where(\"card_order > ?\", card.card_order).each do |r|\n r.update_attributes(card_order: (r.card_order-1) )\n end\n end\n # Increase the orders for cards above in the new deck\n cards.each do |r|\n r.update_attributes(card_order: (r.card_order+1) )\n end\n # Add the card to the bottom of the new deck\n card.update_attributes(deck_id: id, card_order: 1)\n end\n end",
"def assume_bottom_queue_position\n update_attribute(queue_position_column, bottom_queue_position_in_queue(self).to_i + 1)\n end",
"def decrement_position\n return unless in_list?\n set_list_position(current_position - 1)\n end",
"def bottom_item(except = nil)\n conditions = \"#{self.class.primary_key} != #{except.id}\" if except\n acts_as_list_class.find(:first, :conditions => conditions, :order => \"#{:position} DESC\")\n end",
"def bottom_item(except = nil)\n scope = acts_as_list_list\n\n if except\n scope = scope.where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", except.id)\n end\n\n scope.in_list.reorder(acts_as_list_order_argument(:desc)).first\n end",
"def move_to_position(new_position)\n old_position = self.send(position_column)\n unless new_position == old_position\n if new_position < old_position\n # Moving higher in the list (up) \n new_position = [1, new_position].max\n increment_positions_between(new_position, old_position - 1)\n else\n # Moving lower in the list (down)\n new_position = [bottom_position_in_list(self).to_i, new_position].min\n decrement_positions_between(old_position + 1, new_position)\n end\n self.update_attribute(position_column, new_position)\n end\n end",
"def add_bottom (card)\n @cards.unshift(card);\n end",
"def bottom_item(except = nil)\n # conditions = scope_condition\n # conditions = \"#{conditions} AND #{self.class.primary_key} != #{except.id}\" if except\n # acts_as_list_class.find(:first, :conditions => conditions, :order => \"#{position_column} DESC\")\n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n conditions = except.nil?() ? \"\" : \"#{self.class.primary_key} != #{except.id}\" \n where(conditions).order(\"#{position_column} DESC\").first\n end \n end",
"def decrement_positions_on_lower_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} - 1)\", \"#{:position} > #{send(:position).to_i}\"\n )\n end",
"def accept_list_item_end(list_item)\n @in_list_entry[-1] = list_end_for(@list.last)\n end",
"def move_up\n return if at_top?\n self.class.where(:position => self.position - 1).first.inc(:position, 1)\n inc(:position, -1)\n end",
"def bump(index, position = 1)\n @items.insert(position-1, @items.delete_at(index.to_i-1))\n save\n @items[position.to_i-1]\n end",
"def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} < ?\", current_position).increment_all\n end",
"def last_position_in_list\n return nil unless in_list?\n bottom_position_in_list\n end",
"def pad_bottom(y)\n yield\n move_down(y)\n end",
"def increment_position\n return unless in_list?\n set_list_position(current_position + 1)\n end",
"def insert_after(item, object)\n # raises IndexOutOfBoundsException if index is out of bounds [0, @length)\n # TODO\n end",
"def bottom_item(except = nil)\n conditions = scope_condition\n if except\n conditions.merge!(\"i.#{position_key} <>\" => except.my_position)\n end\n\n order_by_position(conditions).last\n end",
"def deleteItem(position)\n if position >= 0 && position < @list_size\n # Adjust the list\n @item = @item[0...position] + @item[position+1..-1]\n @item_len = @item_len[0...position] + @item_len[position+1..-1]\n @item_pos = @item_pos[0...position] + @item_pos[position+1..-1]\n\n self.setViewSize(@list_size - 1)\n\n if @list_size > 0\n self.resequence\n end\n\n if @list_size < self.maxViewSize\n @win.werase # force the next redraw to be complete\n end\n\n # do this to update the view size, etc\n self.setPosition(@current_item)\n end\n end",
"def update_position\n if scope_changed?\n decrement(all_next_was)\n if range.include?(position)\n reorder(position_was, position)\n else\n add_to_bottom\n end\n else\n if range.include?(position)\n reorder(position_was, position)\n else\n self.position = position_was # Keep original position\n end\n end\n end",
"def snap_to_bottom_of( sibling_view )\n new_y = sibling_view.frame.origin.y - self.height\n self.frame = CGRectMake(self.frame.origin.x, new_y, self.width, self.height)\n end",
"def increment_positions_on_higher_items\n # return unless in_list?\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{scope_condition} AND #{position_column} < #{send(position_column).to_i}\") \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{position_column} < #{send(position_column).to_i}\")\n end \n end",
"def bottom_item(except = nil)\n except ? siblings.reject{|page| page == self }.last : siblings.last\n end",
"def decrement_position\n return unless in_list?\n update_attribute :position, self.send(:position).to_i - 1\n end",
"def bottom_item(except = nil)\n conditions = scope_condition\n if except\n conditions.merge!( { position_key.ne => except.my_position } )\n end\n\n order_by_position(conditions).last\n end",
"def last?\n return false unless in_list?\n bottom_pos = bottom_position_in_list\n my_position == bottom_pos\n end",
"def last?\n return false unless in_list?\n bottom_pos = bottom_position_in_list\n my_position == bottom_pos\n end",
"def remove_from_list\n return unless in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end",
"def move_later\n nekst = self.next\n self.append_to(nekst) if nekst\n end",
"def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end\n end",
"def move_to_top\n return true if at_top?\n move_above(first_sibling_in_list)\n end",
"def move_bottom_action\n post1 = Post.find(params[:post_id].to_i)\n post2 = Post.order(\"sort_id ASC\").first\n if post1 && post2\n post1.sort_id = post2.sort_id - 1\n post1.save!\n end\n return redirect_to \"/admin\"\n end",
"def move_lower\n return unless lower_item\n\n acts_as_list_class.transaction do\n if lower_item.current_position != current_position\n swap_positions_with(lower_item)\n else\n lower_item.decrement_position\n increment_position\n end\n end\n end",
"def move_lower\n lower = lower_item\n return unless lower\n acts_as_list_class.transaction do\n self.update_attribute(position_column, lower.send(position_column))\n lower.decrement_position\n end\n end",
"def align_bottom\n @vertical_align = :bottom\n return self\n end",
"def bottom(value)\n @ole.Bottom = value\n nil\n end",
"def bottom(value)\n @ole.Bottom = value\n nil\n end",
"def push(item)\n\t @items.push(item)\n\t # add to the maximum if the maximum is empty \n\t # or the newest item is greater than the old maximum\n\t @max.push(item) if @max.empty? || item >= @max.last\n\tend",
"def page_down_to_bottom_of_scroll_bar\n scroll_down_one_page while vertical_scroll_percent < 99.99\n end",
"def last?\n # return false unless in_list?\n self.send(position_column) == bottom_position_in_list\n end",
"def move_higher_in_queue\n return unless higher_item_in_queue\n\n acts_as_queue_class.transaction do\n higher_item_in_queue.increment_queue_position\n decrement_queue_position\n end\n end",
"def test_moving\n item = QuotedList.first\n item.higher_items\n item.lower_items\n item.send :bottom_item # Part of private api\n end",
"def swap_with_next i\n #if first_item >= first_item.next_list_item\n\n end",
"def end_item\n @p.end_item(self)\n end",
"def move_to_bottom_on_unarchive\n if self.just_unarchived\n self.just_unarchived = false\n self.move_to_bottom if self.respond_to?(:move_to_bottom)\n end\n return true\n end",
"def push_last(value)\n @driver_instance.push_list_last(@key, value)\n end",
"def decrement_positions_on_lower_items(position=current_position)\n return unless in_list?\n\n if sequential_updates?\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} > ?\", position).reorder(acts_as_list_order_argument(:asc)).decrement_sequentially\n else\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} > ?\", position).decrement_all\n end\n end",
"def decrement_positions_on_higher_items(position)\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} - 1)\", \"#{scope_condition} AND #{position_column} <= #{position}\") \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} - 1)\", \"#{position_column} <= #{position}\")\n end \n end",
"def goto_bottom\n if y < battlefield_height - 61\n accelerate 1\n else\n @at_bottom = true\n end\n end",
"def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_list_position(nil)\n end\n end",
"def insert_after(index, *items)\n items.each_with_index do |item, i|\n self.insert(index + i + 1, item)\n end\n self\n end",
"def push(item)\n @items.push(item)\n @max.push(item) if [email protected] || item > @max.last\n end",
"def bottom_queue_position_in_queue(except = nil)\n item = bottom_item_in_queue(except)\n item ? item.send(queue_position_column) : 0\n end",
"def decrement_position\n return unless in_list?\n\n # self_class_all_or_in_collection.where(:pos => my_position).\n adjust_position!(-1)\n end",
"def move_to_top\n @item.move_to_top\n flash[:notice] = t(:moved_to_top, :thing => \"item\")\n redirect\n end",
"def clear_for_new_position\n end_of_list = fund_grant.fund_items.maximum( :position )\n unless end_of_list && end_of_list < position\n fund_grant.fund_items.where { |i| i.id != id }.\n where { |i| i.position >= position }.update_all(\n 'fund_items.position = fund_items.position + 1' )\n end\n true\n end",
"def accept_list_item_end list_item\n width = case @list_type.last\n when :BULLET then\n 4\n when :NOTE, :LABEL then\n use_prefix\n\n 4\n else\n @list_index[-1] = @list_index.last.succ\n 4\n end\n\n @indent -= width\n end",
"def move_below(other)\n if position > other.position\n new_position = other.position + 1\n other.lower_siblings.where(:position.lt => self.position).each { |s| s.inc(:position, 1) }\n self.position = new_position\n save!\n else\n new_position = other.position\n other.higher_siblings.where(:position.gt => self.position).each { |s| s.inc(:position, -1) }\n other.inc(:position, -1)\n self.position = new_position\n save!\n end\n end",
"def fit_to_bottom_of( sibling_view )\n new_height = sibling_view.frame.origin.y - self.frame.origin.y\n self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.width, new_height)\n end"
] | [
"0.89545804",
"0.89390266",
"0.8729667",
"0.8696749",
"0.8179114",
"0.8084895",
"0.7987429",
"0.7786934",
"0.7624863",
"0.7589462",
"0.7485386",
"0.73781663",
"0.71489966",
"0.7095753",
"0.7079211",
"0.70756894",
"0.7026675",
"0.69410986",
"0.6854394",
"0.6850265",
"0.6785297",
"0.67786235",
"0.67786235",
"0.676425",
"0.67350864",
"0.6711289",
"0.6692584",
"0.6620237",
"0.6583924",
"0.65610087",
"0.6558225",
"0.6501762",
"0.6399783",
"0.63958865",
"0.63796824",
"0.63796824",
"0.62896377",
"0.6271912",
"0.6235301",
"0.6228173",
"0.61758727",
"0.61378497",
"0.61017656",
"0.60965496",
"0.6093367",
"0.6039757",
"0.60274976",
"0.5957927",
"0.5932835",
"0.59310853",
"0.59143764",
"0.584766",
"0.58357596",
"0.5827641",
"0.58262545",
"0.5790277",
"0.57652855",
"0.5763234",
"0.57587403",
"0.56827664",
"0.5665388",
"0.5609398",
"0.5590689",
"0.5586986",
"0.55738884",
"0.5572069",
"0.5558259",
"0.5558259",
"0.55447614",
"0.55445683",
"0.5539048",
"0.5538451",
"0.5526379",
"0.5516883",
"0.5471484",
"0.54328316",
"0.5422831",
"0.5422831",
"0.54209554",
"0.5417528",
"0.5407767",
"0.54071814",
"0.53891766",
"0.53884256",
"0.53604996",
"0.53578365",
"0.535078",
"0.53453404",
"0.5339502",
"0.5337587",
"0.5328179",
"0.53270185",
"0.52883816",
"0.5282801",
"0.5278889",
"0.52758163",
"0.5266654",
"0.52537185",
"0.52490616",
"0.5246706"
] | 0.8816438 | 2 |
Move to the top of the list. If the item is already in the list, the items above it have their position adjusted accordingly. | def move_to_top
return unless in_list?
acts_as_list_class.transaction do
increment_positions_on_higher_items
assume_top_position
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end",
"def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end",
"def move_to_top\n return unless in_list?\n insert_at_position acts_as_list_top\n end",
"def move_to_top\n # return unless in_list?\n acts_as_list_class.transaction do\n # increment_positions_on_higher_items\n in_list? ? increment_positions_on_higher_items : increment_positions_on_all_items\n assume_top_position\n end\n end",
"def move_to_top\n return if position_in_list == 1\n move_to(1)\n end",
"def move_to_top\n self.class.transaction do\n increment_position_of_higher_items\n set_top_position\n end\n end",
"def move_to_top\n return true if at_top?\n move_above(first_sibling_in_list)\n end",
"def assume_top_position\n set_list_position(acts_as_list_top)\n end",
"def move_lower\n return unless lower_item\n\n acts_as_list_class.transaction do\n if lower_item.current_position != current_position\n swap_positions_with(lower_item)\n else\n lower_item.decrement_position\n increment_position\n end\n end\n end",
"def move_to_top\n first_sib = first_sibling\n move_to_left_of(first_sib) if first_sib && self != first_sib\n end",
"def move_to_bottom\n return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end",
"def move_to_bottom\n # return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items if in_list?\n assume_bottom_position\n end\n end",
"def check_top_position\n if current_position && !default_position? && current_position < acts_as_list_top\n self[position_column] = acts_as_list_top\n end\n end",
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n higher_item.increment_position\n decrement_position\n end\n end",
"def move_lower\n lower = lower_item\n return unless lower\n acts_as_list_class.transaction do\n self.update_attribute(position_column, lower.send(position_column))\n lower.decrement_position\n end\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end",
"def move_to_top\n @item.move_to_top\n flash[:notice] = t(:moved_to_top, :thing => \"item\")\n redirect\n end",
"def move_to_top_in_queue\n return unless in_queue?\n acts_as_queue_class.transaction do\n increment_queue_positions_on_higher_items\n assume_top_queue_position\n end\n end",
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n if higher_item.current_position != current_position\n swap_positions_with(higher_item)\n else\n higher_item.increment_position\n decrement_position\n end\n end\n end",
"def move_higher\n higher = higher_item\n return unless higher\n acts_as_list_class.transaction do\n self.update_attribute(position_column, higher.send(position_column))\n higher.increment_position\n end\n end",
"def move_to_bottom\n return unless in_list?\n insert_at_position bottom_position_in_list.to_i\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position\n end",
"def move_lower\n low_item = lower_item\n return unless low_item\n\n low_item.decrement_position\n increment_position\n end",
"def move_lower\n low_item = lower_item\n return unless low_item\n\n low_item.decrement_position\n increment_position\n end",
"def move_to_top(tag, klass)\n self.instance.add(tag, klass, 0)\n end",
"def move_to_top(klass)\n self.instance.add(klass, 0)\n end",
"def lower_item\n return nil unless in_list?\n acts_as_list_class.find(:first, :conditions =>\n \"position = #{(send(:position).to_i + 1).to_s}\"\n )\n end",
"def move_above(sibling = nil)\n if sibling\n return if (!self_and_siblings(true).include?(sibling) || (sibling == self))\n if sibling.position_in_list > position_in_list\n move_to(sibling.position_in_list - 1)\n else\n move_to(sibling.position_in_list)\n end\n else\n move_to_top\n end\n end",
"def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} + 1)\", \"#{:position} < #{send(:position).to_i}\"\n )\n end",
"def move_higher\n return if position_in_list == 1\n move_to(position_in_list - 1)\n end",
"def move_lower\n return if self == self_and_siblings(true).last\n move_to(position_in_list + 1)\n end",
"def move_to_bottom\n self.class.transaction do\n decrement_position_of_lower_items\n set_bottom_position\n end\n end",
"def decrement_positions_on_lower_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} - 1)\", \"#{:position} > #{send(:position).to_i}\"\n )\n end",
"def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end\n end",
"def remove_from_list\n return unless in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end",
"def move_up\n return if at_top?\n self.class.where(:position => self.position - 1).first.inc(:position, 1)\n inc(:position, -1)\n end",
"def assume_bottom_position\n set_list_position(bottom_position_in_list(self).to_i + 1)\n end",
"def increment_position\n return unless in_list?\n set_list_position(current_position + 1)\n end",
"def assume_top_position\n set_my_position(1)\n end",
"def assume_top_position\n set_my_position(1)\n end",
"def assume_top_position\n update_attribute(:position, 1)\n end",
"def set_top\n self.class.transaction do\n self.class.where(tag_id: self.tag_id).where.not(id: self.id).update_all('`position` = `position` + 1')\n self.update(:position => 0)\n end\n end",
"def add_at_head(val)\n @list.unshift(val)\n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.increment_position\n decrement_position\n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.increment_position\n decrement_position\n end",
"def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} < ?\", current_position).increment_all\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1 \n set_my_position(pos)\n end",
"def swap_with_next i\n #if first_item >= first_item.next_list_item\n\n end",
"def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_list_position(nil)\n end\n end",
"def push(item)\n @stack.unshift(item)\n self.top = @stack[0]\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.current_position : acts_as_list_top - 1\n end",
"def top_item\n @current = 0\n\n items\n end",
"def lower_items(limit=nil)\n limit ||= acts_as_list_list.count\n acts_as_list_list.\n where(\"#{quoted_position_column_with_table_name} >= ?\", current_position).\n where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", self.send(self.class.primary_key)).\n reorder(acts_as_list_order_argument(:asc)).\n limit(limit)\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1\n set_my_position(pos)\n end",
"def prioritize(index, position = 1)\n\[email protected](position-1, @items.delete_at(index.to_i-1))\n\t@items[position.to_i-1]\n\t\t\n\tend",
"def prepend(*args)\n update(*args)\n @list.unshift(args[0])\n end",
"def lower_item\n # return nil unless in_list?\n # acts_as_list_class.find(:first, :conditions => \"#{scope_condition} AND #{position_column} > #{send(position_column).to_s}\", :order => \"#{position_column} ASC\")\n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n where(\"#{position_column} = #{(send(position_column).to_i + 1).to_s}\").first\n end \n end",
"def add_card_to_top(card)\n unless self.id.nil? or (card.deck_id == self.id and card.card_order == get_top_order)\n #Update order of card's current deck\n if card.deck_id\n card.deck.cards.where(\"card_order > ?\", card.card_order).each do |r|\n r.update_attributes(card_order: (r.card_order-1) )\n end\n end\n # Add the card to the top of the new deck\n card.update_attributes(deck_id: id, card_order: (get_top_order+1) )\n end\n end",
"def move_lower_in_queue\n return unless lower_item_in_queue\n\n acts_as_queue_class.transaction do\n lower_item_in_queue.decrement_queue_position\n increment_queue_position\n end\n end",
"def decrement_positions_on_lower_items(position=current_position)\n return unless in_list?\n\n if sequential_updates?\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} > ?\", position).reorder(acts_as_list_order_argument(:asc)).decrement_sequentially\n else\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} > ?\", position).decrement_all\n end\n end",
"def increment_positions_on_lower_items(position)\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{scope_condition} AND #{position_column} >= #{position}\")\n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{position_column} >= #{position}\")\n end \n end",
"def increment_positions_on_lower_items(position, avoid_id = nil)\n scope = acts_as_list_list\n\n if avoid_id\n scope = scope.where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", avoid_id)\n end\n\n if sequential_updates?\n scope.where(\"#{quoted_position_column_with_table_name} >= ?\", position).reorder(acts_as_list_order_argument(:desc)).increment_sequentially\n else\n scope.where(\"#{quoted_position_column_with_table_name} >= ?\", position).increment_all\n end\n end",
"def decrement_position\n return unless in_list?\n set_list_position(current_position - 1)\n end",
"def assume_top_position\n update_attribute(position_column, 1)\n end",
"def insert_before(item, object)\n # raises IndexOutOfBoundsException if index is out of bounds [0, @length)\n # TODO\n end",
"def insert_before(index, *items)\n items.reverse.each do |item|\n self.insert(index, item)\n end\n self\n end",
"def move_up_in_collection!\n weight = self.weight\n\n if previous_item = self.prioritizable_collection.where(['weight > ?', weight]).last\n swap_weight_with_other_item!(previous_item)\n end\n end",
"def assume_bottom_position\n update_attribute(:position, bottom_position_in_list(self).to_i + 1)\n end",
"def assume_top_queue_position\n update_attribute(queue_position_column, 1)\n end",
"def set_top(position, piece)\n if position < 0 || position > 2\n \"Not a valid spot, please put the piece in the 0-2 spot\" \n else\n @top.delete_at(position)\n @top.insert(position, piece)\n end\n end",
"def lower_item\n return nil unless list_id\n Card.find :first,\n :conditions => \"list_id = #{list_id} AND list_position < #{list_position}\",\n :order => \"list_position DESC\"\n end",
"def move_top(origin, destination)\n disk = origin.pop.data\n add(destination, disk)\n end",
"def prev_item\n @current -= 1 if @current > 0\n\n items\n end",
"def\tinsert_item!(previous_item_id, item_id)\n if previous_item_id\n index = self.items_positions.index(previous_item_id.to_i)\n \t self.items_positions.insert(index + 1, item_id)\n else\n self.items_positions.unshift(item_id)\n end\n self.save\n end",
"def up_item \n order_op2(true, @item)\n end",
"def lower_item\n return nil unless in_list?\n lower_items(1).first\n end",
"def move_to_top(msg, mail_folder)\r\n\t\tkeys = msg_get_keys(msg)\r\n\t\tkeys.each {\r\n\t\t\t|key|\r\n\t\t\ttuple = @library[key]\r\n\t\t\tlist = nil\r\n\t\t\tlist = tuple.list if tuple != nil\r\n\t\t\tif list != nil\r\n\t\t\t\titem = list.delete(mail_folder)\r\n\t\t\t\tlist.insert(0, item) if item != nil\r\n\t\t\tend\r\n\t\t}\r\n\tend",
"def bump(index, position = 1)\n @items.insert(position-1, @items.delete_at(index.to_i-1))\n save\n @items[position.to_i-1]\n end",
"def insert_at(position = acts_as_list_top)\n insert_at_position(position)\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item #(except)\n item ? item.my_position : 0\n end",
"def insert(item, where = :top)\r\n\t\tcase where\r\n\t\t\twhen :top\r\n\t\t\t\[email protected](item)\r\n\t\t\twhen :bottom\r\n\t\t\t\t@deck << item\r\n\t\t\twhen :random\r\n\t\t\t\titem = @deck.insert(rand(@deck.size), item)\r\n\t\tend\t\t\r\n\t\tself\r\n\tend",
"def increment_position\n return unless in_list?\n # self_class_all_or_in_collection.where(:pos => my_position).\n adjust_position!(1)\n end",
"def bottom_position_in_list(_except = nil)\n item = bottom_item # (except)\n item ? item.my_position : 0\n end",
"def down_to_top_traversal_step(current_branch=@current_branch, vertical_cursor=@vertical_cursor)\n current_branch << vertical_cursor.item\n end",
"def keep_top\n @pos_y = court.top_y\n end",
"def move_to_position(new_position)\n old_position = self.send(position_column)\n unless new_position == old_position\n if new_position < old_position\n # Moving higher in the list (up) \n new_position = [1, new_position].max\n increment_positions_between(new_position, old_position - 1)\n else\n # Moving lower in the list (down)\n new_position = [bottom_position_in_list(self).to_i, new_position].min\n decrement_positions_between(old_position + 1, new_position)\n end\n self.update_attribute(position_column, new_position)\n end\n end",
"def shuffle_positions_on_intermediate_items(old_position, new_position, avoid_id = nil)\n return if old_position == new_position\n scope = acts_as_list_list\n\n if avoid_id\n scope = scope.where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", avoid_id)\n end\n\n if old_position < new_position\n # Decrement position of intermediate items\n #\n # e.g., if moving an item from 2 to 5,\n # move [3, 4, 5] to [2, 3, 4]\n items = scope.where(\n \"#{quoted_position_column_with_table_name} > ?\", old_position\n ).where(\n \"#{quoted_position_column_with_table_name} <= ?\", new_position\n )\n\n if sequential_updates?\n items.reorder(acts_as_list_order_argument(:asc)).decrement_sequentially\n else\n items.decrement_all\n end\n else\n # Increment position of intermediate items\n #\n # e.g., if moving an item from 5 to 2,\n # move [2, 3, 4] to [3, 4, 5]\n items = scope.where(\n \"#{quoted_position_column_with_table_name} >= ?\", new_position\n ).where(\n \"#{quoted_position_column_with_table_name} < ?\", old_position\n )\n\n if sequential_updates?\n items.reorder(acts_as_list_order_argument(:desc)).increment_sequentially\n else\n items.increment_all\n end\n end\n end",
"def move_node_to_head(node) \n removed = remove_node(node)\n\n add_head(removed)\n end",
"def update_position\n if self.simple_acts_as_list_scope.length == 0\n self.position = 1\n else\n self.position = self.simple_acts_as_list_scope.last.position + 1\n end\n end",
"def increment_positions_on_higher_items\n # return unless in_list?\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{scope_condition} AND #{position_column} < #{send(position_column).to_i}\") \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{position_column} < #{send(position_column).to_i}\")\n end \n end",
"def move_to_bottom\n @item.move_to_bottom\n flash[:notice] = t(:moved_to_bottom, :thing => \"item\")\n redirect\n end",
"def move_to_bottom\n return true if at_bottom?\n move_below(last_sibling_in_list)\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.send(:position) : 0\n end",
"def lower_item\n return nil unless in_list?\n\n conditions = scope_condition.merge!(greater_than_me)\n order_by_position(conditions).first\n end",
"def add_deck_to_top(add_deck)\n if add_deck.cards and add_deck.id != self.id and add_deck.cards.size > 0\n orig_count = self.cards.size\n add_deck.cards.each do |c|\n c.update_attributes(deck_id: id, card_order: (c.card_order + orig_count))\n end\n end\n end",
"def reorder_queue_items\n queue_items.each_with_index do |queue_item,index|\n queue_item.update_attributes(list_order: index + 1)\n end\n end",
"def older(o)\n #puts \"older: #{@pos}\"\n # If we're at the newest end of the list, save a copy in @list[0]\n # so we can get back to it with newer.\n if @pos == 0\n @list[0] = o.sort\n end\n if @pos + 1 < @list.size\n if @list[@pos + 1] != @list[0]\n @pos += 1\n elsif @pos + 2 < @list.size\n @pos += 2\n end\n end\n @list[@pos].dup.tap do |x|\n #puts \"older: #{@pos} => #{x.inspect} #{@list.inspect}\"\n end\n end",
"def move_to_bottom_in_queue\n return unless in_queue?\n acts_as_queue_class.transaction do\n decrement_queue_positions_on_lower_items\n assume_bottom_queue_position\n end\n end",
"def lower_item\n return nil unless in_list?\n\n conditions = scope_condition.merge!( greater_than_me )\n order_by_position(conditions).first\n end",
"def bottom_item\n @current = last\n\n items\n end"
] | [
"0.8963604",
"0.8963604",
"0.8709419",
"0.86347026",
"0.8564782",
"0.79207796",
"0.77833104",
"0.7370714",
"0.7115456",
"0.70733476",
"0.70612925",
"0.70531374",
"0.694561",
"0.6931347",
"0.68894947",
"0.6858711",
"0.68464035",
"0.68075615",
"0.68047327",
"0.67787117",
"0.67494255",
"0.6722349",
"0.67168546",
"0.67168546",
"0.670545",
"0.6657168",
"0.6576347",
"0.651709",
"0.6487319",
"0.64869267",
"0.64832145",
"0.6472315",
"0.6417664",
"0.6409098",
"0.63937527",
"0.63661796",
"0.63604486",
"0.63550246",
"0.6302607",
"0.6302607",
"0.6279399",
"0.62586755",
"0.6229333",
"0.61767894",
"0.61767894",
"0.6165136",
"0.6153997",
"0.6153291",
"0.6138181",
"0.60947806",
"0.609452",
"0.60412264",
"0.603686",
"0.6036018",
"0.6003852",
"0.5949611",
"0.59252393",
"0.5899422",
"0.5878404",
"0.58697224",
"0.58556753",
"0.5850788",
"0.58389175",
"0.58341616",
"0.57967275",
"0.576555",
"0.57526237",
"0.5715821",
"0.5700691",
"0.5697719",
"0.56941444",
"0.56807315",
"0.56776375",
"0.5673372",
"0.56658185",
"0.5662291",
"0.5660654",
"0.56531316",
"0.5650782",
"0.5635234",
"0.56262064",
"0.56243026",
"0.5624211",
"0.5609685",
"0.5597607",
"0.5594312",
"0.5586547",
"0.5571321",
"0.5568544",
"0.5565422",
"0.55507624",
"0.5537547",
"0.55234647",
"0.5513057",
"0.5512607",
"0.55007136",
"0.54811424",
"0.5469887",
"0.54638696",
"0.54623616"
] | 0.8769221 | 2 |
Test if this record is in a list | def in_list?
!send(:position).nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_in(token, list)\n return false unless list\n list.include?(token[1])\n end",
"def includes?(data)\n list.includes?(data)\n end",
"def in_list?\n !not_in_list?\n end",
"def in?(*list)\n for item in list\n self === item and return true\n end\n false\n end",
"def in(*list)\n if list.length == 1\n return list[0].include?(self)\n else\n return list.include?(self)\n end\n end",
"def include?(el)\n list.include?(el)\n end",
"def does_list_include?(array, obj)\n array.count(obj) > 0\nend",
"def has_list?\n list.present?\n end",
"def include?(object)\n records.include?(object)\n end",
"def include?(value)\n each do |index, list_value|\n return true if list_value == value\n end\n return false\n end",
"def item_in_list?(to_check, the_list)\n\tthe_list.each do |element|\n\t\tif to_check == element\n\t\t\treturn true\n\t\tend\n\tend\n\tfalse\nend",
"def list_exists?(name)\n @lists.detect { |list| list.name == name }\n end",
"def is_member_of_list(list_name, lead_or_idnum, options={})\n list_operation(list_name, \"ISMEMBEROFLIST\", lead_or_idnum, options)\n end",
"def valid_to_ins(list, new_entry, identifier)\n id = new_entry[identifier]\n list.each do |entry|\n return false if entry[identifier] == id\n end\n\n true\n end",
"def in?(object)\n object.include?(self)\n end",
"def in?(object)\n object.include?(self)\n end",
"def name_in_agent_list(name, list)\n list.each do |e|\n return true if e.name == name\n end\n\n false\nend",
"def include?(list,tst)\n list.each {|itm| return true if itm == tst}\n false\nend",
"def is_member_of_list?(list_id, lead)\n list_operation(list_id_key(list_id), ListOperationType::IS_MEMBER_OF, lead.id)[:success_list_operation][:result][:status_list][:lead_status][:status]\n end",
"def include?(list, search)\n return false if list.empty? && search == nil \n list.find { |elem| elem == search } == search ? true : false\nend",
"def contains?(other_list)\n other_list.list.all?{|other_item, other_value| self.list.any?{|item, value| other_item.equal?(item) }}\n end",
"def in_list?\n !my_position.nil?\n end",
"def in_list?\n !my_position.nil?\n end",
"def include?(element)\n @element_list.include? element\n end",
"def in_list?\n !send(position_column).nil?\n end",
"def contains?(data)\n if @head == nil \n puts \"error: empty list\" \n end\n in_list = false\n current_node = @head\n while current_node != nil\n if current_node.value == data\n in_list = true\n end\n current_node = current_node.next_node\n end\n in_list\n end",
"def contains(value, list)\n assert_type list, :List\n \n Sass::Script::Bool.new(list.value.include?(value))\n end",
"def collection?(l)\n return @lists.key?(l) || l.list?\n end",
"def include?(list, search)\n !!list.find_index(search)\nend",
"def is_in_list?(email)\n set_api\n begin\n resp = @api.lists(list_id).members(subscriber_hash(email)).retrieve\n return resp.body[\"status\"] == \"subscribed\"\n rescue Gibbon::MailChimpError\n return false\n end\n end",
"def include?(val)\n self.each {|item|\n if item.equal?(val)\n return true\n end\n }\n return false\n end",
"def contains?(list, search_item)\n found = false\n list.each do |current_item|\n if current_item[\"productName\"] == search_item[\"productName\"]\n found = true\n end\n end\n return found\n end",
"def is_a_list?(file)\n !!(file =~ /list$/)\n end",
"def checklist(item)\n @array.include?(item)\n end",
"def check_valid_list_id!\n assoc_class = ModelReference.to_record_class_for_type assoc_name.singularize\n assoc_item = assoc_class.where(list_on_attr => list_id).first\n return if assoc_item\n\n raise FphsGeneralError, \"list id does not represent an associated list: #{list_id} for #{assoc_class}\"\n end",
"def in_special_list?(list_type=nil)\n if list_type.nil?\n @in_special_list ? true : false\n else\n @in_special_list == list_type\n end\n end",
"def list?(obj)\n obj.instance_of?(Array)\n end",
"def subscribed?(email)\n list.include? email\n end",
"def include_record?(record_id)\n @records.include?(record_id)\n end",
"def item_in_list(check, list)\n list.each do |item|\n if check == item\n return true\n end\n end\nend",
"def item_in_list(to_check, the_list)\n the_list.each { |item|\n if to_check == item\n return true\n end\n }\n false\nend",
"def isInList(tablist)\n for tab in tablist\n return(true) if self.isSame(tab) ;\n end\n return false\n end",
"def contains? (value)\n return false if @head.nil?\n\n self.each {|current| return true if current.data == value}\n \n return false \n end",
"def find_in_collection(field, value)\n @collection.values.select do |item|\n field_value = item.public_send(field)\n\n if field_value.is_a?(Array)\n field_value.include?(value)\n else\n field_value.to_s == value\n end\n end\n end",
"def in? first, *rest\n (first.is_a?(Array) ? first : [first].concat(rest)).include? self\n end",
"def innit?(array, item_to_look_for)\n\tresult = false\n\tarray.each do |list_item|\n\t\tif list_item == item_to_look_for\n\t\t\tresult = true\t\n\t\tend\n\tend\n\treturn result\nend",
"def include?(entry)\n entries.include?(entry)\n end",
"def include? entity, user_or_id, with_pullins=true\n # Trivial accept if the entity is physically in among the list items\n return true if @list.stores? entity\n user_id = user_or_id.is_a?(Integer) ? user_or_id : user_or_id.id\n ts = TaggingServices.new entity\n # It's included if the owner or this user has tagged it with the name tag\n return true if ts.exists? @list.name_tag_id, (user_id == @list.owner_id ? user_id : [user_id, @list.owner_id])\n # If not directly tagged, it's included if it's tagged with any of the list's tags, BY ANYONE (?)\n return false unless with_pullins && @list.pullin\n ts.exists? pulled_tag_ids\n end",
"def contains?(item)\n\n\n\n\n end",
"def include?(el)\n store.include?(el)\n end",
"def include? array, item\n array.include?(item)\nend",
"def include?(ary, value)\r\n ary.select{ |obj| obj == value } != []\r\nend",
"def include?(element)\n @ary.include? element\n end",
"def following?(list)\n following.include?(list)\n end",
"def include?(item)\n end",
"def check_list (list, item)\n if list.include?(item) == true\n puts \"You need to pick up \" + item\n else\n puts \"You do not need to pick up \" + item\n end\nend",
"def object_exists_in_list(objects, text)\n objects.each do |item|\n if item.text.upcase.include? text.upcase\n return true\n end\n end\n false\n end",
"def user_likes_list?\n Like.exists?(:user_id => current_user, :list_id => @list)\n end",
"def include?(object)\n each {|item| return true if item == object }\n false\n end",
"def list?\n if @value2.pair?\n if @value2.cdr.is_a?(Pair) || @value2.cdr.nil?\n true\n else\n false\n end\n else\n false\n end\n end",
"def contains?(value)\n node = list\n while node != nil\n return true if node.value == value\n node = node.nextNode\n end\n return false\n end",
"def member_of?(key, value)\n val = get(key)\n val and val.include?(value)\n end",
"def any_lists?\n current_user.lists.any?\n end",
"def contains?(item)\n @items_set.include?(item.to_s)\n end",
"def entry_in_history_list(entry, list)\n name = entry.start_with?(\".ro/\") ? entry.sub(\".ro/\", \"\") : \"/#{entry}\"\n list.include?(name)\nend",
"def valid?\n if value.is_a?(Array)\n (value - self.class.list).none?\n else\n self.class.list.include?(value)\n end\n end",
"def event_in_list\n if !SYSTEM_DATA[\"events\"].map { |x| x[\"name\"] }.include?(event)\n errors.add(:event, \"not included in list of valid events\")\n end\n end",
"def inInventory?(book)\n\t\tbooks.include?(book)\n\tend",
"def matches? invoice\n contact_ids.include? invoice.contact_id\n end",
"def include?(obj)\n self.each{|*val|\n return true if val.__svalue == obj\n }\n false\n end",
"def contains list, item\n cur = list.head\n\n while cur != nil\n return true if cur.node == item\n cur = cur.nxt\n end\n\n return false\nend",
"def include?(model)\n ids.include?(model.id)\n end",
"def in\n field_fetch('IN')\n end",
"def current_list_id_set?\n !session[:list_id].nil? if user_signed_in?\n end",
"def contains(uid)\n #This doesn't work in ruby 1.8.5\n #return self[\"USERS/ID[.=#{uid}]\"] != nil\n\n id_array = retrieve_elements('USERS/ID')\n return id_array != nil && id_array.include?(uid.to_s)\n end",
"def contains(uid)\n #This doesn't work in ruby 1.8.5\n #return self[\"USERS/ID[.=#{uid}]\"] != nil\n\n id_array = retrieve_elements('USERS/ID')\n return id_array != nil && id_array.include?(uid.to_s)\n end",
"def is_tagged_list(exp, tag)\n exp.instance_of?(Pair) and exp.first == tag\n end",
"def present?(list)\n list.size > 0\n end",
"def list?\n children[0] && children[0].is_a?(List)\n end",
"def contains\n @row_elements\n end",
"def includes? track\n\t\[email protected]? track\n\tend",
"def include?(item)\n self.__contains__(item).rubify\n end",
"def valid?\n ids.include?(@id)\n end",
"def enrolled? (student)\n @students.include?(student) # returns true or false on array existence\n end",
"def isIn(user)\n \n isIn = false\n @userList.getcontents.each { |users| \n \n if(user == users)\n isIn = true\n break\n end\n \n }\n return isIn\n end",
"def include?(arr, include_item)\n arr.each { |item| return true if item == include_item }\n false\nend",
"def sign_in_list?\n start_data_type == \"Mass Start\" || sign_in_list_enabled?\n end",
"def include_ids?(item_ids)\n all_item_ids == item_ids\n end",
"def include_record?(record_id)\n @atoms.each do |atomname, atom|\n return true if atom.include_record?(record_id)\n end\n end",
"def contains?(given_value)\n self.traverse_list do |node|\n if node.value == given_value\n return true\n else\n return false\n end\n end\n end",
"def include?(name)\n items.include?(coerce_name(name))\n end",
"def include?(obj)\n @members.include? obj\n end",
"def in?(key)\n return true if get(key)\n false\n end",
"def contains?(record)\n begin\n val = relation.exists?(record.id)\n @valid = true # set valid to true, if relation.exists?(model) does not throw any exception\n val\n rescue\n @valid = false\n end\n end",
"def in_basket?(basket)\n @item_ids.all? do |item_id|\n basket.include?(item_id)\n end\n end",
"def run_list?(item)\n run_list.detect { |r| r == item } ? true : false\n end",
"def include?(key)\n value.include?(key)\n end",
"def in_list?(namespace: nil)\n o_params = org_selectable_params.fetch(:org_autocomplete, {})\n namespace += '_' unless namespace.nil? || namespace.end_with?('_')\n o_params[\"#{namespace}not_in_list\"] != '1'\n end",
"def include?(array, query)\n array.each do |el|\n return true if el == query\n end\n false\nend",
"def contains\n \t\tfalse\n\tend"
] | [
"0.735059",
"0.7263366",
"0.72335136",
"0.70742536",
"0.6963092",
"0.6862043",
"0.68228",
"0.6734479",
"0.66829413",
"0.66368186",
"0.64990103",
"0.64718276",
"0.6413733",
"0.6407528",
"0.63881415",
"0.63881415",
"0.63848376",
"0.63733286",
"0.63656",
"0.63544965",
"0.6267211",
"0.6237816",
"0.6237816",
"0.6232764",
"0.6220714",
"0.6215465",
"0.62036747",
"0.6201046",
"0.61995876",
"0.61919683",
"0.6187983",
"0.61633986",
"0.6131842",
"0.60896975",
"0.60883594",
"0.606997",
"0.60614574",
"0.6050891",
"0.60480046",
"0.60259765",
"0.6013733",
"0.6002964",
"0.59877545",
"0.5982544",
"0.595088",
"0.5932778",
"0.5899119",
"0.5897338",
"0.5894462",
"0.58921975",
"0.5885858",
"0.58783734",
"0.5878211",
"0.5841265",
"0.58220524",
"0.58186936",
"0.58115643",
"0.5796642",
"0.5780865",
"0.57803184",
"0.5778065",
"0.57744145",
"0.577436",
"0.57696956",
"0.5756677",
"0.575279",
"0.5741885",
"0.5740288",
"0.5729079",
"0.572139",
"0.57047844",
"0.5702303",
"0.5695829",
"0.56871456",
"0.56837815",
"0.56837815",
"0.56825876",
"0.56816655",
"0.5655286",
"0.56552714",
"0.56521046",
"0.564942",
"0.5648377",
"0.5645379",
"0.56443554",
"0.56400156",
"0.56333816",
"0.562551",
"0.5620245",
"0.56192017",
"0.5612939",
"0.560905",
"0.56072915",
"0.5603906",
"0.5596657",
"0.55965745",
"0.5595492",
"0.55954516",
"0.5587286",
"0.5584537"
] | 0.6452956 | 12 |
Decrease the position of this item without adjusting the rest of the list. | def decrement_position
return unless in_list?
update_attribute :position, self.send(:position).to_i - 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrement_position\n return unless in_list?\n set_list_position(current_position - 1)\n end",
"def decrement_position\n return unless in_list?\n\n # self_class_all_or_in_collection.where(:pos => my_position).\n adjust_position!(-1)\n end",
"def decrement_position\n # return unless in_list?\n update_attribute position_column, self.send(position_column).to_i - 1\n end",
"def decrement_position\n return unless in_list?\n\n # in_collection.where(:pos => my_position).\n adjust!(position_key => -1)\n save!\n end",
"def decrement_positions_on_lower_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} - 1)\", \"#{:position} > #{send(:position).to_i}\"\n )\n end",
"def decrement_positions_on_higher_items(position)\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} <= ?\", position).decrement_all\n end",
"def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end\n end",
"def remove_from_list\n return unless in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end",
"def decrement_positions_on_higher_items(position)\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} - 1)\", \"#{scope_condition} AND #{position_column} <= #{position}\") \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} - 1)\", \"#{position_column} <= #{position}\")\n end \n end",
"def decrement_positions_on_lower_items(position=current_position)\n return unless in_list?\n\n if sequential_updates?\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} > ?\", position).reorder(acts_as_list_order_argument(:asc)).decrement_sequentially\n else\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} > ?\", position).decrement_all\n end\n end",
"def decrement_positions_on_lower_items\n # return unless in_list?\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} - 1)\", \"#{scope_condition} AND #{position_column} > #{send(position_column).to_i}\") \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} - 1)\", \"#{position_column} > #{send(position_column).to_i}\")\n end \n end",
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n higher_item.increment_position\n decrement_position\n end\n end",
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n if higher_item.current_position != current_position\n swap_positions_with(higher_item)\n else\n higher_item.increment_position\n decrement_position\n end\n end\n end",
"def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_list_position(nil)\n end\n end",
"def move_higher\n movement { self.position -= 1 }\n end",
"def deleteItem(position)\n if position >= 0 && position < @list_size\n # Adjust the list\n @item = @item[0...position] + @item[position+1..-1]\n @item_len = @item_len[0...position] + @item_len[position+1..-1]\n @item_pos = @item_pos[0...position] + @item_pos[position+1..-1]\n\n self.setViewSize(@list_size - 1)\n\n if @list_size > 0\n self.resequence\n end\n\n if @list_size < self.maxViewSize\n @win.werase # force the next redraw to be complete\n end\n\n # do this to update the view size, etc\n self.setPosition(@current_item)\n end\n end",
"def move_higher\n higher = higher_item\n return unless higher\n acts_as_list_class.transaction do\n self.update_attribute(position_column, higher.send(position_column))\n higher.increment_position\n end\n end",
"def remove_from_list\n # if in_list?\n # decrement_positions_on_lower_items\n # update_attribute position_column, nil\n # end \n return unless in_list?\n decrement_positions_on_lower_items\n update_attribute position_column, nil \n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.increment_position\n decrement_position\n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.increment_position\n decrement_position\n end",
"def down_item\n order_op2(false, @item)\n end",
"def decrement_queue_position\n return unless in_queue?\n update_attribute queue_position_column, self.send(queue_position_column).to_i - 1\n end",
"def decrement_positions_on_higher_items(position)\n conditions = scope_condition\n conditions.merge!( { position_key.lt => position } )\n\n decrease_all! in_collection.where(conditions)\n end",
"def decrement_positions_on_higher_items(position)\n conditions = scope_condition\n conditions.merge!(\"i.#{position_key} <\" => position)\n\n decrease_all! self_class_all_or_in_collection.where(stringify_conditions(conditions))\n end",
"def move_higher\n return if position_in_list == 1\n move_to(position_in_list - 1)\n end",
"def retreat\n @position = @position - 1 rescue -1\n self[@position + 1]\n end",
"def move_lower\n lower = lower_item\n return unless lower\n acts_as_list_class.transaction do\n self.update_attribute(position_column, lower.send(position_column))\n lower.decrement_position\n end\n end",
"def decrement(records)\n records.update_all(['position = position - 1'])\n end",
"def decrease_sell_in(item)\n item.sell_in -= 1\n end",
"def remove_item\n @parent.remove_item(self)\n end",
"def destroy_item_at(position)\n # TODO Stubbed - Requires definition and implementation\n end",
"def decrement_line_item_quantity(line_item_id)\n current_item = line_items.find(line_item_id)\n if current_item.quantity > 1\n current_item.quantity -= 1\n else\n current_item.destroy\n end\n current_item\n end",
"def release_quantity_of_item(item, quantity)\r\n if self.items.include?(item)\r\n item.quantity -= quantity\r\n end\r\n end",
"def decrement_queue_positions_on_lower_items\n return unless in_queue?\n acts_as_queue_class.update_all(\n \"#{queue_position_column} = (#{queue_position_column} - 1)\", \"#{queue_scope_condition} AND #{queue_position_column} > #{send(queue_position_column).to_i}\"\n )\n end",
"def destroy_item_at(position)\n # TODO Stubbed - Requires definition and implementation\n end",
"def move_lower\n low_item = lower_item\n return unless low_item\n\n low_item.decrement_position\n increment_position\n end",
"def move_lower\n low_item = lower_item\n return unless low_item\n\n low_item.decrement_position\n increment_position\n end",
"def move_lower\n return unless lower_item\n\n acts_as_list_class.transaction do\n if lower_item.current_position != current_position\n swap_positions_with(lower_item)\n else\n lower_item.decrement_position\n increment_position\n end\n end\n end",
"def remove!(child)\n @last_items_count -= +1 if child && child.last\n super\n end",
"def remove\n if @item.quantity == 1\n @item.destroy!\n else\n @item.decrement(:quantity)\n @item.save!\n end\n\n refresh\n end",
"def decrement_queue_positions_on_higher_items(queue_position)\n acts_as_queue_class.update_all(\n \"#{queue_position_column} = (#{queue_position_column} - 1)\", \"#{queue_scope_condition} AND #{queue_position_column} <= #{queue_position}\"\n )\n end",
"def move_to_bottom\n return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end",
"def decrease\n @line_item = @current_cart.line_items.where(:id => params[:line_item_id]).first\n if @line_item.count > 0\n @line_item.update_attribute :count, @line_item.count - 1\n else\n @line_item.destroy # destroy database record if quantity was decreased to 0\n end\n end",
"def decrement_positions_between(low, high)\n acts_as_list_class.update_all(\n \"#{position_column} = (#{position_column} - 1)\", [\"#{scope_condition} AND #{position_column} >= ? AND #{position_column} <= ?\", low, high]\n )\n end",
"def move_to_bottom\n self.class.transaction do\n decrement_position_of_lower_items\n set_bottom_position\n end\n end",
"def decrementX\n @currentPos.x -= 1\n if @currentPos.x < @grid.minX\n @currentPos.x = @grid.maxX\n end\n end",
"def move_down\n return if at_bottom?\n self.class.where(:position => self.position + 1).first.inc(:position, -1)\n inc(:position, 1)\n end",
"def decrement!\n @value -= @increment\n \n self\n end",
"def move_to_bottom\n # return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items if in_list?\n assume_bottom_position\n end\n end",
"def back\n @index -= 1 if @index > 0\n end",
"def move_down(n)\n self.y -= n\n end",
"def remove_item_at(index)\n @list.slice!(index)\n end",
"def remove_by_index(index)\n @items.delete_at(index-1)\n end",
"def prev_item\n @current -= 1 if @current > 0\n\n items\n end",
"def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} + 1)\", \"#{:position} < #{send(:position).to_i}\"\n )\n end",
"def remove_item(item)\n index = @list.index(item)\n remove_item_at(index)\n end",
"def down!\n swap_with(self.next) unless last?\n end",
"def decrementY\n @currentPos.y -= 1\n if @currentPos.y < @grid.minY\n @currentPos.y = @grid.maxY\n end\n end",
"def single_sell_in_day_remover(item)\r\n item.sell_in -= 1\r\n end",
"def decrement_positions_on_lower_items(max_pos = nil)\n return unless in_list?\n conditions = scope_condition\n conditions.merge!(greater_than_me)\n conditions.merge!(\"i.#{position_key} <\" => max_pos) if max_pos\n\n decrease_all! self_class_all_or_in_collection.where(stringify_conditions(conditions))\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end",
"def shift_skill_positions\n self.competence_node.skills.where('skills.id != ?', self.id)\n .where('position > ?', self.position).each do |skill|\n\n skill.position -= 1\n skill.save!\n end\n end",
"def sell_inventory(material, quantity)\n material.quantity -= quantity\n end",
"def decrement(attribute, by = 1)\n increment(attribute, -by)\n end",
"def remove_item\n\n end",
"def decrement_positions_on_lower_items(max_pos = nil)\n return unless in_list?\n conditions = scope_condition\n conditions.merge!( greater_than_me )\n conditions.merge!({ position_key.lt => max_pos} ) if max_pos\n\n decrease_all! in_collection.where(conditions)\n end",
"def action_up\n @ui.index -= 1\n end",
"def decrement(node)\n change_by node, -1\n end",
"def drop_item(index)\n @children.delete_at(index)\n end",
"def bump(index, position = 1)\n @items.insert(position-1, @items.delete_at(index.to_i-1))\n save\n @items[position.to_i-1]\n end",
"def move_down(index)\n\t\traise ArgumentError, \"Can not move the primary Style\" if index == 0\n\t\traise IndexError, \"Indices must be positive natural numbers.\" if index < 0\n\t\t\n\t\t\n\t\t# can't move the final element in the list down any further\n\t\tif src == @styles.size-1\n\t\t\tsrc = index\n\t\t\tdst = index + 1\n\t\t\t\n\t\t\tswap(@styles, src, dst)\n\t\tend\n\tend",
"def end_item\n @p.end_item(self)\n end",
"def move_down\n @array[-XSIZE..-1].each_with_index { |e, x| yield e } if block_given?\n @array = @array[-XSIZE..-1].concat(@array[0...-XSIZE])\n end",
"def detach(scope = list_scope)\n list(scope).all(:position.gt => position).adjust!({ :position => -1 },true)\n self.position = nil\n end",
"def decrement\n @value -= 1\n end",
"def decrement!(attribute, by = 1)\n increment!(attribute, -by)\n end",
"def shrink_ship\n @length -= 1\n end",
"def decrement(attribute, by = 1)\n increment(attribute, -by)\n end",
"def prev_item\n storage.rotate!(-1)\n\n update\n end",
"def remove_slot\n @limit -= 1\n end",
"def decrease_stock\n\t\t@stock -= 1\n\tend",
"def remove_item(item)\n order_item = self.order_items.where(item: item).order('price asc').first\n if order_item.is_a? OrderItem\n order_item.remove 1\n recalculate!\n end\n end",
"def remove(item)\n if item.kind_of?(ItemStack)\n stack = get_item(item)\n stack.remove(item)\n if stack.quantity == 0\n self.delete(stack)\n elsif stack.quantity == 1\n self[self.index(stack)] = stack.item\n end\n else\n self.delete(item)\n end\n end",
"def decrement!(attribute, by = 1, touch: nil)\n increment!(attribute, -by, touch: touch)\n end",
"def move_up\n return if at_top?\n self.class.where(:position => self.position - 1).first.inc(:position, 1)\n inc(:position, -1)\n end",
"def decrease\n self.num_mines = self.num_mines - 1\n return self.num_mines\t\n end",
"def remove_from_queue\n if in_queue?\n decrement_queue_positions_on_lower_items\n update_attribute queue_position_column, nil\n end\n end",
"def move_to_top\n return unless in_list?\n acts_as_list_class.transaction do\n increment_positions_on_higher_items\n assume_top_position\n end\n end",
"def decrease(rectangle, player, decrement=1)\n # Decrement counter\n increase(rectangle, player, -decrement)\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position\n end",
"def decrement_indent\n\t\t\t@indent[-1] -= 1\n\t\tend",
"def remove_item(id, nb = 999)\n return if @locked\n return add_item(id, -nb) if nb < 0\n\n id = GameData::Item[id].id\n @items[id] ||= 0 unless @items[id]\n @items[id] -= nb\n if @items[id] <= 0\n @items[id] = 0\n remove_item_from_order(id)\n end\n end",
"def decrement_scores_index\n @scores_idx -=1 if valid_scores_idx?(@scores_idx - 1)\n self\n end",
"def move_down\n if @value < @options\n @y += 50\n @value += 1\n end\n end",
"def prev_item\n storage.rotate!(-1)\n\n update\n end",
"def prev_item\n storage.rotate!(-1)\n\n update\n end",
"def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} < ?\", current_position).increment_all\n end",
"def move_down\n\t\tmove([0,1])\n\tend",
"def move_to_position(new_position)\n old_position = self.send(position_column)\n unless new_position == old_position\n if new_position < old_position\n # Moving higher in the list (up) \n new_position = [1, new_position].max\n increment_positions_between(new_position, old_position - 1)\n else\n # Moving lower in the list (down)\n new_position = [bottom_position_in_list(self).to_i, new_position].min\n decrement_positions_between(old_position + 1, new_position)\n end\n self.update_attribute(position_column, new_position)\n end\n end",
"def remove_item(index)\n new_items = items\n\n # TODO cleanse. this is shameful\n item = load_item_at(index)\n item.reverse_appointment! if item.is_a?(Proposal)\n\n new_items.delete_at(index)\n update_attribute :items, new_items\n end"
] | [
"0.78441364",
"0.7756966",
"0.77155715",
"0.7483058",
"0.7363868",
"0.7135145",
"0.7029498",
"0.694255",
"0.6940081",
"0.6910789",
"0.6874631",
"0.68350005",
"0.66091406",
"0.6557186",
"0.6520704",
"0.65114504",
"0.6485874",
"0.6408452",
"0.63783157",
"0.63783157",
"0.6366913",
"0.6356367",
"0.6315041",
"0.62870026",
"0.62366945",
"0.6205407",
"0.6194777",
"0.6161967",
"0.61525947",
"0.6100763",
"0.60963994",
"0.60773814",
"0.6071479",
"0.60608417",
"0.6054326",
"0.6046402",
"0.6046402",
"0.6036891",
"0.5985436",
"0.59676",
"0.59658504",
"0.59554076",
"0.5932865",
"0.5919512",
"0.5845548",
"0.5845269",
"0.58397985",
"0.582797",
"0.5804253",
"0.5788143",
"0.57784367",
"0.57587516",
"0.5756492",
"0.57381904",
"0.57215935",
"0.5686052",
"0.5664676",
"0.5653657",
"0.56493443",
"0.5644095",
"0.56428355",
"0.5641072",
"0.5640298",
"0.5637213",
"0.562913",
"0.5627428",
"0.5615396",
"0.5607501",
"0.56038064",
"0.5601264",
"0.5593651",
"0.557692",
"0.5574297",
"0.5570083",
"0.5563375",
"0.556288",
"0.55574644",
"0.5554201",
"0.5551544",
"0.5543632",
"0.55408335",
"0.55376196",
"0.5533527",
"0.5531551",
"0.5527808",
"0.5526947",
"0.55251145",
"0.55246186",
"0.5517133",
"0.5513855",
"0.5512394",
"0.55035037",
"0.54730856",
"0.5467809",
"0.5461472",
"0.5461472",
"0.54508567",
"0.54473287",
"0.5436407",
"0.5434086"
] | 0.80463296 | 0 |
Returns the bottom position number in the list. bottom_position_in_list => 2 | def bottom_position_in_list(except = nil)
item = bottom_item(except)
item ? item.send(:position) : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_position_in_list\n return nil unless in_list?\n bottom_position_in_list\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.send(position_column) : 0\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.current_position : acts_as_list_top - 1\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item #(except)\n item ? item.my_position : 0\n end",
"def bottom_position_in_list(_except = nil)\n item = bottom_item # (except)\n item ? item.my_position : 0\n end",
"def move_to_bottom\n return unless in_list?\n insert_at_position bottom_position_in_list.to_i\n end",
"def assume_bottom_position\n set_list_position(bottom_position_in_list(self).to_i + 1)\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1 \n set_my_position(pos)\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1\n set_my_position(pos)\n end",
"def bottom\n return @bottom\n end",
"def bottom\n row, col = @position\n return [row + 1, col] unless row + 1 > 7\n []\n end",
"def assume_bottom_position\n update_attribute(:position, bottom_position_in_list(self).to_i + 1)\n end",
"def bottom_queue_position_in_queue(except = nil)\n item = bottom_item_in_queue(except)\n item ? item.send(queue_position_column) : 0\n end",
"def bottom()\n return @top + @height\n end",
"def assume_bottom_position\n update_attribute(position_column, bottom_position_in_list(self).to_i + 1)\n end",
"def last?\n return false unless in_list?\n bottom_pos = bottom_position_in_list\n my_position == bottom_pos\n end",
"def last?\n return false unless in_list?\n bottom_pos = bottom_position_in_list\n my_position == bottom_pos\n end",
"def last?\n # return false unless in_list?\n self.send(position_column) == bottom_position_in_list\n end",
"def bottom; return self[1]+self[3]; end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end",
"def bottom\n `#{clientRect}.bottom` + Window.scrollY\n end",
"def bottom(column)\n @grid[column].index([])\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position\n end",
"def bottom_left\n row, col = @position\n return [row + 1, col - 1] unless row + 1 > 7 || col - 1 < 0\n []\n end",
"def move_to_bottom\n # return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items if in_list?\n assume_bottom_position\n end\n end",
"def bottom_item\n @current = last\n\n items\n end",
"def bottom\n @ole.Bottom\n end",
"def bottom\n @ole.Bottom\n end",
"def bottom_left\n Point[x, y + height]\n end",
"def move_to_bottom\n return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end",
"def bottom_right\n row, col = @position\n return [row + 1, col + 1] unless row + 1 > 7 || col + 1 > 7\n []\n end",
"def bottom\n scoped_all.size + start - 1\n end",
"def bottomleft; return self[0], self.bottom; end",
"def last(list)\n list[-1]\nend",
"def last\n list.first\n end",
"def bottom_item(except = nil)\n conditions = scope_condition\n if except\n conditions.merge!(\"i.#{position_key} <>\" => except.my_position)\n end\n\n order_by_position(conditions).last\n end",
"def bottom\n @x_max\n end",
"def get_last\n return @position\n end",
"def bottom_right\n @position + @dimensions\n end",
"def bottom_item(except = nil)\n conditions = \"#{self.class.primary_key} != #{except.id}\" if except\n acts_as_list_class.find(:first, :conditions => conditions, :order => \"#{:position} DESC\")\n end",
"def find_nth_from_last(ll, n)\n\nend",
"def bottom_item(except = nil)\n conditions = scope_condition\n if except\n conditions.merge!( { position_key.ne => except.my_position } )\n end\n\n order_by_position(conditions).last\n end",
"def bottom_panel\n Panel.bottom_panel(pointer)\n end",
"def bottom_item(except = nil)\n # conditions = scope_condition\n # conditions = \"#{conditions} AND #{self.class.primary_key} != #{except.id}\" if except\n # acts_as_list_class.find(:first, :conditions => conditions, :order => \"#{position_column} DESC\")\n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n conditions = except.nil?() ? \"\" : \"#{self.class.primary_key} != #{except.id}\" \n where(conditions).order(\"#{position_column} DESC\").first\n end \n end",
"def bottom=(value)\n @bottom = value\n end",
"def bottom(value)\n @ole.Bottom = value\n nil\n end",
"def bottom(value)\n @ole.Bottom = value\n nil\n end",
"def bottom_item(except = nil)\n scope = acts_as_list_list\n\n if except\n scope = scope.where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", except.id)\n end\n\n scope.in_list.reorder(acts_as_list_order_argument(:desc)).first\n end",
"def last?\n position == bottom\n end",
"def last_sibling_in_list\n self.class.asc(:position).last\n end",
"def bottom_item(except = nil)\n except ? siblings.reject{|page| page == self }.last : siblings.last\n end",
"def bottom_cell_y_at(y); (y + HEIGHT - 1) / HEIGHT; end",
"def bottom_cell(cell)\n get_next_cell(cell) { | cell | Coordinates.new(cell.col, cell.row+1)}\n end",
"def move_to_bottom\n return true if at_bottom?\n move_below(last_sibling_in_list)\n end",
"def assume_bottom_queue_position\n update_attribute(queue_position_column, bottom_queue_position_in_queue(self).to_i + 1)\n end",
"def add_to_bottom\n self.position = bottom + 1\n end",
"def bottom_boundary(input, top, left)\n zero_position = nil\n\n puts \"bottom_boundary top: #{top} left: #{left}\"\n\n (top..input.length - 1).each do |i|\n puts \"loop, i=#{i}\"\n if input[i][left] == 0\n zero_position = i\n else\n return zero_position\n end\n end\n\n zero_position\nend",
"def border_bottom()\n return get_border(:bottom)\n end",
"def bottom\n return nil if empty?\n @que.first\n end",
"def highest_height\n i = acc.reverse.find_index{|i|!i.nil?}\n i ||= 0\n acc.length - i\n end",
"def penultimate(list)\n list[-2]\nend",
"def find_gt(list, item, &block)\r\n\t\ti = bisect_right(list, item, &block)\r\n\t\treturn list[i] unless list.size == i\r\n\tend",
"def bottom n=1, &blk\n if block_given?\n sort(&blk)[0...n]\n else\n #bottom_by(n) {|x| x }\n sort[0...n]\n end\n end",
"def tree_height(pos)\n r = 0..0\n tree_heights = acc.map.with_index{|a, i| a ? i : nil}.reverse\n tree_heights[tree_heights.index(highest_height - 1)..-1].each do |h|\n next unless h\n r = (r.last...(r.last + 2**h))\n return h if r.include?(pos)\n end\n end",
"def higher_item\n # return nil unless in_list? # http://github.com/brightspark3/acts_as_list/commit/8e55352aaa437d23a1ebdeabd5276c6dd5aad6a1\n \n # acts_as_list_class.find(:first, :conditions =>\n # \"#{scope_condition} AND #{position_column} < #{send(position_column).to_s}\", :order => \"#{position_column} DESC\"\n # ) \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n where(\"#{position_column} = #{(send(position_column).to_i - 1).to_s}\").first\n end \n end",
"def last_i\n size - 1\n end",
"def last_specified_position\n tree.dimensions.length.downto(1) do |index|\n return index - 1 if conditions[tree.dimensions[index - 1]] != '*'\n end\n\n return -1\n end",
"def from_last(list, n)\n ptr_a = list.get_first\n ptr_b = list.get_first\n\n # First, advance ptr_b by the value of n\n (1..n).each do\n ptr_b = ptr_b.next_node\n end\n\n # Then, walk both pointers forward by one, simultaneously,\n # until ptr_b reaches the end of the list (ptr_b remains \n # n spaces ahead of ptr_a)\n while ptr_b.next_node\n ptr_a = ptr_a.next_node\n ptr_b = ptr_b.next_node\n end\n\n ptr_a # ptr_a will now point to the node n spaces from the end of the list\nend",
"def fallen_off_bottom?\n self.y > $window.height\n end",
"def use_binary_search(list, item)\r\n low = 0\r\n high = list.length - 1\r\n while low <= high\r\n mid = (low + high)\r\n guess = list[mid]\r\n if guess == item\r\n return mid\r\n end\r\n if guess > item\r\n high = mid - 1\r\n else\r\n low = mid + 1\r\n end\r\n end\r\n return nil\r\nend",
"def higher_item\n return nil unless in_list?\n higher_items(1).first\n end",
"def move_to_bottom\n return if self == self_and_siblings(true).last\n move_to(self_and_siblings.last.position_in_list)\n end",
"def bottom\n @widget.margins.bottom + @widget.borders.bottom\n end",
"def last_index\n entries.any? ? entries.size - 1 : nil\n end",
"def next_idx(list)\n return 0 if list.empty?\n list.map { |item| item[:idx] }.max + 1\n end",
"def higher_item\n return nil unless in_list?\n conditions = scope_condition.merge!(less_than_me)\n order_by_position(conditions).last\n end",
"def higher_item\n return nil unless in_list?\n conditions = scope_condition.merge!( less_than_me )\n order_by_position(conditions).last\n end",
"def height\n heights = [left_height, right_height].sort\n\n heights.last\n end",
"def exists? item, list, lo, hi\n until lo >= hi\n mid = ((lo + hi) / 2).to_i\n if list[mid] < item\n lo = mid + 1\n elsif list[mid] > item\n hi = mid - 1\n else\n return true\n end\n end\n list[lo] == item\nend",
"def floor_height(floor)\n\t\tfloors.index(floor)\n\tend",
"def max_span(list)\n ans = 0\n # Counts the amount in between the first and last item in the list.\n if list.count >= 2\n ans = list.count - 2\n else\n ans = list.count\n end\n print ans\nend",
"def current_high_bid\n list_of_bids = bids.order(amount: :desc)\n if list_of_bids.blank? \n return 0\n elsif list_of_bids.length == 1\n return 1\n end\n\n return list_of_bids[1].amount + 1 #add $1 to the 2nd highest bid\n end",
"def find_nth_from_end(n)\n list_length = self.length\n return nil if n > list_length - 1 || n < 0\n cursor = @tail\n n.times do\n cursor = cursor.prev\n end\n return cursor.data\n end",
"def find_le(list, item, &block)\r\n\t\ti = bisect_right(list, item, &block)\r\n\t\treturn list[i - 1] unless 0 == i\r\n\tend",
"def last\n return nil if ! @map.last\n if @map.length == 1\n left = 0\n else\n left = @map[@map.length-2][0]+1\n end\n [@map.length-1,@map.last[1],left,@map.last[0]]\n end",
"def index(list, item, &block)\r\n\t\ti = bisect_left(list, item, &block)\r\n\t\treturn list[i] == item ? i : nil\r\n\tend",
"def bottom_floor\n\t\[email protected]\n\tend",
"def last(numbers, int)\n numbers.last(int)\nend",
"def highest_num(list)\n max = list[0]\n i = 0\n until i >= list.length\n max = list[i] if list[i] > max\n i += 1\n end\n max\nend",
"def position_to_index(position)\n position - 1\n end",
"def bottomright; return self.right, self.bottom; end",
"def move_higher\n return if position_in_list == 1\n move_to(position_in_list - 1)\n end",
"def insert_at_bottom\n assume_bottom_position\n end",
"def bottom=(b); self[1] = b - self[3]; return b; end",
"def return_result(stack_bottom)\n\n count = stack_top - stack_bottom\n\n return nil if count == 0\n return stack_pop if count == 1\n\n (1..count).collect { |pos| stack_pop }.reverse\n end",
"def bottom_most_free_row_index(column_index)\n found_row_index = @slot_rows.size - 1\n found_row_index -= 1 until found_row_index == -1 || @slot_rows[found_row_index][column_index].value == 0\n found_row_index\n end",
"def find_ge(list, item, &block)\r\n\t\ti = bisect_left(list, item, &block)\r\n\t\treturn list[i] unless list.size == i\r\n\tend",
"def last_child\n children.max_by { |x| x.position}\n end",
"def find_nth_from_end(n)\r\n current = @head\r\n n_ahead = @head\r\n \r\n # return nil if list is empty\r\n return nil if current.nil?\r\n \r\n n.times do\r\n # move n_ahead pointer forward n nodes\r\n n_ahead = n_ahead.next\r\n # return nil if n is outside bounds of list\r\n return if n_ahead.nil?\r\n end\r\n \r\n # move n_ahead forward until it's pointing at the last node. Move current forward the same number of times. \r\n while n_ahead.next != nil\r\n n_ahead = n_ahead.next\r\n current = current.next\r\n end\r\n \r\n # current is now pointing at the nth node from the end\r\n return current.data\r\n \r\n end",
"def nthElementFromTheEnd(l, n)\n out, ln = [], l\n while ln do\n out.push ln.value\n ln = ln.next\n end\n return n > out.size ? -1 : out[out.size - n]\nend"
] | [
"0.81155956",
"0.8079379",
"0.80280375",
"0.7928457",
"0.7911197",
"0.69945776",
"0.6879014",
"0.67420703",
"0.67404836",
"0.6604313",
"0.65601915",
"0.65463865",
"0.65017986",
"0.6450243",
"0.6329894",
"0.6293622",
"0.6293622",
"0.6283526",
"0.62620646",
"0.6239669",
"0.62001956",
"0.6163797",
"0.6160632",
"0.6142733",
"0.6085476",
"0.6072425",
"0.60631794",
"0.60631794",
"0.6049927",
"0.5978806",
"0.5965509",
"0.59633297",
"0.5865716",
"0.5841242",
"0.58113605",
"0.5767689",
"0.5732492",
"0.571893",
"0.57068086",
"0.5673687",
"0.56654316",
"0.5661909",
"0.5652813",
"0.56269526",
"0.56062526",
"0.5591932",
"0.5591932",
"0.5582537",
"0.55648607",
"0.5558491",
"0.5552979",
"0.5527792",
"0.5527077",
"0.55261034",
"0.5488875",
"0.5484357",
"0.5461229",
"0.5430682",
"0.5425468",
"0.54160964",
"0.53837675",
"0.53610903",
"0.5355875",
"0.5351328",
"0.53431314",
"0.5325183",
"0.53248614",
"0.53015846",
"0.52965057",
"0.528894",
"0.5282392",
"0.5279509",
"0.52676255",
"0.52651495",
"0.5259021",
"0.524044",
"0.5238515",
"0.52359325",
"0.5235145",
"0.52176523",
"0.5216944",
"0.5213841",
"0.5207092",
"0.5205727",
"0.5198474",
"0.5197437",
"0.51972294",
"0.517807",
"0.51642877",
"0.51549834",
"0.5149223",
"0.51409215",
"0.51360136",
"0.5134889",
"0.5131603",
"0.5130786",
"0.51187974",
"0.5113516",
"0.51027554",
"0.5096848"
] | 0.8109231 | 1 |
Returns the bottom item | def bottom_item(except = nil)
conditions = "#{self.class.primary_key} != #{except.id}" if except
acts_as_list_class.find(:first, :conditions => conditions, :order => "#{:position} DESC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottom_item\n @current = last\n\n items\n end",
"def bottom_item(except = nil)\n except ? siblings.reject{|page| page == self }.last : siblings.last\n end",
"def bottom\n return @bottom\n end",
"def bottom\n @ole.Bottom\n end",
"def bottom\n @ole.Bottom\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.current_position : acts_as_list_top - 1\n end",
"def bottom_item(except = nil)\n conditions = scope_condition\n if except\n conditions.merge!(\"i.#{position_key} <>\" => except.my_position)\n end\n\n order_by_position(conditions).last\n end",
"def bottom_item(except = nil)\n conditions = scope_condition\n if except\n conditions.merge!( { position_key.ne => except.my_position } )\n end\n\n order_by_position(conditions).last\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.send(position_column) : 0\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.send(:position) : 0\n end",
"def bottom()\n return @top + @height\n end",
"def bottom_item(except = nil)\n scope = acts_as_list_list\n\n if except\n scope = scope.where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", except.id)\n end\n\n scope.in_list.reorder(acts_as_list_order_argument(:desc)).first\n end",
"def bottom_item(except = nil)\n # conditions = scope_condition\n # conditions = \"#{conditions} AND #{self.class.primary_key} != #{except.id}\" if except\n # acts_as_list_class.find(:first, :conditions => conditions, :order => \"#{position_column} DESC\")\n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n conditions = except.nil?() ? \"\" : \"#{self.class.primary_key} != #{except.id}\" \n where(conditions).order(\"#{position_column} DESC\").first\n end \n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item #(except)\n item ? item.my_position : 0\n end",
"def bottom_position_in_list(_except = nil)\n item = bottom_item # (except)\n item ? item.my_position : 0\n end",
"def last_item\n @children[@items.last]\n end",
"def bottom; return self[1]+self[3]; end",
"def bottom\n row, col = @position\n return [row + 1, col] unless row + 1 > 7\n []\n end",
"def last\n @items.last\n end",
"def bottom\n return nil if empty?\n @que.first\n end",
"def bottom\n @widget.margins.bottom + @widget.borders.bottom\n end",
"def higher_item\n return nil unless in_list?\n higher_items(1).first\n end",
"def bottom()\n @view__.bottom\n end",
"def bottomleft; return self[0], self.bottom; end",
"def bottom\n scoped_all.size + start - 1\n end",
"def border_bottom()\n return get_border(:bottom)\n end",
"def top_item\n @current = 0\n\n items\n end",
"def html_bottom_items\n @html_bottom_items ||= []\n end",
"def last\n items.compact.last\n end",
"def last_position_in_list\n return nil unless in_list?\n bottom_position_in_list\n end",
"def peek\n\t\[email protected]\n\tend",
"def bottom_panel\n Panel.bottom_panel(pointer)\n end",
"def bottom\n `#{clientRect}.bottom` + Window.scrollY\n end",
"def bottom_right\n @position + @dimensions\n end",
"def top()\n @a.last\n end",
"def bottomright; return self.right, self.bottom; end",
"def higher_item\n return nil unless in_list?\n conditions = scope_condition.merge!( less_than_me )\n order_by_position(conditions).last\n end",
"def assume_bottom_position\n set_list_position(bottom_position_in_list(self).to_i + 1)\n end",
"def bottom(column)\n @grid[column].index([])\n end",
"def bottom_queue_position_in_queue(except = nil)\n item = bottom_item_in_queue(except)\n item ? item.send(queue_position_column) : 0\n end",
"def higher_item\n return nil unless in_list?\n conditions = scope_condition.merge!(less_than_me)\n order_by_position(conditions).last\n end",
"def last\n list.first\n end",
"def last\n self[-1]\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1 \n set_my_position(pos)\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1\n set_my_position(pos)\n end",
"def last\r\n self[-1]\r\n end",
"def top()\n @data.last\n end",
"def last\n at(-1)\n end",
"def bottom\n @x_max\n end",
"def bottom_item_in_queue(except = nil)\n conditions = queue_scope_condition\n conditions = \"#{conditions} AND #{self.class.primary_key} != #{except.id}\" if except\n acts_as_queue_class.find(:first, :conditions => conditions, :order => \"#{queue_position_column} DESC\")\n end",
"def assume_bottom_position\n update_attribute(:position, bottom_position_in_list(self).to_i + 1)\n end",
"def get_last\n return @position\n end",
"def higher_item\n # return nil unless in_list? # http://github.com/brightspark3/acts_as_list/commit/8e55352aaa437d23a1ebdeabd5276c6dd5aad6a1\n \n # acts_as_list_class.find(:first, :conditions =>\n # \"#{scope_condition} AND #{position_column} < #{send(position_column).to_s}\", :order => \"#{position_column} DESC\"\n # ) \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n where(\"#{position_column} = #{(send(position_column).to_i - 1).to_s}\").first\n end \n end",
"def item index\n @items[index-1]\n end",
"def bottom_left\n Point[x, y + height]\n end",
"def last\n @children.last\n end",
"def top()\n @array[-1][0]\n end",
"def last\n stack.last\n end",
"def peek()\n return nil if @items.empty?\n return @items[-1]\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position\n end",
"def last\n @ordered_elements.last\n end",
"def bottom_floor\n\t\[email protected]\n\tend",
"def last\n self[-1]\n end",
"def assume_bottom_position\n update_attribute(position_column, bottom_position_in_list(self).to_i + 1)\n end",
"def bottom_right\n row, col = @position\n return [row + 1, col + 1] unless row + 1 > 7 || col + 1 > 7\n []\n end",
"def top()\n @stack.last\n end",
"def top()\n @stack.last\n end",
"def bottom(value)\n @ole.Bottom = value\n nil\n end",
"def bottom(value)\n @ole.Bottom = value\n nil\n end",
"def last\n @tail\n end",
"def last_item\n if @paginator.items_per_page.kind_of?(Array) \n [offset + (@number <= @paginator.items_per_page.size ? @paginator.items_per_page[@number-1] : @paginator.items_per_page.last),@paginator.item_count].min\n else\n [@paginator.items_per_page * @number, @paginator.item_count].min\n end\n end",
"def move_to_bottom\n return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end",
"def move_to_bottom\n # return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items if in_list?\n assume_bottom_position\n end\n end",
"def move_to_bottom\n return unless in_list?\n insert_at_position bottom_position_in_list.to_i\n end",
"def last\n self.slice(self.size - 1)\n end",
"def get_last\n return nil if @head.nil?\n return get_last_helper(@head)\n end",
"def left_sibling\n higher_items.last\n end",
"def get_last_item(arr)\n\treturn arr[-1]\nend",
"def get_last\n return @tail ? @tail.data : nil\n end",
"def last\n all[all.size - 1]\n end",
"def top()\n @stack.last\n end",
"def last_child\n children.max_by { |x| x.position}\n end",
"def last\n list = self\n list = list.tail until list.tail.empty?\n list.head\n end",
"def lastElement\n return @stk[@count]\n end",
"def peek()\n if @items.empty?\n return nil\n end\n return @items[-1]\n end",
"def peek()\n if @items.empty?\n return nil\n end\n return @items[-1]\n end",
"def bottom=(value)\n @bottom = value\n end",
"def peek()\n if @items.empty?\n return nil\n end\n return @items[-1]\n end",
"def last_item(electives)\n electives[electives.length - 1] #length -1 so it can be used with any number of items, counting starts at 0\nend",
"def top()\n @stack[-1]\n end",
"def last_used_item(); $game_temp.last_used_item; end",
"def peek_last\n raise 'No such element' if @size == 0\n @tail.value\n end",
"def move_to_bottom\n return if self == self_and_siblings(true).last\n move_to(self_and_siblings.last.position_in_list)\n end",
"def last\n all.last\n end",
"def last\n all.last\n end",
"def top\n raise EMPTY_STACK_ERROR if @data.empty?\n\n @data.last\n end",
"def move_to_bottom\n self.class.transaction do\n decrement_position_of_lower_items\n set_bottom_position\n end\n end",
"def top\n @stack.last\n end",
"def last\n all.last\n end"
] | [
"0.8642546",
"0.80459046",
"0.7966891",
"0.7739817",
"0.7739817",
"0.76541287",
"0.751771",
"0.7361369",
"0.73133516",
"0.7283584",
"0.7187465",
"0.71776414",
"0.71752954",
"0.71603096",
"0.71485853",
"0.7103811",
"0.7102432",
"0.706414",
"0.7038563",
"0.7030219",
"0.7024166",
"0.70070666",
"0.69957757",
"0.6927536",
"0.6863564",
"0.6804797",
"0.6783095",
"0.67550683",
"0.6743075",
"0.6725027",
"0.6692395",
"0.66869044",
"0.66775465",
"0.6651691",
"0.6620172",
"0.6609211",
"0.66079515",
"0.65883815",
"0.65721023",
"0.65571743",
"0.6540302",
"0.6496399",
"0.6488796",
"0.64875364",
"0.6480684",
"0.64754254",
"0.64753014",
"0.6465844",
"0.64513695",
"0.6412238",
"0.64092743",
"0.6391622",
"0.6386349",
"0.63860136",
"0.63758796",
"0.63500756",
"0.63462275",
"0.6341034",
"0.63395613",
"0.63373697",
"0.6335294",
"0.63297516",
"0.6325525",
"0.6298369",
"0.6294284",
"0.6293651",
"0.6271521",
"0.6271521",
"0.62663555",
"0.62663555",
"0.6261745",
"0.6258588",
"0.623976",
"0.6238805",
"0.62347186",
"0.62333006",
"0.6217981",
"0.6217259",
"0.6203034",
"0.62017274",
"0.62013185",
"0.6183488",
"0.6177888",
"0.6171734",
"0.61708856",
"0.6169567",
"0.6169567",
"0.6167176",
"0.61630625",
"0.6140884",
"0.61202365",
"0.61089045",
"0.6082427",
"0.60779625",
"0.6073314",
"0.6073314",
"0.60705954",
"0.60703737",
"0.6067027",
"0.606644"
] | 0.7234649 | 10 |
Forces item to assume the bottom position in the list. | def assume_bottom_position
update_attribute(:position, bottom_position_in_list(self).to_i + 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assume_bottom_position\n set_list_position(bottom_position_in_list(self).to_i + 1)\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1 \n set_my_position(pos)\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1\n set_my_position(pos)\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position\n end",
"def move_to_bottom\n # return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items if in_list?\n assume_bottom_position\n end\n end",
"def move_to_bottom\n return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end",
"def move_to_bottom\n return unless in_list?\n insert_at_position bottom_position_in_list.to_i\n end",
"def assume_bottom_position\n update_attribute(position_column, bottom_position_in_list(self).to_i + 1)\n end",
"def bottom_item\n @current = last\n\n items\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.current_position : acts_as_list_top - 1\n end",
"def move_to_bottom\n self.class.transaction do\n decrement_position_of_lower_items\n set_bottom_position\n end\n end",
"def bottom_position_in_list(_except = nil)\n item = bottom_item # (except)\n item ? item.my_position : 0\n end",
"def insert_at_bottom\n assume_bottom_position\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.send(:position) : 0\n end",
"def add_to_bottom\n self.position = bottom + 1\n end",
"def move_to_bottom\n return true if at_bottom?\n move_below(last_sibling_in_list)\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item #(except)\n item ? item.my_position : 0\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.send(position_column) : 0\n end",
"def move_to_bottom\n return if self == self_and_siblings(true).last\n move_to(self_and_siblings.last.position_in_list)\n end",
"def assume_bottom_queue_position\n update_attribute(queue_position_column, bottom_queue_position_in_queue(self).to_i + 1)\n end",
"def move_to_bottom_in_queue\n return unless in_queue?\n acts_as_queue_class.transaction do\n decrement_queue_positions_on_lower_items\n assume_bottom_queue_position\n end\n end",
"def last_position_in_list\n return nil unless in_list?\n bottom_position_in_list\n end",
"def bottom_item(except = nil)\n conditions = scope_condition\n if except\n conditions.merge!(\"i.#{position_key} <>\" => except.my_position)\n end\n\n order_by_position(conditions).last\n end",
"def bottom_item(except = nil)\n conditions = \"#{self.class.primary_key} != #{except.id}\" if except\n acts_as_list_class.find(:first, :conditions => conditions, :order => \"#{:position} DESC\")\n end",
"def bottom(value)\n @ole.Bottom = value\n nil\n end",
"def bottom(value)\n @ole.Bottom = value\n nil\n end",
"def bottom_item(except = nil)\n conditions = scope_condition\n if except\n conditions.merge!( { position_key.ne => except.my_position } )\n end\n\n order_by_position(conditions).last\n end",
"def bottom_item(except = nil)\n # conditions = scope_condition\n # conditions = \"#{conditions} AND #{self.class.primary_key} != #{except.id}\" if except\n # acts_as_list_class.find(:first, :conditions => conditions, :order => \"#{position_column} DESC\")\n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n conditions = except.nil?() ? \"\" : \"#{self.class.primary_key} != #{except.id}\" \n where(conditions).order(\"#{position_column} DESC\").first\n end \n end",
"def bottom_item(except = nil)\n scope = acts_as_list_list\n\n if except\n scope = scope.where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", except.id)\n end\n\n scope.in_list.reorder(acts_as_list_order_argument(:desc)).first\n end",
"def move_to_bottom\n last_sib = last_sibling\n move_to_right_of(last_sib) if last_sib && self != last_sib\n end",
"def move_to_top\n return unless in_list?\n acts_as_list_class.transaction do\n increment_positions_on_higher_items\n assume_top_position\n end\n end",
"def bottom_item(except = nil)\n except ? siblings.reject{|page| page == self }.last : siblings.last\n end",
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n higher_item.increment_position\n decrement_position\n end\n end",
"def bottom=(value)\n @bottom = value\n end",
"def move_to_top\n # return unless in_list?\n acts_as_list_class.transaction do\n # increment_positions_on_higher_items\n in_list? ? increment_positions_on_higher_items : increment_positions_on_all_items\n assume_top_position\n end\n end",
"def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end",
"def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end",
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n if higher_item.current_position != current_position\n swap_positions_with(higher_item)\n else\n higher_item.increment_position\n decrement_position\n end\n end\n end",
"def move_higher\n return if position_in_list == 1\n move_to(position_in_list - 1)\n end",
"def last?\n return false unless in_list?\n bottom_pos = bottom_position_in_list\n my_position == bottom_pos\n end",
"def last?\n return false unless in_list?\n bottom_pos = bottom_position_in_list\n my_position == bottom_pos\n end",
"def move_higher\n higher = higher_item\n return unless higher\n acts_as_list_class.transaction do\n self.update_attribute(position_column, higher.send(position_column))\n higher.increment_position\n end\n end",
"def last?\n # return false unless in_list?\n self.send(position_column) == bottom_position_in_list\n end",
"def move_to_top\n return unless in_list?\n insert_at_position acts_as_list_top\n end",
"def bottom_queue_position_in_queue(except = nil)\n item = bottom_item_in_queue(except)\n item ? item.send(queue_position_column) : 0\n end",
"def move_to_top\n return if position_in_list == 1\n move_to(1)\n end",
"def assume_top_position\n set_list_position(acts_as_list_top)\n end",
"def move_to_bottom\n @item.move_to_bottom\n flash[:notice] = t(:moved_to_bottom, :thing => \"item\")\n redirect\n end",
"def move_to_bottom(klass)\n remove(klass)\n self.instance.add(klass)\n end",
"def move_to_bottom(tag, klass)\n remove(tag, klass)\n self.instance.add(tag, klass)\n end",
"def decrement_positions_on_lower_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} - 1)\", \"#{:position} > #{send(:position).to_i}\"\n )\n end",
"def move_to_top\n self.class.transaction do\n increment_position_of_higher_items\n set_top_position\n end\n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.increment_position\n decrement_position\n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.increment_position\n decrement_position\n end",
"def bottom\n @ole.Bottom\n end",
"def bottom\n @ole.Bottom\n end",
"def move_to_bottom_of(node)\n movement(node, :strict => true) do |to|\n self.left_sibling = to.target.record\n end\n end",
"def bottom\n return @bottom\n end",
"def check_top_position\n if current_position && !default_position? && current_position < acts_as_list_top\n self[position_column] = acts_as_list_top\n end\n end",
"def at_bottom?\n lower_siblings.empty?\n end",
"def move_down\n return if at_bottom?\n self.class.where(:position => self.position + 1).first.inc(:position, -1)\n inc(:position, 1)\n end",
"def last?\n position == bottom\n end",
"def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} + 1)\", \"#{:position} < #{send(:position).to_i}\"\n )\n end",
"def bottom\n scoped_all.size + start - 1\n end",
"def accept_list_item_end(list_item)\n @in_list_entry[-1] = list_end_for(@list.last)\n end",
"def fallen_off_bottom?\n self.y > $window.height\n end",
"def pad_bottom(y)\n yield\n move_down(y)\n end",
"def bottom=(bottom)\n @view__.bottom = bottom\n end",
"def test_moving\n item = QuotedList.first\n item.higher_items\n item.lower_items\n item.send :bottom_item # Part of private api\n end",
"def assume_top_position\n update_attribute(:position, 1)\n end",
"def bottom()\n @view__.bottom\n end",
"def align_bottom\n @vertical_align = :bottom\n return self\n end",
"def bottom(column)\n @grid[column].index([])\n end",
"def bottom_item_in_queue(except = nil)\n conditions = queue_scope_condition\n conditions = \"#{conditions} AND #{self.class.primary_key} != #{except.id}\" if except\n acts_as_queue_class.find(:first, :conditions => conditions, :order => \"#{queue_position_column} DESC\")\n end",
"def bottom=(b); self[1] = b - self[3]; return b; end",
"def html_bottom_items\n @html_bottom_items ||= []\n end",
"def decrement_position\n return unless in_list?\n set_list_position(current_position - 1)\n end",
"def assume_top_position\n update_attribute(position_column, 1)\n end",
"def bottom_aligned?\n value == :bottom\n end",
"def bottom\n `#{clientRect}.bottom` + Window.scrollY\n end",
"def assume_top_position\n set_my_position(1)\n end",
"def assume_top_position\n set_my_position(1)\n end",
"def higher_item\n # return nil unless in_list? # http://github.com/brightspark3/acts_as_list/commit/8e55352aaa437d23a1ebdeabd5276c6dd5aad6a1\n \n # acts_as_list_class.find(:first, :conditions =>\n # \"#{scope_condition} AND #{position_column} < #{send(position_column).to_s}\", :order => \"#{position_column} DESC\"\n # ) \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n where(\"#{position_column} = #{(send(position_column).to_i - 1).to_s}\").first\n end \n end",
"def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} < ?\", current_position).increment_all\n end",
"def max_heapify_bottom_up(index)\n if parent_i(index) && self[parent_i(index)] < self[index] \n self.swap(parent_i(index), index)\n max_heapify_bottom_up(parent_i(index))\n end\n end",
"def decrement_position\n return unless in_list?\n update_attribute :position, self.send(:position).to_i - 1\n end",
"def bottom()\n return @top + @height\n end",
"def move_lower\n lower = lower_item\n return unless lower\n acts_as_list_class.transaction do\n self.update_attribute(position_column, lower.send(position_column))\n lower.decrement_position\n end\n end",
"def add_bottom (card)\n @cards.unshift(card);\n end",
"def bottom\n @widget.margins.bottom + @widget.borders.bottom\n end",
"def assume_top_queue_position\n update_attribute(queue_position_column, 1)\n end",
"def goto_bottom\n if y < battlefield_height - 61\n accelerate 1\n else\n @at_bottom = true\n end\n end",
"def remove_from_list\n return unless in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end",
"def add_card_to_bottom(card)\n unless self.id.nil? or (card.deck_id == self.id and card.card_order == 1)\n # Decrese the orders for the cards above in the old deck\n if card.deck_id\n card.deck.cards.where(\"card_order > ?\", card.card_order).each do |r|\n r.update_attributes(card_order: (r.card_order-1) )\n end\n end\n # Increase the orders for cards above in the new deck\n cards.each do |r|\n r.update_attributes(card_order: (r.card_order+1) )\n end\n # Add the card to the bottom of the new deck\n card.update_attributes(deck_id: id, card_order: 1)\n end\n end",
"def bottom; return self[1]+self[3]; end",
"def move_to_bottom_on_unarchive\n if self.just_unarchived\n self.just_unarchived = false\n self.move_to_bottom if self.respond_to?(:move_to_bottom)\n end\n return true\n end",
"def move_lower\n return unless lower_item\n\n acts_as_list_class.transaction do\n if lower_item.current_position != current_position\n swap_positions_with(lower_item)\n else\n lower_item.decrement_position\n increment_position\n end\n end\n end",
"def last(n = 1, before: nil, &block)\n return super(n, &block) unless before\n\n if include? before\n last_item_before before, n\n else\n super(n) { |item| item.before? before }\n end\n end",
"def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end\n end"
] | [
"0.8895148",
"0.8751973",
"0.872385",
"0.84182245",
"0.83475506",
"0.8330359",
"0.83057916",
"0.80619425",
"0.79133695",
"0.7763853",
"0.7697672",
"0.76956654",
"0.7365909",
"0.73552006",
"0.73487",
"0.7337892",
"0.7336568",
"0.73062414",
"0.7229807",
"0.720082",
"0.69901395",
"0.68394107",
"0.68249726",
"0.67958105",
"0.67765653",
"0.6678921",
"0.6678921",
"0.6662658",
"0.6627618",
"0.6623719",
"0.6616429",
"0.6591149",
"0.6587812",
"0.6566184",
"0.6516594",
"0.6495591",
"0.63998437",
"0.63998437",
"0.6331885",
"0.6306436",
"0.6304637",
"0.6304637",
"0.62882674",
"0.628714",
"0.62396854",
"0.6207046",
"0.6201637",
"0.6196152",
"0.6186777",
"0.6137035",
"0.61358637",
"0.611892",
"0.6115051",
"0.61100405",
"0.61100405",
"0.6104132",
"0.6104132",
"0.610402",
"0.6078328",
"0.6077874",
"0.6046326",
"0.60284215",
"0.5996295",
"0.59788185",
"0.59745896",
"0.59279174",
"0.58751196",
"0.5831061",
"0.5830013",
"0.5818573",
"0.58077043",
"0.5785598",
"0.577064",
"0.5761794",
"0.5757739",
"0.5739056",
"0.5699103",
"0.569658",
"0.5671897",
"0.5614871",
"0.56095916",
"0.5604506",
"0.5604506",
"0.5584251",
"0.5582102",
"0.557759",
"0.55644834",
"0.554633",
"0.5540351",
"0.55111355",
"0.54990774",
"0.54959196",
"0.54927117",
"0.5483926",
"0.54809535",
"0.5480273",
"0.54788953",
"0.5473179",
"0.54721785",
"0.54511714"
] | 0.8451492 | 3 |
Forces item to assume the top position in the list. | def assume_top_position
update_attribute(:position, 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assume_top_position\n set_list_position(acts_as_list_top)\n end",
"def move_to_top\n return unless in_list?\n acts_as_list_class.transaction do\n increment_positions_on_higher_items\n assume_top_position\n end\n end",
"def move_to_top\n # return unless in_list?\n acts_as_list_class.transaction do\n # increment_positions_on_higher_items\n in_list? ? increment_positions_on_higher_items : increment_positions_on_all_items\n assume_top_position\n end\n end",
"def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end",
"def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end",
"def move_to_top\n return if position_in_list == 1\n move_to(1)\n end",
"def move_to_top\n return unless in_list?\n insert_at_position acts_as_list_top\n end",
"def check_top_position\n if current_position && !default_position? && current_position < acts_as_list_top\n self[position_column] = acts_as_list_top\n end\n end",
"def move_to_top\n self.class.transaction do\n increment_position_of_higher_items\n set_top_position\n end\n end",
"def assume_top_position\n set_my_position(1)\n end",
"def assume_top_position\n set_my_position(1)\n end",
"def top_item\n @current = 0\n\n items\n end",
"def assume_top_position\n update_attribute(position_column, 1)\n end",
"def move_to_top\n return true if at_top?\n move_above(first_sibling_in_list)\n end",
"def lower_item\n return nil unless in_list?\n acts_as_list_class.find(:first, :conditions =>\n \"position = #{(send(:position).to_i + 1).to_s}\"\n )\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1 \n set_my_position(pos)\n end",
"def assume_top_queue_position\n update_attribute(queue_position_column, 1)\n end",
"def assume_bottom_position\n set_list_position(bottom_position_in_list(self).to_i + 1)\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1\n set_my_position(pos)\n end",
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n higher_item.increment_position\n decrement_position\n end\n end",
"def set_top\n self.class.transaction do\n self.class.where(tag_id: self.tag_id).where.not(id: self.id).update_all('`position` = `position` + 1')\n self.update(:position => 0)\n end\n end",
"def move_lower\n return unless lower_item\n\n acts_as_list_class.transaction do\n if lower_item.current_position != current_position\n swap_positions_with(lower_item)\n else\n lower_item.decrement_position\n increment_position\n end\n end\n end",
"def move_to_top_in_queue\n return unless in_queue?\n acts_as_queue_class.transaction do\n increment_queue_positions_on_higher_items\n assume_top_queue_position\n end\n end",
"def move_lower\n lower = lower_item\n return unless lower\n acts_as_list_class.transaction do\n self.update_attribute(position_column, lower.send(position_column))\n lower.decrement_position\n end\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.current_position : acts_as_list_top - 1\n end",
"def move_lower\n low_item = lower_item\n return unless low_item\n\n low_item.decrement_position\n increment_position\n end",
"def move_lower\n low_item = lower_item\n return unless low_item\n\n low_item.decrement_position\n increment_position\n end",
"def move_to_top(klass)\n self.instance.add(klass, 0)\n end",
"def move_to_top(tag, klass)\n self.instance.add(tag, klass, 0)\n end",
"def move_higher\n higher = higher_item\n return unless higher\n acts_as_list_class.transaction do\n self.update_attribute(position_column, higher.send(position_column))\n higher.increment_position\n end\n end",
"def decrement_positions_on_lower_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} - 1)\", \"#{:position} > #{send(:position).to_i}\"\n )\n end",
"def lower_item\n return nil unless in_list?\n\n conditions = scope_condition.merge!(greater_than_me)\n order_by_position(conditions).first\n end",
"def lower_item\n return nil unless in_list?\n\n conditions = scope_condition.merge!( greater_than_me )\n order_by_position(conditions).first\n end",
"def lower_item\n # return nil unless in_list?\n # acts_as_list_class.find(:first, :conditions => \"#{scope_condition} AND #{position_column} > #{send(position_column).to_s}\", :order => \"#{position_column} ASC\")\n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n where(\"#{position_column} = #{(send(position_column).to_i + 1).to_s}\").first\n end \n end",
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n if higher_item.current_position != current_position\n swap_positions_with(higher_item)\n else\n higher_item.increment_position\n decrement_position\n end\n end\n end",
"def assume_bottom_position\n update_attribute(:position, bottom_position_in_list(self).to_i + 1)\n end",
"def move_to_top\n first_sib = first_sibling\n move_to_left_of(first_sib) if first_sib && self != first_sib\n end",
"def lower_items(limit=nil)\n limit ||= acts_as_list_list.count\n acts_as_list_list.\n where(\"#{quoted_position_column_with_table_name} >= ?\", current_position).\n where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", self.send(self.class.primary_key)).\n reorder(acts_as_list_order_argument(:asc)).\n limit(limit)\n end",
"def lower_item\n return nil unless in_list?\n lower_items(1).first\n end",
"def higher_item\n # return nil unless in_list? # http://github.com/brightspark3/acts_as_list/commit/8e55352aaa437d23a1ebdeabd5276c6dd5aad6a1\n \n # acts_as_list_class.find(:first, :conditions =>\n # \"#{scope_condition} AND #{position_column} < #{send(position_column).to_s}\", :order => \"#{position_column} DESC\"\n # ) \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n where(\"#{position_column} = #{(send(position_column).to_i - 1).to_s}\").first\n end \n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item #(except)\n item ? item.my_position : 0\n end",
"def keep_top\n @pos_y = court.top_y\n end",
"def bottom_position_in_list(_except = nil)\n item = bottom_item # (except)\n item ? item.my_position : 0\n end",
"def move_to_bottom\n # return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items if in_list?\n assume_bottom_position\n end\n end",
"def move_to_top\n @item.move_to_top\n flash[:notice] = t(:moved_to_top, :thing => \"item\")\n redirect\n end",
"def move_to_bottom\n return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end",
"def set_initial_position\n self.position = (Category.minimum(:position) || 0) - 1\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.send(:position) : 0\n end",
"def top()\n tp = pop\n push(tp)\n tp\n end",
"def higher_item\n return nil unless in_list?\n higher_items(1).first\n end",
"def top(value)\n @ole.Top = value\n nil\n end",
"def top(value)\n @ole.Top = value\n nil\n end",
"def top()\n x = pop()\n push(x)\n x\n end",
"def top\n _exchange(true)\n end",
"def set_initial_position\n if self.class.count == 0\n self.position = 0\n elsif self.position == nil\n self.position = self.class.last.position + 1\n end\n end",
"def move_lower\n return if self == self_and_siblings(true).last\n move_to(position_in_list + 1)\n end",
"def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} + 1)\", \"#{:position} < #{send(:position).to_i}\"\n )\n end",
"def lower_item\n return nil unless list_id\n Card.find :first,\n :conditions => \"list_id = #{list_id} AND list_position < #{list_position}\",\n :order => \"list_position DESC\"\n end",
"def update_position\n if self.simple_acts_as_list_scope.length == 0\n self.position = 1\n else\n self.position = self.simple_acts_as_list_scope.last.position + 1\n end\n end",
"def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end\n end",
"def remove_from_list\n return unless in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end",
"def prioritize(index, position = 1)\n\[email protected](position-1, @items.delete_at(index.to_i-1))\n\t@items[position.to_i-1]\n\t\t\n\tend",
"def bottom_item\n @current = last\n\n items\n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.increment_position\n decrement_position\n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.increment_position\n decrement_position\n end",
"def front\n @items[0]\n end",
"def bottom_item(except = nil)\n conditions = \"#{self.class.primary_key} != #{except.id}\" if except\n acts_as_list_class.find(:first, :conditions => conditions, :order => \"#{:position} DESC\")\n end",
"def higher_item\n return nil unless in_list?\n conditions = scope_condition.merge!( less_than_me )\n order_by_position(conditions).last\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end",
"def top(val)\n raise \"top requires an Integer.\" unless val.is_a? Integer\n @top = val\n self\n end",
"def higher_item\n return nil unless in_list?\n conditions = scope_condition.merge!(less_than_me)\n order_by_position(conditions).last\n end",
"def prev_item\n @current -= 1 if @current > 0\n\n items\n end",
"def move_higher\n return if position_in_list == 1\n move_to(position_in_list - 1)\n end",
"def top=(value)\n @top = value\n end",
"def top=(value)\n @top = value\n end",
"def set_first\n return 0 if @first_item.nil?\n first = 0\n (0..item_max - 1).each { |i|\n first = i if @data[i].id == @first_item\n }\n @index = first\n end",
"def top(num)\n @top = num\n self\n end",
"def decrement_positions_on_lower_items(position=current_position)\n return unless in_list?\n\n if sequential_updates?\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} > ?\", position).reorder(acts_as_list_order_argument(:asc)).decrement_sequentially\n else\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} > ?\", position).decrement_all\n end\n end",
"def set_top(position, piece)\n if position < 0 || position > 2\n \"Not a valid spot, please put the piece in the 0-2 spot\" \n else\n @top.delete_at(position)\n @top.insert(position, piece)\n end\n end",
"def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} < ?\", current_position).increment_all\n end",
"def peek\n item = pop\n push(item)\n item\n end",
"def peek\n\t\[email protected]\n\tend",
"def increment_positions_on_lower_items(position, avoid_id = nil)\n scope = acts_as_list_list\n\n if avoid_id\n scope = scope.where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", avoid_id)\n end\n\n if sequential_updates?\n scope.where(\"#{quoted_position_column_with_table_name} >= ?\", position).reorder(acts_as_list_order_argument(:desc)).increment_sequentially\n else\n scope.where(\"#{quoted_position_column_with_table_name} >= ?\", position).increment_all\n end\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position\n end",
"def higher_item\n return nil unless list_id\n Card.find :first,\n :conditions => \"list_id = #{list_id} AND list_position > #{list_position}\",\n :order => \"list_position\"\n end",
"def before(single)\n self[index(single) - 1]\n end",
"def top\n self.position[:y]\n end",
"def move_to_bottom\n self.class.transaction do\n decrement_position_of_lower_items\n set_bottom_position\n end\n end",
"def increment_positions_on_lower_items(position)\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{scope_condition} AND #{position_column} >= #{position}\")\n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{position_column} >= #{position}\")\n end \n end",
"def swap_with_next i\n #if first_item >= first_item.next_list_item\n\n end",
"def bottom_item(except = nil)\n # conditions = scope_condition\n # conditions = \"#{conditions} AND #{self.class.primary_key} != #{except.id}\" if except\n # acts_as_list_class.find(:first, :conditions => conditions, :order => \"#{position_column} DESC\")\n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n conditions = except.nil?() ? \"\" : \"#{self.class.primary_key} != #{except.id}\" \n where(conditions).order(\"#{position_column} DESC\").first\n end \n end",
"def move_to_bottom\n return unless in_list?\n insert_at_position bottom_position_in_list.to_i\n end",
"def priority #most important item\n @items.first\n end",
"def peek\n if @count > 0\n @items[@count - 1]\n else\n raise \"There are no items in the stack\"\n end\n end",
"def min_item\n list.min do |a, b|\n return -1 if a[0].null_item?\n return 1 if b[0].null_item?\n a[1] <=> b[1]\n end\n end",
"def item_at_offset(offset)\n item_index = self.simple_acts_as_list_scope.index(self)\n index = item_index + offset\n index < 0 ? nil : self.simple_acts_as_list_scope[index]\n end",
"def top=(val) @img_stack.top = val; end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.send(position_column) : 0\n end",
"def bottom_item(except = nil)\n scope = acts_as_list_list\n\n if except\n scope = scope.where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", except.id)\n end\n\n scope.in_list.reorder(acts_as_list_order_argument(:desc)).first\n end",
"def top\n copy = self.deep_copy\n copy.parent = nil\n copy\n end"
] | [
"0.84269834",
"0.82675207",
"0.82260305",
"0.8187087",
"0.8187087",
"0.7804485",
"0.77915674",
"0.7559511",
"0.75136405",
"0.74292815",
"0.74292815",
"0.7241875",
"0.7085184",
"0.6894807",
"0.6806887",
"0.6767487",
"0.6756102",
"0.6746853",
"0.6664958",
"0.66403157",
"0.6640205",
"0.6563699",
"0.65438163",
"0.652653",
"0.6458182",
"0.6445096",
"0.6445096",
"0.6439249",
"0.6402962",
"0.6390025",
"0.63810563",
"0.63731045",
"0.63331133",
"0.63204837",
"0.6318312",
"0.63043475",
"0.62818503",
"0.62798053",
"0.62510574",
"0.6249512",
"0.62367624",
"0.62367076",
"0.62334424",
"0.62228596",
"0.6173136",
"0.6158848",
"0.61556333",
"0.614576",
"0.61418825",
"0.6127049",
"0.6123636",
"0.6123636",
"0.61199296",
"0.60831356",
"0.60774195",
"0.6027079",
"0.601655",
"0.6012891",
"0.60122454",
"0.5976361",
"0.59699464",
"0.5964399",
"0.59618753",
"0.596086",
"0.596086",
"0.5960287",
"0.5953264",
"0.59008276",
"0.5895328",
"0.58829814",
"0.5866228",
"0.58569306",
"0.58138347",
"0.5807577",
"0.58072186",
"0.5796202",
"0.57911974",
"0.57871413",
"0.57859683",
"0.5779306",
"0.5779221",
"0.5752217",
"0.5749316",
"0.5696917",
"0.56857073",
"0.56771624",
"0.566399",
"0.5641085",
"0.56344223",
"0.5632269",
"0.56192446",
"0.561761",
"0.56141996",
"0.5586434",
"0.55751264",
"0.5573178",
"0.555474",
"0.55469733",
"0.55440736",
"0.55380535"
] | 0.74106985 | 11 |
This has the effect of moving all the lower items up one. | def decrement_positions_on_lower_items
return unless in_list?
acts_as_list_class.update_all(
"#{:position} = (#{:position} - 1)", "#{:position} > #{send(:position).to_i}"
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_lower\n low_item = lower_item\n return unless low_item\n\n low_item.decrement_position\n increment_position\n end",
"def move_lower\n low_item = lower_item\n return unless low_item\n\n low_item.decrement_position\n increment_position\n end",
"def move_lower\n return unless lower_item\n\n acts_as_list_class.transaction do\n if lower_item.current_position != current_position\n swap_positions_with(lower_item)\n else\n lower_item.decrement_position\n increment_position\n end\n end\n end",
"def move_up_in_collection!\n weight = self.weight\n\n if previous_item = self.prioritizable_collection.where(['weight > ?', weight]).last\n swap_weight_with_other_item!(previous_item)\n end\n end",
"def move_up\n return if at_top?\n self.class.where(:position => self.position - 1).first.inc(:position, 1)\n inc(:position, -1)\n end",
"def move_lower\n lower = lower_item\n return unless lower\n acts_as_list_class.transaction do\n self.update_attribute(position_column, lower.send(position_column))\n lower.decrement_position\n end\n end",
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n higher_item.increment_position\n decrement_position\n end\n end",
"def move_to_top\n self.class.transaction do\n increment_position_of_higher_items\n set_top_position\n end\n end",
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n if higher_item.current_position != current_position\n swap_positions_with(higher_item)\n else\n higher_item.increment_position\n decrement_position\n end\n end\n end",
"def move_up\n @array[0...XSIZE].each_with_index { |e, x| yield e } if block_given?\n @array = @array[XSIZE..-1].concat(@array[0...XSIZE])\n end",
"def move_to_bottom\n self.class.transaction do\n decrement_position_of_lower_items\n set_bottom_position\n end\n end",
"def move_lower\n return if self == self_and_siblings(true).last\n move_to(position_in_list + 1)\n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.increment_position\n decrement_position\n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.increment_position\n decrement_position\n end",
"def move_lower_in_queue\n return unless lower_item_in_queue\n\n acts_as_queue_class.transaction do\n lower_item_in_queue.decrement_queue_position\n increment_queue_position\n end\n end",
"def move_higher\n higher = higher_item\n return unless higher\n acts_as_list_class.transaction do\n self.update_attribute(position_column, higher.send(position_column))\n higher.increment_position\n end\n end",
"def move_to_top\n # return unless in_list?\n acts_as_list_class.transaction do\n # increment_positions_on_higher_items\n in_list? ? increment_positions_on_higher_items : increment_positions_on_all_items\n assume_top_position\n end\n end",
"def from_up(cur)\n\t\tmove(cur, -1, 0)\n\tend",
"def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end",
"def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end",
"def move_up\n current_y = position[0] - 1\n position[0] = (current_y < 0 ) ? (width-1) : current_y\n end",
"def move_to_top\n return unless in_list?\n acts_as_list_class.transaction do\n increment_positions_on_higher_items\n assume_top_position\n end\n end",
"def move_up\n @collection.move_higher\n redirect_to account_collections_url, notice: 'Collection was successfully reordered.'\n end",
"def move_lower\n movement { self.position += 1 }\n end",
"def move_to_bottom\n # return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items if in_list?\n assume_bottom_position\n end\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end",
"def move_to_bottom\n return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end",
"def move_higher\n movement { self.position -= 1 }\n end",
"def bubble_up()\n\t\ti = @elements.length - 1\n\t\twhile(i > 0)\n\t\t\t# compare with its parent. swap if parent is less than it\n\t\t\tif @elements[(i-1)/2][@orderBy] >= @elements[i][@orderBy]\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tswap((i-1)/2, i)\n\t\t\t\ti = (i-1)/2\n\t\t\tend\n\t\tend\n\tend",
"def decrement_positions_on_lower_items\n # return unless in_list?\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} - 1)\", \"#{scope_condition} AND #{position_column} > #{send(position_column).to_i}\") \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} - 1)\", \"#{position_column} > #{send(position_column).to_i}\")\n end \n end",
"def move_higher\n return if position_in_list == 1\n move_to(position_in_list - 1)\n end",
"def move_up\n unless @value.eql? 1\n @y -= 50\n @value -= 1\n end\n end",
"def move_up(array)\r\n set_current_row_col(array)\r\n new_row = (@current_row == 0) ? array.length - 1 : @current_row - 1 # This logic will decide the new co-ordinated of space\r\n current_ele = array[new_row][@current_col]\r\n prepare_new_array(new_row, @current_col, array, current_ele, @current_row)\r\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position\n end",
"def move_up_left\n i = 1\n until false\n x, y = @pos\n x -= i\n y -= i\n pos = [x, y]\n break if x > 7 || x < 0 || y > 7 || y < 0 || @board[pos].color == @color\n @moves << pos\n break if @board[pos].color != @color\n i += 1\n end\n end",
"def bubble_up(i)\n while i > 0\n parent = (i+1) / 2 - 1\n if @contents[parent].key >= @contents[i].key then\n @contents[parent],@contents[i] = @contents[i],@contents[parent]\n i = parent\n else return\n end\n end\n end",
"def move_up\n up_tile = C[@location.first - 1, @location.second]\n move_to(up_tile)\n end",
"def decrement_queue_positions_on_lower_items\n return unless in_queue?\n acts_as_queue_class.update_all(\n \"#{queue_position_column} = (#{queue_position_column} - 1)\", \"#{queue_scope_condition} AND #{queue_position_column} > #{send(queue_position_column).to_i}\"\n )\n end",
"def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} + 1)\", \"#{:position} < #{send(:position).to_i}\"\n )\n end",
"def move_up\n # TODO: maybe refactor this to use acts-as-list or ranked-model\n aisles = @store.aisles\n\n # first, compact everything back down to 1-n in case a delete or something got it out of whack\n aisles.sort! { |a, b| a.position <=> b.position }\n aisles.each_with_index do |aisle, i|\n aisle.position = i + 1\n aisle.save!\n end\n\n @aisle = aisles.find(params[:id])\n original_position = @aisle.position\n if original_position > 1\n @aisle.position -= 1\n @aisle.save!\n aisles.each do |aisle|\n aisle.position += 1 if aisle != @aisle &&\n aisle.position >= @aisle.position &&\n aisle.position <= original_position\n aisle.save!\n end\n end\n redirect_to(store_aisles_url(@store.id))\n end",
"def sift_up(i)\n parent = (i - 1) / 2\n if parent >= 0 and @heap[parent] > @heap[i]\n @heap[parent], @heap[i] = @heap[i], @heap[parent]\n sift_up(parent)\n end\n end",
"def move_up\n up_tile = Couple.new(@location.first - 1, @location.second)\n move_to(up_tile)\n end",
"def move_to_top\n return if position_in_list == 1\n move_to(1)\n end",
"def move_higher_in_queue\n return unless higher_item_in_queue\n\n acts_as_queue_class.transaction do\n higher_item_in_queue.increment_queue_position\n decrement_queue_position\n end\n end",
"def move_up\n\t\t# if the horse isn't yet at the top of the screen move it up 20\n\t\tif @y > 0\n\t\t\t@y = @y -20\n\t\tend\n\tend",
"def up_item \n order_op2(true, @item)\n end",
"def move_down\n return if at_bottom?\n self.class.where(:position => self.position + 1).first.inc(:position, -1)\n inc(:position, 1)\n end",
"def move_down\n @collection.move_lower\n redirect_to account_collections_url, notice: 'Collection was successfully reordered.'\n end",
"def move_higher \n prev_sib = previous_sibling\n move_to_left_of(prev_sib) if prev_sib\n end",
"def move_down\n @array[-XSIZE..-1].each_with_index { |e, x| yield e } if block_given?\n @array = @array[-XSIZE..-1].concat(@array[0...-XSIZE])\n end",
"def decrement_positions_on_lower_items(position=current_position)\n return unless in_list?\n\n if sequential_updates?\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} > ?\", position).reorder(acts_as_list_order_argument(:asc)).decrement_sequentially\n else\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} > ?\", position).decrement_all\n end\n end",
"def move_lower\n next_sib = next_sibling\n move_to_right_of(next_sib) if next_sib\n end",
"def moveup\n papers = venue.papers.where(\"listorder < ?\",self.listorder).order(:listorder)\n \n if papers.length == 1\n self.listorder = papers[0].listorder - 1.0\n elsif papers.length > 1\n self.listorder = (papers[papers.length-1].listorder + papers[papers.length-2].listorder) / 2\n end\n end",
"def move_down\n @item.move_lower\n flash[:notice] = t(:moved_lower, :thing => \"item\")\n redirect\n end",
"def piece_up\n return unless @falling_piece\n\n @falling_piece.y -= @block_size\n @falling_piece.grid_position.y -= 1\n end",
"def move_up\n\t\tunless @y_player <= 0\n\t\t\t@y_player -= 4\n\t\tend\n\tend",
"def move_down\n\t\tmove([0,1])\n\tend",
"def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} < ?\", current_position).increment_all\n end",
"def test_moving\n item = QuotedList.first\n item.higher_items\n item.lower_items\n item.send :bottom_item # Part of private api\n end",
"def move_to_top(klass)\n self.instance.add(klass, 0)\n end",
"def move_up()\n floor_before_move = @building.floors[@current_floor]\n floor_before_move.board_elevator(self)\n @current_floor += 1\n exit_passengers(@current_floor)\n new_floor = @building.floors[@current_floor]\n new_floor.board_elevator(self)\n if num_passengers == 0\n @direction = \"stationary\"\n end \n end",
"def move_west\n @x -= 1\n end",
"def move_up(index)\n\t\traise ArgumentError, \"Can not move the primary Style\" if index == 0\n\t\traise IndexError, \"Indices must be positive natural numbers.\" if index < 0\n\t\t\n\t\t\n\t\t# can't be 0: can't move the primary style \n\t\t# can't be 1: can't move the style at index 1 up, because it would displace the primary\n\t\tif index > 1\n\t\t\tsrc = index\n\t\t\tdst = index - 1\n\t\t\t\n\t\t\tswap(@styles, src, dst)\n\t\tend\n\tend",
"def move_up(environment)\n @previous_action = 'moved up'\n location[:y] -= 1 if can_move_up?(environment)\n environment.state\n end",
"def move_to_top_in_queue\n return unless in_queue?\n acts_as_queue_class.transaction do\n increment_queue_positions_on_higher_items\n assume_top_queue_position\n end\n end",
"def calculate_up_child\n # Guard condition for movement not possible\n return nil if blank_y + 1 == size\n\n # Make the movement\n new_state = swap_up\n\n # Avoids loop\n parents_array = parent_states(3)\n return nil if parents_array.include?(new_state)\n\n # Returns new node\n Node.new(new_state, self, blank_x, blank_y + 1)\n end",
"def move_to_top\n return unless in_list?\n insert_at_position acts_as_list_top\n end",
"def lower_position!(amount = 2)\n if position > 0\n update!(position: position - amount)\n end\n dashboard.reposition_cells\n position\n end",
"def sift_up(current_index, heap)\n parent_index = (current_index - 1) / 2\n while current_index > 0 && heap[current_index] < heap[parent_index]\n self.swap(current_index, parent_index, heap)\n current_index = parent_index\n parent_index = (current_index - 1) / 2\n end\n end",
"def prev_item\n @current -= 1 if @current > 0\n\n items\n end",
"def move_up\n\n section = Section.find(params[:id])\n index = section.checklist.sections.index(section)\n if section.checklist.sections[index].move_higher\n flash['notice'] = 'Sections were re-ordered'\n else\n flash['notice'] = 'Section re-order failed'\n end\n\n redirect_to(:controller => 'checklist', \n :action => 'edit', \n :id => section.checklist_id)\n end",
"def move_up_right\n i = 1\n until false\n x, y = @pos\n x -= i\n y += i\n pos = [x, y]\n break if x > 7 || x < 0 || y > 7 || y < 0 || @board[pos].color == @color\n @moves << pos\n break if @board[pos].color != @color\n i += 1\n end\n end",
"def move_up\r\n if @y + @vel_y > GAME_PRESET[\"player_move_up\"]\r\n @y -= @vel_y\r\n end\r\n end",
"def move_object_up(object)\n object.location_move_up unless is_wall?(object.location_up)\n end",
"def increment_positions_on_higher_items\n # return unless in_list?\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{scope_condition} AND #{position_column} < #{send(position_column).to_i}\") \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{position_column} < #{send(position_column).to_i}\")\n end \n end",
"def move_to_bottom_in_queue\n return unless in_queue?\n acts_as_queue_class.transaction do\n decrement_queue_positions_on_lower_items\n assume_bottom_queue_position\n end\n end",
"def move_up(n)\n self.y += n\n end",
"def action_up\n @ui.index -= 1\n end",
"def weapons_scroll_up\n guns[selected_gun].off\n @selected_gun -= 1\n if @selected_gun <= -1\n @selected_gun = @guns.length-1\n end\n guns[selected_gun].on\n end",
"def increment_positions_on_lower_items(position)\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{scope_condition} AND #{position_column} >= #{position}\")\n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{position_column} >= #{position}\")\n end \n end",
"def vshift(amount)\n @top += amount\n self\n end",
"def sift_up(current_idx, heap)\n parent_idx = (current_idx - 1) / 2\n while current_idx > 0 && heap[current_idx] < heap[parent_idx]\n self.swap(current_idx, parent_idx, heap)\n current_idx = parent_idx\n parent_idx = (current_idx - 1) / 2\n end\n end",
"def down_item\n order_op2(false, @item)\n end",
"def paddle_left_up\n @paddles[0].move_up\n end",
"def move_above(other)\n if position > other.position\n new_position = other.position\n other.lower_siblings.where(:position.lt => self.position).each { |s| s.inc(:position, 1) }\n other.inc(:position, 1)\n self.position = new_position\n save!\n else\n new_position = other.position - 1\n other.higher_siblings.where(:position.gt => self.position).each { |s| s.inc(:position, -1) }\n self.position = new_position\n save!\n end\n end",
"def move_to_top\n first_sib = first_sibling\n move_to_left_of(first_sib) if first_sib && self != first_sib\n end",
"def bubble_up(index, node)\n while (index!=0 && @ary[(index-1)/2].key > node.key) #while parent is bigger,\n @ary[index], @ary[(index-1)/2] = @ary[(index-1)/2], @ary[index] #swap\n index = (index-1)/2\n end\n end",
"def swap_with_next i\n #if first_item >= first_item.next_list_item\n\n end",
"def move_up\n\n subsection = Subsection.find(params['id']) \n index = subsection.section.subsections.index(subsection)\n\n if subsection.section.subsections[index].move_higher\n flash['notice'] = 'Subsections were re-ordered'\n else\n flash['notice'] = 'Subsection re-order failed'\n end\n \n redirect_to(:controller => 'checklist', \n :action => 'edit', \n :id => subsection.checklist.id)\n end",
"def move_everything_up_between(lower, upper, ary)\n new_ary = Array.new(ary)\n new_ary.each do |a|\n if (upper..lower).cover?(a[1])\n a[1] -= 1\n end\n end\n return new_ary\n end",
"def move_up\n #get current order of step\n i = self.step_order\n saved = false\n experiment = self.experiment\n\n unless i == 1 \n # increment the order of the previous step\n other_step = experiment.steps.find_by_step_order(i - 1) \n other_step.step_order = i\n self.step_order = i - 1\n \n saved = self.save && other_step.save\n end\n saved\n end",
"def remove_from_list\n return unless in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end",
"def move_prev\n self.step -= 1\n 'prev'\n end",
"def move_up(mat, y, x)\n return if (y - 1) < 0\n\n zero_el = mat[y][x]\n other_el = mat[y - 1][x]\n mat[y - 1][x] = zero_el\n mat[y][x] = other_el\n\n { m: mat, zero: update_coordinates(zero_el, other_el), move: :up }\nend",
"def move_to_top\n @item.move_to_top\n flash[:notice] = t(:moved_to_top, :thing => \"item\")\n redirect\n end",
"def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end\n end",
"def increment_queue_positions_on_lower_items(queue_position)\n acts_as_queue_class.update_all(\n \"#{queue_position_column} = (#{queue_position_column} + 1)\", \"#{queue_scope_condition} AND #{queue_position_column} >= #{queue_position}\"\n )\n end",
"def decrement_position\n return unless in_list?\n\n # self_class_all_or_in_collection.where(:pos => my_position).\n adjust_position!(-1)\n end",
"def go_up\n self.current_floor += 1\n end",
"def move_up\n # Ensure each parent node to this node (the goal here is to hit a question node) is valid\n !survey.node_maps.select do |i|\n i.node == self\n end.collect do |node_map|\n # Parent must be an answer - cannot move into the position of a Question!\n next unless !node_map.parent.nil? && node_map.parent.node.class.ancestors.include?(::ActiveRecordSurvey::Node::Answer)\n\n # I know this looks overly complicated, but we need to always work with the survey.node_maps - never children/parent of the relation\n parent_node = survey.node_maps.select do |j|\n node_map.parent == j\n end.first\n\n parent_parent = survey.node_maps.select do |j|\n node_map.parent.parent == j\n end.first\n\n node_map.parent = parent_parent\n parent_parent.children << node_map\n\n survey.node_maps.select do |j|\n node_map.children.include?(j)\n end.each do |c|\n c.parent = parent_node\n parent_node.children << c\n end\n\n parent_node.parent = node_map\n node_map.children << parent_node\n end\n end"
] | [
"0.8017883",
"0.8017883",
"0.79280317",
"0.7623656",
"0.7591928",
"0.7574836",
"0.7452978",
"0.7427453",
"0.73179835",
"0.73155963",
"0.7238273",
"0.7236713",
"0.7190494",
"0.7190494",
"0.7165726",
"0.7165582",
"0.71362764",
"0.7101295",
"0.7091394",
"0.7091394",
"0.7044215",
"0.6989861",
"0.6967021",
"0.6960664",
"0.69203085",
"0.69185317",
"0.67766756",
"0.6743976",
"0.6731308",
"0.6728658",
"0.6715652",
"0.67120826",
"0.66718596",
"0.66508746",
"0.66505253",
"0.6643381",
"0.66132057",
"0.6549409",
"0.6532027",
"0.65161014",
"0.6515804",
"0.64885664",
"0.6482959",
"0.64819145",
"0.64377046",
"0.64364195",
"0.6379829",
"0.63751",
"0.63741004",
"0.63590986",
"0.633135",
"0.6329911",
"0.6323698",
"0.63207823",
"0.6293508",
"0.6262976",
"0.62577325",
"0.62565196",
"0.62375927",
"0.61815226",
"0.6156789",
"0.61549807",
"0.61547375",
"0.61194474",
"0.6111225",
"0.61049753",
"0.60963124",
"0.6081213",
"0.60697174",
"0.6068873",
"0.60585135",
"0.6032126",
"0.6030228",
"0.6027863",
"0.6023503",
"0.6021415",
"0.6012376",
"0.6009382",
"0.6001194",
"0.5993528",
"0.5977013",
"0.5972973",
"0.5952607",
"0.59481937",
"0.59461987",
"0.5944915",
"0.59403664",
"0.59300303",
"0.59293896",
"0.59216636",
"0.59195554",
"0.5911416",
"0.5906751",
"0.590465",
"0.590339",
"0.5892282",
"0.5890321",
"0.5867223",
"0.5864581",
"0.5849854"
] | 0.7304567 | 10 |
This has the effect of moving all the higher items down one. | def increment_positions_on_higher_items
return unless in_list?
acts_as_list_class.update_all(
"#{:position} = (#{:position} + 1)", "#{:position} < #{send(:position).to_i}"
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n higher_item.increment_position\n decrement_position\n end\n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.increment_position\n decrement_position\n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.increment_position\n decrement_position\n end",
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n if higher_item.current_position != current_position\n swap_positions_with(higher_item)\n else\n higher_item.increment_position\n decrement_position\n end\n end\n end",
"def move_higher\n movement { self.position -= 1 }\n end",
"def move_higher\n return if position_in_list == 1\n move_to(position_in_list - 1)\n end",
"def move_higher\n higher = higher_item\n return unless higher\n acts_as_list_class.transaction do\n self.update_attribute(position_column, higher.send(position_column))\n higher.increment_position\n end\n end",
"def move_to_bottom\n self.class.transaction do\n decrement_position_of_lower_items\n set_bottom_position\n end\n end",
"def move_to_top\n self.class.transaction do\n increment_position_of_higher_items\n set_top_position\n end\n end",
"def move_lower\n low_item = lower_item\n return unless low_item\n\n low_item.decrement_position\n increment_position\n end",
"def move_lower\n low_item = lower_item\n return unless low_item\n\n low_item.decrement_position\n increment_position\n end",
"def decrement_positions_on_lower_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} - 1)\", \"#{:position} > #{send(:position).to_i}\"\n )\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end",
"def move_down\n return if at_bottom?\n self.class.where(:position => self.position + 1).first.inc(:position, -1)\n inc(:position, 1)\n end",
"def move_up\n return if at_top?\n self.class.where(:position => self.position - 1).first.inc(:position, 1)\n inc(:position, -1)\n end",
"def move_to_bottom\n # return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items if in_list?\n assume_bottom_position\n end\n end",
"def move_higher_in_queue\n return unless higher_item_in_queue\n\n acts_as_queue_class.transaction do\n higher_item_in_queue.increment_queue_position\n decrement_queue_position\n end\n end",
"def move_to_bottom\n return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end",
"def move_down\n\t\tmove([0,1])\n\tend",
"def move_up_in_collection!\n weight = self.weight\n\n if previous_item = self.prioritizable_collection.where(['weight > ?', weight]).last\n swap_weight_with_other_item!(previous_item)\n end\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position\n end",
"def move_higher \n prev_sib = previous_sibling\n move_to_left_of(prev_sib) if prev_sib\n end",
"def move_lower\n return unless lower_item\n\n acts_as_list_class.transaction do\n if lower_item.current_position != current_position\n swap_positions_with(lower_item)\n else\n lower_item.decrement_position\n increment_position\n end\n end\n end",
"def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end",
"def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end",
"def move_to_top\n # return unless in_list?\n acts_as_list_class.transaction do\n # increment_positions_on_higher_items\n in_list? ? increment_positions_on_higher_items : increment_positions_on_all_items\n assume_top_position\n end\n end",
"def move_to_top\n return unless in_list?\n acts_as_list_class.transaction do\n increment_positions_on_higher_items\n assume_top_position\n end\n end",
"def move_down\n @array[-XSIZE..-1].each_with_index { |e, x| yield e } if block_given?\n @array = @array[-XSIZE..-1].concat(@array[0...-XSIZE])\n end",
"def move_lower\n lower = lower_item\n return unless lower\n acts_as_list_class.transaction do\n self.update_attribute(position_column, lower.send(position_column))\n lower.decrement_position\n end\n end",
"def move_lower_in_queue\n return unless lower_item_in_queue\n\n acts_as_queue_class.transaction do\n lower_item_in_queue.decrement_queue_position\n increment_queue_position\n end\n end",
"def decrement_positions_on_lower_items\n # return unless in_list?\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} - 1)\", \"#{scope_condition} AND #{position_column} > #{send(position_column).to_i}\") \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} - 1)\", \"#{position_column} > #{send(position_column).to_i}\")\n end \n end",
"def decrement_queue_positions_on_lower_items\n return unless in_queue?\n acts_as_queue_class.update_all(\n \"#{queue_position_column} = (#{queue_position_column} - 1)\", \"#{queue_scope_condition} AND #{queue_position_column} > #{send(queue_position_column).to_i}\"\n )\n end",
"def decrement_positions_on_higher_items(position)\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} <= ?\", position).decrement_all\n end",
"def move_up\n current_y = position[0] - 1\n position[0] = (current_y < 0 ) ? (width-1) : current_y\n end",
"def down_item\n order_op2(false, @item)\n end",
"def decrement_positions_on_higher_items(position)\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} - 1)\", \"#{scope_condition} AND #{position_column} <= #{position}\") \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} - 1)\", \"#{position_column} <= #{position}\")\n end \n end",
"def move_up\n @array[0...XSIZE].each_with_index { |e, x| yield e } if block_given?\n @array = @array[XSIZE..-1].concat(@array[0...XSIZE])\n end",
"def move_up\n unless @value.eql? 1\n @y -= 50\n @value -= 1\n end\n end",
"def from_up(cur)\n\t\tmove(cur, -1, 0)\n\tend",
"def move_up\n @collection.move_higher\n redirect_to account_collections_url, notice: 'Collection was successfully reordered.'\n end",
"def move_down\n if @value < @options\n @y += 50\n @value += 1\n end\n end",
"def move_to_top\n return if position_in_list == 1\n move_to(1)\n end",
"def decrement_positions_on_lower_items(position=current_position)\n return unless in_list?\n\n if sequential_updates?\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} > ?\", position).reorder(acts_as_list_order_argument(:asc)).decrement_sequentially\n else\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} > ?\", position).decrement_all\n end\n end",
"def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_list.where(\"#{quoted_position_column_with_table_name} < ?\", current_position).increment_all\n end",
"def decrement_position\n return unless in_list?\n\n # self_class_all_or_in_collection.where(:pos => my_position).\n adjust_position!(-1)\n end",
"def bubble_up(i)\n while i > 0\n parent = (i+1) / 2 - 1\n if @contents[parent].key >= @contents[i].key then\n @contents[parent],@contents[i] = @contents[i],@contents[parent]\n i = parent\n else return\n end\n end\n end",
"def move_down\n @collection.move_lower\n redirect_to account_collections_url, notice: 'Collection was successfully reordered.'\n end",
"def bubble_down()\n\t\t# remove max and swap with last node\n\t\t@elements[0] = @elements.pop\n\t\ti = 0\n\t\twhile(i < @elements.length)\n\t\t\tmax_idx = i\n\t\t\t# find greater of left and right child\n\t\t\tif((2*i + 1) < @elements.length && @elements[2*i + 1][@orderBy] >= @elements[max_idx][@orderBy])\n\t\t\t\tmax_idx = 2*i + 1\n\t\t\tend\n\t\t\tif((2*i + 2) < @elements.length && @elements[2*i + 2][@orderBy] >= @elements[max_idx][@orderBy])\n\t\t\t\tmax_idx = 2*i + 2\n\t\t\tend\n\t\t\t# if left or right child is greater, swap and update i\n\t\t\tif(max_idx != i)\n\t\t\t\tswap(i, max_idx)\n\t\t\t\ti = max_idx\n\t\t\t# if not, we are done\n\t\t\telse\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend",
"def move_down( index )\r\n if index == @deck.length - 1\r\n @deck[1..1] = @deck[index], @deck[1]\r\n @deck.pop\r\n else\r\n @deck[index], @deck[index + 1] = @deck[index + 1], @deck[index]\r\n end\r\n end",
"def move_to_bottom_in_queue\n return unless in_queue?\n acts_as_queue_class.transaction do\n decrement_queue_positions_on_lower_items\n assume_bottom_queue_position\n end\n end",
"def test_moving\n item = QuotedList.first\n item.higher_items\n item.lower_items\n item.send :bottom_item # Part of private api\n end",
"def bubble_down(i)\n while true\n child1 = (i+1) * 2 - 1\n child2 = (i+1) * 2\n if child1 >= size then return\n elsif child2 >= size then\n if @contents[i].key >= @contents[child1].key then\n @contents[i],@contents[child1] = @contents[child1],@contents[i]\n return\n else return\n end\n else min = if @contents[child1].key <= @contents[child2].key\n then child1 else child2\n end\n if @contents[i].key > @contents[min].key\n @contents[i],@contents[min] = @contents[min],@contents[i]\n i = min\n else return\n end\n end\n end\n end",
"def move_lower\n return if self == self_and_siblings(true).last\n move_to(position_in_list + 1)\n end",
"def decrement_queue_positions_on_higher_items(queue_position)\n acts_as_queue_class.update_all(\n \"#{queue_position_column} = (#{queue_position_column} - 1)\", \"#{queue_scope_condition} AND #{queue_position_column} <= #{queue_position}\"\n )\n end",
"def bottom_item\n @current = last\n\n items\n end",
"def move_down(index)\n\t\traise ArgumentError, \"Can not move the primary Style\" if index == 0\n\t\traise IndexError, \"Indices must be positive natural numbers.\" if index < 0\n\t\t\n\t\t\n\t\t# can't move the final element in the list down any further\n\t\tif src == @styles.size-1\n\t\t\tsrc = index\n\t\t\tdst = index + 1\n\t\t\t\n\t\t\tswap(@styles, src, dst)\n\t\tend\n\tend",
"def move_down(n)\n self.y -= n\n end",
"def move_lower\n movement { self.position += 1 }\n end",
"def decrement_position\n return unless in_list?\n update_attribute :position, self.send(:position).to_i - 1\n end",
"def move_down\n down_tile = C[@location.first + 1, @location.second]\n move_to(down_tile)\n end",
"def move_down\n @item.move_lower\n flash[:notice] = t(:moved_lower, :thing => \"item\")\n redirect\n end",
"def move_down\n down_tile = Couple.new(@location.first + 1, @location.second)\n move_to(down_tile)\n end",
"def increment_positions_on_higher_items\n # return unless in_list?\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{scope_condition} AND #{position_column} < #{send(position_column).to_i}\") \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{position_column} < #{send(position_column).to_i}\")\n end \n end",
"def swap_with_next i\n #if first_item >= first_item.next_list_item\n\n end",
"def increment_queue_positions_on_higher_items\n return unless in_queue?\n acts_as_queue_class.update_all(\n \"#{queue_position_column} = (#{queue_position_column} + 1)\", \"#{queue_scope_condition} AND #{queue_position_column} < #{send(queue_position_column).to_i}\"\n )\n end",
"def move_below(other)\n if position > other.position\n new_position = other.position + 1\n other.lower_siblings.where(:position.lt => self.position).each { |s| s.inc(:position, 1) }\n self.position = new_position\n save!\n else\n new_position = other.position\n other.higher_siblings.where(:position.gt => self.position).each { |s| s.inc(:position, -1) }\n other.inc(:position, -1)\n self.position = new_position\n save!\n end\n end",
"def back(steps)\n move(-steps)\n end",
"def move_B\r\n 2.times { move_down( @deck.index( 'B' ) ) }\r\n end",
"def bubble_up()\n\t\ti = @elements.length - 1\n\t\twhile(i > 0)\n\t\t\t# compare with its parent. swap if parent is less than it\n\t\t\tif @elements[(i-1)/2][@orderBy] >= @elements[i][@orderBy]\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tswap((i-1)/2, i)\n\t\t\t\ti = (i-1)/2\n\t\t\tend\n\t\tend\n\tend",
"def decrement_position\n return unless in_list?\n set_list_position(current_position - 1)\n end",
"def decrement_position\n # return unless in_list?\n update_attribute position_column, self.send(position_column).to_i - 1\n end",
"def weapons_scroll_up\n guns[selected_gun].off\n @selected_gun -= 1\n if @selected_gun <= -1\n @selected_gun = @guns.length-1\n end\n guns[selected_gun].on\n end",
"def move_to_bottom\n return unless in_list?\n insert_at_position bottom_position_in_list.to_i\n end",
"def moveup\n papers = venue.papers.where(\"listorder < ?\",self.listorder).order(:listorder)\n \n if papers.length == 1\n self.listorder = papers[0].listorder - 1.0\n elsif papers.length > 1\n self.listorder = (papers[papers.length-1].listorder + papers[papers.length-2].listorder) / 2\n end\n end",
"def move_prev\n self.step -= 1\n 'prev'\n end",
"def piece_up\n return unless @falling_piece\n\n @falling_piece.y -= @block_size\n @falling_piece.grid_position.y -= 1\n end",
"def prev_item\n @current -= 1 if @current > 0\n\n items\n end",
"def move_to_top_in_queue\n return unless in_queue?\n acts_as_queue_class.transaction do\n increment_queue_positions_on_higher_items\n assume_top_queue_position\n end\n end",
"def rolldown\n\t\t\tpush [:swap]\n\t\t\tdip\n\t\t\tswap\n\t\tend",
"def decrement_positions_on_higher_items(position)\n conditions = scope_condition\n conditions.merge!( { position_key.lt => position } )\n\n decrease_all! in_collection.where(conditions)\n end",
"def move_up_left\n i = 1\n until false\n x, y = @pos\n x -= i\n y -= i\n pos = [x, y]\n break if x > 7 || x < 0 || y > 7 || y < 0 || @board[pos].color == @color\n @moves << pos\n break if @board[pos].color != @color\n i += 1\n end\n end",
"def up_item \n order_op2(true, @item)\n end",
"def shift_right\n self.unshift(self.pop)\n end",
"def move_toward_beeper()\n if front_is_clear?()\n move()\n else\n turn_left()\n end\n end",
"def assume_bottom_position\n update_attribute(:position, bottom_position_in_list(self).to_i + 1)\n end",
"def decrement_positions_on_higher_items(position)\n conditions = scope_condition\n conditions.merge!(\"i.#{position_key} <\" => position)\n\n decrease_all! self_class_all_or_in_collection.where(stringify_conditions(conditions))\n end",
"def sift_up(i)\n parent = (i - 1) / 2\n if parent >= 0 and @heap[parent] > @heap[i]\n @heap[parent], @heap[i] = @heap[i], @heap[parent]\n sift_up(parent)\n end\n end",
"def move_west\n @x -= 1\n end",
"def decrement_position\n return unless in_list?\n\n # in_collection.where(:pos => my_position).\n adjust!(position_key => -1)\n save!\n end",
"def move_up\n\t\t# if the horse isn't yet at the top of the screen move it up 20\n\t\tif @y > 0\n\t\t\t@y = @y -20\n\t\tend\n\tend",
"def back\n @index -= 1 if @index > 0\n end",
"def position_for_next_harvest()\n turn_right()\n move()\n turn_right()\n end",
"def move_down(array)\r\n set_current_row_col(array)\r\n new_row = @current_row == array.length - 1 ? 0 : @current_row + 1 # This logic will decide the new co-ordinated of space\r\n current_ele = array[new_row][@current_col]\r\n array[new_row][@current_col] = ' '\r\n replace_existing_element(array,current_ele, @current_row, @current_col)\r\n array\r\n end",
"def move_up(n)\n self.y += n\n end",
"def decrement_positions_on_lower_items(max_pos = nil)\n return unless in_list?\n conditions = scope_condition\n conditions.merge!(greater_than_me)\n conditions.merge!(\"i.#{position_key} <\" => max_pos) if max_pos\n\n decrease_all! self_class_all_or_in_collection.where(stringify_conditions(conditions))\n end",
"def down!\n swap_with(self.next) unless last?\n end",
"def lower_position!(amount = 2)\n if position > 0\n update!(position: position - amount)\n end\n dashboard.reposition_cells\n position\n end",
"def move_up\n # TODO: maybe refactor this to use acts-as-list or ranked-model\n aisles = @store.aisles\n\n # first, compact everything back down to 1-n in case a delete or something got it out of whack\n aisles.sort! { |a, b| a.position <=> b.position }\n aisles.each_with_index do |aisle, i|\n aisle.position = i + 1\n aisle.save!\n end\n\n @aisle = aisles.find(params[:id])\n original_position = @aisle.position\n if original_position > 1\n @aisle.position -= 1\n @aisle.save!\n aisles.each do |aisle|\n aisle.position += 1 if aisle != @aisle &&\n aisle.position >= @aisle.position &&\n aisle.position <= original_position\n aisle.save!\n end\n end\n redirect_to(store_aisles_url(@store.id))\n end",
"def scroll_backward\n #@oldindex = @current_index\n @current_index -= @scrollatrows\n @prow = @current_index - @scrollatrows\n end",
"def decrement_positions_on_lower_items(max_pos = nil)\n return unless in_list?\n conditions = scope_condition\n conditions.merge!( greater_than_me )\n conditions.merge!({ position_key.lt => max_pos} ) if max_pos\n\n decrease_all! in_collection.where(conditions)\n end"
] | [
"0.82816607",
"0.82685244",
"0.82685244",
"0.815027",
"0.794733",
"0.79036486",
"0.7872906",
"0.74482703",
"0.7392774",
"0.7359648",
"0.7359648",
"0.72972417",
"0.72765803",
"0.7203857",
"0.72002316",
"0.71914345",
"0.714911",
"0.7128582",
"0.71229905",
"0.7097113",
"0.70429146",
"0.7039366",
"0.7026143",
"0.7013024",
"0.7013024",
"0.6984021",
"0.69252664",
"0.68970513",
"0.679699",
"0.678548",
"0.67849225",
"0.67669195",
"0.67015004",
"0.66796076",
"0.6665412",
"0.6639243",
"0.6626018",
"0.66161495",
"0.6615299",
"0.6585135",
"0.6579214",
"0.65740794",
"0.6539665",
"0.6520421",
"0.6484427",
"0.64599943",
"0.64448",
"0.6444142",
"0.64321494",
"0.64298046",
"0.6421123",
"0.6406317",
"0.63761675",
"0.6339056",
"0.6334289",
"0.6328192",
"0.6328087",
"0.6314141",
"0.6287362",
"0.62769616",
"0.62763506",
"0.62679994",
"0.6242136",
"0.6234474",
"0.62020785",
"0.6199747",
"0.61933374",
"0.6186786",
"0.6178632",
"0.61760986",
"0.615747",
"0.61359787",
"0.6135062",
"0.61338174",
"0.6133147",
"0.61146533",
"0.611256",
"0.6089575",
"0.60856146",
"0.60823524",
"0.6081299",
"0.60800564",
"0.60796815",
"0.60670644",
"0.6054617",
"0.6052617",
"0.60522467",
"0.6044193",
"0.6044183",
"0.6035512",
"0.6028582",
"0.60272497",
"0.6021644",
"0.60200113",
"0.60184515",
"0.59994715",
"0.59884906",
"0.5988339",
"0.59832484",
"0.59751594"
] | 0.680853 | 28 |
Parse value, if necessary | def object
@object ||= case @library
when :nokogiri then parse_nokogiri(value)
when :rexml then parse_rexml(value)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_value; end",
"def parse_value(value)\n if value.is_a?(String)\n if value.to_i.to_s == value\n value.to_i\n elsif value.to_f.to_s == value\n value.to_f\n elsif value.gsub(/^\\s+|\\s+$/, '') == '' || value == '(Not Specified)'\n nil\n elsif /^\\d{2}\\/\\d{2}\\/\\d{4}$/ =~ value\n Date.parse(value)\n elsif /^\\d{2}\\/\\d{2}\\/\\d{4}\\s\\d{2}:\\d{2}:\\d{2}$/ =~ value\n Time.parse(value)\n else\n value\n end\n else\n value\n end\n end",
"def value_parse value, type\n return nil if value.nil? || value.to_s.size == 0\n case type\n when :integer then value.to_i\n when :autoincrement then value.to_i\n when :string then value.to_s\n when :float then value.to_f\n when :bool then value.to_s.to_bool\n when :symbol then value.to_s.to_sym\n when :marshal then value.is_a?(String) ? Marshal.load(value) : value\n when :array then value.is_a?(String) ? Yajl::Parser.parse(value) : value\n when :hash then value.is_a?(String) ? Hashr.new(Yajl::Parser.parse(value)) : Hashr.new(value)\n when :time then value.is_a?(String) ? Time.parse(value) : value\n when :date then value.is_a?(String) ? Date.parse(value) : value\n else value\n end\n end",
"def parse_values; end",
"def parse_value(val, type)\n return nil if val.nil? || val.to_s.strip == ''\n \n case type\n when :raw then\n val\n \n when :string then\n if val.is_a?(Float)\n # Sometimes float values come in for \"integer\" columns from Excel,\n # so if the user asks for a string, strip off that \".0\" if present\n val.to_s.gsub(/\\.0+$/, '')\n else\n # Strip whitespace and we're good to go\n val.to_s.strip\n end\n \n when :integer, :int then \n if val.class < Numeric\n # If numeric, verify that there's no decimal places to worry about\n if (val.to_f % 1.0 == 0.0)\n val.to_i\n else\n nil\n end\n else \n # Convert to string, strip off trailing decimal zeros\n val = val.to_s.strip.gsub(/\\.0*$/, '')\n if val.integer?\n val.to_i\n else\n nil\n end\n end\n \n when :float then\n if val.class < Numeric\n val.to_f\n else \n # Clean up then verify it matches a valid float format & convert\n val = val.to_s.strip\n if val.match(/\\A-?[0-9]+(?:\\.[0-9]+)?\\z/)\n val.to_f\n else\n nil\n end\n end\n \n when :cents then\n if val.is_a?(String)\n val = val.gsub(/\\s*\\$\\s*/, '')\n end\n intval = parse_value(val, :integer)\n if !val.is_a?(Float) && intval\n intval * 100\n else\n floatval = parse_value(val, :float)\n if floatval\n (floatval * 100).round\n else\n nil\n end\n end\n \n when :date then\n # Pull out the date part of the string and convert\n date_str = val.to_s.extract(/[0-9]+[\\-\\/][0-9]+[\\-\\/][0-9]+/)\n date_str.to_date rescue nil\n \n when :bool then\n val_str = parse_value(val, :string).to_s.downcase\n if ['true','yes','y','t','1'].include?(val_str)\n return true\n elsif ['false','no','n','f','0'].include?(val_str)\n return false\n else\n nil\n end\n \n else\n raise \"Unknown column type #{type.inspect} - unimplemented?\"\n end\n end",
"def parse_value(value)\n if value.include?('$env')\n fetch_environment_variable(value)\n elsif value.include?('$payload')\n fetch_payload_data(value)\n elsif value.instance_of?(Hash)\n parse_payload!(value)\n elsif value.instance_of?(Array)\n # TODO: Add support for accessing a single element\n value.map { |i| parse_payload!(i) }\n else\n value\n end\n end",
"def parse_value value\r\n case value\r\n when /\\d+/\r\n value.to_f\r\n else\r\n value\r\n end\r\n end",
"def value\n parsed_value\n end",
"def parse_value(value, type = :string)\n case type\n when :integer then value.to_i\n when :decimal then value.to_f\n when :boolean\n case value\n when 'Yes' then true\n when 'No' then false\n else\n nil\n end\n else\n value\n end\n end",
"def parse_value(string)\n string = string.strip\n if string =~ /^\\d+\\.\\d+$/\n string.to_f\n elsif string =~ /^\\d+$/\n string.to_i\n elsif string.encap_by?('\"')\n string.uncapsulate('\"', limit: 1).gsub('\\\\\"', '\"')\n elsif string.encap_by?(\"'\")\n string.uncapsulate(\"'\", limit: 1).gsub(\"\\\\'\", \"'\")\n elsif string =~ /^\\/.*\\/[mix]?+$/\n string.to_regex\n elsif string =~ /^true$/i\n true\n elsif string =~ /^false$/i\n false\n elsif string =~ /^(null|nil)$/i\n nil\n elsif string =~ /^\\(?\\d+(\\.\\d+)?\\.{2,3}\\d+(\\.\\d+)?\\)?$/\n Range.new(*[string.split(/\\.+/, 2).map(&:to_i), string =~ /\\.{3}/].flatten)\n elsif string =~ /^\\[.*\\]$/\n string.uncapsulate('[', limit: 1).qsplit(',').map { |value| parse_value(value) }\n else\n string\n end\n end",
"def parse_value(key, value)\n case self.column_type(key.to_sym)\n when :date, :time then MotionModelResource::DateParser.parse_date value\n else value\n end\n end",
"def parse_local_value(valuetype)\n value = CGI.unescapeHTML(@cell.xpath(\"text:p//text()\").to_s)\n value = value == \"\" ? nil : value\n case valuetype\n when \"integer\"\n value = @cell.xpath(\"@office:value\").to_s.to_i\n when \"float\"\n value = @cell.xpath(\"@office:value\").to_s.to_f\n value = value.to_i unless @cell.xpath(\"@office:value\").to_s =~ /\\./ # sadly most integers are typed as floats...\n when \"date\"\n value = DateTime.parse(@cell.xpath(\"@office:date-value\").to_s)\n end\n value\n end",
"def parse_value(nodes); end",
"def parse_value(hash)\n case hash['type']\n when 'literal'\n parse_literal(hash)\n when 'uri'\n parse_uri(hash)\n when 'bnode'\n nil\n else\n fail ArgumentError, \"Unidentifieble datatype: #{hash['type']} in #{hash}\"\n end\n end",
"def parse_value(expr)\n case expr.first\n when :var_ref\n expr[1][1] == \"true\"\n when :@int\n expr[1].to_i\n when :@float\n expr[1].to_f\n else\n parse_literal(expr)\n end\n end",
"def pre_process_value(value)\n value\n end",
"def parse(value)\n case value\n when Symbol\n sym = value.to_s.strip.downcase.to_sym\n return @values[sym.to_i] if /^\\d+/.match? sym\n @values[sym]\n when String\n name = value.strip.downcase\n return @values[name.to_i] if /^\\d+/.match? name\n @values[name.to_sym]\n when Integer\n @values[value]\n end\n end",
"def process_field_value(value)\r\n value\r\n end",
"def parse(sval)\n case sid\n when 'integer' then sval.to_s\n when 'string', 'text' then sval.to_s\n when 'boolean' then BoolTrueReps.member?(sval.to_s).to_s\n when 'float' then sval.to_s\n when 'date' then sval.presence && (sval.is_a?(String) ? Date.parse(sval) : sval).strftime(\"%Y-%m-%d\")\n else raise \"Don't know how to handle MetaPropertyType with sid '#{sid}'.\"\n end\n end",
"def parse_value(v, locale)\n new_value = nil\n case v\n when Symbol then\n lk = Lit::LocalizationKey.where(:localization_key=>v.to_s).first\n if lk\n loca = Lit::Localization.where(:locale_id=>locale.id).\n where(:localization_key_id=>lk.id).first\n new_value = loca.get_value if loca and loca.get_value.present?\n end\n when String then\n new_value = v\n when Hash then\n new_value = nil\n when Proc then\n new_value = nil # was v.call - requires more love\n else\n new_value = v.to_s\n end\n new_value\n end",
"def parse(str)\n m = str.match(/^#{tag}\\=([^\\x01]*)\\x01/).to_a\n if m.any?\n @value = m[1]\n str.gsub(/^[^\\x01]+\\x01/, '')\n else\n str\n end\n end",
"def parse_value\n trace = @lexer.trace\n quote = false\n\n if @lexer.get and @lexer.get.type == :quote\n quote = @lexer.get.value\n @lexer.next!\n end\n \n value = parse_text quote\n return terminate trace if not value\n\n if quote\n return terminate trace if not @lexer.get or @lexer.get.type != :quote or\n @lexer.get.value != quote\n @lexer.next!\n end\n\n value\n end",
"def parse_value_problem(s_p)\n value_problem = {}\n \n # parse value and problem name\n s_p = s_p[1...-1] # remove starting and trailing brackets\n s_p = s_p.split(\":\", 2) # split on :, at most two parts\n value_text = s_p[0]\n problem_name = s_p[1] # if no : to split on, problem_name is nil\n \n # extract value, return nil if unable to\n value = Float(value_text) rescue nil \n value_problem.update({ \"value\" => value }) if value\n\n # extract problem, ignore problem if problem_name is invalid or not provided\n if problem_name and (problem = self.submission.assessment.problems.find_by_name(problem_name))\n value_problem.update({ \"problem_id\" => problem.id })\n end\n\n return value_problem\n end",
"def deserialize_value(value)\r\n value\r\n end",
"def auto_convert_value(value)\n return nil if value.nil?\n\n if data_type == Array\n return value.split(',') if value.kind_of?(String)\n elsif data_type == Integer\n return value.to_i if value.to_i.to_s == value.to_s\n elsif data_type == Float\n return value.to_f if value.to_f.to_s == value.to_s\n elsif allow_shell_conversion\n return value.shelljoin if value.kind_of?(Array)\n return value.map { |k, v| \"#{k.to_s.shellescape}=#{v.shellescape}\" }.join(' ') if value.kind_of?(Hash)\n elsif data_type == Hash && value.kind_of?(String)\n begin\n parsed = JSON.parse(value)\n return parsed if parsed.kind_of?(Hash)\n rescue JSON::ParserError\n end\n elsif data_type != String\n # Special treatment if the user specified true, false or YES, NO\n # There is no boolean type, so we just do it here\n if %w(YES yes true TRUE).include?(value)\n return true\n elsif %w(NO no false FALSE).include?(value)\n return false\n end\n end\n # rubocop:enable Metrics/PerceivedComplexity\n\n return value # fallback to not doing anything\n end",
"def decoded_value\n case value_type\n when \"Fixnum\" then value.to_i\n when \"Float\" then value.to_f\n when \"Date\" then Date.parse(value)\n when \"Array\", \"Hash\" then JSON.parse(value)\n when \"Boolean\" then value == \"true\" ? true : false\n else value.to_s\n end\n end",
"def value_from_s(value)\n @value_proc.call(value)\n end",
"def parse\n if value.include?(',')\n arr = value.split(',')\n arr.map!(&:strip)\n @casted_value = cast(arr, config.type)\n @operator = 'IN'\n else\n value =~ /\\A(!?[<|>]?=?\\*?)(.+)/\n # JsonApiServer.logger.debug(\"VALUE IS #{Regexp.last_match(2)}\")\n # JsonApiServer.logger.debug(\"CONFIG.TYPE IS #{config.type}\")\n @casted_value = cast(Regexp.last_match(2), config.type)\n @operator = Regexp.last_match(1)\n end\n end",
"def parse_pair\n parse_string &&\n spaces &&\n must_see(\":\") &&\n spaces &&\n # We may have to fill in a rhs *null*.\n (parse_value || append('null'))\n end",
"def parse!(klass, v)\n case v\n when ''\n nil\n when String\n _string_parse!(klass, v)\n else\n raise Error, \"unexpected value received: #{v.inspect}\"\n end\n end",
"def convert_value\n # Do nothing if value has not changed\n return true unless value_changed?\n # Cast the value and return success\n return parse_string_value(@uncast_value) if @uncast_value.is_a? String\n # Convert the value to yaml otherwise\n v = @uncast_value.to_yaml unless @uncast_value.nil?\n self[:value] = v\n end",
"def parse_value(s)\n s[0] == '\"' ? s[1...-1].gsub(/\\\\(.)/, \"\\\\1\") : s\n end",
"def value_for(value)\n values = value.split(',').map{|i| i.strip}\n return values.size == 1 ? values.first() : values\n end",
"def parse_value(value, row_value, data)\n return value if value.nil?\n return value unless value.kind_of?(String)\n\n if value[0] == '%'[0]\n if value == '%_'\n return row_value\n else\n if not data[value[1..-1]]\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"parse_value failed. data does not contain value indexed by \\\"#{value[1..-1]}\\\"\")\n exit\n else\n return data[value[1..-1]]\n end\n end\n end\n return value\nend",
"def parse_attribute(value, type)\n case type\n when 'INTEGER'\n value.to_i\n when 'BOOLEAN'\n value.to_i == 1\n when 'TEXT'\n value.strip\n else\n raise 'Invalid data type'\n end\n end",
"def parse_value(raw)\n return [raw.value, raw.language] if raw.is_a? RDF::Literal\n return [raw, nil] if raw.present?\n [nil, nil]\n end",
"def parse_value val\n case\n when val == nil then true # --flag option on its own means 'set that option'\n when val == '' then nil # --flag='' the explicit empty string means nil\n else val # else just return the value\n end\n end",
"def deserialize_value\n if @value.nil?\n @value = read_attribute :value\n end\n\n case value_type\n when SUPPORTED_TYPES[:Object] # or Hash, Array, etc.\n @value = YAML::load @value\n when SUPPORTED_TYPES[:Symbol]\n @value = @value.to_sym\n when SUPPORTED_TYPES[:Integer] # or Fixnum, Bignum\n @value = @value.to_i\n when SUPPORTED_TYPES[:Float]\n @value = @value.to_f\n when SUPPORTED_TYPES[:Complex]\n @value = Complex @value\n when SUPPORTED_TYPES[:Rational]\n @value = Rational @value\n when SUPPORTED_TYPES[:Boolean]\n @value = (@value == \"true\")\n else\n @value\n end\n end",
"def parse(value)\n value = value.to_s.split(' ')\n returns = []\n value.each do |val|\n ::Transform::Parsers.each do |parser|\n parsed = parser.parse(val)\n found = {:value => parsed, :parser => parser} if (parsed)\n end\n found = found || {:value => val, :parser => ::Transform::Parser::String}\n returns << found\n end\n return returns\n end",
"def parse_value(v, locale)\n new_value = nil\n case v\n when Symbol then\n lk = @localization_key_object_cache[v.to_s] || \\\n Lit::LocalizationKey.where(localization_key: v.to_s).first\n if lk\n loca = Lit::Localization.active.where(locale_id: locale.id).\n where(localization_key_id: lk.id).first\n new_value = loca.translation if loca && loca.translation.present?\n end\n when String then\n new_value = v\n when Hash then\n new_value = nil\n when Proc then\n new_value = nil # was v.call - requires more love\n else\n new_value = v.to_s\n end\n new_value\n end",
"def parse_value(untranslated, each_translated)\n case untranslated\n when Array\n # implode array\n untranslated.map { |from| parse_value(from, each_translated) }\n when String\n if untranslated.empty?\n untranslated\n else\n restore_interpolations untranslated, each_translated.next\n end\n else\n untranslated\n end\n end",
"def process_value(value)\n if value.nil? || value.text.strip == ''\n nil\n else\n value.text.strip\n end\nend",
"def prepare_value(value)\n return value if value.nil? || value.is_a?(String)\n\n value.to_s\n end",
"def parse_tag_value ( tag )\n match_value = /[=]\\d*\\/\\d*/\n match = tag.match match_value\n # if no value found then this must be a boolean switch (because a tag was parsed from the field!) so set value to true\n value = match != nil ? extract_fraction(match[0]) : true\n return value\n end",
"def parse_value(untranslated, each_translated)\n case untranslated\n when Array\n # implode array\n untranslated.map { |from| parse_value(from, each_translated) }\n when String\n restore_interpolations untranslated, each_translated.next\n else\n untranslated\n end\n end",
"def interpret(value)\n value == \"\" ? nil : value\n end",
"def process_value element\n case element.name\n when 'date'\n Time.parse(element.content)\n when 'string'\n element.content\n when 'real'\n element.content.to_f\n when 'true'\n true\n when 'false'\n false\n when 'array'\n element.xpath('*').map{ |e| process_value(e) }\n when 'dict'\n process_dict(element)\n end\n end",
"def parse_value_rexml(value, ns_strs, language)\n # Fixme\n end",
"def parse_value(string)\n continuation = false\n\n # if our value starts with a double quote, then we are in a\n # line continuation situation\n if leading_quote?\n # check for a closing quote at the end of the string\n if string =~ @close_quote\n self.value += Regexp.last_match(1)\n\n # otherwise just append the string to the value\n else\n self.value += string\n continuation = true\n end\n\n # not currently processing a continuation line\n else\n case string\n when @full_quote\n self.value = Regexp.last_match(1)\n\n when @open_quote\n self.value = Regexp.last_match(1)\n continuation = true\n\n when @trailing_slash\n if self.value\n self.value += Regexp.last_match(1)\n else\n self.value = Regexp.last_match(1)\n end\n continuation = true\n\n when @normal_value\n if self.value\n self.value += Regexp.last_match(1)\n else\n self.value = Regexp.last_match(1)\n end\n\n else\n error\n end\n end\n\n if continuation\n self.value += $INPUT_RECORD_SEPARATOR if leading_quote?\n else\n process_property\n end\n\n continuation\n end",
"def parse_value(type, key, value) #:nodoc:\n if type == :boolean\n TRUE_VALUES.include?(value)\n elsif value && ALLOWED_TYPES[type].none?{ |klass| value.is_a?(klass) }\n raise \"Expected type :#{type} in params[:#{key}], got #{value.class}\"\n else\n value\n end\n end",
"def preprocess_value(value, key)\n return value unless value =~ /\\(\\(.*\\)\\)/\n\n starter = value.index(\"((\")\n ender = value.index(\"))\")\n qualifier = value[starter + 2, ender - starter - 2]\n\n if qualifier == \"random_large\"\n value[starter..ender + 1] = rand(1_000_000_000_000).to_s\n elsif qualifier == \"random_ssn\"\n value = rand(9**9).to_s.rjust(9, '0')\n value.insert 5, \"-\"\n value.insert 3, \"-\"\n elsif qualifier == \"random_selection\"\n list = chain(\"#{key}.options.to_a\")\n\n selected = list.sample.text\n selected = list.sample.text if selected.nil?\n value = selected\n else # rubocop:disable Style/EmptyElse\n # Silent pass through.\n end\n\n value\n end",
"def parse_value(type, key, value)\n if type == :boolean\n TRUE_VALUES.include?(value)\n elsif value && ALLOWED_TYPES[type].none?{ |klass| value.is_a?(klass) }\n raise \"Expected type :#{type} in params[:#{key}], got #{value.class}\"\n else\n value\n end\n end",
"def parse(v)\n row[v].strip rescue nil\n end",
"def set_value(value)\n if value.is_a? Array\n @map = nil\n @array = ParsedArray.new @global\n @array.abstractArrayItems = []\n value.each do |item|\n array_item = ParsedArrayItem.new @global\n array_item.arrayValueItem = ParsedArrayValueItem.new @global\n array_item.arrayValueItem.primitive = ParsedPrimitive.new(@global)\n array_item.arrayValueItem.primitive.string = ParsedString.new(item)\n array_item.arrayValueItem.primitive.text = item\n @array.abstractArrayItems << array_item\n end\n @valueItem = nil\n @text = @array.extract_hash\n return\n elsif value.is_a?(ParsedPair)\n @map = value.map ? value.map : nil\n @array = value.array ? value.array : nil\n @valueItem = value.valueItem ? value.valueItem : nil\n return\n elsif value.is_a?(TrueClass) || value.is_a?(FalseClass)\n @map = nil\n @array = nil\n @valueItem = ParsedValueItem.new @global\n @valueItem.value = ParsedValue.new @global\n @valueItem.value.primitive = ParsedPrimitive.new(@global)\n if value\n @valueItem.value.primitive.trueVal = ParsedTrue.instance\n else\n @valueItem.value.primitive.falseVal = ParsedFalse.instance\n end\n @valueItem.value.primitive.text = value\n @valueItem.value.text = value\n @text = value\n return\n end\n value = value.extract_hash unless value.is_a?(String) || value.is_a?(Integer)\n @map = nil\n @array = nil\n @valueItem = ParsedValueItem.new @global\n @valueItem.value = ParsedString.new(value)\n @text = value\n end",
"def clean_value(value)\n # value.is_a?(String) ? value.strip.gsub(/\\A\"|\"\\Z/, '') : value\n value\n end",
"def parse_values(field)\n if field =~ /^\\w+: (#{match_values})$/\n $1.scan(/(#{match_value})(?:,|$|\\])/).inject([]) do |m, match|\n m << match[0]\n end\n #TODO GC 02/26/2010 - What to do if it does not match the values pattern?\n end\n end",
"def parse_metadata(val)\n metadata = nil\n if val\n if val == \"[]\" || val == \"null\"\n metadata = []\n elsif val.is_a?(Array)\n metadata = val\n else\n # parse string into format name:value, name:value\n # merge IDs from current metadata\n # todo: should allow quoted semicolons..\n metadata_list = val.to_s.split(\",\").select {|it| !it.to_s.empty? }\n metadata_list = metadata_list.collect do |it|\n metadata_pair = it.include?(\":\") ? it.split(\":\") : it.split(\"=\")\n row = {}\n row['name'] = metadata_pair[0].to_s.strip\n row['value'] = metadata_pair[1].to_s.strip\n # hacky way to set masked flag to true of false to (masked) in the value itself\n if(row['value'].include?(\"(masked)\"))\n row['value'] = row['value'].gsub(\"(masked)\", \"\").strip\n row['masked'] = true\n end\n if(row['value'].include?(\"(unmasked)\"))\n row['value'] = row['value'].gsub(\"(unmasked)\", \"\").strip\n row['masked'] = false\n end\n row\n end\n metadata = metadata_list\n end\n end\n return metadata\n end",
"def parse_value x\n case x\n when Value, NilClass\n x\n when Array\n x1, x2, = x\n if x1.is_a? Symbol and x2 == nil\n # [reg]\n RegisterMemory.new x1\n elsif x1.is_a? Symbol and x2.is_a? Integer\n # [reg, imm]\n OffsetRegisterMemory.new x1, x2\n elsif x1.is_a? Integer\n # [imm]\n ImmediateMemory.new x1\n else\n fail \"invalid memory access syntax\"\n end\n when Symbol\n # register\n Register.new x\n when String\n # label\n ImmediateLabel.new(x).tap { |v| @relocations << v }\n when Integer\n # immediate\n Immediate.new x\n else\n raise \"unexpected value class #{x.class}\"\n end\n end",
"def field_value\n if check_version_of(\"mail\", \"> 2.7.0\")\n %w(unparsed_value)\n elsif check_version_of(\"mail\", \"= 2.7.0\")\n %w(instance_variable_get @unparsed_value)\n elsif check_version_of(\"mail\", \"< 2.7.0\")\n %w(instance_variable_get @value)\n end\n end",
"def convert_value(val)\n case basic_type\n when nil\n val\n when /^str/i\n (val.nil? or val.empty?) ? nil : val\n when /^bool/i\n if val.is_a?(TrueClass) or val.is_a?(FalseClass)\n val\n elsif val.is_a?(String)\n !!(['1', 't', 'T'].include?(val))\n elsif val.is_a?(Numeric)\n !!val.nonzero?\n else\n val\n end\n when /^int/i\n val.to_i\n else\n val\n end\n end",
"def parse_value_of(key)\n text = parse_pair('E23_11', 'E23_09')[key]\n #puts \"parse pair: '#{text.inspect}' #{(text.nil? || text.blank?) ? 'BLANK' : ''}\"\n text = ' ' if text.nil? || text.strip.blank?\n text\n end",
"def clean_value(value)\n case value\n when Symbol then value.to_s\n when TrueClass then 1\n when FalseClass then 0\n when /^\\d+$/ then value.to_i # Integer\n when /^\\d+(\\.\\d+)?([eE]\\d+)?$/ then value.to_f # Float\n when blank? then nil\n else value\n end \n end",
"def process_property\n property.strip!\n value.strip!\n\n self.value = Regexp.last_match(1) if value =~ %r{\\A\"(.*)(?<!\\\\)\"\\z}m\n\n section[property] = typecast(value)\n\n self.property = nil\n self.value = nil\n end",
"def convert tag, val\n return val unless val.kind_of?(String)\n case tag\n when 'partofset', 'track'\n return val\n end\n case val\n when REGEXP_TIMESTAMP\n year, month, day, hour, minute = $~.captures[0,5].map {|cap| cap.to_i}\n if month == 0 || day == 0\n return nil\n end\n second = $6.to_f\n zone = $7\n zone = '+00:00' if zone == 'Z'\n begin\n Time.new(year, month, day, hour, minute, second, zone)\n rescue ArgumentError\n val\n end\n when REGEXP_RATIONAL\n return val if $2.to_i == 0\n Rational($1, $2)\n else\n val\n end\n end",
"def deserialize val\r\n case val.to_s\r\n when 'true': return true\r\n when 'false': return false\r\n end\r\n val =~ /^\\d+$/ ? val.to_i : val\r\n end",
"def nextvalue\n c = self.nextclean\n s = \"\"\n\n case c\n when /\\\"|\\'/\n\treturn(self.nextstring(c))\n when '{'\n\tself.back()\n return(Hash.new.from_json(self))\n when '['\n\tself.back()\n\treturn(Array.new.from_json(self))\n else\n\tbuf = \"\"\n\twhile ((c =~ /\"| |:|,|\\]|\\}|\\/|\\0/).nil?)\n\t buf += c\n\t c = self.nextchar()\n\tend\n\tself.back()\n\ts = buf.chomp\n\tcase s\n\twhen \"true\"\n\t return(true)\n\twhen \"false\"\n\t return(false)\n\twhen \"null\"\n\t return(nil)\n\twhen /^[0-9]|\\.|-|\\+/\n\t begin\n\t return(Integer(s))\n\t rescue ArgumentError\n\t # do nothing on an error, the next case should do the trick\n\t end\n\t begin\n\t return(Float(s))\n\t rescue ArgumentError\n\t # do nothing\n\t end\n\tend\n\tif (s == \"\")\n s = nil\n end\n\treturn(s)\n end\n end",
"def deserialize(value)\n return if value.blank?\n ActiveSupport::Duration.parse(value)\n end",
"def parse_by_type(value, type)\n case type\n when \"Integer\"\n Integer(value)\n when \"String\"\n value.inspect\n # when \"IntegerArray\"\n # [JSON(value)]\n when \"StringArray\"\n value\n else\n value\n end\n value\n end",
"def parse_component_value(input = T.unsafe(nil)); end",
"def deserialize(value)\n value\n end",
"def parse_value(value)\n if value.include?('$env')\n fetch_environment_variable(value)\n else\n value\n end\n end",
"def _string_parse!(klass, v)\n klass.parse(v)\n end",
"def value\n @value ||= extract_value\n end",
"def post_process_date( val )\n\t\t\treturn Date.parse( val )\n\t\trescue ArgumentError\n\t\t\treturn nil\n\t\tend",
"def deserialize_value(column, value)\n value\n end",
"def parse(v)\n row[v[0]..v[1]].strip rescue nil\n end",
"def parse(str); end",
"def extract_value_from_default(default)\n super ||\n extract_escaped_string_from_default(default) ||\n extract_time_from_default(default) ||\n extract_empty_array_from_default(default) ||\n extract_decimal_from_default(default)\n end",
"def post_parse(record)\n numeric_fields.each do |field|\n if val = record[field] and val != :absent\n record[field] = record[field].split(\",\")\n end\n end\n end",
"def parse(value)\n data = ::JSON.parse(value)\n Result.success(data)\n rescue ::JSON::ParserError, TypeError\n Result.error.code!(:invalid_json)\n end",
"def call\n clean_value = remove_commas\n PURE_NUMERIC_REGEX.match?(clean_value) ? clean_value : @original_value\n end",
"def get_scope_arg_value(key, value)\n # cast to string to avoid incorred blank? behavior for us\n return \"false\" if value == false\n # if we havea date field, try to parse, falling back to the original\n # value\n if key.to_s =~ /date/\n value = Date.parse(value) rescue value\n end\n # return the final value\n value\n end",
"def fetch_value(value); end",
"def cast_value(val)\n raise ArgumentError.new(\"Your value is not a String! (it's a #{val.class})\") if val.class != String && val.class != TrueClass && val.class != FalseClass\n \n if (Float val rescue false)\n Float val\n elsif (Integer val rescue false)\n Integer val\n elsif val =~ /^true$/i || val == true\n true\n elsif val =~ /^false$/i || val == false\n false\n else\n val\n end\n end",
"def tokenize_config_value(str); end",
"def transmogrified_value\n case param.field.options[:value_transmogrification]\n when :chronic\n Chronic.parse(value, :context => :past)\n when :chronic_date\n v = Chronic.parse(value, :context => :past)\n v ? v.to_date : nil\n when :upcase\n value.upcase\n when :downcase\n value.downcase\n else\n value\n end\n end",
"def value\n if self[:value_type].present?\n case self[:value_type].to_sym\n when :string, :text\n self[:value].to_s\n when :password\n self[:value].to_s\n when :decimal\n BigDecimal.new(self[:value].to_s).round(2, BigDecimal::ROUND_HALF_UP)\n when :integer\n self[:value].to_i\n when :boolean\n (self[:value].to_s =~ /^[t|1]/i) != nil\n else\n self[:value].is_a?(String) ? YAML.load(self[:value]) : self[:value]\n end\n else\n self[:value]\n end\n end",
"def parse_value\n if String === peek_token\n ScopedSearch::QueryLanguage::AST::LeafNode.new(next_token)\n elsif ([:in, :notin].include? current_token)\n value = parse_multiple_values()\n ScopedSearch::QueryLanguage::AST::LeafNode.new(value)\n else\n raise ScopedSearch::QueryNotSupported, \"Value expected but found #{peek_token.inspect}\"\n end\n end",
"def setValue(var, varValue, delim)\r\n #single value (delimited by | )\r\n if varValue.index(delim) == nil\r\n var[0] = varValue;\r\n #multiple values\r\n else\r\n s = varValue.split(delim)\r\n #go through and trim values\r\n for i in (0..s.size()-1) do\r\n var[i] = s[i].strip()\r\n end\r\n end\r\nend",
"def parse(value)\n unless value.is_a?(String)\n raise TimeParseError, \"value must be string: #{value}\"\n end\n\n if @cache1_key == value\n return @cache1_time\n elsif @cache2_key == value\n return @cache2_time\n else\n begin\n time = @parse.call(value)\n rescue => e\n raise TimeParseError, \"invalid time format: value = #{value}, error_class = #{e.class.name}, error = #{e.message}\"\n end\n @cache1_key = @cache2_key\n @cache1_time = @cache2_time\n @cache2_key = value\n @cache2_time = time\n return time\n end\n end",
"def internal_value_of(value)\n return value if value.respond_to?(:nan?) && value.nan?\n return Float::NAN if [nil, '?'].include?(value)\n return parse_date(value.to_s) if date?\n return value.to_f if numeric?\n return index_of_value(value.to_s) if nominal? || string?\n end",
"def parse_values(data, object)\n config[data].each do |k,v|\n if v[2]\n if v[2] == 'date'\n object[k] = Date.strptime(parse(v), \"%y%m%d\") rescue nil\n elsif v[2] == \"float\"\n object[k] = parse_amount(parse(v))\n end\n else\n object[k] = parse(v)\n end\n end\n end",
"def datetime_parse(value)\n dt = translate(value)&.to_datetime&.strftime\n datetime_clean(dt) if dt\n rescue\n nil\n end",
"def convert(val)\r\n\t\t\t# clean up strings and return nil for \r\n\t\t\tif val.class == String\r\n\t\t\t\tval.strip!()\r\n\t\t\t\tif [\"?\", \"unknown\"].member?(val.downcase())\r\n\t\t\t\t\treturn nil\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\treturn val\r\n\t\tend",
"def convert(val)\r\n\t\t\t# clean up strings and return nil for \r\n\t\t\tif val.class == String\r\n\t\t\t\tval.strip!()\r\n\t\t\t\tif [\"?\", \"unknown\"].member?(val.downcase())\r\n\t\t\t\t\treturn nil\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\treturn val\r\n\t\tend",
"def convert(val)\r\n\t\t\t# clean up strings and return nil for \r\n\t\t\tif val.class == String\r\n\t\t\t\tval.strip!()\r\n\t\t\t\tif [\"?\", \"unknown\"].member?(val.downcase())\r\n\t\t\t\t\treturn nil\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\treturn val\r\n\t\tend",
"def parse_string(value, base)\n digits = value.split(//)\n parse_array(digits, base)\n end",
"def parse_value(value)\n case value\n when Numeric\n [{:context => [], :value => value}]\n when Hash\n value.inject([]) do |all, (key, val)|\n case key\n when nil\n all.push :context => [], :value => val\n when Array\n if key.size % 2 == 0\n all.push :context => key, :value => val\n else\n bad_value! \"Contexts must have an even number of items\"\n end\n else\n bad_value! \"Unknown context type: #{key.class.name}\"\n end\n all\n end\n else\n bad_value! \"Unknown value type: #{value.class.name}\"\n end\n end",
"def post_process_datetime( val )\n\t\t\treturn Time.parse( val )\n\t\trescue ArgumentError\n\t\t\treturn nil\n\t\tend",
"def string_value(value)\r\n value\r\n end",
"def parse(value, favorites = [], is_lat_and_long=false)\n if is_lat_and_long\n latAndLong = value.split(\",\")\n address = parse_lat_and_long(latAndLong[0], latAndLong[1])\n return address if address\n end\n \n return value if value.kind_of?(Location::Base)\n return nil if value.blank?\n \n favorite = parse_favorite(value, favorites)\n return favorite.location if favorite\n \n airport = parse_airport(value)\n return airport if airport\n \n address = parse_address(value)\n return address if address\n \n latAndLong = value.split(\",\")\n address = parse_lat_and_long(latAndLong[0], latAndLong[1])\n return address if address\n \n raise ParseError.new(value)\n end"
] | [
"0.8314484",
"0.722614",
"0.72228366",
"0.72040856",
"0.7171283",
"0.70247275",
"0.6937803",
"0.6806457",
"0.6776627",
"0.67737776",
"0.6739892",
"0.67258364",
"0.6588984",
"0.65740097",
"0.65112966",
"0.65027463",
"0.64995927",
"0.64725477",
"0.64668965",
"0.6441344",
"0.643803",
"0.6428356",
"0.63946193",
"0.63895947",
"0.637021",
"0.6307368",
"0.6291085",
"0.62839407",
"0.6281383",
"0.6271089",
"0.62696147",
"0.62496006",
"0.6239792",
"0.62289536",
"0.61920834",
"0.6189028",
"0.6185278",
"0.6176601",
"0.61664295",
"0.6146997",
"0.61299855",
"0.6118208",
"0.6112653",
"0.6093582",
"0.60855854",
"0.60561204",
"0.60419506",
"0.60396254",
"0.60374886",
"0.596571",
"0.59533733",
"0.59508735",
"0.59505177",
"0.5935176",
"0.5934009",
"0.5932355",
"0.592009",
"0.5919106",
"0.5901696",
"0.5901696",
"0.5867362",
"0.58659565",
"0.5862491",
"0.5862001",
"0.5847186",
"0.5827827",
"0.58208656",
"0.5813435",
"0.5784424",
"0.5771942",
"0.57643807",
"0.5732977",
"0.5731835",
"0.5720296",
"0.57185334",
"0.5711923",
"0.5701689",
"0.56994385",
"0.5690475",
"0.56776327",
"0.5672104",
"0.56683725",
"0.56666446",
"0.56638837",
"0.5642773",
"0.5633144",
"0.5630794",
"0.5620872",
"0.56188995",
"0.56157184",
"0.56133294",
"0.5608905",
"0.56049097",
"0.5592148",
"0.5592148",
"0.5592148",
"0.55852836",
"0.5571393",
"0.556694",
"0.5562586",
"0.55567956"
] | 0.0 | -1 |
XML Equivalence. XML Literals can be compared with each other or with xsd:strings | def eql?(other)
if other.is_a?(Literal::XML)
case @library
when :nokogiri then equivalent_nokogiri(other)
when :rexml then equivalent_rexml(other)
end
elsif other.is_a?(Literal) && (other.plain? || other.datatype == RDF::XSD.string)
value == other.value
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equivalent_rexml(other)\n begin\n require 'active_support'\n require 'active_support/core_ext'\n rescue LoadError\n # string equivalence\n end\n\n if Hash.respond_to?(:from_xml)\n Hash.from_xml(\"<root>#{self}</root>\") == Hash.from_xml(\"<root>#{other}</root>\")\n else\n # Poor mans equivalent\n value == other.value\n end\n end",
"def xml_should_be_same(expected, actual)\n expected = Hpricot(expected)\n actual = Hpricot(actual)\n \n blame = \"\\n\\n#################### expected\\n#{expected.to_html}\\n\\n\" \"#################### actual:\\n#{actual.to_html}\\n\\n\" \n (xml_cmp(expected, actual)).should.blaming(blame).equal true\nend",
"def xml_should_eql(actual, expected)\n same = xml_cmp(actual, expected)\n actual.should.== expected unless same \nend",
"def assert_equivalent_xml(expected, actual)\n expected_xml = Nokogiri::XML(\"<test-xml>\\n#{expected}\\n</test-xml>\")\n actual_xml = Nokogiri::XML(\"<test-xml>\\n#{actual}\\n</test-xml>\")\n ignored_attributes = %w(style data-disable-with)\n\n equivalent = EquivalentXml.equivalent?(expected_xml, actual_xml, {\n ignore_attr_values: ignored_attributes\n }) do |a, b, result|\n if result === false && b.is_a?(Nokogiri::XML::Element)\n if b.attr('name') == 'utf8'\n # Handle wrapped utf8 hidden field for Rails 4.2+\n result = EquivalentXml.equivalent?(a.child, b)\n end\n if b.delete('data-disable-with')\n # Remove data-disable-with for Rails 5+\n # Workaround because ignoring in EquivalentXml doesn't work\n result = EquivalentXml.equivalent?(a, b)\n end\n if a.attr('type') == 'datetime' && b.attr('type') == 'datetime-local'\n a.delete('type')\n b.delete('type')\n # Handle new datetime type for Rails 5+\n result = EquivalentXml.equivalent?(a, b)\n end\n end\n result\n end\n\n assert equivalent, lambda {\n # using a lambda because diffing is expensive\n Diffy::Diff.new(\n sort_attributes(expected_xml.root),\n sort_attributes(actual_xml.root)\n ).to_s(:color)\n }\n end",
"def xml_compare a, b\n a = REXML::Document.new(a.to_s)\n b = REXML::Document.new(b.to_s)\n\n normalized = Class.new(REXML::Formatters::Pretty) do\n def write_text(node, output)\n super(node.to_s.strip, output)\n end\n end\n\n normalized.new(indentation=0,ie_hack=false).write(node=a, a_normalized='')\n normalized.new(indentation=0,ie_hack=false).write(node=b, b_normalized='')\n\n a_normalized == b_normalized\n end",
"def assert_xml_equals(first_xml, second_xml)\n doc1 = XML::Document.string(first_xml)\n doc2 = XML::Document.string(second_xml)\n\n assert_block \"'#{first_xml}' is not the same as '#{second_xml}'\" do\n tree_equals?(doc1.root, doc2.root)\n end\n end",
"def equivalent_nokogiri(other)\n if defined?(::EquivalentXml)\n EquivalentXml.equivalent?(object, other.object)\n else\n equivalent_rexml(other)\n end\n end",
"def assert_equal(expected, actual)\n if expected.is_a?(Nokogiri::XML::Node) && actual.is_a?(Nokogiri::XML::Node)\n assert(EquivalentXml.equivalent?(expected, actual,\n element_order: false, normalize_whitespace: true),\n \"XML nodes were not equal\")\n elsif expected.is_a?(String) && actual.is_a?(String)\n ex_bin = expected.dup.force_encoding('BINARY')\n act_bin = actual.dup.force_encoding('BINARY')\n\n assert(ex_bin == act_bin,\n \"strings were not equal\")\n else\n assert(expected == actual, \"expected `#{expected}`, got `#{actual}`\")\n end\n end",
"def ==(x)\n return false unless x.is_a? XML\n return false unless name == x.name and attrs == x.attrs\n # Now the hard part, strings can be split in different ways\n # empty string children are possible etc.\n self_i = 0\n othr_i = 0\n while self_i != contents.size or othr_i != x.contents.size\n # Ignore \"\"s\n if contents[self_i].is_a? String and contents[self_i] == \"\"\n self_i += 1\n next\n end\n if x.contents[othr_i].is_a? String and x.contents[othr_i] == \"\"\n othr_i += 1\n next\n end\n\n # If one is finished and the other contains non-empty elements,\n # they are not equal\n return false if self_i == contents.size or othr_i == x.contents.size\n\n # Are they both Strings ?\n # Strings can be divided in different ways, and calling normalize!\n # here would be rather expensive, so let's use this complicated\n # algorithm\n if contents[self_i].is_a? String and x.contents[othr_i].is_a? String\n a = contents[self_i]\n b = x.contents[othr_i]\n self_i += 1\n othr_i += 1\n while a != \"\" or b != \"\"\n if a == b\n a = \"\"\n b = \"\"\n elsif a.size > b.size and a[0, b.size] == b\n a = a[b.size..-1]\n if x.contents[othr_i].is_a? String\n b = x.contents[othr_i]\n othr_i += 1\n next\n end\n elsif b.size > a.size and b[0, a.size] == a\n b = b[a.size..-1]\n if contents[self_i].is_a? String\n a = contents[self_i]\n self_i += 1\n next\n end\n else\n return false\n end\n end\n next\n end\n\n # OK, so at least one of them is not a String.\n # Hopefully they're either both XMLs or one is an XML and the\n # other is a String. It is also possible that contents contains\n # something illegal, but we aren't catching that,\n # so xml(:foo, Garbage.new) is going to at least equal itself.\n # And we aren't, because xml(:foo, Garbage.new) == xml(:bar, Garbage.new)\n # is going to return an honest false, and incoherent sanity\n # check is worse than no sanity check.\n #\n # Oh yeah, they can be XML_PI or XML_Comment. In such case, this\n # is ok.\n return false unless contents[self_i] == x.contents[othr_i]\n self_i += 1\n othr_i += 1\n end\n return true\n end",
"def ==(other)\n if other.class == self.class\n xml.to_s == other.xml.to_s\n else\n super\n end\n end",
"def test_in_different_access\n doc = Document.new <<-EOL\n <?xml version='1.0' encoding='ISO-8859-1'?>\n <a a=\"\\xFF\">\\xFF</a>\n EOL\n expect = \"\\303\\277\"\n expect.force_encoding(::Encoding::UTF_8)\n assert_equal( expect, doc.elements['a'].attributes['a'] )\n assert_equal( expect, doc.elements['a'].text )\n end",
"def assert_xml_not_equal(expected_doc, actual_doc, message = nil)\r\n expected_doc = parse_xml(expected_doc)\r\n actual_doc = parse_xml(actual_doc)\r\n _wrap_assertion do\r\n full_message = build_message(message, <<EOT, actual_doc.inspect, expected_doc.inspect)\r\n\r\n<?> expected not to be equal to\r\n<?> but was equal.\r\nEOT\r\n assert_block(full_message){ ! are_equal?(expected_doc, actual_doc)}\r\n end\r\n end",
"def test_sax_doctype\n parse_compare(%{<?xml version=\"1.0\"?>\n<!DOCTYPE top PUBLIC \"top.dtd\">\n<top/>\n},\n [[:instruct, 'xml'],\n [:attr, :version, \"1.0\"],\n [:end_instruct, 'xml'],\n [:doctype, ' top PUBLIC \"top.dtd\"'],\n [:start_element, :top],\n [:end_element, :top]])\n end",
"def apply(left, right)\n RDF::Literal(left.to_s == right.to_s)\n end",
"def tdiff_equal(node)\n if (self.class == node.class)\n case node\n when Nokogiri::XML::Attr\n (self.name == node.name && self.value == node.value)\n when Nokogiri::XML::Element, Nokogiri::XML::DTD\n self.name == node.name\n when Nokogiri::XML::Text, Nokogiri::XML::Comment\n self.text == node.text\n when Nokogiri::XML::ProcessingInstruction\n (self.name == node.name && self.content = self.content)\n else\n false\n end\n else\n false\n end\n end",
"def test_entities\n\tsourceWithoutPreproc = '<!DOCTYPE x [\n<!ENTITY example \"<p>An ampersand (&#38;) may be escaped numerically (&#38;#38;) or with a general entity (&amp;).</p>\" >\n]>'\n\tbody = \"\\n<x>&example;</x>\"\n\n\ttoker = NQXML::Tokenizer.new(\"<?xml version=\\\"1.0\\\"?>\\n\" +\n\t\t\t\t sourceWithoutPreproc + body)\n\n\tnewline = NQXML::Text.new(\"\\n\", \"\\n\")\n\tliteral = '<p>An ampersand (&) may be escaped numerically' +\n\t ' (&#38;) or with a general entity (&amp;).</p>'\n\tsrc = '<!ENTITY example \"<p>An ampersand (&#38;) may be escaped' +\n\t ' numerically (&#38;#38;) or with a general entity' +\n\t ' (&amp;).</p>\" >'\n\texampleEntity = NQXML::GeneralEntityTag.new('example', literal, nil,\n\t\t\t\t\t\t nil, src)\n\tdoctype = NQXML::Doctype.new('x', nil, [exampleEntity],\n\t\t\t\t sourceWithoutPreproc)\n\n\texpected = [\n\t NQXML::XMLDecl.new('xml', {'version'=>'1.0'},\n\t\t\t '<?xml version=\"1.0\"?>'),\n\t newline,\n\t doctype,\n\t newline,\n\t NQXML::Tag.new('x', {}, false, '<x>'),\n\t NQXML::Tag.new('p', {}, false, '<p>'),\n\t NQXML::Text.new('An ampersand (&) may be escaped numerically' +\n\t\t\t ' (&) or with a general entity (&).',\n\t\t\t 'An ampersand (&) may be escaped numerically' +\n\t\t\t ' (&38;) or with a general entity' +\n\t\t\t ' (&amp;).'),\n\t NQXML::Tag.new('p', nil, true, '</p>'),\n\t NQXML::Tag.new('x', nil, true, '</x>'),\n\t newline\n\t]\n\n\ti = 0\n\ttoker.each { | entity |\n\t assert_equal(expected[i], entity)\n\t if entity.instance_of?(NQXML::Doctype)\n\t\tassert_equal(1, entity.entities.length)\n\t\tassert_equal(exampleEntity, entity.entities[0])\n\t end\n\t i += 1\n\t}\n end",
"def test_entity_insertions\n assert_equal(\"&\", REXML::Text.new(\"&\", false, nil, true).to_s)\n #assert_equal(\"&\", REXML::Text.new(\"&\", false, false).to_s)\n end",
"def xml_tag\n :comparison\n end",
"def test2\n parser = ZML::StreamToREXML.new\n REXML::Document.parse_stream(DOC1, parser)\n res = parser.result\n assert(res.instance_of?(REXML::Document), \"Result should be REXML::Document\")\n\n # Now we have to check it's the same. We don't have a convenient method\n # to walk down two trees checking they are equal. Unfortunately, just\n # getting REXML to write it back out and comparing with the source\n # doesn't work properly; it inserts newlines at places of its own\n # chosing, e.g. after <!ELEMENT ...> and after <!DOCTYPE ... [\n # So, we reparse the source XML and get REXML to write that out too!\n\n rtext = \"\"\n res.write(rtext)\n should = \"\"\n REXML::Document.new(DOC1).write(should)\n assert_equal(should, rtext)\n end",
"def compare_to_rsrc_xml(io, sourceFooToBletch)\n\twrittenLines = io.read()\n\n\t# What we expect is slightly different than the original XML\n\t# because entities have been replaced and the output tags and\n\t# attribute values have been normalized.\n\tnormalizedXml = @rsrc.xml.dup()\n\tnormalizedXml.gsub!(/&foo;/, 'bletch')\n\tnormalizedXml.gsub!('/>', '></inner:tag>')\n\tnormalizedXml.gsub!(\"tabs\\tto\\tspaces\", \"tabs to spaces\")\n\n\t# The writer's output won't have the same whitespace.\n\tnormalizedXml.gsub!(/^\\s+\\<(!ENTITY|!ELEMENT|!ATTLIST|!NOTATION|\\?|!--)/,\n\t\t\t '<\\1')\n\t# Get rid of one newline that the writer doesn't output.\n\tnormalizedXml.gsub!(/(<!DOCTYPE(.+?))[\\n]]>/m, '\\1]>')\n\n\tassert_equal(normalizedXml, writtenLines)\n end",
"def equal_to_xml(xml)\n @type = :equalToXml\n @value = xml\n @request_builder\n end",
"def on_eq(ast_node, context)\n left = process(ast_node.children[0], context)\n right = process(ast_node.children[1], context)\n\n if left.is_a?(XML::NodeSet)\n left = first_node_text(left)\n end\n\n if right.is_a?(XML::NodeSet)\n right = first_node_text(right)\n end\n\n if left.is_a?(Numeric) and !right.is_a?(Numeric)\n right = to_float(right)\n end\n\n if left.is_a?(String) and !right.is_a?(String)\n right = to_string(right)\n end\n\n return left == right\n end",
"def test_entity_replacement\n source = %q{<!DOCTYPE foo [\n <!ENTITY % YN '\"Yes\"'>\n <!ENTITY WhatHeSaid \"He said %YN;\">]>\n <a>&WhatHeSaid;</a>}\n\n d = REXML::Document.new( source )\n dt = d.doctype\n assert_equal( '\"Yes\"', dt.entities[ \"YN\" ].value )\n assert_equal( 'He said \"Yes\"', dt.entities[ \"WhatHeSaid\" ].value )\n assert_equal( 'He said \"Yes\"', d.elements[1].text )\n end",
"def test_values_with_apostrophes\n doc = Document.new(%q#<tag h1=\"1'2'\" h2='1\"2'/>#)\n s = doc.to_s\n assert(s =~ /h1='1'2''/)\n assert(s =~ /h2='1\"2'/)\n end",
"def test1\n rtext = \"\"\n parser = ZML::StreamToXML.new(rtext)\n REXML::Document.parse_stream(DOC1, parser)\n\n # The results should be byte-by-byte equal. (Actually, there might\n # be differences like attr='val' versus attr=\"val\", or ordering of\n # the attributes, but we choose our test case carefully!)\n assert_equal(DOC1, rtext)\n end",
"def is_xml_valid?(xml_text)\n return true #FIXME\n end",
"def ==(other)\n case other\n when Literal\n # If other is a Literal, reverse test to consolodate complex type checking logic\n other == self\n when String then to_s == other\n when URI then hash == other.hash && to_s == other.to_s\n else other.respond_to?(:to_uri) && to_s == other.to_uri.to_s\n end\n end",
"def ==(other)\n if other.is_a? XPathNodeSet or\n other.is_a? XPathBoolean or other.is_a? XPathNumber then\n other == self\n else\n to_str == other.to_str\n end\n end",
"def ap_xml\n # other gsub could be negaitve /<content?([A-Za-z \"=]+)>(?!<\\!\\[CDATA\\[)/\n # but CS theory says that isn't a good idea, and so does running time tests\n Crack::XML.parse(body.gsub(/<content?([A-Za-z \"=]+)><\\!\\[CDATA\\[/, '<content>').gsub(/\\]\\]><\\/content>/, \"</content>\").gsub(/<content?([A-Za-z \"=]+)>/, \"<content><![CDATA[\").gsub(/<\\/content>/, \"]]></content>\"))\n # Crack::XML.parse(body.gsub(/<content?([A-Za-z \"=]+)>(?!<\\!\\[CDATA\\[)/, \"<content><![CDATA[\").gsub(/<\\/content>/, \"]]></content>\"))\n end",
"def rexml? ; false end",
"def test_twin_attrs\n\texpect_error('<tag attr=\"foo\" attr=\"bar\">',\n\t\t /attribute name '(.*)' appears more than once/)\n\texpect_error('<?xml version=\"1.0\" version=\"2.0\"?>',\n\t\t /attribute name '(.*)' appears more than once/)\n end",
"def equality\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 54 )\n return_value = EqualityReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal244 = nil\n string_literal245 = nil\n string_literal246 = nil\n string_literal247 = nil\n relation243 = nil\n relation248 = nil\n\n tree_for_string_literal244 = nil\n tree_for_string_literal245 = nil\n tree_for_string_literal246 = nil\n tree_for_string_literal247 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 601:5: relation ( ( '==' | '!=' | '===' | '!==' ) relation )*\n @state.following.push( TOKENS_FOLLOWING_relation_IN_equality_3968 )\n relation243 = relation\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, relation243.tree )\n end\n # at line 602:5: ( ( '==' | '!=' | '===' | '!==' ) relation )*\n while true # decision 58\n alt_58 = 2\n look_58_0 = @input.peek( 1 )\n\n if ( look_58_0 == NEQ || look_58_0 == NEQQ || look_58_0 == EQ || look_58_0 == EQQ )\n alt_58 = 1\n\n end\n case alt_58\n when 1\n # at line 603:7: ( '==' | '!=' | '===' | '!==' ) relation\n # at line 603:7: ( '==' | '!=' | '===' | '!==' )\n alt_57 = 4\n case look_57 = @input.peek( 1 )\n when EQ then alt_57 = 1\n when NEQ then alt_57 = 2\n when EQQ then alt_57 = 3\n when NEQQ then alt_57 = 4\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 57, 0 )\n end\n case alt_57\n when 1\n # at line 603:9: '=='\n string_literal244 = match( EQ, TOKENS_FOLLOWING_EQ_IN_equality_3986 )\n if @state.backtracking == 0\n\n tree_for_string_literal244 = @adaptor.create_with_payload( string_literal244 )\n root_0 = @adaptor.become_root( tree_for_string_literal244, root_0 )\n\n end\n\n when 2\n # at line 603:17: '!='\n string_literal245 = match( NEQ, TOKENS_FOLLOWING_NEQ_IN_equality_3991 )\n if @state.backtracking == 0\n\n tree_for_string_literal245 = @adaptor.create_with_payload( string_literal245 )\n root_0 = @adaptor.become_root( tree_for_string_literal245, root_0 )\n\n end\n\n when 3\n # at line 603:25: '==='\n string_literal246 = match( EQQ, TOKENS_FOLLOWING_EQQ_IN_equality_3996 )\n if @state.backtracking == 0\n\n tree_for_string_literal246 = @adaptor.create_with_payload( string_literal246 )\n root_0 = @adaptor.become_root( tree_for_string_literal246, root_0 )\n\n end\n\n when 4\n # at line 603:34: '!=='\n string_literal247 = match( NEQQ, TOKENS_FOLLOWING_NEQQ_IN_equality_4001 )\n if @state.backtracking == 0\n\n tree_for_string_literal247 = @adaptor.create_with_payload( string_literal247 )\n root_0 = @adaptor.become_root( tree_for_string_literal247, root_0 )\n\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_relation_IN_equality_4013 )\n relation248 = relation\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, relation248.tree )\n end\n\n else\n break # out of loop for decision 58\n end\n end # loop for decision 58\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 54 )\n\n end\n \n return return_value\n end",
"def test_param_entities\n\ttoker = NQXML::Tokenizer.new('<?xml version=\"1.0\"?>\n<!DOCTYPE test [\n<!ENTITY % xx \\'%zz;\\'>\n<!ENTITY % zz \\'<!ENTITY tricky \"error-prone\" >\\' >\n<!ENTITY % yy \\'%zz;\\' >\n%xx;\n]>\n<test>This sample shows a &tricky; method.</test>'\n\t)\n\n\tnewline = NQXML::Text.new(\"\\n\", \"\\n\")\n\txx = NQXML::ParameterEntityTag.new('xx', '%zz;', nil,\n\t\t\t\t\t '<!ENTITY % xx \\'%zz;\\'>')\n\tzzSrc = '<!ENTITY % zz \\'<!ENTITY tricky \"error-prone\" >\\' >'\n\tzz = NQXML::ParameterEntityTag.new('zz',\n\t\t\t\t\t '<!ENTITY tricky \"error-prone\" >',\n\t\t\t\t\t nil, zzSrc)\n\tyySrc = '<!ENTITY % yy \\'%zz;\\' >'\n\tyy = NQXML::ParameterEntityTag.new('yy',\n\t\t\t\t\t '<!ENTITY tricky \"error-prone\" >',\n\t\t\t\t\t nil, yySrc)\n\n\ttricky = NQXML::GeneralEntityTag.new('tricky', 'error-prone', nil, nil,\n\t\t\t\t\t '<!ENTITY tricky \"error-prone\" >')\n\t\n\tdoctype = NQXML::Doctype.new('test', nil,\n\t\t\t\t [xx, zz, yy, tricky],\n'<!DOCTYPE test [\n<!ENTITY % xx \\'%zz;\\'>\n<!ENTITY % zz \\'<!ENTITY tricky \"error-prone\" >\\' >\n<!ENTITY % yy \\'%zz;\\' >\n%xx;\n]>'\n\t\t\t\t )\n\texpected = [\n\t NQXML::XMLDecl.new('xml', {'version'=>'1.0'},\n\t\t\t '<?xml version=\"1.0\"?>'),\n\t newline,\n\t doctype,\n\t newline,\n\t NQXML::Tag.new('test', {}, false, '<test>'),\n\t NQXML::Text.new('This sample shows a error-prone method.'),\n\t NQXML::Tag.new('test', nil, true, '</test>')\n\t]\n\n\ti = 0\n\ttoker.each { | entity |\n\t assert_equal(expected[i], entity)\n\t if entity.instance_of?(NQXML::Doctype)\n\t\tassert_equal(4, entity.entities.length)\n\t\tassert_equal(xx, entity.entities[0])\n\t\tassert_equal(zz, entity.entities[1])\n\t\tassert_equal(yy, entity.entities[2])\n\t\tassert_equal(tricky, entity.entities[3])\n\t end\n\t i += 1\n\t}\n end",
"def test_creates_self_closing_tags\n DangDeveloper::ElementalHelper.xhtml_content_tags.each do |element|\n result = eval(\"#{element}\")\n expected = \"<#{element}/>\"\n assert_dom_equal expected, result\n end\n DangDeveloper::ElementalHelper.self_closing_tags.each do |element|\n result = eval(\"#{element}\")\n expected = \"<#{element}/>\"\n assert_dom_equal expected, result\n end\n end",
"def test_tag_1_attributes_2\n expected_tag = \"<p style=\\\"background-color:Tomato;\\\">Lorem ipsum...</p>\"\n\n tag = \"p\"\n content = \"Lorem ipsum...\"\n atrribute1 = \"style=\\\"background-color:Tomato;\\\"\"\n actual_tag = @page_generator.generate_simple_tag tag, content, atrribute1\n\n assert_equal expected_tag, actual_tag\n end",
"def compare_websocket_data_with_xml(values_from_xml, units_from_xml, values_from_ws, units_from_ws)\n val_mismatch_count = 0\n if values_from_xml.size == values_from_ws.size || units_from_xml.size == units_from_ws.size\n for i in 0..values_from_xml.size - 1\n if unit_validity(units_from_xml[i]) && unit_validity(units_from_ws[i]) && unit_compatibility(units_from_xml[i], units_from_ws[i])\n if source_val_match_with_output_val\n puts \"Object value from XML: \\\"#{values_from_xml[i]} #{units_from_xml[i]}\\\" is equivalent to converted value sent over websocket: \\\"#{values_from_ws[i]} #{units_from_ws[i]}\\\"\"#.green #-- cucumber html reports doesn't like/honor the colorise gem's colors\n else\n puts \"Object value in XML: \\\"#{values_from_xml[i]} #{units_from_xml[i]}\\\" is not equivalent to the value sent over websocket: \\\"#{values_from_ws[i]} #{units_from_ws[i]}\\\"\"#.red\n val_mismatch_count +=1\n end\n else\n puts \"Unit are either not valid or not comptible for conversion.\"\n raise TestCaseFailed, 'Invalid or non-compatible units'\n end\n end\n if val_mismatch_count > 0\n raise TestCaseFailed, 'Values of %{count}/%{total} objects did not match exactly with their corresponding values obtained from websocket stream.' % {count: val_mismatch_count, total: values_from_xml.size}\n end\n else\n puts \"Number of objects/units sent by sims does not match with number of objects/units obtained from websocket stream.\"\n raise TestCaseFailed, 'Object/unit count mismatch bewteen sims and websocket stream.'\n end\nend",
"def escape_xml(string) \n string.gsub(/[&<>\\'\\\"]/) do | match |\n case match\n when '&' then '&'\n when '<' then '<'\n when '>' then '>'\n when '\"' then '"'\n when \"'\" then '''\n end\n end \n end",
"def valid_xml_element(name, options={:level => :error})\n\t\t\t\tvalidate(\"Invalid XML element '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def test_encoding\n\tassert_equal('x & x', NQXML.encode('x & x'))\n\tassert_equal('x ' x', NQXML.encode('x \\' x'))\n\tassert_equal('x <"> x', NQXML.encode('x <\"> x'))\n end",
"def test_get_xml_for\n order_1 = orders(:santa_next_christmas_order)\n\n # Order with a blank shipping type, just to cover a comparison in the method.\n order_2 = orders(:an_order_ordered_paid_shipped)\n order_2.order_shipping_type = nil\n \n # Test the XML.\n require 'rexml/document'\n \n xml = REXML::Document.new(Order.get_xml_for([order_1, order_2]))\n assert xml.root.name, \"orders\"\n\n # TODO: For some elements the name don't correspond with the content.\n # This can be tested a little more.\n end",
"def test_encoded_in_change_out\n doc = Document.new( @encoded )\n doc.xml_decl.encoding = \"UTF-8\"\n assert_equal(\"UTF-8\", doc.encoding)\n REXML::Formatters::Default.new.write( doc.root, out=\"\" )\n out.force_encoding(::Encoding::ASCII_8BIT)\n assert_equal( @not_encoded.b, out )\n char = XPath.first( doc, \"/a/b/text()\" ).to_s\n char.force_encoding(::Encoding::ASCII_8BIT)\n assert_equal( \"ĉ\".b, char )\n end",
"def test_compare_string_overlap_defs\n v1 = Vertex.new(\"speech\", 2, 1, 0, 0, 1, \"NN\")\n v2 = Vertex.new(\"delivering\", 2, 1, 0, 0, 1, \"VB\")\n assert_equal(1, instance.compare_strings(v1, v2, speller))#no POS is considered for hypernyms and hyponyms\n end",
"def test_lt\n\txml = '<p/><= 4'\n\texpectedEntities = [\n\t NQXML::Tag.new('p', {}, false, '<p/>'),\n\t NQXML::Tag.new('p', nil, true, '<p/>'),\n\t NQXML::Text.new('<= 4')\n\t]\n\n\tt = NQXML::Tokenizer.new(xml)\n\ti = 0\n\tt.each { | e |\n\t assert_equal(expectedEntities[i], e)\n\t i += 1\n\t}\n\tassert_equal(expectedEntities.length, i)\n\tassert(t.eof?)\n end",
"def escape_xml(string)\n string.gsub!(\"&\", \"&\")\n string.gsub!(\"<\", \"<\")\n string.gsub!(\">\", \">\")\n string.gsub!(\"'\", \"'\")\n string.gsub!(\"\\\"\", \""\")\n\n return string\n end",
"def test_tag_2_attributes_1\n expected_tag = \"<a href=\\\"https:\\\\\\\\www.google.com\\\" target=\\\"_blank\\\">Google</a>\"\n\n tag = \"a\"\n content = \"Google\"\n atrribute1 = \"href=\\\"https:\\\\\\\\www.google.com\\\"\"\n attribute2 = \"target=\\\"_blank\\\"\"\n actual_tag = @page_generator.generate_simple_tag tag, content, atrribute1, attribute2\n\n assert_equal expected_tag, actual_tag\n end",
"def test_string_comparison\n value1_ = ::Versionomy.create([1, 9, 2, 'a2'], :semver)\n value2_ = ::Versionomy.create([1, 9, 2, 'b1'], :semver)\n assert(value2_ > value1_)\n end",
"def ==(other)\n case other\n when Literal\n self.value.eql?(other.value) &&\n self.language.eql?(other.language) &&\n self.datatype.eql?(other.datatype)\n when String\n self.plain? && self.value.eql?(other)\n else false\n end\n end",
"def test_in_different_out\n doc = Document.new( @not_encoded )\n doc.write( Output.new( out=\"\", \"ISO-8859-3\" ) )\n out.force_encoding(::Encoding::ASCII_8BIT)\n assert_equal( \"<?xml version='1.0'?>#{@encoded_root}\".b, out )\n end",
"def isxml?(xml)\n xml.lstrip.start_with?('<')\n end",
"def ==(other_element)\n if other_element.type == type && other_element.content == content\n return true\n end\n return false\n end",
"def ==(other)\n return false unless other.is_a?(QName)\n s9_qname.equals(other.to_java)\n end",
"def escape_xml(xml_in) \n return xml_in.gsub(/&/,'&').gsub(/</,'<')\n end",
"def parse_value_rexml(value, ns_strs, language)\n # Fixme\n end",
"def test_output_escaping\n\t\ttext = '<bad-script>if (a < b || b > c) { return \"text\"; }<stop/>return \">>>snip<<<\";</bad-script>'\n node = LibXML::XML::Parser.string(text).parse.root\n\t\tassert_equal text, node.to_s\n\n\t\ttext_noenc = '<bad-script>if (a < b || b > c) { return \"text\"; }<stop/>return \">>>snip<<<\";</bad-script>'\n\t\tnode.output_escaping = false\n\t\tassert_equal text_noenc, node.to_s\n\n\t\tnode.output_escaping = true\n\t\tassert_equal text, node.to_s\n\n\t\tnode.output_escaping = nil\n\t\tassert_equal text_noenc, node.to_s\n\n\t\tnode.output_escaping = true\n\t\tassert_equal text, node.to_s\n end",
"def normalize_xmlliteral(contents, options = {})\n options[:namespaces] ||= {}\n\n begin\n # Only normalize if Nokogiri is included\n require 'nokogiri' unless defined?(Nokogiri)\n rescue LoadError => e\n contents.to_s # No normalization\n end\n \n if contents.is_a?(String)\n ns_hash = {}\n options[:namespaces].each_pair do |prefix, uri|\n attr = prefix.to_s.empty? ? \"xmlns\" : \"xmlns:#{prefix}\"\n ns_hash[attr] = uri.to_s\n end\n ns_strs = []\n ns_hash.each_pair {|a, u| ns_strs << \"#{a}=\\\"#{u}\\\"\"}\n\n # Add inherited namespaces to created root element so that they're inherited to sub-elements\n contents = Nokogiri::XML::Document.parse(\"<foo #{ns_strs.join(\" \")}>#{contents}</foo>\").root.children\n end\n\n # Add already mapped namespaces and language\n contents.map do |c|\n if c.is_a?(Nokogiri::XML::Element)\n c = Nokogiri::XML.parse(c.dup.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::NO_EMPTY_TAGS)).root\n # Gather namespaces from self and decendant nodes\n c.traverse do |n|\n ns = n.namespace\n next unless ns\n prefix = ns.prefix ? \"xmlns:#{ns.prefix}\" : \"xmlns\"\n c[prefix] = ns.href.to_s unless c.namespaces[prefix]\n end\n \n # Add lanuage\n if options[:language] && c[\"lang\"].to_s.empty?\n c[\"xml:lang\"] = options[:language]\n end\n end\n c.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::NO_EMPTY_TAGS)\n end.join(\"\")\n end",
"def assert_js_xml(q) # ERGO explain this beast; hide inside assert_js_*\n \n # FIXME test this with an &entity;!\n \n xml = eval('\"' + q + '\"')\n xml = '<html><body>' + CGI::unescapeHTML(xml) + '</body></html>' if using :libxml?\n\n assert_xml xml # ERGO what are the errors if these fail?\n end",
"def replace_xml_str(xml_node, old_str, new_str)\n if xml_node.has_elements?\n xml_node.elements.each do | cur_node |\n replace_xml_str(cur_node, old_str, new_str)\n end\n else\n if xml_node.get_text\n xml_node.text = xml_node.get_text.value.gsub(old_str, new_str)\n end\n end\n end",
"def test_output_escaping_sanity\n\t\ttext = '<bad-script>if (a < b || b > c) { return \"text\"; }<stop/>return \">>>snip<<<\";</bad-script>'\n node = LibXML::XML::Parser.string(text).parse.root\n\t\taffected = node.find('//text()')\n\n\t\tcheck_escaping = lambda do |flag|\n\t\t\tassert_equal('bad-script', node.name)\n\t\t\tassert_equal(flag, node.output_escaping?)\n\t\t\taffected.each do |x|\n\t\t\t\tassert_equal(flag ? 'text' : 'textnoenc', x.name)\n\t\t\t\tassert_equal(flag, x.output_escaping?)\n\t\t\tend\n\t\tend\n\n\t\tnode.output_escaping = false\n\t\tcheck_escaping[false]\n\n\t\tnode.output_escaping = true\n\t\tcheck_escaping[true]\n\n\t\tnode.output_escaping = nil\n\t\tcheck_escaping[false]\n\n\t\tnode.output_escaping = true\n\t\tcheck_escaping[true]\n\n\t\taffected.first.output_escaping = true\n\t\taffected.last.output_escaping = false\n\t\tassert node.output_escaping?.nil?\n end",
"def escape_xml(value)\n value.to_s.gsub(/[&<>\"']/) { |s| ESCAPE_TABLE[s] } # or /[&<>\"']/\n end",
"def test_tag_1_attributes_1\n expected_tag = \"<h1 style=\\\"background-color:DodgerBlue;\\\">Hello World</h1>\"\n\n tag = \"h1\"\n content = \"Hello World\"\n atrribute1 = \"style=\\\"background-color:DodgerBlue;\\\"\"\n actual_tag = @page_generator.generate_simple_tag tag, content, atrribute1\n\n assert_equal expected_tag, actual_tag\n end",
"def test_entity_replacement\n\tt = NQXML::Tokenizer.new('')\n\n\t# add a method that lets us set the internal entity hash\n\tclass << t\n\t def testSetInternalEntities(h); @internalEntities = h; end\n\tend\n\n\tt.testSetInternalEntities({ # as if we saw <!ENTITY...> tags\n\t 'a' => '&b;',\n\t 'b' => '&foo;',\n\t 'foo' => '&bar;',\n\t 'bar' => 'bletch',\n\t 'ugly' => 'An ampersand (&) may be escaped' +\n\t\t\t' numerically (&#38;) or with a general' +\n\t\t\t' entity (&amp;).'\n\t})\n\n\tassert_equal('x <&> x', t.replaceAllRefsButParams('x <&> x'))\n\tassert_equal('x \"\\' x', t.replaceAllRefsButParams('x "' x'))\n\tassert_equal('x A x', t.replaceAllRefsButParams('x A x'))\n\tassert_equal('x A x', t.replaceAllRefsButParams('x A x'))\n\tassert_equal('&&', t.replaceAllRefsButParams('&&'))\n\n\tassert_equal('&', t.replaceAllRefsButParams('&'))\n\tassert_equal('&', t.replaceAllRefsButParams('&'))\n\n\tassert_equal('bletch', t.replaceAllRefsButParams('&bar;'))\n\tassert_equal('bletch', t.replaceAllRefsButParams('&foo;'))\n\tassert_equal('bletch', t.replaceAllRefsButParams('&b;'))\n\tassert_equal('bletch', t.replaceAllRefsButParams('&a;'))\n\n\tassert_equal('An ampersand (&) may be escaped' +\n\t\t ' numerically (&) or with a general' +\n\t\t ' entity (&).', t.replaceAllRefsButParams('&ugly;'))\n\n\t# Make sure unknown entities raise an error\n\texpect_error('x &huh; x', /entity reference '&huh;' is undefined/)\n end",
"def ==(x)\n return false unless x.kind_of?(Element)\n return true if x.object_id == object_id\n return false unless x.tagname_symbol == @tagname\n return false unless x.attrs.size == @attrs.size\n @attrs.each do |a|\n return false unless x[a.key] == a.value\n end\n return false unless x.body == @body\n true\n end",
"def test_multiple_formats\n two_format_setup\n\n correct = <<~HEREDOC\n <picture>\n <source srcset=\"ss\" type=\"webp\">\n <source srcset=\"ss\" type=\"original\">\n <img src=\"good_url\">\n </picture>\n HEREDOC\n\n assert_equal correct, @tested.to_s\n end",
"def test_equality\n uri_string = \"http://foobar.com/xyz/\"\n uri = N::URI.new(uri_string)\n uri_2 = N::URI.new(uri_string)\n uri_other = N::URI.new(\"http://otheruri.com/\")\n \n assert_equal(uri, uri_string)\n assert_equal(uri, uri)\n assert_equal(uri, uri_2)\n assert_not_equal(\"http://something.org\", uri)\n assert_not_equal(uri, uri_other)\n assert_not_equal(uri, Hash.new)\n end",
"def ==(other)\n self.canonicalize.to_s == other.canonicalize.to_s\n end",
"def xml?; end",
"def xml?; end",
"def test_equality_string\n value1_ = ::Versionomy.parse(\"1.8.7p72\")\n assert_operator(value1_, :==, \"1.8.7p72\")\n assert_operator(value1_, :==, \"1.8.7.0-72.0\")\n end",
"def test_uri_validator\n # invalid\n assert !RDF::valid_uri?(\"use`quote\")\n # assert !RDF::valid_uri?(\"use%7quote\")\n\n # valid\n assert RDF::valid_uri?(\"use%07quote\")\n\n end",
"def test3\n parser = ZML::StreamToREXML.new(false)\n REXML::Document.parse_stream(DOC1, parser)\n res = parser.result\n assert(res.instance_of?(REXML::Element), \"Result should be REXML::Element\")\n\n rtext = \"\"\n res.write(rtext)\n\n # Restrict to the root element only\n # (REXML handles whitespace correctly within this, so we don't need\n # to mess around too much here)\n md = /\\A.*?(<([a-zA-Z0-9:_]+)[^>]*>.*<\\/\\2>).*\\z/m.match(DOC1)\n assert(md)\n assert_equal(md[1], rtext)\n end",
"def test_mismatch\r\n ax = Ziya::Components::AxisCategory.new\r\n ax.font = \"Arial\"\r\n ax.size = 10\r\n ax.bold = true\r\n ax.skip = 1\r\n ax.color = \"ff00ff\"\r\n ax.alpha = 50\r\n ax.orientation = \"horizontal\"\r\n ax.margin = 1\r\n ax.steps = 4\r\n ax.min = -40\r\n ax.max = 100\r\n ax.prefix = \"hello1\"\r\n ax.suffix = \"mama\"\r\n ax.decimals = 2\r\n ax.decimal_char = '.'\r\n ax.separator = '_'\r\n \r\n xml = Builder::XmlMarkup.new\r\n ax.flatten(xml)\r\n \r\n begin\r\n check_results(xml.to_s.gsub(/<to_s\\/>/, ''), File.join(File.dirname(__FILE__), '../xmls/axis_category.xml'))\r\n rescue => error\r\n assert_equal \"Attribute mismatch for key 'prefix'.\\n<\\\"hello\\\"> expected but was\\n<\\\"hello1\\\">.\", error.to_s\r\n return\r\n end\r\n fail \"Expecting exception\"\r\n end",
"def delimited_string_literal?(node); end",
"def test_operation_from_xml()\n extracted = Nokogiri::XML(\n @batch_job_utils.extract_soap_operations(VALID_SERVICE_XML)\n )\n expected = Nokogiri::XML(EXPECTED_OPERATION)\n assert_equal(clean_xml(expected.to_s), clean_xml(extracted.to_s))\n end",
"def smart_parse_compare(xml, expected, handler = AllSax, opts = {}, handler_attr = :calls)\n parse_compare(xml, expected, handler, opts.merge(smart: true, skip: :skip_white), handler_attr)\n end",
"def test_equality_parsed\n value1_ = ::Versionomy.parse(\"1.8.7p72\")\n value2_ = ::Versionomy.parse(\"1.8.7.0-72.0\")\n assert_equal(value2_, value1_)\n assert_equal(value2_.hash, value1_.hash)\n end",
"def assert_xml_reflexively_equals_to_mime_dir(xml, mimedir)\n assert_xml_equals_to_mime_dir(xml, mimedir)\n\n component = Tilia::VObject::Reader.read(mimedir)\n assert_equal(Hash.from_xml(xml), Hash.from_xml(Tilia::VObject::Writer.write_xml(component)))\n end",
"def add_xml_decl! #:nodoc:\n converted = @input.unpack(\"C*\").map do |c|\n if ASCII.include?(c) then\n c\n else\n case c\n when 168, 170, 233; ?e\n when 195; nil\n when 244; ?o\n else; ?_\n end\n end\n end\n\n @input = converted.pack(\"C*\")\n @input = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n#{@input}\"\n end",
"def equality\r\n node = relational()\r\n\r\n loop do\r\n if consume(\"==\")\r\n node = new_binary(ND_EQ, node, relational())\r\n elsif consume(\"!=\")\r\n node = new_binary(ND_NE, node, relational())\r\n else\r\n return node\r\n end\r\n end\r\nend",
"def to_xml_string(str = +'')\n str << '<conditionalFormatting sqref=\"' << sqref << '\">'\n rules.each_with_index do |rule, index|\n str << ' ' unless index.zero?\n rule.to_xml_string(str)\n end\n str << '</conditionalFormatting>'\n end",
"def assert_xml_tag(xml, conditions)\n doc = HTML::Document.new(xml)\n assert doc.find(conditions), \n \"expected tag, but no tag found matching #{conditions.inspect} in:\\n#{xml.inspect}\"\nend",
"def protectXML(content)\n content.gsub('&','&').gsub('<','<').gsub('>','>')\n end",
"def test_string_comparison\n value1_ = ::Versionomy.create([1, 9, 2, 'a', 2], :rubygems)\n value2_ = ::Versionomy.create([1, 9, 2, 'b', 1], :rubygems)\n assert(value2_ > value1_)\n end",
"def ==(other)\n # If lexically invalid, use regular literal testing\n return super unless self.valid? && (!other.respond_to?(:valid?) || other.valid?)\n\n case other\n when Literal::Numeric\n (cmp = (self <=> other)) ? cmp.zero? : false\n when RDF::URI, RDF::Node\n # Interpreting SPARQL data-r2/expr-equal/eq-2-2, numeric can't be compared with other types\n type_error(\"unable to determine whether #{self.inspect} and #{other.inspect} are equivalent\")\n else\n super\n end\n end",
"def test_documentcreateelementcasesensitive\n doc = nil\n newElement1 = nil\n newElement2 = nil\n attribute1 = nil\n attribute2 = nil\n doc = load_document(\"staff\", true)\n newElement1 = doc.createElement(\"ADDRESS\")\n newElement2 = doc.createElement(\"address\")\n newElement1.setAttribute(\"district\", \"Fort Worth\")\n newElement2.setAttribute(\"county\", \"Dallas\")\n attribute1 = newElement1.getAttribute(\"district\")\n attribute2 = newElement2.getAttribute(\"county\")\n assert_equal(\"Fort Worth\", attribute1, \"attrib1\")\n assert_equal(\"Dallas\", attribute2, \"attrib2\")\n \n end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def xml?\n type == DOCUMENT_NODE\n end",
"def import_xml_common(ent, node)\n REXML::XPath.each(node, \"./ctx:identifier\", {\"ctx\" => \"info:ofi/fmt:xml:xsd:ctx\"}) do |id|\n ent.add_identifier(id.get_text.value) if id and id.has_text?\n end\n\n priv = REXML::XPath.first(node, \"./ctx:private-data\", {\"ctx\" => \"info:ofi/fmt:xml:xsd:ctx\"})\n ent.set_private_data(priv.get_text.value) if priv and priv.has_text?\n\n ref = REXML::XPath.first(node, \"./ctx:metadata-by-ref\", {\"ctx\" => \"info:ofi/fmt:xml:xsd:ctx\"})\n if ref\n reference = {}\n ref.to_a.each do |r|\n if r.name == \"format\"\n reference[:format] = r.get_text.value if r.get_text\n else\n reference[:location] = r.get_text.value\n end\n end\n ent.set_reference(reference[:location], reference[:format])\n end\n end",
"def EqualityExpr(path, parsed); end",
"def xml?\n return unless subtype\n\n subtype == 'xml'\n end",
"def assert_rexml(*args, &block)\n contents = (args.shift || @response.body).to_s\n# ERGO benchmark these things\n\n contents.gsub!('\\\\\\'', ''')\n contents.gsub!('//<![CDATA[<![CDATA[', '')\n contents.gsub!('//<![CDATA[', '')\n contents.gsub!('//]]>', '')\n contents.gsub!('//]>', '')\n contents.gsub!('//]]', '')\n contents.gsub!('//]', '')\n\n begin\n @xdoc = REXML::Document.new(contents)\n rescue REXML::ParseException => e\n raise e unless e.message =~ /attempted adding second root element to document/\n @xdoc = REXML::Document.new(\"<xhtml>#{ contents }</xhtml>\")\n end\n\n _bequeath_attributes(@xdoc)\n assert_xpath(*args, &block) if args != []\n return (assert_xpath('/*') rescue nil) if @xdoc\n end",
"def test2b\n seq2b = deepcopy(SEQ2)\n res2b = deepcopy(RES2)\n seq2b[1][2] << ['xml:space','default']\n res2b['attributes'] << ['137','xml:space','default']\n check(seq2b, res2b, [1,3,7], {}, false)\n check(seq2b, res2b, [1,3,7], {}, true)\n end",
"def assert_xhtml_strict xhtml\n validator = Validator.new xhtml, Validator::XHTML1_STRICT\n assert validator.valid?, validator.inspect\n end",
"def assert_tag(tag, string)\n complete_tag = \"<#{tag}>\"\n partial_tag = \"<#{tag}(\"\n (string.include? complete_tag) || (string.include? partial_tag)\n end",
"def xml_escape(input)\n return input.to_s.to_xs\n end",
"def ==(other)\n # If lexically invalid, use regular literal testing\n return super unless self.valid?\n\n case other\n when Literal::Numeric\n return super unless other.valid?\n (cmp = (self <=> other)) ? cmp.zero? : false\n when RDF::URI, RDF::Node\n # Interpreting SPARQL data-r2/expr-equal/eq-2-2, numeric can't be compared with other types\n type_error(\"unable to determine whether #{self.inspect} and #{other.inspect} are equivalent\")\n else\n super\n end\n end",
"def xml_fragment_should_validate_against_schema(xml, schema_name, xmlns={})\n xml = xml.is_a?(String) ? xml : xml.to_s\n doc = Nokogiri::XML(xml)\n doc.root.send(:[]=, *xmlns.first)\n xml_data_should_validate_against_schema(doc, schema_name)\n end",
"def test_access\n\tdoc = NQXML::TreeParser.new(@rsrc.xml).document\n\n\troot = doc.rootNode\n\tassert_nil(root.parent)\n\tassert_equal('outer', root.entity.name)\n \tassert_equal(8, root.children.length)\n\tassert_instance_of(NQXML::Text, root.firstChild().entity)\n\tassert_instance_of(NQXML::Text, root.lastChild().entity)\n\n\tnode = root.firstChild().nextSibling()\n\tassert_equal(node.parent, root)\n\tassert_equal('<simpleTag>', node.entity.source)\n\tassert_equal(1, node.children.length)\n\tassert_equal('text', node.firstChild().entity.text)\n end",
"def test_no_extraneous_values_simple_encoding\n\t\t#code = IO.read('test/data/app.js',{ :encoding => 'UTF-8', :mode => 'rb'})\n\t\tr = Js.parse_file('test/data/app_clean.js','UTF-8')\n\t\tr.traverse(:also_foreign) do |node|\t\t\t\n\t\t\tnode.collect_values_with_count.each do |value,count|\n\t\t\t\tvalue_s = value.to_s.encode(Parser::DEFAULT_INTERNAL_ENCODING)\n\t\t\t\tvalue_s = value_s[0..-3] if value_s.end_with?('.0')\n\t\t\t\tnode_code = node.source.code.encode(Parser::DEFAULT_INTERNAL_ENCODING)\n\t\t\t\tunless node_code.include?(value_s)\n\t\t\t\t\tnode.class.ecore.eAllAttributes.each do |a|\n\t\t\t\t\t\tif a.many\n\t\t\t\t\t\t\tputs \"Attribute #{a.name}\" if node.send(:\"#{a.name}\").include?(value)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tputs \"Attribute #{a.name}\" if node.send(:\"#{a.name}\")==value\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tfail(\"Value '#{value}' expected in #{node}. Artifact: #{node.source.artifact}, abspos: #{node.source.position(:absolute)}, code: '#{node_code}'\")\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def test_tag_no_attributes_2\n expected_tag = \"<th>W/L</th>\"\n\n tag = \"th\"\n content = \"W/L\"\n actual_tag = @page_generator.generate_simple_tag tag, content\n\n assert_equal expected_tag, actual_tag\n end",
"def test_that_sanitize_does_not_mangle_ref_tags_and_such\n text = \"Hi <ref id=\\\"\\\">2007</ref> ho <ref id=\\\"12345\\\">Bar 2006</ref> fum<ref id=\\\"\\\"> Foo</ref>.\"\n content = contents(:cons1)\n otu = Otu.new(:name => 'foo')\n ct = ContentType.new(:name => 'bar')\n content.update_attributes!(:text => text, :otu => otu, :content_type => ct)\n content.reload\n assert_equal(text, content.text)\n end"
] | [
"0.70666987",
"0.69580764",
"0.6945802",
"0.68708915",
"0.67834777",
"0.64853346",
"0.642785",
"0.63423467",
"0.6318661",
"0.6158912",
"0.6108669",
"0.5952487",
"0.58695203",
"0.5854799",
"0.58479977",
"0.58113885",
"0.58005613",
"0.5781364",
"0.5747349",
"0.5728704",
"0.56661123",
"0.5664353",
"0.5662833",
"0.5594486",
"0.5590321",
"0.54782164",
"0.54318184",
"0.5404366",
"0.5393834",
"0.53881466",
"0.53872997",
"0.5376401",
"0.53606474",
"0.53557277",
"0.5324925",
"0.5292746",
"0.5288758",
"0.528474",
"0.52844584",
"0.52771276",
"0.5262292",
"0.5256666",
"0.5237387",
"0.52357566",
"0.5235522",
"0.5233692",
"0.52222794",
"0.5210912",
"0.52083564",
"0.5206118",
"0.51989925",
"0.51961243",
"0.51590955",
"0.5156215",
"0.5139156",
"0.5136989",
"0.5109194",
"0.5103861",
"0.5086546",
"0.5080648",
"0.5078263",
"0.507757",
"0.5076146",
"0.5075974",
"0.50575864",
"0.5051546",
"0.5051546",
"0.5050854",
"0.5043012",
"0.50416493",
"0.5025078",
"0.5023",
"0.50208104",
"0.50193596",
"0.501641",
"0.50147307",
"0.5011466",
"0.5003629",
"0.4997706",
"0.49930054",
"0.4989979",
"0.49862874",
"0.4981165",
"0.49800313",
"0.49724373",
"0.49655056",
"0.4959509",
"0.495818",
"0.49430212",
"0.4938704",
"0.49298137",
"0.49243534",
"0.49215144",
"0.49170467",
"0.49165952",
"0.49163637",
"0.49125722",
"0.4908668",
"0.49036926",
"0.49017465"
] | 0.67453015 | 5 |
Use equivalentxml to determine equivalence | def equivalent_nokogiri(other)
if defined?(::EquivalentXml)
EquivalentXml.equivalent?(object, other.object)
else
equivalent_rexml(other)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equivalent_rexml(other)\n begin\n require 'active_support'\n require 'active_support/core_ext'\n rescue LoadError\n # string equivalence\n end\n\n if Hash.respond_to?(:from_xml)\n Hash.from_xml(\"<root>#{self}</root>\") == Hash.from_xml(\"<root>#{other}</root>\")\n else\n # Poor mans equivalent\n value == other.value\n end\n end",
"def assert_equivalent_xml(expected, actual)\n expected_xml = Nokogiri::XML(\"<test-xml>\\n#{expected}\\n</test-xml>\")\n actual_xml = Nokogiri::XML(\"<test-xml>\\n#{actual}\\n</test-xml>\")\n ignored_attributes = %w(style data-disable-with)\n\n equivalent = EquivalentXml.equivalent?(expected_xml, actual_xml, {\n ignore_attr_values: ignored_attributes\n }) do |a, b, result|\n if result === false && b.is_a?(Nokogiri::XML::Element)\n if b.attr('name') == 'utf8'\n # Handle wrapped utf8 hidden field for Rails 4.2+\n result = EquivalentXml.equivalent?(a.child, b)\n end\n if b.delete('data-disable-with')\n # Remove data-disable-with for Rails 5+\n # Workaround because ignoring in EquivalentXml doesn't work\n result = EquivalentXml.equivalent?(a, b)\n end\n if a.attr('type') == 'datetime' && b.attr('type') == 'datetime-local'\n a.delete('type')\n b.delete('type')\n # Handle new datetime type for Rails 5+\n result = EquivalentXml.equivalent?(a, b)\n end\n end\n result\n end\n\n assert equivalent, lambda {\n # using a lambda because diffing is expensive\n Diffy::Diff.new(\n sort_attributes(expected_xml.root),\n sort_attributes(actual_xml.root)\n ).to_s(:color)\n }\n end",
"def xml_should_be_same(expected, actual)\n expected = Hpricot(expected)\n actual = Hpricot(actual)\n \n blame = \"\\n\\n#################### expected\\n#{expected.to_html}\\n\\n\" \"#################### actual:\\n#{actual.to_html}\\n\\n\" \n (xml_cmp(expected, actual)).should.blaming(blame).equal true\nend",
"def xml_compare a, b\n a = REXML::Document.new(a.to_s)\n b = REXML::Document.new(b.to_s)\n\n normalized = Class.new(REXML::Formatters::Pretty) do\n def write_text(node, output)\n super(node.to_s.strip, output)\n end\n end\n\n normalized.new(indentation=0,ie_hack=false).write(node=a, a_normalized='')\n normalized.new(indentation=0,ie_hack=false).write(node=b, b_normalized='')\n\n a_normalized == b_normalized\n end",
"def xml_should_eql(actual, expected)\n same = xml_cmp(actual, expected)\n actual.should.== expected unless same \nend",
"def assert_equal(expected, actual)\n if expected.is_a?(Nokogiri::XML::Node) && actual.is_a?(Nokogiri::XML::Node)\n assert(EquivalentXml.equivalent?(expected, actual,\n element_order: false, normalize_whitespace: true),\n \"XML nodes were not equal\")\n elsif expected.is_a?(String) && actual.is_a?(String)\n ex_bin = expected.dup.force_encoding('BINARY')\n act_bin = actual.dup.force_encoding('BINARY')\n\n assert(ex_bin == act_bin,\n \"strings were not equal\")\n else\n assert(expected == actual, \"expected `#{expected}`, got `#{actual}`\")\n end\n end",
"def ==(other)\n if other.class == self.class\n xml.to_s == other.xml.to_s\n else\n super\n end\n end",
"def assert_xml_equals(first_xml, second_xml)\n doc1 = XML::Document.string(first_xml)\n doc2 = XML::Document.string(second_xml)\n\n assert_block \"'#{first_xml}' is not the same as '#{second_xml}'\" do\n tree_equals?(doc1.root, doc2.root)\n end\n end",
"def ==(x)\n return false unless x.is_a? XML\n return false unless name == x.name and attrs == x.attrs\n # Now the hard part, strings can be split in different ways\n # empty string children are possible etc.\n self_i = 0\n othr_i = 0\n while self_i != contents.size or othr_i != x.contents.size\n # Ignore \"\"s\n if contents[self_i].is_a? String and contents[self_i] == \"\"\n self_i += 1\n next\n end\n if x.contents[othr_i].is_a? String and x.contents[othr_i] == \"\"\n othr_i += 1\n next\n end\n\n # If one is finished and the other contains non-empty elements,\n # they are not equal\n return false if self_i == contents.size or othr_i == x.contents.size\n\n # Are they both Strings ?\n # Strings can be divided in different ways, and calling normalize!\n # here would be rather expensive, so let's use this complicated\n # algorithm\n if contents[self_i].is_a? String and x.contents[othr_i].is_a? String\n a = contents[self_i]\n b = x.contents[othr_i]\n self_i += 1\n othr_i += 1\n while a != \"\" or b != \"\"\n if a == b\n a = \"\"\n b = \"\"\n elsif a.size > b.size and a[0, b.size] == b\n a = a[b.size..-1]\n if x.contents[othr_i].is_a? String\n b = x.contents[othr_i]\n othr_i += 1\n next\n end\n elsif b.size > a.size and b[0, a.size] == a\n b = b[a.size..-1]\n if contents[self_i].is_a? String\n a = contents[self_i]\n self_i += 1\n next\n end\n else\n return false\n end\n end\n next\n end\n\n # OK, so at least one of them is not a String.\n # Hopefully they're either both XMLs or one is an XML and the\n # other is a String. It is also possible that contents contains\n # something illegal, but we aren't catching that,\n # so xml(:foo, Garbage.new) is going to at least equal itself.\n # And we aren't, because xml(:foo, Garbage.new) == xml(:bar, Garbage.new)\n # is going to return an honest false, and incoherent sanity\n # check is worse than no sanity check.\n #\n # Oh yeah, they can be XML_PI or XML_Comment. In such case, this\n # is ok.\n return false unless contents[self_i] == x.contents[othr_i]\n self_i += 1\n othr_i += 1\n end\n return true\n end",
"def on_eq(ast_node, context)\n left = process(ast_node.children[0], context)\n right = process(ast_node.children[1], context)\n\n if left.is_a?(XML::NodeSet)\n left = first_node_text(left)\n end\n\n if right.is_a?(XML::NodeSet)\n right = first_node_text(right)\n end\n\n if left.is_a?(Numeric) and !right.is_a?(Numeric)\n right = to_float(right)\n end\n\n if left.is_a?(String) and !right.is_a?(String)\n right = to_string(right)\n end\n\n return left == right\n end",
"def compare_xml_method current, expect\n @compareTable.compare_table(current, expect)\n end",
"def eql?(other)\n if other.is_a?(Literal::XML)\n case @library\n when :nokogiri then equivalent_nokogiri(other)\n when :rexml then equivalent_rexml(other)\n end\n elsif other.is_a?(Literal) && (other.plain? || other.datatype == RDF::XSD.string)\n value == other.value\n else\n super\n end\n end",
"def equivalent?(other)\n Equivalence.new.call(self, other)\n end",
"def tdiff_equal(node)\n if (self.class == node.class)\n case node\n when Nokogiri::XML::Attr\n (self.name == node.name && self.value == node.value)\n when Nokogiri::XML::Element, Nokogiri::XML::DTD\n self.name == node.name\n when Nokogiri::XML::Text, Nokogiri::XML::Comment\n self.text == node.text\n when Nokogiri::XML::ProcessingInstruction\n (self.name == node.name && self.content = self.content)\n else\n false\n end\n else\n false\n end\n end",
"def build_xml(builder)\n super(builder)\n builder.EquivalentSegment {|b| equivalent_segment.build_xml(b) } if equivalent_segment\n end",
"def test2\n parser = ZML::StreamToREXML.new\n REXML::Document.parse_stream(DOC1, parser)\n res = parser.result\n assert(res.instance_of?(REXML::Document), \"Result should be REXML::Document\")\n\n # Now we have to check it's the same. We don't have a convenient method\n # to walk down two trees checking they are equal. Unfortunately, just\n # getting REXML to write it back out and comparing with the source\n # doesn't work properly; it inserts newlines at places of its own\n # chosing, e.g. after <!ELEMENT ...> and after <!DOCTYPE ... [\n # So, we reparse the source XML and get REXML to write that out too!\n\n rtext = \"\"\n res.write(rtext)\n should = \"\"\n REXML::Document.new(DOC1).write(should)\n assert_equal(should, rtext)\n end",
"def equal_to_xml(xml)\n @type = :equalToXml\n @value = xml\n @request_builder\n end",
"def rexml? ; false end",
"def nodesEquivalent?(n1, n2)\n depth do\n r = if n1.is_a?(Array) && n2.is_a?(Array) && n1.length == n2.length\n equiv = true\n n1.each_with_index do |v1, i|\n equiv &&= nodesEquivalent?(v1, n2[i]) if equiv\n end\n equiv\n elsif value?(n1) && value?(n2)\n n1 == n2\n elsif list?(n1)\n list?(n2) &&\n n1.fetch('@index', true) == n2.fetch('@index', true) &&\n nodesEquivalent?(n1['@list'], n2['@list'])\n elsif (node?(n1) || node_reference?(n2))\n (node?(n2) || node_reference?(n2)) && n1['@id'] == n2['@id']\n else\n false\n end\n\n debug(\"nodesEquivalent?(#{n1.inspect}, #{n2.inspect}): #{r.inspect}\")\n r\n end\n end",
"def assert_xml_reflexively_equals_to_mime_dir(xml, mimedir)\n assert_xml_equals_to_mime_dir(xml, mimedir)\n\n component = Tilia::VObject::Reader.read(mimedir)\n assert_equal(Hash.from_xml(xml), Hash.from_xml(Tilia::VObject::Writer.write_xml(component)))\n end",
"def assert_xml_not_equal(expected_doc, actual_doc, message = nil)\r\n expected_doc = parse_xml(expected_doc)\r\n actual_doc = parse_xml(actual_doc)\r\n _wrap_assertion do\r\n full_message = build_message(message, <<EOT, actual_doc.inspect, expected_doc.inspect)\r\n\r\n<?> expected not to be equal to\r\n<?> but was equal.\r\nEOT\r\n assert_block(full_message){ ! are_equal?(expected_doc, actual_doc)}\r\n end\r\n end",
"def compare_websocket_data_with_xml(values_from_xml, units_from_xml, values_from_ws, units_from_ws)\n val_mismatch_count = 0\n if values_from_xml.size == values_from_ws.size || units_from_xml.size == units_from_ws.size\n for i in 0..values_from_xml.size - 1\n if unit_validity(units_from_xml[i]) && unit_validity(units_from_ws[i]) && unit_compatibility(units_from_xml[i], units_from_ws[i])\n if source_val_match_with_output_val\n puts \"Object value from XML: \\\"#{values_from_xml[i]} #{units_from_xml[i]}\\\" is equivalent to converted value sent over websocket: \\\"#{values_from_ws[i]} #{units_from_ws[i]}\\\"\"#.green #-- cucumber html reports doesn't like/honor the colorise gem's colors\n else\n puts \"Object value in XML: \\\"#{values_from_xml[i]} #{units_from_xml[i]}\\\" is not equivalent to the value sent over websocket: \\\"#{values_from_ws[i]} #{units_from_ws[i]}\\\"\"#.red\n val_mismatch_count +=1\n end\n else\n puts \"Unit are either not valid or not comptible for conversion.\"\n raise TestCaseFailed, 'Invalid or non-compatible units'\n end\n end\n if val_mismatch_count > 0\n raise TestCaseFailed, 'Values of %{count}/%{total} objects did not match exactly with their corresponding values obtained from websocket stream.' % {count: val_mismatch_count, total: values_from_xml.size}\n end\n else\n puts \"Number of objects/units sent by sims does not match with number of objects/units obtained from websocket stream.\"\n raise TestCaseFailed, 'Object/unit count mismatch bewteen sims and websocket stream.'\n end\nend",
"def compare_xml current_dir, expect_dir\n case_name = get_case_name() \n puts '[ReportCaseBase] compare_xml ' << case_name\n\n expect_file_name = File.join(expect_dir, case_name.gsub(/[\\\\\\/:\\*\\?<>|\\\"]/, '') + '_(expect).xml')\n raise \"%s isn't exist.\" % expect_file_name if !File.exist?(expect_file_name)\n expect_xml = ParseFile.parser_xml_by_filename(expect_file_name)\n \n current_file_name = File.join(current_dir, case_name.gsub(/[\\\\\\/:\\*\\?<>|\\\"]/, '') + '.xml')\n raise \"%s isn't exist.\" % current_file_name if !File.exist?(current_file_name)\n current_xml = ParseFile.parser_xml_by_filename(current_file_name)\n \n result = true\n expect_xml.each_key do |flow_type|\n expect = expect_xml[flow_type]\n current = current_xml[flow_type]\n result &= compare_xml_method(current, expect)\n end\n result \n end",
"def to_xml\n find_correct_build.to_xml\n end",
"def sameNodes?(node1, node2, truthArray=[])\n\tif node1.nil? || node2.nil?\n\t\treturn false\n\tend\n\tif node1.name != node2.name\n\t\treturn false\n\tend\n if node1.text != node2.text\n return false\n end\n\tnode1Attrs = node1.attributes\n\tnode2Attrs = node2.attributes\n\tnode1Kids = node1.children\n\tnode2Kids = node2.children\n\tnode1Kids.zip(node2Kids).each do |pair|\n\t\ttruthArray << sameNodes?(pair[0],pair[1])\n\tend\n\t# if every value in the array is true, then the nodes are equal\n\treturn truthArray.all?\nend",
"def test_get_xml_for\n order_1 = orders(:santa_next_christmas_order)\n\n # Order with a blank shipping type, just to cover a comparison in the method.\n order_2 = orders(:an_order_ordered_paid_shipped)\n order_2.order_shipping_type = nil\n \n # Test the XML.\n require 'rexml/document'\n \n xml = REXML::Document.new(Order.get_xml_for([order_1, order_2]))\n assert xml.root.name, \"orders\"\n\n # TODO: For some elements the name don't correspond with the content.\n # This can be tested a little more.\n end",
"def test_in_different_access\n doc = Document.new <<-EOL\n <?xml version='1.0' encoding='ISO-8859-1'?>\n <a a=\"\\xFF\">\\xFF</a>\n EOL\n expect = \"\\303\\277\"\n expect.force_encoding(::Encoding::UTF_8)\n assert_equal( expect, doc.elements['a'].attributes['a'] )\n assert_equal( expect, doc.elements['a'].text )\n end",
"def equality\r\n node = relational()\r\n\r\n loop do\r\n if consume(\"==\")\r\n node = new_binary(ND_EQ, node, relational())\r\n elsif consume(\"!=\")\r\n node = new_binary(ND_NE, node, relational())\r\n else\r\n return node\r\n end\r\n end\r\nend",
"def equivalent(c)\n self.token == c.token\n self.right == c.right\n end",
"def compare(node, node2)\n\n hxlist, hxlist2 = hashedxml(node), hashedxml(node2) \n \n # elements which may have been modified are also \n # added to the added_indexes list \n added_or_changed_indexes = added(hxlist, hxlist2)\n added_indexes, updated_indexes = @fuzzy_match ? \\\n fuzzy_match(added_or_changed_indexes, node, node2) : \\\n [added_or_changed_indexes, []]\n added_indexes.each do |i|\n \n attributes = node2.elements[i+1].attributes\n attributes[:created] ||= Time.now.to_s\n \n node2.elements[i+1].traverse do |e|\n\n e.attributes[:created] ||= Time.now.to_s\n\n end\n end\n\n deleted_indexes = deleted(hxlist, hxlist2)\n \n unchanged_indexes = unchanged(hxlist, hxlist2)\n\n unchanged_indexes.each do |i, i2| \n\n compare(node.elements[i+1], node2.elements[i2+1]) if node\\\n .elements[i+1].has_elements?\n attributes2 = node2.elements[i2+1].attributes\n \n if attributes2[:created].nil? then\n attributes = node.elements[i+1].attributes\n attributes2[:created] = attributes[:created] if attributes[:created]\n end\n end\n\n end",
"def xml_tag\n :comparison\n end",
"def == other_node\n eql? other_node\n end",
"def _to_xml(xml)\n end",
"def topologically_equivalent?(other)\n our_nodes = nodes.to_a\n other_nodes = other.nodes.to_a\n return false if our_nodes.size != other_nodes.size\n our_edges = edges.to_a\n other_edges = other.edges.to_a\n return false if our_edges.size != other_edges.size\n\n our_node_numbers = Hash[\n our_nodes.each_with_index.map{|n, i| [n, i]}\n ]\n\n # Since there are no permutations,\n # we have to special case graphs with 0 or 1 node:\n case our_nodes.size\n when 0\n true\n when 1\n true # since we already know they have the same number of edges\n else\n # Now we have to try all permutations of the nodes:\n 0.upto(nodes.size - 1).to_a.permutation.each do |phi|\n equivalent = true\n catch :answered do\n our_nodes.each_with_index do |u, i|\n phi_u = other_nodes[phi[i]]\n u.feeds.each do |v|\n phi_v = other_nodes[phi[our_node_numbers[v]]]\n if not phi_u.feeds.include?(phi_v)\n equivalent = false\n throw :answered\n end\n end\n end\n end\n return true if equivalent\n end\n false\n end\n end",
"def xml?; end",
"def xml?; end",
"def eql?(other)\n return false if (other.nil? or self.class != other.class)\n return false unless super(other)\n return false unless self.attributes == other.attributes\n return false unless self.nodes == other.nodes\n true\n end",
"def diff(nocolor: false)\n xml = Nokogiri::XML(File.open(@path), &:noblanks)\n ideal = xml.to_xml(indent: 2)\n now = File.read(@path)\n differ(ideal, now, nocolor: nocolor)\n end",
"def merge(xml1, file2)\n xml2 = File.read(file2)\n return xml2 unless xml1\n\n merge_xml(xml1, xml2)\n end",
"def same_as\n returnLinks = []\n links = query_root_node(\"owl:sameAs/@rdf:resource\", @@NAMESPACES)\n links.each do |link|\n returnLinks << link.to_s\n end\n returnLinks\n end",
"def to_xml(xml)\n xml.Override(self.instance_values)\n end",
"def equivalentValues(other) # JS == operator\n other.is_a?(Object) && unwrap.eql?(other.unwrap)\n end",
"def test2b\n seq2b = deepcopy(SEQ2)\n res2b = deepcopy(RES2)\n seq2b[1][2] << ['xml:space','default']\n res2b['attributes'] << ['137','xml:space','default']\n check(seq2b, res2b, [1,3,7], {}, false)\n check(seq2b, res2b, [1,3,7], {}, true)\n end",
"def hashedxml(node)\n \n node.elements.map do |element|\n \n attributes = element.attributes.clone\n \n # Although attribute last_modified isn't used by rexle-diff it is \n # created by Dynarex whenever a record is created or updated. \n # This would of course cause the record to be flagged as changed even \n # when the element value itself hashn't changed.\n #\n %i(created last_modified).each {|x| attributes.delete x}\n x = element.elements.length > 0 ? '' : 0\n [element.name, attributes, element.text.to_s.strip, x].hash\n \n end\n end",
"def eql?(other)\n return false unless super(other)\n return false unless attributes == other.attributes\n return false unless content == other.content\n\n true\n end",
"def ==(other)\n if other.is_a? XPathNodeSet or\n other.is_a? XPathBoolean or other.is_a? XPathNumber then\n other == self\n else\n to_str == other.to_str\n end\n end",
"def smart_parse_compare(xml, expected, handler = AllSax, opts = {}, handler_attr = :calls)\n parse_compare(xml, expected, handler, opts.merge(smart: true, skip: :skip_white), handler_attr)\n end",
"def ===(rel)\n if self.edge == rel.edge\n if self.node[0] == rel.node[0] and self.node[1] == rel.node[1]\n return true\n elsif self.node[0] == rel.node[1] and self.node[1] == rel.node[0]\n return true\n else\n return false\n end\n else\n return false\n end\n end",
"def eq\n @ole.EQ\n end",
"def test1\n rtext = \"\"\n parser = ZML::StreamToXML.new(rtext)\n REXML::Document.parse_stream(DOC1, parser)\n\n # The results should be byte-by-byte equal. (Actually, there might\n # be differences like attr='val' versus attr=\"val\", or ordering of\n # the attributes, but we choose our test case carefully!)\n assert_equal(DOC1, rtext)\n end",
"def compare_test_prettify(prettify)\n\tf_xml = f_answer = nil\n\tbegin\n\t suffix = prettify ? \"\\n\" : ''\n\n\t f_xml = Tempfile.new('xml_writer')\n\t f_answer = Tempfile.new('xml_writer_answer')\n\n\t w = NQXML::Writer.new(f_xml, prettify)\n\n\t f_answer.print(\"<?xml version=\\\"1.0\\\"?>#{suffix}\")\n\t w.processingInstruction('xml', 'version=\"1.0\"')\n\n\t f_answer.print(\"<tag1>#{suffix}\")\n\t w.startElement('tag1')\n\n\t f_answer.print(' ' * NQXML::Writer::INDENT_OFFSET) if prettify\n\t f_answer.print(\"<tag2 attr1=\\\"foo\\\" attr2=\\\"b&r\\\">#{suffix}\")\n\t w.startElement('tag2')\n\t w.attribute('attr1', 'foo')\n\t w.attribute('attr2', 'b&r')\n\n\t f_answer.print(\"data & <stuff>\\n\")\n\t w.write(\"data & <stuff>\\n\")\n\n\t f_answer.print(' '* NQXML::Writer::INDENT_OFFSET) if prettify\n\t f_answer.print(\"</tag2>#{suffix}\")\n\t w.endElement('tag2')\n\n\t f_answer.print(' ' * NQXML::Writer::INDENT_OFFSET) if prettify\n\t f_answer.print(\"<empty-tag/>#{suffix}\")\n\t w.startElement('empty-tag')\n\t w.endElement('empty-tag')\n\n\t f_answer.print(\"</tag1>#{suffix}\")\n\t w.endElement('tag1')\n\n\t f_answer.close()\n\t f_xml.close()\n\n\t assert(File.compare(f_answer.path(), f_xml.path()))\n\trescue NQXML::WriterError\n\t assert_fail($!)\n\tensure\n\t f_answer.close(true)\n\t f_xml.close(true)\n\tend\n end",
"def pairup(other_node)\n if other_node.clusters.length > 1 then\n puts \"Can't pair #{other_node.fn_prefix} has other clusters\"\n return false\n end\n \n # match nics\n if self.node_type.is_virtual? and other_node.node_type.is_virtual? then\n unless self.nics == other_node.nics \n other_node.nics.clear \n self.nics.each {|nic|\n other_node.nics << nic\n }\n end\n end\n # match cluster\n # TODO: loop over other_node.clusters and remove all non-mgmt clusters\n self.clusters.each {|c|\n next if c.cluster_name =~ /mgmt/\n c.add_node(other_node,c.ip_address)\n }\n # match OS\n other_node.os_version_id = self.os_version_id\n # match OS\n other_node.model_id = self.model_id \n other_node.save\n end",
"def equality\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 54 )\n return_value = EqualityReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal244 = nil\n string_literal245 = nil\n string_literal246 = nil\n string_literal247 = nil\n relation243 = nil\n relation248 = nil\n\n tree_for_string_literal244 = nil\n tree_for_string_literal245 = nil\n tree_for_string_literal246 = nil\n tree_for_string_literal247 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 601:5: relation ( ( '==' | '!=' | '===' | '!==' ) relation )*\n @state.following.push( TOKENS_FOLLOWING_relation_IN_equality_3968 )\n relation243 = relation\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, relation243.tree )\n end\n # at line 602:5: ( ( '==' | '!=' | '===' | '!==' ) relation )*\n while true # decision 58\n alt_58 = 2\n look_58_0 = @input.peek( 1 )\n\n if ( look_58_0 == NEQ || look_58_0 == NEQQ || look_58_0 == EQ || look_58_0 == EQQ )\n alt_58 = 1\n\n end\n case alt_58\n when 1\n # at line 603:7: ( '==' | '!=' | '===' | '!==' ) relation\n # at line 603:7: ( '==' | '!=' | '===' | '!==' )\n alt_57 = 4\n case look_57 = @input.peek( 1 )\n when EQ then alt_57 = 1\n when NEQ then alt_57 = 2\n when EQQ then alt_57 = 3\n when NEQQ then alt_57 = 4\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 57, 0 )\n end\n case alt_57\n when 1\n # at line 603:9: '=='\n string_literal244 = match( EQ, TOKENS_FOLLOWING_EQ_IN_equality_3986 )\n if @state.backtracking == 0\n\n tree_for_string_literal244 = @adaptor.create_with_payload( string_literal244 )\n root_0 = @adaptor.become_root( tree_for_string_literal244, root_0 )\n\n end\n\n when 2\n # at line 603:17: '!='\n string_literal245 = match( NEQ, TOKENS_FOLLOWING_NEQ_IN_equality_3991 )\n if @state.backtracking == 0\n\n tree_for_string_literal245 = @adaptor.create_with_payload( string_literal245 )\n root_0 = @adaptor.become_root( tree_for_string_literal245, root_0 )\n\n end\n\n when 3\n # at line 603:25: '==='\n string_literal246 = match( EQQ, TOKENS_FOLLOWING_EQQ_IN_equality_3996 )\n if @state.backtracking == 0\n\n tree_for_string_literal246 = @adaptor.create_with_payload( string_literal246 )\n root_0 = @adaptor.become_root( tree_for_string_literal246, root_0 )\n\n end\n\n when 4\n # at line 603:34: '!=='\n string_literal247 = match( NEQQ, TOKENS_FOLLOWING_NEQQ_IN_equality_4001 )\n if @state.backtracking == 0\n\n tree_for_string_literal247 = @adaptor.create_with_payload( string_literal247 )\n root_0 = @adaptor.become_root( tree_for_string_literal247, root_0 )\n\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_relation_IN_equality_4013 )\n relation248 = relation\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, relation248.tree )\n end\n\n else\n break # out of loop for decision 58\n end\n end # loop for decision 58\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 54 )\n\n end\n \n return return_value\n end",
"def apply(left, right)\n RDF::Literal(left.to_s == right.to_s)\n end",
"def instance_to_xml\r\n ATTRIBUTES_MAP.each do |name, hash|\r\n elem = @xml.root.elements[hash[\"element\"]]\r\n elem = @xml.root.elements.add(hash[\"element\"]) if elem.nil?\r\n val = self.send(name)\r\n val = self.send(hash[\"to_xml\"], val) if hash.has_key?(\"to_xml\")\r\n if hash.has_key?(\"attribute\")\r\n elem.attributes[hash[\"attribute\"]] = val\r\n else\r\n elem.text = val\r\n end\r\n end\r\n end",
"def documents_equal?(a, b)\n normalize_document(a) == normalize_document(b)\n end",
"def setup\n xml_results = <<BEGIN\n <search:response total=\"2\" start=\"1\" page-length=\"10\" xmlns:search=\"http://marklogic.com/appservices/search\">\n <search:result index=\"1\" uri=\"/documents/discoverBook.xml\" path=\"fn:doc('/documents/discoverBook.xml')\" score=\"243\" confidence=\"0.97047\" fitness=\"1\">\n <search:snippet>\n <search:match path=\"fn:doc('/documents/discoverBook.xml')/*:book/*:bookinfo/*:title\">Discoverers <search:highlight>and</search:highlight> Explorers</search:match>\n <search:match path=\"fn:doc('/documents/discoverBook.xml')/*:book/*:chapter[1]/*:chapterinfo/*:biblioentry/*:title\">Discoverers <search:highlight>and</search:highlight> Explorers</search:match>\n </search:snippet>\n </search:result>\n <search:result index=\"2\" uri=\"/documents/a_and_c.xml\" path=\"fn:doc('/documents/a_and_c.xml')\" score=\"234\" confidence=\"0.952329\" fitness=\"1\">\n <search:snippet>\n <search:match path=\"fn:doc('/documents/a_and_c.xml')/PLAY/PERSONAE/PERSONA[10]\">Officers, Soldiers, Messengers, <search:highlight>and</search:highlight> other Attendants.</search:match>\n </search:snippet>\n </search:result>\n <search:qtext>and</search:qtext>\n <search:metrics>\n <search:query-resolution-time>PT0.009197S</search:query-resolution-time>\n <search:facet-resolution-time>PT0.000083S</search:facet-resolution-time>\n <search:snippet-resolution-time>PT0.019534S</search:snippet-resolution-time>\n <search:total-time>PT0.029033S</search:total-time>\n </search:metrics>\n</search:response>\nBEGIN\n\n xml_results_noh = <<BEGIN\n <search:response total=\"2\" start=\"1\" page-length=\"10\" xmlns:search=\"http://marklogic.com/appservices/search\">\n <search:result index=\"1\" uri=\"/documents/discoverBook.xml\" path=\"fn:doc('/documents/discoverBook.xml')\" score=\"243\" confidence=\"0.97047\" fitness=\"1\">\n <search:snippet>\n <search:match path=\"fn:doc('/documents/discoverBook.xml')/*:book/*:bookinfo/*:title\">Discoverers and Explorers</search:match>\n <search:match path=\"fn:doc('/documents/discoverBook.xml')/*:book/*:chapter[1]/*:chapterinfo/*:biblioentry/*:title\">Discoverers and Explorers</search:match>\n </search:snippet>\n </search:result>\n <search:result index=\"2\" uri=\"/documents/a_and_c.xml\" path=\"fn:doc('/documents/a_and_c.xml')\" score=\"234\" confidence=\"0.952329\" fitness=\"1\">\n <search:snippet>\n <search:match path=\"fn:doc('/documents/a_and_c.xml')/PLAY/PERSONAE/PERSONA[10]\">Officers, Soldiers, Messengers, and other Attendants.</search:match>\n </search:snippet>\n </search:result>\n <search:qtext>and</search:qtext>\n <search:metrics>\n <search:query-resolution-time>PT0.009197S</search:query-resolution-time>\n <search:facet-resolution-time>PT0.000083S</search:facet-resolution-time>\n <search:snippet-resolution-time>PT0.019534S</search:snippet-resolution-time>\n <search:total-time>PT0.029033S</search:total-time>\n </search:metrics>\n</search:response>\nBEGIN\n\n results_with_facets = <<-BEGIN\n<search:response total=\"21973\" start=\"1\" page-length=\"10\" xmlns:search=\"http://marklogic.com/appservices/search\">\n <search:result index=\"9\" uri=\"/Users/clarkrichey/Downloads/wits/wits21402.xml\" path=\"fn:doc("/Users/clarkrichey/Downloads/wits/wits21402.xml")\" score=\"196\" confidence=\"0.338805\" fitness=\"0.890659\">\n <search:snippet>\n <search:match path=\"fn:doc("/Users/clarkrichey/Downloads/wits/wits21402.xml")/*:Incident/*:Subject\">1 newspaper editor injured in letter <search:highlight>bomb</search:highlight> attack by Informal Anarchist Federation in Turin, Piemonte, Italy</search:match>\n <search:match path=\"fn:doc("/Users/clarkrichey/Downloads/wits/wits21402.xml")/*:Incident/*:EventTypeList\">\n<search:highlight>Bombing</search:highlight>\n</search:match>\n <search:match path=\"fn:doc("/Users/clarkrichey/Downloads/wits/wits21402.xml")/*:Incident/*:WeaponTypeList/*:WeaponType\">Letter <search:highlight>Bomb</search:highlight></search:match>\n </search:snippet>\n </search:result>\n <search:result index=\"10\" uri=\"/Users/clarkrichey/Downloads/wits/wits23118.xml\" path=\"fn:doc("/Users/clarkrichey/Downloads/wits/wits23118.xml")\" score=\"196\" confidence=\"0.338805\" fitness=\"0.890659\">\n <search:snippet>\n <search:match path=\"fn:doc("/Users/clarkrichey/Downloads/wits/wits23118.xml")/*:Incident/*:Subject\">1 government employee killed in <search:highlight>bombing</search:highlight> in Ghazni, Afghanistan</search:match>\n <search:match path=\"fn:doc("/Users/clarkrichey/Downloads/wits/wits23118.xml")/*:Incident/*:EventTypeList\">\n<search:highlight>Bombing</search:highlight>\n</search:match>\n </search:snippet>\n </search:result>\n <search:facet name=\"Region\">\n <search:facet-value name=\"Africa\" count=\"622\">Africa</search:facet-value>\n <search:facet-value name=\"Central and South America\" count=\"1012\">Central and South America</search:facet-value>\n <search:facet-value name=\"East Asia-Pacific\" count=\"1198\">East Asia-Pacific</search:facet-value>\n <search:facet-value name=\"Eurasia\" count=\"761\">Eurasia</search:facet-value>\n <search:facet-value name=\"Europe\" count=\"1057\">Europe</search:facet-value>\n <search:facet-value name=\"Middle East and Persian Gulf\" count=\"10374\">Middle East and Persian Gulf</search:facet-value>\n <search:facet-value name=\"North America and Caribbean\" count=\"16\">North America and Caribbean</search:facet-value>\n <search:facet-value name=\"South Asia\" count=\"6933\">South Asia</search:facet-value>\n </search:facet>\n <search:facet name=\"Country\">\n <search:facet-value name=\"England\" count=\"200\">England</search:facet-value>\n <search:facet-value name=\"Ireland\" count=\"422\">Ireland</search:facet-value>\n <search:facet-value name=\"Brazil\" count=\"10\">Brazil</search:facet-value>\n </search:facet>\n <search:qtext>bomb</search:qtext>\n <search:metrics>\n <search:query-resolution-time>PT0.420016S</search:query-resolution-time>\n <search:facet-resolution-time>PT0.002873S</search:facet-resolution-time>\n <search:snippet-resolution-time>PT0.039998S</search:snippet-resolution-time>\n <search:total-time>PT0.463759S</search:total-time>\n </search:metrics>\n</search:response>\n BEGIN\n @search_results = ActiveDocument::SearchResults.new(xml_results)\n @search_results_noh = ActiveDocument::SearchResults.new(xml_results_noh)\n @faceted_results = ActiveDocument::SearchResults.new(results_with_facets)\n end",
"def to_xml(xml)\n #build it for now, break it down later!\n xml[:xdr].twoCellAnchor {\n xml.from {\n from.to_xml(xml)\n }\n xml.to {\n to.to_xml(xml)\n }\n @object.to_xml(xml)\n xml.clientData\n }\n end",
"def test_encoded_in_change_out\n doc = Document.new( @encoded )\n doc.xml_decl.encoding = \"UTF-8\"\n assert_equal(\"UTF-8\", doc.encoding)\n REXML::Formatters::Default.new.write( doc.root, out=\"\" )\n out.force_encoding(::Encoding::ASCII_8BIT)\n assert_equal( @not_encoded.b, out )\n char = XPath.first( doc, \"/a/b/text()\" ).to_s\n char.force_encoding(::Encoding::ASCII_8BIT)\n assert_equal( \"ĉ\".b, char )\n end",
"def assert_nodes_are_equal(a, b)\n assert_equal a.id, b.id, \"node IDs\"\n assert_equal a.latitude, b.latitude, \"latitude on node #{a.id}\"\n assert_equal a.longitude, b.longitude, \"longitude on node #{a.id}\"\n assert_equal a.changeset_id, b.changeset_id, \"changeset ID on node #{a.id}\"\n assert_equal a.visible, b.visible, \"visible on node #{a.id}\"\n assert_equal a.version, b.version, \"version on node #{a.id}\"\n assert_equal a.tags, b.tags, \"tags on node #{a.id}\"\n end",
"def equal_by_trans?(g1, g2)\n check_pre((\n (graph_obj?(g1)) and\n (graph_obj?(g2))\n ))\n\n # pick two points\n # sub p1 from p2\n # translate p2 by diff\n # check equal_by_tree\n\n if not equal_by_dim?(g1, g2)\n return false\n end\n\n p1 = shape_lowest_left_point(g1)\n p2 = shape_lowest_left_point(g2)\n\n tp1 = p1 - p2\n tg1 = g2.translate(tp1)\n\n return equal_by_tree?(g1, tg1)\nend",
"def assert_nodes_are_equal(a, b)\n assert_equal a.id, b.id, \"node IDs\"\n assert_equal a.latitude, b.latitude, \"latitude on node #{a.id}\"\n assert_equal a.longitude, b.longitude, \"longitude on node #{a.id}\"\n assert_equal a.changeset_id, b.changeset_id, \"changeset ID on node #{a.id}\"\n assert_equal a.visible, b.visible, \"visible on node #{a.id}\"\n assert_equal a.version, b.version, \"version on node #{a.id}\"\n assert_equal a.tags, b.tags, \"tags on node #{a.id}\"\n end",
"def == other_node\n @properties == other_node.properties\n end",
"def test_in_different_out\n doc = Document.new( @not_encoded )\n doc.write( Output.new( out=\"\", \"ISO-8859-3\" ) )\n out.force_encoding(::Encoding::ASCII_8BIT)\n assert_equal( \"<?xml version='1.0'?>#{@encoded_root}\".b, out )\n end",
"def test_to_xml_dups_options\n options = {:skip_instruct => true}\n {}.to_xml(options)\n # :builder, etc, shouldn't be added to options\n assert_equal({:skip_instruct => true}, options)\n end",
"def equal_by_trans?(graph_obj1, graph_obj2)\n check_pre((graph_obj?(graph_obj1) and graph_obj?(graph_obj2)))\n bounds_obj1 = bounds(graph_obj1)\n bounds_obj2 = bounds(graph_obj2)\n if (not (bounds_obj1.size == bounds_obj2.size)) #or (not equal_by_dim?(graph_obj1, graph_obj2))\n false\n elsif one_dim?(graph_obj1) and one_dim?(graph_obj2)\n translate(graph_obj1, -(bounds_obj1.first - bounds_obj2.first)) == graph_obj2\n #equal_by_tree?(translate(graph_obj1, -(bounds_obj1.first - bounds_obj2.first)), graph_obj2)\n elsif two_dim?(graph_obj1) and two_dim?(graph_obj2)\n translate(graph_obj1, Point2d[-(bounds_obj1.x_range.first - bounds_obj2.x_range.first),\n -(bounds_obj1.y_range.first - bounds_obj2.y_range.first)]) == graph_obj2\n #equal_by_tree?(translate(graph_obj1, Point2d[-(bounds_obj1.x_range.first - bounds_obj2.x_range.first), \n #-(bounds(graph_obj1).y_range.first - bounds(graph_obj2).y_range.first)]), graph_obj2)\n else false\n end\nend",
"def eql?(other) self.class == other.class and target==other.target and source==other.source; end",
"def eql?(other) self.class == other.class and target==other.target and source==other.source; end",
"def equivalentValues(other) # JS == operator\n return false unless other.is_a?(Function)\n return true if unwrap == other.unwrap\n # Method.== does check if their bind to the same object\n # JS == means they might be bind to different objects :\n unwrap.to_s == other.unwrap.to_s # \"#<Method: Foo#bar>\"\n end",
"def assert_equivalent(exp, act, msg=nil)\n EqualityAssay.assert!(act, exp, :message=>msg, :backtrace=>caller)\n end",
"def test_entities\n\tsourceWithoutPreproc = '<!DOCTYPE x [\n<!ENTITY example \"<p>An ampersand (&#38;) may be escaped numerically (&#38;#38;) or with a general entity (&amp;).</p>\" >\n]>'\n\tbody = \"\\n<x>&example;</x>\"\n\n\ttoker = NQXML::Tokenizer.new(\"<?xml version=\\\"1.0\\\"?>\\n\" +\n\t\t\t\t sourceWithoutPreproc + body)\n\n\tnewline = NQXML::Text.new(\"\\n\", \"\\n\")\n\tliteral = '<p>An ampersand (&) may be escaped numerically' +\n\t ' (&#38;) or with a general entity (&amp;).</p>'\n\tsrc = '<!ENTITY example \"<p>An ampersand (&#38;) may be escaped' +\n\t ' numerically (&#38;#38;) or with a general entity' +\n\t ' (&amp;).</p>\" >'\n\texampleEntity = NQXML::GeneralEntityTag.new('example', literal, nil,\n\t\t\t\t\t\t nil, src)\n\tdoctype = NQXML::Doctype.new('x', nil, [exampleEntity],\n\t\t\t\t sourceWithoutPreproc)\n\n\texpected = [\n\t NQXML::XMLDecl.new('xml', {'version'=>'1.0'},\n\t\t\t '<?xml version=\"1.0\"?>'),\n\t newline,\n\t doctype,\n\t newline,\n\t NQXML::Tag.new('x', {}, false, '<x>'),\n\t NQXML::Tag.new('p', {}, false, '<p>'),\n\t NQXML::Text.new('An ampersand (&) may be escaped numerically' +\n\t\t\t ' (&) or with a general entity (&).',\n\t\t\t 'An ampersand (&) may be escaped numerically' +\n\t\t\t ' (&38;) or with a general entity' +\n\t\t\t ' (&amp;).'),\n\t NQXML::Tag.new('p', nil, true, '</p>'),\n\t NQXML::Tag.new('x', nil, true, '</x>'),\n\t newline\n\t]\n\n\ti = 0\n\ttoker.each { | entity |\n\t assert_equal(expected[i], entity)\n\t if entity.instance_of?(NQXML::Doctype)\n\t\tassert_equal(1, entity.entities.length)\n\t\tassert_equal(exampleEntity, entity.entities[0])\n\t end\n\t i += 1\n\t}\n end",
"def test_mismatch\r\n ax = Ziya::Components::ChartPref.new\r\n ax.point_shape = \"circle\"\r\n ax.fill_shape = true\r\n ax.reverse = true\r\n ax.type = \"body\"\r\n ax.line_thickness = 10\r\n ax.bull_color = \"ff0000\"\r\n ax.bear_color = \"00ff00\"\r\n ax.point_size = 5\r\n ax.point_shape = \"circle\"\r\n ax.trend_thickness = 10\r\n ax.trend_alpha = 50\r\n ax.line_alpha = 100\r\n ax.rotation_x = 90\r\n ax.rotation_y = -90\r\n ax.grid = \"linear\"\r\n \r\n xml = Builder::XmlMarkup.new\r\n ax.flatten( xml )\r\n result = xml.to_s\r\n \r\n begin\r\n check_results( result.gsub( /<to_s\\/>/, ''), \r\n File.join( File.expand_path( \".\" ), \"/test/xmls/chart_pref.xml\" ) )\r\n rescue => boom\r\n assert_equal \"Attribute mismatch for key 'point_shape'.\\n<\\\"square\\\"> expected but was\\n<\\\"circle\\\">.\", boom.to_s\r\n return\r\n end\r\n fail \"Expecting exception\"\r\n end",
"def compare_to_rsrc_xml(io, sourceFooToBletch)\n\twrittenLines = io.read()\n\n\t# What we expect is slightly different than the original XML\n\t# because entities have been replaced and the output tags and\n\t# attribute values have been normalized.\n\tnormalizedXml = @rsrc.xml.dup()\n\tnormalizedXml.gsub!(/&foo;/, 'bletch')\n\tnormalizedXml.gsub!('/>', '></inner:tag>')\n\tnormalizedXml.gsub!(\"tabs\\tto\\tspaces\", \"tabs to spaces\")\n\n\t# The writer's output won't have the same whitespace.\n\tnormalizedXml.gsub!(/^\\s+\\<(!ENTITY|!ELEMENT|!ATTLIST|!NOTATION|\\?|!--)/,\n\t\t\t '<\\1')\n\t# Get rid of one newline that the writer doesn't output.\n\tnormalizedXml.gsub!(/(<!DOCTYPE(.+?))[\\n]]>/m, '\\1]>')\n\n\tassert_equal(normalizedXml, writtenLines)\n end",
"def eql?(other)\n @element_list.each do |element|\n return false unless other.element_list.include? element\n end\n other.element_list.each do |element|\n return false unless @element_list.include? element\n end\n true\n end",
"def eql?(other)\n\t if other.is_a?(Array)\n\t\[email protected]? other\n\t elsif other.is_a?(PointIso)\n\t\tvalue = other.value\n\t\[email protected]? {|e| e.eql? value }\n\t elsif other.is_a?(PointOne)\n\t\[email protected]? {|e| e.eql? 1 }\n\t elsif other.is_a?(PointZero)\n\t\[email protected]? {|e| e.eql? 0 }\n\t else\n\t\tsuper other\n\t end\n\tend",
"def not_equal(left, right)\n raise \"Not applicable to sphinx.\"\n end",
"def test_entity_insertions\n assert_equal(\"&\", REXML::Text.new(\"&\", false, nil, true).to_s)\n #assert_equal(\"&\", REXML::Text.new(\"&\", false, false).to_s)\n end",
"def merge_xml(string1, string2)\n xml1 = Nokogiri::XML(string1)\n xml2 = Nokogiri::XML(string2)\n\n # Only supports one package\n package1 = xml1.xpath('//package').first\n package2 = xml2.xpath('//package').first\n merged_package = merge_packages(package1, package2)\n\n xml1.css('coverage packages').first.content = ''\n merged_package.parent = xml1.css('coverage packages').first\n xml1.to_s\n end",
"def xml!; @xml = true; end",
"def eql? other_node\n self.class == other_node.class and @node.id == other_node.node.id\n end",
"def to_xml\n output=\"\"\n self.to_rexml.write output\n end",
"def ==(other)\n Attribute === other && \n !(Expression === other) &&\n relation == other.relation && \n name == other.name && \n self.alias == other.alias && \n original_relation == other.original_relation\n end",
"def write_xml\n true\n end",
"def build_xml(builder)\n super(builder)\n builder.tag!(\"FromEntity\", \"xsi:type\" => self.source.class.to_s) {|b| source.build_xml(b)} if source\n builder.tag!(\"ToEntity\", \"xsi:type\" => self.target.class.to_s) {|b| target.build_xml(b)} if target\n successors.each do |s|\n builder.Successor {|b| s.build_xml(b)} if s\n end\n builder.Order order if order\n end",
"def node_and_parent_same_text?(node)\n node.parent.text.strip == node.text.strip\n end",
"def ==(left, right)\n raise \"Not applicable to sphinx.\"\n end",
"def ==(other_node)\n @properties == other_node.properties\n end",
"def ==(other)\n other.is_a? EdgeWrapper and\n element_id == other.element_id and\n graph == other.graph\n end",
"def ==(x)\n return false unless x.kind_of?(Element)\n return true if x.object_id == object_id\n return false unless x.tagname_symbol == @tagname\n return false unless x.attrs.size == @attrs.size\n @attrs.each do |a|\n return false unless x[a.key] == a.value\n end\n return false unless x.body == @body\n true\n end",
"def deconstruct_and_write_xml(old_filename, new_filename)\r\n\r\n\t\t\tif File.exists?(old_filename)\r\n\t\t\t\tenc_file = ''\r\n\t\t\t\tenc_file = IO.read(old_filename).to_s\r\n\t\t\t\tcontent = get_xml enc_file\r\n\t\t\t\tFile.open(new_filename, \"w\") { |f| f.write(content) }\r\n\t\t\telse\r\n\t\t\t\tputs \"File does not exist!\"\r\n\t\t\t\treturn nil\r\n\t\t\tend\r\n\r\n\t\tend",
"def refute_equivalent(criterion, act, msg=nil)\n EqualityAssay.refute!(act, criterion, :message=>msg, :backtrace=>caller)\n end",
"def ==(other)\n return false unless other.is_a?(QName)\n s9_qname.equals(other.to_java)\n end",
"def xml_nodes_match_attrs(xml_nodes, attrs, mismatches = [])\n attrs.each_with_index.each { |attr_set, idx|\n xn = xml_nodes[idx]\n attr_set.each { |(attr_key, attr_val)|\n # Either call method, or hash key, or recurse on children\n # p.name vs. p[:name]\n if :children == attr_key\n # recurse over children\n xml_nodes_match_attrs(xn.children, attr_val, mismatches)\n else\n # compare attrs\n xn_val = xn.methods.include?(attr_key) ? xn.send(attr_key) : xn[attr_key]\n if xn_val != attr_val\n mismatches << { node: xn.name_and_class_path, attr: \"#{ attr_key }: expected #{ attr_val.inspect }, got #{ xn_val.inspect }\" }\n end\n end\n }\n }\n mismatches\n end",
"def test_operation_from_xml()\n extracted = Nokogiri::XML(\n @batch_job_utils.extract_soap_operations(VALID_SERVICE_XML)\n )\n expected = Nokogiri::XML(EXPECTED_OPERATION)\n assert_equal(clean_xml(expected.to_s), clean_xml(extracted.to_s))\n end",
"def to_xml()\n XmlSimple.xml_out( { :address => self.to_hash() }, { :KeepRoot=>true, :NoAttr=>true } )\n end",
"def compare_html(file1, file2)\n content1 = File.exists?(file1) ? File.open(file1) { |f| f.read } : nil\n content2 = File.exists?(file2) ? File.open(file2) { |f| f.read } : nil\n content1 = content1.empty? ? nil : content1.encode(content1.encoding, :universal_newline => true) unless content1.nil?\n content2 = content2.empty? ? nil : content2.encode(content2.encoding, :universal_newline => true) unless content2.nil?\n content1 == content2\n end",
"def amended?\n @doc.at_xpath('/a:akomaNtoso/a:act', a: NS)['contains'] != 'originalVersion'\n end",
"def xml_to_instance\r\n ATTRIBUTES_MAP.each do |name, hash| \r\n elem = @xml.root.elements[hash[\"element\"]]\r\n unless elem.nil?\r\n val = (hash.has_key?(\"attribute\") ? elem.attributes[hash[\"attribute\"]] : elem.text)\r\n val = self.send(hash[\"from_xml\"], val) if hash.has_key?(\"from_xml\")\r\n self.send(name+\"=\", val)\r\n end\r\n end\r\n self.status = :old\r\n\r\n @xml.root.elements.each(\"link\") do |link|\r\n @feed = link.attributes[\"href\"] if link.attributes[\"rel\"] == \"edit\"\r\n end\r\n end",
"def ==(other_element)\n if other_element.type == type && other_element.content == content\n return true\n end\n return false\n end",
"def to_xml(xml)\n xml.relation(attributes) do\n members.each do |member|\n member.to_xml(xml)\n end\n tags.to_xml(xml)\n end\n end"
] | [
"0.7360179",
"0.70576596",
"0.6480727",
"0.6468421",
"0.64491636",
"0.6258976",
"0.62296516",
"0.598884",
"0.5913244",
"0.5804363",
"0.57848096",
"0.5780509",
"0.5732317",
"0.5587081",
"0.5512715",
"0.54148257",
"0.5400435",
"0.53641295",
"0.5327247",
"0.5314293",
"0.52894455",
"0.5285253",
"0.5245245",
"0.520538",
"0.5200817",
"0.5169783",
"0.51177126",
"0.50909305",
"0.5069652",
"0.5036797",
"0.5019103",
"0.5001731",
"0.4968661",
"0.4968247",
"0.49514702",
"0.49514702",
"0.49333093",
"0.4928707",
"0.49219537",
"0.4914746",
"0.49133345",
"0.4909043",
"0.49045593",
"0.4897577",
"0.48818228",
"0.48773554",
"0.48663074",
"0.48659334",
"0.4865027",
"0.4861105",
"0.48560652",
"0.48507762",
"0.48405913",
"0.48390588",
"0.48313245",
"0.48225158",
"0.48181888",
"0.4802907",
"0.48006585",
"0.4796109",
"0.47895074",
"0.4779747",
"0.47796524",
"0.47597557",
"0.47476",
"0.4741183",
"0.4738649",
"0.4738649",
"0.47331607",
"0.4732797",
"0.47314408",
"0.472682",
"0.47240084",
"0.47211024",
"0.47202468",
"0.47182614",
"0.4714246",
"0.47108835",
"0.47086686",
"0.47052854",
"0.4703714",
"0.47015077",
"0.46855745",
"0.46845955",
"0.46495676",
"0.46494812",
"0.46488088",
"0.46443355",
"0.46434072",
"0.4640929",
"0.46292424",
"0.46250048",
"0.4616881",
"0.46158472",
"0.46092737",
"0.46049625",
"0.46046737",
"0.4599579",
"0.459676",
"0.45960662"
] | 0.733993 | 1 |
Parse the value either as a NodeSet, as results are equivalent if it is just a node | def parse_rexml(value)
REXML::Document.new("<root>#{value}</root>").root.children
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_value(nodes); end",
"def parse_set\n @current_set = Set.new\n @current_match.add_set @current_set\n end",
"def _set_value(value)\n if value.is_a? Array\n value.map do |v|\n v.is_a?(Taverna::Baclava::Node) ? v : Node.new(v)\n end\n else\n value.to_s\n end\n end",
"def value=(value)\n self.remove_children :value\n return unless value\n Array(value).each do |val|\n self << (v = XMPPNode.new(:value))\n v.namespace = self.namespace\n v.content = val\n end\n end",
"def on_type_test_node(ast_node, context)\n nodes = XML::NodeSet.new\n\n context.each do |node|\n if node.is_a?(XML::Node) or node.is_a?(XML::Document)\n nodes << node\n end\n end\n\n return nodes\n end",
"def value=(value)\n self.remove_children :value\n if value\n self << (v = XMPPNode.new(:value))\n v.namespace = self.namespace\n v << value\n end\n end",
"def parse(value)\n value = value.to_s.split(' ')\n returns = []\n value.each do |val|\n ::Transform::Parsers.each do |parser|\n parsed = parser.parse(val)\n found = {:value => parsed, :parser => parser} if (parsed)\n end\n found = found || {:value => val, :parser => ::Transform::Parser::String}\n returns << found\n end\n return returns\n end",
"def parse_value\n if String === peek_token\n ScopedSearch::QueryLanguage::AST::LeafNode.new(next_token)\n elsif ([:in, :notin].include? current_token)\n value = parse_multiple_values()\n ScopedSearch::QueryLanguage::AST::LeafNode.new(value)\n else\n raise ScopedSearch::QueryNotSupported, \"Value expected but found #{peek_token.inspect}\"\n end\n end",
"def match_node node, value\n return if ANY_VALUE != node &&\n (Array === value || Hash === value)\n\n if node.class == value.class\n node == value\n\n elsif Regexp === node\n match = node.match value.to_s\n return false unless match\n match = match.size > 1 ? match[1..-1] : match.to_a\n [true, match]\n\n elsif Range === node\n stat = node.include? value.to_i\n match = [value.to_i] if stat\n [stat, match]\n\n elsif ANY_VALUE == node\n [true, [value]]\n\n else\n value.to_s == node.to_s\n end\n end",
"def parse_value_rexml(value, ns_strs, language)\n # Fixme\n end",
"def visit_set(binding_type)\n orig_input = self.input # save\n out_set = Set.new\n et = binding_type.element_type\n for ev in orig_input.value\n candidate = visit_list_element(ev, et)\n if out_set.include? candidate\n report_error('vapi.bindings.typeconverter.set.duplicate.element', candidate)\n end\n out_set << candidate\n end\n self.input = orig_input # restore\n self.result = out_set\n end",
"def set(oid,value)\n roid=self.oid2roid(oid)\n validate_roid(roid)\n roid_first=roid.first\n if roid.size>1\n @nodes[roid_first]=self.class.new(self.oid + [roid_first]) if not @nodes[roid_first]\n node=@nodes[roid_first]\n return node.set(oid,value)\n end\n return @nodes[roid_first]=value\n end",
"def node_value\n return @value\n end",
"def nodeValue\n @value\n end",
"def parse_value; end",
"def value\n node.value\n end",
"def from_node(node); end",
"def on_type_test_text(ast_node, context)\n nodes = XML::NodeSet.new\n\n context.each do |node|\n nodes << node if node.is_a?(XML::Text)\n end\n\n return nodes\n end",
"def normalize_value(value)\n case value\n when nil then RDF.nil\n when RDF::Value then value\n when Array then self.class.new(subject: nil, graph: graph, values: value)\n else value\n end\n end",
"def unparse_either(node); end",
"def massage(value)\n # FIXME more ugliness\n \n if value.kind_of?(Array)\n value.collect! do |node|\n if node.kind_of?(Hash)\n Dock::Node.new node\n else node\n end\n end\n elsif value.kind_of?(Hash)\n massaged_values = value.inject({}) do |hash, (next_key, next_value)|\n if next_value.kind_of?(Hash) and next_value.key?('type')\n next_value = Dock::Node.new next_value\n else\n next_value = massage next_value\n end\n \n hash[next_key] = next_value unless next_value.kind_of?(Hash) and next_value.empty?\n hash\n end\n value.clear\n value.merge! massaged_values\n end\n \n value\n end",
"def parse_value(hash)\n case hash['type']\n when 'literal'\n parse_literal(hash)\n when 'uri'\n parse_uri(hash)\n when 'bnode'\n nil\n else\n fail ArgumentError, \"Unidentifieble datatype: #{hash['type']} in #{hash}\"\n end\n end",
"def set\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 53 )\n\n\n return_value = SetReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __K_SET284__ = nil\n __LLAIZQ285__ = nil\n __K_VALUE286__ = nil\n __LLADER287__ = nil\n\n\n tree_for_K_SET284 = nil\n tree_for_LLAIZQ285 = nil\n tree_for_K_VALUE286 = nil\n tree_for_LLADER287 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 243:3: K_SET LLAIZQ K_VALUE LLADER\n __K_SET284__ = match( K_SET, TOKENS_FOLLOWING_K_SET_IN_set_1202 )\n if @state.backtracking == 0\n tree_for_K_SET284 = @adaptor.create_with_payload( __K_SET284__ )\n @adaptor.add_child( root_0, tree_for_K_SET284 )\n\n end\n\n __LLAIZQ285__ = match( LLAIZQ, TOKENS_FOLLOWING_LLAIZQ_IN_set_1204 )\n if @state.backtracking == 0\n tree_for_LLAIZQ285 = @adaptor.create_with_payload( __LLAIZQ285__ )\n @adaptor.add_child( root_0, tree_for_LLAIZQ285 )\n\n end\n\n __K_VALUE286__ = match( K_VALUE, TOKENS_FOLLOWING_K_VALUE_IN_set_1206 )\n if @state.backtracking == 0\n tree_for_K_VALUE286 = @adaptor.create_with_payload( __K_VALUE286__ )\n @adaptor.add_child( root_0, tree_for_K_VALUE286 )\n\n end\n\n __LLADER287__ = match( LLADER, TOKENS_FOLLOWING_LLADER_IN_set_1208 )\n if @state.backtracking == 0\n tree_for_LLADER287 = @adaptor.create_with_payload( __LLADER287__ )\n @adaptor.add_child( root_0, tree_for_LLADER287 )\n\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 53 )\n\n\n end\n\n return return_value\n end",
"def valid_node_value?(nodes)\n nodes == [] || array_of(nodes, String)\n end",
"def first_node_text(set)\n return set[0].respond_to?(:text) ? set[0].text : ''\n end",
"def call(value)\n coerced = value.map do |item|\n coerced_item = super(item)\n\n return coerced_item if coerced_item.is_a?(InvalidValue)\n\n coerced_item\n end\n\n @set ? Set.new(coerced) : coerced\n end",
"def nodeset(words, h = {})\n words.each do |w|\n chars = w.split(\"\")\n chars.each { |c| h[c] = \"\" }\n end\n\n h\nend",
"def on_test(ast_node, context)\n nodes = XML::NodeSet.new\n\n context.each do |xml_node|\n nodes << xml_node if node_matches?(xml_node, ast_node)\n end\n\n return nodes\n end",
"def val \n query = xpath\n trim_text = !query.index(\"text()\").nil?\n val = @document.find_by_xpath(query).collect {|node| (trim_text ? node.text.strip : node.text) }\n term.deserialize(val)\n end",
"def parse_value(nodes)\n nodes = [nodes] unless nodes.is_a?(Array)\n string = ''\n\n nodes.each do |node|\n case node[:node]\n when :comment, :semicolon\n next\n\n when :at_keyword, :ident\n string << node[:value]\n\n when :function\n if node[:value].is_a?(String)\n string << node[:value]\n string << '('\n else\n string << parse_value(node[:tokens])\n end\n\n else\n if node.key?(:raw)\n string << node[:raw]\n elsif node.key?(:tokens)\n string << parse_value(node[:tokens])\n end\n end\n end\n\n string.strip\n end",
"def value_set()\n values = self.values\n values.each { |elt| raise \"not a list! #{elt}\" if !elt.is_a?(Array) and !elt.is_a?(Set) }\n return self.values.reduce(Set.new) { |sum,nex| sum | nex }\n end",
"def set_value(value)\n if value.is_a? Array\n @map = nil\n @array = ParsedArray.new @global\n @array.abstractArrayItems = []\n value.each do |item|\n array_item = ParsedArrayItem.new @global\n array_item.arrayValueItem = ParsedArrayValueItem.new @global\n array_item.arrayValueItem.primitive = ParsedPrimitive.new(@global)\n array_item.arrayValueItem.primitive.string = ParsedString.new(item)\n array_item.arrayValueItem.primitive.text = item\n @array.abstractArrayItems << array_item\n end\n @valueItem = nil\n @text = @array.extract_hash\n return\n elsif value.is_a?(ParsedPair)\n @map = value.map ? value.map : nil\n @array = value.array ? value.array : nil\n @valueItem = value.valueItem ? value.valueItem : nil\n return\n elsif value.is_a?(TrueClass) || value.is_a?(FalseClass)\n @map = nil\n @array = nil\n @valueItem = ParsedValueItem.new @global\n @valueItem.value = ParsedValue.new @global\n @valueItem.value.primitive = ParsedPrimitive.new(@global)\n if value\n @valueItem.value.primitive.trueVal = ParsedTrue.instance\n else\n @valueItem.value.primitive.falseVal = ParsedFalse.instance\n end\n @valueItem.value.primitive.text = value\n @valueItem.value.text = value\n @text = value\n return\n end\n value = value.extract_hash unless value.is_a?(String) || value.is_a?(Integer)\n @map = nil\n @array = nil\n @valueItem = ParsedValueItem.new @global\n @valueItem.value = ParsedString.new(value)\n @text = value\n end",
"def parse_value(raw)\n return [raw.value, raw.language] if raw.is_a? RDF::Literal\n return [raw, nil] if raw.present?\n [nil, nil]\n end",
"def parse_occurs(value)\n if value == 'unbounded'\n value\n else\n Integer(value || 1)\n end\n end",
"def node_from_set(nodeset, index)\n if index.kind_of?(Integer)\n node = nodeset[index]\n elsif index.kind_of?(Symbol) && nodeset.respond_to?(index) \n node = nodeset.send(index)\n else\n raise \"Could not retrieve node using index #{index}.\"\n end\n \n return node\n end",
"def remove_dups\n unique_values = []\n while head\n node = shift\n value = node.value\n unique_values << value unless unique_values.include? value\n end\n unique_values.each {|value| unshift(Node.new(value))}\n return self\n end",
"def nodes(nodeSet = Set.new)\n @topo.eachNode do |n|\n nodeSet << n\n end\n return nodeSet\n end",
"def next=(node_or_tags); end",
"def call(value)\n coerced = value.map { |item| super(item) }\n\n @set ? Set.new(coerced) : coerced\n end",
"def node; changeset.node; end",
"def test_parse_set_collating_sequence\n root = RP.parse('[a[.span-ll.]h]', :any)\n exp = root[0]\n\n assert_equal '[.span-ll.]', exp[1].to_s\n end",
"def normalize_node(node_or_string)\n String === node_or_string ? node_or_string : node_or_string.text\n end",
"def parsed_tree; end",
"def value=(value)\n if value.is_a?(Array)\n if value.size == 1\n @value = value.first\n else\n fail ArgumentError, 'The argument must either be a string or an array with only one child'\n end\n else\n @value = value\n end\n end",
"def parse_values; end",
"def parse_value xpath\n node = parser_xml.xpath(xpath)\n return nil if node.empty?\n node.text.strip\n end",
"def item_node_set(input_element)\n input_element.xpath(XPATH[:item])\n end",
"def parse\n @parsed\n end",
"def on_axis_ancestor_or_self(ast_node, context)\n nodes = XML::NodeSet.new\n\n context.each do |xml_node|\n while has_parent?(xml_node)\n if node_matches?(xml_node, ast_node)\n nodes << xml_node\n break\n end\n\n xml_node = xml_node.parent\n end\n end\n\n return nodes\n end",
"def nodeValue=(text)\n self.childNodes = [text]\n end",
"def convert(y)\n y.chars.to_a.to_set\nend",
"def parse(target, xml)\n case options[:type]\n when :single\n target.send(\"#{@attribute}=\".to_sym, build(target, xml))\n when :collection\n collection = target.send(@attribute.to_s)\n element = build(target, xml)\n collection << element\n end\n end",
"def set(value)\n value.to_a\n end",
"def infer_set(o)\n if o.instance_of?(Array)\n infer_set_Array(o)\n elsif o.instance_of?(Hash)\n infer_set_Hash(o)\n elsif o.instance_of?(SemanticPuppet::Version)\n infer_set_Version(o)\n else\n infer(o)\n end\n end",
"def nodeValue\n ret = \"\"\n @children.each do |child|\n ret << child.nodeValue\n end if @children\n ret\n end",
"def value_from_node_property\n ''\n end",
"def semantic_values\n [semantic_value]\n end",
"def visit_set(binding_type)\n if not input.is_a? Set\n report_error('vapi.bindings.typeconverter.invalid',\n 'set', input.class.name)\n end\n visit_list(binding_type)\n end",
"def createNewSet (source)#, depth=1,clean=false)\r\n\tns = source.clone\r\n\tns.root.children.remove\r\n\tns.encoding = 'UTF-8'\r\n\treturn ns\r\nend",
"def get_value_set_for_element element\n value_set = element[\"children\"].find{ |ch| ch[\"attrs\"][\"phemaObject\"] and ch[\"attrs\"][\"phemaObject\"][\"className\"] == \"ValueSet\" }\n return {\"id\" => \"\", \"name\" => \"(Not specified)\"} if value_set.nil?\n {\"id\" => value_set[\"attrs\"][\"element\"][\"id\"], \"name\" => value_set[\"attrs\"][\"element\"][\"name\"] }\n end",
"def clone\n new_set = TreeSet.new\n # Create new nodes in the same order as self's\n if root\n root.root_traverse do |node|\n new_set << node.value\n end\n end\n new_set\n end",
"def _reduce_58(val, _values, result)\n result = Node.new(:ID, [unescape_css_identifier(val.first)])\n result\nend",
"def parse_local_value(valuetype)\n value = CGI.unescapeHTML(@cell.xpath(\"text:p//text()\").to_s)\n value = value == \"\" ? nil : value\n case valuetype\n when \"integer\"\n value = @cell.xpath(\"@office:value\").to_s.to_i\n when \"float\"\n value = @cell.xpath(\"@office:value\").to_s.to_f\n value = value.to_i unless @cell.xpath(\"@office:value\").to_s =~ /\\./ # sadly most integers are typed as floats...\n when \"date\"\n value = DateTime.parse(@cell.xpath(\"@office:date-value\").to_s)\n end\n value\n end",
"def children=(node_or_tags); end",
"def children=(node_or_tags); end",
"def union(setone,settwo) \n #Find the number of elements , make root of the Tree with fewer nodes point to root of the tree with large node\n first=find(setone)\n second=find(settwo)\n\n if first.instance_of?(String) || second.instance_of?(String) then\n puts 'One of the Input is not a valid set'\n return\n end\n \n if first[1]>=second[1] then\n @store[settwo]=setone #settwo has more elements\n @store[first[0]]=second[1]+first[1]\n else\n @store[setone]=settwo\n @store[first[0]]=first[1]+second[1]\n end\n end",
"def parse(s)\n case s['type']\n when '2p-set'\n TwoPhaseSet.new s\n when 'lww-set'\n LWWSet.new s\n when 'or-set'\n ORSet.new s\n when 'g-counter'\n GCounter.new s\n else\n raise ArgumentError, \"unknown type #{s['type']}\"\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n Nodeum.const_get(type).build_from_hash(value)\n end\n end",
"def on_axis_self(ast_node, context)\n nodes = XML::NodeSet.new\n\n context.each do |context_node|\n nodes << context_node if node_matches?(context_node, ast_node)\n end\n\n return nodes\n end",
"def to_set\n ::Set.new(to_a)\n end",
"def nested_to_set(obj)\n if obj.is_a? Array\n obj.map{ |v| nested_to_set(v) }.to_set\n elsif obj.is_a? Hash\n obj.inject({}) do |h,(k,v)|\n h.merge!(k => nested_to_set(v))\n end\n else\n obj\n end\n end",
"def parse_root_in_json(value=nil)\n return @parse_root_in_json if value.nil?\n @parse_root_in_json = value\n end",
"def parse_node str\n case str\n when nil, ANYVAL_MATCHER\n ANY_VALUE\n\n when RANGE_MATCHER\n Range.new $1.to_i, $3.to_i, ($2 == \"...\")\n\n when ILEN_MATCHER\n Range.new $1.to_i, ($1.to_i + $2.to_i), true\n\n when String\n if @regex_opts || str =~ PATH_CHAR_MATCHER\n\n # Remove extra suffix characters\n str.gsub! %r{(^|[^#{Path::RECH}])(\\*+\\?*)}, '\\1*'\n str.gsub! %r{(^|[^#{Path::RECH}])\\*+}, '\\1*'\n\n str = Regexp.escape str\n\n # Remove escaping from special path characters\n str.gsub! %r{#{Path::RECH}([#{PATH_CHARS}])}, '\\1'\n str.gsub! %r{#{Path::RECH}([#{RESC_CHARS}])}, '\\1'\n str.gsub! %r{(^|[^#{Path::RECH}])([#{SUFF_CHARS}])}, '\\1(.\\2)'\n str.gsub! %r{(^|[^\\.#{Path::RECH}])([#{SUFF_CHARS}])}, '\\1(.\\2)'\n\n Regexp.new \"\\\\A(?:#{str})\\\\Z\", @regex_opts\n\n else\n str.gsub %r{#{Path::RECH}([^#{Path::RECH}]|$)}, '\\1'\n end\n\n else\n str\n end\n end",
"def build_value_for_element valueSet, value\n if value.nil?\n return {\n \"type\" => \"CD\",\n \"code_list_id\" => valueSet[\"id\"],\n \"title\" => valueSet[\"name\"],\n }\n else\n if value and value[\"type\"]\n if value[\"type\"] == \"present\"\n return {\"type\" => \"ANYNonNull\" }\n elsif value[\"type\"] == \"value\"\n return build_range_hash(false, value[\"operator\"], value[\"units\"][\"id\"], value[\"valueLow\"], value[\"valueHigh\"])\n end\n end\n end\n nil\n end",
"def find_all(value)\n nodes = []\n self.each {|node| nodes << node if node.value == value}\n nodes\n end",
"def tags=(value)\n if value.kind_of?(String)\n @tags = value.split(\",\").uniq.map(&:strip)\n elsif value.kind_of?(Array)\n @tags = value.uniq.map(&:strip)\n end\n end",
"def nodetype=(val) @records.set(GRT_NODETYPE, val); end",
"def parse\n if value.include?(',')\n arr = value.split(',')\n arr.map!(&:strip)\n @casted_value = cast(arr, config.type)\n @operator = 'IN'\n else\n value =~ /\\A(!?[<|>]?=?\\*?)(.+)/\n # JsonApiServer.logger.debug(\"VALUE IS #{Regexp.last_match(2)}\")\n # JsonApiServer.logger.debug(\"CONFIG.TYPE IS #{config.type}\")\n @casted_value = cast(Regexp.last_match(2), config.type)\n @operator = Regexp.last_match(1)\n end\n end",
"def peek\n @nodeset[1]\n end",
"def value_before_typecast(node)\n if combinator?\n node[node_attribute_key] || node.matches_css?(combinator)\n else\n node.find(selector).text\n end\n rescue Capybara::ElementNotFound\n nil\n end",
"def parse_post_node_set_node_validate(json, node)\n post_node = PostNode.parse(json)\n node.attributes = post_node.node.attributes\n post_node.node = node\n post_node.validate\n post_node\n end",
"def get_node_value(node)\n node\n end",
"def from_node(original_node); end",
"def to_set\n require 'set' unless defined?(::Set)\n each.to_set\n end",
"def convert_value(value)\n case value\n when VividMash, AttrArray\n value\n when Hash\n VividMash.new(value, __root__, __node__, __precedence__)\n when Array\n AttrArray.new(value, __root__, __node__, __precedence__)\n else\n value\n end\n end",
"def process_value element\n case element.name\n when 'date'\n Time.parse(element.content)\n when 'string'\n element.content\n when 'real'\n element.content.to_f\n when 'true'\n true\n when 'false'\n false\n when 'array'\n element.xpath('*').map{ |e| process_value(e) }\n when 'dict'\n process_dict(element)\n end\n end",
"def [](value)\n node_data[value.to_s]\n end",
"def deserialize(value)\n value\n end",
"def value\n children = if self.namespace\n xpath('ns:value', ns: self.namespace.href)\n else\n xpath(:value)\n end\n return children.first&.content if children.length < 2\n children.map(&:content)\n end",
"def transform_dec_val_to_set(dec_expr)\n _tag, expr, val = dec_expr\n ['set', expr, ['-', expr, val]]\n end",
"def convert_value\n # Do nothing if value has not changed\n return true unless value_changed?\n # Cast the value and return success\n return parse_string_value(@uncast_value) if @uncast_value.is_a? String\n # Convert the value to yaml otherwise\n v = @uncast_value.to_yaml unless @uncast_value.nil?\n self[:value] = v\n end",
"def on_path(ast_node, context)\n nodes = XML::NodeSet.new\n\n ast_node.children.each do |test|\n nodes = process(test, context)\n\n if nodes.empty?\n break\n else\n context = nodes\n end\n end\n\n return nodes\n end",
"def setter_to_getter(node); end",
"def on_type_test_processing_instruction(ast_node, context)\n nodes = XML::NodeSet.new\n\n context.each do |node|\n nodes << node if node.is_a?(XML::ProcessingInstruction)\n end\n\n return nodes\n end",
"def type_cast(value)\n if root.equal?(self)\n raise NotImplementedError, \"#type_cast should be implemented in a subclass.\"\n else\n root.type_cast(value)\n end\n end",
"def build_nodes_one(in_str)\n set = Set.new\n x,y = [0,0]\n in_str.each do |str|\n dir = str[0]\n num = str[1..-1].to_i\n case dir \n when \"R\"\n r = (x..(x + num))\n r.each do |i|\n set.add([i, y])\n x = i\n end \n when \"L\"\n r = ((x - num)...x)\n r.to_a.reverse.each do |i|\n set.add([i, y])\n x = i\n end \n when \"U\"\n r = (y..y + num)\n r.each do |i|\n set.add([x, i])\n y = i\n end \n when \"D\"\n r = ((y - num)...y)\n r.to_a.reverse.each do |i|\n set.add([x, i])\n y = i\n end \n end \n end \n set\nend",
"def set_value(input, root)\n\t\treturn root = Node.new(input) if root == nil\n\n\t\tcase input <=> root.value\n\t\twhen -1\n\t\t\treturn root.small_child = Node.new(input, root) if root.small_child == nil\n\t\t\tset_value(input, root.small_child)\n\t\twhen 1\n\t\t\treturn root.big_child = Node.new(input, root) if root.big_child == nil\n\t\t\tset_value(input, root.big_child)\n\t\twhen 0\n\t\t\troot.count += 1\n\t\tend\n\tend",
"def parse_for_relevant_nodes\n @relevant_nodes = Array.new\n\n reduce(params[:api_response].to_hash)['data'].each do | node |\n if node[1]['from']['id'] == params[:friend_id]\n @relevant_nodes << node[1]\n elsif node[1]['tags']\n node[1]['tags']['data'].each do |tagged_person|\n if tagged_person['id'] == params[:friend_id]\n @relevant_nodes << node[1]\n end\n end\n end\n end\n end",
"def parse()\n #This is a stub, used for indexing\n end",
"def ast_class=(value); end"
] | [
"0.66734195",
"0.5850223",
"0.5667307",
"0.5488531",
"0.5221209",
"0.52194256",
"0.5207817",
"0.5159564",
"0.5138471",
"0.5100816",
"0.50731546",
"0.50714356",
"0.5069714",
"0.5021881",
"0.5014765",
"0.5013516",
"0.49961022",
"0.49947268",
"0.4994703",
"0.49702662",
"0.49647403",
"0.49119172",
"0.49079883",
"0.4906373",
"0.48964125",
"0.48960125",
"0.48603603",
"0.48472404",
"0.48298675",
"0.48071963",
"0.4802044",
"0.4787495",
"0.4782352",
"0.4777386",
"0.47590357",
"0.47559905",
"0.47490692",
"0.47253454",
"0.47223505",
"0.47219038",
"0.47065338",
"0.47024247",
"0.46967208",
"0.4694245",
"0.46831217",
"0.46776524",
"0.4673446",
"0.4671757",
"0.46713036",
"0.46682975",
"0.4663241",
"0.46599415",
"0.46586603",
"0.46477592",
"0.46461654",
"0.46451244",
"0.46448243",
"0.46387312",
"0.46304062",
"0.4624992",
"0.461367",
"0.4610146",
"0.460848",
"0.45990914",
"0.45990914",
"0.45906118",
"0.4584151",
"0.45817915",
"0.45809987",
"0.45711258",
"0.4571066",
"0.4564747",
"0.45647195",
"0.455489",
"0.45433202",
"0.4542782",
"0.45416546",
"0.45379803",
"0.45358884",
"0.45331222",
"0.45228478",
"0.45182243",
"0.4515683",
"0.45150876",
"0.45131683",
"0.45076188",
"0.449909",
"0.44975746",
"0.44932777",
"0.44873416",
"0.44838113",
"0.44740754",
"0.44696468",
"0.44683704",
"0.44681248",
"0.4465917",
"0.446404",
"0.44626826",
"0.44589812",
"0.44580677"
] | 0.4551201 | 74 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.