query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
Checks if the type of the field is `TIMESTAMP`.
|
def timestamp?
type == "TIMESTAMP"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check_timestamp(timestamp)\n fail ArgumentError, 'Timestamp must be a Time' unless timestamp.is_a? Time\n end",
"def check_timestamp!(timestamp)\n fail ArgumentError, 'Timestamp must be a Time' unless timestamp.is_a? Time\n end",
"def datetime?\n type == \"DATETIME\"\n end",
"def type_literal_generic_datetime(column)\n :timestamp\n end",
"def check_for_timestamp name\n @created_at = true if name == CREATED_AT_FIELD\n @updated_at = true if name == UPDATED_AT_FIELD\n nil\n end",
"def timestamps?\n if (model_column_names & %w[created_on updated_on]).any?\n :legacy\n else\n (model_column_names & %w[created_at updated_at]).any?\n end\n end",
"def has_timestamps?\n has_created_at_timestamp? || has_updated_at_timestamp?\n end",
"def record_timestamps\n false\n end",
"def timestamps\n opts = @table.schema.opts\n if opts[ :mysql_timestamps ]\n # Unfortunately, MySQL allows only either automatic create timestamp\n # (DEFAULT CURRENT_TIMESTAMP) or automatic update timestamp (DEFAULT\n # CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP), but not both - one\n # has to be updated manually anyway. So we choose to have the update timestamp\n # automatically updated, and let the create one to be set manually.\n # Also, Sequel doesn't currently honor :on_update for column definitions,\n # so we have to use default literal to make it work. Sigh.\n timestamp :create_time, :null => false, :default => ( opts[ :zero_timestamps ] == false ? DEFAULT_TIME : ZERO_TIME )\n timestamp :update_time, :null => false, :default => Sequel.lit( 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP' )\n else\n Time :create_time\n Time :update_time\n end\n end",
"def timestamp_field=(_field_name)\n raise Error, E_TIMESTAMP_FIELD_CONFIG\n end",
"def has_updated_at_timestamp?\n !!@updated_at\n end",
"def record_timestamps\n false\n end",
"def time?\n type == \"TIME\"\n end",
"def valid_timestamp?(timestamp)\n (timestamp.is_a?(Integer) ||\n (timestamp.is_a?(String) && timestamp.match(/^\\d+$/))) &&\n timestamp.to_i > 946_684_800 &&\n timestamp.to_i < (Time.now.to_i + 31_557_600)\n end",
"def type_literal_generic_only_time(column)\n :time\n end",
"def type_literal_generic_time(column)\n column[:only_time] ? :time : :datetime\n end",
"def timestamp?\n created_at || expires_at || @wsu_timestamp\n end",
"def apply_validations_for_timestamp\n apply_validations_for_datetime\n end",
"def has_created_at_timestamp?\n !!@created_at\n end",
"def valid_time_or_date?(value)\n value.is_a?(Time) || value.is_a?(Date) || value.is_a?(ActiveSupport::TimeWithZone)\n end",
"def has_timestamp?(version)\n _ver, build_info = version.split(\"+\")\n return false if build_info.nil?\n\n build_info.split(\".\").any? do |part|\n Time.strptime(part, Omnibus::BuildVersion::TIMESTAMP_FORMAT)\n true\n rescue ArgumentError\n false\n end\n end",
"def time_value?(input)\n return input.is_a?(Time) || input.is_a?(Date)\n end",
"def has_both_timestamps?\n has_created_at_timestamp? && has_updated_at_timestamp?\n end",
"def timestamp\n Time.parse( props[ TIMESTAMP_PROP_NAME ] ) if props\n end",
"def apply_validations_for_time\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Time\") if value && (! value.kind_of?(Time))\n end\n end",
"def supports_timestamp_timezones?\n true\n end",
"def supports_timestamp_timezones?\n true\n end",
"def supports_timestamp_timezones?\n true\n end",
"def type_literal_generic_datetime(column)\n :datetime\n end",
"def timeseries?\n !@column_metadata.select { |dc| dc.role == NexosisApi::ColumnRole::TIMESTAMP }.empty?\n end",
"def datetime?\n !@arg[:datetimeValue].nil?\n end",
"def validate_timestamp(obj)\n if !obj[:timestamp].nil?\n if obj[:timestamp].match(/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}.\\d{3}/)\n return true\n end\n end\n false\nend",
"def apply_validations_for_datetime\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Time or DateTime\") if value && (! value.kind_of?(Time)) && (value.class.name != 'DateTime')\n end\n end",
"def is_valid?\n is_valid_datetime?\n end",
"def timestamp name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :timestamp, description: description, mode: mode, policy_tags: policy_tags\n end",
"def timestamp=(timestamp)\n @timestamp = _check_timestamp(timestamp)\n end",
"def timestamp?\n !!(self =~ /^Rel\\d\\d\\d\\d\\d\\d\\d\\d$/ ||\n self =~ /^\\w\\w\\w?_\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d$/)\n end",
"def type_literal_generic_time(column)\n if column[:only_time]\n type_literal_generic_only_time(column)\n else\n type_literal_generic_datetime(column)\n end\n end",
"def filter_timestamps(schema)\n schema.reject { |item| ['created_at', 'updated_at'].include?(item[0]) }\n end",
"def parse_timestamps\n super\n @updated = updated.to_i if updated.is_a? String\n @updated = Time.at(updated) if updated\n end",
"def requires_sql_standard_datetimes?\n true\n end",
"def timestamp_for_day\n if timestamp > Time.zone.now.at_beginning_of_day\n self.errors.add(:timestamp, 'should be not earlier then the beginning of this day.')\n end\n end",
"def timestamp\n @timestamp ||= Time.parse(self['timestamp'])\n end",
"def verify_timestamp(prev_block)\r\n unless prev_block.nil?\r\n prev_timestamp = prev_block.timestamp\r\n prev_seconds = prev_timestamp.split('.')[0].to_i\r\n\r\n curr_seconds = @timestamp.split('.')[0].to_i\r\n\r\n if prev_seconds == curr_seconds\r\n prev_nano = prev_timestamp.split('.')[1].to_i\r\n curr_nano = @timestamp.split('.')[1].to_i\r\n if prev_nano >= curr_nano\r\n raise \"Line #{total_block_number}: Prev timestamp #{prev_timestamp} >= new timestamp #{@timestamp}\"\r\n end\r\n elsif prev_seconds > curr_seconds\r\n raise \"Line #{total_block_number}: Prev timestamp #{prev_timestamp} >= new timestamp #{@timestamp}\"\r\n end\r\n true\r\n end\r\n end",
"def update_timestamps_for_changes?\n klass = commentable.class\n if klass.respond_to? :update_timestamps_for_comment_changes?\n klass.update_timestamps_for_comment_changes?\n else\n false\n end\n end",
"def a_timestamp\n proc { |t| t.to_s =~ /^\\d{10}$/ }\n end",
"def default_timestamp_format\n \"TIMESTAMP '%Y-%m-%d %H:%M:%S%N %z'\".freeze\n end",
"def has_status_timestamp?\n !overall_status_modified_at.nil?\n end",
"def must_convert?\n big_query_conversion_column.present? && unit != 'seconds'\n end",
"def timestamping?\n !timeless\n end",
"def timestamp=(timestamp)\n @timestamp = _check_timestamp(timestamp)\n end",
"def timestamp_parse(_timestamp)\n _undefined\n end",
"def timestamps(options = {})\n attribute(:created_at, options.update(type: :timestamp))\n attribute(:updated_at, options.update(type: :timestamp))\n end",
"def supports_timestamp_usecs?\n false\n end",
"def validates_as_datetime(*attr_names)\n configuration = { :message => \"attribute should be of type Time\" }\n validates_each(attr_names, configuration) do |record, attr_name, value|\n unless value.is_a?(Time)\n record.errors.add(attr_name, :invalid, :default => configuration[:message], :value => value)\n end\n end\n end",
"def date_or_time?(row, idx)\n row.format(idx).date_or_time? && Float(read_cell_content(row, idx)) > 0 rescue false\n end",
"def datetime_timestamp\n return Date.parse(self.date).to_time\n end",
"def parse_timestamps\n @created = created.to_i if created.is_a? String\n @created = Time.at(created) if created\n end",
"def check_timestamp\n @recent.save! if Time.now - @recent.updated_at >= 600\n end",
"def timestamp\n _timestamp.as_time\n end",
"def timestamp\n attribute_prop(4)\n end",
"def disable_timestamp_callback\n if self.respond_to?(\"updated_at\")\n self.class.skip_callback(:save, :before, :update_timestamps ) if @@_disable_timestamp_count == 0\n @@_disable_timestamp_count += 1\n end\n end",
"def must_convert?\n self.big_query_conversion_column.present? && self.unit != 'seconds'\n end",
"def timestamp\n if @data.exist?\n mtime = @data.mtime.to_time\n raise \"Table #{name} exists but modified time is unavailable.\" if mtime.nil?\n mtime\n else\n Rake::EARLY\n end\n end",
"def should_override_api_timestamp?\n (@timestamp_header_value == \"posse\")? true : false\n end",
"def is_a?(klass)\n klass == ::Time || super\n end",
"def time_for(record)\n return nil unless record\n case database_type\n when :mongo\n return Time.at(record['ts'].seconds)\n when :toku\n return record['ts']\n end\n end",
"def validate_timestamps(info)\r\n\t\tprev_ts = @current_timestamp\r\n\t\tcur_ts = info['ts']\r\n\r\n\t\tif cur_ts[:sec] > prev_ts[:sec]\r\n\t\t\tsuccess = true\r\n\t\telsif cur_ts[:sec] == prev_ts[:sec]\r\n\t\t\t(cur_ts[:nsec] > prev_ts[:nsec]) ? success = true : success = false\r\n\t\telse\r\n\t\t\tsuccess = false\r\n\t\tend\r\n\t\t\t\t\r\n\t\t#puts success\r\n\t\terror_msg = \"Previous timestamp #{prev_ts[:sec]}.#{prev_ts[:nsec]} >= new timestamp #{cur_ts[:sec]}.#{cur_ts[:nsec]}\" unless success\r\n\r\n\t\t@current_timestamp = cur_ts\r\n\t\t#puts \"Seconds #{cur_ts[:sec]} >= #{prev_ts[:sec]}: #{cur_ts[:sec] >= prev_ts[:sec]} where success: #{success}\"\r\n\t\t#puts \"Nano #{cur_ts[:nsec]} > #{prev_ts[:nsec]}: #{cur_ts[:nsec] > prev_ts[:nsec]} where success: #{success}\"\r\n\t\treturn success, error_msg\r\n\tend",
"def date?\n type == \"DATE\"\n end",
"def time_define?\n !time.blank?\n end",
"def is_valid_datetime?\n Chronic.parse(@value.respond_to?(:to_date) ? @value.to_date : @value.to_s)\n end",
"def require_timestamp(command_in_context) # :nodoc:\n return if cartage.config.timestamp\n fail GLI::MissingRequiredArgumentsException.new(\n 'Timestamp required', command_in_context\n )\n end",
"def gtfs_time_setter(attribute_sym, val)\n if val.is_a? String\n t = Time.new_from_gtfs(val)\n if t.nil?\n errors.add(attribute_sym, :invalid)\n write_attribute(attribute_sym, val)\n return false\n end\n write_attribute(attribute_sym, t)\n return\n end\n write_attribute(attribute_sym, val)\n end",
"def denormalization_timestamps\n @denormalization_timestamps ||= (self.column_names.select { |attribute_name| self.denormalization_timestamp?(attribute_name) } rescue [])\n end",
"def timestamp\n _timestamp.as_time\n end",
"def literal_datetime(v)\n v.strftime(\"TIMESTAMP '%Y-%m-%d %H:%M:%S'\")\n end",
"def timestamp\n timestamp_to_datetime(static_data(\"timestamp\"))\n end",
"def time_query?\n created_at? || updated_at?\n end",
"def supports_datetime_with_precision?\n false\n end",
"def supports_datetime_with_precision?\n false\n end",
"def literal_time(v)\n v.strftime(\"TIMESTAMP '%Y-%m-%d %H:%M:%S'\")\n end",
"def looks_like_date?(value)\n value.is_a?(Date) || value.is_a?(Time)\n end",
"def set_deleted_timestamp(time=nil)\n field = model.deleted_timestamp_field\n meth = :\"#{field}=\"\n if respond_to?(field) && respond_to?(meth) && (model.deleted_timestamp_overwrite? || send(field).nil?)\n self.send(meth, time||=Sequel.datetime_class.now)\n self.save\n end\n end",
"def handle_ts\n handle_at\n handle_in\n @time_special = @tokens[@index].get_tag(TimeSpecial).type\n @index += 1\n @precision = :time_special\n end",
"def timestamp_columns(table_name)\n columns(table_name) & TIMESTAMP_COLUMN_NAMES\n end",
"def type\n 'Edm.Time'\n end",
"def deleted_timestamp_overwrite?\n @deleted_timestamp_overwrite\n end",
"def enable_timestamp_callback\n if self.respond_to?(\"updated_at\")\n @@_disable_timestamp_count -= 1\n self.class.set_callback(:save, :before, :update_timestamps ) if @@_disable_timestamp_count == 0\n end\n end",
"def timestamps\n attribute :created_at, :datetime, required: true\n attribute :updated_at, :datetime, required: true\n end",
"def save_without_timestamping\n class << self\n def record_timestamps; false; end\n end\n \n save\n \n class << self\n remove_method :record_timestamps\n end\n end",
"def time?(string)\n begin\n DateTime.strptime(string, @time_format)\n true\n rescue\n false\n end\n end",
"def typecast_value_datetime(value)\n Sequel.typecast_to_application_timestamp(value)\n end",
"def timestampFormat(value)\n _timestampFormat(value) or fail ArgumentError, \"Unknown value for timestampFormat: #{value}\"\n end",
"def timestamps(on = true)\r\n attribute :created_at, on if model.column_names.include? \"created_at\"\r\n attribute :updated_at, on if model.column_names.include? \"updated_at\"\r\n end",
"def validate_timestamp\n ts = ValidatingTimestamp\n .from_string(timestamp,\n parse_format: roda_class.opts[:time_parse_fmt],\n validity: expiration_time)\n return self if ts.valid?\n\n roda_class.opts[:common_logger]&.warn \"Request aborted. #{ts}\"\n halt [111,\n { 'Content-Type' => 'text/html' },\n { message: 'Bad request. Ignored.' }.to_json]\n end",
"def valid_checkin_at?\n return true if datetime_parsed?(@record.checkin_at.to_s)\n\n error_message = I18n.t('models.entry.errors.invalid_datetime')\n add_error_record(:checkin_at, error_message)\n end",
"def timestamp\n params['TIMESTAMP']\n end",
"def timestamp_ok?(timestamp)\n return unless (Time.now - Time.at(timestamp.to_i)).abs / 1.second > 5.minute\n\n raise Unauthorized \"ERROR: you're not Slack!\"\n end",
"def save_without_timestamping\n class << self\n def record_timestamps; false; end\n end\n \n save\n \n class << self\n remove_method :record_timestamps\n end\n end",
"def datetime_parsed?(value)\n true if DateTime.parse(value)\n rescue ArgumentError\n false\n end"
] |
[
"0.70083463",
"0.69439775",
"0.67441046",
"0.67128104",
"0.67067975",
"0.6548675",
"0.6139999",
"0.613817",
"0.6133439",
"0.6036024",
"0.6018841",
"0.6016524",
"0.5987084",
"0.59496635",
"0.590741",
"0.5900461",
"0.5894694",
"0.5881744",
"0.5848368",
"0.5846171",
"0.58445066",
"0.57914937",
"0.5782535",
"0.5770769",
"0.56610477",
"0.56535256",
"0.56535256",
"0.56535256",
"0.56532794",
"0.5619367",
"0.5617539",
"0.56090975",
"0.5599975",
"0.55364686",
"0.5527859",
"0.5525634",
"0.5515966",
"0.5492876",
"0.5461204",
"0.54439425",
"0.5394608",
"0.53937554",
"0.5388555",
"0.5385556",
"0.5365306",
"0.5357349",
"0.5345423",
"0.53445137",
"0.5329583",
"0.53258204",
"0.53252685",
"0.5320563",
"0.5315153",
"0.5298887",
"0.52761644",
"0.52514446",
"0.5251006",
"0.5249079",
"0.5242335",
"0.5242221",
"0.5231118",
"0.52241087",
"0.52213496",
"0.52200687",
"0.5214497",
"0.5210905",
"0.5203558",
"0.5201964",
"0.51974833",
"0.51794446",
"0.51783305",
"0.5174116",
"0.5170888",
"0.5162499",
"0.51554555",
"0.51521623",
"0.51500714",
"0.5144137",
"0.5138197",
"0.5138197",
"0.5136131",
"0.513596",
"0.51276386",
"0.5122948",
"0.512199",
"0.51160777",
"0.51044875",
"0.510435",
"0.5103993",
"0.5084594",
"0.50827783",
"0.50800586",
"0.5078419",
"0.50730056",
"0.5050292",
"0.50487334",
"0.5030846",
"0.50294936",
"0.5027903",
"0.50174725"
] |
0.8122504
|
0
|
Checks if the type of the field is `TIME`.
|
def time?
type == "TIME"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def time_value?(input)\n return input.is_a?(Time) || input.is_a?(Date)\n end",
"def valid_time_or_date?(value)\n value.is_a?(Time) || value.is_a?(Date) || value.is_a?(ActiveSupport::TimeWithZone)\n end",
"def is_time_unit?\n self.is_numeric? && TIME_UNITS.include?(self.unit)\n end",
"def type_literal_generic_only_time(column)\n :time\n end",
"def type_literal_generic_time(column)\n column[:only_time] ? :time : :datetime\n end",
"def is_time_unit?\n is_numeric? && TIME_UNITS.include?(unit)\n end",
"def time?(string)\n begin\n DateTime.strptime(string, @time_format)\n true\n rescue\n false\n end\n end",
"def validate_time(time)\n\t\tif time.is_a? Time\n\t\t\treturn time\n\t\telse\n\t\t\treturn Time.parse(time)\n\t\tend\n\tend",
"def apply_validations_for_time\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Time\") if value && (! value.kind_of?(Time))\n end\n end",
"def is_time(time)\n return Integer(time) rescue\n return Date.iso8601(time) rescue\n false\nend",
"def time_define?\n !time.blank?\n end",
"def datetime?\n type == \"DATETIME\"\n end",
"def type_literal_generic_time(column)\n if column[:only_time]\n type_literal_generic_only_time(column)\n else\n type_literal_generic_datetime(column)\n end\n end",
"def basic_type_check(time, minutes)\n raise 'Unexpected type passed for time variable - should be string' unless time.is_a? String\n raise 'Unexpected type passed for additional_minutes variable - should be integer' unless minutes.is_a? Integer\nend",
"def is_a?(klass)\n klass == ::Time || super\n end",
"def end_time_defined?(time)\n if time.empty?\n '24:00'\n else\n time\n end\n end",
"def type\n 'Edm.Time'\n end",
"def handle_time_parameter(object, time_name)\n return true if params[:no_times]\n return false unless valid_time?(object, time_name)\n if time_cleared?(object, time_name)\n reset_date_parameters(object, time_name)\n else\n set_default_date_parameters(object, time_name)\n end\n true\n end",
"def wab_time_format?(str)\n return false unless 30 == str.length\n TIME_REGEX === str\n end",
"def time_field field = nil\n @time_field = field if field\n @time_field\n end",
"def could_be_minute?(minute); end",
"def check_timestamp(timestamp)\n fail ArgumentError, 'Timestamp must be a Time' unless timestamp.is_a? Time\n end",
"def validate_time(time)\n time=~/^([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/\nend",
"def valid_at?(time)\n if time.is_a?(Integer)\n time = Time.at(time)\n end\n\n if (self.not_after < time) || (self.not_before > time)\n false\n else\n true\n end\n end",
"def in_time_range?(time)\n time = Time.parse(time) if ! time.is_a?(Time)\n time_range.cover?(time)\n end",
"def typecast_value_time(value)\n case value\n when Time\n if value.is_a?(SQLTime)\n value\n else\n # specifically check for nsec == 0 value to work around JRuby 1.6 ruby 1.9 mode bug\n SQLTime.create(value.hour, value.min, value.sec, (value.respond_to?(:nsec) && value.nsec != 0) ? value.nsec/1000.0 : value.usec)\n end\n when String\n Sequel.string_to_time(value)\n when Hash\n SQLTime.create(*[:hour, :minute, :second].map{|x| (value[x] || value[x.to_s]).to_i})\n else\n raise Sequel::InvalidValue, \"invalid value for Time: #{value.inspect}\"\n end\n end",
"def time(limit = nil)\n Validation.new { |d| d.is_a?(Time) && in_range?(d, limit) }\n end",
"def check_timestamp!(timestamp)\n fail ArgumentError, 'Timestamp must be a Time' unless timestamp.is_a? Time\n end",
"def should_time?\n should?('never_time')\n end",
"def time_ok?\n @time_is_ok ||= check_time\n end",
"def time?(text)\n if datetime?(text)\n extract = Nickel.parse(text).occurrences[0].start_time\n extract.nil? ? false : true\n else\n false\n end\n\n rescue RuntimeError => e\n Failure.save_case(text, e)\n return false\n end",
"def contains_time?(time)\n segments.each do |seg|\n return true if seg.contains_time?(time)\n end\n return false\n end",
"def time(value)\n _parse_time(value)\n end",
"def matches?(time=Time.now)\n\n time = as_time(time)\n\n return false unless sub_match?(time, :sec, @seconds)\n return false unless sub_match?(time, :min, @minutes)\n return false unless sub_match?(time, :hour, @hours)\n return false unless date_match?(time)\n true\n end",
"def end_time_is_valid?\n return false unless not_nil_and_string(self.end_time)\n return self.end_time.length > 0\n end",
"def time_in_record? time, record\n return false if record.end_time == :running\n time >= record.start_time && time <= record.end_time\n end",
"def gtfs_time_setter(attribute_sym, val)\n if val.is_a? String\n t = Time.new_from_gtfs(val)\n if t.nil?\n errors.add(attribute_sym, :invalid)\n write_attribute(attribute_sym, val)\n return false\n end\n write_attribute(attribute_sym, t)\n return\n end\n write_attribute(attribute_sym, val)\n end",
"def validate(val)\n if ((val.is_a?(String)) &&\n # This could be expanded. @TODO\n (m = val.match(/([0-9]{4})-([0-9]{2})-([0-9]{2})/)))\n return Time.new(m[1], m[2], m[3])\n elsif (val.respond_to?(:to_time))\n return val.to_time\n elsif (val.is_a?(Time))\n return val\n else\n return nil\n end\n end",
"def time name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :time, description: description, mode: mode, policy_tags: policy_tags\n end",
"def bson_type\n ::Time::BSON_TYPE\n end",
"def as_of_time\n Conversions.string_to_utc_time attributes_before_type_cast['as_of_time']\n end",
"def start_time_is_valid?\n return false unless not_nil_and_string(self.start_time)\n return self.start_time.length > 0\n end",
"def time_field(field, options={})\n options.reverse_merge!(:value => field_value(field) ? field_value(field).to_time.strftime(\"%H:%M\") : nil, :id => field_id(field))\n options[:class] = 'time_field'\n options.merge!(:class => field_error(field, options))\n @template.time_field_tag field_name(field), options\n end",
"def is_time?\n ! maintenance_service_interval_type.is_miles?\n end",
"def includesTime(time_format)\r\n @times.empty? or @times.any? { |start,finish| start <= time_format && time_format < finish}\r\n end",
"def time?\n !times.empty?\n end",
"def time?\n false\n end",
"def time_default?(a_time)\n default = Time.now.change({ hour: 23, min: 59})\n hour(default) == hour(a_time)\n end",
"def time_default?(a_time)\n default = Time.now.change({ hour: 23, min: 59})\n hour(default) == hour(a_time)\n end",
"def time(text)\n scan(text, TIME, :time)\n end",
"def time\n Types::Time.deserialize(@time)\n end",
"def set_Time(value)\n set_input(\"Time\", value)\n end",
"def specific?\n starts_at.is_a?(Time) && ends_at.is_a?(Time)\n end",
"def parse_time(attribute, time_string)\n time_string.blank? ? nil : DateTime.parse(time_string).in_time_zone\n rescue ArgumentError\n errors.add(attribute, :invalid_time)\n nil\n end",
"def valid?(time=Time.now.utc)\n time>not_before && time<self.not_after\n end",
"def validate\n\t\tif not isEmpty(self.time)\n\t\t\terrors.add(:time, \"is already occupied.\")\n\t\tend\n\t\tif not Schedule.isValidTimeSlot(self.schedule, self.time)\n\t\t\terrors.add(:time, \"is not a valid timeslot.\")\n\t\tend\n\tend",
"def safe_for_time_parse?(string)\n # misformatted cli option\n !string.include?('=') and\n # a date time string needs a number in it\n string =~ /\\d/\n end",
"def timestamp?\n type == \"TIMESTAMP\"\n end",
"def has_times(*attrs)\n options = attrs.extract_options!\n attrs.each do |attr|\n attr_reader attr\n define_reader_with_options(attr,options)\n define_method(\"#{attr.to_s}=\") do |val|\n val = val.to_time unless val.nil?\n instance_variable_set(\"@#{attr}\", val)\n attributes[attr] = val\n val\n end\n end\n end",
"def _valid_time? hour, minute, second\n hour += 24 if hour < 0\n minute += 60 if minute < 0\n seconds += 60 if second < 0\n return unless ((0...24) === hour && (0...60) === minute && (0...60) === second) ||\n (24 == hour && 0 == minute && 0 == second)\n time_to_day_fraction hour, minute, second\n end",
"def time_klass(time)\n case time\n when ActiveSupport::TimeWithZone\n Time\n else\n time.class\n end\n end",
"def time_check thistime=nil\n @sugtime = thistime ? (thistime.to_i*2) : 1\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def time_only(person_or_type = nil)\n time_detail(:time_only => true, :audience => person_or_type)\n end",
"def parse_time\n time_str = @request[FTIME].sub(REGEX_TIME_FIX) { \"#{$1} #{$2}\" }\n Time.parse(time_str) rescue nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def parse_time_string(time_string)\n time_string ? Time.parse(time_string) : nil\n end",
"def validate_event_time(item)\n error(msg: 'Invalid iso8601 string', item: __method__.to_s) unless valid_iso_8601(item)\n end",
"def time_class; end",
"def as_of_time\n Conversions.string_to_utc_time attributes['as_of_time']\n end",
"def parse_time(time)\n case time\n when Time\n time\n when Integer, Float\n Time.at(time)\n else\n Time.parse(time.to_s)\n end\n end",
"def time_right_now? time\n time_now_with_resetted_date = reset_date_for_time_now\n time_with_resetted_date = reset_date_for_time time\n (time_now_with_resetted_date <=> time_with_resetted_date) == Timeable::TIME_COMPARE_RESULTS[:both_sides_same_time]\n end",
"def parse_time(time)\n if time.is_a? Time\n return Time.parse time.httpdate\n elsif time.is_a String\n return Time.parse(Time.parse(time).httpdate)\n else\n raise \"Argument Error, #{time} is not a valid time\"\n end\n end",
"def quantity_as_time?\n false\n end",
"def timebox_type_check\n if group_id && project_id\n field = project_id_changed? ? :project_id : :group_id\n errors.add(field, _(\"%{timebox_name} should belong either to a project or a group.\") % { timebox_name: timebox_name })\n end\n end",
"def daytime_hours?\n @test_time = @time if @test_time.nil?\n @test_time.daytime_hours?\n end",
"def time(options = {})\n if @time.is_a?(Time)\n @time.strftime(\"%l#{@time.min > 0 ? \":%M\" : ''}%P\").strip\n else\n nil\n end\n end",
"def missing?\n time.nil?\n end",
"def validates_as_datetime(*attr_names)\n configuration = { :message => \"attribute should be of type Time\" }\n validates_each(attr_names, configuration) do |record, attr_name, value|\n unless value.is_a?(Time)\n record.errors.add(attr_name, :invalid, :default => configuration[:message], :value => value)\n end\n end\n end",
"def respond_to?(sym) #:nodoc:\n super || @time.respond_to?(sym)\n end",
"def check_lock_time(lock_time)\n false\n end"
] |
[
"0.75910455",
"0.71092737",
"0.6954289",
"0.69318175",
"0.69092184",
"0.6798967",
"0.67504483",
"0.6715974",
"0.6713501",
"0.6647548",
"0.6590515",
"0.6581413",
"0.64501256",
"0.6442437",
"0.6401007",
"0.6358342",
"0.6355443",
"0.63516265",
"0.63376915",
"0.6305664",
"0.6284139",
"0.62188876",
"0.62028384",
"0.6179076",
"0.6172406",
"0.61191714",
"0.60963416",
"0.60800105",
"0.6068283",
"0.605348",
"0.6008591",
"0.59946537",
"0.5993908",
"0.5982582",
"0.5978836",
"0.5929556",
"0.5928123",
"0.5915152",
"0.59151214",
"0.5913196",
"0.58837444",
"0.5881371",
"0.5857008",
"0.58546656",
"0.5836084",
"0.5832052",
"0.58260906",
"0.58020586",
"0.58020586",
"0.5778675",
"0.5760522",
"0.5758475",
"0.5753532",
"0.57497954",
"0.57444876",
"0.5739261",
"0.5737833",
"0.57116705",
"0.5707166",
"0.5704653",
"0.5692715",
"0.56855494",
"0.56783926",
"0.56783926",
"0.56783926",
"0.5672761",
"0.56503826",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5604839",
"0.5599102",
"0.5598616",
"0.55950284",
"0.55878514",
"0.55815893",
"0.5571315",
"0.5568051",
"0.5566035",
"0.556495",
"0.5558795",
"0.5558455",
"0.5554958",
"0.5549149",
"0.5546862"
] |
0.8383756
|
0
|
Checks if the type of the field is `DATETIME`.
|
def datetime?
type == "DATETIME"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def apply_validations_for_datetime\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Time or DateTime\") if value && (! value.kind_of?(Time)) && (value.class.name != 'DateTime')\n end\n end",
"def is_valid?\n is_valid_datetime?\n end",
"def valid_time_or_date?(value)\n value.is_a?(Time) || value.is_a?(Date) || value.is_a?(ActiveSupport::TimeWithZone)\n end",
"def datetime?\n !@arg[:datetimeValue].nil?\n end",
"def is_valid_datetime?\n Chronic.parse(@value.respond_to?(:to_date) ? @value.to_date : @value.to_s)\n end",
"def validates_as_datetime(*attr_names)\n configuration = { :message => \"attribute should be of type Time\" }\n validates_each(attr_names, configuration) do |record, attr_name, value|\n unless value.is_a?(Time)\n record.errors.add(attr_name, :invalid, :default => configuration[:message], :value => value)\n end\n end\n end",
"def is_start_date_is_valid_datetime\n errors.add(:start_date, 'start date must be a valid datetime') if (:start_date.kind_of? DateTime)\n end",
"def time_value?(input)\n return input.is_a?(Time) || input.is_a?(Date)\n end",
"def type_literal_generic_datetime(column)\n :datetime\n end",
"def looks_like_date?(value)\n value.is_a?(Date) || value.is_a?(Time)\n end",
"def date_time?(date_time)\n true if DateTime.parse(date_time)\n rescue ArgumentError\n false\n end",
"def datetime_validate(value)\n begin\n return DateTime.parse(value)\n rescue ArgumentError, NoMethodError\n logger.warn(\"Invalid DateTime format for #{value}\")\n end\n end",
"def datetime_parsed?(value)\n true if DateTime.parse(value)\n rescue ArgumentError\n false\n end",
"def subtype\n self.datetime_type\n end",
"def apply_validations_for_time\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Time\") if value && (! value.kind_of?(Time))\n end\n end",
"def date?\n type == \"DATE\"\n end",
"def time?\n type == \"TIME\"\n end",
"def type_literal_generic_time(column)\n column[:only_time] ? :time : :datetime\n end",
"def timestamp?\n type == \"TIMESTAMP\"\n end",
"def type_literal_generic_datetime(column)\n :timestamp\n end",
"def requires_sql_standard_datetimes?\n true\n end",
"def set_time_as_datetime(options)\n options[:type] = DateTime if options[:type] == Time\n end",
"def check_timestamp(timestamp)\n fail ArgumentError, 'Timestamp must be a Time' unless timestamp.is_a? Time\n end",
"def valid?(text)\n datetime?(text) || datetime?(clear_text(text))\n end",
"def is_time(time)\n return Integer(time) rescue\n return Date.iso8601(time) rescue\n false\nend",
"def check_timestamp!(timestamp)\n fail ArgumentError, 'Timestamp must be a Time' unless timestamp.is_a? Time\n end",
"def type_literal_generic_only_time(column)\n :time\n end",
"def datetime_matcher\n proc do |value|\n handle_error(value) do\n datetime = value.in_time_zone(Time.zone)\n datetime.present?\n end\n end\n end",
"def type\n 'Edm.DateTime'\n end",
"def date_class\n ::DateTime\n end",
"def apply_validations_for_timestamp\n apply_validations_for_datetime\n end",
"def is_a?(klass)\n klass == ::Time || super\n end",
"def datetime(name, option={})\n option[:is_a] = :datetime\n register_attribute_member(name, option)\n define_attribute_accessor(name, option)\n define_validations(name, option)\n end",
"def can_be_date?\n raise NoMethodError, \"This method is no longer supported.\"\n end",
"def validate_date_attribute(date_type)\n value = send(\"#{date_type}_before_type_cast\")\n self[date_type] = value.is_a?(Date) || value.is_a?(Time) ? value : Time.zone.parse(value)\n if self[date_type].nil?\n errors.add(date_type, I18n.t('error.invalid_date', key: date_type.capitalize))\n end\n rescue ArgumentError, TypeError\n errors.add(date_type, I18n.t('error.invalid_date', key: date_type.capitalize))\n end",
"def check_validity!\n keys = CHECKS.keys\n options.slice(*keys).each do |option, value|\n next if is_time?(value) || value.is_a?(Proc) || value.is_a?(Symbol) || (defined?(ActiveSupport::TimeWithZone) and value.is_a? ActiveSupport::TimeWithZone)\n raise ArgumentError, \":#{option} must be a time, a date, a time_with_zone, a symbol or a proc\"\n end\n end",
"def start_time_is_valid?\n return false unless not_nil_and_string(self.start_time)\n return self.start_time.length > 0\n end",
"def valid_date?(date)\r\n raise CLXException, 'Date must be of type DateTime' unless date.is_a? DateTime\r\n end",
"def to_datetime string_or_datetime\n if string_or_datetime.is_a?(String)\n Sequel.string_to_datetime(string_or_datetime)\n else\n string_or_datetime\n end\n end",
"def datetime?(text)\n datetime = Nickel.parse(text).occurrences[0]\n datetime.nil? ? false : true\n\n rescue => e\n Failure.save_case(text, e)\n return false\n end",
"def datetime_format_and_existence_is_valid \n errors.add(:datetime_observation, 'datum musí být ve formátu DD.MM.YYYY') unless\n (@date =~ /\\d\\d\\.( )?\\d\\d\\.( )?\\d{4}/)# check the date's format\n errors.add(:datetime_observation, 'čas musí být ve formátu HH:MM') unless # check the time's format\n (@time =~ /^((0?[1-9]|1[012])(:[0-5]\\d){0,2}(\\ [AaPp][Mm]))$|^(([01]\\d|2[0-3])(:[0-5]\\d){0,2})$/)\n # build the complete date + time string and parse\n @datetime_str = @date + \" \" + @time\n errors.add(:datetime_observation, \"neexistuje\") if \n ((Time.zone.parse(@datetime_str) rescue ArgumentError) == ArgumentError)\n end",
"def datetime\n new(:datetime, DATE_TIME_REGEXP, lambda { |raw| Time.parse(raw).to_datetime })\n end",
"def parse_and_validate_date_if_necessary(value, type)\n # note: cannot use 'case type' as that expands to === which checks for instances of rather than type equality\n if type == Date\n expect(value).to match(/^\\d{4}-\\d{2}-\\d{2}$/)\n Date.strptime(value, \"%Y-%m-%d\")\n elsif type == DateTime\n expect(value).to match(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$/)\n DateTime.strptime(value, \"%Y-%m-%dT%H:%M:%SZ\")\n else\n value\n end\n end",
"def type\n 'Edm.Time'\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 has_valid_format?(record)\n return (is_date?(record.start_at) and is_date?(record.end_at))\n end",
"def valid_checkin_at?\n return true if datetime_parsed?(@record.checkin_at.to_s)\n\n error_message = I18n.t('models.entry.errors.invalid_datetime')\n add_error_record(:checkin_at, error_message)\n end",
"def date_or_time?(row, idx)\n row.format(idx).date_or_time? && Float(read_cell_content(row, idx)) > 0 rescue false\n end",
"def valid_tee_time?(datetime)\n before_5pm = (datetime.hour <= 16 && datetime.min <= 40)\n after_9am = datetime.hour >= 9\n before_end_date = (datetime + 3.hours) <= @end_time\n return before_5pm && after_9am && before_end_date\n end",
"def type_literal_generic_time(column)\n if column[:only_time]\n type_literal_generic_only_time(column)\n else\n type_literal_generic_datetime(column)\n end\n end",
"def valid_at?(time)\n if time.is_a?(Integer)\n time = Time.at(time)\n end\n\n if (self.not_after < time) || (self.not_before > time)\n false\n else\n true\n end\n end",
"def time?(string)\n begin\n DateTime.strptime(string, @time_format)\n true\n rescue\n false\n end\n end",
"def valid_checkout_at?\n return if @record&.checkout_at.nil?\n return true if datetime_parsed?(@record.checkout_at.to_s)\n\n error_message = I18n.t('models.entry.errors.invalid_datetime')\n add_error_record(:checkout_at, error_message)\n end",
"def check_date_consistency(date_from_timepicker)\n\t\tparams_ok = true\n\t\tbegin\n\t\t\tdate_from_timepicker.to_datetime\n\t\trescue ArgumentError\n\t\t\tparams_ok = false\n\t\tend\n\n\t\tif date_from_timepicker == \"\"\n\t\t\tparams_ok = false\n\t\tend\n\t\tparams_ok\n\tend",
"def has_date?\n !fields.select { |f| f.responsible_for?('Date') }.empty?\n end",
"def is_date_column?(name, table_name = nil)\n case get_type_for_column(table_name, name)\n when nil\n self.class.is_date_column?(name, table_name)\n when :date\n true\n else\n false\n end\n end",
"def is_datatype?(); @type == GRT_DATATYPE; end",
"def check_for_timestamp name\n @created_at = true if name == CREATED_AT_FIELD\n @updated_at = true if name == UPDATED_AT_FIELD\n nil\n end",
"def typecast_value_datetime(value)\n Sequel.typecast_to_application_timestamp(value)\n end",
"def supports_datetime_with_precision?\n false\n end",
"def supports_datetime_with_precision?\n false\n end",
"def ==(datetime)\n return false unless DateTime === datetime\n super and hour == datetime.hour and min == datetime.min and sec == datetime.sec and usec == datetime.usec \n end",
"def end_time_is_valid?\n return false unless not_nil_and_string(self.end_time)\n return self.end_time.length > 0\n end",
"def validate_time(time)\n\t\tif time.is_a? Time\n\t\t\treturn time\n\t\telse\n\t\t\treturn Time.parse(time)\n\t\tend\n\tend",
"def time_define?\n !time.blank?\n end",
"def is_time_unit?\n self.is_numeric? && TIME_UNITS.include?(self.unit)\n end",
"def handle_time_parameter(object, time_name)\n return true if params[:no_times]\n return false unless valid_time?(object, time_name)\n if time_cleared?(object, time_name)\n reset_date_parameters(object, time_name)\n else\n set_default_date_parameters(object, time_name)\n end\n true\n end",
"def typecast_value_datetime(value)\n if convert_infinite_timestamps\n case value\n when *INFINITE_DATETIME_VALUES\n value\n else\n super\n end\n else\n super\n end\n end",
"def bson_type\n ::Time::BSON_TYPE\n end",
"def visit_date_time(binding_type)\n dt_str = DateTimeConverter.convert_from_datetime(input)\n self.result = binding_type.definition.new_value(dt_str)\n end",
"def basic_type_check(time, minutes)\n raise 'Unexpected type passed for time variable - should be string' unless time.is_a? String\n raise 'Unexpected type passed for additional_minutes variable - should be integer' unless minutes.is_a? Integer\nend",
"def check_dates_for_type\n unless self.configuracion_ciclo.nil? or is_tipo_v?\n errors[:base] << \"Debe agregar la fecha de inicio del primer extraordinario.\" if self.configuracion_ciclo.inicio_extra1.blank?\n errors[:base] << \"Debe agregar la fecha de término del primer extraordinario.\" if self.configuracion_ciclo.fin_extra1.blank?\n errors[:base] << \"Debe agregar la fecha de inicio del segundo extraordinario.\" if self.configuracion_ciclo.inicio_extra2.blank?\n errors[:base] << \"Debe agregar la fecha de término del segundo extraordinario.\" if self.configuracion_ciclo.fin_extra2.blank?\n end\n end",
"def isDateTimeFormat(str_date_time)\n\tif (@regexp_date =~ str_date_time) or (@regexp_date_time =~ str_date_time) then\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def start_datetime_should_be_less_than_finish_datetime\n errors.add(:start_date, \"をfinish_dateより前に入力してください\") unless start_datetime <= finish_datetime\n end",
"def specific?\n starts_at.is_a?(Time) && ends_at.is_a?(Time)\n end",
"def has_datatype?\n !datatype.nil?\n end",
"def validate_each(record, attr_name, value)\n before_type_cast = :\"#{attr_name}_before_type_cast\"\n\n value_before_type_cast = if record.respond_to?(before_type_cast)\n record.send(before_type_cast)\n else\n nil\n end\n\n if value_before_type_cast.present? && value.nil?\n record.errors.add(attr_name, :not_a_date, **options)\n return\n end\n\n return if (value.nil? && options[:allow_nil]) || (value.blank? && options[:allow_blank])\n\n unless value\n record.errors.add(attr_name, :not_a_date, **options)\n return\n end\n\n unless is_time?(value)\n record.errors.add(attr_name, :not_a_date, **options)\n return\n end\n\n options.slice(*CHECKS.keys).each do |option, option_value|\n option_value = option_value.call(record) if option_value.is_a?(Proc)\n option_value = record.send(option_value) if option_value.is_a?(Symbol)\n\n original_value = value\n original_option_value = option_value\n\n # To enable to_i conversion, these types must be converted to Datetimes\n if defined?(ActiveSupport::TimeWithZone)\n option_value = option_value.to_datetime if option_value.is_a?(ActiveSupport::TimeWithZone)\n value = value.to_datetime if value.is_a?(ActiveSupport::TimeWithZone)\n end\n\n if defined?(Date)\n option_value = option_value.to_datetime if option_value.is_a?(Date)\n value = value.to_datetime if value.is_a?(Date)\n end\n\n unless is_time?(option_value) && value.to_i.send(CHECKS[option], option_value.to_i)\n record.errors.add(attr_name, :\"date_#{option}\", **options.merge(\n value: original_value,\n date: (I18n.localize(original_option_value) rescue original_option_value)\n ))\n end\n end\n end",
"def timestamps?\n if (model_column_names & %w[created_on updated_on]).any?\n :legacy\n else\n (model_column_names & %w[created_at updated_at]).any?\n end\n end",
"def must_convert?\n self.big_query_conversion_column.present? && self.unit != 'seconds'\n end",
"def datetime name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :datetime, description: description, mode: mode, policy_tags: policy_tags\n end",
"def must_convert?\n big_query_conversion_column.present? && unit != 'seconds'\n end",
"def validate_time(time)\n time=~/^([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/\nend",
"def test_simple_valid_datetime\n assert_equal [11, 0], verify_and_return_datetime([10, 100], '11.0', 10)\n end",
"def validate_event_time(item)\n error(msg: 'Invalid iso8601 string', item: __method__.to_s) unless valid_iso_8601(item)\n end",
"def datetime_format\n /^\\d{4}-\\d{2}-\\d{2}\\w\\d{2}:\\d{2}:\\d{2}/\n end",
"def start_time_is_valid\n errors.add(:start_time,'Invalid empty string for start time.') unless start_time_is_valid?\n end",
"def before?(date_or_time)\n self < date_or_time\n end",
"def check_completed_at\n self.errors.add('Completion Date', 'can\\'t be blank') if (self.completed && self.completed_at.blank?)\n end",
"def time?(text)\n if datetime?(text)\n extract = Nickel.parse(text).occurrences[0].start_time\n extract.nil? ? false : true\n else\n false\n end\n\n rescue RuntimeError => e\n Failure.save_case(text, e)\n return false\n end",
"def valid_representation?(date, time)\n year, month, day = date\n hour = time.first\n\n date.nil? || !(!year.nil? && (month.nil? || day.nil?) && !hour.nil?)\n end",
"def date?\n false\n end",
"def is_date\n @is_date\n end",
"def check_dates\n # TODO the init_time must be less then the end_time\n true\n end",
"def type_literal_generic_date(column)\n :date\n end",
"def is_time_unit?\n is_numeric? && TIME_UNITS.include?(unit)\n end",
"def as_of_time\n Conversions.string_to_utc_time attributes_before_type_cast['as_of_time']\n end",
"def validate_field_types\n database_field_names.each do |field|\n field_info = self.class.get_table_info.select {|hash| hash[\"name\"] == field}.first\n check_field_value_matches_data_type(field_info, field) \n end\n @errors\n end",
"def validate_and_parsetime(value)\n return unless value\n Time.iso8601(value).getutc.to_i\n rescue ArgumentError => e\n logger.error \"Couldn't parse time from '#{value}'\"\n nil\n end",
"def expected_end\n val = super\n val = DatelessTime.new val unless val.blank?\n val\n end",
"def datetime_classes\n [DateTime, Time, defined?(FmRest::StringDateTime) && FmRest::StringDateTime].compact.freeze\n end"
] |
[
"0.7253279",
"0.7066005",
"0.695279",
"0.6949436",
"0.69007933",
"0.67179453",
"0.6636011",
"0.66234845",
"0.6473741",
"0.639751",
"0.6379868",
"0.6309361",
"0.6288109",
"0.62505186",
"0.6227763",
"0.62239206",
"0.6209907",
"0.6202373",
"0.60372734",
"0.59958756",
"0.5961784",
"0.5941888",
"0.58753765",
"0.5873891",
"0.58427733",
"0.58309853",
"0.58129215",
"0.58115077",
"0.5797985",
"0.5779718",
"0.5769834",
"0.5726008",
"0.5723108",
"0.5718658",
"0.5708668",
"0.5669469",
"0.56571054",
"0.5655123",
"0.564908",
"0.56439257",
"0.56141394",
"0.5599295",
"0.5593183",
"0.5584774",
"0.5567882",
"0.55442125",
"0.551368",
"0.5512151",
"0.5478105",
"0.54762733",
"0.5457794",
"0.54511523",
"0.5437295",
"0.54262155",
"0.54261094",
"0.5382509",
"0.53760904",
"0.53615946",
"0.53391117",
"0.5324762",
"0.5324762",
"0.5323458",
"0.52976227",
"0.5297605",
"0.5293249",
"0.52854216",
"0.52601385",
"0.52463716",
"0.5245763",
"0.52358043",
"0.52339435",
"0.521417",
"0.5208812",
"0.5203295",
"0.5191457",
"0.5188679",
"0.5182582",
"0.5181772",
"0.51751083",
"0.5172551",
"0.51666737",
"0.516294",
"0.5159001",
"0.51553124",
"0.5146973",
"0.513432",
"0.5123464",
"0.51125735",
"0.51105523",
"0.5098604",
"0.5085548",
"0.5084663",
"0.5079564",
"0.50788313",
"0.50719416",
"0.50717896",
"0.50717837",
"0.5063953",
"0.5059909",
"0.50570774"
] |
0.84741426
|
0
|
Checks if the type of the field is `DATE`.
|
def date?
type == "DATE"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def looks_like_date?(value)\n value.is_a?(Date) || value.is_a?(Time)\n end",
"def can_be_date?\n raise NoMethodError, \"This method is no longer supported.\"\n end",
"def has_date?\n !fields.select { |f| f.responsible_for?('Date') }.empty?\n end",
"def validate_date_attribute(date_type)\n value = send(\"#{date_type}_before_type_cast\")\n self[date_type] = value.is_a?(Date) || value.is_a?(Time) ? value : Time.zone.parse(value)\n if self[date_type].nil?\n errors.add(date_type, I18n.t('error.invalid_date', key: date_type.capitalize))\n end\n rescue ArgumentError, TypeError\n errors.add(date_type, I18n.t('error.invalid_date', key: date_type.capitalize))\n end",
"def is_date\n @is_date\n end",
"def is_date_column?(name, table_name = nil)\n case get_type_for_column(table_name, name)\n when nil\n self.class.is_date_column?(name, table_name)\n when :date\n true\n else\n false\n end\n end",
"def datetime?\n type == \"DATETIME\"\n end",
"def apply_validations_for_date\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Date\") if value && (! value.kind_of?(Date))\n end\n end",
"def valid_date?(date)\r\n raise CLXException, 'Date must be of type DateTime' unless date.is_a? DateTime\r\n end",
"def date_is_valid\n if !date.is_a? Date\n errors.add :date, I18n.t('activerecord.errors.invalid_date_format')\n elsif date.to_date > Date.today\n errors.add :date, I18n.t('activerecord.errors.future_date')\n end\n end",
"def is_date(*keys)\n keys.each do |key|\n matches(key, FORMATS[:date], \"#{key} must be a date in the form MM/DD/YYYY\")\n end\n end",
"def date?\n false\n end",
"def is_valid_datetime?\n Chronic.parse(@value.respond_to?(:to_date) ? @value.to_date : @value.to_s)\n end",
"def parse_and_validate_date_if_necessary(value, type)\n # note: cannot use 'case type' as that expands to === which checks for instances of rather than type equality\n if type == Date\n expect(value).to match(/^\\d{4}-\\d{2}-\\d{2}$/)\n Date.strptime(value, \"%Y-%m-%d\")\n elsif type == DateTime\n expect(value).to match(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$/)\n DateTime.strptime(value, \"%Y-%m-%dT%H:%M:%SZ\")\n else\n value\n end\n end",
"def is_date?\r\n\t\ttemp = self.gsub(/[-.\\/]/, '')\r\n\t\t['%m%d%Y','%m%d%y','%M%D%Y','%M%D%y','%d%m%y','%D%M%y'].each do |f|\r\n\t\t\tbegin\r\n\r\n\t\t\t\treturn false if Date.strptime(temp, f)\r\n\t\t\t\trescue\r\n\t\t\t\t#do nothing\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\treturn true\r\n\tend",
"def type_literal_generic_date(column)\n :date\n end",
"def has_date?\n @date == ''\n end",
"def validates_as_date(*attr_names)\n configuration = { :message => \"attribute should be of type Date\" }\n validates_each(attr_names, configuration) do |record, attr_name, value|\n unless value.is_a?(Date)\n record.errors.add(attr_name, :invalid, :default => configuration[:message], :value => value)\n end\n end\n end",
"def has_date?\n\t\t@date == ''\n\tend",
"def is_start_date_is_valid_datetime\n errors.add(:start_date, 'start date must be a valid datetime') if (:start_date.kind_of? DateTime)\n end",
"def date_parsed?(value)\n true if Date.parse(value)\n rescue ArgumentError\n false\n end",
"def is_valid?\n is_valid_datetime?\n end",
"def validate_date(date)\n begin\n Date.parse(date.to_s)\n true\n rescue ArgumentError\n false\n end\n end",
"def accepts_outcome_date?\n accepted_outcome_types.member?('date')\n end",
"def valid_date?\n !!(params[:date].match(/\\d{4}-(0[1-9]|1[0-2])-\\d{2}/)) && Date.parse(params[:date]) rescue false \n end",
"def is_valid_data_with_format?(date, reg_ex_date, obj_type)\n is_string?(date) ? (string_contains_reg_exp?(date, reg_ex_date) ? invalid_date_error_type(\"format\", obj_type) : true) : invalid_date_error_type(\"data type\", obj_type)\nend",
"def dates\n # only convert fields whose name is date* or *_date*\n # lots of other things might be 8 digits, and we have to exclude eg 'candidate'\n t.convert :field => /(^|_)date/ do |value|\n unless value.nil?\n Date.parse(value) rescue value\n end\n end\n end",
"def valid_ddmmyyyy_date_format?(date)\n is_valid_data_with_format?(date, /^(0[1-9]|[12][0-9]|3[01])[- \\/.](0[1-9]|1[012])[- \\/.](19|20)\\d\\d$/, \"Date\")\nend",
"def valid_date?(date)\n return (not DateTime.parse(date).nil?)\n rescue StandardError => e\n return false\n end",
"def match_date( val )\n\t\treturn Date.parse( val ) rescue nil\n\tend",
"def expiration_date_valid?\n expiration_date.is_a? Date\n end",
"def valid_mmddyyyy_date_format?(date)\n is_valid_data_with_format?(date, /^(0[1-9]|1[012])[- \\/.](0[1-9]|[12][0-9]|3[01])[- \\/.](19|20)\\d\\d$/, \"Date\")\nend",
"def isDate stringDate\r\n if stringDate.blank?\r\n return false\r\n elsif stringDate.is_a?(String)\r\n if date = stringDate.to_date\r\n return date\r\n end\r\n end\r\n return false\r\n end",
"def check_new_date(date, field_name)\n dt = parse_datetime_string(date)\n if dt == nil\n return false\n end\n check_now_date(dt, field_name)\n end",
"def validate_each(record, attr_name, value)\n before_type_cast = :\"#{attr_name}_before_type_cast\"\n\n value_before_type_cast = if record.respond_to?(before_type_cast)\n record.send(before_type_cast)\n else\n nil\n end\n\n if value_before_type_cast.present? && value.nil?\n record.errors.add(attr_name, :not_a_date, **options)\n return\n end\n\n return if (value.nil? && options[:allow_nil]) || (value.blank? && options[:allow_blank])\n\n unless value\n record.errors.add(attr_name, :not_a_date, **options)\n return\n end\n\n unless is_time?(value)\n record.errors.add(attr_name, :not_a_date, **options)\n return\n end\n\n options.slice(*CHECKS.keys).each do |option, option_value|\n option_value = option_value.call(record) if option_value.is_a?(Proc)\n option_value = record.send(option_value) if option_value.is_a?(Symbol)\n\n original_value = value\n original_option_value = option_value\n\n # To enable to_i conversion, these types must be converted to Datetimes\n if defined?(ActiveSupport::TimeWithZone)\n option_value = option_value.to_datetime if option_value.is_a?(ActiveSupport::TimeWithZone)\n value = value.to_datetime if value.is_a?(ActiveSupport::TimeWithZone)\n end\n\n if defined?(Date)\n option_value = option_value.to_datetime if option_value.is_a?(Date)\n value = value.to_datetime if value.is_a?(Date)\n end\n\n unless is_time?(option_value) && value.to_i.send(CHECKS[option], option_value.to_i)\n record.errors.add(attr_name, :\"date_#{option}\", **options.merge(\n value: original_value,\n date: (I18n.localize(original_option_value) rescue original_option_value)\n ))\n end\n end\n end",
"def ruby_domo_type_match?(val, domo_column_type)\n case domo_column_type\n when Java::ComDomoSdkDatasetsModel::ColumnType::DATE\n return true if val.is_a? Date\n begin\n _ = Date.parse(val)\n return true\n rescue ArgumentError\n return false\n end\n when Java::ComDomoSdkDatasetsModel::ColumnType::DATETIME\n if val.is_a? LogStash::Timestamp or val.is_a? DateTime or val.is_a? Date or val.is_a? Time\n return true\n end\n begin\n _ = DateTime.parse(val)\n return true\n rescue ArgumentError\n return false\n end\n when Java::ComDomoSdkDatasetsModel::ColumnType::LONG\n if val.is_a? Integer\n return true\n end\n begin\n _ = Integer(val)\n return true\n rescue ArgumentError\n return false\n end\n when Java::ComDomoSdkDatasetsModel::ColumnType::DOUBLE\n if val.is_a? Float\n return true\n end\n begin\n _ = Float(val)\n return true\n rescue ArgumentError\n return false\n end\n else\n true\n end\n end",
"def has_valid_format?(record)\n return (is_date?(record.start_at) and is_date?(record.end_at))\n end",
"def valid_date?(date:)\n date.respond_to?(:year) && date.year.digits.length == 4\n end",
"def warn_invalid_date; end",
"def has_date?\n header.has_date?\n end",
"def valid_date(date)\n date_regex = APP_CONFIG['ui']['dates']['regex']\n\n return !/#{date_regex}/.match(date.downcase).nil?\n end",
"def valid_date?(date)\n begin\n Date.parse(date) && date.match?(/\\d{4}\\-\\d{2}\\-\\d{2}/)\n rescue\n false\n end\n end",
"def valid_date?(date)\n date =~ %r(\\A\\d{4}\\/\\d{1,2}\\/\\d{1,2}\\z)\n end",
"def valid_time_or_date?(value)\n value.is_a?(Time) || value.is_a?(Date) || value.is_a?(ActiveSupport::TimeWithZone)\n end",
"def apply_validations_for_datetime\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Time or DateTime\") if value && (! value.kind_of?(Time)) && (value.class.name != 'DateTime')\n end\n end",
"def start_date_is_valid?\n begin\n date = USDateParse(self.start_date)\n self.start_date = date.strftime(\"%m/%d/%y\")\n rescue\n return false\n end\n return true\n end",
"def initialize_to_correct_date_type(field_info, field)\n initialize_integer(field_info, field)\n initialize_float(field_info, field)\n end",
"def hasDate?\n if self.getDateStr == \"\" then out = false else out = true end \n return out\n end",
"def date_time?(date_time)\n true if DateTime.parse(date_time)\n rescue ArgumentError\n false\n end",
"def handle_date(attrs, key, warnings)\n if attrs.has_key?(key) && attrs[key].present?\n begin\n # check if it's US looking date\n if attrs[key].respond_to?(:match) && attrs[key].match(/\\d{1,2}\\/\\d{1,2}\\/\\d{4}/)\n attrs[key] = Date.strptime(attrs[key], '%m/%d/%Y').to_s # converts to YYYY-MM-DD\n end\n\n # try to parse it as Rails will\n Date.parse(attrs[key])\n rescue => e\n warnings[key.to_sym] ||= []\n warnings[key.to_sym] << \"#{e}, use YYYY-MM-DD or MM/DD/YYYY format\"\n end\n end\n end",
"def date_is_not_ancient?(date)\n date > Date.new(1900)\n end",
"def has_date?\n format = self.format.gsub(/(\"[^\"]*\"|#|\\[[\\w.]+\\])/,'')\n \n !(format =~ /[ymdwhq]/).nil?\n end",
"def is_valid_date?(string_date, format=\"%d/%m/%Y\")\n begin\n time = Date.strptime(string_date, format)\n rescue ArgumentError\n return false\n end\n true\n end",
"def validDate\n if (Date.parse(last_reminder.to_s) rescue ArgumentError) == ArgumentError\n errors.add(:last_reminder, 'must be a valid date')\n end\n end",
"def has_dates(*attrs)\n options = attrs.extract_options!\n attrs.each do |attr|\n\n attr_reader attr\n define_reader_with_options(attr,options)\n define_method(\"#{attr.to_s}=\") do |val| \n val = val.to_date unless val.nil?\n instance_variable_set(\"@#{attr}\", val )\n attributes[attr] = val\n val\n\n end\n end\n end",
"def is_date_nil\n\t\tif @start_date.blank? && @start_time.blank?\n\t\t\terrors.add(:start_date, \"Please enter a date.\")\n\t\t\terrors.add(:start_time, \"Please enter a time.\")\n\t\tend\n\n\t\tif @start_date.blank? && @start_time.present?\n\t\t\terrors.add(:start_date, \"Please enter a date.\")\n\t\tend\n\n\t\tif @start_time.blank? && @start_date.present?\n\t\t\terrors.add(:start_time, \"Please enter a time.\")\n\t\tend\n\tend",
"def exact_date?(options = {})\n from_date(options) == to_date(options)\n end",
"def date_or_time?(row, idx)\n row.format(idx).date_or_time? && Float(read_cell_content(row, idx)) > 0 rescue false\n end",
"def validate_year_date(field)\n date = nil\n formats = [\"%d/%m/%Y\",\"%d-%m-%Y\",\"%d %m %Y\",\"%m/%d/%Y\",\"%m-%d-%Y\",\"%m %d %Y\"]\n formats.each do |format|\n if(Date.strptime(field, format) rescue false)\n date = Date.strptime(field, format)\n break\n end\n end\n unless date.nil?\n field = date.to_s.scan(/\\d*/) # Return an array with patterns matching with only numbers in it\n if field[0].length == 4\n return true\n else\n return false\n end\n else\n return false\n end\n end",
"def check_date_format\n err = \"is not valid date.\"\n errors[\"from_date\"] << err unless is_date(from_date)\n errors[\"to_date\"] << err if(to_date.present? && !is_date(to_date))\n end",
"def clean_date\n read_attribute :date\n end",
"def date(limit = nil)\n Validation.new { |d| d.is_a?(Date) && in_range?(d, limit) }\n end",
"def is_a_valid_date\n errors.add(:birthdate, \"is not a valid date.\") if birthdate.present? and birthdate > Date.current\n end",
"def time_value?(input)\n return input.is_a?(Time) || input.is_a?(Date)\n end",
"def valid_start_date?\n return true if date_parsed?(@record.start_date.to_s)\n\n error_message = I18n.t('models.user.errors.invalid_date')\n add_error_record(:start_date, error_message)\n end",
"def match?(str)\n str.match(DATE_REGEXP).nil? ? false : true\n end",
"def format_date\n begin\n self.dos = Date.strptime(self.unformatted_dos, \"%m/%d/%Y\").to_time(:utc) if !self.unformatted_dos.blank?\n rescue\n errors.add :base, \"Invalid Date(s)\"\n return false\n end\n end",
"def expect_have_field_date(rendered_or_page, field_name, field_id, value, disabled, visible, pre_selector = '')\n expect(rendered_or_page).to have_field(field_name, disabled: disabled, visible: visible, count: 1)\n expect(rendered_or_page).to have_selector(\"#{pre_selector}input[type=date][id=#{field_id}][value='#{value}']\") if visible\n expect(rendered_or_page).to have_selector(\"#{pre_selector}input[type=date][id=#{field_id}]\") unless visible\n end",
"def verify_date_requested(test_data)\n verify_values_match(test_data[UseOfCollections::DATE_REQUESTED.name], element_value(date_requested_input))\n end",
"def check_type!(expression, expected, supports_nulls = true)\n if (expected == expression[:type] && !expression.key?(:field_manipulations)) ||\n (expression.key?(:field_manipulations) && check_function_type?(expression, expected)) ||\n (supports_nulls && expression[:type] == :null)\n return true\n # If the field will be passed into a function,\n # check the type of the return value of the function\n # and coerce if necessary.\n elsif expression[:field_manipulations] &&\n expression[:type] == :integer &&\n expression[:field_manipulations][:return_type] == :decimal\n expression[:type] = :decimal\n expression[:cast] = :integer\n return true\n elsif expected == :datetime && expression[:type] == :date\n expression[:type] = :datetime\n expression[:cast] = :date\n return true\n elsif expected == :date && expression[:type] == :datetime\n expression[:type] = :date\n expression[:cast] = :datetime\n if multiple_values?(expression[:value])\n expression[:value].map! { |val| coerce_datetime val }\n else\n expression[:value] = coerce_datetime expression[:value]\n end\n return true\n elsif expected == :decimal && expression[:type] == :integer\n expression[:type] = :decimal\n expression[:cast] = :integer\n return true\n end\n\n type_error(expression, expected)\n false\n end",
"def typecast_value_date(value)\n case value\n when DateTime, Time\n Date.new(value.year, value.month, value.day)\n when Date\n value\n when String\n Sequel.string_to_date(value)\n when Hash\n Date.new(*[:year, :month, :day].map{|x| (value[x] || value[x.to_s]).to_i})\n else\n raise InvalidValue, \"invalid value for Date: #{value.inspect}\"\n end\n end",
"def verify_date_requested(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::DATE_REQUESTED.name], element_value(date_requested_input))\n end",
"def check_dates_for_type\n unless self.configuracion_ciclo.nil? or is_tipo_v?\n errors[:base] << \"Debe agregar la fecha de inicio del primer extraordinario.\" if self.configuracion_ciclo.inicio_extra1.blank?\n errors[:base] << \"Debe agregar la fecha de término del primer extraordinario.\" if self.configuracion_ciclo.fin_extra1.blank?\n errors[:base] << \"Debe agregar la fecha de inicio del segundo extraordinario.\" if self.configuracion_ciclo.inicio_extra2.blank?\n errors[:base] << \"Debe agregar la fecha de término del segundo extraordinario.\" if self.configuracion_ciclo.fin_extra2.blank?\n end\n end",
"def date_tag?(tag)\n validate_tag(tag) { |v| (v.size == 0) || (v.first.to_s =~ /^\\d\\d\\d\\d$/) }\n end",
"def get_datatype(field)\n #Remove if field has any comma's for int and float rep\n if field != nil && field.class == String\n num = field.gsub(/,/,'')\n else\n num = field\n end\n if(Integer(num) rescue false)\n if num.class == Float\n return \"float\"\n end\n return \"int\"\n elsif(Float(num) rescue false)\n return \"float\"\n elsif(Date.parse(field) or Date.strptime(field, '%m/%d/%Y') or Date.strptime(field, '%m-%d-%Y') or Date.strptime(field, '%m %d %Y') rescue false)\n if datetime_pattern(field)\n if field =~ /:/ # To check if the field contains any pattern for Hours:minutes\n return \"datetime\"\n else\n return \"date\"\n end\n end\n end\n return \"string\"\n end",
"def coerce_date(value)\n case value\n when Date\n value\n when String\n Date.parse(value)\n else\n raise ArgumentError, \"expected: Date or String, got: \" +\n value.inspect\n end\n end",
"def validate_publication_date\n if self.is_public\n errors.add(:publication_date, :is_not_a_date) if self.publication_date.blank? || !self.publication_date.kind_of?(Time)\n else\n errors.add(:publication_date, :must_be_blank_if_private) if !self.publication_date.blank?\n end\n end",
"def date_present(date)\n return unless date.is_a?(Date) || date.is_a?(String)\n\n date.present? ? format_bgs_date(date) : nil\n end",
"def single_date?\n event_type.to_sym == :single\n end",
"def datetime?\n !@arg[:datetimeValue].nil?\n end",
"def explicit_date?(date)\n \t\t!(/(?<relative_date>#{EXISTING_PATTERNS[:explicit_dates]})/.match(date)).nil?\n \tend",
"def valid_date?(date_string)\n if date_string.match(/\\d{4}-\\d{2}-\\d{2}/)\n begin\n Date.parse(date_string)\n return true\n rescue ArgumentError\n return false\n end\n else\n begin\n SycTimeleap::TimeLeap.new.send(date_string)\n return true\n rescue\n return false\n end\n end\n end",
"def v_date?(date_string)\n x = Date.parse(date_string).to_s\n y, m, d = x.split \"-\"\n Date.valid_date? y.to_i, m.to_i, d.to_i\n return true\n rescue\n return false\n end",
"def validateDate(date)\n\n year = '[1-2][90][0-9][0-9]'\n month = '0[1-9]|10|11|12'\n day = '[1-9]|0[1-9]|1[0-9]|2[0-9]|3[0-1]'\n hour = '[0-1][0-9]|2[0-3]|[1-9]'\n minute = '[0-5][0-9]'\n second = '[0-5][0-9]'\n case date\n when /^(#{year})(#{month})(#{day})$/\n identifiedDate = $1 + ':' + $2 + ':' + $3 + ' 00:00:00'\n when /^(#{year})(#{month})(#{day})(#{hour})(#{minute})(#{second})$/\n identifiedDate = $1 + ':' + $2 + ':' + $3 + ' ' + $4 + ':' + $5 + ':' + $6\n when /^(#{year})[\\:|\\.|\\-](#{month})[\\:|\\.|\\-](#{day})\\s(#{hour})[\\:](#{minute})[\\:](#{second})$/\n identifiedDate = $1 + ':' + $2 + ':' + $3 + ' ' + $4 + ':' + $5 + ':' + $6\n when /^(#{year})[\\:|\\.|\\-](#{month})[\\:|\\.|\\-](#{day})$/\n day = \"%02d\" % $3\n month = \"%02d\" % $2\n\n # Return the identified string\n $1 + ':' + month + ':' + day + ' 00:00:00'\n\n else\n\n # This wasn't a date we recognize\n false\n\n end\n end",
"def isDay date, path\n extend TCD::Common\n path_date= getDateTimeFromPath(path) rescue getDateFromPath(path)\n path_date.year==date.year and path_date.month==date.month and\n path_date.day==date.day\n end",
"def validates_datastream_date(*attr_names)\n\t\tdatastream_name, fields = attr_names\n\t\tvalues = self.datastreams[datastream_name].get_values(fields)\n \t\tif !values.empty? && !values.first.empty?\n \tvalues.each_with_index do |val,index|\n\t\t\t\tvalidates_date(val)\n\t\t\tend\n\t\tend\t\n\tend",
"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 isValidDate(dateStr)\n begin\n return (Date.parse(dateStr).class.to_s == \"Date\"), Date.parse(dateStr).to_s\n rescue\n begin\n return (Date.strptime(dateStr, \"%m/%d/%Y\").class.to_s == \"Date\"), Date.strptime(dateStr, \"%m/%d/%Y\").to_s\n rescue\n return false, nil\n end\n end\n end",
"def requires_date_and_premiere?\n result = DATE_MODES.include?(mode_desc)\n end",
"def check_date(date)\n check = /^\\d{2}\\/\\d{2}\\/\\d{4}/\n unless date =~ check\n return ''\n else\n return date\n end\n end",
"def verify_foundation_date(test_data)\n errors = []\n text_values_match?(test_data[Org::FOUNDING_DATE.name], element_value(foundation_date_input), errors)\n errors\n end",
"def type_conforms?(obj, field)\n true\n end",
"def validDate\n if (Date.parse(startDate.to_s) rescue ArgumentError) == ArgumentError\n errors.add(:startDate, 'must be a valid date')\n elsif (Date.parse(endDate.to_s) rescue ArgumentError) == ArgumentError\n errors.add(:endDate, 'must be a valid date')\n elsif startDate >= endDate\n errors.add(:endDate, 'must be after start date')\n end\n end",
"def check_in_date\n check_in && Date.parse(check_in)\n rescue ArgumentError\n # check-in parameter is not a valid date\n end",
"def datatype?(elora, die=nil)\n die = @proofsheet.die(elora.inherited_namespace, elora.absolute_xpath) if not die\n validity = true # default cdata, so valid\n if die\n if die.datatype\n dts = Datatypes.new\n if not dts.valid?(die.datatype, content(elora))\n validity = false\n error = \"DATATYPE '#{content(elora)}' :#{die.datatype}:\"\n @errors << [die.namespace, die.xpath, error]\n end\n end\n end\n return validity\n end",
"def date_classes\n [Date, defined?(FmRest::StringDate) && FmRest::StringDate].compact.freeze\n end",
"def determine_dataype(value)\n return validate_field(value)\n end",
"def verify_dissolution_date(test_data)\n errors = []\n text_values_match?(test_data[Org::DISSOLUTION_DATE.name], element_value(dissolution_date_input), errors)\n errors\n end",
"def date_class\n ::DateTime\n end",
"def valid_release_date?(date)\n # Validate date against all release date requirements\n check_no_delay_requirements(date) && check_before_date_requirements(date) && check_fixed_date_requirements(date)\n end"
] |
[
"0.76774865",
"0.74911207",
"0.74447596",
"0.7014848",
"0.6945377",
"0.6918824",
"0.6865966",
"0.6765849",
"0.6597502",
"0.6591865",
"0.65790087",
"0.652027",
"0.65072876",
"0.648048",
"0.6462714",
"0.64104706",
"0.6385692",
"0.6359112",
"0.631448",
"0.628149",
"0.6255187",
"0.62274367",
"0.61740696",
"0.6167356",
"0.61659515",
"0.615156",
"0.60990787",
"0.60813653",
"0.60614043",
"0.6027387",
"0.59843713",
"0.5979218",
"0.5953088",
"0.5945042",
"0.5939586",
"0.5904981",
"0.59043777",
"0.58874977",
"0.5837233",
"0.583489",
"0.5829507",
"0.57943475",
"0.57702225",
"0.57526636",
"0.57465917",
"0.57357043",
"0.5734539",
"0.5716746",
"0.57072",
"0.57029945",
"0.57011586",
"0.5694834",
"0.56921947",
"0.568567",
"0.5683634",
"0.5668303",
"0.5666856",
"0.56404865",
"0.5634364",
"0.5615391",
"0.5611841",
"0.5598077",
"0.55940306",
"0.5593659",
"0.55919355",
"0.5563113",
"0.5560886",
"0.5560566",
"0.55593044",
"0.5545925",
"0.55395174",
"0.55337894",
"0.5533688",
"0.5528468",
"0.55256265",
"0.55249727",
"0.5512154",
"0.5511337",
"0.5504674",
"0.5502004",
"0.54999286",
"0.54995257",
"0.5482072",
"0.5478142",
"0.5472055",
"0.5470891",
"0.5452111",
"0.54492617",
"0.5445888",
"0.54363346",
"0.5426943",
"0.54175574",
"0.53804517",
"0.53675604",
"0.53662634",
"0.5363888",
"0.5356886",
"0.5356298",
"0.53553575",
"0.5353452"
] |
0.8253281
|
0
|
Checks if the type of the field is `GEOGRAPHY`.
|
def geography?
type == "GEOGRAPHY"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def geo_object\n begin\n if r = geo_object_type # rubocop:disable Lint/AssignmentInCondition\n send(r)\n else\n false\n end\n rescue RGeo::Error::InvalidGeometry\n return nil # TODO: we need to render proper error for this!\n end\n end",
"def is_xy?(); @type == GRT_XY; end",
"def is_latlng?\n coordinates && coordinates.valid?\n end",
"def geo_json_valid?\n geo_data = RGeo::GeoJSON.decode(params.to_json)\n if !geo_data.blank?\n return true\n else\n json_response(nil, :unprocessable_entity, :invalid_geojson_type)\n return false\n end\n end",
"def geo_coded?\n !!(self.lat && self.lng)\n end",
"def geo_coded?\n !!(self.lat && self.lng)\n end",
"def geo_coded?\n !!(self.lat && self.lng)\n end",
"def valid_geometry?(solr_geom)\n return false unless solr_geom.present?\n\n # :solr_geom => \"ENVELOPE(#{w}, #{e}, #{n}, #{s})\",\n # Solr docs say: \"minX, maxX, maxY, minY order\"\n # maximum boundary: (minX=-180.0,maxX=180.0,minY=-90.0,maxY=90.0)\n match = solr_geom.match(/ENVELOPE\\(([\\d\\.\\-]+)[\\ \\,]*([\\d\\.\\-]+)[\\ \\,]*([\\d\\.\\-]+)[\\ \\,]*([\\d\\.\\-]+)\\)/)\n\n # Not parsable ENVELOPE() syntax?\n return false unless match.present?\n\n minX, maxX, maxY, minY = match.captures\n return false if minX.to_f < -180 ||\n maxX.to_f > 180 ||\n maxY.to_f > 90 ||\n minY.to_f < -90\n\n return true\nend",
"def geom_type\n FFIGeos.GEOSGeomType_r(Geos.current_handle_pointer, ptr)\n end",
"def gadm_geographic_area_type_from_row(row)\n return row['engtype_2'] if !row['name_2'].blank?\n return row['engtype_1'] if !row['name_1'].blank?\n 'Country'\n end",
"def has_location?\n # Since we require presence of both lat&lon, checking for one\n # property is good enough.\n lat.present?\n end",
"def valid?\n lat && lng\n end",
"def valid?\n lat && lng\n end",
"def check_geo_code_type\n unless ActiveRecord::Base.check_for_model_class?(self.geo_code_type)\n self.errors.add(:geo_code_type, 'should be a model class name')\n return false\n end\n return true\n end",
"def has_locationable_field?\n if latitude.blank? and longitude.blank? and address.blank?\n errors.add :base, 'You must fill in at least one field'\n end\n end",
"def latlng_good?\n self.addr_latlng && self.addr_latlng.lat && self.addr_latlng.lng\n end",
"def has_lat_long?\r\n return !lat.nil? && !long.nil?\r\n end",
"def geom_type\n# \tself.geom.geometry_n(0).geometry_type\n \"Point\" # Hard-coding for non-spaital database deployment\n end",
"def geometry_simplified_type(sql_type)\n case sql_type\n when /geography\\(point/i then :point\n when /geography\\(linestring/i then :line_string\n when /geography\\(polygon/i then :polygon\n when /geography\\(multipoint/i then :multi_point\n when /geography\\(multilinestring/i then :multi_line_string\n when /geography\\(multipolygon/i then :multi_polygon\n when /geography\\(geometrycollection/i then :geometry_collection\n when /geography/i then :geometry\n else\n super\n end\n end",
"def geocoded?\r\n super && (self.latitude != 0 && self.longitude != 0)\r\n end",
"def resembles_latlng?\n !!coordinates\n end",
"def coord_type\n @data[1]['COORDTYPE']\n end",
"def coord_type\n @data[1]['COORDTYPE']\n end",
"def geo_validation(options)\n options[:message].location.latitude.to_i == RUBIZZA[:latitude] &&\n options[:message].location.longitude.to_i == RUBIZZA[:longitude]\n end",
"def is_point?\n point_data = RGeo::GeoJSON.decode(params.to_json)\n if point_data.blank? || point_data.geometry.geometry_type.to_s != 'Point'\n json_response(nil, :unprocessable_entity, :incompatible_geomtry)\n end\n end",
"def geo_location_changed?\n self.changed.include?(\"lat\") || self.changed.include?(\"lng\")\n end",
"def is_boundary?(); @type == GRT_BOUNDARY; end",
"def geocoded?\n read_coordinates.compact.size > 0\n end",
"def geometry_simplified_type(field_type)\n case field_type\n when /linestring/i then :linestring\n when /multipoint/i then :multipoint\n when /multilinestring/i then :multilinestring\n when /multipolygon/i then :multipolygon\n when /geometrycollection/i then :geometry\n when /point/i then :point\n when /polygon/i then :polygon\n when /geometry/i then :geometry\n when /geography/i then :geography\n end\n end",
"def validation\n self.country ||= province.country\n unless !@x || !@y || @x == \"\" || @y == \"\"\n self.geom = Point.from_x_y(@x.to_f, @y.to_f)\n end\n end",
"def binary_geometry_type #:nodoc:\n 1\n end",
"def binary_geometry_type#:nodoc:\r\n 1\r\n end",
"def geom_type\n case geo_concern.class.to_s\n when /ImageWorkShowPresenter/\n 'Image'\n when /RasterWorkShowPresenter/\n 'Raster'\n when /VectorWorkShowPresenter/\n vector_geom_type\n end\n end",
"def valid?\n lat && lng && lat >= -90 && lat <= 90 && lng >= -180 && lng <= 180\n end",
"def validate_map_region\n unless region.nil? or Map.regions.include?(region.to_s)\n raise DataFormatError,\n \"Map region must be one of: #{Map.regions.join(', ')}\"\n end\n end",
"def geometry_type\n raise Error::UnsupportedOperation, \"Method Geometry#geometry_type not defined.\"\n end",
"def is_datatype?(); @type == GRT_DATATYPE; end",
"def is_valid?\n return is_closed? && (@polygon_points.length >= 3)\n end",
"def is_valid?\n return is_closed? && (@polygon_points.length >= 3)\n end",
"def validation\n self.nation ||= region.nation\n unless !@x || !@y || @x == '' || @y == ''\n self.geom = Point.from_x_y(@x.to_f, @y.to_f)\n end\n end",
"def should_geocode?\n address.present? && (address_changed? || !latitude || !longitude)\n end",
"def valid?\n !@lat.nil? && !@lon.nil? && @lat.to_f.abs < 90 && @lon.to_f.abs < 90\n end",
"def geography_columns!; end",
"def has_geomancy_feature?\n !features(:geomancy_element_shift).empty?\n end",
"def is_simple?\n raise Error::UnsupportedOperation, \"Method Geometry#is_simple? not defined.\"\n end",
"def is_match_data_type?(db_field, gw_field)\n result = true\n if gw_field.is_a? Hash\n gw_value = gw_field[\"value\"]\n else\n gw_value = gw_field\n end\n case db_field.value_data_type\n when :integer\n if gw_value.class != Fixnum\n result = false\n end\n when :float\n if gw_value.class != Float\n result = false\n end\n end\n unless result\n Rails.logger.warn \"[DeviceService][sync_with_latest_state] Data type not match\"\n Rails.logger.warn \"db_field data type: #{db_field.value_data_type.to_s}.\"\n Rails.logger.warn \"gw_field value: #{gw_value}.\"\n end\n result\n end",
"def is_regional?\n regional_code.present?\n end",
"def numeric?\n properties.include?(\"numeric\")\n end",
"def is_units?(); @type == GRT_UNITS; end",
"def check_type(type)\n %w{galera mysql}.each do |t|\n return true if t == type\n end\n false\n end",
"def should_be_float?(field_info, field)\n field_info[\"type\"] == \"REAL\"\n end",
"def geography_columns; end",
"def geo_mime_type\n if shapefile?\n 'application/zip; ogr-format=\"ESRI Shapefile\"'\n elsif tif?\n 'image/tiff; gdal-format=GTiff'\n elsif binary_grid?\n 'application/octet-stream; gdal-format=AIG'\n end\n end",
"def is_format?(); @type == GRT_FORMAT; end",
"def as_georss(options = {})\r\n dialect= options[:dialect] || :simple\r\n case(dialect)\r\n when :simple\r\n geom_attr = \"\"\r\n geom_attr += \" featuretypetag=\\\"#{options[:featuretypetag]}\\\"\" if options[:featuretypetag]\r\n geom_attr += \" relationshiptag=\\\"#{options[:relationshiptag]}\\\"\" if options[:relationshiptag]\r\n geom_attr += \" floor=\\\"#{options[:floor]}\\\"\" if options[:floor]\r\n geom_attr += \" radius=\\\"#{options[:radius]}\\\"\" if options[:radius]\r\n geom_attr += \" elev=\\\"#{options[:elev]}\\\"\" if options[:elev]\r\n \r\n georss_simple_representation(options.merge(:geom_attr => geom_attr))\r\n when :w3cgeo\r\n georss_w3cgeo_representation(options)\r\n when :gml\r\n georss_gml_representation(options)\r\n end\r\n end",
"def valid_lat_long?\n float?(latitude) && float?(longitude) &&\n latitude.to_f.between?(VALID_LATITUDE[:min], VALID_LATITUDE[:max]) &&\n longitude.to_f.between?(VALID_LONGITUDE[:min], VALID_LONGITUDE[:max])\n end",
"def geocode?\n !(address.blank? || (!latitude.blank? && !longitude.blank?))\n end",
"def gmaps\n return true if resource_type == 'Web'\n return false if read_attribute(:gmaps) == false # lets us flag entries for re-processing manually\n !(street_address_changed? or city_changed? or country_changed? or postal_changed?)\n end",
"def eucalyptus?\n resolve_cloud_type if @eucalyptus.nil?\n @eucalyptus\n end",
"def check_geocode\n unless self.latitude\n geocode\n end\n end",
"def binary_geometry_type #:nodoc:\r\n 7\r\n end",
"def is_width?(); @type == GRT_WIDTH; end",
"def as_georss(options = {})\r\n dialect= options[:dialect] || :simple\r\n case(dialect)\r\n when :simple\r\n geom_attr = \"\"\r\n geom_attr += \" featuretypetag=\\\"#{options[:featuretypetag]}\\\"\" if options[:featuretypetag]\r\n geom_attr += \" relationshiptag=\\\"#{options[:relationshiptag]}\\\"\" if options[:relationshiptag]\r\n geom_attr += \" floor=\\\"#{options[:floor]}\\\"\" if options[:floor]\r\n geom_attr += \" radius=\\\"#{options[:radius]}\\\"\" if options[:radius]\r\n geom_attr += \" elev=\\\"#{options[:elev]}\\\"\" if options[:elev]\r\n georss_simple_representation(options.merge(:geom_attr => geom_attr))\r\n when :w3cgeo\r\n georss_w3cgeo_representation(options)\r\n when :gml\r\n georss_gml_representation(options)\r\n end\r\n end",
"def coordinates_changed?\n if self.address_changed?\n unless self.lat_changed? || self.lng_changed?\n self.errors.add(:address, 'cannot be geo-located. Please try to be more specific')\n return false\n end\n end\n true\n end",
"def is_collection?\n collection_data = RGeo::GeoJSON.decode(params.to_json)\n if collection_data.blank? || !defined?(collection_data.size) || collection_data.size.blank?\n json_response(nil, :unprocessable_entity, :incompatible_geomtry)\n end\n end",
"def is_angle?(); @type == GRT_ANGLE; end",
"def geography(name, options = {})\n column(name, :geography, options)\n end",
"def is_numeric?\n self.data_type == 'number'\n end",
"def vector_geom_type\n return 'Mixed' if file_sets.nil? || file_sets.empty?\n geom_field = Solrizer.solr_name('geometry_type')\n file_sets.first.solr_document.fetch(geom_field, ['Mixed']).first\n end",
"def type_grass?\n return type?(GameData::Types::GRASS)\n end",
"def is_numeric?\n data_type == 'number'\n end",
"def numeric?\n type == \"NUMERIC\"\n end",
"def geo; end",
"def poly?\n self.class.poly?\n end",
"def has_floor\n\t\t\t@has_floor ||= block_type.present? ?\n\t\t\t!['adjacent_house', 'land'].include?(block_type.options['parent'] || block_type.name)\n\t\t\t:\n\t\t\tfalse\n\t\tend",
"def require_country?\n true\n end",
"def is_empty?\n raise Error::UnsupportedOperation, \"Method Geometry#is_empty? not defined.\"\n end",
"def file_set_format?\n geo_mime_type = file_set.solr_document.fetch(:geo_mime_type_ssim, []).first\n GeoWorks::RasterFormatService.include?(geo_mime_type) || GeoWorks::VectorFormatService.include?(geo_mime_type)\n end",
"def dev_or_test_and_have_geo_unchanged?\n (Rails.env.development? || Rails.env.test?) &&\n (!latitude.nil? && !longitude.nil?) &&\n (self.new_record? || !((self.changed & GEO_FIELDS).any?) )\n end",
"def __spatial_column_name_geos; end",
"def valid_type?\n %w[ip domain].include? type\n end",
"def geocode?\n address_changed? and (latitude.blank? or longitude.blank?)\n end",
"def valid?\n @errors = []\n validate_field_types\n \n if integer?(\"point_base\")\n if point_base < 1\n @errors << {message: \"Point base must be greater than 0.\", variable: \"point_base\"}\n end\n end\n @errors.empty?\n end",
"def map_set?\n geo_work.model_name.to_s == 'MapSet'\n end",
"def process_geo\n\t if !params[:geo].nil? && params[:geo].split(\",\").length == 2\n\t\t@lat = params[:geo].split(\",\")[0].to_f\n\t\t@lng = params[:geo].split(\",\")[1].to_f\n\t end\n\t if params[:radius].nil?\n\t\t@radius = 1.0\n\t else\n\t\t@radius = params[:radius].to_f\n\t end\n\tend",
"def geo_factory\n @geo_factory\n end",
"def geo_factory\n @geo_factory\n end",
"def size\n if location.nil?\n return 0.0\n else\n case location.geometry_type\n when RGeo::Feature::Polygon\n return location.area.to_f\n else\n return 0.0\n end\n end\n end",
"def is_valid_type(plugin)\n plugin && @MapTypes.include?(@PREFIX+plugin)\n end",
"def flux_gs2?\n\t\t\t@flux_option == \"gs2\"\n\t\tend",
"def number?\n [:double, :float, :integer, :long].include?(type)\n end",
"def valid_coordinates\n input.length == 2 && input.all? { |value| value.match? /\\A\\d+\\z/ }\n end",
"def can_be_numeric?\n type == :numeric\n end",
"def valid?\n return false if !super\n return false if @z_order_position.nil?\n type_validator = EnumAttributeValidator.new('String', ['Shape', 'Chart', 'Table', 'PictureFrame', 'VideoFrame', 'AudioFrame', 'SmartArt', 'OleObjectFrame', 'GroupShape', 'GraphicalObject', 'Connector', 'SmartArtShape', 'ZoomFrame', 'SectionZoomFrame', 'SummaryZoomFrame', 'SummaryZoomSection'])\n return false unless type_validator.valid?(@type)\n true\n end",
"def geocode?\n \t(!address.blank? && (latitude.blank? || longitude.blank?)) || address_changed?\n end",
"def use_hidden_geometry?\n end",
"def doc2layer_geom_type(doc)\n sdtstype = doc.xpath('//metadata/spdoinfo/ptvctinf/sdtsterm/sdtstype').text\n return 'Polygon' if sdtstype.match /G-polygon/i\n return 'Point' if sdtstype.match /Point/i\n return 'Line' if sdtstype.match /String/i\n\n direct = doc.xpath('//metadata/spdoinfo/direct').text\n return 'Raster' if direct.match /Raster/i\n return 'Point' if direct.match /Point/i\n return 'Polygon' if direct.match /Vector/i\n\n indspref = doc.xpath('//metadata/spdoinfo/indspref').text\n return 'Table' if indspref.match /Table/i\n\n # undetermined\n return 'UNDETERMINED'\n end",
"def geometry_type_ogrinfo(shp_filename)\n IO.popen(\"#{Settings.gdal_path}ogrinfo -ro -so -al '#{shp_filename}'\") do |file|\n file.readlines.each do |line|\n next unless line =~ /^Geometry:\\s+(.*)\\s*$/\n\n logger.debug \"generate-mods: parsing ogrinfo geometry output: #{line}\"\n return Regexp.last_match(1).gsub('3D', '').gsub('Multi', '').strip\n end\n end\n end",
"def check_address_or_lat_long\n if address.blank? and latitude.blank? and longitude.blank?\n return false\n elsif !address.blank? and latitude.blank? and longitude.blank?\n return true\n elsif address.blank? and !latitude.blank? and !longitude.blank?\n return true\n elsif !address.blank? and !latitude.blank? and !longitude.blank?\n return false\n end\n end",
"def is_on_floor_bottom\n return Sketchup.active_model.get_attribute(\"GeoReference\", \"onOceanFloor\") == \"true\";\nend"
] |
[
"0.6524741",
"0.6107748",
"0.6041386",
"0.60261095",
"0.59719145",
"0.59719145",
"0.59719145",
"0.5869683",
"0.5709475",
"0.5698675",
"0.5697295",
"0.56849015",
"0.56849015",
"0.5669533",
"0.55479497",
"0.54863834",
"0.54706085",
"0.5457221",
"0.5456846",
"0.5456844",
"0.54061013",
"0.5389888",
"0.5389888",
"0.53857887",
"0.5384687",
"0.5369555",
"0.5343606",
"0.5306579",
"0.53044224",
"0.52874887",
"0.527931",
"0.5272893",
"0.5234551",
"0.5201646",
"0.5191331",
"0.5188843",
"0.5185915",
"0.5170806",
"0.5170806",
"0.5154441",
"0.5152159",
"0.5108446",
"0.51078814",
"0.50956666",
"0.5087009",
"0.5086692",
"0.5081515",
"0.5080323",
"0.507496",
"0.5071617",
"0.50496435",
"0.5042693",
"0.5021337",
"0.5006572",
"0.50063795",
"0.49919385",
"0.49898595",
"0.49889225",
"0.49880883",
"0.49802643",
"0.49768865",
"0.4974294",
"0.4968723",
"0.49584055",
"0.49530265",
"0.49400446",
"0.49311975",
"0.49283698",
"0.49278024",
"0.49261317",
"0.49224156",
"0.49220428",
"0.4918222",
"0.49091834",
"0.49031588",
"0.4901927",
"0.48852804",
"0.488359",
"0.48784184",
"0.48662457",
"0.48541608",
"0.48515764",
"0.48374945",
"0.4829833",
"0.48222053",
"0.48221725",
"0.48221725",
"0.48157722",
"0.48138136",
"0.48064494",
"0.48052135",
"0.48039058",
"0.4789899",
"0.47767556",
"0.4775082",
"0.47663933",
"0.47652182",
"0.47629198",
"0.47628152",
"0.4762597"
] |
0.75620186
|
0
|
Checks if the type of the field is `RECORD`.
|
def record?
type == "RECORD" || type == "STRUCT"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def expect_record name, value\n expect_type name, value, \"Record\", lambda{ value.is_a?(Record) }\n end",
"def record?\n type.record?\n end",
"def uses_record_type?\n list_class.attribute_names.include?('record_type')\n end",
"def record_with_type?(record)\n record.include?(inheritance_column) && !record[inheritance_column].nil? && \n !record[inheritance_column].empty?\n end",
"def is_record_set?\n type.downcase == \"record\"\n end",
"def records?\n defined?(@record_types) and ! @record_types.empty?\n end",
"def any_records?(type)\n @records.any? { |rec| rec.is_a?(type) && rec.valid? }\n end",
"def type_of_record\n tor = @job.metadata_hash['type_of_record']\n TYPE_OF_RECORD[tor] || tor\n end",
"def type_conforms?(obj, field)\n true\n end",
"def check_record(rec)\n @mapping.each { |mapping|\n unless rec[mapping[:field_name]].blank?\n if mapping.has_key?(:format) && !mapping[:format].match(rec[mapping[:field_name]])\n Rails.logger.error([\"invalid value for field #{mapping[:name]} [#{rec[mapping[:field_name]]}]\", \"#{@filename}, line #{@linenumber}\", \"SchoolDataImporter\"].join(\" - \"))\n return false\n end\n end\n }\n return true\n end",
"def valid_record?\n status = (config['BATCH']['record_type']? parse(config['BATCH']['record_type'] ) != 'INV' : true)\n return status\n end",
"def info_only\n if @type == RECORD\n @changed_records.all? { |r| r.type == RecordChange::IGNORED }\n else\n false\n end\n end",
"def validate_as_record\n self.class.fields.each do |field|\n errors[field] = \"is required\" unless fields[field]\n end\n end",
"def a_record?\n dns.first.class == Net::DNS::RR::A if dns?\n end",
"def field?\n true \n end",
"def check_record; end",
"def record_class\n self.class.const_get(:Record)\n end",
"def recordable?(recording)\n !!open_tuner && (recording.full_size < space_available)\n end",
"def check fields, obj\r\n fields.each{ |field|\r\n if not obj.respond_to? field then\r\n return false\r\n end\r\n }\r\n return true\r\n end",
"def name(); RECORD_INFO[@type].name; end",
"def length(record)\n if type.variable?\n record[:header][:field_lengths][position]\n else\n type.length\n end\n end",
"def check_record_field assertions, input_fields, record_input_type_fields, expected_record\n count = 0\n assert_equal record_input_type_fields.length, input_fields.length\n input_fields.each do |input_field|\n expected_name = record_input_type_fields[count]\n assertions.each do |assertion|\n assertion.call(input_field, expected_name)\n end\n count += 1\n end\n end",
"def parse_record_packet\n @packet.utiny # skip first byte\n null_bit_map = @packet.read((@fields.length+7+2)/8).unpack(\"b*\").first\n rec = @fields.each_with_index.map do |f, i|\n if null_bit_map[i+2] == ?1\n nil\n else\n unsigned = f.flags & Field::UNSIGNED_FLAG != 0\n v = Protocol.net2value(@packet, f.type, unsigned)\n if v.nil? or v.is_a? Numeric or v.is_a? Time\n v\n elsif f.type == Field::TYPE_BIT or f.charsetnr == Charset::BINARY_CHARSET_NUMBER\n Charset.to_binary(v)\n else\n Charset.convert_encoding(v, @encoding)\n end\n end\n end\n rec\n end",
"def field?\n false \n end",
"def get_record_types\n get_records_with_filter {|records, record_type, offset, ptr| records.push(ptr[0])}\n end",
"def include?(record)\n # The existing implementation relies on receiving an Active Record instance as the input parameter named record.\n # Any non-Active Record object passed to this implementation is guaranteed to return `false`.\n return false unless record.is_a?(klass)\n\n if loaded? || offset_value || limit_value || having_clause.any?\n records.include?(record)\n else\n id = if record.class.composite_primary_key?\n record.class.primary_key.zip(record.id).to_h\n else\n record.id\n end\n\n exists?(id)\n end\n end",
"def is_a_recording?\n manifestation_type.manifestation_type_category == 2\n end",
"def should_be_integer?(field_info, field)\n field_info[\"type\"] == \"INTEGER\"\n end",
"def has_field?(field_name); end",
"def get_type\n return @resource[:record_type]\n end",
"def check_object_type(record, attribute, value)\n return unless value && value['objectType']\n unless value && value['objectType'] && (value['objectType'] == 'Agent' || value['objectType'] == 'Group')\n record.errors[attribute] << (options[:message] || \"invalid agent object type\")\n end\n end",
"def get_record_type_code\n @record_type_code\n end",
"def type\n record.class.name or super\n end",
"def type_of_field_in_database(class_name, field_name)\n all_fields = class_name.get_table_info\n all_fields.each do |field|\n if field[\"name\"] == field_name\n return field[\"type\"]\n end\n end\n false\n end",
"def _record_changed?(reflection, record, key)\n record.new_record? ||\n (association_foreign_key_changed?(reflection, record, key) ||\n inverse_polymorphic_association_changed?(reflection, record)) ||\n record.will_save_change_to_attribute?(reflection.foreign_key)\n end",
"def record(recording)\n if recordable?(recording)\n tuner = open_tuner\n current_recordings[tuner] = recording\n current_recordings[tuner].record!\n\n tuner\n else\n false \n end\n end",
"def record_exist?(fqdn, type)\n\n matches = find_match(@dnss.records, fqdn, true)\n if matches != nil\n record = nil\n matches.each do |record|\n Puppet.debug \"inspecting #{record.hash_type} == #{type}\"\n if record.hash_type.to_s == type.to_s\n Puppet.notice \"found dns record : #{fqdn}, #{type}\"\n return true\n end\n end\n else\n Puppet.debug \"match found no record : #{fqdn}, #{type}\"\n end\n Puppet.debug \"record not found : #{fqdn}, #{type}\"\n return false\n end",
"def is_match_data_type?(db_field, gw_field)\n result = true\n if gw_field.is_a? Hash\n gw_value = gw_field[\"value\"]\n else\n gw_value = gw_field\n end\n case db_field.value_data_type\n when :integer\n if gw_value.class != Fixnum\n result = false\n end\n when :float\n if gw_value.class != Float\n result = false\n end\n end\n unless result\n Rails.logger.warn \"[DeviceService][sync_with_latest_state] Data type not match\"\n Rails.logger.warn \"db_field data type: #{db_field.value_data_type.to_s}.\"\n Rails.logger.warn \"gw_field value: #{gw_value}.\"\n end\n result\n end",
"def record_type(type)\n @record_types[type.intern]\n end",
"def type\n name = self.class.name.split('::').last\n return '<type>' if name == 'Record'\n name\n end",
"def single_data_value?\n RECORD_INFO[type].single_data_value?\n end",
"def record_text_for(name)\n (!@record.respond_to?(name) and name[0,1] == '_') ? '_record' : 'record'\nend",
"def record_text_for(name)\n (!@record.respond_to?(name) and name[0,1] == '_') ? '_record' : 'record'\nend",
"def raise_on_type_mismatch!(record)\n unless record.is_a?(reflection.klass)\n fresh_class = reflection.class_name.safe_constantize\n unless fresh_class && record.is_a?(fresh_class)\n message = \"#{reflection.class_name}(##{reflection.klass.object_id}) expected, \"\\\n \"got #{record.inspect} which is an instance of #{record.class}(##{record.class.object_id})\"\n raise ActiveRecord::AssociationTypeMismatch, message\n end\n end\n end",
"def can_add?( record, type = '*' )\n return false unless can_change?( record, type )\n\n return false if !allow_new_records?\n\n true\n end",
"def handle_record_line(line, record)\n ret = nil\n if record.respond_to?(:process)\n if ret = record.send(:process, line.dup)\n unless ret.is_a?(Hash)\n raise Puppet::DevError,\n \"Process record type #{record.name} returned non-hash\"\n end\n else\n return nil\n end\n elsif regex = record.match\n # In this case, we try to match the whole line and then use the\n # match captures to get our fields.\n if match = regex.match(line)\n fields = []\n ret = {}\n record.fields.zip(match.captures).each do |field, value|\n if value == record.absent\n ret[field] = :absent\n else\n ret[field] = value\n end\n end\n else\n nil\n end\n else\n ret = {}\n sep = record.separator\n\n # String \"helpfully\" replaces ' ' with /\\s+/ in splitting, so we\n # have to work around it.\n if sep == \" \"\n sep = / /\n end\n line_fields = line.split(sep)\n record.fields.each do |param|\n value = line_fields.shift\n if value and value != record.absent\n ret[param] = value\n else\n ret[param] = :absent\n end\n end\n\n if record.rollup and ! line_fields.empty?\n last_field = record.fields[-1]\n val = ([ret[last_field]] + line_fields).join(record.joiner)\n ret[last_field] = val\n end\n end\n\n if ret\n ret[:record_type] = record.name\n return ret\n else\n return nil\n end\n end",
"def include_record?(record_id)\n @records.include?(record_id)\n end",
"def is_serial?\n @job.metadata_hash['type_of_record'] == \"as\"\n end",
"def has_fields?\n num_fields > 0\n end",
"def field_type field\n case field\n when Symbol then members_types[field]\n # when Array\n # if field.length > 1 then members_types[field.first].field_type(field[1..-1])\n # else field_type field.first\n # end\n end\n end",
"def fields_for(record_name, record_object = T.unsafe(nil), fields_options = T.unsafe(nil), &block); end",
"def null?(record)\n type.nullable? && record[:header][:field_nulls][position]\n end",
"def recordable?\n (Time.now + recording_start_time_delta > start_time) && \\\n Time.now < end_time\n end",
"def embed_records?\n !!@embedded\n end",
"def handles?(field); end",
"def is_control_record\n false\n end",
"def autofill_record?(record)\n return false if @autofill_record.nil?\n\n record.position == @autofill_record.position\n end",
"def new_record?(object)\n object[\"UID\"].nil? || object[\"UID\"] == \"\"\n end",
"def defined?(path, record)\n field_validator = JsonFieldValidator.new\n is_defined = field_validator.defined?(path[0], record)\n @@output.concat(field_validator.debug_output)\n unless is_defined\n @@defined_error_msg = field_validator.error_message\n end # unless\n return is_defined\n end",
"def valid_record?( record )\n !record[:name].nil? and !record[:type].nil? and !record[:value].nil? and\n !record[:name].empty? and !record[:type].empty? and !record[:value].empty?\nend",
"def activerecord?\n record.is_a?(::ActiveRecord::Base)\n end",
"def node_field?(field)\n type = field.type.unwrap\n kind = type.kind\n\n if kind.object?\n node_types.include?(type)\n elsif kind.interface? || kind.union?\n possible_node_types(type).any?\n end\n end",
"def data_match_field_type field\n\t\tfield = field.to_s\n\t\tif field[-2,2] == 'id'\n\t\t\ttype = Scfg[:field_number][0]\n\t\telsif Scfg[:field_fixnum].include? field\n\t\t\ttype = 'Fixnum'\n\t\telsif Scfg[:field_time].include? field\n\t\t\ttype = 'Time'\n\t\telse\n\t\t\ttype = 'String'\n\t\tend\n\t\ttype\n\tend",
"def get_records_of_type requested_record_type\n ui2 = @records_unpacked\n records = []\n\n ui2_size = ui2.size\n offset = 0\n ptr = ui2\n record_byte_offset = 0\n record_type_array = Array(requested_record_type)\n\n while(offset < ui2_size) do\n curr_record_type = ptr[offset]\n record_size = ptr[offset+1]\n\n offset += (record_size/2)\n\n #yield records, curr_record_type, offset, ptr\n #do |records, record_type, offset, ptr|\n if record_type_array.include? curr_record_type\n #records.push(ptr[record_byte_offset...record_byte_offset+record_size].pack('S>*'))\n records.push(@records_packed[record_byte_offset...record_byte_offset+record_size])\n end\n #end\n\n record_byte_offset += record_size\n #ptr = ptr[(record_size/2)..-1]\n end\n\n records\n end",
"def typed?\n type != :object\n end",
"def has_field?(field_name)\n @data.has_key?(AudioMetadata.field_name_for(field_name))\n end",
"def fields?; @fields; end",
"def handle_text_line(line, record)\n line =~ record.match ? {:record_type => record.name, :line => line} : nil\n end",
"def e_reader_kindle?\n item_fields(record).find do |field|\n field.subfields.select { |sf| sf.code == 'h' }.find { |sfc| sfc.value.downcase.include?('kindle') }\n end\n end",
"def record_type=(record_type)\n validator = EnumAttributeValidator.new('String', [\"ServiceTicket\", \"ProjectTicket\", \"ProjectIssue\"])\n unless validator.valid?(record_type)\n fail ArgumentError, \"invalid value for 'record_type', must be one of #{validator.allowable_values}.\"\n end\n @record_type = record_type\n end",
"def fields_for(record_name, record_object = T.unsafe(nil), options = T.unsafe(nil), &block); end",
"def record?(group)\n data_offset?(@lsn_offset, group)\n end",
"def has_record?(record)\n table.has_key?(lookup_key_for(record))\n end",
"def is_datatype?(); @type == GRT_DATATYPE; end",
"def avro?\n @gapi.source_format == \"AVRO\"\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 can_display_in?(screen, field)\n return self.kind == field.kind\n end",
"def validate #:nodoc:\n unless self.record_type.nil?\n record = build\n record.errors.each do |k,v|\n next if k == \"zone_id\" # skip associations we don't have\n\n self.errors.add( k, v )\n end unless record.valid?\n end\n end",
"def record_to_object(record)\n record\n end",
"def field? key\n @schema.field? key\n end",
"def method_missing name, *args, &block\n if name.to_s =~ /^(.+)_fields$/\n self.fields.select {|f| f.data_type.to_s.parameterize.underscore == $1 } || super\n else \n super\n end\n end",
"def check_for_object(runner, workspace, idf_object, idd_object_type)\r\n workspace.getObjectsByType(idd_object_type).each do |object|\r\n # all of these objects fields are data fields\r\n if idf_object.dataFieldsEqual(object)\r\n return true\r\n end\r\n end\r\n return false\r\n end",
"def datetime?\n type == \"DATETIME\"\n end",
"def record_expr(record = 'record_of_the_death')\n record\n end",
"def has_field?(field_)\n case field_\n when Schema::Field\n @_field_path.include?(field_)\n when ::Integer\n @_field_path.size > field_ && field_ >= 0\n when ::String, ::Symbol\n @_values.has_key?(@_format.schema.canonical_name(field_))\n else\n raise ::ArgumentError\n end\n end",
"def pbGetCsvRecord(rec,lineno,schema)\r\n record = []\r\n repeat = false\r\n start = 0\r\n if schema[1][0,1]==\"*\"\r\n repeat = true\r\n start = 1\r\n end\r\n begin\r\n for i in start...schema[1].length\r\n chr = schema[1][i,1]\r\n case chr\r\n when \"i\" # Integer\r\n record.push(csvInt!(rec,lineno))\r\n when \"I\" # Optional integer\r\n field = csvfield!(rec)\r\n if nil_or_empty?(field)\r\n record.push(nil)\r\n elsif !field[/^\\-?\\d+$/]\r\n raise _INTL(\"Field {1} is not an integer\\r\\n{2}\",field,FileLineData.linereport)\r\n else\r\n record.push(field.to_i)\r\n end\r\n when \"u\" # Positive integer or zero\r\n record.push(csvPosInt!(rec,lineno))\r\n when \"U\" # Optional positive integer or zero\r\n field = csvfield!(rec)\r\n if nil_or_empty?(field)\r\n record.push(nil)\r\n elsif !field[/^\\d+$/]\r\n raise _INTL(\"Field '{1}' must be 0 or greater\\r\\n{2}\",field,FileLineData.linereport)\r\n else\r\n record.push(field.to_i)\r\n end\r\n when \"v\" # Positive integer\r\n field = csvPosInt!(rec,lineno)\r\n raise _INTL(\"Field '{1}' must be greater than 0\\r\\n{2}\",field,FileLineData.linereport) if field==0\r\n record.push(field)\r\n when \"V\" # Optional positive integer\r\n field = csvfield!(rec)\r\n if nil_or_empty?(field)\r\n record.push(nil)\r\n elsif !field[/^\\d+$/]\r\n raise _INTL(\"Field '{1}' must be greater than 0\\r\\n{2}\",field,FileLineData.linereport)\r\n elsif field.to_i==0\r\n raise _INTL(\"Field '{1}' must be greater than 0\\r\\n{2}\",field,FileLineData.linereport)\r\n else\r\n record.push(field.to_i)\r\n end\r\n when \"x\" # Hexadecimal number\r\n field = csvfield!(rec)\r\n if !field[/^[A-Fa-f0-9]+$/]\r\n raise _INTL(\"Field '{1}' is not a hexadecimal number\\r\\n{2}\",field,FileLineData.linereport)\r\n end\r\n record.push(field.hex)\r\n when \"X\" # Optional hexadecimal number\r\n field = csvfield!(rec)\r\n if nil_or_empty?(field)\r\n record.push(nil)\r\n elsif !field[/^[A-Fa-f0-9]+$/]\r\n raise _INTL(\"Field '{1}' is not a hexadecimal number\\r\\n{2}\",field,FileLineData.linereport)\r\n else\r\n record.push(field.hex)\r\n end\r\n when \"f\" # Floating point number\r\n record.push(csvFloat!(rec,lineno))\r\n when \"F\" # Optional floating point number\r\n field = csvfield!(rec)\r\n if nil_or_empty?(field)\r\n record.push(nil)\r\n elsif !field[/^\\-?^\\d*\\.?\\d*$/]\r\n raise _INTL(\"Field {1} is not a floating point number\\r\\n{2}\",field,FileLineData.linereport)\r\n else\r\n record.push(field.to_f)\r\n end\r\n when \"b\" # Boolean\r\n record.push(csvBoolean!(rec,lineno))\r\n when \"B\" # Optional Boolean\r\n field = csvfield!(rec)\r\n if nil_or_empty?(field)\r\n record.push(nil)\r\n elsif field[/^1|[Tt][Rr][Uu][Ee]|[Yy][Ee][Ss]|[Tt]|[Yy]$/]\r\n record.push(true)\r\n else\r\n record.push(false)\r\n end\r\n when \"n\" # Name\r\n field = csvfield!(rec)\r\n if !field[/^(?![0-9])\\w+$/]\r\n raise _INTL(\"Field '{1}' must contain only letters, digits, and\\r\\nunderscores and can't begin with a number.\\r\\n{2}\",field,FileLineData.linereport)\r\n end\r\n record.push(field)\r\n when \"N\" # Optional name\r\n field = csvfield!(rec)\r\n if nil_or_empty?(field)\r\n record.push(nil)\r\n elsif !field[/^(?![0-9])\\w+$/]\r\n raise _INTL(\"Field '{1}' must contain only letters, digits, and\\r\\nunderscores and can't begin with a number.\\r\\n{2}\",field,FileLineData.linereport)\r\n else\r\n record.push(field)\r\n end\r\n when \"s\" # String\r\n record.push(csvfield!(rec))\r\n when \"S\" # Optional string\r\n field = csvfield!(rec)\r\n record.push((nil_or_empty?(field)) ? nil : field)\r\n when \"q\" # Unformatted text\r\n record.push(rec)\r\n rec = \"\"\r\n when \"Q\" # Optional unformatted text\r\n if nil_or_empty?(rec)\r\n record.push(nil)\r\n else\r\n record.push(rec)\r\n rec = \"\"\r\n end\r\n when \"e\" # Enumerable\r\n record.push(csvEnumField!(rec,schema[2+i-start],\"\",FileLineData.linereport))\r\n when \"E\" # Optional enumerable\r\n field = csvfield!(rec)\r\n record.push(checkEnumFieldOrNil(field,schema[2+i-start]))\r\n when \"y\" # Enumerable or integer\r\n field = csvfield!(rec)\r\n record.push(csvEnumFieldOrInt!(field,schema[2+i-start],\"\",FileLineData.linereport))\r\n when \"Y\" # Optional enumerable or integer\r\n field = csvfield!(rec)\r\n if nil_or_empty?(field)\r\n record.push(nil)\r\n elsif field[/^\\-?\\d+$/]\r\n record.push(field.to_i)\r\n else\r\n record.push(checkEnumFieldOrNil(field,schema[2+i-start]))\r\n end\r\n end\r\n end\r\n break if repeat && nil_or_empty?(rec)\r\n end while repeat\r\n return (schema[1].length==1) ? record[0] : record\r\n end",
"def field?(name)\n ! self[name].nil?\n end",
"def should_be_a_record?\n !pages_domain? && apex_domain?\n end",
"def length(record)\n if record.header.lengths.include?(@name)\n len = record.header.lengths[@name]\n raise \"Fixed-length mismatch\" unless variable? || len == @data_type.width\n else\n len = @data_type.width\n end\n extern?(record) ? len - EXTERN_FIELD_SIZE : len\n end",
"def allowed?(val)\n case ftype\n when 'string', 'url'\n val.is_a?(String)\n when 'number'\n val.is_a?(Integer) || val.is_a?(Float)\n when 'sample'\n allowable_field_types.collect { |aft| aft.sample_type.id }.member? val.sample_type_id\n when 'item'\n allowable_field_types.collect { |aft| aft.object_type.id }.member? val.object_type_id\n end\n end",
"def new_line_type(record)\n @record_types ||= {}\n @record_order ||= []\n\n raise ArgumentError, \"Line type #{record.name} is already defined\" if @record_types.include?(record.name)\n\n @record_types[record.name] = record\n @record_order << record\n\n record\n end",
"def any_fields?\n num_fields.positive?\n end",
"def process_record(record, data)\n length = if data.nil?\n 0\n else\n data.length\n end\n Rails.logger.info(data.to_s)\n warn(\"ShardId: #{@shard_id}, Partition Key: #{record['partitionKey']}, Sequence Number:#{record['sequenceNumber']}, Length of data: #{length}\")\n rescue StandardError => e\n warn \"#{e}: Failed to process record '#{record}'\"\n end",
"def test_a_recordset\n recordset = @wddx.data[\"aRecordset\"]\n assert recordset.kind_of?(WDDX::RecordSet)\n\n assert_equal [\"John Doe\", \"Jane Doe\"], recordset.fetch_fields(\"NAME\")\n assert_equal [34, 31], recordset.fetch(\"AGE\") \n end",
"def read(record, cursor)\n return :NULL if null?(record)\n cursor.name(type.name) { type.reader.read(record, cursor, length(record)) }\n end",
"def time_in_record? time, record\n return false if record.end_time == :running\n time >= record.start_time && time <= record.end_time\n end",
"def respond_to?(field)\n key = field.to_s\n key.chomp!('=')\n\n return true if @values.any? {|(name, _)| name == key}\n super\n end",
"def caprese_is_field?(field)\n respond_to?(field = field.to_sym) || caprese_is_attribute?(field) || self.class.caprese_field_aliases[field]\n end",
"def new_record?(object)\n false\n end",
"def process_record(record, data)\n begin\n if data.nil?\n length = 0\n else\n length = data.length\n end\n STDERR.puts(\"ShardId: #{@shard_id}, Partition Key: #{record['partitionKey']}, Sequence Number:#{record['sequenceNumber']}, Length of data: #{length}\")\n rescue => e\n STDERR.puts \"#{e}: Failed to process record '#{record}'\"\n end\n end"
] |
[
"0.6796277",
"0.6785496",
"0.66050035",
"0.65891266",
"0.6562007",
"0.6303785",
"0.613521",
"0.61300427",
"0.6009332",
"0.6004249",
"0.5814604",
"0.56702024",
"0.5624154",
"0.56034684",
"0.554095",
"0.54789495",
"0.54681534",
"0.5450118",
"0.5432151",
"0.5392479",
"0.53802425",
"0.53608805",
"0.534265",
"0.5342269",
"0.5326606",
"0.5294863",
"0.5285085",
"0.52843004",
"0.52467185",
"0.5238776",
"0.5232332",
"0.52161086",
"0.52068365",
"0.51985955",
"0.5186666",
"0.517449",
"0.5167301",
"0.5153428",
"0.5148803",
"0.5144968",
"0.51341075",
"0.5133992",
"0.5133992",
"0.50968105",
"0.5096061",
"0.50866663",
"0.5073354",
"0.5073178",
"0.5071777",
"0.506092",
"0.5057245",
"0.50534874",
"0.5050862",
"0.5042743",
"0.5036059",
"0.50312257",
"0.5028822",
"0.5021241",
"0.50132126",
"0.5009815",
"0.500468",
"0.49935967",
"0.4990825",
"0.49706972",
"0.49678588",
"0.4959852",
"0.4953655",
"0.49523488",
"0.4946301",
"0.49372512",
"0.49359468",
"0.49343652",
"0.49326172",
"0.4931724",
"0.49264723",
"0.4908365",
"0.49070448",
"0.49025893",
"0.48943102",
"0.48941937",
"0.48783666",
"0.48714098",
"0.48714045",
"0.48591298",
"0.48572066",
"0.48543414",
"0.4851998",
"0.48516747",
"0.48513004",
"0.48487046",
"0.4844516",
"0.4843293",
"0.48426756",
"0.48413178",
"0.48407918",
"0.48391742",
"0.4838597",
"0.48343658",
"0.48337987",
"0.4823499"
] |
0.7889294
|
0
|
The nested fields if the type property is set to `RECORD`. Will be empty otherwise.
|
def fields
if frozen?
Array(@gapi.fields).map { |f| Field.from_gapi(f).freeze }.freeze
else
Array(@gapi.fields).map { |f| Field.from_gapi f }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fields\n return @fields if defined?(@fields)\n\n @fields = array_of_items_for(Fields, :fields)\n end",
"def nested_object_fields\n @nested_object_fields\n end",
"def fields\n self.class.fields(true)\n end",
"def all_fields\n found_fields = Array.new\n self.fields.each do |field|\n found_fields << field\n found_fields = found_fields + field.all_fields if field.type == 'ObjectField'\n end\n found_fields\n end",
"def fields\n raw['fields']\n end",
"def fields\n []\n end",
"def fetch_fields\n @fields\n end",
"def fields\n @fields\n end",
"def fields\n @fields\n end",
"def fields\n @fields ||= []\n end",
"def fields\n @fields\n end",
"def fields\n FIELDS\n end",
"def fields\n @fields ||= []\n end",
"def fields\n FIELDS\n end",
"def fields\n FIELDS\n end",
"def fields\n @fields ||= begin\n default_fields\n end\n end",
"def fields\n @fields ||= {}\n end",
"def fields\n @fields ||= {}\n end",
"def fields\n @fields ||= {}\n end",
"def fields\n @fields ||= {}\n end",
"def fields\n @fields ||= {}\n end",
"def fields\n all_fields\n end",
"def fields\n self.class.fields\n end",
"def fields\n properties.keys.map(&:to_sym).reject{ |x| x == :type }\n end",
"def fields\n nil\n end",
"def fields\n self.class.fields\n end",
"def fields\n self.class.fields\n end",
"def fields\n self.class.fields\n end",
"def fields\n self.class.fields\n end",
"def flattened_fields\n metadata_string = String.from_java_bytes @reader.getMetadata\n description_text = self.class.description_from_metadata_xml(metadata_string)\n begin\n metadata = JSON(description_text)\n flattened_fields = metadata.key?('jpdfer_flattened_fields') ? metadata['jpdfer_flattened_fields'] : {}\n rescue JSON::ParserError\n flattened_fields = {}\n end\n flattened_fields.each_with_object({}) do |(name, value), fields|\n fields[name.to_sym] = value\n end\n end",
"def all_fields\n fields.values\n end",
"def fields\n schema.fields\n end",
"def get_fields(payload)\n payload['fields']\n end",
"def fields\n @fields.keys\n end",
"def fields\n @fields.keys\n end",
"def fields\n schema.fields\n end",
"def fields\n schema.fields\n end",
"def fields\n schema.fields\n end",
"def all_fields\n @fields.values\n end",
"def fields\n @_fields ||= {}\n end",
"def fields\n @fields ||= FieldList.new\n end",
"def fields\n @fields ||= @stats.keys.select{ |k| k != RECORDS_LISTING_KEY}.flatten.uniq\n end",
"def fields\n @fields ||= @raw_message[1]\n end",
"def fields\n @fields ||= form.fields\n end",
"def fields\n self.class.fields\n end",
"def fields; h.fields; end",
"def fields\n preview_json['fields']\n end",
"def get_fields()\n return @api.do_request(\"GET\", get_base_api_path() + \"/fields\")\n end",
"def fields?; @fields; end",
"def fields_from_record(options = {})\n field_attributes = _filter_field_attributes(options)\n field_attributes += [ options.fetch(:include, []) ]\n field_attributes.flatten!\n field_attributes.compact!\n field_attributes.uniq!\n\n field_attributes = field_attributes.inject({}) do |hash, field|\n if _protobuf_field_transformers.has_key?(field)\n hash[field] = _protobuf_field_transformers[field].call(self)\n else\n value = respond_to?(field) ? __send__(field) : nil\n hash[field] = _protobuf_convert_attributes_to_fields(field, value)\n end\n hash\n end\n\n field_attributes\n end",
"def fields; end",
"def fields; end",
"def fields; end",
"def fields #:nodoc:\n f = @properties.to_a\n last = f.pop\n f.push @elements\n f.push last\n end",
"def get_fields(template)\n read(template).fields\n end",
"def nested_attributes\n []\n end",
"def to_a; @fields end",
"def record_fields\n record_format.values_at(:key, :sys, :row).flatten.sort_by(&:position) if record_format\n end",
"def fields\n self.class::FIELDS\n end",
"def fields\n self.class::FIELDS\n end",
"def fields\n self.class::FIELDS\n end",
"def result_fields\n @fields ||= result_meta.collect { |m| m.name }\n end",
"def fetch_fields\n @result.fetch_fields\n end",
"def fields(field_hash = {})\n @fields.merge!(field_hash) unless field_hash.empty?\n @fields\n end",
"def fields\n collection(\"profiles/fields\")\n end",
"def record_fields\n mappings = {}\n\n mappings['identifier'] = self.record.identifier || self.record['identifier']\n mappings['publish'] = self.record['publish']\n mappings['level'] = self.record.level || self.record['level']\n mappings['title'] = strip_mixed_content(self.record['title'])\n mappings['uri'] = self.record.uri || self.record['uri']\n\n resolved_resource = self.record['_resolved_resource'] || self.record.resolved_resource\n if resolved_resource\n resource_obj = resolved_resource[self.record['resource']]\n if resource_obj\n mappings['collection_id'] = \"#{resource_obj[0]['id_0']} #{resource_obj[0]['id_1']} #{resource_obj[0]['id_2']} #{resource_obj[0]['id_3']}\".rstrip\n mappings['collection_title'] = resource_obj[0]['title']\n end\n end\n\n resolved_repository = self.record.resolved_repository\n if resolved_repository\n mappings['repo_code'] = resolved_repository['repo_code']\n mappings['repo_name'] = resolved_repository['name']\n end\n\n if record['creators']\n mappings['creators'] = self.record['creators']\n .select { |cr| cr.present? }\n .map { |cr| cr.strip }\n .join(\"; \")\n end\n\n if record.notes\n accessrestrict = record.notes['accessrestrict']\n if accessrestrict\n arSubnotes = accessrestrict['subnotes']\n if arSubnotes\n mappings['accessrestrict'] = arSubnotes\n .select { |arSubnote| arSubnote['content'].present? }\n .map { |arSubnote| arSubnote['content'].strip }\n .join(\"; \")\n end\n end\n end\n\n return mappings\n end",
"def info_hash\n @fields\n end",
"def values\n record && record.to_hash(fields)\n end",
"def fields()\n @@defined_subclass_field_lists[self.class]\n end",
"def fields\n class_name.constantize.fields\n end",
"def contents_fields\n []\n end",
"def fields_on_form #:nodoc:\r\n form_fields = []\r\n if @form['form']['fields']\r\n # read only field elements (key is Integer)\r\n @form['form']['fields'].each { |key, options| form_fields << options if key.class == Integer }\r\n else\r\n @form['form']['tabs'].keys.each do |tab|\r\n @form['form']['tabs'][tab].each { |key, options| form_fields << options if key.class == Integer }\r\n end \r\n end\r\n form_fields\r\nend",
"def fields()\n if !@custom_fields || @fields.length == 0 then\n @elements.each { |field|\n if field.respond_to?(:is_form_field) then\n @fields << field.name\n @element_map[field.name.to_s] = field\n elsif field.is_a?(Fieldset) then\n @fields << { field.name => field.fields }\n @element_map.update(field.element_map)\n end\n }\n end\n @fields.uniq!\n return @fields\n end",
"def model_fields(collection)\n records = []\n model = collection.classify.constantize\n document = model.new\n# p document.methods\n document.attribute_names.each do |attribute_name|\n options = model.fields[attribute_name].options\n description = I18n.t(\"helpers.help.#{collection}.#{attribute_name}\")\n description = I18n.t(\"helpers.label.#{collection}.#{attribute_name}\") if description.match('missing:')\n description = attribute_name if description.match('missing:')\n\n records.push( {'collection' => collection, \n 'field' => attribute_name, \n 'type' => options[:type],\n 'description' => description, \n '_default' => options[:default]\n } )\n end\n# embedded documents\n document.embedded_relations.each do |a_embedded|\n embedded = a_embedded.last\n description = I18n.t(\"helpers.help.#{collection}.#{embedded.key}\")\n description = I18n.t(\"helpers.label.#{collection}.#{embedded.key}\") if description.match('missing:')\n description = embedded.key if description.match('missing:')\n\n records.push( {'collection' => collection, \n 'field' => embedded.key, \n 'type' => 'Embedded:' + embedded.class_name,\n 'description' => description\n } )\n end\n#p records\n records\nend",
"def reflect_fields\n send_and_receive('admin/luke', params: { fl: '*', 'json.nl' => 'map' })['fields']\n end",
"def has_flattened_fields?\n flattened_fields.size > 0 ? true : false\n end",
"def show_fields\n self.class.fields.values.select { |field| field.show }\n end",
"def fields_on_form() #:nodoc:\r\n fields = []\r\n if @form['form']['fields']\r\n# read only field elements (key is Fixnum)\r\n @form['form']['fields'].each {|key,options| fields << options if key.class == Fixnum }\r\n else\r\n @form['form']['tabs'].keys.each do |tab|\r\n @form['form']['tabs'][tab].each {|key,options| fields << options if key.class == Fixnum }\r\n end \r\n end\r\n fields\r\nend",
"def non_relationship_fields\n self.fields.select { |field| !field.is_relationship? }\n end",
"def get_fields(template); end",
"def fields\n @fields ||= self.class.fields.collect { |f| f.clone_for(self) }\n end",
"def fields\n displayed_fields = @display_fields.select { |display_field| @document.key?(display_field) }\n pairs = displayed_fields.map do |display_field|\n [display_field, Array.wrap(@document.fetch(display_field))]\n end\n Hash[pairs]\n end",
"def get_field_list\n return make_request(\"#{self.endpoint}/list/fields\")\n end",
"def field_types\r\n return @field_types\r\n end",
"def fields!\n @schema.fields!\n end",
"def get_fields(type)\n @instrumented_field_map[type.name]\n end",
"def get_fields\n FIELD_DESCS\n end",
"def fields\n missing_method :fields\n end",
"def labor_request_all_fields\n LaborRequest.fields\n end",
"def standard_document_fields\n if object.standard_document\n doc_fields = object.standard_document.standard_document_fields + object.document_fields\n ActiveModel::ArraySerializer.new(doc_fields,\n each_serializer: BaseDocumentFieldSerializer,\n scope: { current_user: current_user, document_id: object.id, skip_secure_value: true },\n root: false)\n else\n []\n end\n end",
"def fields\n fields = orig_fields\n\n fields.instance_exec(self) do |content_type|\n fields.define_singleton_method(:add) do |field|\n content_type.update(fields: content_type.merged_fields(field))\n end\n\n fields.define_singleton_method(:create) do |params|\n field = Contentful::Management::Field.new\n Field.property_coercions.each do |key, _value|\n snakify_key = Support.snakify(key)\n param = params[snakify_key.to_sym]\n field.send(\"#{snakify_key}=\", param) if param\n end\n content_type.update(fields: content_type.merged_fields(field))\n end\n\n fields.define_singleton_method(:destroy) do |id|\n fields = content_type.fields.reject { |field| field.id == id }\n content_type.update(fields: fields)\n end\n end\n\n fields\n end",
"def fields\n search.class.fields\n end",
"def record?\n type == \"RECORD\" || type == \"STRUCT\"\n end",
"def sub_request_fields(key)\n return unless @opts[:\"#{key}_fields\"].present? ||\n @opts[:\"#{key}_associations\"].present? ||\n @opts[:\"#{key}_extra_fields\"].present?\n\n sub_fields = @opts[:\"#{key}_fields\"]\n sub_associations = @opts[:\"#{key}_associations\"]\n sub_opt_fields = @opts[:\"#{key}_extra_fields\"]\n\n [sub_fields, sub_associations, sub_opt_fields]\n end",
"def media_object_fields\n fields.select { |field| media_object_header?(field.header) }\n end",
"def types\n FIELD_TYPES\n end",
"def fields\n return @fields if fields_registered?\n all_fields = @session.connection.get_fields(@name)\n @fields = all_fields[\"module_fields\"].with_indifferent_access\n @link_fields= all_fields[\"link_fields\"]\n handle_empty_arrays\n @fields_registered = true\n @fields\n end",
"def staff_request_all_fields\n StaffRequest.fields\n end",
"def fields\n klass.members.map(&:to_sym)\n end",
"def get_fields\n _fields = @config['form']['fields']\n _fields.map{|k,v| Field.new(k=>v)}\n end"
] |
[
"0.678552",
"0.67693776",
"0.66834253",
"0.66683996",
"0.66116625",
"0.65870357",
"0.65228474",
"0.65189856",
"0.65189856",
"0.65007037",
"0.64862615",
"0.6432243",
"0.6428611",
"0.64037454",
"0.63619715",
"0.6358757",
"0.6348525",
"0.6348525",
"0.6348525",
"0.6348525",
"0.6348525",
"0.6314359",
"0.6286136",
"0.62829345",
"0.6276302",
"0.6237637",
"0.6237637",
"0.6237637",
"0.6237637",
"0.62189287",
"0.62065864",
"0.6193005",
"0.619221",
"0.61788225",
"0.61788225",
"0.6164659",
"0.6164659",
"0.6164659",
"0.61566645",
"0.61477935",
"0.61042076",
"0.6072542",
"0.60645854",
"0.601897",
"0.59967804",
"0.5995381",
"0.5994477",
"0.59783465",
"0.59692913",
"0.593793",
"0.592406",
"0.592406",
"0.592406",
"0.59107757",
"0.5898839",
"0.58773047",
"0.5864697",
"0.5853691",
"0.5828811",
"0.5828811",
"0.5828811",
"0.5810221",
"0.57858956",
"0.5771655",
"0.57469904",
"0.5743619",
"0.573062",
"0.5713447",
"0.56969935",
"0.5693386",
"0.5688905",
"0.5681926",
"0.5676998",
"0.5667524",
"0.56577516",
"0.564897",
"0.5640425",
"0.5640052",
"0.56381226",
"0.5637417",
"0.5636631",
"0.56247485",
"0.5618212",
"0.56061256",
"0.5601672",
"0.55937845",
"0.5573428",
"0.55682725",
"0.5560245",
"0.55542254",
"0.5530771",
"0.5529188",
"0.5526121",
"0.55195063",
"0.5510793",
"0.55067587",
"0.5500827",
"0.54996806",
"0.5497304",
"0.54916483"
] |
0.56081444
|
83
|
The names of the nested fields as symbols if the type property is set to `RECORD`. Will be empty otherwise.
|
def headers
fields.map(&:name).map(&:to_sym)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fields\n klass.members.map(&:to_sym)\n end",
"def fields\n properties.keys.map(&:to_sym)\n end",
"def fields\n properties.keys.map(&:to_sym)\n end",
"def fields\n @field_labels.collect { |k, v| { sym: k, name: v } }\n end",
"def field_names\n internal_format.keys\n end",
"def field_names\n fields.keys\n end",
"def fields\n properties.keys.map(&:to_sym).reject{ |x| x == :type }\n end",
"def field_names\n @_field_path.map{ |field_| field_.name }\n end",
"def fields\n @fields.keys\n end",
"def fields\n @fields.keys\n end",
"def names\n NAME_FIELDS.map { |k| has_field?(k) ? @fields[k].tokens : nil }.flatten.compact\n end",
"def field_names\n attribute_names.map(&:to_sym)\n end",
"def field_names\r\n return @field_names\r\n end",
"def names\n iterator = @form_fields.keySet.iterator\n set = []\n set << iterator.next.toString.to_sym while iterator.hasNext\n set\n end",
"def keys\n fields.map { |f| f.name }\n end",
"def fields\n FIELDS\n end",
"def field_names\n @field_names ||= attribute_names.map(&:to_sym)\n end",
"def fields\n FIELDS\n end",
"def fields\n []\n end",
"def field_names\n jso.field_names\n end",
"def fields\n FIELDS\n end",
"def field_names\n label_fields.to_h\n end",
"def fields\n iterator = @form_fields.keySet.iterator\n map = {}\n while iterator.hasNext\n key = iterator.next.toString\n map[key.to_sym] = field(key)\n end\n map\n end",
"def get_array_of_symbolic_keys\n # getting array of keys (in symbol form)\n all_fields = self.attributes.keys.map do |key|\n key.to_sym;\n end\n return all_fields\n end",
"def fields\r\n @hash.keys\r\n end",
"def fields\n raw['fields']\n end",
"def nested_object_fields\n @nested_object_fields\n end",
"def fields\n @fields\n end",
"def fields\n @fields\n end",
"def fields\n self.class.fields(true)\n end",
"def person_name_fields\n \"\".tap do |result|\n fields_for(:person_name) do |f|\n result << f.text_field(:name_prefix)\n result << f.text_field(:first_name)\n result << f.text_field(:middle_name)\n result << f.text_field(:last_name)\n result << f.text_field(:name_suffix)\n end\n end\n end",
"def all_fields\n fields.values\n end",
"def flatten_struct!(fields, prefix: nil)\n fields.map do |field|\n type = field.first\n name = [prefix, field.last].compact.join(\"_\")\n\n if type.is_a? Array then\n flatten_struct!(type, prefix: name)\n else\n [[type.to_sym, name.to_sym]]\n end\n end.flatten(1)\n end",
"def fields\n @fields\n end",
"def fields\n class_name.constantize.fields\n end",
"def fields\n schema.fields\n end",
"def to_str\n fields.collect do |field, body|\n send(field) if body.type == Object\n end.compact.sort.join(' ')\n end",
"def fields\n schema.fields\n end",
"def fields\n schema.fields\n end",
"def fields\n schema.fields\n end",
"def config_fields\n get_config_fields.map { |f| f[:field_name].to_sym }\n end",
"def config_fields\n get_config_fields.map { |f| f[:field_name].to_sym }\n end",
"def info_hash\n @fields\n end",
"def fields\n @fields ||= []\n end",
"def as_names\n __getobj__.map { |i| i.name }\n end",
"def field_names\n @field_names ||= (columns_hash.keys.map(&:to_sym) rescue [])\n end",
"def fields\n return @fields if defined?(@fields)\n\n @fields = array_of_items_for(Fields, :fields)\n end",
"def get_field_names(template)\n read(template).fields.map{|f| f.name}\n end",
"def fields\n @fields ||= {}\n end",
"def fields\n @fields ||= {}\n end",
"def fields\n @fields ||= {}\n end",
"def fields\n @fields ||= {}\n end",
"def fields\n @fields ||= {}\n end",
"def render_fields(meth)\n parts = [ ]\n self.fields.each do |k,f|\n parts.push(f.send(meth, type))\n end\n return parts.join('')\n end",
"def get_fields\n FIELD_DESCS\n end",
"def nested_attributes_tags\n self.nested_attributes_options.keys.map(&:to_s)\n end",
"def field_names\n property_defaults.keys\n end",
"def field_names(filter = [], include_inherited = true)\n names = fields.keys\n\n if include_inherited && has_parent?\n names.concat(inherited_fields)\n end\n\n unless filter.empty?\n names = names & filter.map(&:to_sym)\n end\n\n names.sort!\n names\n end",
"def all_fields\n @fields.values\n end",
"def field_names(include_hidden = false)\n # collect field names\n names = []\n hidden = no_eval_param(:hide)\n @field_names.each do |name|\n if include_hidden or not hidden.include?(name)\n names << name\n end\n end\n names\n end",
"def fields\n @fields ||= []\n end",
"def field_names\n (text_fields + html_fields + atom_fields + datetime_fields +\n number_fields + geo_fields).uniq\n end",
"def fields\n @lhs.fields + (@rhs.fields - @rhs.keys).map{|f| \n @lhs.fields.include?(f) ? \"rhs.#{f}\" : f\n }\n end",
"def fields\n @fields ||= @stats.keys.select{ |k| k != RECORDS_LISTING_KEY}.flatten.uniq\n end",
"def facet_field_names(lens = nil)\n blacklight_config_for(lens).facet_fields.values.map(&:field)\n end",
"def document_show_fields\n Blacklight.config[:show_fields][:field_names]\n end",
"def get_field_names(template); end",
"def salesforce_attributes ; @salesforce_fields.keys ; end",
"def inspect\n inspection =\n self.class.fields.keys.collect { |name|\n \"#{name}: #{attribute_for_inspect(name)}\"\n }.join(\", \")\n\n \"#<#{self.class} #{inspection}>\"\n end",
"def fields\n all_fields\n end",
"def get_fields(type)\n @instrumented_field_map[type.graphql_name]\n end",
"def pascal_string_fields(name)\n [ pascal_string_len_field(name.to_sym), name.to_sym ]\n end",
"def display_fields\n database_field_names\n end",
"def name(); RECORD_INFO[@type].name; end",
"def symbols_for_association_chain #:nodoc:\n []\n end",
"def fields\n @_fields ||= {}\n end",
"def flattened_fields\n metadata_string = String.from_java_bytes @reader.getMetadata\n description_text = self.class.description_from_metadata_xml(metadata_string)\n begin\n metadata = JSON(description_text)\n flattened_fields = metadata.key?('jpdfer_flattened_fields') ? metadata['jpdfer_flattened_fields'] : {}\n rescue JSON::ParserError\n flattened_fields = {}\n end\n flattened_fields.each_with_object({}) do |(name, value), fields|\n fields[name.to_sym] = value\n end\n end",
"def display_fields\n @form.fields.each {|f| puts f.name}\n end",
"def record_fields\n record_format.values_at(:key, :sys, :row).flatten.sort_by(&:position) if record_format\n end",
"def fields #:nodoc:\n f = @properties.to_a\n last = f.pop\n f.push @elements\n f.push last\n end",
"def field_names\n drawings.pluck(:field_name)\n end",
"def fields; end",
"def fields; end",
"def fields; end",
"def fields\n self.class.fields\n end",
"def keys\n attributes.keys\n end",
"def get_fields\n return (\n _get_specific_action_config(:action_fields, :fields)&.map(&:to_s) ||\n self.get_model&.column_names ||\n []\n )\n end",
"def tag_name_fields\n Tag::TAGGABLE_TYPES.map do |tag_type|\n \"#{tag_type.humanize.pluralize}.name\"\n end + [\"tags.name\", \"meta_tags.name\"]\n end",
"def fields\n self.class.fields\n end",
"def fields\n self.class.fields\n end",
"def fields\n self.class.fields\n end",
"def fields\n self.class.fields\n end",
"def dynamo_fields\n DynamoField.find(:all, :conditions=>['model = ?', self.to_s]).map(&:field_name)\n end",
"def fields(*args)\n return @fields if args.empty?\n @fields = args.flatten.compact.map{|i| i.to_sym}\n end",
"def members\n attributes.keys\n end",
"def api_attributes\n record.class.column_names.map(&:to_sym)\n end",
"def to_hash\n @fields\n end",
"def fields\n %i[ position_title employee_type request_type\n contractor_name number_of_months annual_base_pay\n nonop_funds nonop_source justification organization__name unit__name\n review_status__name review_comment user__name created_at updated_at ]\n end",
"def field_types\r\n return @field_types\r\n end",
"def field_names\n (@profile.keys - NON_PROFILE_FIELDS).sort\n end"
] |
[
"0.704944",
"0.69432807",
"0.69432807",
"0.68852913",
"0.68282706",
"0.6805112",
"0.67131704",
"0.65895027",
"0.65304536",
"0.65304536",
"0.6509964",
"0.65070677",
"0.63958687",
"0.6316637",
"0.6244989",
"0.6173241",
"0.6169892",
"0.6114155",
"0.61100876",
"0.6095985",
"0.6084459",
"0.6046178",
"0.6045227",
"0.60151154",
"0.59694946",
"0.594692",
"0.591288",
"0.5910737",
"0.5910737",
"0.58997947",
"0.583651",
"0.5819167",
"0.58163816",
"0.57956535",
"0.5785587",
"0.57854915",
"0.5774281",
"0.57597315",
"0.57597315",
"0.57597315",
"0.5749023",
"0.5749023",
"0.57432777",
"0.5742376",
"0.5730656",
"0.5730315",
"0.5728874",
"0.5715197",
"0.5706558",
"0.5706558",
"0.5706558",
"0.5706558",
"0.5706558",
"0.56993806",
"0.5692683",
"0.5690581",
"0.5679482",
"0.56790036",
"0.5674493",
"0.5673665",
"0.56375355",
"0.5633132",
"0.5618945",
"0.56180036",
"0.56175274",
"0.56152964",
"0.55989945",
"0.5597961",
"0.5578695",
"0.5574997",
"0.5562728",
"0.55308414",
"0.55290145",
"0.5521572",
"0.5521444",
"0.5517575",
"0.55159026",
"0.55150324",
"0.55083936",
"0.5504117",
"0.5499312",
"0.5498412",
"0.5498412",
"0.5498412",
"0.54980695",
"0.54937685",
"0.549037",
"0.54885983",
"0.5484524",
"0.5484524",
"0.5484524",
"0.5484524",
"0.5476364",
"0.54744613",
"0.54682857",
"0.54663277",
"0.54649174",
"0.54640234",
"0.54593223",
"0.5449445"
] |
0.5702627
|
53
|
The types of the field, using the same format as the optional query parameter types. The parameter types are one of the following BigQuery type codes: `:BOOL` `:INT64` `:FLOAT64` `:NUMERIC` `:BIGNUMERIC` `:STRING` `:DATETIME` `:DATE` `:TIMESTAMP` `:TIME` `:BYTES` `Array` Lists are specified by providing the type code in an array. For example, an array of integers are specified as `[:INT64]`. `Hash` Types for STRUCT values (`Hash` objects) are specified using a `Hash` object, where the keys are the nested field names, and the values are the the nested field types.
|
def param_type
param_type = type.to_sym
param_type = fields.to_h { |field| [field.name.to_sym, field.param_type] } if record?
param_type = [param_type] if repeated?
param_type
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def types\n @types ||= {\n String => GraphQL::STRING_TYPE,\n\n Fixnum => GraphQL::INT_TYPE,\n Integer => GraphQL::INT_TYPE,\n Float => GraphQL::FLOAT_TYPE,\n\n Date => GraphQL::STRING_TYPE,\n Time => GraphQL::STRING_TYPE,\n DateTime => GraphQL::STRING_TYPE,\n\n Array => GraphQL::STRING_TYPE,\n Object => GraphQL::STRING_TYPE,\n Hash => GraphQL::STRING_TYPE,\n }\n end",
"def types\n FIELD_TYPES\n end",
"def tf_types\n {\n Api::Type::Boolean => 'schema.TypeBool',\n Api::Type::Double => 'schema.TypeFloat',\n Api::Type::Integer => 'schema.TypeInt',\n Api::Type::String => 'schema.TypeString',\n # Anonymous string property used in array of strings.\n 'Api::Type::String' => 'schema.TypeString',\n Api::Type::Time => 'schema.TypeString',\n Api::Type::Enum => 'schema.TypeString',\n Api::Type::ResourceRef => 'schema.TypeString',\n Api::Type::NestedObject => 'schema.TypeList',\n Api::Type::Array => 'schema.TypeList',\n Api::Type::KeyValuePairs => 'schema.TypeMap',\n Api::Type::Map => 'schema.TypeSet',\n Api::Type::Fingerprint => 'schema.TypeString'\n }\n end",
"def param_types\n schema.param_types\n end",
"def datatypes\n value.document.fetch(\"#{value.key}_type\", [])\n end",
"def types\n @types ||= {\n Boolean => GraphQL::BOOLEAN_TYPE,\n ::Mongoid::Boolean => GraphQL::BOOLEAN_TYPE,\n BSON::ObjectId => GraphQL::STRING_TYPE,\n }\n end",
"def types\n @types ||= inject({}) { |memo, schema| memo.merge(schema.types) }\n end",
"def field_types\r\n return @field_types\r\n end",
"def field_types_for name\n {\n text: text_fields.include?(name),\n html: html_fields.include?(name),\n atom: atom_fields.include?(name),\n datetime: datetime_fields.include?(name),\n number: number_fields.include?(name),\n geo: geo_fields.include?(name)\n }.delete_if { |_k, v| !v }.keys\n end",
"def fields(*args)\n hash_fields = args.last.is_a?(Hash) ? args.pop : {}\n hash_fields[type] = args if args.any?\n munson.fields(hash_fields)\n end",
"def type\n field[:type]\n end",
"def get_dataType(field_name)\n if(field_name.is_a? Array)\n firstKey = field_name.shift\n field_name.unshift(:default)\n field_name.unshift(firstKey)\n cursor = fields\n while(field_name.length > 0)\n nextKey = field_name.shift\n if((cursor.is_a?(Hash) && cursor.include?(nextKey)) || (cursor.is_a?(Array) && cursor.length > nextKey))\n cursor = cursor[nextKey]\n end\n end\n return(typeOf(cursor))\n else\n typeOf(fields[field_name.to_sym][:default])\n end\n end",
"def field_type field\n case field\n when Symbol then members_types[field]\n # when Array\n # if field.length > 1 then members_types[field.first].field_type(field[1..-1])\n # else field_type field.first\n # end\n end\n end",
"def type_params; end",
"def type_params; end",
"def type_params; end",
"def type_params; end",
"def type_params; end",
"def getTypes()\n\ttypes = Hash.new\n\n\t@fields_doc.elements.each(\"acda-fields/types/*\") { |elem|\n\t\tcase elem.name\n\t\t\twhen \"number\"\n\t\t\t\tnumber = nil\n\t\t\t\tif elem.attributes[\"default\"]\n\t\t\t\t\tnumber = NumberType.new(elem.attributes[\"id\"],\n\t\t\t\t\t\t\t\t\t\t\t elem.attributes[\"default\"])\n\t\t\t\telse\n\t\t\t\t\tnumber = NumberType.new(elem.attributes[\"id\"])\n\t\t\t\tend\n\n\t\t\t\ttypes[number.name] = number\n\n\t\t\twhen \"text\"\n\t\t\t\tstring = nil\n\t\t\t\tif elem.attributes[\"default\"]\n\t\t\t\t\tstring = StringType.new(elem.attributes[\"id\"],\n\t\t\t\t\t\t\t\t\t\t elem.attributes[\"default\"])\n\t\t\t\telse\n\t\t\t\t\tstring = StringType.new(elem.attributes[\"id\"])\n\t\t\t\tend\n\n\t\t\t\ttypes[string.name] = string\n\n\t\t\twhen \"choice\"\n\t\t\t\tchoices = Array.new\n\n\t\t\t\telem.elements.each(\"entry\") {\n |entry| choices.push(entry.attributes[\"name\"])\n }\n\n if elem.attributes[\"default\"]\n\t\t\t\t choice = ChoiceType.new(elem.attributes[\"id\"],\n\t\t\t\t\t\t\t\t\t\tchoices,\telem.attributes[\"default\"])\n else\n\t\t\t\t choice = ChoiceType.new(elem.attributes[\"id\"], choices)\n end\n\n\t\t\t \ttypes[choice.name] = choice\n\t\t\telse\n\t\t\t\traise RuntimeError, \"Unknown optional type #{elem.name}\"\n\t\tend\n\t}\n\n\treturn types\nend",
"def params() @param_types end",
"def inspect_data_types(t)\n types = {}\n\n t.headers.each do |col|\n type = NilClass\n t[col].each do |v|\n next if v.nil?\n if v.class == String\n type = type_of(v)\n else\n type = v.class\n end\n break\n end\n types[col] = type\n end\n\n types\n end",
"def type_info(field)\n field = field.dup\n field[:type] = Thrift.type_name(field[:type]).sub('Types::', '')\n field.delete :name\n field[:key] = type_info(field[:key]) if field[:key]\n field[:value] = type_info(field[:value]) if field[:value]\n field[:element] = type_info(field[:element]) if field[:element]\n if enum = field[:enum_class]\n field[:enum] = enum.const_get 'VALUE_MAP'\n end\n field\n end",
"def schema_data_type\n case type\n when \"N\", \"F\"\n decimal > 0 ? \":float\" : \":integer\"\n when \"I\"\n \":integer\"\n when \"D\"\n \":date\"\n when \"T\"\n \":datetime\"\n when \"L\"\n \":boolean\"\n when \"M\"\n \":text\"\n else\n \":string, :limit => #{length}\"\n end\n end",
"def serialized_type(reference_state)\n result = field_type.serialize(reference_state)\n optional_field ? field_type.class.union_with_null(result) : result\n end",
"def elasticsearch_datatype\n case self\n when TextArea,TextField\n 'string'\n when IntegerField\n 'integer'\n when NumberField\n 'float'\n when BooleanField\n 'boolean'\n when DateField\n 'date'\n when AttachmentField\n 'attachment'\n when ArrayField\n 'string'\n else\n 'string'\n end\n end",
"def col_types\n result = {}\n columns.each do |c|\n result[c.header] = c.type\n end\n result\n end",
"def value_type(vals)\n types = vals.map {|v| v.class }.uniq\n\n # Convert everything to string if there isn't a single unique type\n return Thrift::Types::STRING if types.size > 1\n\n type = types.first\n\n # Array -> LIST\n return Thrift::Types::LIST if type == Array\n\n # Hash can be a MAP or STRUCT\n if type == Hash\n if vals.first.has_key?(STRUCT)\n return Thrift::Types::STRUCT\n else\n return Thrift::Types::MAP\n end\n end\n\n Thrift::Types::STRING\n end",
"def field_type(key)\n IBM_DB.field_type(@stmt, key)\n end",
"def types\n @opt_types.values\n end",
"def explain_types; end",
"def get_field_class(value)\n case\n when value.is_a?(String)\n 'string'\n when value.is_a?(Integer)\n 'integer'\n when value.is_a?(Float)\n 'float'\n when value.is_a?(BigDecimal)\n 'decimal'\n when value.is_a?(DateTime)\n 'datetime'\n when value.is_a?(FalseClass) || value.is_a?(TrueClass)\n 'boolean'\n else\n raise FieldTypeError, 'Invalid field type.'\n end\n end",
"def java_types(params)\n return nil if params.nil?\n\n params.map {|e| e.class.java_class.name }.to_java(:string)\n end",
"def _field_types\n special_attribute('@fieldTypes'.freeze)\n end",
"def value_types; end",
"def csharp_type_for_schema_definition( schema )\n types = {\n ::Respect::ArraySchema => \"List<string>\",\n ::Respect::BooleanSchema => \"bool#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::FloatSchema => \"float#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::HashSchema => \"Dictionary<string, object>\",\n ::Respect::IntegerSchema => \"long#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::StringSchema => \"string\",\n ::Respect::AnySchema => \"object\",\n ::Respect::GeoPointSchema => \"global::#{ base_api_namespace() }.Fields.GeoPoint\",\n ::Respect::AttachmentSchema => \"global::#{ base_api_namespace() }.Fields.Attachment\"\n }\n\n types = if options[:use_noda_time] == \"true\" || options[:use_noda_time] == \"1\"\n types.merge({\n ::Respect::DatetimeSchema => \"NodaTime.Instant#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::InstantSchema => \"NodaTime.Instant#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::DateSchema => \"NodaTime.LocalDate#{ schema.allow_nil? ? \"?\" : \"\" }\"\n })\n else\n types.merge({\n ::Respect::DatetimeSchema => \"DateTime#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::InstantSchema => \"DateTime#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::DateSchema => \"DateTime#{ schema.allow_nil? ? \"?\" : \"\" }\"\n })\n end\n\n type = types[ schema.class ]\n\n custom = nil\n collection = false\n\n schema_item = schema.instance_variable_get(:@item)\n if type == \"List<string>\" && schema_item && schema_item.is_a?(::Respect::AnySchema)\n type = \"List<object>\"\n end\n\n if schema.is_a?(Respect::HasOneSchema)\n type = sanitize_model_namespace( schema.of ) + \".\" + sanitize_model_class( schema.of )\n custom = type\n collection = false\n end\n\n if schema.is_a?(Respect::EnumSchema)\n type = sanitize_model_namespace( schema.values_module ) + \".\" + sanitize_model_class( schema.values_module )\n custom = type\n collection = false\n\n emit_enum!( schema.values_module )\n end\n\n if schema.is_a?(Respect::HasManySchema)\n type = \"List<\" + sanitize_model_namespace( schema.of ) + \".\" + sanitize_model_class( schema.of ) + \">\"\n custom = type\n collection = true\n end\n\n return type, custom, collection\n end",
"def set_data_type_and_array\n column_schema = SearchFacet.get_table_schema(column_name: big_query_id_column)\n detected_type = column_schema[:data_type]\n self.is_array_based = detected_type.include?('ARRAY')\n item_type = BQ_DATA_TYPES.detect { |d| detected_type.match(d).present? }\n self.data_type = BQ_TO_FACET_TYPES[item_type]\n end",
"def thrift_type_to_json_type(value, field)\n type = Thrift.type_name(field[:type])\n raise Thrift::TypeError.new(\"Type for #{field.inspect} not found.\") unless type\n type.sub!('Types::', '')\n result = value\n type = 'UNION' if type == 'STRUCT' && field[:class].ancestors.any?{|x| x == Thrift::Union}\n if type == 'STRUCT'\n result = thrift_struct_to_json_map(value, field[:class])\n # field[:class].const_get('FIELDS').each do |(_, struct_field)|\n # name = struct_field[:name]\n # val = value.send(name)\n # result[name] = thrift_type_to_json_type(val, struct_field) if val\n # end\n elsif type == 'LIST' || type == 'SET'\n result = value.map {|val| thrift_type_to_json_type val, field[:element]}\n elsif type == 'MAP'\n result = value.map do |key, val|\n [thrift_type_to_json_type(key, field[:key]), thrift_type_to_json_type(val, field[:value])]\n end\n elsif enum = field[:enum_class]\n result = enum.const_get('VALUE_MAP')[value] || value\n elsif type == 'UNION'\n result = thrift_union_to_json_map(value, field[:class])\n end\n result\n end",
"def set_data_type_and_array\n column_schema = SearchFacet.get_table_schema(column_name: self.big_query_id_column)\n detected_type = column_schema[:data_type]\n self.is_array_based = detected_type.include?('ARRAY')\n item_type = BQ_DATA_TYPES.detect {|d| detected_type.match(d).present?}\n self.data_type = BQ_TO_FACET_TYPES[item_type]\n end",
"def type(*values)\n values.inject(self) { |res, val| res._type(val) or fail ArgumentError, \"Unknown value for type: #{val}\" }\n end",
"def type(*values)\n values.inject(self) { |res, val| res._type(val) or fail ArgumentError, \"Unknown value for type: #{val}\" }\n end",
"def type(*values)\n values.inject(self) { |res, val| res._type(val) or fail ArgumentError, \"Unknown value for type: #{val}\" }\n end",
"def parameter_types; end",
"def type(types)\n types = [types] unless types.is_a?(Array)\n any_in(:_type => types)\n end",
"def FieldTypes\n @_FieldTypes ||= OLEProperty.new(@ole, 9, [VT_BSTR], [VT_BSTR, VT_BSTR])\n end",
"def schema_column_type(db_type)\n case db_type\n when 'json'\n :json\n when 'jsonb'\n :jsonb\n else\n super\n end\n end",
"def parse_type_and_options(type)\n case type\n when /(string|text|binary|integer)\\{(\\d+)\\}/\n return $1, limit: $2.to_i\n when /decimal\\{(\\d+)[,.-](\\d+)\\}/\n return :decimal, precision: $1.to_i, scale: $2.to_i\n when /(references|belongs_to)\\{(.+)\\}/\n type = $1\n provided_options = $2.split(/[,.-]/)\n options = Hash[provided_options.map { |opt| [opt.to_sym, true] }]\n return type, options\n else\n return type, {}\n end\n end",
"def column_types\n @column_types ||= @columns.values\n end",
"def process_method_field_types(fields)\n fields.each do |field|\n field_type = field[:type]\n next if STANDARD_TYPES.include?(field_type)\n @raw_types << field_type unless @raw_types.include?(field_type)\n end\n end",
"def query_type_enum\n return {\n 0=>'empty',\n 1=>'iso',\n 2=>'multi'\n }\n end",
"def report_type_params\n params.fetch(:report_type, {:Type => :string})\n end",
"def set_query_params_type\n @query_params[:type]= @query_params[:type] || \"json\"\n end",
"def read_type(field_info)\n # if field_info is a Fixnum, assume it is a Thrift::Types constant\n # convert it into a field_info Hash for backwards compatibility\n if field_info.is_a? Fixnum\n field_info = {:type => field_info}\n end\n\n case field_info[:type]\n when Types::BOOL\n read_bool\n when Types::BYTE\n read_byte\n when Types::DOUBLE\n read_double\n when Types::I16\n read_i16\n when Types::I32\n read_i32\n when Types::I64\n read_i64\n when Types::STRING\n if field_info[:binary]\n read_binary\n else\n read_string\n end\n else\n raise NotImplementedError\n end\n end",
"def type *params\n raise_without_self \"Parameters are not specified!\", HOWT if params.empty?\n params = params[0]\n unless params.is_a?(Hash) && params.size > 0\n raise_without_self \"Invalid parameters. Should be Text or Fuzzy Search parameters!\", HOWT\n end\n\n # reduce short form to full\n params = {@text_default => params.keys[0], :text => params.values[0]} if params.size == 1\n\n\n # parse full form\n opt = OpenStruct.new(:control_text => nil)\n value = params[:text]\n parse_metric params, opt\n\n raise_without_self \"Value cannot be 'nil'\", HOWT unless value\n\n return @adapter.type(opt, value.to_s)\n end",
"def type?(*types)\n types.each &method(:assert_simple_type)\n existing = get('type', nil)\n if existing.is_a? Json::Array\n (existing.to_a & types).any?\n else\n types.include? existing\n end\n end",
"def possible_types(type)\n if type.kind.interface?\n schema.possible_types(type)\n elsif type.kind.union?\n type.possible_types\n end\n end",
"def _field_type(avro_schema)\n Deimos::SchemaBackends::AvroBase.field_type(avro_schema)\n end",
"def param_type(keys)\n puts \"Entering param_type '#{@sy}'\" if DEBUG\n type = nil\n \n if ParamType.first.include? @sy.text\n if @sy.type == TokenType::ARRAY_TOKEN\n type = param_array(keys | ParamType.follow)\n else\n type = @sy.text\n next_token\n end\n else\n error(\"Line #{@sy.line_number}: Invalid parameter type #{@sy.text}\", keys | ParamType.follow)\n end\n \n puts \"Leaving param_type '#{@sy}'\" if DEBUG\n return type if type.is_a? TypeNode\n TypeNode.new type\n end",
"def data_type\n ns_definition(:query_spec_datatypes)\n end",
"def extra_field_type(index)\r\n t = extra_type(index).to_s\r\n case t\r\n when 'password'\r\n 'password'\r\n when 'integer', 'float'\r\n 'number'\r\n when 'boolean'\r\n 'checkbox'\r\n else\r\n if t.downcase.index('in:')\r\n 'select'\r\n else\r\n 'text'\r\n end\r\n end\r\n end",
"def describe_types\n [@options[:type]].flatten.join('/')\n end",
"def type_information(opts)\n opts = check_params(opts,[:field_names])\n super(opts)\n end",
"def generic_supported_types\n [\n # general\n \"num_participants\",\n \"num_assignments\",\n \"num_teams\",\n \"num_reviews\",\n # assignment_teams\n \"total_num_assignment_teams\",\n \"average_num_assignment_teams\",\n \"max_num_assignment_teams\",\n \"min_num_assignment_teams\",\n # assignment_scores\n \"average_assignment_score\",\n \"max_assignment_score\",\n \"min_assignment_score\",\n # assignment_reviews\n \"total_num_assignment_reviews\",\n \"average_num_assignment_reviews\",\n \"max_num_assignment_reviews\",\n \"min_num_assignment_reviews\",\n # team_reviews\n \"total_num_team_reviews\",\n \"average_num_team_reviews\",\n \"max_num_team_reviews\",\n \"min_num_team_reviews\",\n # team_scores\n \"average_team_score\",\n \"max_team_score\",\n \"min_team_score\",\n # review_score\n \"average_review_score\",\n \"max_review_score\",\n \"min_review_score\",\n # review_word_count\n \"total_review_word_count\",\n \"average_review_word_count\",\n \"max_review_word_count\",\n \"min_review_word_count\",\n # character_count\n \"total_review_character_count\",\n \"average_review_character_count\",\n \"max_review_character_count\",\n \"min_review_character_count\"\n ]\n end",
"def encode_fields(*fields)\n fields.map do |type, value|\n case type\n when :raw\n value\n when :string\n encode_string(value)\n when :list\n encode_list(value)\n when :mpint\n encode_mpint(value)\n when :time\n encode_time(value)\n when :uint64\n encode_uint64(value)\n when :uint32\n encode_uint32(value)\n when :options\n encode_options(value)\n else\n raise DecodeError, \"bad type: #{type}\"\n end\n end.join\n end",
"def user_defined_types(*categories)\n category_condition = categories.present? \\\n ? \"AND t.typtype IN ('#{categories.join(\"', '\")}')\" \\\n : \"AND t.typtype NOT IN ('b', 'd')\"\n\n select_all(<<-SQL, 'SCHEMA').rows.to_h\n SELECT t.typname AS name,\n CASE t.typtype\n WHEN 'e' THEN 'enum'\n END AS type\n FROM pg_type t\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n WHERE n.nspname NOT IN ('pg_catalog', 'information_schema')\n #{category_condition}\n AND NOT EXISTS(\n SELECT 1\n FROM pg_catalog.pg_type el\n WHERE el.oid = t.typelem\n AND el.typarray = t.oid\n )\n AND (t.typrelid = 0 OR (\n SELECT c.relkind = 'c'\n FROM pg_catalog.pg_class c\n WHERE c.oid = t.typrelid\n ))\n ORDER BY t.typtype DESC\n SQL\n end",
"def simplified_type(field_type)\r\n return :boolean if field_type =~ /logical/i\r\n return :string if field_type =~ /varchar/i\r\n return :binary if field_type =~ /long binary/i\r\n return :datetime if field_type =~ /timestamp/i\r\n return :integer if field_type =~ /short|integer/i\r\n return :integer if field_type =~ /autoinc/i\r\n super\r\n end",
"def types\n load_schema! unless schema_loaded?\n @types\n end",
"def validate_fields_types(options)\n unless queue.nil? || queue.is_a?(String)\n err_field(:queue, options, \"queue must be a string\")\n end\n unless priority.nil? || priority.is_a?(Integer)\n err_field(:priority, options, \"priority must be an integer\")\n end\n unless DEFINED_JOB_TYPES.include?(schedule_type)\n err_field(:schedule_type, options, \"Not in #{DEFINED_JOB_TYPES}\")\n end\n end",
"def column_schema_to_ruby_type(schema)\n case t = schema[:db_type].downcase\n when /\\A(?:medium|small)?int(?:eger)?(?:\\((?:\\d+)\\))?(?: unsigned)?\\z/o\n {:type=>Integer}\n when /\\Atinyint(?:\\((\\d+)\\))?\\z/o\n {:type =>schema[:type] == :boolean ? TrueClass : Integer}\n when /\\Abigint(?:\\((?:\\d+)\\))?(?: unsigned)?\\z/o\n {:type=>Bignum}\n when /\\A(?:real|float|double(?: precision)?)\\z/o\n {:type=>Float}\n when 'boolean'\n {:type=>TrueClass}\n when /\\A(?:(?:tiny|medium|long|n)?text|clob)\\z/o\n {:type=>String, :text=>true}\n when 'date'\n {:type=>Date}\n when /\\A(?:small)?datetime\\z/o\n {:type=>DateTime}\n when /\\Atimestamp(?:\\((\\d+)\\))?(?: with(?:out)? time zone)?\\z/o\n {:type=>DateTime, :size=>($1.to_i if $1)}\n when /\\Atime(?: with(?:out)? time zone)?\\z/o\n {:type=>Time, :only_time=>true}\n when /\\An?char(?:acter)?(?:\\((\\d+)\\))?\\z/o\n {:type=>String, :size=>($1.to_i if $1), :fixed=>true}\n when /\\A(?:n?varchar|character varying|bpchar|string)(?:\\((\\d+)\\))?\\z/o\n {:type=>String, :size=>($1.to_i if $1)}\n when /\\A(?:small)?money\\z/o\n {:type=>BigDecimal, :size=>[19,2]}\n when /\\A(?:decimal|numeric|number)(?:\\((\\d+)(?:,\\s*(\\d+))?\\))?\\z/o\n s = [($1.to_i if $1), ($2.to_i if $2)].compact\n {:type=>BigDecimal, :size=>(s.empty? ? nil : s)}\n when /\\A(?:bytea|(?:tiny|medium|long)?blob|(?:var)?binary)(?:\\((\\d+)\\))?\\z/o\n {:type=>File, :size=>($1.to_i if $1)}\n when 'year'\n {:type=>Integer}\n else\n {:type=>String}\n end\n end",
"def simplified_type(field_type)\n case field_type\n # Numeric and monetary types\n when /^(?:real|double precision)$/\n :float\n # Monetary types\n when 'money'\n :decimal\n when 'hstore'\n :hstore\n when 'ltree'\n :ltree\n # Network address types\n when 'inet'\n :inet\n when 'cidr'\n :cidr\n when 'macaddr'\n :macaddr\n # Character types\n when /^(?:character varying|bpchar)(?:\\(\\d+\\))?$/\n :string\n when /^citext(?:\\(\\d+\\))?$/\n :citext\n # Binary data types\n when 'bytea'\n :binary\n # Date/time types\n when /^timestamp with(?:out)? time zone$/\n :datetime\n when /^interval(?:|\\(\\d+\\))$/\n :string\n # Geometric types\n when /^(?:point|line|lseg|box|\"?path\"?|polygon|circle)$/\n :string\n # Bit strings\n when /^bit(?: varying)?(?:\\(\\d+\\))?$/\n :string\n # XML type\n when 'xml'\n :xml\n # tsvector type\n when 'tsvector'\n :tsvector\n # Arrays\n when /^\\D+\\[\\]$/\n :string\n # Object identifier types\n when 'oid'\n :integer\n # UUID type\n when 'uuid'\n :uuid\n # JSON type\n when 'json'\n :json\n # Small and big integer types\n when /^(?:small|big)int$/\n :integer\n when /(num|date|tstz|ts|int4|int8)range$/\n field_type.to_sym\n # Pass through all types that are not specific to PostgreSQL.\n else\n super\n end\n end",
"def field_type(key)\n pdf_field(key).getFormType.toString\n end",
"def __typedeaf_validate_types_for(param, value, types)\n validated = false\n\n # If we've received a DefaultArgument, we need to dig into it to get our\n # types to check back out\n if types.is_a? Typedeaf::Arguments::DefaultArgument\n types = types.types\n end\n\n if types.is_a? Array\n types.each do |type|\n validated = __typedeaf_valid_type? value, type\n break if validated\n end\n else\n validated = __typedeaf_valid_type? value, types\n end\n\n unless validated\n raise InvalidTypeException,\n \"Expected `#{param}` to be a kind of #{types} but was #{value.class}\"\n end\n end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def types\n if @@types.nil? || (@@last_type_check + (4 * 60 * 60)) < Time.now\n @@last_type_check = Time.now\n @@types = _make_request(:types)['results']\n end\n @@types\n end",
"def deimos_field_type(schema_field)\n _field_type(schema_field.type)\n end",
"def types(types); end",
"def query_type_params\n params.require(:query_type).permit(:name)\n end",
"def types\n get_metadata unless @types\n return @types\n end",
"def argument_types\n @arguments.map(&:type)\n end",
"def simplified_type(field_type)\n case field_type\n # Numeric and monetary types\n when /^(?:real|double precision)$/\n :float\n # Monetary types\n when 'money'\n :decimal\n # Character types\n when /^(?:character varchar|varying|bpchar)(?:\\(\\d+\\))?$/\n :string\n # Binary data types\n when 'bytea'\n :binary\n when 'binary'\n :binary\n # Date/time types\n when /^timestamp with(?:out)? time zone$/\n :datetime\n when 'interval'\n :string\n # Geometric types\n when /^(?:point|line|lseg|box|\"?path\"?|polygon|circle)$/\n :string\n # Network address types\n when /^(?:cidr|inet|macaddr)$/\n :string\n # Bit strings\n when /^bit(?: varying)?(?:\\(\\d+\\))?$/\n :string\n # XML type\n when 'xml'\n :xml\n # Arrays\n when /^\\D+\\[\\]$/\n :string\n # Object identifier types\n when 'oid'\n :integer\n # UUID type\n when 'uuid'\n :string\n # Small and big integer types\n when /^(?:small|big)int$/\n :integer\n # Pass through all types that are not specific to Vertica.\n else\n super\n end\n end",
"def puppet_type_to_ruby(type)\n array = false\n\n type = $1 if type =~ /Optional\\[(.+)/\n\n if type =~ /Array\\[(.+)/\n type = $1\n array = true\n end\n\n return [Numeric, array] if type =~ /Integer/\n return [Numeric, array] if type =~ /Float/\n return [Hash, array] if type =~ /Hash/\n return [:boolean, array] if type =~ /Boolean/\n\n [String, array]\n end",
"def validate_parameter_type\n if PRIMITIVE_PARAMETER_TYPES.include? self.parameter_type || self.parameter_type === 'Object'\n true\n elsif self.parameter_type.include?('[') # compound types have brackets []\n # extract primitives from complex type\n raw_primitives = self.parameter_type.split('[').last\n raw_primitives.gsub!(/]\\??/, '')\n primitives = raw_primitives.split(',').map(&:strip)\n if self.parameter_type.start_with?('Array')\n # there is only one primitive type from the control list\n unless primitives.size === 1 && PRIMITIVE_PARAMETER_TYPES.include?(primitives.first)\n errors.add(:parameter_type, \"has an invalid primitive type: #{(primitives - PRIMITIVE_PARAMETER_TYPES).join(', ')}\")\n end\n elsif self.parameter_type.start_with?('Map')\n # there are two primitive types, and the intersection is the same as the unique list of primitives\n unless primitives.size === 2 && (primitives & PRIMITIVE_PARAMETER_TYPES === primitives.uniq)\n errors.add(:parameter_type, \"has an invalid primitive type: #{(primitives - PRIMITIVE_PARAMETER_TYPES).join(', ')}\")\n end\n else\n errors.add(:parameter_type, \"has an invalid complex type: #{self.parameter_type.split('[').first}\")\n end\n else\n errors.add(:parameter_type, \"has an invalid value: #{self.parameter_type}\")\n end\n end",
"def extract_parameter_types(type_expr)\n # No type\n if type_expr.nil?\n []\n # Multiple types to extract (ex. Variant[TargetSpec, String])\n elsif defined?(type_expr.keys)\n type_expr.keys.flat_map { |param| extract_parameter_types(param) }\n # Store cased value\n elsif defined?(type_expr.cased_value)\n [type_expr.cased_value]\n # Type alias, able to resolve alias\n elsif defined?(type_expr.resolved_type.name)\n [type_expr.resolved_type.name]\n # Nested type alias, recurse\n elsif defined?(type_expr.type)\n extract_parameter_types(type_expr.type)\n # Array conatins alias types\n elsif defined?(type_expr.types)\n type_expr.types.flat_map { |param| extract_parameter_types(param) }\n # Each element can be handled by a resolver above\n elsif defined?(type_expr.element_type)\n extract_parameter_types(type_expr.element_type)\n end\n end",
"def type_name_enum\r\n [ [ '数字字段1', 'int1' ] ,[ '数字字段2', 'int2' ] ,[ '数字字段3', 'int3' ] ,[ '数字字段4', 'int4' ],[ '数字字段5', 'int5' ],\r\n [ '文本字段1', 'text1' ],[ '文本字段2', 'text2' ],[ '文本字段3', 'text3' ],[ '文本字段4', 'text4' ],[ '文本字段5', 'text5' ],\r\n [ '文本字段6', 'text6' ],[ '文本字段7', 'text7' ],[ '文本字段8', 'text8' ],[ '文本字段9', 'text9' ],[ '文本字段10', 'text10' ]]\r\n end",
"def validate_field_types\n database_field_names.each do |field|\n field_info = self.class.get_table_info.select {|hash| hash[\"name\"] == field}.first\n check_field_value_matches_data_type(field_info, field) \n end\n @errors\n end",
"def simplified_type(field_type)\n case field_type\n # Numeric and monetary types\n when /^(?:real|double precision)$/ then :float\n # Monetary types\n when 'money' then :decimal\n # Character types\n when /^(?:character varying|bpchar)(?:\\(\\d+\\))?$/ then :string\n # Binary data types\n when 'bytea' then :binary\n # Date/time types\n when /^timestamp with(?:out)? time zone$/ then :datetime\n when 'interval' then :string\n # Geometric types\n when /^(?:point|line|lseg|box|\"?path\"?|polygon|circle)$/ then :string\n # Network address types\n when /^(?:cidr|inet|macaddr)$/ then :string\n # Bit strings\n when /^bit(?: varying)?(?:\\(\\d+\\))?$/ then :string\n # XML type\n when 'xml' then :xml\n # tsvector type\n when 'tsvector' then :tsvector\n # Arrays\n when /^\\D+\\[\\]$/ then :string\n # Object identifier types\n when 'oid' then :integer\n # UUID type\n when 'uuid' then :string\n # Small and big integer types\n when /^(?:small|big)int$/ then :integer\n # Pass through all types that are not specific to PostgreSQL.\n else\n super\n end\n end",
"def get_field_type(field_name)\n\t\tend",
"def column_type(type_indicator)\n case type_indicator\n when :eval; :text\n when :text; :text\n when :string; :string\n when :sec; :double\n when :msec; :double\n when :duration; :double\n when :float; :double\n when :double; :double\n when :integer; :integer\n when :int; :int\n when :timestamp; :datetime\n when :datetime; :datetime\n when :date; :date\n else :string\n end\n end",
"def fish_type_params\n ActiveModelSerializers::Deserialization.jsonapi_parse(params)\n end",
"def paramstype\n \"Array\"\n end",
"def get_datatype(field)\n #Remove if field has any comma's for int and float rep\n if field != nil && field.class == String\n num = field.gsub(/,/,'')\n else\n num = field\n end\n if(Integer(num) rescue false)\n if num.class == Float\n return \"float\"\n end\n return \"int\"\n elsif(Float(num) rescue false)\n return \"float\"\n elsif(Date.parse(field) rescue false || Date.strptime(field, '%m/%d/%Y') rescue false || Date.strptime(field, '%m-%d-%Y') rescue false || Date.strptime(field, '%m %d %Y') rescue false)\n if datetime_pattern(field)\n if field =~ /:/ # To check if the field contains any pattern for Hours:minutes\n return \"datetime\"\n else\n return \"date\"\n end\n end\n end\n return \"string\"\n end",
"def get_datatype(field)\n #Remove if field has any comma's for int and float rep\n if field != nil && field.class == String\n num = field.gsub(/,/,'')\n else\n num = field\n end\n if(Integer(num) rescue false)\n if num.class == Float\n return \"float\"\n end\n return \"int\"\n elsif(Float(num) rescue false)\n return \"float\"\n elsif(Date.parse(field) or Date.strptime(field, '%m/%d/%Y') or Date.strptime(field, '%m-%d-%Y') or Date.strptime(field, '%m %d %Y') rescue false)\n if datetime_pattern(field)\n if field =~ /:/ # To check if the field contains any pattern for Hours:minutes\n return \"datetime\"\n else\n return \"date\"\n end\n end\n end\n return \"string\"\n end",
"def get_data_type\n get_field_config['type']\n end",
"def schema_array_type(db_type)\n :array\n end",
"def types\n @stmt.types\n end",
"def get_field_type\n\t\tend",
"def field(*params)\n config = params.extract_options!\n config.assert_valid_keys(*::Schemaless::Field::VALID_OPTS)\n type = config.delete(:type)\n type ||= params.size > 1 ? params.pop : :string # TBD\n name = params.join\n schemaless_fields <<\n ::Schemaless::Field.new(name, type, config)\n end"
] |
[
"0.6660835",
"0.64402235",
"0.6266272",
"0.59910387",
"0.58440995",
"0.5803015",
"0.5777114",
"0.5774889",
"0.5740401",
"0.57320464",
"0.57033545",
"0.5646276",
"0.56369185",
"0.56158304",
"0.56158304",
"0.56158304",
"0.56158304",
"0.56158304",
"0.5610856",
"0.5563489",
"0.55446774",
"0.5529439",
"0.54996794",
"0.5485439",
"0.54825103",
"0.54615855",
"0.5415157",
"0.5355013",
"0.53456503",
"0.5323759",
"0.5323753",
"0.53004354",
"0.52967805",
"0.5294838",
"0.52906454",
"0.52709776",
"0.5249834",
"0.5247829",
"0.5231452",
"0.5231452",
"0.5231452",
"0.52248996",
"0.5211028",
"0.5202897",
"0.5196507",
"0.5182172",
"0.5180377",
"0.51779735",
"0.51776767",
"0.5169199",
"0.5161172",
"0.51597935",
"0.51586777",
"0.5154964",
"0.5143421",
"0.5127708",
"0.5123361",
"0.51182526",
"0.5118013",
"0.5096481",
"0.5086085",
"0.5059445",
"0.50496006",
"0.5044088",
"0.5042951",
"0.50336236",
"0.5011626",
"0.5009842",
"0.500187",
"0.49913165",
"0.49856508",
"0.49852598",
"0.49852598",
"0.49852598",
"0.49852598",
"0.49852598",
"0.4984669",
"0.4983948",
"0.49826702",
"0.497786",
"0.49600923",
"0.49568188",
"0.4953159",
"0.49453446",
"0.49438718",
"0.4938018",
"0.49153897",
"0.4901713",
"0.4900247",
"0.48971575",
"0.48856503",
"0.4871738",
"0.48705402",
"0.48677844",
"0.48653492",
"0.48590237",
"0.48588854",
"0.48530835",
"0.48502922",
"0.4848358"
] |
0.6213474
|
3
|
Retrieve a nested field by name, if the type property is set to `RECORD`. Will return `nil` otherwise.
|
def field name
f = fields.find { |fld| fld.name == name.to_s }
return nil if f.nil?
yield f if block_given?
f
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_field_by_name(name)\n self.class.get_field_by_name(name)\n end",
"def get_field_by_name(name)\n self.class.get_field_by_name(name)\n end",
"def get_field(field_name)\n fields = @data_source['fields']\n \n fields.each do | f |\n if f['name'] == filed_name\n return f\n end\n end \n return nil\n end",
"def get_field_by_name(name)\n name = name.to_sym\n fields.values.find {|field| field.name == name}\n end",
"def field_by_name(name = nil)\n @fields.find { |h| h[:name].to_snym == name.to_snym }\n end",
"def get_field(tag_or_name)\n case tag_or_name\n when Integer then get_field_by_tag(tag_or_name)\n when String, Symbol then get_field_by_name(tag_or_name)\n else raise TypeError, tag_or_name.class\n end\n end",
"def field(p,field_name)\n f = p.fields.find {|f| f.name == field_name}\n if f.nil? then\n return nil\n else\n return f.value\n end\nend",
"def get_field(tag_or_name)\n self.class.get_field(tag_or_name)\n end",
"def get_field(tag_or_name)\n self.class.get_field(tag_or_name)\n end",
"def get_field(tag_or_name)\n case tag_or_name\n when Integer, String, Symbol\n field_dictionary[tag_or_name]\n else\n raise TypeError, tag_or_name.class\n end\n end",
"def field(l_name)\n fields.find{|fld| fld.l_name == l_name}\n end",
"def get_field(parent_type, field_name)\n with_definition_error_check do\n parent_type_name = case parent_type\n when GraphQL::BaseType\n parent_type.name\n when String\n parent_type\n else\n raise \"Unexpected parent_type: #{parent_type}\"\n end\n\n defined_field = @instrumented_field_map[parent_type_name][field_name]\n if defined_field\n defined_field\n elsif parent_type == query && (entry_point_field = introspection_system.entry_point(name: field_name))\n entry_point_field\n elsif (dynamic_field = introspection_system.dynamic_field(name: field_name))\n dynamic_field\n else\n nil\n end\n end\n end",
"def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end",
"def field name\n @fields[name]\n end",
"def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end",
"def get_field(name)\n self[name]\n end",
"def get_field(parent_type, field_name)\n with_definition_error_check do\n parent_type_name = case parent_type\n when GraphQL::BaseType, Class, Module\n parent_type.graphql_name\n when String\n parent_type\n else\n raise \"Unexpected parent_type: #{parent_type}\"\n end\n\n defined_field = @instrumented_field_map[parent_type_name][field_name]\n if defined_field\n defined_field\n elsif parent_type == query && (entry_point_field = introspection_system.entry_point(name: field_name))\n entry_point_field\n elsif (dynamic_field = introspection_system.dynamic_field(name: field_name))\n dynamic_field\n else\n nil\n end\n end\n end",
"def get_ext_field_by_name(name)\n name = name.to_sym\n extension_fields.values.find {|field| field.name == name}\n end",
"def find_field(name_or_id)\n self.fields.detect { |field| field.matches?(name_or_id) }\n end",
"def get_ext_field_by_name(name)\n extension_fields.values.find {|field| field.name == name.to_sym}\n end",
"def get_field_by_name(fields_list, name)\n fields_array = arrayize(fields_list)\n index = fields_array.find_index {|field| field[:name].eql?(name)}\n return (index.nil?) ? nil : fields_array.at(index)\n end",
"def fetch_field\n return nil if @field_index >= @fields.length\n ret = @fields[@field_index]\n @field_index += 1\n ret\n end",
"def get_ext_field(tag_or_name)\n case tag_or_name\n when Integer; get_ext_field_by_tag tag_or_name\n when String, Symbol; get_ext_field_by_name tag_or_name\n else; raise TypeError.new(tag_or_name.class)\n end\n end",
"def field(identifier)\n ensure_loaded do\n fields.each do |f|\n return f if f.identifier == identifier\n end\n end\n \n nil\n end",
"def get(name)\n if @fields.has_key?(name.lexeme)\n @fields[name.lexeme]\n else\n method = @klass.find_method name.lexeme\n unless method.nil?\n method.bind self\n else\n message = \"Undefined property '#{name.lexeme}'.\"\n raise LoxRuntimeError.new(name, message)\n end\n end\n end",
"def [](name_or_sym_or_field)\n return field_reference[:attr_syms ][name_or_sym_or_field] if @field_map[:attr_syms ].has_key?(name_or_sym_or_field)\n return field_reference[:ui_labels ][name_or_sym_or_field] if @field_map[:ui_labels ].has_key?(name_or_sym_or_field)\n return field_reference[:json_fields][name_or_sym_or_field] if @field_map[:json_fields].has_key?(name_or_sym_or_field)\n end",
"def get_ext_field(tag_or_name)\n case tag_or_name\n when Integer then get_ext_field_by_tag(tag_or_name)\n when String, Symbol then get_ext_field_by_name(tag_or_name)\n else raise TypeError, tag_or_name.class\n end\n end",
"def sub_field(named, human_name = nil, &block)\n human_name ||= named\n @sub_fields << QueryBuilder::Field.new(named, human_name, self.depth+1, &block)\n end",
"def get_field(field_name)\n\t\tend",
"def get(*nested_field_names, &b)\n if nested_field_names.size == 1\n field_name = nested_field_names.first\n field = self.class.field_for_name(field_name)\n raise ArgumentError.new unless field\n unless self.value_for_tag?(field.tag)\n return b ? b.call : nil\n end\n return self.value_for_tag(field.tag)\n end\n last_proto = nested_field_names[0..-2].inject(self) do |sub_proto, ifield_name|\n sub_field = sub_proto.class.field_for_name(ifield_name)\n raise ArgumentError.new unless sub_field\n raise ArgumentError.new unless sub_field.is_a?(ProtocolBuffers::Field::MessageField)\n unless sub_proto.value_for_tag?(sub_field.tag)\n return b ? b.call : nil\n end\n sub_proto.value_for_tag(sub_field.tag)\n end\n last_field_name = nested_field_names.last\n last_field = last_proto.class.field_for_name(last_field_name)\n unless last_proto.value_for_tag?(last_field.tag)\n return b ? b.call : nil\n end\n last_proto.value_for_tag(last_field.tag)\n end",
"def fetch_field(expected_key = nil, &block)\n find_field(expected_key, &block) ||\n (raise FieldNotFound,\n \"no such field `#{expected_key}` for #{self}.\")\n end",
"def field_records_by_field_name(name)\n records = self.field_records.select { |record| record.fieldset_child.child.name == name }\n return records\n \n # this version uses less queries but feels less elegant\n # field = DynamicFieldsets::Field.find_by_name(name)\n # child = DynamicFieldsets::FieldsetChild.where(:child => field, :fieldset => self.fieldset).first\n # records = DynamicFieldsets::FieldRecord.where(:child => child, :associator => self)\n # return records\n end",
"def field_locator(name)\n locator_by_type(:field, name)\n end",
"def field (key)\n\n return self.yattributes[key.to_s] if self.yattributes\n\n fields.find_by_fkey(key.to_s)\n end",
"def find_field(expected_key = nil, &block)\n if block_given?\n each_field do |key, field|\n return field if block.call(key, field)\n end\n else\n each_field do |key, field|\n return field if expected_key == key\n end\n end\n nil\n end",
"def find_obj_for_name(name)\n idx = @field_names.index(name)\n if idx\n instantiate_obj(idx)\n @field_objs[idx].obj\n else\n nil\n end\n end",
"def fetch name\n raise \"ERROR: Field with name #{name} does not exist!\" if !@format[name]\n @format[name]\n end",
"def get_field_by_id(id, params = {})\n get(\"/fields/#{id}\", params)\n end",
"def general_field(name)\n self.general_fields.where(fieldable_id: self.id).where(\"payload->>'key' = ?\", name).first\n end",
"def get_field(field_name)\n fields[field_name] || interface_fields[field_name]\n end",
"def get_field_value(obj, name)\n begin\n @struct_field_getter.call(obj, name)\n rescue\n 0\n end\n end",
"def field(name); end",
"def field key\n @fields.get key\n end",
"def nested_t_field_or_nil(level1, level2)\n if self[level1]\n self[level1][level2] ? self[level1][level2]['$t']: nil\n end\n end",
"def [](field)\n @fields.has_key?(field.to_s) ? @fields[field.to_s] : nil\n end",
"def [](field)\n @fields.has_key?(field.to_s) ? @fields[field.to_s] : nil\n end",
"def fields_for(record_name, record_object = T.unsafe(nil), fields_options = T.unsafe(nil), &block); end",
"def [](field_name)\n get(field_name)\n end",
"def [](field_name)\n find_field_by_name(field_name) || raise(FieldNotFoundError, \"Field named '#{field_name}' not found in form.\")\n end",
"def stack_load_field(name)\n\n Lib.lua_getfield(@pointer, -1, name)\n end",
"def field(lookup = nil)\n if !(lookup.to_s =~ INTEGER_REGEXP).nil?\n field_by_id(lookup)\n else\n field_by_name(lookup)\n end\n end",
"def get_for_field(name)\n @locations.select { |location| location.field == name }\n end",
"def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end",
"def [](field_name)\n f = field(field_name)\n f && f.value\n end",
"def fields_for(record_name, record_object = T.unsafe(nil), options = T.unsafe(nil), &block); end",
"def subfield_value(field, subfield)\n sub = field.subfields.find {|s| s.code == subfield}\n if sub.nil?\n return nil\n end\n sub.value\nend",
"def find_field_by_name(field_name)\n product_field_id = self.product_fields.find_by(name: field_name).id\n stock_field = self.stock_fields.select do |stock_field|\n stock_field.product_field_id == product_field_id\n end.first\n end",
"def parse_field(field_name)\n element_spec = @@spec.values.\n select {|v| (v['name']) =~ /^#{field_name}$/i}.\n first\n self.send(element_spec['node'])\n end",
"def get_field(name, field_name, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_field_with_http_info(name, field_name, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_field_with_http_info(name, field_name, opts)\n else\n raise\n end\n return data\n end",
"def get_struct(field)\n field['structValue']\n end",
"def find_name_by_reflection(field, id)\n return nil if id.blank?\n @detail_value_name_by_reflection ||= Hash.new do |hash, key|\n association = Issue.reflect_on_association(key.first.to_sym)\n name = nil\n if association\n record = association.klass.find_by_id(key.last)\n if record\n name = record.name.force_encoding('UTF-8')\n end\n end\n hash[key] = name\n end\n @detail_value_name_by_reflection[[field, id]]\n end",
"def find_var(name, depth = 0)\n return @self_reference if name == @name\n\n @parent.find_var(name, depth + 1)\n end",
"def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end",
"def get_field(key)\n @form_fields.getField key.to_s\n end",
"def child_get(name)\n child = @children.select{ |elem| name.eql?(elem.name) }\n return nil unless child\n child\n end",
"def field_by_id(id = nil)\n @fields.find { |h| h[:id] == id.to_s }\n end",
"def by_name(name)\n elt = self[name]\n return elt unless elt.nil?\n\n @elements.each_key do |subelt_name|\n if self[subelt_name].is_a?(Model)\n elt = self[subelt_name][name]\n return elt unless elt.nil?\n end\n end\n\n nil\n end",
"def lookup_field_type(name)\n result = config.field_types.find(name)\n raise UnregisteredFieldTypeError, name if result.nil?\n\n result\n end",
"def field\n @field ||= quoted_field(field_name)\n end",
"def [](name_or_index)\n if name_or_index.kind_of? Integer\n temp = @fields[name_or_index]\n temp = temp.value unless temp.nil?\n else\n name = Field.name_canonicalize(name_or_index)\n result = detect { |n, v|\n if n.downcase == name then true else false end\n }\n if result.nil? then nil else result[1] end\n end\n end",
"def [](name)\n fields[name.to_sym] || parent && parent.provide(name)\n end",
"def name\n self.general_fields.where(fieldable_id: self.id).where(\"payload->>'key' = 'name'\").first.value\n end",
"def find_entries_custom_field(id_or_name)\n return nil if id_or_name.nil? # bypass the memoization\n\n _field = self.entries_custom_fields.find(id_or_name) rescue nil\n _field || self.entries_custom_fields.where(name: id_or_name).first\n end",
"def find_screen_field(field_name)\n @screen.fields.find {|field| field.name == field_name }\n end",
"def semantic_fields_for(record_or_name_or_array, *args, &block)\n fields_for(record_or_name_or_array, *args, &block)\n end",
"def field_find(**args)\n # if looking for a specific field, use built-in hash for initial filter,\n # otherwise get all fields.\n fields_in_scope =\n if args[:tag].is_a?(String)\n fields(args[:tag]).dup\n else\n @fields.dup\n end\n fields_in_scope.each { |f| return f if f.meets_criteria?(args) }\n nil\n end",
"def getFieldValue( name , formName = \"\" , frameName = \"\" )\n # returns the current value of the field\n \n fname = getFunctionName()\n log fname + ' Starting. getting value for field with name: ' + name if $debuglevel >=0\n\n begin # if there are 2 elements with the same name, we get an exception - so we need a different version of this method\n\n container = getObjectContainer( name , formName , frameName )\n\n o = nil\n v = \"\"\n container.all.each do |c|\n next unless o == nil\n begin\n if c.name.to_s == name \n #log 'Hack:: found the object. '\n o = c\n end\n rescue\n # probably no name\n end\n end\n if o != nil\n v = o.value.to_s\n else\n v = nil\n end\n\n rescue => e\n showException(e)\n v = nil \n end \n return v\n \n end",
"def subfield(tag)\n subfields.find { |sf| sf.tag == tag.to_s }\n end",
"def field_named(name)\n ensure_setup!\n field_set.field_named(name)\n end",
"def field\n @field ||= @options.fetch(:field, repository.adapter.field_naming_convention.call(name))\n end",
"def read_metadata_field(field_name)\n @client.get(\"#{metadata_path}/#{field_name}\")\n end",
"def get(name)\n return @table[name] if @table.has_key?(name)\n return @parent.get(name) unless @parent.nil?\n return nil\n end",
"def field_called(field_name)\n return nil if field_name.to_s.empty?\n # return nil if field_name.to_s.empty?\n @fields[field_name.to_sym]\n end",
"def get_field_config\n fields = @screen.get_screen_config['fields'].select do |field|\n field['name'] == @name\n end\n\n unless fields.size == 1\n raise \"Invalid results when looking for field '#{@name}'\"\n end\n\n fields[0]\n end",
"def get_field(field_name)\n field_name = field_name.to_sym\n field = @field_references[field_name]\n if field.nil?\n unless @@is_a_java_class\n field = method(field_name).call\n else\n field_object = nil\n [field_name.to_s, field_name.camelize, field_name.camelize(false)].uniq.each do |name|\n begin\n field_object = self.class.send(:class_variable_get, :@@java_class).java_class.declared_field(name)\n rescue NameError, NoMethodError => e\n end\n break unless field_object.nil?\n end\n raise UndefinedControlError, \"There is no control named #{field_name} on view #{@main_view_component.class}\" if field_object.nil?\n \n field_object.accessible = true\n field = Java.java_to_ruby(field_object.value(Java.ruby_to_java(@main_view_component)))\n end\n @field_references[field_name] = field\n end\n field\n end",
"def method_field(name)\n self.method_fields.where(fieldable_id: self.id).where(\"payload->>'key' = ?\", name).first\n end",
"def get_record zone, name\n get_all_records_for_zone(zone).each do |rec|\n return rec if rec['display_name'] == name && rec['zone_name'] == zone\n end rescue NoMethodError\n nil\n end",
"def [] (name)\n field = schema.fields[name.to_s]\n read_attribute(field, self) if field\n end",
"def get(field)\n self.class.get(field, @data)\n end",
"def variables(name = nil, &block)\n NodeCache.find_children_of_type(self, \"Field\", name)\n end",
"def field(name, options={}, &blk)\n slice(name, {:count=>1, :collapse=>true}.merge(options), &blk)\n end",
"def read_attribute(name)\n fields[name].get(@attributes[name])\n end",
"def dynamic_getter(name)\n field = self.content_type.find_field(name)\n value = self.localized_dynamic_attribute_value(field)\n\n case field.type\n when :date, :date_time\n value.is_a?(String) ? Chronic.parse(value) : value\n when :file\n value.present? ? { 'url' => value } : nil\n when :belongs_to\n field.klass.find_entry(value)\n when :has_many\n field.klass.find_entries_by(field.inverse_of, [self._label, self._permalink])\n when :many_to_many\n field.klass.find_entries_among(value)\n else\n # :string, :text, :select, :boolean, :email, :integer, :float, :tags\n value\n end\n end",
"def get_field_value(data, field_name)\n data[field_name]['__content__'] if data[field_name]\n end",
"def field_attribute(attr)\n return 'id' if attr == :_id\n # default, simply return name\n return attr unless attr.is_a? Hash\n # else, Hash\n return attr[:object] if attr.has_key? :object\n return attr[:array] if attr.has_key? :array\n return attr[:value] if attr.has_key? :value\n return attr[:link] if attr.has_key? :link\n\n attr.keys[0]\n end",
"def set_field\n @field = @nested_form.fields.find(params[:id])\n end",
"def find_single_record zone, name, content, type = 'A'\n get_records(zone, name).values.each do |rec|\n if rec['zone_name'] == zone \\\n && rec['display_name'] == name \\\n && rec['content'] == content \\\n && rec['type'] == type\n return rec\n end\n end\n nil\n end",
"def semantic_fields_for(record_name, record_object = nil, options = {}, &block)\n options, record_object = record_object, nil if record_object.is_a?(Hash) && record_object.extractable_options?\n options[:builder] ||= @@builder\n options[:custom_namespace] = options.delete(:namespace)\n\n with_custom_field_error_proc do\n self.fields_for(record_name, record_object, options, &block)\n end\n end",
"def get_field(field, serialize = true)\n if _cached?(field)\n return _cached_field(field) if _in_cache?(field)\n end\n\n response = if respond_to?(field)\n send(field)\n elsif object.respond_to?(field)\n object.send(field)\n else\n fail InvalidField, \"#{field} could not be found\"\n end\n\n if response.respond_to?(:serializable_hash) && serialize\n response = response.serializable_hash\n end\n\n if _cached?(field)\n _set_cached_field(field, response)\n else\n response\n end\n end",
"def yaml_field_type name\n self.yaml_fields[name]\n end"
] |
[
"0.66709703",
"0.66709703",
"0.6649633",
"0.6635229",
"0.6610409",
"0.64476484",
"0.6426916",
"0.6404205",
"0.6404205",
"0.63927656",
"0.6294397",
"0.62513715",
"0.6228461",
"0.6213466",
"0.62071985",
"0.6196045",
"0.61749434",
"0.58883244",
"0.58391106",
"0.57854563",
"0.57607925",
"0.5758375",
"0.56978536",
"0.5695252",
"0.56706065",
"0.56684583",
"0.564545",
"0.563168",
"0.5628938",
"0.5615192",
"0.5579308",
"0.5549764",
"0.55248356",
"0.5506083",
"0.5502856",
"0.5501601",
"0.54985887",
"0.54823655",
"0.54747146",
"0.5467514",
"0.5448372",
"0.543704",
"0.54221314",
"0.5421727",
"0.54076207",
"0.54076207",
"0.54037124",
"0.53892297",
"0.53843176",
"0.5380584",
"0.5368504",
"0.53477204",
"0.5346867",
"0.53423935",
"0.5339117",
"0.5311091",
"0.53109777",
"0.5290378",
"0.5286573",
"0.5272383",
"0.52645075",
"0.52584594",
"0.52515084",
"0.5239218",
"0.5226601",
"0.5188584",
"0.51834357",
"0.5177464",
"0.5172467",
"0.51676154",
"0.5164342",
"0.5142975",
"0.51369655",
"0.5133082",
"0.51237226",
"0.5111722",
"0.51010364",
"0.5085945",
"0.50838214",
"0.50816506",
"0.50809145",
"0.507367",
"0.50716305",
"0.5058502",
"0.5049912",
"0.50359476",
"0.50304294",
"0.5028515",
"0.50238585",
"0.50236887",
"0.5016319",
"0.5007783",
"0.50056994",
"0.49930087",
"0.49859783",
"0.49737167",
"0.49696115",
"0.49661365",
"0.49498802",
"0.494329"
] |
0.63999707
|
9
|
Adds a string field to the nested schema of a record field. This can only be called on fields that are of type `RECORD`.
|
def string name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil
record_check!
add_field name,
:string,
description: description,
mode: mode,
policy_tags: policy_tags,
max_length: max_length
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_field(name, type, options={})\n name = name.to_s\n \n # preconditions\n raise InvalidModelField.new(\"Duplicate field name\") if record_fields.key?(name)\n raise InvalidModelField.new(\"Type must be a known yodel field type\") unless valid_type?(type)\n raise InvalidModelField.new(\"Field name cannot start with an underscore\") if name.start_with?('_')\n \n # add the field to the model and subclasses\n field_type = Field.field_from_type(type.to_s)\n field = field_type.new(name, deep_stringify_keys(options.merge(type: type.to_s)))\n RecordIndex.add_index_for_field(self, field) if field.index?\n record_fields[name] = field\n end",
"def add_field_schema(name, type, schema)\n @field_names ||= [] ; @field_schemas ||= {}\n @field_names = @field_names | [name]\n schema = schema.symbolize_keys.merge({ :name => name })\n #\n # FIXME: this is terrible, especially given what's in TypeFactory anyway.\n #\n schema[:type] =\n case\n when type == Hash && schema.has_key?(:values) then Icss::Meta::TypeFactory.receive({ :type => :hash, :values => schema.delete(:values)})\n when type == Array && schema.has_key?(:items) then Icss::Meta::TypeFactory.receive({ :type => :array, :items => schema.delete(:items) })\n when type == Hash then IdenticalHashFactory\n when type == Array then IdenticalArrayFactory\n else\n Icss::Meta::TypeFactory.receive(type)\n end\n fld = (field_schemas[name] || make_field_schema).merge(schema)\n fld[:parent] = self\n @field_schemas[name] = fld\n end",
"def field(*params)\n config = params.extract_options!\n config.assert_valid_keys(*::Schemaless::Field::VALID_OPTS)\n type = config.delete(:type)\n type ||= params.size > 1 ? params.pop : :string # TBD\n name = params.join\n schemaless_fields <<\n ::Schemaless::Field.new(name, type, config)\n end",
"def <<(field)\n @fields << field.compact.join(':')\n end",
"def field(spec, name = nil, data_lambda = nil)\n add_field Field.new(String, spec, name || next_unknown_field_name, data_lambda)\n end",
"def get_string_field(field_name)\n\t\tend",
"def collection_name\n 'string_fields'\n end",
"def add_field(field)\n\t\tend",
"def add_field!(field_name, value = T.unsafe(nil)); end",
"def column_from_string_or_sym(string) #nodoc\n string.each do |name|\n add_field(name.to_sym, :string)\n end\n end",
"def column_from_string_or_sym(string) #nodoc\n string.each do |name|\n add_field(name.to_sym, :string)\n end\n end",
"def add_field!(field_name, value = nil)\n fields << Field.new({'name' => field_name}, value)\n end",
"def record(out, field_name, module_name, record_name)\n record_name = invalid_names[record_name] || record_name\n out << \" #{record_name.downcase()} :#{field_name}\\n\"\n end",
"def add_dynamo_field(field_name, field_type=:string)\n field_name = field_name.to_s\n field_type = field_type.to_s\n logger.debug \"Dynamo: add_dynamo field Name: #{field_name} FieldType: #{field_type} \"\n \n # Ensure a field with this name doesn't already exist for this particular class\n raise ArgumentError, \"The column #{field_name} already exists for the model #{self.to_s}\" if DynamoField.find(:all, :conditions=>['model = ? AND field_name = ?', self.to_s, field_name], :limit=>1).size > 0\n \n # Ensure a valid type is given\n raise ArgumentError, \"Invalid field type given: #{field_type}. Valid types are: #{VALID_FIELD_TYPES.keys.join(',')}\" unless VALID_FIELD_TYPES.has_key? field_type.to_sym\n \n # Create and save this new dynamic field.\n DynamoField.new(:model=>self.to_s, :field_name=>field_name, :field_type=>VALID_FIELD_TYPES[field_type.to_sym]).save!\n end",
"def get_string(field)\n field['stringValue']\n end",
"def add_field(identifier, value = nil)\n @fields << build_field(identifier, value)\n end",
"def add_field(field, data_type = nil, options = {})\n data_type = DataType::String if data_type.nil?\n puts [\":#{field}\", \"#{data_type.class.to_s}\", \"#{options.inspect}\"].collect { |s| s.ljust(25) }.join if ENV['DEBUG']\n \n # Fields that do special things go here.\n if field == :timestamps\n add_field(:updated_at, :datetime)\n add_field(:created_at, :datetime)\n return true\n end\n\n # Add index if explicitly asked\n @indexes << field if options.delete(:index) || data_type.class.to_s == 'Hash' && data_type.delete(:index)\n @validations[field] = options.delete(:validates) if options[:validates]\n options.merge!(:field => field) \n \n # Matches: description DataType::Paragraph, :index => true\n if data_type.is_a?(Class) && data_type.respond_to?(:migrant_data_type?)\n @columns[field] = data_type.new(options)\n # Matches: description :index => true, :unique => true\n else\n begin\n # Eg. \"My field\" -> String -> DataType::String\n @columns[field] = \"DataType::#{data_type.class.to_s}\".constantize.new(options.merge(:value => data_type))\n rescue NameError\n # We don't have a matching type, throw a warning and default to string\n puts \"MIGRATION WARNING: No migration implementation for class #{data_type.class.to_s} on field '#{field}', defaulting to string...\"\n @columns[field] = DataType::Base.new(options)\n end\n end\n end",
"def add_field(var_name, type, xml_tag, value=nil)\n @fields[var_name] = Field.new(var_name, type, xml_tag, value)\n end",
"def add_field! key, initial = nil, opts = {}, &block\n key = @schema.validate_new_key! key\n @values[key] = initial\n @schema.add_field! key, initial, opts, &block\n self\n end",
"def string(name)\n add_column String, name\n end",
"def to_responsys_field(s)\n if @@system_fields.include?(s)\n s.to_s.upcase + \"_\"\n else\n s.to_s.upcase\n end\n end",
"def record_text_for(name)\n (!@record.respond_to?(name) and name[0,1] == '_') ? '_record' : 'record'\nend",
"def record_text_for(name)\n (!@record.respond_to?(name) and name[0,1] == '_') ? '_record' : 'record'\nend",
"def add(name, type, offset = nil)\n if type.respond_to?(:to_str) || type.respond_to?(:to_sym)\n type = registry.build(type.to_s)\n end\n @fields << [name.to_s, type, offset]\n end",
"def schema(s)\n @config[:schema] = s\n end",
"def append(field)\n @fields.push(field)\n @fields.clean = false\n end",
"def add_field(name, value)\n raise ArgumentError.new(\"Found invalid XML 1.0 unicode character(s)\") if value.is_a? String and value =~ INVALID_CHAR_XML10\n @fields[name] = value\n end",
"def add(name, value, index = nil, params = nil)\n value = value.to_str\n if params\n value = value.dup\n sep = \"; \"\n params.each do |n, v|\n value << sep\n value << n.to_s\n value << '='\n v = v.to_s\n if v =~ /^\\w+$/\n value << v\n else\n value << '\"'\n value << v\n value << '\"'\n end\n end\n end\n field = Field.new(name, value)\n index ||= @fields.length\n @fields[index, 0] = field\n self\n end",
"def field_type=(value)\n super(value.to_s)\n end",
"def add_field(name, value, options = {})\n @fields << RSolr::Message::Field.new(options.merge({:name=>name}), value)\n end",
"def sub_field(named, human_name = nil, &block)\n human_name ||= named\n @sub_fields << QueryBuilder::Field.new(named, human_name, self.depth+1, &block)\n end",
"def add_field(name, sample_name, container_name, role, opts)\n raise \"Can't add field to #{self.class} before it has been saved.\" unless id\n\n sample_names = sample_name.nil? || sample_name.is_a?(String) ? [sample_name] : sample_name\n container_names = container_name.nil? || container_name.is_a?(String) ? [container_name] : container_name\n\n ft = field_types.create({ parent_id: id, name: name, ftype: 'sample', role: role }.merge(opts))\n ft.save\n\n if sample_names\n (0..sample_names.length - 1).each do |i|\n sample = SampleType.find_by(name: sample_names[i]) if sample_names[i].present?\n container = ObjectType.find_by(name: container_names[i]) if container_names[i].present?\n\n ft.allowable_field_types.create(\n sample_type_id: sample ? sample.id : nil,\n object_type_id: container ? container.id : nil\n )\n end\n end\n\n self\n end",
"def add_field(type, value)# {{{\n t = TLV.new(2,2)\n t.type = type\n t.value = value\n t.length = 4 + value.length\n self.payload += t.encode \n end",
"def add_raw(raw)\n @fields << Field.new(raw)\n self\n end",
"def add(field, val, boost=nil)\n return if val == nil\n return if val == ''\n if val.is_a? Array\n val.each {|v| self.add(field, v)}\n else\n self.addField(field, val)\n end\n self.boost = boost if boost\n end",
"def add_field(name, val)\n @data[name] = val\n self\n end",
"def add_field(name, val)\n @data[name] = val\n self\n end",
"def semantic_fields_for(record_name, record_object = nil, options = {}, &block)\n options, record_object = record_object, nil if record_object.is_a?(Hash) && record_object.extractable_options?\n options[:builder] ||= @@builder\n options[:custom_namespace] = options.delete(:namespace)\n\n with_custom_field_error_proc do\n self.fields_for(record_name, record_object, options, &block)\n end\n end",
"def field=(updated_field)\n self.field_data = updated_field.flatten.join\n end",
"def process_field(field_name)\n if ['id', 'name', 'first_name', 'node_id'].include?(field_name)\n \"#{table}.#{field_name}\"\n else\n super # raises\n end\n end",
"def inject_original_value (data,data_record,key,new_name)\n log.debug \"injecting original \", key\n\n if (data_record.length > 2)\n separator = SEPARATOR\n else\n separator = ''\n end\n # by inserting the details into the start of the string we only need to find the initial bracket\n # there is no need to parse the structure, worry about escaped characters etc\n data_record.insert(data_record.index('{')+1, '\"'+new_name+'\":'+data[key].to_s + separator)\n return data_record\n end",
"def field(name, type)\n @fields << Field.new(name, type, @fields.size, nil, {})\n end",
"def add_field(name, data_lambda = nil)\n name = next_unknown_field_name if name.nil?\n @fields << name.to_sym\n @lambdas[name.to_sym] = data_lambda if data_lambda\n end",
"def add(record)\n @server.add record.class.name, record.to_doc\n end",
"def field(name)\n unless @fields.include? name\n @fields.push name.to_s\n end\n end",
"def field_as_json(field)\n res = \"'#{field.name}' => @#{field.name}\"\n field_base_type = _schema_base_class(field.type).type_sym\n\n if %i(record enum).include?(field_base_type)\n res += case field.type.type_sym\n when :array\n '.map { |v| v&.as_json }'\n when :map\n '.transform_values { |v| v&.as_json }'\n else\n '&.as_json'\n end\n end\n\n res + (field.name == @fields.last.name ? '' : ',')\n end",
"def <<(field)\n list[field.name] = field\n end",
"def add_record(value)\n @children['record'][:value] << value\n end",
"def add_record(value)\n @children['record'][:value] << value\n end",
"def quote_type_name(string, schema = nil)\n name_schema, table = string.to_s.scan(/[^\".\\s]+|\"[^\"]*\"/)\n if table.nil?\n table = name_schema\n name_schema = nil\n end\n\n schema = schema || name_schema || 'public'\n Name.new(schema, table).quoted\n end",
"def field(name); end",
"def format_string(record, attribute, val)\n val\n end",
"def field_name= new_field_name\n frozen_check!\n @gapi.field_name = new_field_name\n end",
"def build_stringified_reference_for_record(record, keys)\n stringify_reference(keys.map { |attribute| record.public_send(attribute).to_s })\n end",
"def field(ffield, length, sourcetag, default = nil, &block)\n @fields << {\n afield: ffield,\n length: length, \n stag: sourcetag,\n default: default,\n block: block\n }\n end",
"def add_child_field(child_field_name)\n\n child_fields[child_field_name] = ''\n\n self.class.send :define_method, \"set_#{child_field_name}\" do |arg|\n\n child_fields[child_field_name] = arg\n\n end\n\n return method(\"set_#{child_field_name}\")\n\n end",
"def value_field\n \"string\"\n end",
"def post_process(record)\n len = record[@len_field.name] rescue nil\n if !len.nil? and len.is_a?(Fixnum)\n value = record[@string_field.name]\n value.slice!(len..-1)\n record[@string_field.name] = value # we can avoid reassignment assuming the value is a reference not a copy\n end\n end",
"def add_field(field_name)\n result_table = table.map { |row| row.merge!(field_name => nil) }\n File.write(@table_path, JSON.generate(result_table))\n end",
"def _ field\n as_name = [name, field].join(\"_\").to_sym\n AS[\"#{relationize}.(#{field})\", as_name, Bag.new([field, field_type(field)]), nil, :skip_type]\n end",
"def add_field(name, values, options = {})\n RSolr::Array.wrap(values).each do |v|\n field_attrs = { name: name }\n field_attrs[:type] = DocumentField if name.to_s == CHILD_DOCUMENT_KEY\n\n @fields << RSolr::Field.instance(options.merge(field_attrs), v)\n end\n end",
"def update_field_name\n self.field = field_name\n end",
"def field(spec, name = nil, data_lambda = nil)\n @field_specs << spec\n add_field(name, data_lambda)\n end",
"def add_field(field)\n fields[field.name] = field\n\n # first setup the Serializable property, this also creates the\n # initial attr for us\n property_accessor field.name\n # next we'll need to overwrite the writer created by property_accessor,\n # with our field validation one.\n define_field_writer field, field.name\n\n field.name\n end",
"def append_field_value(value)\n return unless current_field && value\n current_value << value.gsub(/\\s+/, ' ')\n end",
"def add(field_name, field_type, offset: current_size, skip: 0)\n field = type.add(field_name.to_s, field_type, offset: offset, skip: skip)\n @current_size = [current_size, field.offset + field.size].max\n field\n end",
"def set_field(field_name, field_value)\n super field_name.to_s, field_value.to_s\n end",
"def name=(val) @records.set(GRT_STRNAME, val); end",
"def add_empty_json_ld_schema(edited_document, schema, schema_name, schema_type, yaml) #:nodoc\r\n data = {}\r\n doc = DcJsonLd.new\r\n doc.name = schema_name\r\n doc.type = schema_type\r\n \r\n edited_document.dc_json_lds << doc\r\n schema.each do |element_name, element|\r\n next if element_name == 'level' # skip level element\r\n if yaml[element['type']]\r\n if element['n'].to_s == '1'\r\n # single element\r\n doc_1 = yaml[element['type'] ]\r\n data[element_name] = doc_1\r\n else\r\n # array\r\n add_empty_json_ld_schema(doc, yaml[element['type']], element_name, element['type'], yaml)\r\n end\r\n else\r\n data[element_name] = element['text']\r\n end\r\n end\r\n doc.data = data.to_yaml\r\n doc.save\r\nend",
"def set_buildtype_field(buildtype_id, field_name, field_value)\n path = \"buildTypes/#{buildtype_id}/#{field_name}\"\n put(path, :accept => :text, :content_type => :text) do |req|\n req.body = field_value\n end\n end",
"def update_field_lookup_strings(field=nil,data=nil,generate_objects=false)\n id = Validator::validate_field_lookup_string_arg(field)\n \n uri = URI.parse(@uri + '/Fields' + \"/#{id}\" +'/FieldLookupStrings')\n results = put(uri,data,generate_objects)\n end",
"def create(name:, application_type:, string_id: nil, account: nil)\n params = { name: name, application_type: application_type }\n params[:string_id] = string_id if string_id\n post account, 'field', params\n end",
"def field(model_attrib_sym, options = {}, &block)\n field_manager.add(scope, model_attrib_sym, options, &block)\n end",
"def dump_field(value, options)\n return if value.nil? || (value.respond_to?(:empty?) && value.empty?)\n\n case options[:type].to_s.upcase\n when \"S\"\n value\n when \"SS\"\n value.flatten\n when \"N\"\n \"#{value.to_f}\"\n when \"D\"\n \"#{value.to_i}\"\n when \"NS\"\n Set[*value.map {|v| \"#{v.to_f}\" }]\n when \"DS\"\n Set[*value.map {|v| \"#{value.to_i}\" }]\n when \"B\"\n AWS::DynamoDB::Binary.new(value)\n when \"BS\"\n Set[*value.map{|v| AWS::DynamoDB::Binary.new(v) }]\n end\n end",
"def handle_field(type, name)\n @records ||= Hash.new\n @classname ||= self.to_s.to_sym\n @fields ||= Hash.new\n @fields[name] = type\n self.instance_variable_set(\"@#{name}\".to_sym, nil)\n if RGSS_TYPES.include?(type)\n accessor = Proc.new do\n instance_var = self.instance_variable_get(\"@#{name}\".to_sym)\n CommonDB.rgss_access(type, instance_var) if instance_var\n end\n self.send(:define_method, name.to_sym, &accessor)\n else\n self.send(:attr_reader, name.to_sym)\n end\n self.send(:attr_writer, name.to_sym)\n return name\n end",
"def field\n @field ||= quoted_field(field_name)\n end",
"def add_field(params = {})\n post(\"/fields\", params)\n end",
"def add(tag, value)\n @fields[tag.to_sym] = value\n end",
"def renderRec(model, rec, result)\n nameSpace, base = assertNamespace(rec.name)\n L.info(\"Rendering record #{rec.name}\")\n result << %<\nmessage #{base} {\n>\n pbInt = 1\n rec.fields.each_key { | fldId|\n fld = rec.fields[fldId]\n ty = fld.dataType.type\n if fld.aggr && !fld.map?\n result << \"#{INDENT}repeated #{protoType(fld.dataType, model, rec)} #{fldId} = #{pbInt};\\n\"\n elsif fld.map?\n raise ArgumentError, %<Field \"#{fldId}\" of the rec \"#{base}\": for Protobuf, map can not be optional, it must be required> unless fld.isRequired\n result << \"#{INDENT}map<#{protoType(fld.dataType, model, rec)}, #{protoType(fld.trgType, model, rec)}> #{fldId} = #{pbInt};\\n\"\n elsif model.enums[ty] && model.enums[ty].is_a?(DataMetaDom::Mapping)\n raise ArgumentError, %<Field \"#{fldId}\" of the rec \"#{base}\": for Protobuf, map can not be optional, it must be required> unless fld.isRequired\n result << \"#{INDENT}map<#{protoType(model.enums[ty].fromT, model, rec)}, #{protoType(model.enums[ty].toT, model, rec)}> #{fldId} = #{pbInt};\\n\"\n elsif fld.isRequired\n result << \"#{INDENT}#{protoType(fld.dataType, model, rec)} #{fldId} = #{pbInt};\\n\"\n else\n result << \"#{INDENT}repeated #{protoType(fld.dataType, model, rec)} #{fldId} = #{pbInt};\\n\"\n end\n pbInt += 1\n }\n result << %q<}\n>\n end",
"def get_field(field, collection)\n if field.is_a?(Hash) # rubocop:disable Style/ConditionalAssignment\n field = \"#{field[:table]}.#{field[:field]}\"\n else\n field = \"#{collection.table_name}.#{field}\"\n end\n field_base.gsub(Placeholder::FIELD, field)\n end",
"def fields_for(record_name, record_object = T.unsafe(nil), fields_options = T.unsafe(nil), &block); end",
"def initialize(string = 'default')\n self.field = string\n end",
"def doc(str)\n @@docs[self.name] = self.name + \":\\n\" + str.gsub(/^\\s+/, '')\n end",
"def substruct(strbuf, name, len, klass, *extra_args)\n new=klass.new(strbuf, *extra_args)\n @fields << new\n @hash_references[name]=new\n meta_def name do new end\n # More informative than the NoMethodError they would normally get.\n meta_def (name.to_s + '=').to_sym do raise NoMethodError, \"Binstruct: Illegal call of '=' on a substruct.\" end\n end",
"def normalizeField(string)\n string.gsub /_id|_/, \" \"\n end",
"def add(field)\n if field.is_a? String\n field = FormField.new(field)\n end\n\n return self if @fields_by_index.include? field\n\n @fields_by_index << field\n @fields[field.label] = field\n self\n end",
"def record_name(record)\n spokesfield ? record.send(spokesfield) : \"#{human_resource} #{record.id}\"\n end",
"def simplified_type(field_type)\n case field_type\n when /tsvector/i\n :text\n when /regprocedure/i\n :string\n else\n simplified_type_base(field_type)\n end\n end",
"def generic_document_fields(config_field)\n send(:\"document_#{config_field}s\")\n end",
"def generic_document_fields(config_field)\n send(:\"document_#{config_field}s\")\n end",
"def addRecord(rec); @records[rec.key] = rec end",
"def field(sym, options={})\n options[:type] ||= Integer\n @fields[sym.to_sym] = options\n end",
"def add(record, zone)\n new_answers = [{ answer: build_api_answer_from_record(record) }]\n\n record_fqdn = record.fqdn.sub(/\\.$/, '')\n\n existing_record = client.record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type\n )\n\n if existing_record.nil?\n client.create_record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type,\n params: {\n answers: new_answers,\n ttl: record.ttl,\n use_client_subnet: false, # only required for filter chains that are not supported by record_store\n }\n )\n return\n end\n\n existing_answers = existing_record['answers'].map { |answer| symbolize_keys(answer) }\n client.modify_record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type,\n params: { answers: existing_answers + new_answers, ttl: record.ttl }\n )\n end",
"def apply_validations_for_string\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a String\") if value && (! value.kind_of?(String)) && (! value.kind_of?(Symbol))\n end\n end",
"def _field_type(avro_schema)\n Deimos::SchemaBackends::AvroBase.field_type(avro_schema)\n end",
"def quote(fld)\n case fld\n when DateTime, Time\n %Q|'#{fld.to_s[0..-7]}'|\n when String, Symbol\n %Q|'#{escape fld.to_s}'|\n else\n super\n end\n\n end",
"def <<(str)\n raise RecordTooLarge.new(str) if str.bytesize >= MAX_BYTES_PER_RECORD\n @buffer << str\n end",
"def get_string_value(field_name)\n\t\tend",
"def strclass=(val) @records.set(GRT_STRCLASS, val); end",
"def add_string\n \"will be created.\"\n end"
] |
[
"0.5786031",
"0.5729764",
"0.5623608",
"0.56012726",
"0.5588057",
"0.55741584",
"0.55379826",
"0.5454162",
"0.54332656",
"0.5416976",
"0.5416976",
"0.5364636",
"0.53565776",
"0.53413695",
"0.531755",
"0.51861954",
"0.51587254",
"0.5148187",
"0.5145978",
"0.51384264",
"0.51112676",
"0.5094488",
"0.5094488",
"0.5092431",
"0.5086398",
"0.50857186",
"0.5077561",
"0.50683504",
"0.505436",
"0.5036488",
"0.5035584",
"0.5029412",
"0.5022466",
"0.5020575",
"0.50078255",
"0.49854973",
"0.49854973",
"0.49585503",
"0.4955501",
"0.4950741",
"0.49378306",
"0.49259865",
"0.49168047",
"0.49041897",
"0.48998055",
"0.48541602",
"0.4849247",
"0.4846265",
"0.4846265",
"0.48399758",
"0.48235083",
"0.48197222",
"0.48171788",
"0.47974235",
"0.4794211",
"0.4790045",
"0.47772172",
"0.4762652",
"0.47341976",
"0.4728983",
"0.47289574",
"0.4727829",
"0.4724744",
"0.47226834",
"0.47185832",
"0.4710678",
"0.4710247",
"0.47009003",
"0.46967968",
"0.46961325",
"0.46947786",
"0.4688172",
"0.46726006",
"0.46448934",
"0.46235797",
"0.46200332",
"0.46183106",
"0.46177915",
"0.46090794",
"0.46061814",
"0.46024925",
"0.4597983",
"0.45974165",
"0.45888782",
"0.45761827",
"0.4574891",
"0.45738193",
"0.4573693",
"0.4571455",
"0.4571455",
"0.45704857",
"0.45656088",
"0.45616204",
"0.45551366",
"0.45529926",
"0.45511183",
"0.45497924",
"0.45473748",
"0.45397815",
"0.4534079"
] |
0.4891323
|
45
|
Adds an integer field to the nested schema of a record field. This can only be called on fields that are of type `RECORD`.
|
def integer name, description: nil, mode: :nullable, policy_tags: nil
record_check!
add_field name, :integer, description: description, mode: mode, policy_tags: policy_tags
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def declare_integer_field(model, declaration)\n precision = declaration.attributes[:h_precision] || declaration.attributes[:precision] || 0\n declaration.remove_attributes! :h_precision, :precision\n if precision==0\n model.integer_h declaration.name\n else\n model.number_h declaration.name, :precision=>precision\n end\n end",
"def should_be_integer?(field_info, field)\n field_info[\"type\"] == \"INTEGER\"\n end",
"def attr_set_integer(attr_type, number)\n #This is a stub, used for indexing\n end",
"def initialize_integer(field_info, field)\n if should_be_integer?(field_info, field) && !integer_exception?(field)\n update_value_of_variable(field, self.send(field).to_i)\n end\n end",
"def field(sym, options={})\n options[:type] ||= Integer\n @fields[sym.to_sym] = options\n end",
"def record_id=(value)\n doc['record_id'] = value\n end",
"def push_my_field\n <<-CODE\n next_int;\n stack_push(NTH_FIELD(c->self, _int));\n CODE\n end",
"def type_literal_generic_integer(column)\n :integer\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 apply_validations_for_integer\n options = { :numericality => { :only_integer => true } }\n options[:allow_nil] = true unless not_nullable?\n flex_column_class.validates field_name, options\n end",
"def increments(field, options = {})\n incrementing_fields[field] = options.reverse_merge!(auto: true)\n attr_protected(field) if respond_to?(:attr_protected)\n end",
"def add_field_schema(name, type, schema)\n @field_names ||= [] ; @field_schemas ||= {}\n @field_names = @field_names | [name]\n schema = schema.symbolize_keys.merge({ :name => name })\n #\n # FIXME: this is terrible, especially given what's in TypeFactory anyway.\n #\n schema[:type] =\n case\n when type == Hash && schema.has_key?(:values) then Icss::Meta::TypeFactory.receive({ :type => :hash, :values => schema.delete(:values)})\n when type == Array && schema.has_key?(:items) then Icss::Meta::TypeFactory.receive({ :type => :array, :items => schema.delete(:items) })\n when type == Hash then IdenticalHashFactory\n when type == Array then IdenticalArrayFactory\n else\n Icss::Meta::TypeFactory.receive(type)\n end\n fld = (field_schemas[name] || make_field_schema).merge(schema)\n fld[:parent] = self\n @field_schemas[name] = fld\n end",
"def add_integer_message_to_errors(field)\n @errors << {message: \"#{field} must be an Integer.\", variable: \"#{field}\"}\n end",
"def set_int(attr, val); end",
"def set_int(attr, val); end",
"def check_integer(field_info, field)\n if should_be_integer?(field_info, field) && !integer?(field) && !foreign_key?(field)\n add_integer_message_to_errors(field)\n end\n end",
"def increment!(field, options)\n options = options.dup\n model_name = (options.delete(:model_name) || self.class.model_name).to_s\n options[:scope] = evaluate_scope(options[:scope]) if options[:scope]\n options[:step] = evaluate_step(options[:step]) if options[:step]\n write_attribute(\n field.to_sym,\n Mongoid::Autoinc::Incrementor.new(model_name, field, options).inc\n )\n end",
"def add_integer(key, value)\n int = QueuedEmailInteger.find_by(queued_email_id: id, key: key.to_s)\n unless int\n int = QueuedEmailInteger.new\n int.queued_email_id = id\n int.key = key.to_s\n end\n int.value = value.to_i\n int.save\n int\n end",
"def store_my_field\n <<-CODE\n next_int;\n SET_FIELD(c->self, _int, stack_top());\n CODE\n end",
"def add_number\n return unless %w[techreport manual].include? @bib.type\n\n did = @bib.docidentifier.detect { |i| i.primary == true }\n did ||= @bib.docidentifier.first\n @item.number = did.id if did\n end",
"def get_int(attr); end",
"def __record_id=(value)\n @__record_id = value.nil? ? nil : value.to_i\n end",
"def handle_int(int, lineno_column)\n Literal.new int.to_i\n end",
"def get_integer_value(field_name)\n\t\tend",
"def attr_get_integer(attr_type, strict = true)\n #This is a stub, used for indexing\n end",
"def add_to_datatype(key, datatype)\n if csv_column_datatypes[key].nil?\n csv_column_datatypes[key] = {datatype => 1}\n else\n if csv_column_datatypes[key][datatype].nil?\n csv_column_datatypes[key][datatype] = 1\n else\n csv_column_datatypes[key][datatype] += 1\n end\n end\n end",
"def number_field(object_name, method, options = T.unsafe(nil)); end",
"def add_field(field)\n\t\tend",
"def validate_integer_type(field)\n if field.is_a?(Integer)\n return true\n else\n return false\n end\n end",
"def record_id\n doc['record_id']\n end",
"def id_from_record(record)\n f907 = record.find {|f| f.tag == \"907\"}\n f907.subfields.find {|s| s.code == \"a\"}.value\nend",
"def add_ins(obj)\n self.first.value = self.first.value + obj.first.value\n obj.type = 'int'\n self.type = 'int'\n end",
"def type_literal_generic_integer(column)\n column[:serial] ? :serial : super\n end",
"def type_literal_generic_integer(column)\n column[:serial] ? :serial : super\n end",
"def integer(key, opts={})\n @attrs[key.to_sym] = Attributes::IntegerAttr.new(key, opts)\n end",
"def type_literal_generic_fixnum(column)\n type_literal_generic_integer(column)\n end",
"def increment_bitfields column_name, *fields\n mask = self.class.increment_mask_for column_name, *fields\n self[column_name] = self[column_name] += mask\n save\n end",
"def add_field(name, type, options={})\n name = name.to_s\n \n # preconditions\n raise InvalidModelField.new(\"Duplicate field name\") if record_fields.key?(name)\n raise InvalidModelField.new(\"Type must be a known yodel field type\") unless valid_type?(type)\n raise InvalidModelField.new(\"Field name cannot start with an underscore\") if name.start_with?('_')\n \n # add the field to the model and subclasses\n field_type = Field.field_from_type(type.to_s)\n field = field_type.new(name, deep_stringify_keys(options.merge(type: type.to_s)))\n RecordIndex.add_index_for_field(self, field) if field.index?\n record_fields[name] = field\n end",
"def increment(field, amount = 1)\n #value = (self[field] || 0) + amount\n #self[field] = value\n #if !@parse_object_id\n # # TODO - warn that the object must be stored first\n # return nil\n #end\n\n body = {field => Parse::Increment.new(amount)}.to_json\n data = Parse.client.request(self.uri, :put, body)\n parse data\n self\n end",
"def add_field! key, initial = nil, opts = {}, &block\n key = @schema.validate_new_key! key\n @values[key] = initial\n @schema.add_field! key, initial, opts, &block\n self\n end",
"def add_field(identifier, value = nil)\n @fields << build_field(identifier, value)\n end",
"def define_field(type, name, number, options = {})\n fields[name] = type.__protofield__(type, name, number, options)\n field_accessors(name)\n end",
"def increment_integer(user_id)\n user = User.find user_id\n user.integer_value += 1\n user.save\n\n user\n end",
"def add(field_name, field_type, offset: current_size, skip: 0)\n field = type.add(field_name.to_s, field_type, offset: offset, skip: skip)\n @current_size = [current_size, field.offset + field.size].max\n field\n end",
"def integer_attr name, options = {}\n add_attribute(IntegerAttribute.new(name, options))\n end",
"def increment_bitfields column_name, *fields\n mask = increment_mask_for column_name, *fields\n update_all \"#{column_name} = #{column_name} + #{mask}\"\n end",
"def set_field_number(field_number)\n raise NotImplementedError, \"Implement this method in a child class\"\n end",
"def custom_attribute_field_id\n @ca_field_id ||= 0\n @ca_field_id += 1\n\n return \"custom_attribute_#{ @ca_field_id }\"\n end",
"def add_int(tag, value)\n value = value.to_i\n type = Type::POSITIVE_NUMBER\n if value < 0\n type = Type::NEGATIVE_NUMBER\n value *= -1\n end\n\n write_tag(tag, type)\n Varint.serialize(@io, value.abs)\n\n self\n end",
"def field_id(lookup = nil)\n field = field(lookup)\n field[:id].to_i if field\n end",
"def add_record(record)\n return unless @if_proc.call(record)\n\n condensed_record = condense_record(record)\n atoms = add_occurences(condensed_record, record.id)\n\n @storage.add(atoms)\n end",
"def add_record(record)\n condensed_record = condense_record(record)\n load_atoms(condensed_record)\n add_occurences(condensed_record,record.id)\n @records_size += 1\n end",
"def set_numeric_field\n @numeric_field = NumericField.find(params[:id])\n end",
"def add_int32(_tag, _val)\n raise NotImplementedError\n end",
"def add_record(record)\n return unless allow_indexing?(record)\n\n condensed_record = condense_record(record)\n atoms = add_occurences(condensed_record, record.id)\n\n @storage.add(atoms)\n end",
"def get_number(field)\n field['numberValue']\n end",
"def add_record(value)\n @children['record'][:value] << value\n end",
"def add_record(value)\n @children['record'][:value] << value\n end",
"def map_integer(ident, &block) ; map_primitive(:integer, ident, &block) ; end",
"def expand_association_to_ids fields\n expanded = {}\n fields.each_pair do |name, type|\n case type\n when 'belongs_to'\n expanded[\"#{name}_id\"] = 'integer'\n end\n end\n fields.merge(expanded)\n end",
"def create_record(attr = nil, force_id: false, no_raise: false, **)\n # noinspection RubyScope, RubyMismatchedReturnType\n super do |attr|\n attr[:backup] ||= {}\n attr[:row] ||= 1 + all_manifest_items(**attr)&.last&.row.to_i\n end\n end",
"def set_invoice_number\n self.invoice_number = self.id + 777777\n self.save\n end",
"def integer?(field)\n self.send(field).is_a? Integer\n end",
"def doc(doc_or_int = 1)\n case doc_or_int\n when Wgit::Document\n append_doc(doc_or_int)\n when Array\n doc_or_int.each { |doc| append_doc(doc) }\n when Integer\n doc_or_int.times { @@docs << DatabaseTestData.doc }\n else\n raise \"Invalid data type: #{url_or_int.class}\"\n end\n end",
"def add_field!(field_name, value = T.unsafe(nil)); end",
"def expect_integer name, value\n expect_type name,\n value,\n \"integer\",\n Integer\n end",
"def add(record)\n handle_drb_error { @server.add index_name, record.to_doc }\n end",
"def add_field(type, value)# {{{\n t = TLV.new(2,2)\n t.type = type\n t.value = value\n t.length = 4 + value.length\n self.payload += t.encode \n end",
"def record(record)\n @db.save_doc(record)\n end",
"def number\n HookNumber.new(number_record)\n end",
"def add(record, zone)\n new_answers = [{ answer: build_api_answer_from_record(record) }]\n\n record_fqdn = record.fqdn.sub(/\\.$/, '')\n\n existing_record = client.record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type\n )\n\n if existing_record.nil?\n client.create_record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type,\n params: {\n answers: new_answers,\n ttl: record.ttl,\n use_client_subnet: false, # only required for filter chains that are not supported by record_store\n }\n )\n return\n end\n\n existing_answers = existing_record['answers'].map { |answer| symbolize_keys(answer) }\n client.modify_record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type,\n params: { answers: existing_answers + new_answers, ttl: record.ttl }\n )\n end",
"def app_specific_record_id=(value)\n @children['app-specific-record-id'][:value] = value\n end",
"def create_integer_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil)\n path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'\n .gsub('{databaseId}', database_id)\n .gsub('{collectionId}', collection_id)\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if collection_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"collectionId\"')\n end\n\n if key.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"key\"')\n end\n\n if required.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"required\"')\n end\n\n params = {\n key: key,\n required: required,\n min: min,\n max: max,\n default: default,\n array: array,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::AttributeInteger\n )\n end",
"def belongs_to(*params)\n config = params.extract_options!\n name = \"#{params.join}_id\"\n schemaless_fields <<\n ::Schemaless::Field.new(name, :integer, config)\n super(*params)\n end",
"def set_id_fld(idFld, opts={}) \n ai = opts.fetch(:autoincrement) { true }\n define_class_method(:id_fld) {idFld.to_s.to_sym}\n define_class_method(:id_ai) {!!ai}\n end",
"def add(record)\n @server.add record.class.name, record.to_doc\n end",
"def addRecord(rec); @records[rec.key] = rec end",
"def add_field(var_name, type, xml_tag, value=nil)\n @fields[var_name] = Field.new(var_name, type, xml_tag, value)\n end",
"def increment!(name,amount=1)\n raise ArgumentError, \"Only integer fields can be incremented.\" unless self.class.fields.include?({:name => name.to_s, :type => :integer})\n store.update_count(field_key(name), amount)\n end",
"def increment_counter(counter_name, id)\n rec = collection.findOne({:_id => id})\n rec[counter_name] += 1\n collection.save(rec)\n end",
"def field(name, type)\n @fields << Field.new(name, type, @fields.size, nil, {})\n end",
"def price_field\n \"#{field_name.parameterize.gsub('-', '_')}_value_as_integer\"\n end",
"def transform_numbers_field fields,row_size\n count = 0\n @numbers.each do |n,arr|\n i = fields.delete(n) # delete the old field\n ## replace by the new fields instead\n arr.each { |v| fields[v] = row_size + count; count += 1 }\n end\n return fields\n end",
"def initialize(field_type, field_size, id)\n @field_type = field_type\n @field_size = field_size\n @id = id\n @@all_fields << self \n end",
"def define_field(rule, type, fname, tag, options)\n field_hash = options[:extension] ? extension_fields : fields\n if field_hash.keys.include?(tag)\n raise TagCollisionError, %!{Field number #{tag} has already been used in \"#{self.name}\" by field \"#{fname}\".!\n end\n field_hash[tag] = Field.build(self, rule, type, fname, tag, options)\n end",
"def number_record_params\n params.require(:number_record).permit(:value)\n end",
"def push_record(record)\n params = TogglRecord.new(record, config).push\n record[:id]\n end",
"def test_bump_numeric\n value_ = ::Versionomy.create([1, 9, 2, 'a', 2], :rubygems)\n value_ = value_.bump(:field2)\n assert_equal([1, 9, 3, 0, 0, 0, 0, 0], value_.values_array)\n end",
"def increase(attr)\n raise NoMethodError, \"undefined method `#{attr}` for #{self}\" unless self.respond_to?(attr)\n raise NotCounterbleError, \"not countable attributs `#{attr}` for #{self}\" unless countable.include? attr\n self.send(\"#{attr}=\", self.send(attr).send(:+, 1))\n end",
"def add(name, type, offset = nil)\n if type.respond_to?(:to_str) || type.respond_to?(:to_sym)\n type = registry.build(type.to_s)\n end\n @fields << [name.to_s, type, offset]\n end",
"def <<(field)\n list[field.name] = field\n end",
"def add_fillin(attr)\n new_fillin_index = increase_atomic_count(@docs[:num_fillins])\n\n fillin_params = {\n :create => true,\n :radlib_id => radlib_id,\n :fillin_index => new_fillin_index,\n :uid => attr[:uid],\n :user_inputs => attr[:radlib_text_array].user_inputs\n }\n\n RadlibFillin.new(fillin_params)\n end",
"def add_record(record_id)\n @records[record_id] = [] unless include_record?(record_id)\n end",
"def add(id)\n\t\traise unless id.is_a?(Fixnum)\n\t\t@extras << id\n\tend",
"def add_patch_number_for_leveldb\n\t\tleveldbCounter = 0\n\t\t@allPatches.each do |frameNumber, fileJSON|\n\t\t\tfileJSON['scales'].each do |scale|\n\t\t\t\tscale['patches'].each do |patch|\n\t\t\t\t\tpatch.merge!({leveldb_counter: leveldbCounter})\n\t\t\t\t\tleveldbCounter = leveldbCounter + 1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def add\n super\n return 77\n end",
"def add_index_field(*) super end",
"def update_invoice_number!\n return unless Spree::PrintInvoice::Config.use_sequential_number?\n return if invoice_number.present?\n\n update_columns(invoice_number: Spree::PrintInvoice::Config.increase_invoice_number)\n end",
"def field_count\n super\n end",
"def set_integer_for(type, value)\n load_balancer.client['LocalLB.Monitor']\n .set_template_integer_property([new_resource.monitor_name],\n [{ 'type' => type, 'value' => value }])\n end"
] |
[
"0.5685745",
"0.56851757",
"0.5654786",
"0.5628772",
"0.5596719",
"0.5501971",
"0.53155404",
"0.5276476",
"0.5261164",
"0.5255116",
"0.5243893",
"0.51886296",
"0.5179827",
"0.5176133",
"0.5176133",
"0.51687646",
"0.5151433",
"0.5139222",
"0.50960225",
"0.5091179",
"0.5085348",
"0.5078494",
"0.5061333",
"0.50169474",
"0.50067997",
"0.49908784",
"0.4973846",
"0.4959455",
"0.49570438",
"0.49333367",
"0.4910788",
"0.4910226",
"0.4903865",
"0.4903865",
"0.489547",
"0.48926717",
"0.48849902",
"0.48745555",
"0.48708394",
"0.48650214",
"0.48593608",
"0.48547745",
"0.48492357",
"0.48428878",
"0.4822043",
"0.48182067",
"0.481643",
"0.4770104",
"0.47606316",
"0.47234112",
"0.47194582",
"0.47163743",
"0.46741617",
"0.4669049",
"0.46651652",
"0.46648097",
"0.46646053",
"0.46646053",
"0.46288615",
"0.46215183",
"0.46119416",
"0.46083203",
"0.457401",
"0.45640898",
"0.45427218",
"0.45416063",
"0.45277232",
"0.45140153",
"0.45127812",
"0.45084316",
"0.45020178",
"0.44921857",
"0.44883195",
"0.44826406",
"0.4481724",
"0.44801402",
"0.44787303",
"0.44609815",
"0.44523087",
"0.44505665",
"0.4442816",
"0.44312286",
"0.44261923",
"0.44247928",
"0.44179708",
"0.4409169",
"0.43844393",
"0.43739122",
"0.4368292",
"0.43674812",
"0.43634355",
"0.43608963",
"0.43585423",
"0.43508938",
"0.4349733",
"0.43475538",
"0.43457285",
"0.43367574",
"0.43342713",
"0.43333292"
] |
0.55988455
|
4
|
Adds a floatingpoint number field to the nested schema of a record field. This can only be called on fields that are of type `RECORD`.
|
def float name, description: nil, mode: :nullable, policy_tags: nil
record_check!
add_field name, :float, description: description, mode: mode, policy_tags: policy_tags
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hincrbyfloat(key, field, increment)\n node_for(key).hincrbyfloat(key, field, increment)\n end",
"def type_literal_generic_float(column)\n :\"double precision\"\n end",
"def should_be_float?(field_info, field)\n field_info[\"type\"] == \"REAL\"\n end",
"def hincrbyfloat(key, field, increment); end",
"def hincrbyfloat(key, field, increment); end",
"def handle_float(float, lineno_column)\n Literal.new float.to_f\n end",
"def incrbyfloat(key, increment)\n node_for(key).incrbyfloat(key, increment)\n end",
"def hincrbyfloat(key, field, increment)\n send_command([:hincrbyfloat, key, field, Float(increment)], &Floatify)\n end",
"def get_number(field)\n field['numberValue']\n end",
"def field_precision(key)\n IBM_DB.field_precision(@stmt, key)\n end",
"def set_numeric_field\n @numeric_field = NumericField.find(params[:id])\n end",
"def apply_validations_for_float\n flex_column_class.validates field_name, :numericality => true, :allow_nil => true\n end",
"def initialize_float(field_info, field)\n if should_be_float?(field_info, field) && !self.send(field).blank?\n update_value_of_variable(field, self.send(field).to_f)\n end\n field\n end",
"def change\n add_column :products, :float, null: false\nend",
"def expect_float(value, field, subfield)\n return true if value.blank?\n return true if value.is_a?(Float)\n errors.add(field, \"#{subfield} must be a float if present\")\n false\n end",
"def add_float_scopes(col)\n add_integer_or_float_scopes(col)\n end",
"def add_float_scopes(col)\n add_integer_or_float_scopes(col)\n end",
"def incrbyfloat(key, increment); end",
"def incrbyfloat(key, increment); end",
"def incrbyfloat(key, increment)\n send_command([:incrbyfloat, key, Float(increment)], &Floatify)\n end",
"def define_field(type, name, number, options = {})\n fields[name] = type.__protofield__(type, name, number, options)\n field_accessors(name)\n end",
"def add_float_message_to_errors(field)\n @errors << {message: \"#{field} must be an Float.\", variable: \"#{field}\"}\n end",
"def number_field(object_name, method, options = T.unsafe(nil)); end",
"def add_field!(field_name, value = T.unsafe(nil)); end",
"def check_real(field_info, field)\n if should_be_float?(field_info, field) && !float?(field)\n add_float_message_to_errors(field)\n end\n end",
"def declare_integer_field(model, declaration)\n precision = declaration.attributes[:h_precision] || declaration.attributes[:precision] || 0\n declaration.remove_attributes! :h_precision, :precision\n if precision==0\n model.integer_h declaration.name\n else\n model.number_h declaration.name, :precision=>precision\n end\n end",
"def number_f=(value)\n @number_f = value\n end",
"def pre_gen(record)\n numeric_fields.each do |field|\n if vals = record[field] and vals.is_a?(Array)\n record[field] = vals.join(\",\")\n end\n end\n end",
"def field(sym, options={})\n options[:type] ||= Integer\n @fields[sym.to_sym] = options\n end",
"def float_significant_dec(x)\n Numerals::Format[:free].write(x)\nend",
"def add_field(name, type, options={})\n name = name.to_s\n \n # preconditions\n raise InvalidModelField.new(\"Duplicate field name\") if record_fields.key?(name)\n raise InvalidModelField.new(\"Type must be a known yodel field type\") unless valid_type?(type)\n raise InvalidModelField.new(\"Field name cannot start with an underscore\") if name.start_with?('_')\n \n # add the field to the model and subclasses\n field_type = Field.field_from_type(type.to_s)\n field = field_type.new(name, deep_stringify_keys(options.merge(type: type.to_s)))\n RecordIndex.add_index_for_field(self, field) if field.index?\n record_fields[name] = field\n end",
"def add(field_name, field_type, offset: current_size, skip: 0)\n field = type.add(field_name.to_s, field_type, offset: offset, skip: skip)\n @current_size = [current_size, field.offset + field.size].max\n field\n end",
"def number_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end",
"def float(key, opts={})\n @attrs[key.to_sym] = Attributes::FloatAttr.new(key, opts)\n end",
"def float_attr name, options = {}\n add_attribute(FloatAttribute.new(name, options))\n end",
"def precision(f)\n return (f * GeoRecord::SCALE).round.to_f / GeoRecord::SCALE\n end",
"def numeric?; float?; end",
"def append_float(f=nil)\n if f.class == Float && !block_given?\n @j_del.java_method(:appendFloat, [Java::float.java_class]).call(::Vertx::Util::Utils.to_float(f))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling append_float(f)\"\n end",
"def precision=(val)\n self['precision'] = val\n end",
"def set_field_number(field_number)\n raise NotImplementedError, \"Implement this method in a child class\"\n end",
"def test_native_float_insert_manual_vs_automatic\n correct_value = \"0012345678901234567890.0123456789\".to_f\n\n connection.add_column \"test_models\", \"wealth\", :float\n\n # Do a manual insertion\n connection.transaction {\n connection.execute \"insert into test_models (id, wealth) values (#{generate_id}, 12345678901234567890.0123456789)\"\n }\n\n # SELECT\n row = TestModel.first\n assert_kind_of Float, row.wealth\n\n # If this assert fails, that means the SELECT is broken!\n assert_equal correct_value, row.wealth\n\n # Reset to old state\n TestModel.delete_all\n\n # Now use the Rails insertion\n TestModel.create wealth: BigDecimal(\"12345678901234567890.0123456789\")\n\n # SELECT\n row = TestModel.first\n assert_kind_of Float, row.wealth\n\n # If these asserts fail, that means the INSERT (create function, or cast to SQL) is broken!\n assert_equal correct_value, row.wealth\n end",
"def add_val_to_fld(solr_input_doc, fld_name, value)\n if !solr_input_doc.nil? && !fld_name.nil? && fld_name.size > 0 && !value.nil? && value.size > 0\n if !solr_input_doc[fld_name].nil? && solr_input_doc\n existing_vals = solr_input_doc[fld_name].getValues\n end\n if existing_vals.nil? || !existing_vals.contains(value)\n solr_input_doc.addField(fld_name, value, 1.0)\n end\n end\n end",
"def create_numeric(name, **options)\n register(NumericType.new_submodel(typename: name, registry: self, **options))\n end",
"def map_float(ident, &block) ; map_primitive(:float, ident, &block) ; end",
"def set_double(attr, val); end",
"def set_double(attr, val); end",
"def fld=(val); @fld = val end",
"def add_double(tag, value)\n write_tag(tag, Type::DOUBLE)\n @io << [value.to_f].pack('E')\n\n self\n end",
"def define_field(rule, type, fname, tag, options)\n field_hash = options[:extension] ? extension_fields : fields\n if field_hash.keys.include?(tag)\n raise TagCollisionError, %!{Field number #{tag} has already been used in \"#{self.name}\" by field \"#{fname}\".!\n end\n field_hash[tag] = Field.build(self, rule, type, fname, tag, options)\n end",
"def type\n Attribute::Float\n end",
"def type\n Attribute::Float\n end",
"def add_field! key, initial = nil, opts = {}, &block\n key = @schema.validate_new_key! key\n @values[key] = initial\n @schema.add_field! key, initial, opts, &block\n self\n end",
"def get_double_value(field_name)\n\t\tend",
"def number_f\n return @number_f\n end",
"def create_float_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil)\n path = '/databases/{databaseId}/collections/{collectionId}/attributes/float'\n .gsub('{databaseId}', database_id)\n .gsub('{collectionId}', collection_id)\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if collection_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"collectionId\"')\n end\n\n if key.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"key\"')\n end\n\n if required.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"required\"')\n end\n\n params = {\n key: key,\n required: required,\n min: min,\n max: max,\n default: default,\n array: array,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::AttributeFloat\n )\n end",
"def float?(field)\n self.send(field).is_a? Float\n end",
"def add_field(field)\n\t\tend",
"def add_field(identifier, value = nil)\n @fields << build_field(identifier, value)\n end",
"def add_field(name, values, options = {})\n RSolr::Array.wrap(values).each do |v|\n field_attrs = { name: name }\n field_attrs[:type] = DocumentField if name.to_s == CHILD_DOCUMENT_KEY\n\n @fields << RSolr::Field.instance(options.merge(field_attrs), v)\n end\n end",
"def expect_integer_or_float(value, field, subfield)\n return true if value.blank?\n return true if value.is_a?(Integer) || value.is_a?(Float)\n errors.add(field, \"#{subfield} must be an integer or float if present\")\n false\n end",
"def get_F64_field(field_name)\n\t\tend",
"def numeric_attrs\n int_attrs + float_attrs\n end",
"def append_double(d=nil)\n if d.class == Float && !block_given?\n @j_del.java_method(:appendDouble, [Java::double.java_class]).call(::Vertx::Util::Utils.to_double(d))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling append_double(d)\"\n end",
"def on_float(token)\n log \"FLOAT: '#{token}'\"\n super(token)\n end",
"def SetFieldWeights(weights)\n assert { weights.instance_of? Hash }\n weights.each do |name, weight|\n assert { name.instance_of? String }\n assert { weight.instance_of? Fixnum }\n end\n\n @fieldweights = weights\n end",
"def number_record_params\n params.require(:number_record).permit(:value)\n end",
"def number_with_precision(number, precision=3)\n \"%01.#{precision}f\" % number\n rescue\n number\n end",
"def add_scalar_fields_to_object(object, nodes)\n scalar_fields.each do |field_name|\n node_name = field_node_name(field_name)\n node = nodes.find { |n| n.value == node_name }\n\n next unless node\n\n if node.nodes.length > 1\n raise \"Expected #{node_name} to only have 1 child\"\n end\n\n object.send(\"#{field_name}=\", node.text)\n end\n end",
"def add_raw(raw)\n @fields << Field.new(raw)\n self\n end",
"def type_literal_generic_fixnum(column)\n type_literal_generic_integer(column)\n end",
"def get_fields(fbe_value, fbe_struct_size)\n fbe_current_size = 4 + 4\n\n if (fbe_current_size + currency.fbe_size) <= fbe_struct_size\n fbe_value.currency = currency.get\n else\n fbe_value.currency = ''\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += currency.fbe_size\n\n if (fbe_current_size + amount.fbe_size) <= fbe_struct_size\n fbe_value.amount = amount.get(0.0)\n else\n fbe_value.amount = 0.0\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += amount.fbe_size\n end",
"def calculate_fields!\n m_price_extend = qty * price\n attributes = { :price_extend => m_price_extend }\n self.update_attributes(attributes)\n end",
"def w=(value); self[W] = Float(value); end",
"def record_value(metric, value, opts = {})\n record_internal({metric => value.round}, opts)\n end",
"def decimal_part(digits: T.unsafe(nil)); end",
"def field(spec, name = nil, data_lambda = nil)\n @field_specs << spec\n add_field(name, data_lambda)\n end",
"def add_field(name, val)\n @data[name] = val\n self\n end",
"def add_field(name, val)\n @data[name] = val\n self\n end",
"def field(name, type)\n @fields << Field.new(name, type, @fields.size, nil, {})\n end",
"def add_field!(field_name, value = nil)\n fields << Field.new({'name' => field_name}, value)\n end",
"def add(field, val, boost=nil)\n return if val == nil\n return if val == ''\n if val.is_a? Array\n val.each {|v| self.add(field, v)}\n else\n self.addField(field, val)\n end\n self.boost = boost if boost\n end",
"def number\n token = match(:T_INT, :T_FLOAT)\n Number.new(token.value)\n end",
"def add_field_schema(name, type, schema)\n @field_names ||= [] ; @field_schemas ||= {}\n @field_names = @field_names | [name]\n schema = schema.symbolize_keys.merge({ :name => name })\n #\n # FIXME: this is terrible, especially given what's in TypeFactory anyway.\n #\n schema[:type] =\n case\n when type == Hash && schema.has_key?(:values) then Icss::Meta::TypeFactory.receive({ :type => :hash, :values => schema.delete(:values)})\n when type == Array && schema.has_key?(:items) then Icss::Meta::TypeFactory.receive({ :type => :array, :items => schema.delete(:items) })\n when type == Hash then IdenticalHashFactory\n when type == Array then IdenticalArrayFactory\n else\n Icss::Meta::TypeFactory.receive(type)\n end\n fld = (field_schemas[name] || make_field_schema).merge(schema)\n fld[:parent] = self\n @field_schemas[name] = fld\n end",
"def field(spec, name = nil, data_lambda = nil)\n add_field Field.new(String, spec, name || next_unknown_field_name, data_lambda)\n end",
"def update_float_attribute(database_id:, collection_id:, key:, required:, min:, max:, default:)\n path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'\n .gsub('{databaseId}', database_id)\n .gsub('{collectionId}', collection_id)\n .gsub('{key}', key)\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if collection_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"collectionId\"')\n end\n\n if key.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"key\"')\n end\n\n if required.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"required\"')\n end\n\n if min.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"min\"')\n end\n\n if max.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"max\"')\n end\n\n if default.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"default\"')\n end\n\n params = {\n required: required,\n min: min,\n max: max,\n default: default,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::AttributeFloat\n )\n end",
"def float(number, direction = :push)\n number.to_f\n end",
"def set_first_value_as_key_in_float_format\n FLOAT_VALUES.each {|key| @hash[key] = round_up_to_tenth(@hash[key][0])}\n end",
"def increment(key, val)\n self[key] += _floatify(val)\n end",
"def get_float(key)\n get(key, \"f\")\n end",
"def prec_f() end",
"def update_value(device_field, value)\n device_field.update_attribute(:value, value)\n if device_field.integer?\n device_field.update_attribute(:value_in_int, value.to_i)\n else device_field.float?\n device_field.update_attribute(:value_in_float, value.to_f)\n end\n end",
"def post_process_float( val )\n\t\t\treturn Float( val.to_s )\n\t\tend",
"def number\n HookNumber.new(number_record)\n end",
"def write_point(key, value, timestamp, precision = DEFAULT_PRECISION)\n db.write_point(key, { value: value, time: precise_float(timestamp, precision) }, false, precision)\n end",
"def add_record(value)\n @children['record'][:value] << value\n end",
"def add_record(value)\n @children['record'][:value] << value\n end",
"def parse_float attr_name, xpath\n v = parse_value xpath\n v = v.to_f if v.respond_to?(:to_f)\n send(\"#{attr_name}=\", v)\n end",
"def assign_mounting_point_to_fields\n return if self.fields.blank?\n\n self.fields.each do |field|\n field.mounting_point = self.mounting_point\n end\n end",
"def to_f(aNum)\r\n# - - - - - - - - - - - - - - - - - -\r\n return 0.0 + aNum\r\nend",
"def Float(p0) end"
] |
[
"0.590296",
"0.5872035",
"0.57110816",
"0.565843",
"0.565843",
"0.56404763",
"0.55729514",
"0.55633736",
"0.55588853",
"0.55072445",
"0.54634774",
"0.54569006",
"0.5426369",
"0.5411874",
"0.5251561",
"0.52158725",
"0.52158725",
"0.52144057",
"0.52144057",
"0.517576",
"0.51558894",
"0.51455635",
"0.5118334",
"0.5117468",
"0.51031977",
"0.5100351",
"0.5096784",
"0.50962603",
"0.50245506",
"0.50206727",
"0.5000964",
"0.49994996",
"0.49921018",
"0.498414",
"0.49823254",
"0.49576408",
"0.49507853",
"0.49496377",
"0.49425048",
"0.4937088",
"0.49281964",
"0.49272668",
"0.4906162",
"0.48865336",
"0.48810524",
"0.48810524",
"0.48717672",
"0.48666364",
"0.48663908",
"0.48625365",
"0.48625365",
"0.4831658",
"0.48212224",
"0.48202977",
"0.48152542",
"0.47989997",
"0.47927317",
"0.47890204",
"0.47884896",
"0.47874773",
"0.47782484",
"0.4773769",
"0.47681063",
"0.47430068",
"0.4741814",
"0.47246915",
"0.47027752",
"0.4702708",
"0.46965006",
"0.46885148",
"0.46881306",
"0.46866545",
"0.46850488",
"0.46845978",
"0.4682472",
"0.4680764",
"0.46804214",
"0.46804214",
"0.4670687",
"0.46593022",
"0.4658041",
"0.46574163",
"0.4648295",
"0.46460477",
"0.46304464",
"0.46289834",
"0.46282944",
"0.46248916",
"0.4610873",
"0.46080104",
"0.45867974",
"0.45866454",
"0.4581364",
"0.45788065",
"0.457638",
"0.457638",
"0.45739076",
"0.4573601",
"0.45705292",
"0.45663616"
] |
0.5850331
|
2
|
Adds a boolean field to the nested schema of a record field. This can only be called on fields that are of type `RECORD`.
|
def boolean name, description: nil, mode: :nullable, policy_tags: nil
record_check!
add_field name, :boolean, description: description, mode: mode, policy_tags: policy_tags
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_boolean_field(field_name)\n\t\tend",
"def record?\n type == \"RECORD\" || type == \"STRUCT\"\n end",
"def type_literal_generic_boolean(column)\n :boolean\n end",
"def attr_set_boolean(attr_type, attr_value)\n #This is a stub, used for indexing\n end",
"def field?\n true \n end",
"def boolean_field_registered?(name)\n return boolean_fields[name.to_s] != nil\n end",
"def get_boolean_value(field_name)\n\t\tend",
"def add_bool(tag, value)\n write_tag(tag, value ? Type::BOOL_TRUE : Type::BOOL_FALSE)\n\n self\n end",
"def register_boolean_fields(*names)\n names.each do |name|\n boolean_fields[name.to_s] = {}\n boolean_fields[name.to_s][\"label\"] = name.to_s\n boolean_fields[name.to_s][\"value\"] = BOOLEAN_VALUE_FOR_ALL\n end\n end",
"def apply_validations_for_boolean\n value_set = [ true, false ]\n value_set << nil unless not_nullable?\n flex_column_class.validates field_name, :inclusion => { :in => value_set }\n end",
"def boolean(sym, options={})\n element(sym, {:type => BooleanConverter, :single => true, :reader => false}.merge(options))\n end",
"def field?\n false \n end",
"def record?\n type.record?\n end",
"def config_boolean_true?(boolean_field)\n data[boolean_field].to_i == 1\n end",
"def sql_boolean\n self\n end",
"def change\n add_column :appeals, :advanced_on_docket, :boolean, default: false\n end",
"def schema_column_type(db_type)\n convert_tinyint_to_bool && db_type =~ /\\Atinyint\\(1\\)/ ? :boolean : super\n end",
"def schema_column_type(db_type)\n if convert_smallint_to_bool && db_type =~ /smallint/i \n :boolean\n else\n super\n end\n end",
"def bson_type\n Boolean::BSON_TYPE\n end",
"def build_record?\n # We want to create a build record by default\n if @options[:build_record].nil?\n true\n else\n @options[:build_record]\n end\n end",
"def validate_boolean_type(field)\n if field.is_a?(TrueClass) || field.is_a?(FalseClass)\n return true\n else\n return false\n end\n end",
"def attr_get_boolean(attr_type, strict = true)\n #This is a stub, used for indexing\n end",
"def typus_boolean(attribute = :default)\n options = read_model_config['fields']['options']\n\n boolean = if options && options['booleans'] && boolean = options['booleans'][attribute.to_s]\n boolean.is_a?(String) ? boolean.extract_settings : boolean\n else\n [\"True\", \"False\"]\n end\n\n [[boolean.first, \"true\"], [boolean.last, \"false\"]]\n end",
"def build_logical\n Schema::Logical.new\n end",
"def boolean_type\n 'Boolean'\n end",
"def schema_column_type(db_type)\n Sequel::Mysql2.convert_tinyint_to_bool && db_type == 'tinyint(1)' ? :boolean : super\n end",
"def schema_column_type(db_type)\n db_type =~ /\\Atinyint\\(1\\)/ ? :boolean : super\n end",
"def write_booleanr(bool)\n\t\twrite_byte(1)\n\t\twrite_boolean(bool)\n\tend",
"def add_has_delta_field\n logger.info \"Adding #{name}._has_delta audit field...\"\n db.query(\"ALTER TABLE #{audit} ADD `_has_delta` TINYINT NOT NULL DEFAULT 0\")\n end",
"def type_bool!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 37 )\n\n\n\n type = TYPE_BOOL\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 213:12: 'bool'\n match( \"bool\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 37 )\n\n\n end",
"def boolean_attributes\n @boolean_attributes\n end",
"def pre_execute_boolean_attribute\n\n return unless children.size == 1\n\n t = @node['tree'] = Flor.dup(tree)\n t[1] << [ '_boo', true, @node['tree'][2] ]\n end",
"def db_boolean(val)\n if adapter == :postgres\n val ? 'TRUE' : 'FALSE'\n else\n val ? '1' : '0'\n end\n end",
"def reporting_schema_via_param_or_feature_flag\n param_flag = ActiveRecord::Type::Boolean.new.deserialize(report_params[:v2])\n user_flag = current_admin.feature_enabled?(:reporting_schema_v2)\n return param_flag unless param_flag.nil?\n user_flag\n end",
"def full_record?\n full_record == true\n end",
"def set_dsl_parsed!(boolean_val)\n update(dsl_parsed: boolean_val)\n end",
"def field? key\n @schema.field? key\n end",
"def dynamic_field?(field)\n dynamic_enabled? &&\n !fields.keys.include?(database_field_name(field)) &&\n !embedded_relations.map { |_, v| v.key }.include?(database_field_name(field))\n end",
"def boolify(val)\n\nend",
"def store_wsbool #:nodoc:\n record = 0x0081 # Record identifier\n length = 0x0002 # Bytes to follow\n\n grbit = 0x0000 # Option flags\n\n # Set the option flags\n grbit |= 0x0001 # Auto page breaks visible\n grbit |= 0x0020 if @outline_style != 0 # Auto outline styles\n grbit |= 0x0040 if @outline_below != 0 # Outline summary below\n grbit |= 0x0080 if @outline_right != 0 # Outline summary right\n grbit |= 0x0100 if @fit_page != 0 # Page setup fit to page\n grbit |= 0x0400 if @outline_on != 0 # Outline symbols displayed\n\n header = [record, length].pack(\"vv\")\n data = [grbit].pack('v')\n\n prepend(header, data)\n end",
"def boolean?(column)\n column.type == :boolean\n end",
"def create_boolean_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)\n path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'\n .gsub('{databaseId}', database_id)\n .gsub('{collectionId}', collection_id)\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if collection_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"collectionId\"')\n end\n\n if key.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"key\"')\n end\n\n if required.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"required\"')\n end\n\n params = {\n key: key,\n required: required,\n default: default,\n array: array,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::AttributeBoolean\n )\n end",
"def set_boolean!(value)\n @objects = nil\n @memory = nil\n\n self[:type] = :boolean\n self[:values][:boolean] = if value\n 1\n else\n 0\n end\n end",
"def boolean cols\n decode_values :boolean, cols\n end",
"def nested_locale_fields?\n false\n end",
"def has_field?(field_name); end",
"def write_bool(*b); end",
"def boolean_attr name, options = {}\n\n attr = add_attribute(BooleanAttribute.new(name, options))\n\n # add the boolean question mark method\n define_method(\"#{attr.name}?\") do\n !!__send__(attr.name)\n end\n\n end",
"def enable_exam=(state)\n @enable_exam = ActiveRecord::Type::Boolean.new.cast(state)\n end",
"def writeBoolEntry(section, key, value)\n writeIntEntry(section, key, value ? 1 : 0)\n end",
"def sql_boolean\n BooleanExpression.new(self.op, *self.args)\n end",
"def approve_writer(flag)\n if flag=='true' || flag==1\n self.wflag=true\n if self.save\n return true\n end\n else\n self.wflag=false\n self.save\n end\n end",
"def up\n add_column_with_default(:services, :instance, :boolean, default: false)\n end",
"def new_record?() true end",
"def format_boolean(val, istruct)\n return istruct.nil_text if val.nil?\n\n val ? istruct.true_text : istruct.false_text\n end",
"def format_boolean(val, istruct)\n return istruct.nil_text if val.nil?\n\n val ? istruct.true_text : istruct.false_text\n end",
"def attr_bool_writer *symbols\n attr_writer *symbols\n end",
"def has_field(field_name)\n\t\tend",
"def has_flattened_fields?\n flattened_fields.size > 0 ? true : false\n end",
"def type_literal_generic_trueclass(column)\n :boolean\n end",
"def add_boolean_scopes(col)\n if self.column_names.include?(col.to_s)\n politely_add_named_scope :\"#{col}\", { :conditions => { :\"#{col}\" => true } }\n politely_add_named_scope :\"not_#{col}\", { :conditions => { :\"#{col}\" => false } }\n end\n end",
"def can_add?( record, type = '*' )\n return false unless can_change?( record, type )\n\n return false if !allow_new_records?\n\n true\n end",
"def boolean\n Util.from_bytes :boolean, value\n end",
"def set_is_recorded\n write_attribute(:is_recorded, !exercise_minutes.to_i.zero? || !exercise_steps.to_i.zero? || self.entry_behaviors.where(\"value > 0\").length > 0)\n true\n end",
"def boolean(name, option={})\n option[:is_a] = :boolean\n register_attribute_member(name, option)\n define_attribute_accessor(name, option)\n method = <<-EOS\n def #{name}?\n get_attribute(:#{name})\n end\nEOS\n class_eval(method, __FILE__, __LINE__)\n define_validations(name, option)\n end",
"def csv_format_boolean(object, attr)\n if object.send(attr) then \"Yes\" else \"No\" end\n end",
"def true_string?(field)\n field == 'true' || field == true\n end",
"def embed_records?\n !!@embedded\n end",
"def new_record?\n @new_record ||= false\n end",
"def new_record?\n @new_record ||= false\n end",
"def toggle! object, field, value\n object[field] ||= []\n\n if object[field].include?(value)\n object[field] -= [value]\n object.save\n false\n else\n object[field] += [value]\n object.save\n true\n end\n end",
"def nested_locale_fields?\n # rubocop:disable Style/DoubleNegation\n !!@nested_locale_fields\n # rubocop:enable Style/DoubleNegation\n end",
"def msg_not_boolean(parent, key, value); end",
"def parse_bool() true end",
"def new_record?\n @new_record == true\n end",
"def set_boolean_value\n @values = [Value.new(@context, true)]\n end",
"def bit_field name, width\n raise \"'bit_field' can be used only inside a 'field' block.\" if @_current_bit_fields.nil?\n \n # Register the bit field definition\n @_current_bit_fields << [name, width, bit_mask(width)]\n \n # Define the attribute accessor\n bits_attr_accessor(name)\n \n if width == 1 or name.to_s =~ /_flag$/\n # Define a question mark method if the size is 1 bit\n class_eval \"def #{name}?; self.attributes[#{name.inspect}] != 0; end\\n\", __FILE__, __LINE__\n \n # returns nil if no substitution happens...\n if flag_method_name = name.to_s.gsub!(/_flag$/, '?')\n # Define another question mark method if ends with \"_flag\"\n class_eval \"alias #{flag_method_name} #{name}?\\n\", __FILE__, __LINE__\n end\n end\n \n end",
"def fields_need_editing(obj) \n \teditable_fields(obj).select {|k,v| v == true }\n end",
"def is_boolean?\n column = NUMBER_TO_OBJECT_MAP[@object].columns.find { |col| col.name == @search_term }\n column && column.type == :boolean\n end",
"def to_bool str\r\n ActiveRecord::Type::Boolean.new.type_cast_from_user(str)\r\n end",
"def is_flag_attribute(word)\n define_method(word.to_sym) do |*args, &block|\n @result.__send__(\"#{word}=\".to_sym, true)\n end\n end",
"def draw_boolean(col)\n _draw_head(col){\n @f.select(col.name, [\n ['(both)', ''],\n ['', 'false'],\n ['√', 'true']])\n }\n end",
"def boolean(**props)\n transform(type: :boolean, **props) do |value|\n !!value\n end\n end",
"def test_boolean_as_integer\n e = DbType.find(:first)\n\n # true\n e.sample_boolean = 1\n assert_equal true, e.sample_boolean\n assert_equal true, e.sample_boolean?\n e.save!\n\n e = DbType.find(:first)\n assert_equal true, e.sample_boolean\n assert_equal true, e.sample_boolean?\n\n # false\n e.sample_boolean = 0\n assert_equal false, e.sample_boolean\n assert_equal false, e.sample_boolean?\n e.save!\n\n e = DbType.find(:first)\n assert_equal false, e.sample_boolean\n assert_equal false, e.sample_boolean?\n end",
"def should_render_show_field? document, field_config\n should_render_field?(field_config, document) && document_has_value?(document, field_config)\n end",
"def add_boolean_scopes(col)\n if self.column_names.include?(col.to_s)\n # have to freeze the column name in place. By the time lambda is evaluated,\n # col is long gone.\n politely_add_named_scope :\"#{col}\", lambda { where( :\"#{col}\" => true ) } \n politely_add_named_scope :\"not_#{col}\", lambda { where( :\"#{col}\" => false ) }\n end\n end",
"def convert_optional_bool value\n return nil if value.nil?\n\n Google::Protobuf::BoolValue.new value: value\n end",
"def bool(val)\n raise ArgumentError, \"bool() requires a boolean argument\" \\\n unless val == true || val == false\n\n self.int32(val ? 1 : 0)\n end",
"def <<(obj)\n raise Error::TypeError unless obj.is_a?(De::Boolean::Bn)\n super(obj)\n end",
"def fix_boolean(node)\n node.children.map! do |child|\n if child.is_a?(AST::Node) &&\n child.type == :coerce_b\n child.children.first\n else\n child\n end\n end\n end",
"def uses_record_type?\n list_class.attribute_names.include?('record_type')\n end",
"def appear_as_new_record\n @record.instance_eval {\n alias :old_new_record? :new_record?\n alias :new_record? :present?\n alias :old_persisted? :persisted?\n alias :persisted? :nil?\n }\n yield\n @record.instance_eval {\n alias :new_record? :old_new_record?\n alias :persisted? :old_persisted?\n }\n end",
"def boolean?\n @type == :boolean\n end",
"def map_field?(field_descriptor)\n (field_descriptor.label == :repeated) &&\n (field_descriptor.subtype.name.include? '_MapEntry_')\n end",
"def rec_frozen=( set_rec )\n if [ '1', 'true', true ].include? set_rec\n write_attribute( :freeze_date, DateTime.now ) if freeze_date.nil?\n elsif [ '0', 'false', false ].include? set_rec\n # no change\n else\n raise ArgumentError, \"Argument is not true/'1' or false/'0': >#{ set_rec.inspect }<\"\n end \n end",
"def validate_as_record\n self.class.fields.each do |field|\n errors[field] = \"is required\" unless fields[field]\n end\n end",
"def validate_fields\n for key in self.query_parameters.keys\n for column in eval(\"#{self.model_name}\").columns\n if key == column.name.to_sym\n if column.type == :boolean\n if self.query_parameters[key] == \"0\"\n self.query_parameters[key] = false\n else\n self.query_parameters[key] = true\n end\n end\n end\n end\n end\n end",
"def new_record?\n true\n end",
"def new_record?\n true\n end",
"def new_record?\n true\n end"
] |
[
"0.5923192",
"0.5616594",
"0.55987525",
"0.5588339",
"0.5562626",
"0.54920614",
"0.54363596",
"0.536065",
"0.5359438",
"0.53562176",
"0.53481424",
"0.5345932",
"0.53389186",
"0.53388315",
"0.53347766",
"0.53011334",
"0.5284964",
"0.5282979",
"0.5282359",
"0.52556163",
"0.5211066",
"0.52087724",
"0.5191064",
"0.51836765",
"0.51548827",
"0.51300853",
"0.5076084",
"0.505888",
"0.5047582",
"0.50453484",
"0.50387394",
"0.50321597",
"0.49960515",
"0.49779937",
"0.49778345",
"0.49734932",
"0.49720627",
"0.4969912",
"0.49642423",
"0.4956862",
"0.49544367",
"0.49535456",
"0.49389097",
"0.49362645",
"0.4932253",
"0.49067333",
"0.4901809",
"0.49001822",
"0.48941994",
"0.48940483",
"0.4870616",
"0.48558828",
"0.48416257",
"0.48387367",
"0.48313072",
"0.48313072",
"0.48251128",
"0.48219553",
"0.48207718",
"0.4810819",
"0.47939485",
"0.47923973",
"0.47899666",
"0.47796378",
"0.47759157",
"0.4774847",
"0.4769373",
"0.47539374",
"0.47535276",
"0.47535276",
"0.47476795",
"0.4747067",
"0.47360173",
"0.47313288",
"0.47309685",
"0.4726242",
"0.4712807",
"0.47117355",
"0.47065952",
"0.4706218",
"0.47025558",
"0.46980894",
"0.46971828",
"0.469601",
"0.46927658",
"0.46923304",
"0.4683193",
"0.46781075",
"0.46762228",
"0.46711904",
"0.46682307",
"0.46666172",
"0.46665075",
"0.46606097",
"0.4657457",
"0.46536526",
"0.46453798",
"0.4643827",
"0.4643827",
"0.4643827"
] |
0.6239906
|
0
|
Adds a bytes field to the nested schema of a record field. This can only be called on fields that are of type `RECORD`.
|
def bytes name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil
record_check!
add_field name,
:bytes,
description: description,
mode: mode,
policy_tags: policy_tags,
max_length: max_length
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_field(type, value)# {{{\n t = TLV.new(2,2)\n t.type = type\n t.value = value\n t.length = 4 + value.length\n self.payload += t.encode \n end",
"def add_raw(raw)\n @fields << Field.new(raw)\n self\n end",
"def record=(record)\n self.record_data = Base64.encode64(Marshal.dump(record))\n end",
"def add_field!(field_name, value = T.unsafe(nil)); end",
"def get_binary_field(field_name)\n\t\tend",
"def add_field(name, value)\n raise ArgumentError.new(\"Found invalid XML 1.0 unicode character(s)\") if value.is_a? String and value =~ INVALID_CHAR_XML10\n @fields[name] = value\n end",
"def add_bytes(tag, value)\n value = value.to_s\n write_tag(tag, Type::BYTE_ARRAY)\n Varint.serialize(@io, value.bytesize)\n @io << value\n\n self\n end",
"def add(field_name, field_type, offset: current_size, skip: 0)\n field = type.add(field_name.to_s, field_type, offset: offset, skip: skip)\n @current_size = [current_size, field.offset + field.size].max\n field\n end",
"def bitfield(bitbuf, len, &blk)\n if @endian==:little\n unless len==16||len==32||len==64\n raise RuntimeError, \"Binstruct: Bitfield: Don't know how to endian swap #{len} bits. :(\"\n end\n instr=bitbuf.slice!(0,len).scan(/.{8}/).reverse.join\n else\n instr=bitbuf.slice!(0,len)\n end\n new=Bitfield.new([instr].pack('B*'), &blk)\n if @endian==:little\n # This is so we know to flip the bytes back in #to_s\n new.instance_variable_set :@endian_flip_hack, true\n end\n @fields << new\n # Add direct references and accessor methods to the containing Binstruct\n new.fields.each {|f| \n unless f.is_a? Fields::Field\n raise RuntimeError, \"Binstruct: Construction: Illegal content #{f.class} in bitfield - use only Fields\"\n end\n @hash_references[f.name]=f\n meta_def f.name do f.get_value end\n meta_def (f.name.to_s + '=').to_sym do |val| f.set_value(val) end\n }\n end",
"def add_field_schema(name, type, schema)\n @field_names ||= [] ; @field_schemas ||= {}\n @field_names = @field_names | [name]\n schema = schema.symbolize_keys.merge({ :name => name })\n #\n # FIXME: this is terrible, especially given what's in TypeFactory anyway.\n #\n schema[:type] =\n case\n when type == Hash && schema.has_key?(:values) then Icss::Meta::TypeFactory.receive({ :type => :hash, :values => schema.delete(:values)})\n when type == Array && schema.has_key?(:items) then Icss::Meta::TypeFactory.receive({ :type => :array, :items => schema.delete(:items) })\n when type == Hash then IdenticalHashFactory\n when type == Array then IdenticalArrayFactory\n else\n Icss::Meta::TypeFactory.receive(type)\n end\n fld = (field_schemas[name] || make_field_schema).merge(schema)\n fld[:parent] = self\n @field_schemas[name] = fld\n end",
"def pack(record, generate = false)\n vals = []\n # for each property, get the value\n # or generate one if there is a lambda/default value\n record.each_pair do |key, value|\n # if the value is nil and there is a lambda\n # generate it\n next if ignored?(key)\n\n if generate and value.nil?\n l = lambdas[key]\n if l\n if l.is_a?(Proc)\n # it's a proc. invoke it.\n value = l.call if l.is_a?(Proc)\n else\n value = l\n end\n end\n end\n # in general it would be inconsistent to flatten legitimate field values\n # (e.g. in case the value was actually nil or an array), however we know\n # that these are never legitimate field values so it must have been\n # explicitly set in order to support composite fields (or the user is crazy)\n if !value.nil?\n if value.is_a?(Array)\n vals += value\n else\n vals << value\n end\n end\n end\n\n packed = vals.pack(field_spec_string)\n raise \"Packed struct size #{packed.length} does not match struct size: \" + size.to_s if packed.length != size\n packed\n end",
"def parse_record_packet\n @packet.utiny # skip first byte\n null_bit_map = @packet.read((@fields.length+7+2)/8).unpack(\"b*\").first\n rec = @fields.each_with_index.map do |f, i|\n if null_bit_map[i+2] == ?1\n nil\n else\n unsigned = f.flags & Field::UNSIGNED_FLAG != 0\n v = Protocol.net2value(@packet, f.type, unsigned)\n if v.nil? or v.is_a? Numeric or v.is_a? Time\n v\n elsif f.type == Field::TYPE_BIT or f.charsetnr == Charset::BINARY_CHARSET_NUMBER\n Charset.to_binary(v)\n else\n Charset.convert_encoding(v, @encoding)\n end\n end\n end\n rec\n end",
"def type_literal_generic_file(column)\n :bytea\n end",
"def add_field! key, initial = nil, opts = {}, &block\n key = @schema.validate_new_key! key\n @values[key] = initial\n @schema.add_field! key, initial, opts, &block\n self\n end",
"def field_to_binary(field_type, field_value)\n case field_type\n when \"boolean\"\n if field_value == \"true\"\n \"\\x01\".b\n elsif field_value == \"false\"\n \"\\x00\".b\n else\n raise \"Expected true/false, got #{field_value}\"\n end\n when \"float\"\n # Works with any of: \"123\", \"123.4\", \"123,4\"\n [field_value.gsub('\"', '').sub(\",\", \".\").to_f].pack(\"f\")\n when \"int\"\n [field_value.gsub('\"', '').to_i].pack(\"l\")\n when \"short\"\n [field_value.gsub('\"', '').to_i].pack(\"v\")\n when \"string\"\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value).unpack(\"U*\")\n else\n str = field_value.unpack(\"U*\")\n end\n [str.size].pack(\"v\") + str.pack(\"v*\")\n when \"optstring\"\n # this is really stupid\n if field_value == \"nil\"\n \"\\x00\"\n else\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value).unpack(\"U*\")\n else\n str = field_value.unpack(\"U*\")\n end\n \"\\x01\" + [str.size].pack(\"v\") + str.pack(\"v*\")\n end\n when /\\Ablob:(\\d+)/\n bloblen = $1.to_i\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value)\n else\n str = eval('\"' + field_value + '\"')\n end\n raise \"Blob expected to have #{bloblen} bytes, had #{str.size}\" unless str.size == bloblen\n str\n else\n warn \"Unknown ft/fv #{field_type} #{field_value}\"\n \"x\"\n end\n end",
"def record_write bytes, state=nil\n begin\n do_record_write bytes, state\n rescue\n nil\n end\n end",
"def store_field(data)\n @io.write [data.size].pack(\"V\") \n offset = @io.pos\n @io.write data\n @io.write \"\\0\"\n offset \n end",
"def type_literal_generic_file(column)\n :blob\n end",
"def add_field(field)\n\t\tend",
"def field(ffield, length, sourcetag, default = nil, &block)\n @fields << {\n afield: ffield,\n length: length, \n stag: sourcetag,\n default: default,\n block: block\n }\n end",
"def bytesize\n @field.bytesize\n end",
"def pad_field(*fields)\n fields.each do |field|\n unless self[field].size % 4 == 0\n self[field] << \"\\x00\" * (4 - (self[field].size % 4))\n end\n end\n end",
"def record_write bytes\n @reader.record_write bytes, @state\n end",
"def convert_field_values_to_utf8!(struct)\n return nil if struct.nil?\n struct.each_with_index do |value, index|\n if value.is_a?(String)\n converted = Puppet::Util::CharacterEncoding.convert_to_utf_8!(value)\n struct[index] = converted if !converted.nil?\n elsif value.is_a?(Array)\n struct[index] = convert_array_values_to_utf8!(value)\n end\n end\n end",
"def add(record)\n @server.add record.class.name, record.to_doc\n end",
"def insert_bytea(column, value = :no_value)\n @columns << column\n @values << Translate.escape_bytea(value, @connection.pgconn) unless value == :no_value\n end",
"def to_bson\n data.bytesize.to_bson + SUBTYPES.fetch(type) + data\n end",
"def _field_type(avro_schema)\n Deimos::SchemaBackends::AvroBase.field_type(avro_schema)\n end",
"def byte_format=(text)\n @struct_internal_format = text\n\n true\n end",
"def write_attribute (field, val, context)\n if field.multivalued?\n val = val.values if val.is_a?(Hash)\n json_attributes[field.name] = EmbeddedDocumentArray.new(field.type, context, val)\n else\n old_value = read_attribute(field, context)\n converted_value = field.convert(val)\n converted_value.parent = context if converted_value.is_a?(EmbeddedDocument)\n unless old_value == converted_value\n unless field.type.include?(EmbeddedDocument) or Thread.current[:do_not_track_json_field_changes]\n changes = changed_attributes\n if changes.include?(field.name)\n changes.delete(field.name) if converted_value == changes[field.name]\n else\n old_value = (old_value.clone rescue old_value) unless old_value.nil? || old_value.is_a?(Numeric) || old_value.is_a?(Symbol) || old_value.is_a?(TrueClass) || old_value.is_a?(FalseClass)\n changes[field.name] = old_value\n end\n end\n unless converted_value.nil?\n json_attributes[field.name] = converted_value\n else\n json_attributes.delete(field.name)\n end\n end\n context.json_attributes_before_type_cast[field.name] = val\n end\n return val\n end",
"def pbWriteCsvRecord(record,file,schema)\r\n rec = (record.is_a?(Array)) ? record.clone : [record]\r\n for i in 0...schema[1].length\r\n chr = schema[1][i,1]\r\n file.write(\",\") if i>0\r\n if rec[i].nil?\r\n # do nothing\r\n elsif rec[i].is_a?(String)\r\n file.write(csvQuote(rec[i]))\r\n elsif rec[i].is_a?(Symbol)\r\n file.write(csvQuote(rec[i].to_s))\r\n elsif rec[i]==true\r\n file.write(\"true\")\r\n elsif rec[i]==false\r\n file.write(\"false\")\r\n elsif rec[i].is_a?(Numeric)\r\n case chr\r\n when \"e\", \"E\" # Enumerable\r\n enumer = schema[2+i]\r\n if enumer.is_a?(Array)\r\n file.write(enumer[rec[i]])\r\n elsif enumer.is_a?(Symbol) || enumer.is_a?(String)\r\n mod = Object.const_get(enumer.to_sym)\r\n file.write(getConstantName(mod,rec[i]))\r\n elsif enumer.is_a?(Module)\r\n file.write(getConstantName(enumer,rec[i]))\r\n elsif enumer.is_a?(Hash)\r\n for key in enumer.keys\r\n if enumer[key]==rec[i]\r\n file.write(key)\r\n break\r\n end\r\n end\r\n end\r\n when \"y\", \"Y\" # Enumerable or integer\r\n enumer = schema[2+i]\r\n if enumer.is_a?(Array)\r\n if enumer[rec[i]]!=nil\r\n file.write(enumer[rec[i]])\r\n else\r\n file.write(rec[i])\r\n end\r\n elsif enumer.is_a?(Symbol) || enumer.is_a?(String)\r\n mod = Object.const_get(enumer.to_sym)\r\n file.write(getConstantNameOrValue(mod,rec[i]))\r\n elsif enumer.is_a?(Module)\r\n file.write(getConstantNameOrValue(enumer,rec[i]))\r\n elsif enumer.is_a?(Hash)\r\n hasenum = false\r\n for key in enumer.keys\r\n if enumer[key]==rec[i]\r\n file.write(key)\r\n hasenum = true; break\r\n end\r\n end\r\n file.write(rec[i]) unless hasenum\r\n end\r\n else # Any other record type\r\n file.write(rec[i].inspect)\r\n end\r\n else\r\n file.write(rec[i].inspect)\r\n end\r\n end\r\n return record\r\n end",
"def attrs_for_record(node, record_class)\n record_class.fields_map.inject({}) do |attrs, (field, xpath)|\n element = node.xpath(\"./#{xpath}\")\n\n value = if element.children.length > 1\n element.children.map(&:to_s)\n else\n text = element.text\n text = text.strip if text\n end\n value = Array(value).map{|e| e.encode('UTF-8') }\n value = value.first if value.length == 1\n\n attrs = attrs.merge(field => value)\n end\n end",
"def to_gfa_field(datatype: nil)\n self << @datatype\n self << \"\\0\"\n to_json\n end",
"def add_record(value)\n @children['record'][:value] << value\n end",
"def add_record(value)\n @children['record'][:value] << value\n end",
"def fields_for(record_name, record_object = T.unsafe(nil), fields_options = T.unsafe(nil), &block); end",
"def << bytes\n @body << bytes\n end",
"def add_record(record)\n return unless @if_proc.call(record)\n\n condensed_record = condense_record(record)\n atoms = add_occurences(condensed_record, record.id)\n\n @storage.add(atoms)\n end",
"def add(record, zone)\n new_answers = [{ answer: build_api_answer_from_record(record) }]\n\n record_fqdn = record.fqdn.sub(/\\.$/, '')\n\n existing_record = client.record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type\n )\n\n if existing_record.nil?\n client.create_record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type,\n params: {\n answers: new_answers,\n ttl: record.ttl,\n use_client_subnet: false, # only required for filter chains that are not supported by record_store\n }\n )\n return\n end\n\n existing_answers = existing_record['answers'].map { |answer| symbolize_keys(answer) }\n client.modify_record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type,\n params: { answers: existing_answers + new_answers, ttl: record.ttl }\n )\n end",
"def add(name, type, offset = nil)\n if type.respond_to?(:to_str) || type.respond_to?(:to_sym)\n type = registry.build(type.to_s)\n end\n @fields << [name.to_s, type, offset]\n end",
"def addRecord(rec); @records[rec.key] = rec end",
"def new_data_field(field)\n datafield = MARC::DataField.new(field['2'],\n field.indicator1,\n field.indicator2)\n field.subfields.each do |sf|\n unless %w[0 2 3].include?(sf.code)\n datafield.append(MARC::Subfield.new(sf.code, sf.value))\n end\n end\n datafield\n# puts \"DATAFIELD: #{datafield.inspect}\"\n end",
"def field(spec, name = nil, data_lambda = nil)\n add_field Field.new(String, spec, name || next_unknown_field_name, data_lambda)\n end",
"def add_field(name, type, options={})\n name = name.to_s\n \n # preconditions\n raise InvalidModelField.new(\"Duplicate field name\") if record_fields.key?(name)\n raise InvalidModelField.new(\"Type must be a known yodel field type\") unless valid_type?(type)\n raise InvalidModelField.new(\"Field name cannot start with an underscore\") if name.start_with?('_')\n \n # add the field to the model and subclasses\n field_type = Field.field_from_type(type.to_s)\n field = field_type.new(name, deep_stringify_keys(options.merge(type: type.to_s)))\n RecordIndex.add_index_for_field(self, field) if field.index?\n record_fields[name] = field\n end",
"def bad_utf8_fix(record)\n record.fields.each do |field|\n if field.class == MARC::DataField\n field.subfields.each do |subfield|\n subfield.value.force_encoding('UTF-8')\n subfield.value.scrub!('')\n end\n else\n field.value.force_encoding('UTF-8')\n field.value.scrub!('')\n end\n end\n record\nend",
"def read_struct_data(bytes)\n self.class.set_values_from_byte_to_object(bytes, self)\n end",
"def substruct(strbuf, name, len, klass, *extra_args)\n new=klass.new(strbuf, *extra_args)\n @fields << new\n @hash_references[name]=new\n meta_def name do new end\n # More informative than the NoMethodError they would normally get.\n meta_def (name.to_s + '=').to_sym do raise NoMethodError, \"Binstruct: Illegal call of '=' on a substruct.\" end\n end",
"def record(record)\n @db.save_doc(record)\n end",
"def literal_blob_append(sql, v)\n sql << \"'\" << db.synchronize(@opts[:server]){|c| c.escape_bytea(v)} << \"'\"\n end",
"def add_field(name, data_lambda = nil)\n name = next_unknown_field_name if name.nil?\n @fields << name.to_sym\n @lambdas[name.to_sym] = data_lambda if data_lambda\n end",
"def serialize_fields(buffer, max_bson_size = nil)\n fields.each do |field|\n value = instance_variable_get(field[:name])\n if field[:multi]\n value.each do |item|\n if field[:type].respond_to?(:size_limited?)\n field[:type].serialize(buffer, item, max_bson_size)\n else\n field[:type].serialize(buffer, item)\n end\n end\n else\n if field[:type].respond_to?(:size_limited?)\n field[:type].serialize(buffer, value, max_bson_size)\n else\n field[:type].serialize(buffer, value)\n end\n end\n end\n end",
"def add_column_types obj\n FbArray.new(obj)\n end",
"def field(*params)\n config = params.extract_options!\n config.assert_valid_keys(*::Schemaless::Field::VALID_OPTS)\n type = config.delete(:type)\n type ||= params.size > 1 ? params.pop : :string # TBD\n name = params.join\n schemaless_fields <<\n ::Schemaless::Field.new(name, type, config)\n end",
"def write(record)\n case record\n when FlatKit::Jsonl::Record\n write_record(record)\n when FlatKit::Record\n converted_record = ::FlatKit::Jsonl::Record.from_record(record)\n write_record(converted_record)\n else\n raise FlatKit::Error, \"Unable to write records of type #{record.class}\"\n end\n rescue FlatKit::Error => fe\n raise fe\n rescue => e\n ::FlatKit.logger.error \"Error reading jsonl records from #{output.name}: #{e}\"\n raise ::FlatKit::Error, e\n end",
"def add(field, val, boost=nil)\n return if val == nil\n return if val == ''\n if val.is_a? Array\n val.each {|v| self.add(field, v)}\n else\n self.addField(field, val)\n end\n self.boost = boost if boost\n end",
"def append(field)\n @fields.push(field)\n @fields.clean = false\n end",
"def literal_blob_append(sql, v)\n if v.empty?\n sql << \"''\"\n else\n sql << \"x'#{v.unpack('H*').first}'\"\n end\n end",
"def bytesize_of(member)\n self.class.bytesize_of(member)\n end",
"def get_struct(field)\n field['structValue']\n end",
"def add_field(field, data_type = nil, options = {})\n data_type = DataType::String if data_type.nil?\n puts [\":#{field}\", \"#{data_type.class.to_s}\", \"#{options.inspect}\"].collect { |s| s.ljust(25) }.join if ENV['DEBUG']\n \n # Fields that do special things go here.\n if field == :timestamps\n add_field(:updated_at, :datetime)\n add_field(:created_at, :datetime)\n return true\n end\n\n # Add index if explicitly asked\n @indexes << field if options.delete(:index) || data_type.class.to_s == 'Hash' && data_type.delete(:index)\n @validations[field] = options.delete(:validates) if options[:validates]\n options.merge!(:field => field) \n \n # Matches: description DataType::Paragraph, :index => true\n if data_type.is_a?(Class) && data_type.respond_to?(:migrant_data_type?)\n @columns[field] = data_type.new(options)\n # Matches: description :index => true, :unique => true\n else\n begin\n # Eg. \"My field\" -> String -> DataType::String\n @columns[field] = \"DataType::#{data_type.class.to_s}\".constantize.new(options.merge(:value => data_type))\n rescue NameError\n # We don't have a matching type, throw a warning and default to string\n puts \"MIGRATION WARNING: No migration implementation for class #{data_type.class.to_s} on field '#{field}', defaulting to string...\"\n @columns[field] = DataType::Base.new(options)\n end\n end\n end",
"def store_defcol #:nodoc:\n record = 0x0055 # Record identifier\n length = 0x0002 # Number of bytes to follow\n\n colwidth = 0x0008 # Default column width\n\n header = [record, length].pack(\"vv\")\n data = [colwidth].pack(\"v\")\n\n prepend(header, data)\n end",
"def store_blob(object,field_name,blob)\n super #=> returns blob[:tempfile]\n end",
"def create_record(line, line_number = -1) #:nodoc:\n h = Hash.new\n\n pack_format = self.class.get_subclass_variable 'pack_format'\n fields = self.class.get_subclass_variable 'fields'\n\n f = line.unpack(pack_format)\n (0..(fields.size-1)).map do |index|\n unless fields[index].is_padding?\n h.store fields[index].name, fields[index].pass_through_filters(f[index])\n end\n end\n Record.new(self.class, h, line_number)\n end",
"def data= blob\n $postgres.exec_prepared('wsfile_update', [self.id, {value: blob, format: 1}])\n end",
"def add_field(database, table, arg_hash)\n array = JSON.parse(@database_set, :symbolize_names => true)\n array.each do |a|\n if a[:database] == database\n a[:tables].each do |t|\n if t[:name] == table\n field_hash = {}\n FIELD_ATTRS.each { |fa|\n field_hash[fa.to_sym] = arg_hash[fa.to_sym].nil? ? \"\" :\n arg_hash[fa.to_sym] }\n FIELD_ATTRS[0..2].each do |fa|\n if field_hash[fa.to_sym] == \"\"\n warn(\"filed #{fa} requires any values.\")\n return -1\n end\n end\n t[:fields].push(field_hash)\n break\n end\n end\n end\n end\n @database_set = JSON.generate(array)\n return 0\n end",
"def add_field(identifier, value = nil)\n @fields << build_field(identifier, value)\n end",
"def post_process(record)\n len = record[@len_field.name] rescue nil\n if !len.nil? and len.is_a?(Fixnum)\n value = record[@string_field.name]\n value.slice!(len..-1)\n record[@string_field.name] = value # we can avoid reassignment assuming the value is a reference not a copy\n end\n end",
"def update_field(key,field,value)\n request :put, \"#{path_prefix}records/#{ue key}?field=#{ue field}\",\n :body => value,\n :content_type => \"application/octet-stream\"\n end",
"def add_field(var_name, type, xml_tag, value=nil)\n @fields[var_name] = Field.new(var_name, type, xml_tag, value)\n end",
"def extend_schema(schema, file = nil, &block)\n Rubyrel::DDL::extend_schema(schema, file, &block)\n end",
"def dump(rec)\n data = if rec.size == 1\n [rec[0].bytesize, DELETE].pack('NN') << rec[0]\n else\n [rec[0].bytesize, rec[1].bytesize].pack('NN') << rec[0] << rec[1]\n end\n data << crc32(data)\n end",
"def field(spec, name = nil, data_lambda = nil)\n @field_specs << spec\n add_field(name, data_lambda)\n end",
"def update_typed_field(header, val, processed)\n if header.match?(type_header_pattern)\n stripped_header = header.gsub('_type', '')\n processed[stripped_header.to_sym] ||= []\n processed[stripped_header.to_sym] << { type: val }\n else\n fields = Array(processed[header.to_sym])\n fields.last[:name] = val\n end\n end",
"def update_typed_field(header, val, processed)\n if header.match(type_header_pattern)\n stripped_header = header.gsub('_type', '')\n processed[stripped_header.to_sym] ||= []\n processed[stripped_header.to_sym] << { type: val }\n else\n fields = Array(processed[header.to_sym])\n fields.last[:name] = val\n end\n end",
"def append_byte(b=nil)\n if b.class == Fixnum && !block_given?\n @j_del.java_method(:appendByte, [Java::byte.java_class]).call(::Vertx::Util::Utils.to_byte(b))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling append_byte(b)\"\n end",
"def add_field(name, sample_name, container_name, role, opts)\n raise \"Can't add field to #{self.class} before it has been saved.\" unless id\n\n sample_names = sample_name.nil? || sample_name.is_a?(String) ? [sample_name] : sample_name\n container_names = container_name.nil? || container_name.is_a?(String) ? [container_name] : container_name\n\n ft = field_types.create({ parent_id: id, name: name, ftype: 'sample', role: role }.merge(opts))\n ft.save\n\n if sample_names\n (0..sample_names.length - 1).each do |i|\n sample = SampleType.find_by(name: sample_names[i]) if sample_names[i].present?\n container = ObjectType.find_by(name: container_names[i]) if container_names[i].present?\n\n ft.allowable_field_types.create(\n sample_type_id: sample ? sample.id : nil,\n object_type_id: container ? container.id : nil\n )\n end\n end\n\n self\n end",
"def renderRec(model, rec, result)\n nameSpace, base = assertNamespace(rec.name)\n L.info(\"Rendering record #{rec.name}\")\n result << %<\nmessage #{base} {\n>\n pbInt = 1\n rec.fields.each_key { | fldId|\n fld = rec.fields[fldId]\n ty = fld.dataType.type\n if fld.aggr && !fld.map?\n result << \"#{INDENT}repeated #{protoType(fld.dataType, model, rec)} #{fldId} = #{pbInt};\\n\"\n elsif fld.map?\n raise ArgumentError, %<Field \"#{fldId}\" of the rec \"#{base}\": for Protobuf, map can not be optional, it must be required> unless fld.isRequired\n result << \"#{INDENT}map<#{protoType(fld.dataType, model, rec)}, #{protoType(fld.trgType, model, rec)}> #{fldId} = #{pbInt};\\n\"\n elsif model.enums[ty] && model.enums[ty].is_a?(DataMetaDom::Mapping)\n raise ArgumentError, %<Field \"#{fldId}\" of the rec \"#{base}\": for Protobuf, map can not be optional, it must be required> unless fld.isRequired\n result << \"#{INDENT}map<#{protoType(model.enums[ty].fromT, model, rec)}, #{protoType(model.enums[ty].toT, model, rec)}> #{fldId} = #{pbInt};\\n\"\n elsif fld.isRequired\n result << \"#{INDENT}#{protoType(fld.dataType, model, rec)} #{fldId} = #{pbInt};\\n\"\n else\n result << \"#{INDENT}repeated #{protoType(fld.dataType, model, rec)} #{fldId} = #{pbInt};\\n\"\n end\n pbInt += 1\n }\n result << %q<}\n>\n end",
"def fields_for(record_name, record_object = T.unsafe(nil), options = T.unsafe(nil), &block); end",
"def << tagspec\n @marcfieldspecs << tagspec\n end",
"def convert_record(tag, record)\n # Assume that all non-message items in the record are dimensions.\n message = record.delete(\"message\")\n dimensions = record\n dimensions[\"tag\"] = tag\n [message, dimensions]\n end",
"def compound_fields\n %i[file_data emma_data]\n end",
"def add_field(field_name)\n result_table = table.map { |row| row.merge!(field_name => nil) }\n File.write(@table_path, JSON.generate(result_table))\n end",
"def byte_size()\n if @record and RECORD_INFO[@record.type].size > 0 then\n RECORD_INFO[@record.type].size * @value.length\n else\n sum = 0\n @value.each do |val|\n sum += (val.length % 2 == 0) ? val.length : val.length + 1\n end\n sum\n end\n end",
"def encode_new_value(record)\n record.new_value.force_encoding('utf-8')\n\n record.new_value =\n record.new_value.encode('utf-8', invalid: :replace, undef: :replace, replace: '_')\n rescue StandardError => e\n Rollbar.error(e, 'Failed to encode value to UTF-8', record: record) if report_to_rollbar\n\n nil\n end",
"def field(name, type)\n @fields << Field.new(name, type, @fields.size, nil, {})\n end",
"def initialize(field_type, field_size, id)\n @field_type = field_type\n @field_size = field_size\n @id = id\n @@all_fields << self \n end",
"def deep_each( &blk ) #:yields: a Field\n @fields.each {|atom|\n if atom.is_a? Binstruct\n atom.deep_each &blk unless atom.fields.empty?\n else\n yield atom\n end\n }\n end",
"def add_available_data_type(name, serialization_type, schema)\n raise ArgumentError, \"Data serialization_type must be 'avro' for '#{name}'\" unless serialization_type == 'avro'\n\n if available_data_types[name.to_s].include? serialization_type.to_s\n raise ArgumentError, \"Data type '#{name}' already defined for serialization_type '#{serialization_type}'\"\n end\n\n available_data_types[name.to_s][serialization_type.to_s] = schema\n end",
"def write(record)\n @fh.puts(encode(record))\n self\n end",
"def fbe_extra\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return 0\n end\n\n fbe_struct_offset = read_uint32(fbe_offset)\n if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4) > @_buffer.size)\n return 0\n end\n\n @_buffer.shift(fbe_struct_offset)\n\n fbe_result = fbe_body \\\n + id.fbe_extra \\\n + symbol.fbe_extra \\\n + side.fbe_extra \\\n + type.fbe_extra \\\n + price.fbe_extra \\\n + volume.fbe_extra \\\n\n @_buffer.unshift(fbe_struct_offset)\n\n fbe_result\n end",
"def field(label = nil, note = nil, &contents)\n @fields << Field.new(:label => label, :note => note, &contents)\n end",
"def literal_blob_append(sql, v)\n sql << \"'\" << v.gsub(/[\\000-\\037\\047\\134\\177-\\377]/n){|b| \"\\\\#{(\"%o\" % b[0..1].unpack(\"C\")[0]).rjust(3, '0')}\"} << \"'\"\n end",
"def decode(bytes)\n bytes.force_encoding(Encoding::BINARY)\n input = StringIO.new(bytes)\n version = has_version_tag ? input.read(1).ord : 0\n schema = schema_versions[version]\n raise ClientError, \"no registered schema for version #{version}\" unless schema\n read(input, schema)\n end",
"def sub_field(named, human_name = nil, &block)\n human_name ||= named\n @sub_fields << QueryBuilder::Field.new(named, human_name, self.depth+1, &block)\n end",
"def set_fields(fbe_value)\n byte0.set(fbe_value.byte0)\n byte1.set(fbe_value.byte1)\n byte2.set(fbe_value.byte2)\n byte3.set(fbe_value.byte3)\n byte4.set(fbe_value.byte4)\n byte5.set(fbe_value.byte5)\n char0.set(fbe_value.char0)\n char1.set(fbe_value.char1)\n char2.set(fbe_value.char2)\n char3.set(fbe_value.char3)\n char4.set(fbe_value.char4)\n char5.set(fbe_value.char5)\n wchar0.set(fbe_value.wchar0)\n wchar1.set(fbe_value.wchar1)\n wchar2.set(fbe_value.wchar2)\n wchar3.set(fbe_value.wchar3)\n wchar4.set(fbe_value.wchar4)\n wchar5.set(fbe_value.wchar5)\n int8b0.set(fbe_value.int8b0)\n int8b1.set(fbe_value.int8b1)\n int8b2.set(fbe_value.int8b2)\n int8b3.set(fbe_value.int8b3)\n int8b4.set(fbe_value.int8b4)\n int8b5.set(fbe_value.int8b5)\n uint8b0.set(fbe_value.uint8b0)\n uint8b1.set(fbe_value.uint8b1)\n uint8b2.set(fbe_value.uint8b2)\n uint8b3.set(fbe_value.uint8b3)\n uint8b4.set(fbe_value.uint8b4)\n uint8b5.set(fbe_value.uint8b5)\n int16b0.set(fbe_value.int16b0)\n int16b1.set(fbe_value.int16b1)\n int16b2.set(fbe_value.int16b2)\n int16b3.set(fbe_value.int16b3)\n int16b4.set(fbe_value.int16b4)\n int16b5.set(fbe_value.int16b5)\n uint16b0.set(fbe_value.uint16b0)\n uint16b1.set(fbe_value.uint16b1)\n uint16b2.set(fbe_value.uint16b2)\n uint16b3.set(fbe_value.uint16b3)\n uint16b4.set(fbe_value.uint16b4)\n uint16b5.set(fbe_value.uint16b5)\n int32b0.set(fbe_value.int32b0)\n int32b1.set(fbe_value.int32b1)\n int32b2.set(fbe_value.int32b2)\n int32b3.set(fbe_value.int32b3)\n int32b4.set(fbe_value.int32b4)\n int32b5.set(fbe_value.int32b5)\n uint32b0.set(fbe_value.uint32b0)\n uint32b1.set(fbe_value.uint32b1)\n uint32b2.set(fbe_value.uint32b2)\n uint32b3.set(fbe_value.uint32b3)\n uint32b4.set(fbe_value.uint32b4)\n uint32b5.set(fbe_value.uint32b5)\n int64b0.set(fbe_value.int64b0)\n int64b1.set(fbe_value.int64b1)\n int64b2.set(fbe_value.int64b2)\n int64b3.set(fbe_value.int64b3)\n int64b4.set(fbe_value.int64b4)\n int64b5.set(fbe_value.int64b5)\n uint64b0.set(fbe_value.uint64b0)\n uint64b1.set(fbe_value.uint64b1)\n uint64b2.set(fbe_value.uint64b2)\n uint64b3.set(fbe_value.uint64b3)\n uint64b4.set(fbe_value.uint64b4)\n uint64b5.set(fbe_value.uint64b5)\n end",
"def add_record(record)\n condensed_record = condense_record(record)\n load_atoms(condensed_record)\n add_occurences(condensed_record,record.id)\n @records_size += 1\n end",
"def add_field(field)\n fields[field.name] = field\n\n # first setup the Serializable property, this also creates the\n # initial attr for us\n property_accessor field.name\n # next we'll need to overwrite the writer created by property_accessor,\n # with our field validation one.\n define_field_writer field, field.name\n\n field.name\n end",
"def field_as_json(field)\n res = \"'#{field.name}' => @#{field.name}\"\n field_base_type = _schema_base_class(field.type).type_sym\n\n if %i(record enum).include?(field_base_type)\n res += case field.type.type_sym\n when :array\n '.map { |v| v&.as_json }'\n when :map\n '.transform_values { |v| v&.as_json }'\n else\n '&.as_json'\n end\n end\n\n res + (field.name == @fields.last.name ? '' : ',')\n end",
"def add_fields(fields)\n\t\tend",
"def add_field(name, val)\n @data[name] = val\n self\n end"
] |
[
"0.59158766",
"0.56080073",
"0.55081683",
"0.5453812",
"0.5372978",
"0.53194565",
"0.5313502",
"0.52146715",
"0.518387",
"0.5176976",
"0.5137892",
"0.5135207",
"0.512863",
"0.51171196",
"0.50648403",
"0.50606465",
"0.50067043",
"0.49941772",
"0.49736175",
"0.49674642",
"0.49631613",
"0.49495822",
"0.49484378",
"0.4895368",
"0.48945996",
"0.4883997",
"0.48767513",
"0.4834031",
"0.48291874",
"0.48039514",
"0.48000458",
"0.4798127",
"0.4796197",
"0.47840455",
"0.47840455",
"0.47825485",
"0.47814283",
"0.47723016",
"0.47708705",
"0.47601262",
"0.47580722",
"0.47580665",
"0.47562793",
"0.47545478",
"0.4750319",
"0.47414544",
"0.47125486",
"0.47003064",
"0.46949303",
"0.46908414",
"0.46806374",
"0.46787056",
"0.46782598",
"0.46736327",
"0.46675503",
"0.46639982",
"0.46609378",
"0.46604878",
"0.46410188",
"0.46407777",
"0.4639448",
"0.4633902",
"0.4633551",
"0.4630716",
"0.46296245",
"0.46264374",
"0.4620827",
"0.4618302",
"0.46048605",
"0.46016142",
"0.4595679",
"0.45916438",
"0.45911574",
"0.4586206",
"0.45806238",
"0.4580017",
"0.4579227",
"0.45781782",
"0.4569494",
"0.45686564",
"0.4563734",
"0.45612904",
"0.4558214",
"0.45577586",
"0.4555799",
"0.45450926",
"0.4544994",
"0.45446292",
"0.45329478",
"0.4528982",
"0.45275065",
"0.4525514",
"0.45251018",
"0.450795",
"0.45063448",
"0.4502955",
"0.44928065",
"0.4486858",
"0.44845837",
"0.4481469"
] |
0.5954681
|
0
|
Adds a timestamp field to the nested schema of a record field. This can only be called on fields that are of type `RECORD`.
|
def timestamp name, description: nil, mode: :nullable, policy_tags: nil
record_check!
add_field name, :timestamp, description: description, mode: mode, policy_tags: policy_tags
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def timestamp_field=(_field_name)\n raise Error, E_TIMESTAMP_FIELD_CONFIG\n end",
"def type_literal_generic_datetime(column)\n :timestamp\n end",
"def append_timestamp(value)\n time = case value\n when Time\n value\n when Date\n value.to_time\n else\n begin\n Time.parse(value)\n rescue\n raise(ArgumentError, \"Cannot parse argument `#{value}` to Time or Date.\")\n end\n end\n\n _append_timestamp(time.year, time.month, time.day, time.hour, time.min, time.sec, time.nsec / 1000)\n end",
"def add_timestamp\n @item.timestamp = @bib.fetched.to_s if @bib.fetched\n end",
"def to_doc\n # doc now has all the fields of our model instance, we \n # just add another field to it:\n doc = super\n # add a field containing the current time\n doc[:added] = Time.now.to_i.to_s\n return doc\n end",
"def record_timestamps\n doc \"When this record has been created.\"\n datetime \"created_at\"\n doc \"When this record has been updated lastly.\"\n datetime \"updated_at\"\n end",
"def add_copied_at_field\n logger.info \"Adding #{name}._copied_at audit field...\"\n db.query(\"ALTER TABLE #{audit} ADD `_copied_at` TIMESTAMP NULL\")\n end",
"def add_dynamic_timestamp(text)\nend",
"def timestamp(value)\n merge(timestamp: value.iso8601)\n end",
"def update_timestamp(work)\n # these timestamps are the Hyrax managed fields, not rails timestamps\n if work.date_uploaded\n work.date_modified = Time.current\n else\n work.date_uploaded = Time.current\n end\n end",
"def set_deleted_timestamp(time=nil)\n field = model.deleted_timestamp_field\n meth = :\"#{field}=\"\n if respond_to?(field) && respond_to?(meth) && (model.deleted_timestamp_overwrite? || send(field).nil?)\n self.send(meth, time||=Sequel.datetime_class.now)\n self.save\n end\n end",
"def timestamp\n @timestamp ||= Time.parse(self['timestamp'])\n end",
"def log_kv(timestamp: Time.now, **fields)\n @logs << fields.merge(timestamp: timestamp)\n nil\n end",
"def new_timestamp # :nodoc:\n @properties['timestamp'].dup\n end",
"def reset_timestamp_attrs_for_update_if_needed!\n paper_trail.reset_timestamp_attrs_for_update_if_needed\n end",
"def record_timestamps\n false\n end",
"def update!(timestamp = Time.now)\n ts = timestamp.respond_to?(:xmlschema) ? timestamp.xmlschema : timestamp.to_s\n\n if has_updated?\n updated.text = ts\n else\n add_child Updated.new { |u| u.text = ts }\n end\n\n self\n end",
"def record_creation_timestamp(path, timestamp)\n # Hook method: Linux filesystems doesn't store creation datetime\n end",
"def time_for(record)\n return nil unless record\n case database_type\n when :mongo\n return Time.at(record['ts'].seconds)\n when :toku\n return record['ts']\n end\n end",
"def record_timestamps\n false\n end",
"def timestamp\n attribute_prop(4)\n end",
"def log_kv(timestamp: Time.now, **fields)\n # Using Thrift::Log to avoid unnecessary memory allocations\n @logs << ThriftLogBuilder.build(timestamp, fields)\n nil\n end",
"def touch_with_version(name = nil)\n unless @record.persisted?\n raise ::ActiveRecord::ActiveRecordError, \"can not touch on a new record object\"\n end\n attributes = @record.send :timestamp_attributes_for_update_in_model\n attributes << name if name\n current_time = @record.send :current_time_from_proper_timezone\n attributes.each { |column|\n @record.send(:write_attribute, column, current_time)\n }\n unless will_record_after_update?\n record_update(force: true, in_after_callback: false)\n end\n @record.save!(validate: false)\n end",
"def time_field field = nil\n @time_field = field if field\n @time_field\n end",
"def record_modification_timestamp(path, timestamp)\n File.utime(timestamp, timestamp, path)\n record_access_timestamp(path, timestamp)\n record_changed_timestamp(path, timestamp)\n end",
"def timestamps!\n key :created_at, Time\n key :updated_at, Time\n class_eval { before_save :update_timestamps }\n end",
"def update_timestamp\n self.fields_last_modified = {\n columns_changeable: self.columns_changeable,\n columns_visible: self.columns_visible,\n filters: self.filters}.hash.to_s(36)[1..5]\n end",
"def record_access_timestamp(path, timestamp)\n # Hook method: Already stored with File.utime\n end",
"def timestamp\n @timestamp ||= @attributes['timestamp'] ? Time.zone.at(@attributes['timestamp']) : nil\n end",
"def timestamp\n @timestamp ||= @attributes['timestamp'] ? Time.zone.at(@attributes['timestamp']) : nil\n end",
"def save_timestamp_changes(root)\n iterator = Iterators::PreOrderEntriesIterator.new(root)\n while iterator.has_next?\n next_entry = iterator.next_item\n record_creation_timestamp(next_entry.path, next_entry.new_created_datetime)\n record_modification_timestamp(next_entry.path, next_entry.new_modified_datetime)\n end\n end",
"def make_gelfentry(tag, time, record)\n record = merge_inner_json(record, \"message\")\n record = merge_inner_json(record, \"log\")\n gelfentry = {}\n gelfentry[\"timestamp\"] = if defined?(Fluent::EventTime) && time.is_a?(Fluent::EventTime)\n time.sec + (time.nsec.to_f / 1_000_000_000).round(3)\n else\n time\n end\n\n gelfentry[\"_fluentd_tag\"] = tag\n\n record.each_pair do |k, v| # rubocop:disable Metrics/BlockLength\n case k\n when \"timestamp\", \"time\"\n gelfentry[\"timestamp\"] = if v.is_a?(Integer) || v.is_a?(Float)\n v\n else\n begin\n (DateTime.parse(v).strftime(\"%Q\").to_f / 1_000).round(3)\n rescue ArgumentError\n v\n end\n end\n when \"msec\" then\n if time.is_a?(Integer) && record[\"timestamp\"].nil? && record[\"time\"].nil?\n gelfentry[\"timestamp\"] = \"#{time}.#{v}\".to_f\n else\n gelfentry[\"_msec\"] = v\n end\n when \"level\"\n gelfentry[\"level\"] = if v.is_a?(Integer)\n v\n else\n level = LEVEL_MAPPING.keys.find { |l| v.downcase =~ /#{l}/ }\n level.nil? ? v : LEVEL_MAPPING[level]\n end\n when \"source_realtime_timestamp\" then gelfentry[\"timestamp\"] = (v.to_f / 1_000_000).round(3)\n when \"host\", \"hostname\" then gelfentry[\"host\"] = v.to_s\n when \"priority\" then gelfentry[\"level\"] = v.to_i\n when \"syslog_facility\" then gelfentry[\"facility\"] = SYSLOG_FACILITY[v]\n when \"short_message\", \"version\", \"full_message\", \"facility\", \"file\", \"line\" then gelfentry[k] = v\n else\n k.to_s.start_with?(\"_\") ? gelfentry[k] = v : gelfentry[\"_#{k}\"] = v\n end\n end\n\n if gelfentry[\"short_message\"].nil? || gelfentry[\"short_message\"].to_s.empty?\n gelfentry[\"short_message\"] = if gelfentry.key?(\"_message\") && !gelfentry[\"_message\"].to_s.empty?\n gelfentry.delete(\"_message\")\n elsif gelfentry.key?(\"_log\") && !gelfentry[\"_log\"].to_s.empty?\n gelfentry.delete(\"_log\")\n else\n \"(no message)\"\n end\n end\n\n if gelfentry[\"level\"].nil?\n level = LEVEL_MAPPING.keys.find { |k| tag.downcase =~ /\\.#{k}/ }\n gelfentry[\"level\"] = level.nil? ? 6 : LEVEL_MAPPING[level]\n end\n\n gelfentry\n end",
"def without_touching(record)\n if record.class.respond_to?(:without_timestamps)\n record.class.without_timestamps { yield }\n else\n yield\n end\n end",
"def timestamp\n _timestamp.as_time\n end",
"def timestamp\n Time.at((attributes[:timestamp] || Time.now).to_i)\n end",
"def reset_timestamp_attrs_for_update_if_needed\n return if live?\n @record.send(:timestamp_attributes_for_update_in_model).each do |column|\n @record.send(\"restore_#{column}!\")\n end\n end",
"def reset_timestamp_attrs_for_update_if_needed\n return if live?\n @record.send(:timestamp_attributes_for_update_in_model).each do |column|\n @record.send(\"restore_#{column}!\")\n end\n end",
"def convert_for_timestamp_shape(arg)\n return nil if arg.nil?\n\n time_value = case arg\n when Time\n arg\n when Date, DateTime\n arg.to_time\n when Integer, Float\n Time.at(arg)\n else\n Time.parse(arg.to_s)\n end\n time_value.utc.iso8601\n end",
"def time name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :time, description: description, mode: mode, policy_tags: policy_tags\n end",
"def timestamp=(time)\n @timestamp = time.is_a?(Time) ? time.to_f : time\n end",
"def append_timestamp_to_column_name(column)\n old_name = \"\\\"#{column['api-name']}\\\"\"\n\n timestamp = get_timestamp()\n column['name'] += timestamp\n column['api-name'] += timestamp\n new_name = \"\\\"#{column['api-name']}\\\"\"\n\n @column_translation[old_name] = new_name\n end",
"def timestamp\n self[:timestamp]\n end",
"def timestamp\n Time.parse( props[ TIMESTAMP_PROP_NAME ] ) if props\n end",
"def local_timestamp(body)\n @var[:timestamp] = body\n _save_env\n _notice \"Timestamp format changed\"\nend",
"def time_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end",
"def created_at; @doc['created_at']; end",
"def time_field(object_name, method, options = T.unsafe(nil)); end",
"def add_last_version_field\n logger.info \"Adding #{name}._last_version audit field...\"\n db.query(\"ALTER TABLE #{audit} ADD `_last_version` BIGINT NULL\") \n end",
"def timestamp\n self.created_at.to_s(:db)\n end",
"def update_timestamp(namespace, new_timestamp)\n @coll.update({ SolrConfigConst::SOLR_URL_KEY => @solr_loc,\n SolrConfigConst::NS_KEY => namespace\n },\n { \"$set\" => {\n SolrConfigConst::UPDATE_TIMESTAMP_KEY => new_timestamp\n }})\n end",
"def timestamp=(timestamp)\n @timestamp = _check_timestamp(timestamp)\n end",
"def timestamps(options = {})\n attribute(:created_at, options.update(type: :timestamp))\n attribute(:updated_at, options.update(type: :timestamp))\n end",
"def update_timestamp\n self.fields_last_modified = {\n columns_changeable: columns_changeable,\n columns_visible: columns_visible,\n filters: filters\n }.hash.to_s(36)[1..5]\n end",
"def literal_time(v)\n v.strftime(\"TIMESTAMP '%Y-%m-%d %H:%M:%S'\")\n end",
"def update_timestamps(prefix)\n new_time = Time.now.utc\n recorder = @recorders[prefix]\n recorder.views_data.each do |view_data|\n view_data.data.each_value do |aggr_data|\n # Apply this only to GAUGE metrics. This could fail if the metric uses\n # Distribution or other fancier aggregators.\n aggr_data.add aggr_data.value, new_time if aggr_data.is_a? OpenCensus::Stats::AggregationData::LastValue\n end\n end\n end",
"def insert_timestamp object_id\n if @timestamps[object_id].nil?\n @timestamps[object_id] = [@current_time]\n else\n @timestamps[object_id] << @current_time\n end\n end",
"def type_literal_generic_only_time(column)\n :time\n end",
"def set_signature_timestamp\n time = Time.now\n @signed_at = time\n @signed_at_timestamp = TimeFormatting.printable_time time\n @signed_at_timestamp_ms = TimeFormatting.ms_timestamp(time)\n set_document_tag :esigntimestamp, @signed_at_timestamp\n end",
"def timestamp=(timestamp)\n @timestamp = _check_timestamp(timestamp)\n end",
"def update_timestamp(*_args)\n current_time = current_time_from_proper_timezone\n\n write_attribute('updated_at', current_time) if respond_to?(:updated_at)\n write_attribute('updated_on', current_time) if respond_to?(:updated_on)\n end",
"def timestamp\n {\n \"u:Timestamp\" => {\n \"u:Created\" => now.xs_datetime,\n \"u:Expires\" => (now + 60 * 5).xs_datetime,\n :order! => [\"u:Created\", \"u:Expires\"],\n },\n :attributes! => { \"u:Timestamp\" => { \"u:Id\" => timestamp_id, \"xmlns:u\" => WSUNamespace } },\n }\n end",
"def timestamp\n timestamp_to_datetime(static_data(\"timestamp\"))\n end",
"def timestamps\n opts = @table.schema.opts\n if opts[ :mysql_timestamps ]\n # Unfortunately, MySQL allows only either automatic create timestamp\n # (DEFAULT CURRENT_TIMESTAMP) or automatic update timestamp (DEFAULT\n # CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP), but not both - one\n # has to be updated manually anyway. So we choose to have the update timestamp\n # automatically updated, and let the create one to be set manually.\n # Also, Sequel doesn't currently honor :on_update for column definitions,\n # so we have to use default literal to make it work. Sigh.\n timestamp :create_time, :null => false, :default => ( opts[ :zero_timestamps ] == false ? DEFAULT_TIME : ZERO_TIME )\n timestamp :update_time, :null => false, :default => Sequel.lit( 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP' )\n else\n Time :create_time\n Time :update_time\n end\n end",
"def timestamp\n _timestamp.as_time\n end",
"def literal_datetime(v)\n v.strftime(\"TIMESTAMP '%Y-%m-%d %H:%M:%S'\")\n end",
"def timestamp_attributes_for_update\n ['last_activity']\n end",
"def type_literal_generic_time(column)\n column[:only_time] ? :time : :datetime\n end",
"def timestamp\n @timestamp ||= Time.parse(@origdate)\n end",
"def datetime name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :datetime, description: description, mode: mode, policy_tags: policy_tags\n end",
"def schedule_new_record(row)\n ETL::Engine.logger.debug \"writing new record\"\n if scd_type == 2\n row[scd_effective_date_field] = @timestamp\n row[scd_end_date_field] = '9999-12-31 00:00:00'\n row[scd_latest_version_field] = true\n end\n buffer << row\n end",
"def timestamp?\n type == \"TIMESTAMP\"\n end",
"def filter_timestamps(schema)\n schema.reject { |item| ['created_at', 'updated_at'].include?(item[0]) }\n end",
"def timestamp\n first(:timestamp)\n end",
"def create_timestamp\n self.created_at = Time.now\n end",
"def create_timestamp\n self.created_at = Time.now\n end",
"def save_without_timestamping\n class << self\n def record_timestamps; false; end\n end\n \n save\n \n class << self\n remove_method :record_timestamps\n end\n end",
"def format(tag, time, record)\n @formatter.format(tag, time, record)\n end",
"def datetime_field(object_name, method, options = T.unsafe(nil)); end",
"def update_timestamp\n if themed\n themed.touch if !themed.new_record?\n themed.save\n end\n end",
"def timestamps\n attribute :created_at, :datetime, required: true\n attribute :updated_at, :datetime, required: true\n end",
"def time_record_params\n params.require(:time_record).permit(:user_id, :crossword_id, :record)\n end",
"def type_literal_generic_time(column)\n if column[:only_time]\n type_literal_generic_only_time(column)\n else\n type_literal_generic_datetime(column)\n end\n end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def timestamp(row)\n row[0].to_f\nend",
"def timestamps(opts={})\n @attrs[:created_at] = Attributes::DatetimeAttr.new(:created_at, opts)\n @attrs[:updated_at] = Attributes::DatetimeAttr.new(:updated_at, opts)\n nil\n end",
"def timestamp=(timestamp)\n @wsu_timestamp = timestamp\n end",
"def msfe_import_timestamps(opts,obj)\n\t\tobj.created_at = opts[\"created_at\"] if opts[\"created_at\"]\n\t\tobj.created_at = opts[:created_at] if opts[:created_at]\n\t\tobj.updated_at = opts[\"updated_at\"] ? opts[\"updated_at\"] : obj.created_at\n\t\tobj.updated_at = opts[:updated_at] ? opts[:updated_at] : obj.created_at\n\t\treturn obj\n\tend",
"def literal_time(v)\n v.strftime(TIMESTAMP_FORMAT)\n end",
"def timestamp # :nodoc:\n @timestamp.dup\n end",
"def coerce_timestamp(timestamp)\n # bug in JRuby prevents correcly parsing a BigDecimal fractional part, see https://github.com/elastic/logstash/issues/4565\n timestamp.is_a?(BigDecimal) ? LogStash::Timestamp.at(timestamp.to_i, timestamp.frac * 1000000) : LogStash::Timestamp.at(timestamp)\n end",
"def update_attribute_without_timestamps(*args)\n value = self.class.record_timestamps\n self.class.record_timestamps = false\n update_attribute(*args)\n ensure\n self.class.record_timestamps = value\n end",
"def timestamp\n @timestamp ||= Time.now.xs_datetime\n end",
"def save_without_timestamping\n class << self\n def record_timestamps; false; end\n end\n \n save\n \n class << self\n remove_method :record_timestamps\n end\n end",
"def format(tag, time, record)\n [tag, time, record].to_json + \"\\n\"\n ## Alternatively, use msgpack to serialize the object.\n # [tag, time, record].to_msgpack\n end",
"def parse_timestamps\n super\n @updated = updated.to_i if updated.is_a? String\n @updated = Time.at(updated) if updated\n end",
"def timestamps!\n before(:create) do\n self['updated_at'] = self['created_at'] = Time.now\n end \n before(:update) do \n self['updated_at'] = Time.now\n end\n end",
"def add(timeobj, val)\n \tsuper normalize_time_input(timeobj),val \n end"
] |
[
"0.61602205",
"0.58389205",
"0.57605076",
"0.57245356",
"0.5676347",
"0.5663652",
"0.5568894",
"0.5564433",
"0.556219",
"0.55579257",
"0.5527557",
"0.5512983",
"0.5490998",
"0.5455854",
"0.54368854",
"0.5419557",
"0.5390411",
"0.5357996",
"0.53446263",
"0.5336489",
"0.5306169",
"0.5290406",
"0.5285752",
"0.5255656",
"0.5251348",
"0.5248618",
"0.52351236",
"0.52254415",
"0.5218705",
"0.5218705",
"0.5214214",
"0.5203642",
"0.5169416",
"0.51635194",
"0.51293546",
"0.51287746",
"0.51287746",
"0.5127059",
"0.5123873",
"0.51181805",
"0.5112166",
"0.5108521",
"0.5081665",
"0.50714153",
"0.5062178",
"0.50612164",
"0.5056453",
"0.5055775",
"0.505517",
"0.5054747",
"0.50502676",
"0.5048081",
"0.5045182",
"0.50442976",
"0.50368094",
"0.5030489",
"0.5015004",
"0.4992115",
"0.49592182",
"0.4952975",
"0.4938889",
"0.4934197",
"0.49257225",
"0.49150386",
"0.4911843",
"0.4911193",
"0.49106213",
"0.48939973",
"0.48887748",
"0.4884248",
"0.48792905",
"0.48662212",
"0.48647994",
"0.48643237",
"0.48632863",
"0.48504424",
"0.48500368",
"0.48447973",
"0.48420894",
"0.48371786",
"0.48306328",
"0.48230568",
"0.48215634",
"0.48215634",
"0.48215634",
"0.48215634",
"0.4820393",
"0.4817482",
"0.48169816",
"0.48146665",
"0.48107758",
"0.48083743",
"0.48063418",
"0.47971752",
"0.4793386",
"0.47916472",
"0.47887403",
"0.47858602",
"0.47842595",
"0.4780517"
] |
0.66636753
|
0
|
Adds a time field to the nested schema of a record field. This can only be called on fields that are of type `RECORD`.
|
def time name, description: nil, mode: :nullable, policy_tags: nil
record_check!
add_field name, :time, description: description, mode: mode, policy_tags: policy_tags
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def time_field field = nil\n @time_field = field if field\n @time_field\n end",
"def type_literal_generic_only_time(column)\n :time\n end",
"def time_field(object_name, method, options = T.unsafe(nil)); end",
"def type_literal_generic_time(column)\n column[:only_time] ? :time : :datetime\n end",
"def apply_validations_for_time\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Time\") if value && (! value.kind_of?(Time))\n end\n end",
"def type_literal_generic_time(column)\n if column[:only_time]\n type_literal_generic_only_time(column)\n else\n type_literal_generic_datetime(column)\n end\n end",
"def time_for(record)\n return nil unless record\n case database_type\n when :mongo\n return Time.at(record['ts'].seconds)\n when :toku\n return record['ts']\n end\n end",
"def type\n 'Edm.Time'\n end",
"def add(timeobj, val)\n \tsuper normalize_time_input(timeobj),val \n end",
"def time_record_params\n params.require(:time_record).permit(\n :work_date,\n :work_time_pattern_id,\n :rest_time,\n :work_started_at,\n :work_ended_at,\n :description\n )\n end",
"def time_field(field, options={})\n options.reverse_merge!(:value => field_value(field) ? field_value(field).to_time.strftime(\"%H:%M\") : nil, :id => field_id(field))\n options[:class] = 'time_field'\n options.merge!(:class => field_error(field, options))\n @template.time_field_tag field_name(field), options\n end",
"def time_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end",
"def time=(value)\n @values['time'] = value\n end",
"def record_time(metric, time = nil, opts = {}, &block)\n opts, time = time, nil if Hash === time\n result = nil\n if time.nil?\n raise ArgumentError, \"You should pass a block if time is not given\" unless block_given?\n time = Benchmark.measure do\n result = block.call\n end.real\n end\n record_internal({\"#{metric}.time\" => (time * 1000).round}, opts)\n result\n end",
"def update_time(time, uuid)\n if time.key?('duration')\n unless time['duration'].is_a? Integer\n duration = duration_to_seconds(time['duration'])\n time['duration'] = duration\n\n # Duration at this point contains an error_msg if not an int\n return duration unless time['duration'].is_a? Integer\n end\n\n if time['duration'] < 0\n return Hash[@error => 'time object: duration cannot be negative']\n end\n\n end\n create_or_update(time, uuid, 'time', 'times', false)\n end",
"def bound_time_field(method, attrs = {})\n update_bound_controls(method, attrs, 'time')\n attrs[:value] = @obj.send(method)\n attrs[:name] ||= control_name(method)\n unbound_time_field(attrs)\n end",
"def create_time(time)\n unless time['duration'].is_a? Integer\n duration = duration_to_seconds(time['duration'])\n time['duration'] = duration\n\n # Duration at this point contains an error_msg if it's not an int\n return duration unless time['duration'].is_a? Integer\n end\n\n if time['duration'] < 0\n return Hash[@error => 'time object: duration cannot be negative']\n end\n\n create_or_update(time, nil, 'time', 'times')\n end",
"def timestamp name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :timestamp, description: description, mode: mode, policy_tags: policy_tags\n end",
"def append_time(value)\n time = case value\n when Time\n value\n else\n begin\n Time.parse(value)\n rescue\n raise(ArgumentError, \"Cannot parse argument `#{value}` to Time.\")\n end\n end\n\n _append_time(time.hour, time.min, time.sec, time.usec)\n end",
"def recordTime(tname, bname, tstart, tend, tags)\n # Check that the parent node is in the tree\n raise \"Brick node: #{bname} does not exist.\" unless @tree.has_key?(bname)\n\n # Create a time record and add it to the timeWorked array\n @tree[bname]['timeWorked'].push(BrickTimeRecord.new(tname, tstart, tend, tags))\n end",
"def time_record_params\n params.require(:time_record).permit(:user_id, :crossword_id, :record)\n end",
"def time_only(person_or_type = nil)\n time_detail(:time_only => true, :audience => person_or_type)\n end",
"def bson_type\n ::Time::BSON_TYPE\n end",
"def add_section_time\n orderDate = self.orderDate\n sectionTime = self.section.startTime\n self.orderDate = DateTime.new(orderDate.year, orderDate.month, orderDate.day, sectionTime.hour, sectionTime.min)\n end",
"def gtfs_time_setter(attribute_sym, val)\n if val.is_a? String\n t = Time.new_from_gtfs(val)\n if t.nil?\n errors.add(attribute_sym, :invalid)\n write_attribute(attribute_sym, val)\n return false\n end\n write_attribute(attribute_sym, t)\n return\n end\n write_attribute(attribute_sym, val)\n end",
"def time=(new_time)\n @time = new_time\n end",
"def date_field_with_time(actual_date, object_name, method, options={})\n actual_date = Time.now if actual_date == nil\n if actual_date != nil\n hash = separate_date_time(actual_date)\n date_part = date_field(object_name, method+'_date', :size => 15, :value => hash[:date])\n time_part = text_field object_name, method+'_time', :size => 4,:value => hash[:time]\n else\n date_part= \"* SHOULD BE DATE STUFF HERE * \"\n time_part= \"* SHOULD BE TIME STUFF HERE * \"\n end\n return date_part+' ' + time_part\n end",
"def set_timepart\n\t\t\tlogger.debug \"DBG_20130612_1345 after_initialize\"\n\t\t\tif self.time.nil?\n\t\t\t\tself.timepart = Time.local(2000, 1, 1).strftime(\"%I:%M %p\")\n\t\t\telse\n\t\t\t\tself.timepart = self.time.strftime(\"%I:%M %p\")\n\t\t\tend\n\t\trescue ActiveRecord::MissingAttributeError\n\t\tend",
"def time=(value)\n @time = value\n end",
"def modify_time=(time)\n @modify_time = time\n update_times\n end",
"def normalize_time\n if time.present?\n Time::DATE_FORMATS[:ms] = \"%M:%S\"\n self.time = \"0:#{time.to_formatted_s(:ms)}\".to_time\n end\n end",
"def create_time=(time)\n @create_time = time\n update_times\n end",
"def time_field_tag(name, value = nil, options = {})\n text_field_tag(name, value, options.merge(type: :time))\n end",
"def _record_end_time(records)\n end_time = DateTime.now\n unless records.empty?\n records.each do |record|\n record.end_at = end_time\n record.updated_at = end_time\n record.total_time += record.time_diff\n end\n end\n end",
"def test_time_truncate_usec_on_assigment_precision_3\n time = Time.parse('2018-12-31T23:59:21.341867')\n record = DateAndTimeTypes.new(my_time_one: time)\n\n assert_equal 23, record.my_time_one.hour\n assert_equal 59, record.my_time_one.min\n assert_equal 21, record.my_time_one.sec\n assert_equal 341_000, record.my_time_one.usec\n assert_equal 341_000_000, record.my_time_one.nsec\n end",
"def time_tag(date_or_time, *args, &block); end",
"def time_type=(new_time_type)\n write_attribute(:time_type, new_time_type)\n swap_start_finish\n end",
"def add_to_date_time_value(date_time_value) #:nodoc:\n raise ArgumentError.new(\"Cannot add #{date_time_value} to #{self}\")\n end",
"def time(value)\n _parse_time(value)\n end",
"def format(tag, time, record)\n @formatter.format(tag, time, record)\n end",
"def datetime name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :datetime, description: description, mode: mode, policy_tags: policy_tags\n end",
"def time_at_column(record)\n if not record.time_at.nil?\n if record.is_a?(Client)\n time_ago_in_words(Time.at(record.time_at.to_f)) + \" ago\"\n else\n time = Time.at(record.time_at.to_f)\n return time.strftime(\"%b %d %H:%M:%S.\") + record.time_at.frac.to_s.sub!('0.','') + time.strftime(\" %Z %Y\")\n end\n end\n end",
"def datetime_field(object_name, method, options = T.unsafe(nil)); end",
"def timeRecordsForDate(brick, date)\n end",
"def set_time_as_datetime(options)\n options[:type] = DateTime if options[:type] == Time\n end",
"def test_time_truncate_usec_on_assigment_default_precision\n time = Time.parse('2018-12-31T23:59:21.341867923')\n record = DateAndTimeTypes.new(my_time: time)\n\n assert_equal 23, record.my_time.hour\n assert_equal 59, record.my_time.min\n assert_equal 21, record.my_time.sec\n assert_equal 341_867, record.my_time.usec\n assert_equal 341_867_000, record.my_time.nsec\n end",
"def append_timestamp(value)\n time = case value\n when Time\n value\n when Date\n value.to_time\n else\n begin\n Time.parse(value)\n rescue\n raise(ArgumentError, \"Cannot parse argument `#{value}` to Time or Date.\")\n end\n end\n\n _append_timestamp(time.year, time.month, time.day, time.hour, time.min, time.sec, time.nsec / 1000)\n end",
"def timestamp_field=(_field_name)\n raise Error, E_TIMESTAMP_FIELD_CONFIG\n end",
"def mark_time\n @time ||= SCORE.time || \"4/4\"\n \"\\t\\\\time #{@time}\" # warning: pas de guillemets\n end",
"def add_time(safebox_guid, add_time_params)\n handle_error { sendsecure_connection.patch(\"api/v2/safeboxes/#{safebox_guid}/add_time.json\", add_time_params) }\n end",
"def set_time(time)\n @time = time.getutc\n return self\n end",
"def __mongoize_time__\n self\n end",
"def time_field(method, *args)\n db_type = type_from_database(method)\n\n # Note that if the database type is string or text, we still use a\n # time_select, as we're assuming it is then a serialized object.\n unless db_type.nil? or db_type =~ /^(?:string|text)$/\n self.send \"#{db_type}_select\", method, *args\n else\n self.time_select method, *args\n end\n end",
"def time_wrap(obj)\n obj.kind_of?(String) ? Time.parse(obj) : obj\n end",
"def time_based_attribute=(value)\n @time_based_attribute = value\n end",
"def type_literal_generic_datetime(column)\n :timestamp\n end",
"def add_time(hour: nil, proj: nil, date: nil, custom_num: nil, fill_value: nil, note: nil, costcodes: nil)\n # check if day already found\n day = self.days.where(:date => date).first\n if day\n result = day.add_time(hour: hour, proj: proj, date: date, custom_num: custom_num, fill_value: fill_value, note: note, cost_codes: costcodes)\n else\n day = Day.new\n result = day.add_time(hour: hour, proj: proj, date: date, custom_num: custom_num, fill_value: fill_value, note: note, cost_codes: costcodes)\n self.days << result[:day]\n end\n refresh_project_total(result: result, proj: proj)\n save\n publish(:add_time_successful, result)\n end",
"def addtime\n \n end",
"def has_times(*attrs)\n options = attrs.extract_options!\n attrs.each do |attr|\n attr_reader attr\n define_reader_with_options(attr,options)\n define_method(\"#{attr.to_s}=\") do |val|\n val = val.to_time unless val.nil?\n instance_variable_set(\"@#{attr}\", val)\n attributes[attr] = val\n val\n end\n end\n end",
"def time_tag(date_or_time, *args, &block)\n options = args.extract_options!\n format = options.delete(:format) || :long\n content = args.first || I18n.l(date_or_time, :format => format)\n datetime = date_or_time.acts_like?(:time) ? date_or_time.xmlschema : date_or_time.iso8601\n\n content_tag(:time, content, options.reverse_merge(:datetime => datetime), &block)\n end",
"def create\n @time_record = TimeRecord.new(params[:time_record])\n @time_record.value = (@time_record.ended_at - @time_record.started_at) / 1.hour\n @time_record.recorded_on = @time_record.started_at.to_date\n\n respond_to do |format|\n if @time_record.save\n format.html { redirect_to time_records_path, notice: 'Time record was successfully created.' }\n format.json { render json: @time_record.to_json, status: :created, location: @time_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_record.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def set_deleted_timestamp(time=nil)\n field = model.deleted_timestamp_field\n meth = :\"#{field}=\"\n if respond_to?(field) && respond_to?(meth) && (model.deleted_timestamp_overwrite? || send(field).nil?)\n self.send(meth, time||=Sequel.datetime_class.now)\n self.save\n end\n end",
"def to_doc\n # doc now has all the fields of our model instance, we \n # just add another field to it:\n doc = super\n # add a field containing the current time\n doc[:added] = Time.now.to_i.to_s\n return doc\n end",
"def date_field_with_time_allowing_blank(date, object_name, method, options={})\n hash = { :date => '', :time => '' } \n \n\thash = separate_date_time(date) if date != nil\n\t\n date_part = date_field(object_name, method+'_date', :size => 15, :value => hash[:date])\n time_part = text_field object_name, method+'_time', :size => 4, :value => hash[:time]\n \n return date_part+' ' + time_part\n end",
"def set_experiment_created_at(experiment, time)\n record = VanityExperiment.find_by_experiment_id(experiment.to_s) ||\n VanityExperiment.new(experiment_id: experiment.to_s)\n record.created_at ||= time\n record.save\n end",
"def time_s=(time)\n self.time = s_to_time(time)\n end",
"def date_time=(time)\n Jhead.call(\"-ts\" << time.strftime(\"%Y:%m:%d-%H:%M:%S\"), @match, @pattern)\n end",
"def set_Time(value)\n set_input(\"Time\", value)\n end",
"def time_class; end",
"def end_time=(val)\n write_attribute :end_time, val\n end",
"def format(tag, time, record)\n newrecord = {}\n\n begin\n if record['severity']\n newrecord['severity'] = Integer(record['severity'])\n else\n newrecord['severity'] = @severity\n end\n rescue\n newrecord['severity'] = @severity\n end\n\n newrecord['type'] = tag.to_s\n newrecord['agent_time'] = time.to_s\n newrecord['manager'] = @manager\n newrecord['class'] = @source\n newrecord['source'] = @hostname\n newrecord['description'] = record['message']\n newrecord['custom_info'] = record\n\n newrecord.to_msgpack\n end",
"def add(element, new_time)\n @add_set[element] = new_time.to_i\n self\n end",
"def apply_validations_for_datetime\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Time or DateTime\") if value && (! value.kind_of?(Time)) && (value.class.name != 'DateTime')\n end\n end",
"def set_time_record\n @time_record = TimeRecord.find(params[:id])\n end",
"def modify_time(); @modify_time ||= Time.now; end",
"def as_time( d = nil )\n d = (d || self)\n return '' unless [Time, DateTime].include? d.class\n format = 'time_short'\n I18n.l d, :format => I18n.t( 'time.formats.' + format )\n end",
"def add_field(name, type, options={})\n name = name.to_s\n \n # preconditions\n raise InvalidModelField.new(\"Duplicate field name\") if record_fields.key?(name)\n raise InvalidModelField.new(\"Type must be a known yodel field type\") unless valid_type?(type)\n raise InvalidModelField.new(\"Field name cannot start with an underscore\") if name.start_with?('_')\n \n # add the field to the model and subclasses\n field_type = Field.field_from_type(type.to_s)\n field = field_type.new(name, deep_stringify_keys(options.merge(type: type.to_s)))\n RecordIndex.add_index_for_field(self, field) if field.index?\n record_fields[name] = field\n end",
"def _record_start_time(records)\n start_time = DateTime.now\n unless records.empty?\n records.each do |record|\n record.start_at = start_time\n record.end_at = nil\n record.updated_at = start_time\n end\n end\n end",
"def time_constraint=(value)\n @time_constraint = value\n end",
"def end_time(person_or_type = nil)\n attribute_for_audience_with_generic(:end_time, person_or_type)\n end",
"def transform_time fields,row\n @time_fields.each do |f|\n v = fields[f]\n next unless v\n ## change time field so it looks like standard\n # Y Mon Day H Mn Sec\n n = 4 + 2 + 2 + 2 + 2 + 2 - 1 # arr start at 0 =)\n row[v] = row[v].gsub(\"+01\",\"\")[0..n]\n transform_time_values row,v\n end\n return row\n end",
"def add_copied_at_field\n logger.info \"Adding #{name}._copied_at audit field...\"\n db.query(\"ALTER TABLE #{audit} ADD `_copied_at` TIMESTAMP NULL\")\n end",
"def add(node, timing)\n if @nodedb.key? node\n # We do not merge because we don't have\n # timing information of the sub-nodes. That is\n # recorded in separate records.\n @nodedb[node].data << timing\n else\n metadata = NodeMetaData.new\n metadata << timing\n node.data = metadata\n @nodedb[node] = node\n\n merge_graph node\n end\n end",
"def add_dynamic_timestamp(text)\nend",
"def set_update_time(time = last_modified_date)\n self.last_updated__c = ((last_updated__c and time < last_updated__c) ? last_updated__c : time) # fails migration ?\n# self.last_updated__c = self.last_modified_date # for migration\n end",
"def time_tag(date_or_time, *args, &block)\n options = args.extract_options!\n format = options.delete(:format) || :long\n content = args.first || I18n.l(date_or_time, format: format)\n\n content_tag(\"time\", content, options.reverse_merge(datetime: date_or_time.iso8601), &block)\n end",
"def add_time(safebox, value, time_unit)\n raise SendSecureException.new(\"SafeBox GUID cannot be null\") if safebox.guid == nil\n raise SendSecureException.new(\"Invalid time unit\") unless SafeBox::TIME_UNIT.values.include?(time_unit)\n add_time_params = { \"safebox\": { \"add_time_value\": value, \"add_time_unit\": time_unit }}.to_json\n result = @json_client.add_time(safebox.guid, add_time_params)\n safebox.expiration = result.delete(\"new_expiration\")\n result\n end",
"def literal_time(v)\n v.strftime(\"TIMESTAMP '%Y-%m-%d %H:%M:%S'\")\n end",
"def time\n Types::Time.deserialize(@time)\n end",
"def test_rfc6351_value_time_with_second\n assert(true)\n\n # According to the Relax NG Schema, there is a conflict between\n # value-date and value-time. The --01 syntax can only match a\n # value-date because of the higher priority set in\n # value-date-and-or-time. So we basically skip this test.\n #\n # xml = <<XML\n # <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n # <vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n # <vcard>\n # <bday>\n # <date-and-or-time>--01</date-and-or-time>\n # </bday>\n # </vcard>\n # </vcards>\n # XML\n # vobj = <<VOBJ\n # BEGIN:VCARD\n # VERSION:4.0\n # BDAY:--01\n # END:VCARD\n # VOBJ\n # assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end",
"def setTime(time)\n\t\t@time = time\n\tend",
"def relative_time_element(time)\n time_element(time, 'js-relative-time')\n end",
"def insert_time_entry cat_id, description ,time=nil\n entry = DB::Time_entries.find_by(finishtime: nil)\n entry.finishtime=time\n entry.save if DB::Time_entries.create(category_id: cat_id, name: description, starttime: time)\n end",
"def apply_time_safety(span = 2.minutes)\n if self.new_record?\n puts \"applying time safety with #{span}\"\n self.start += span\n self.end -= span\n end\n end",
"def add_time\n if (date.hour == 0 or date.hour == 12) and date.min == 0 and date.sec == 0\n self.date = date + id \n end\n end",
"def aTime=(tim)\n @dirty = true\n time, day = rubyToDosTime(tim)\n @dir_ent['atime_day'] = day\n end",
"def define_write_method_for_dates_and_times(attr_name, type)\n method_body = <<-EOV\n def #{attr_name}=(value)\n old = read_attribute('#{attr_name}') if defined?(ActiveRecord::Dirty)\n new = self.class.parse_date_time(value, :#{type})\n @attributes_cache['#{attr_name}'] = new\n if defined?(ActiveRecord::Dirty) && !changed_attributes.include?('#{attr_name}') && old != new\n changed_attributes['#{attr_name}'] = (old.duplicable? ? old.clone : old)\n end\n @attributes['#{attr_name}'] = value\n end\n EOV\n evaluate_attribute_method attr_name, method_body\n end",
"def addTime(hour, min, sec)\n addSec(sec) ;\n addMin(min) ;\n addHour(hour) ;\n end",
"def format(tag, time, record)\n [tag, time, record].to_json + \"\\n\"\n ## Alternatively, use msgpack to serialize the object.\n # [tag, time, record].to_msgpack\n end",
"def record_tweet(tweet_name, time)\n @tweets[tweet_name] = [] unless @tweets.key?(tweet_name)\n @tweets[tweet_name].push(time)\n end"
] |
[
"0.67043835",
"0.61925834",
"0.60828453",
"0.6065578",
"0.60606164",
"0.594004",
"0.58431935",
"0.5765489",
"0.57491165",
"0.57446575",
"0.572281",
"0.5712897",
"0.5704962",
"0.56798023",
"0.5677857",
"0.5674365",
"0.566035",
"0.5653106",
"0.56337565",
"0.55973554",
"0.5563603",
"0.54750365",
"0.540919",
"0.5401165",
"0.53879124",
"0.53505313",
"0.5323603",
"0.5308563",
"0.5253655",
"0.5253541",
"0.52442133",
"0.5233741",
"0.5232249",
"0.5226967",
"0.52258795",
"0.52107096",
"0.5206645",
"0.5186656",
"0.51785547",
"0.5174029",
"0.5164242",
"0.5160443",
"0.5157436",
"0.515652",
"0.5156064",
"0.5147974",
"0.5128912",
"0.51268023",
"0.5101559",
"0.50964195",
"0.5088553",
"0.5085883",
"0.50825626",
"0.50687397",
"0.5066256",
"0.5059243",
"0.5056559",
"0.5055513",
"0.5051113",
"0.5050805",
"0.5044974",
"0.5027297",
"0.5023431",
"0.50220394",
"0.5016541",
"0.5002292",
"0.50000966",
"0.49882463",
"0.49850047",
"0.49788737",
"0.49765614",
"0.4974004",
"0.49603313",
"0.49601594",
"0.49536577",
"0.49488094",
"0.49418467",
"0.4941841",
"0.49320683",
"0.49284455",
"0.4923563",
"0.49233994",
"0.49117294",
"0.4906325",
"0.4902936",
"0.48998708",
"0.48949718",
"0.48926985",
"0.48803717",
"0.4877447",
"0.4875598",
"0.48731667",
"0.48678774",
"0.48677993",
"0.4858154",
"0.48571",
"0.4854199",
"0.48518047",
"0.4849975",
"0.48487696"
] |
0.6748423
|
0
|
Adds a datetime field to the nested schema of a record field. This can only be called on fields that are of type `RECORD`.
|
def datetime name, description: nil, mode: :nullable, policy_tags: nil
record_check!
add_field name, :datetime, description: description, mode: mode, policy_tags: policy_tags
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def datetime_field(object_name, method, options = T.unsafe(nil)); end",
"def to_doc\n # doc now has all the fields of our model instance, we \n # just add another field to it:\n doc = super\n # add a field containing the current time\n doc[:added] = Time.now.to_i.to_s\n return doc\n end",
"def type_literal_generic_datetime(column)\n :datetime\n end",
"def apply_validations_for_datetime\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Time or DateTime\") if value && (! value.kind_of?(Time)) && (value.class.name != 'DateTime')\n end\n end",
"def time_field field = nil\n @time_field = field if field\n @time_field\n end",
"def type_literal_generic_datetime(column)\n :timestamp\n end",
"def visit_date_time(binding_type)\n dt_str = DateTimeConverter.convert_from_datetime(input)\n self.result = binding_type.definition.new_value(dt_str)\n end",
"def datetime_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end",
"def add_copied_at_field\n logger.info \"Adding #{name}._copied_at audit field...\"\n db.query(\"ALTER TABLE #{audit} ADD `_copied_at` TIMESTAMP NULL\")\n end",
"def bound_datetime_field(method, attrs = {})\n update_bound_controls(method, attrs, 'datetime')\n attrs[:value] = @obj.send(method)\n attrs[:name] ||= control_name(method)\n unbound_datetime_field(attrs)\n end",
"def subtype\n self.datetime_type\n end",
"def convert_string_to_datetime(record)\n record['sf_lastmodifieddate'] = record['sf_lastmodifieddate'].to_datetime if record['sf_lastmodifieddate']\n record['sf_createddate'] = record['sf_createddate'].to_datetime if record['sf_createddate']\n record['sf_lastactivitydate'] = record['sf_lastactivitydate'].to_date if record['sf_lastactivitydate']\n record\n end",
"def datetime(name, option={})\n option[:is_a] = :datetime\n register_attribute_member(name, option)\n define_attribute_accessor(name, option)\n define_validations(name, option)\n end",
"def datetime_local_field(object_name, method, options = T.unsafe(nil)); end",
"def timestamp name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :timestamp, description: description, mode: mode, policy_tags: policy_tags\n end",
"def datetime_attr name, options = {}\n add_attribute(DateTimeAttribute.new(name, options))\n end",
"def timestamp_field=(_field_name)\n raise Error, E_TIMESTAMP_FIELD_CONFIG\n end",
"def parse_date_time\n self.each do |review|\n review['date_created'] = DateTime.parse(review['date_created'])\n end\n end",
"def set_rails_dt_attributes!(meth,dt)\n if dt && meth.match(/_(?:on|d)$/)\n write_attribute meth, dt.to_date\n elsif dt && meth.match(/_(?:at|dt)$/)\n write_attribute meth, dt.to_datetime\n else\n write_attribute meth, dt\n end\n end",
"def add_to_date_time_value(date_time_value) #:nodoc:\n raise ArgumentError.new(\"Cannot add #{date_time_value} to #{self}\")\n end",
"def datetime(key, opts={})\n @attrs[key.to_sym] = Attributes::DatetimeAttr.new(key, opts)\n end",
"def apply_devise_schema(name, type, options={})\n # type = Time if type == DateTime\n # field name, { :type => type }.merge!(options)\n end",
"def add(timeobj, val)\n \tsuper normalize_time_input(timeobj),val \n end",
"def apply_devise_schema(name, type, options={})\n type = Time if type == DateTime\n field name, { :type => type }.merge(options)\n end",
"def date_field(object_name, method, options = T.unsafe(nil)); end",
"def add_section_time\n orderDate = self.orderDate\n sectionTime = self.section.startTime\n self.orderDate = DateTime.new(orderDate.year, orderDate.month, orderDate.day, sectionTime.hour, sectionTime.min)\n end",
"def datetime(key, options = {})\n before_all(key, options)\n begin; store(key, ->(item){DateTime.parse(item.to_s)} , options); rescue; raise_type_error(key, \"DateTime\"); end\n end",
"def type_literal_generic_time(column)\n column[:only_time] ? :time : :datetime\n end",
"def time_record_params\n params.require(:time_record).permit(\n :work_date,\n :work_time_pattern_id,\n :rest_time,\n :work_started_at,\n :work_ended_at,\n :description\n )\n end",
"def time_field(object_name, method, options = T.unsafe(nil)); end",
"def set_auto_date_field(field_name)\n self.send(\"#{field_name}=\", Time.now) if self.respond_to? field_name\n end",
"def format_proper_date(key, value)\n return unless key == 'layer_modified_dt'\n\n metadata[key] = Time.parse(value).utc.iso8601\n end",
"def datetime_local_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end",
"def created_at; @doc['created_at']; end",
"def set_deleted_timestamp(time=nil)\n field = model.deleted_timestamp_field\n meth = :\"#{field}=\"\n if respond_to?(field) && respond_to?(meth) && (model.deleted_timestamp_overwrite? || send(field).nil?)\n self.send(meth, time||=Sequel.datetime_class.now)\n self.save\n end\n end",
"def date_field_with_time(actual_date, object_name, method, options={})\n actual_date = Time.now if actual_date == nil\n if actual_date != nil\n hash = separate_date_time(actual_date)\n date_part = date_field(object_name, method+'_date', :size => 15, :value => hash[:date])\n time_part = text_field object_name, method+'_time', :size => 4,:value => hash[:time]\n else\n date_part= \"* SHOULD BE DATE STUFF HERE * \"\n time_part= \"* SHOULD BE TIME STUFF HERE * \"\n end\n return date_part+' ' + time_part\n end",
"def type_cast_for_schema(value) # :nodoc:\n case value\n when 'toDate(now()', 'CAST(now() AS Date)'\n 'now()'.inspect\n else\n value.inspect\n end\n end",
"def set_time_as_datetime(options)\n options[:type] = DateTime if options[:type] == Time\n end",
"def time_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end",
"def time name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :time, description: description, mode: mode, policy_tags: policy_tags\n end",
"def type\n 'Edm.DateTime'\n end",
"def set_record_created_at\n self.record_created_at = Time.current.utc.iso8601(3)\n end",
"def initialize_to_correct_date_type(field_info, field)\n initialize_integer(field_info, field)\n initialize_float(field_info, field)\n end",
"def define_write_method_for_dates_and_times(attr_name, type)\n method_body = <<-EOV\n def #{attr_name}=(value)\n old = read_attribute('#{attr_name}') if defined?(ActiveRecord::Dirty)\n new = self.class.parse_date_time(value, :#{type})\n @attributes_cache['#{attr_name}'] = new\n if defined?(ActiveRecord::Dirty) && !changed_attributes.include?('#{attr_name}') && old != new\n changed_attributes['#{attr_name}'] = (old.duplicable? ? old.clone : old)\n end\n @attributes['#{attr_name}'] = value\n end\n EOV\n evaluate_attribute_method attr_name, method_body\n end",
"def issue_date= datetime\n write_attribute(:issue_date, User.current.system_time(datetime))\n end",
"def date_nested\n self[Solrizer.solr_name('date_nested', :displayable)]\n end",
"def record_update_time(record)\n # HACK: Models like PersonAddress are missing the preferred\n # `date_changed` field thus we are falling back to date_created\n if immutable_model?(record, true)\n return record_date_voided(record) || record.date_created\n end\n\n if record.class == DrugOrder\n order = Order.unscoped.find(record.order_id)\n return order.date_voided || order.date_created\n end\n\n if record.class == ProgramWorkflowState || record.class == ProgramWorkflow\n return record.date_changed || record.date_created\n end\n\n record_date_voided(record) || record.date_changed || record.date_created\n end",
"def type_literal_generic_only_time(column)\n :time\n end",
"def _record_start_time(records)\n start_time = DateTime.now\n unless records.empty?\n records.each do |record|\n record.start_at = start_time\n record.end_at = nil\n record.updated_at = start_time\n end\n end\n end",
"def upload_date_time=(value)\n @upload_date_time = value\n end",
"def time_record_params\n params.require(:time_record).permit(:user_id, :crossword_id, :record)\n end",
"def record_timestamps\n doc \"When this record has been created.\"\n datetime \"created_at\"\n doc \"When this record has been updated lastly.\"\n datetime \"updated_at\"\n end",
"def update_timestamp(work)\n # these timestamps are the Hyrax managed fields, not rails timestamps\n if work.date_uploaded\n work.date_modified = Time.current\n else\n work.date_uploaded = Time.current\n end\n end",
"def apply_validations_for_time\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Time\") if value && (! value.kind_of?(Time))\n end\n end",
"def timeRecordsForDate(brick, date)\n end",
"def type_literal_generic_date(column)\n :date\n end",
"def to_datetime()\n #This is a stub, used for indexing\n end",
"def date name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :date, description: description, mode: mode, policy_tags: policy_tags\n end",
"def typecast_value_datetime(value)\n if convert_infinite_timestamps\n case value\n when *INFINITE_DATETIME_VALUES\n value\n else\n super\n end\n else\n super\n end\n end",
"def create(record)\n now = Time.now\n record['created_at'] ||= now\n record['updated_at'] ||= now\n collection.insert(record)\n end",
"def freeze_rec( d )\n self.freeze_date = d if freeze_date.nil?\n end",
"def generic_datetime_field(name, attrs)\n description = attrs.delete(:desc)\n\n <<-HTML\n <span class=\"field #{name}\">\n #{unbound_text_field(attrs)}\n <label class=\"description\" for=\"#{attrs[:id]}\">\n #{description}\n </label>\n </span>\n HTML\n end",
"def datetime\n new(:datetime, DATE_TIME_REGEXP, lambda { |raw| Time.parse(raw).to_datetime })\n end",
"def pay_date= datetime\n if datetime\n datetime = User.current.system_time(datetime)\n end\n write_attribute(:pay_date, datetime)\n end",
"def type_literal_generic_time(column)\n if column[:only_time]\n type_literal_generic_only_time(column)\n else\n type_literal_generic_datetime(column)\n end\n end",
"def datetime_local_field(name, *args)\n options = args.extract_options!.symbolize_keys!\n prepare_options(name, options)\n options[:input_group][:data].merge!({'date-extra-formats' => [BootstrapForm::DATE_FORMAT_JS+\"THH:mm\"+(options[:include_seconds] ? ':ss' : '')]}.merge(options[:data] || {}))\n append_min_max(BootstrapForm::DATE_FORMAT_RUBY+\"T%T\", options)\n args << options\n super\n end",
"def add_field!(field_name, value = T.unsafe(nil)); end",
"def type\n 'Edm.Time'\n end",
"def test_datetime2_truncate_usec_on_assigment_default_precision\n time = Time.parse('2018-12-31T23:59:21.341867923')\n record = DateTime2Types.new(my_datetime: time)\n\n assert_equal 23, record.my_datetime.hour\n assert_equal 59, record.my_datetime.min\n assert_equal 21, record.my_datetime.sec\n assert_equal 341_867, record.my_datetime.usec\n assert_equal 341_867_000, record.my_datetime.nsec\n end",
"def test_send_rfc3339_date_time_in_nested_model()\n # Parameters for the API call\n body = SendRfc339DateTime.from_hash(APIHelper.json_deserialize(\n '{\"dateTime\":{\"dateTime\":\"1994-02-13T14:01:54.9571247Z\"}}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.send_rfc339_date_time_in_nested_models(body)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def test_send_rfc3339_date_time_in_nested_model()\n # Parameters for the API call\n body = SendRfc339DateTime.from_hash(APIHelper.json_deserialize(\n '{\"dateTime\":{\"dateTime\":\"1994-02-13T14:01:54.9571247Z\"}}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.send_rfc339_date_time_in_nested_models(body)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def create_date_field(task, relative_date)\n if task.has_key?('days')\n task['date'] = relative_date + task['days'].to_i\n end\n\n if task.has_key?('subtasks') && task['subtasks'].any?\n task['subtasks'].each { |subtask|\n create_date_field(subtask, relative_date)\n }\n end\nend",
"def data_upload_date\n formatted_timestamp(data['modifyDate'])\n end",
"def schedule_new_record(row)\n ETL::Engine.logger.debug \"writing new record\"\n if scd_type == 2\n row[scd_effective_date_field] = @timestamp\n row[scd_end_date_field] = '9999-12-31 00:00:00'\n row[scd_latest_version_field] = true\n end\n buffer << row\n end",
"def record_timestamps\n false\n end",
"def add_field! key, initial = nil, opts = {}, &block\n key = @schema.validate_new_key! key\n @values[key] = initial\n @schema.add_field! key, initial, opts, &block\n self\n end",
"def typecast_value_datetime(value)\n Sequel.typecast_to_application_timestamp(value)\n end",
"def created_at\n with_type!(Fixnum) { attribute_from_model(:created_at) || attribute_from_model(:created) }\n end",
"def test_format_strftime_record\n d = create_driver %[\n tag #{@tag}\n key #{@key}\n format %d/%b/%Y:%H:%M:%S %z\n source record\n standard localtime\n ]\n\n d.run do\n d.emit({\"a\"=>1}, Time.parse(\"1990-04-14 09:45:15 UTC\").to_i)\n end\n\n record = d.emits.first.last\n assert_equal \"14/Apr/1990:11:45:15 +0200\", record[@key]\n end",
"def add_field(name, type, options={})\n name = name.to_s\n \n # preconditions\n raise InvalidModelField.new(\"Duplicate field name\") if record_fields.key?(name)\n raise InvalidModelField.new(\"Type must be a known yodel field type\") unless valid_type?(type)\n raise InvalidModelField.new(\"Field name cannot start with an underscore\") if name.start_with?('_')\n \n # add the field to the model and subclasses\n field_type = Field.field_from_type(type.to_s)\n field = field_type.new(name, deep_stringify_keys(options.merge(type: type.to_s)))\n RecordIndex.add_index_for_field(self, field) if field.index?\n record_fields[name] = field\n end",
"def set_auto_date_field(field_name)\n method = \"#{field_name}=\"\n self.send(method, Time.now) if self.respond_to?(method)\n end",
"def updated(date_or_time = T.unsafe(nil)); end",
"def literal_datetime(v)\n v.strftime(\"TIMESTAMP '%Y-%m-%d %H:%M:%S'\")\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 test_datetime2_truncate_usec_on_assigment_precision_0\n time = Time.parse('2018-12-31T23:59:21.341867')\n record = DateTime2Types.new(my_datetime_alt: time)\n\n assert_equal 23, record.my_datetime_alt.hour\n assert_equal 59, record.my_datetime_alt.min\n assert_equal 21, record.my_datetime_alt.sec\n assert_equal 0, record.my_datetime_alt.usec\n assert_equal 0, record.my_datetime_alt.nsec\n end",
"def parse_datetime_date(type, resource)\n year = resource[\"#{type}(1i)\"].to_i\n month = resource[\"#{type}(2i)\"].to_i\n day = resource[\"#{type}(3i)\"].to_i\n hour = resource[\"#{type}(4i)\"].to_i\n minute = resource[\"#{type}(5i)\"].to_i\n DateTime.new(year, month, day, hour, minute)\n end",
"def add_timestamp\n @item.timestamp = @bib.fetched.to_s if @bib.fetched\n end",
"def bound_time_field(method, attrs = {})\n update_bound_controls(method, attrs, 'time')\n attrs[:value] = @obj.send(method)\n attrs[:name] ||= control_name(method)\n unbound_time_field(attrs)\n end",
"def date_field_with_time_allowing_blank(date, object_name, method, options={})\n hash = { :date => '', :time => '' } \n \n\thash = separate_date_time(date) if date != nil\n\t\n date_part = date_field(object_name, method+'_date', :size => 15, :value => hash[:date])\n time_part = text_field object_name, method+'_time', :size => 4, :value => hash[:time]\n \n return date_part+' ' + time_part\n end",
"def initialize_fields_by_type\n database_field_names.each do |field|\n field_info = self.class.get_table_info.select {|hash| hash[\"name\"] == field}.first\n initialize_to_correct_date_type(field_info, field) \n end\n end",
"def convert_uploadDate(v, opts = {})\n v.is_a?(Time) ? v : v['$date'] ? Time.parse(v['$date']) : upload_date\n end",
"def touch_with_version(name = nil)\n unless @record.persisted?\n raise ::ActiveRecord::ActiveRecordError, \"can not touch on a new record object\"\n end\n attributes = @record.send :timestamp_attributes_for_update_in_model\n attributes << name if name\n current_time = @record.send :current_time_from_proper_timezone\n attributes.each { |column|\n @record.send(:write_attribute, column, current_time)\n }\n unless will_record_after_update?\n record_update(force: true, in_after_callback: false)\n end\n @record.save!(validate: false)\n end",
"def literal_datetime(v)\n v.strftime(TIMESTAMP_FORMAT)\n end",
"def visit_date_time(binding_type)\n self.result = binding_type.to_ruby(input)\n end",
"def format_datetime\n if @opts[:as] == :select\n values = {}\n if v = @attr[:value]\n v = DateTime.parse(v) unless v.is_a?(Time) || v.is_a?(DateTime)\n values[:year], values[:month], values[:day], values[:hour], values[:minute], values[:second] = v.year, v.month, v.day, v.hour, v.min, v.sec\n end\n _format_date_select(values, @opts[:order] || DEFAULT_DATETIME_ORDER)\n else\n _format_input('datetime-local')\n end\n end",
"def add_field_schema(name, type, schema)\n @field_names ||= [] ; @field_schemas ||= {}\n @field_names = @field_names | [name]\n schema = schema.symbolize_keys.merge({ :name => name })\n #\n # FIXME: this is terrible, especially given what's in TypeFactory anyway.\n #\n schema[:type] =\n case\n when type == Hash && schema.has_key?(:values) then Icss::Meta::TypeFactory.receive({ :type => :hash, :values => schema.delete(:values)})\n when type == Array && schema.has_key?(:items) then Icss::Meta::TypeFactory.receive({ :type => :array, :items => schema.delete(:items) })\n when type == Hash then IdenticalHashFactory\n when type == Array then IdenticalArrayFactory\n else\n Icss::Meta::TypeFactory.receive(type)\n end\n fld = (field_schemas[name] || make_field_schema).merge(schema)\n fld[:parent] = self\n @field_schemas[name] = fld\n end",
"def add_dynamic_timestamp(text)\nend",
"def format_datetime(val, istruct)\n return istruct.nil_text if val.nil?\n\n if val.to_date == val\n # It is a Date, with no time component.\n val.strftime(istruct.date_fmt)\n else\n val.strftime(istruct.datetime_fmt)\n end\n end",
"def format_datetime(val, istruct)\n return istruct.nil_text if val.nil?\n\n if val.to_date == val\n # It is a Date, with no time component.\n val.strftime(istruct.date_fmt)\n else\n val.strftime(istruct.datetime_fmt)\n end\n end",
"def time_for(record)\n return nil unless record\n case database_type\n when :mongo\n return Time.at(record['ts'].seconds)\n when :toku\n return record['ts']\n end\n end"
] |
[
"0.5910415",
"0.56748605",
"0.5605256",
"0.5586138",
"0.5501807",
"0.5490748",
"0.54817814",
"0.54065937",
"0.5399331",
"0.534236",
"0.53157085",
"0.5314812",
"0.5298801",
"0.52873474",
"0.52333033",
"0.52229726",
"0.519428",
"0.51758206",
"0.5173208",
"0.51540613",
"0.51531184",
"0.51516724",
"0.51362956",
"0.51203126",
"0.51004213",
"0.50803685",
"0.50659037",
"0.5060666",
"0.50554734",
"0.5052452",
"0.5044326",
"0.50419116",
"0.5006755",
"0.49767515",
"0.49732205",
"0.49699393",
"0.49605516",
"0.49589133",
"0.49413878",
"0.494115",
"0.49406517",
"0.49337152",
"0.49285376",
"0.4921063",
"0.49159682",
"0.49071497",
"0.49068165",
"0.48869166",
"0.48863086",
"0.48820823",
"0.4873441",
"0.48667154",
"0.48616913",
"0.48517543",
"0.48463744",
"0.48394305",
"0.48353738",
"0.48213935",
"0.4817741",
"0.48089728",
"0.48068494",
"0.48016468",
"0.47975385",
"0.47784454",
"0.47766858",
"0.47693577",
"0.47675753",
"0.47576877",
"0.47493827",
"0.47457808",
"0.47457808",
"0.47176743",
"0.47153127",
"0.47121078",
"0.47079557",
"0.46979278",
"0.4695503",
"0.46939936",
"0.46774015",
"0.4672569",
"0.46670392",
"0.46505332",
"0.46497753",
"0.46466568",
"0.4643945",
"0.46416456",
"0.4634092",
"0.4633077",
"0.46262664",
"0.46154818",
"0.461505",
"0.4614241",
"0.4609493",
"0.46039402",
"0.45941037",
"0.458589",
"0.45744926",
"0.45741922",
"0.45741922",
"0.45726508"
] |
0.6224733
|
0
|
Adds a date field to the nested schema of a record field. This can only be called on fields that are of type `RECORD`.
|
def date name, description: nil, mode: :nullable, policy_tags: nil
record_check!
add_field name, :date, description: description, mode: mode, policy_tags: policy_tags
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def date_nested\n self[Solrizer.solr_name('date_nested', :displayable)]\n end",
"def date_field(object_name, method, options = T.unsafe(nil)); end",
"def _build_date_single(date, xml)\n attrs = { localType: date['date_label'] }\n create_node(xml, 'date', attrs, date['structured_date_single']['date_expression'])\n end",
"def add_date(date_val = '')\n header['date'] = date_val\n end",
"def to_doc\n # doc now has all the fields of our model instance, we \n # just add another field to it:\n doc = super\n # add a field containing the current time\n doc[:added] = Time.now.to_i.to_s\n return doc\n end",
"def type_literal_generic_date(column)\n :date\n end",
"def date_field(field, options = {})\n append_class_option(options, \"date_field\")\n value = object.send(field)\n if value.is_a?(Date)\n value = I18n.l(value, :format => :default)\n end\n options[:value] = value\n text_field(field, options)\n end",
"def freeze_rec( d )\n self.freeze_date = d if freeze_date.nil?\n end",
"def initialize_to_correct_date_type(field_info, field)\n initialize_integer(field_info, field)\n initialize_float(field_info, field)\n end",
"def apply_validations_for_date\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Date\") if value && (! value.kind_of?(Date))\n end\n end",
"def bound_date_field(method, attrs = {})\n update_bound_controls(method, attrs, 'date')\n attrs[:value] = @obj.send(method)\n attrs[:name] ||= control_name(method)\n unbound_date_field(attrs)\n end",
"def add_date\n @bib.date.each do |d|\n case d.type\n when \"published\"\n @item.year = d.on :year\n month = d.on :month\n @item.month = month if month\n when \"accessed\" then @item.urldate = d.on.to_s\n end\n end\n end",
"def add_field! key, initial = nil, opts = {}, &block\n key = @schema.validate_new_key! key\n @values[key] = initial\n @schema.add_field! key, initial, opts, &block\n self\n end",
"def create_date_field(task, relative_date)\n if task.has_key?('days')\n task['date'] = relative_date + task['days'].to_i\n end\n\n if task.has_key?('subtasks') && task['subtasks'].any?\n task['subtasks'].each { |subtask|\n create_date_field(subtask, relative_date)\n }\n end\nend",
"def date=(date)\n @table[:date] = date\n end",
"def add_date(predicate, date, required = false, fmt = nil)\n add(predicate, to_iso8601(parse_date(date, fmt)), required)\n end",
"def set_date(*fields)\n fields.each do |field|\n next unless self.respond_to?(field) && self[field].is_a?(String)\n self[field] = Date.strptime(self[field], \"%Y-%m-%d\")\n end\n end",
"def generate_object_date\n lambda do |record, accumulator, _context|\n object_date = record[OBJECT_BEGIN_DATE] unless record[OBJECT_BEGIN_DATE].to_s.empty?\n object_date = \"#{object_date} - #{record[OBJECT_END_DATE]}\" unless record[OBJECT_END_DATE].to_s.empty?\n accumulator << object_date\n end\n end",
"def set_date(source, target, field_name)\n value = source[field_name]\n\n unless value.blank?\n try_conversion(field_name, source) do\n target[field_name] = Date.parse(value)\n end\n end\n end",
"def date() self[:date]; end",
"def set_auto_date_field(field_name)\n self.send(\"#{field_name}=\", Time.now) if self.respond_to? field_name\n end",
"def updated_date\n extractor = MarcExtractor.new(\"907b\", :first => true)\n lambda do |record, acc|\n datestr = extractor.extract(record).first\n begin\n date = Date.strptime(datestr, \"%m-%d-%y\")\n acc << solr_date(date)\n rescue ArgumentError\n yell.debug \"Unable to parse datestr #{datestr}\"\n end\n end\n end",
"def date_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end",
"def append_date(value)\n date = case value\n when Date, Time\n value\n else\n begin\n Date.parse(value)\n rescue\n raise(ArgumentError, \"Cannot parse argument `#{value}` to Date.\")\n end\n end\n\n _append_date(date.year, date.month, date.day)\n end",
"def easy_date; date; end",
"def add_field(field)\n\t\tend",
"def publication_date(field = nil)\n IsoDay.cast(find_record_items(field).first)&.to_s if field\n end",
"def set_date_before_save\n self.date = Chronic.parse(self.human_date)\n end",
"def date_field(field, options={})\n options.reverse_merge!(:value => field_value(field), :id => field_id(field))\n options[:class] = 'date_field'\n options.merge!(:class => field_error(field, options))\n @template.date_field_tag field_name(field), options\n end",
"def add_field(identifier, value = nil)\n @fields << build_field(identifier, value)\n end",
"def create_date_field(form,\n value,\n name,\n label,\n field_id,\n required: false,\n validation: nil,\n html_class: nil,\n is_multiple: false,\n readonly: false,\n index: 0,\n ttip: nil,\n example: nil,\n default_value: nil)\n render partial: 'dynamic_form/fields/text_field',\n locals: {\n f: form,\n multiple: is_multiple,\n index:,\n field_value: value,\n field_name: name,\n field_label: label,\n field_class: html_class,\n field_id:,\n input_type: 'date',\n readonly:,\n required:,\n validation:,\n ttip:,\n example:,\n default_value:\n }\n end",
"def initialize_fields_by_type\n database_field_names.each do |field|\n field_info = self.class.get_table_info.select {|hash| hash[\"name\"] == field}.first\n initialize_to_correct_date_type(field_info, field) \n end\n end",
"def date_created=(value)\n @children['date-created'][:value] = value\n end",
"def date_created=(value)\n @children['date-created'][:value] = value\n end",
"def date_of_work_models\n @date_of_work_structured ||= begin\n (solr_document[\"date_of_work_json_ssm\"] || []).collect do |json|\n DateOfWork.new.from_json(json).tap { |d| d.readonly! }\n end\n end\n end",
"def datetime name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :datetime, description: description, mode: mode, policy_tags: policy_tags\n end",
"def set_auto_date_field(field_name)\n method = \"#{field_name}=\"\n self.send(method, Time.now) if self.respond_to?(method)\n end",
"def has_date?\n !fields.select { |f| f.responsible_for?('Date') }.empty?\n end",
"def add_field(name, type, options={})\n name = name.to_s\n \n # preconditions\n raise InvalidModelField.new(\"Duplicate field name\") if record_fields.key?(name)\n raise InvalidModelField.new(\"Type must be a known yodel field type\") unless valid_type?(type)\n raise InvalidModelField.new(\"Field name cannot start with an underscore\") if name.start_with?('_')\n \n # add the field to the model and subclasses\n field_type = Field.field_from_type(type.to_s)\n field = field_type.new(name, deep_stringify_keys(options.merge(type: type.to_s)))\n RecordIndex.add_index_for_field(self, field) if field.index?\n record_fields[name] = field\n end",
"def datetime_field(object_name, method, options = T.unsafe(nil)); end",
"def set_date(date)\n param = date[:year]\n if date.key? :month\n param << \":\" << date[:month]\n param << \":\" << date[:day] if date.key? :day\n end\n Jhead.call(\"-ds\" << param, @match, @pattern)\n end",
"def add_field_schema(name, type, schema)\n @field_names ||= [] ; @field_schemas ||= {}\n @field_names = @field_names | [name]\n schema = schema.symbolize_keys.merge({ :name => name })\n #\n # FIXME: this is terrible, especially given what's in TypeFactory anyway.\n #\n schema[:type] =\n case\n when type == Hash && schema.has_key?(:values) then Icss::Meta::TypeFactory.receive({ :type => :hash, :values => schema.delete(:values)})\n when type == Array && schema.has_key?(:items) then Icss::Meta::TypeFactory.receive({ :type => :array, :items => schema.delete(:items) })\n when type == Hash then IdenticalHashFactory\n when type == Array then IdenticalArrayFactory\n else\n Icss::Meta::TypeFactory.receive(type)\n end\n fld = (field_schemas[name] || make_field_schema).merge(schema)\n fld[:parent] = self\n @field_schemas[name] = fld\n end",
"def _build_date_single_std(date, xml)\n expression = date['structured_date_single']['date_expression']\n standardized = date['structured_date_single']['date_standardized']\n\n inner_text = expression ? expression : standardized\n\n std_attr = case date['structured_date_single']['date_standardized_type']\n when 'standard'\n :standardDate\n when 'not_before'\n :notBefore\n when 'not_after'\n :notAfter\n end\n\n attrs = { localType: date['date_label'] }\n attrs[std_attr] = standardized\n\n create_node(xml, 'date', attrs, inner_text)\n end",
"def new_paper_date!(dt)\n if self.last_paper_date.nil? || dt.to_date > self.last_paper_date.to_date\n self.last_paper_date = dt\n self.save!\n\n unless self.parent_uid.nil?\n self.parent.new_paper_date!(dt)\n end\n end\n end",
"def parse_date_time\n self.each do |review|\n review['date_created'] = DateTime.parse(review['date_created'])\n end\n end",
"def date_attr name, options = {}\n add_attribute(DateAttribute.new(name, options))\n end",
"def record(record)\n @db.save_doc(record)\n end",
"def addRecord(rec); @records[rec.key] = rec end",
"def modification_date=(_); end",
"def apply_extension(original_date, ext)\n if ext\n ext.infinite? ? nil : (original_date + ext.days.days)\n else\n original_date\n end\n end",
"def date\n @date ||= Date.parse(@attrs[:date]) rescue nil\n end",
"def formatted_date(field)\n self.send(field).strftime('%b %d, %Y') if self.send(field).present?\n end",
"def collection_date uid=nil\n if (ref = ref_for uid, false) && ref.in_collection\n ref.created_at\n end\n # (ref = uid.nil? ? ref_for : ref_for(uid, false)) && ref.created_at\n end",
"def add_local\n remap_resource_type\n process_date_ingest_fields\n add_controlled_fields\n end",
"def display_datastream_date_field(document,datastream_name,fields=[],label_text='',dd_class=nil)\n label = \"\"\n dd_class = \"class=\\\"#{dd_class}\\\"\" if dd_class\n datastream_field = \"\"\n\t \tunless get_values_from_datastream(document,datastream_name, fields).first.empty?\n if label_text.length > 0\n label = pluralize(get_values_from_datastream(document,datastream_name, fields).count,label_text)[2..-1]\n end\n datastream_field = <<-EOS\n <dt>\n #{fedora_field_label(datastream_name,fields,label)}\n </dt>\n <dd #{dd_class}>\n #{display_friendly_date(get_values_from_datastream(document,datastream_name, fields)[0])}\n </dd>\n EOS\n end\n datastream_field.html_safe\n end",
"def display_datastream_date_field(document,datastream_name,fields=[],label_text='',dd_class=nil)\n label = \"\"\n dd_class = \"class=\\\"#{dd_class}\\\"\" if dd_class\n datastream_field = \"\"\n\t \tunless get_values_from_datastream(document,datastream_name, fields).first.empty?\n if label_text.length > 0\n label = pluralize(get_values_from_datastream(document,datastream_name, fields).count,label_text)[2..-1]\n end\n datastream_field = <<-EOS\n <dt>\n #{fedora_field_label(datastream_name,fields,label)}\n </dt>\n <dd #{dd_class}>\n #{display_friendly_date(get_values_from_datastream(document,datastream_name, fields)[0])}\n </dd>\n EOS\n end\n datastream_field.html_safe\n end",
"def date\n set_function_and_argument(:date, nil)\n end",
"def add_copied_at_field\n logger.info \"Adding #{name}._copied_at audit field...\"\n db.query(\"ALTER TABLE #{audit} ADD `_copied_at` TIMESTAMP NULL\")\n end",
"def timeRecordsForDate(brick, date)\n end",
"def add_field!(field_name, value = T.unsafe(nil)); end",
"def add_record(value)\n @children['record'][:value] << value\n end",
"def add_record(value)\n @children['record'][:value] << value\n end",
"def add_field!(field_name, value = nil)\n fields << Field.new({'name' => field_name}, value)\n end",
"def to_date()\n #This is a stub, used for indexing\n end",
"def visit_date_time(binding_type)\n dt_str = DateTimeConverter.convert_from_datetime(input)\n self.result = binding_type.definition.new_value(dt_str)\n end",
"def dates\n # only convert fields whose name is date* or *_date*\n # lots of other things might be 8 digits, and we have to exclude eg 'candidate'\n t.convert :field => /(^|_)date/ do |value|\n unless value.nil?\n Date.parse(value) rescue value\n end\n end\n end",
"def parse_date\r\n if params[:record]\r\n external_key = \"\";\r\n invalid_year = false;\r\n params[:record].dup.each { |key, value|\r\n if key.include?(\"1i\")\r\n invalid_year = value.to_i < 1000\r\n external_key = key.split(\"(\")[0]\r\n end\r\n\r\n if invalid_year\r\n invalid_year = false\r\n params[:record].delete_if { |key, value|\r\n key.include?(external_key)\r\n }\r\n\r\n params[:record][external_key] = params[:record].delete(external_key)\r\n end\r\n }\r\n end\r\n end",
"def clean_date\n read_attribute :date\n end",
"def date(key, options = {})\n before_all(key, options)\n begin; store(key, ->(item){Date.parse(item.to_s)}, options); rescue; raise_type_error(key, \"Date\"); end\n end",
"def touch_date uid=nil\n if ref = ref_if_any(uid)\n ref.updated_at\n end\n end",
"def create\n @hours_record = HoursRecord.new(hours_record_params)\n @hours_record.record_doc.attach(params[:record_doc])\n\n respond_to do |format|\n if @hours_record.save\n format.html { redirect_to @hours_record, notice: 'Hours record was successfully created.' }\n format.json { render :show, status: :created, location: @hours_record }\n else\n format.html { render :new }\n format.json { render json: @hours_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def collect_posting_date(doc, offer_object)\n puts \"Mining posting date\"\n meta = doc.at('script:contains(\"localeData\")')\n # extract CDATA\n meta = meta.children[0].content\n date = meta.match(/Creation-Date:([^\\\\]+)/)[1]\n date[0] = ''\n offer_object[:posting_date] = date.to_datetime\n end",
"def date; end",
"def date; end",
"def date; end",
"def date; end",
"def date_select(field, options={}, &block)\n format_with_label(field, options.merge(:field_type => \"date\"), super(field, purge_custom_tags(options)), &block)\n end",
"def set_rails_dt_attributes!(meth,dt)\n if dt && meth.match(/_(?:on|d)$/)\n write_attribute meth, dt.to_date\n elsif dt && meth.match(/_(?:at|dt)$/)\n write_attribute meth, dt.to_datetime\n else\n write_attribute meth, dt\n end\n end",
"def add_field(name, values, options = {})\n RSolr::Array.wrap(values).each do |v|\n field_attrs = { name: name }\n field_attrs[:type] = DocumentField if name.to_s == CHILD_DOCUMENT_KEY\n\n @fields << RSolr::Field.instance(options.merge(field_attrs), v)\n end\n end",
"def field(*params)\n config = params.extract_options!\n config.assert_valid_keys(*::Schemaless::Field::VALID_OPTS)\n type = config.delete(:type)\n type ||= params.size > 1 ? params.pop : :string # TBD\n name = params.join\n schemaless_fields <<\n ::Schemaless::Field.new(name, type, config)\n end",
"def read_date_attribute(node, attr_name)\n if node.attributes[attr_name]\n begin\n Model::IncompleteDate.new node.attributes[attr_name]\n rescue ArgumentError\n nil\n end\n end\n end",
"def handle_date(attrs, key, warnings)\n if attrs.has_key?(key) && attrs[key].present?\n begin\n # check if it's US looking date\n if attrs[key].respond_to?(:match) && attrs[key].match(/\\d{1,2}\\/\\d{1,2}\\/\\d{4}/)\n attrs[key] = Date.strptime(attrs[key], '%m/%d/%Y').to_s # converts to YYYY-MM-DD\n end\n\n # try to parse it as Rails will\n Date.parse(attrs[key])\n rescue => e\n warnings[key.to_sym] ||= []\n warnings[key.to_sym] << \"#{e}, use YYYY-MM-DD or MM/DD/YYYY format\"\n end\n end\n end",
"def touch_date uid=nil\n if (ref = ref_for uid, false)\n ref.updated_at\n end\n #(ref = uid.nil? ? current_ref : ref_for(uid, false)) && ref.updated_at\n end",
"def recordAttendance\n @provider = Provider.find(params[:provider_id])\n @children = @provider.children.order('lName')\n @date = params[:date] \n @date = Date.parse(\"#{params[:date]['day']}-#{params[:date]['month']}-#{params[:date]['year']}\") if params[:date]\n @date ||= Date.current\nend",
"def schedule_new_record(row)\n ETL::Engine.logger.debug \"writing new record\"\n if scd_type == 2\n row[scd_effective_date_field] = @timestamp\n row[scd_end_date_field] = '9999-12-31 00:00:00'\n row[scd_latest_version_field] = true\n end\n buffer << row\n end",
"def enforce_iso8601_date(api_attribute, table_column = api_attribute)\n define_method(api_attribute) do\n object.send(table_column).strftime('%F') unless object.send(table_column).nil?\n end\n end",
"def convert_string_to_datetime(record)\n record['sf_lastmodifieddate'] = record['sf_lastmodifieddate'].to_datetime if record['sf_lastmodifieddate']\n record['sf_createddate'] = record['sf_createddate'].to_datetime if record['sf_createddate']\n record['sf_lastactivitydate'] = record['sf_lastactivitydate'].to_date if record['sf_lastactivitydate']\n record\n end",
"def date_field_with_time(actual_date, object_name, method, options={})\n actual_date = Time.now if actual_date == nil\n if actual_date != nil\n hash = separate_date_time(actual_date)\n date_part = date_field(object_name, method+'_date', :size => 15, :value => hash[:date])\n time_part = text_field object_name, method+'_time', :size => 4,:value => hash[:time]\n else\n date_part= \"* SHOULD BE DATE STUFF HERE * \"\n time_part= \"* SHOULD BE TIME STUFF HERE * \"\n end\n return date_part+' ' + time_part\n end",
"def date(date)\n @datee = Date.new(date[:year],date[:month],date[:day])\n end",
"def add_field(name, data_lambda = nil)\n name = next_unknown_field_name if name.nil?\n @fields << name.to_sym\n @lambdas[name.to_sym] = data_lambda if data_lambda\n end",
"def date\n if (self.datetime_observation) then self.datetime_observation.to_date\n else @date ||= self.observation.date #default\n end\n end",
"def rolls_date= date\n return super(date) unless date.is_a? String\n\n date = Date.strptime(date, \"%m%d%Y\") if date =~ /\\d{8}/\n date = Date.strptime(date, \"%m/%d/%Y\") if date =~ /\\d{1,2}\\/\\d{1,2}\\/\\d{4}/\n date = Date.parse(date) if date =~ /\\d{4}-\\d{1,2}-\\d{1,2}/\n\n super date\n end",
"def add_fields(fields)\n\t\tend",
"def date_field_enter(date)\n my_date = Date.parse(date)\n year = my_date.year\n month = my_date.strftime('%b')\n day = my_date.strftime('%d')\n\n day_field = @field.all(:css, 'input[id$=\"DayValue\"]').first\n day_field.set \"#{day}\"\n\n month_drop_down = @field.all(:css, 'select[id$=\"MonthLongValue\"]').first[:id]\n select(month, :from => month_drop_down)\n\n year_field = @field.all(:css, 'input[id$=\"YearValue\"]').first\n year_field.set \"#{year}\"\n end",
"def append(field)\n @fields.push(field)\n @fields.clean = false\n end",
"def field(name, type)\n @fields << Field.new(name, type, @fields.size, nil, {})\n end",
"def addDueDate(id, date)\n item = Todo.find(id)\n item.duedate = date\n item.save\nend",
"def start_form_column(column, options)\n text_field :record, :start, options.merge({:class => \"date_picker\"})\n end",
"def date\n \"#{self[:day]}_#{self[:month]}_#{self[:year]}\"\n end",
"def created_at; @doc['created_at']; end"
] |
[
"0.5841291",
"0.562257",
"0.5616748",
"0.55500364",
"0.54208255",
"0.5420433",
"0.5403138",
"0.53960913",
"0.53750974",
"0.531933",
"0.5253915",
"0.52248484",
"0.5169552",
"0.51013654",
"0.5096172",
"0.50791895",
"0.5062106",
"0.50587535",
"0.50331414",
"0.49732295",
"0.49703154",
"0.4967024",
"0.4964504",
"0.49617022",
"0.49534917",
"0.49224004",
"0.4920641",
"0.4908637",
"0.49034658",
"0.48883438",
"0.48619452",
"0.48529893",
"0.48471665",
"0.48471665",
"0.4836759",
"0.48140028",
"0.48127034",
"0.48038954",
"0.4803099",
"0.479491",
"0.47815326",
"0.47608706",
"0.47486496",
"0.47363406",
"0.47162628",
"0.47148594",
"0.46997574",
"0.46905977",
"0.46895748",
"0.46894246",
"0.4689343",
"0.46793735",
"0.4666673",
"0.4657795",
"0.4656528",
"0.4656528",
"0.46534377",
"0.46479952",
"0.46459645",
"0.46434513",
"0.46400544",
"0.46400544",
"0.46233374",
"0.46068698",
"0.46068174",
"0.4593799",
"0.45931393",
"0.45840216",
"0.4574912",
"0.45703098",
"0.45658365",
"0.45570922",
"0.4555433",
"0.4555433",
"0.4555433",
"0.4555433",
"0.45531216",
"0.45494184",
"0.4547849",
"0.45399976",
"0.45391014",
"0.45374507",
"0.45233667",
"0.4520854",
"0.45133728",
"0.45108223",
"0.45104104",
"0.4501788",
"0.44993228",
"0.44978184",
"0.44966337",
"0.44952685",
"0.44917402",
"0.44892552",
"0.44892043",
"0.44840023",
"0.44830674",
"0.44794327",
"0.4477292",
"0.4473746"
] |
0.6045377
|
0
|
Adds a geography field to the nested schema of a record field.
|
def geography name, description: nil, mode: :nullable, policy_tags: nil
record_check!
add_field name, :geography, description: description, mode: mode, policy_tags: policy_tags
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def geography(name, options = {})\n column(name, :geography, options)\n end",
"def append_geom( geom, **other_attrs )\n if geom.is_a?(GeoRuby::SimpleFeatures::Geometry)\n geom = RGeo::WKRep::WKBParser.new.parse(geom.as_wkb) rescue nil\n end\n new_geom = geom\n self.place_geometry.reload\n if place_geometry && !place_geometry.geom.nil?\n union = place_geometry.geom.union(new_geom)\n new_geom = if union.geometry_type == ::RGeo::Feature::MultiPolygon\n union\n else\n f = place_geometry.geom.factory\n f.multi_polygon([union])\n end\n end\n self.save_geom( new_geom, **other_attrs )\n end",
"def geography\n @geography ||= auxilliary_metadata(:geography, GeographyMeta)\n end",
"def geography_columns!; end",
"def get_containing_geography\n return self.geography\n end",
"def geography_columns; end",
"def add_geometry_column(table)\n sql = <<-SQL\n SELECT AddGeometryColumn('%s', 'geom', 4326, 'GEOMETRY', 2);\n\n ALTER TABLE %s ADD CONSTRAINT constraint_geom_no_geometrycollection\n CHECK (GeometryType(geom) != 'GEOMETRYCOLLECTION');\n\n CREATE INDEX ON %s USING gist (geom);\n SQL\n\n run sql % ([table.to_s] * 3)\n end",
"def geojson(fields)\n geojson = Array.new\n fields.each do |field|\n geojson << {\n type: 'Feature',\n geometry: {\n type: 'Point',\n coordinates: [field.longitude, field.latitude]\n },\n properties: {\n id: field.id,\n name: field.name,\n address: print_field(field),\n :'marker-color' => '#00607d',\n :'marker-symbol' => 'circle',\n :'marker-size' => 'medium',\n title: \"<a href=#{field_url(field)} data-no-turbolink><b>#{field.name}</b></a>\",\n description: print_field(field)\n }\n }\n end\n geojson\n end",
"def geometry_simplified_type(sql_type)\n case sql_type\n when /geography\\(point/i then :point\n when /geography\\(linestring/i then :line_string\n when /geography\\(polygon/i then :polygon\n when /geography\\(multipoint/i then :multi_point\n when /geography\\(multilinestring/i then :multi_line_string\n when /geography\\(multipolygon/i then :multi_polygon\n when /geography\\(geometrycollection/i then :geometry_collection\n when /geography/i then :geometry\n else\n super\n end\n end",
"def to_geo_json_feature\n # !! avoid loading the whole geographic item, just grab the bits we need:\n # self.georeferences(true) # do this to\n to_simple_json_feature.merge({\n 'properties' => {\n 'collecting_event' => {\n 'id' => self.id,\n 'tag' => \"Collecting event #{self.id}.\"\n }\n }\n })\n end",
"def partial() \"single/geometryfield\" ; end",
"def add_field_schema(name, type, schema)\n @field_names ||= [] ; @field_schemas ||= {}\n @field_names = @field_names | [name]\n schema = schema.symbolize_keys.merge({ :name => name })\n #\n # FIXME: this is terrible, especially given what's in TypeFactory anyway.\n #\n schema[:type] =\n case\n when type == Hash && schema.has_key?(:values) then Icss::Meta::TypeFactory.receive({ :type => :hash, :values => schema.delete(:values)})\n when type == Array && schema.has_key?(:items) then Icss::Meta::TypeFactory.receive({ :type => :array, :items => schema.delete(:items) })\n when type == Hash then IdenticalHashFactory\n when type == Array then IdenticalArrayFactory\n else\n Icss::Meta::TypeFactory.receive(type)\n end\n fld = (field_schemas[name] || make_field_schema).merge(schema)\n fld[:parent] = self\n @field_schemas[name] = fld\n end",
"def geometry_simplified_type(field_type)\n case field_type\n when /linestring/i then :linestring\n when /multipoint/i then :multipoint\n when /multilinestring/i then :multilinestring\n when /multipolygon/i then :multipolygon\n when /geometrycollection/i then :geometry\n when /point/i then :point\n when /polygon/i then :polygon\n when /geometry/i then :geometry\n when /geography/i then :geography\n end\n end",
"def georss_w3cgeo_representation(options)#:nodoc: \r\n self[0].georss_w3cgeo_representation(options)\r\n end",
"def __spatial_column_name=(geom); end",
"def geography_column_by_name(name); end",
"def add_field(field)\n\t\tend",
"def create_geography_column_accessors!(options = {})\n options = {\n geography_columns: true\n }.merge(options)\n\n create_spatial_column_accessors!(options)\n end",
"def feature_from_model(model, field=:location)\n geometry = model.respond_to?(\"#{field}_geometry\") ?\n model.send(\"#{field}_geometry\") : # get geometry geojson from database\n model.send(field) # get geometry from rgeo object\n build_feature geometry, model.id, model.geojson_properties\n end",
"def add_local\n remap_resource_type\n process_date_ingest_fields\n add_controlled_fields\n end",
"def geography(level)\n data = @data['families'].find { |type| type['name'] == 'Geography' }\n badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) }\n HQTrivia::Badge.new(badge)\n end",
"def structured_postal_address\n get_attribute(Yoti::Attribute::STRUCTURED_POSTAL_ADDRESS)\n end",
"def spatial_columns!\n geometry_columns! + geography_columns!\n end",
"def add_layer\n Layer.create(:name => @new_table_name, :table_name => @new_table_name, :geometric_column_name => \"the_geom\")\n end",
"def relate(geom)\n check_geometry(geom)\n FFIGeos.GEOSRelate_r(Geos.current_handle_pointer, ptr, geom.ptr)\n end",
"def translate_geometry_type(key, value)\n return unless key == 'layer_geom_type_s' && geometry_types.include?(value)\n\n metadata[key] = geometry_types[value]\n end",
"def spatial_columns\n geometry_columns + geography_columns\n end",
"def geopos(key, member); end",
"def geojson\n obj = factory.parse_wkt(geometry_as_wkt)\n RGeo::GeoJSON.encode(obj).to_json\n rescue\n Geoblacklight.logger.warn \"Geometry is not valid: #{geom}\"\n default_extent\n end",
"def wkt=(value)\n begin\n a = ::Gis::FACTORY.parse_wkt(value)\n b = a.geometry_type.type_name.tableize.singularize.to_sym\n\n self.geographic_item = GeographicItem.new(b => a)\n @wkt_error = nil\n rescue RGeo::Error::RGeoError => e\n self.geographic_item = nil\n @wkt_error = e.message\n end\n end",
"def add_raw(raw)\n @fields << Field.new(raw)\n self\n end",
"def add_facet_field(*) super end",
"def build(document)\n document.geom_type = geom_type\n document.format = format\n end",
"def build(document)\n document.geom_types = geom_types\n document.format = format\n end",
"def add_attribute(opts = {})\n @attributes << Crow::TypeMapFactory.create_typemap(opts.merge(parent_struct: self))\n end",
"def field(ffield, length, sourcetag, default = nil, &block)\n @fields << {\n afield: ffield,\n length: length, \n stag: sourcetag,\n default: default,\n block: block\n }\n end",
"def to_geo_json_string\n GeographicItem.connection.select_one(\n \"SELECT ST_AsGeoJSON(#{geo_object_type}::geometry) a \" \\\n \"FROM geographic_items WHERE id=#{id};\")['a']\n end",
"def customize_geojson(geojson, options={})\n geojson\n end",
"def geography?\n type == \"GEOGRAPHY\"\n end",
"def ir_add_source_structure!(ir)\n ir.keys.each do |k|\n if ir[k][:full_source_relation_name]\n ir[k][:source_structure] = ir[\n ir[k][:full_source_relation_name]\n ]\n end\n end\n end",
"def encode(field, id=nil, properties={})\n return nil if field.nil?\n\n feature = build_feature field, id, properties\n encode_feature_collection([feature])\n end",
"def __spatial_column_name_wkb; end",
"def georss_w3cgeo_representation(options)\r\n w3cgeo_ns = options[:w3cgeo_ns] || \"geo\"\r\n \r\n \"<#{w3cgeo_ns}:lat>#{self[0][0].y}</#{w3cgeo_ns}:lat>\\n<#{w3cgeo_ns}:long>#{self[0][0].x}</#{w3cgeo_ns}:long>\\n\"\r\n end",
"def add_field(identifier, value = nil)\n @fields << build_field(identifier, value)\n end",
"def add_field(name, sample_name, container_name, role, opts)\n raise \"Can't add field to #{self.class} before it has been saved.\" unless id\n\n sample_names = sample_name.nil? || sample_name.is_a?(String) ? [sample_name] : sample_name\n container_names = container_name.nil? || container_name.is_a?(String) ? [container_name] : container_name\n\n ft = field_types.create({ parent_id: id, name: name, ftype: 'sample', role: role }.merge(opts))\n ft.save\n\n if sample_names\n (0..sample_names.length - 1).each do |i|\n sample = SampleType.find_by(name: sample_names[i]) if sample_names[i].present?\n container = ObjectType.find_by(name: container_names[i]) if container_names[i].present?\n\n ft.allowable_field_types.create(\n sample_type_id: sample ? sample.id : nil,\n object_type_id: container ? container.id : nil\n )\n end\n end\n\n self\n end",
"def add_sidecar_fields(solr_hash)\n solr_hash.merge! resource.sidecar.to_solr\n end",
"def geo; end",
"def field_map_class\n ActiveFedora::RDF::FieldMap\n end",
"def geometry\n @geometry ||= _geometry\n end",
"def add_field! key, initial = nil, opts = {}, &block\n key = @schema.validate_new_key! key\n @values[key] = initial\n @schema.add_field! key, initial, opts, &block\n self\n end",
"def update_geo_location(record)\n result = Kase.connection.update(\"UPDATE #{table_name} \" + \n \"SET #{table_name}.lng = #{record.lng ? sanitize_sql(record.lng) : 'NULL'}, \" +\n \"#{table_name}.lat = #{record.lat ? sanitize_sql(record.lat) : 'NULL'} \" +\n \"WHERE #{table_name}.id = #{sanitize_sql(record.id)}\")\n result\n end",
"def add_geo(db, geo_name, company)\n db.execute(\"INSERT INTO geologists (name, company) \n VALUES (?, ?)\", [geo_name, company])\nend",
"def parse_field(field)\n [STREET_TYPES, CITY_TYPES, STATE_TYPES, POSTAL_TYPES].each do |type|\n if similar?(field['types'], type[:values])\n send(\"add_#{type[:name]}\", field)\n end\n end\n end",
"def as_georss(options = {})\r\n dialect= options[:dialect] || :simple\r\n case(dialect)\r\n when :simple\r\n geom_attr = \"\"\r\n geom_attr += \" featuretypetag=\\\"#{options[:featuretypetag]}\\\"\" if options[:featuretypetag]\r\n geom_attr += \" relationshiptag=\\\"#{options[:relationshiptag]}\\\"\" if options[:relationshiptag]\r\n geom_attr += \" floor=\\\"#{options[:floor]}\\\"\" if options[:floor]\r\n geom_attr += \" radius=\\\"#{options[:radius]}\\\"\" if options[:radius]\r\n geom_attr += \" elev=\\\"#{options[:elev]}\\\"\" if options[:elev]\r\n \r\n georss_simple_representation(options.merge(:geom_attr => geom_attr))\r\n when :w3cgeo\r\n georss_w3cgeo_representation(options)\r\n when :gml\r\n georss_gml_representation(options)\r\n end\r\n end",
"def __spatial_column_name_wkt; end",
"def latitude\n self.wkb_geometry.coordinates[1]\n end",
"def geoAddress\n\n self.address + \",\" +self.region.name\n\n end",
"def build_simple_attributes(document)\n simple_attributes.each do |a|\n document.send(\"#{a}=\", geo_concern.send(a.to_s))\n end\n end",
"def feature_geo_code_params\n params.require(:feature_geo_code).permit(:geo_code_type_id, :geo_code_value)\n end",
"def mongoize\n\t{:type => 'Point', :coordinates => [@longitude, @latitude]}\nend",
"def geom_type\n# \tself.geom.geometry_n(0).geometry_type\n \"Point\" # Hard-coding for non-spaital database deployment\n end",
"def binary_geometry_type #:nodoc:\r\n 7\r\n end",
"def as_georss(options = {})\r\n dialect= options[:dialect] || :simple\r\n case(dialect)\r\n when :simple\r\n geom_attr = \"\"\r\n geom_attr += \" featuretypetag=\\\"#{options[:featuretypetag]}\\\"\" if options[:featuretypetag]\r\n geom_attr += \" relationshiptag=\\\"#{options[:relationshiptag]}\\\"\" if options[:relationshiptag]\r\n geom_attr += \" floor=\\\"#{options[:floor]}\\\"\" if options[:floor]\r\n geom_attr += \" radius=\\\"#{options[:radius]}\\\"\" if options[:radius]\r\n geom_attr += \" elev=\\\"#{options[:elev]}\\\"\" if options[:elev]\r\n georss_simple_representation(options.merge(:geom_attr => geom_attr))\r\n when :w3cgeo\r\n georss_w3cgeo_representation(options)\r\n when :gml\r\n georss_gml_representation(options)\r\n end\r\n end",
"def notes_geojson\n\t \t{ 'type' => 'FeatureCollection', \n\t \t 'features' => aw.notes_geo \n\t \t}\n\t \tend",
"def geoObject()\n return @shape ;\n end",
"def add_field!(field_name, value = T.unsafe(nil)); end",
"def add_new_custom_field(field_name, opts = {})\n add_new_custom_field_with_http_info(field_name, opts)\n return nil\n end",
"def binary_geometry_type #:nodoc:\n 1\n end",
"def __spatial_column_name_geos; end",
"def prepare_final_xml_for_spatial_element\n add_user_defined_field_to_xml_file('StandardsBuildingType', @standards_building_type)\n add_user_defined_field_to_xml_file('SystemType', @system_type)\n add_user_defined_field_to_xml_file('BarDivisionMethod', @bar_division_method)\n add_user_defined_field_to_xml_file('FractionArea', @fraction_area)\n add_user_defined_field_to_xml_file('SpaceTypesFloorArea', @space_types_floor_area)\n add_user_defined_field_to_xml_file('TotalFloorArea(m^2)', @total_floor_area)\n add_user_defined_field_to_xml_file('ConditionedFloorArea(m^2)', @conditioned_floor_area_heated_cooled) if !@conditioned_floor_area_heated_cooled.nil?\n add_user_defined_field_to_xml_file('HeatedFloorArea(m^2)', @conditioned_floor_area_heated_only) if !@conditioned_floor_area_heated_only.nil?\n add_user_defined_field_to_xml_file('CooledFloorArea(m^2)', @conditioned_floor_area_cooled_only) if !@conditioned_floor_area_cooled_only.nil?\n add_user_defined_field_to_xml_file('ConditionedAboveGradeFloorArea(m^2)', @custom_conditioned_above_grade_floor_area) if !@custom_conditioned_above_grade_floor_area.nil?\n add_user_defined_field_to_xml_file('ConditionedBelowGradeFloorArea(m^2)', @custom_conditioned_below_grade_floor_area) if !@custom_conditioned_below_grade_floor_area.nil?\n\n @base_xml.add_element(@user_defined_fields)\n end",
"def add_field!(field_name, value = nil)\n fields << Field.new({'name' => field_name}, value)\n end",
"def set_GeoContext(value)\n set_input(\"GeoContext\", value)\n end",
"def set_GeoContext(value)\n set_input(\"GeoContext\", value)\n end",
"def add_field(field_name,value,commit=true)\n update_solr(field_name,'add',value,commit)\n execute_callbacks(field_name,value)\n end",
"def vector_geom_type\n return 'Mixed' if file_sets.nil? || file_sets.empty?\n geom_field = Solrizer.solr_name('geometry_type')\n file_sets.first.solr_document.fetch(geom_field, ['Mixed']).first\n end",
"def text_geometry_type #:nodoc:\n 'POINT'\n end",
"def georss_w3cgeo_representation(options = {}) #:nodoc:\r\n w3cgeo_ns = options[:w3cgeo_ns] || \"geo\"\r\n point = self.center\r\n \"<#{w3cgeo_ns}:lat>#{point.y}</#{w3cgeo_ns}:lat>\\n<#{w3cgeo_ns}:long>#{point.x}</#{w3cgeo_ns}:long>\\n\"\r\n end",
"def text_geometry_type #:nodoc:\r\n \"POINT\"\r\n end",
"def to_simple_json_feature\n base = {\n 'type' => 'Feature',\n 'properties' => {}\n }\n\n if geographic_items.any?\n geo_item_id = geographic_items.select(:id).first.id\n query = \"ST_AsGeoJSON(#{GeographicItem::GEOMETRY_SQL.to_sql}::geometry) geo_json\"\n base['geometry'] = JSON.parse(GeographicItem.select(query).find(geo_item_id).geo_json)\n end\n base\n end",
"def field_with_json_storage_name(json_storage_name)\n ensure_setup!\n field_set.field_with_json_storage_name(json_storage_name)\n end",
"def add_extra_field(extra_field)\n # Try to find an extra field with the same header ID already in the list\n # and merge the new one with that if one exists; otherwise, add the new\n # one to the list.\n existing_extra_field = @extra_fields.find do |ef|\n ef.header_id == extra_field.header_id\n end\n if existing_extra_field.nil? then\n @extra_fields << extra_field\n else\n extra_field = existing_extra_field.merge(extra_field)\n end\n\n # Set some attributes of this entry based on the settings in select types\n # of extra fields.\n if extra_field.kind_of?(ExtraField::ExtendedTimestamp) then\n self.mtime = extra_field.mtime unless extra_field.mtime.nil?\n self.atime = extra_field.atime unless extra_field.atime.nil?\n elsif extra_field.kind_of?(ExtraField::Unix) then\n self.mtime = extra_field.mtime unless extra_field.mtime.nil?\n self.atime = extra_field.atime unless extra_field.atime.nil?\n self.uid = extra_field.uid unless extra_field.uid.nil?\n self.gid = extra_field.gid unless extra_field.uid.nil?\n end\n self\n end",
"def polygon\n raise OSMLib::Error::NoDatabaseError.new(\"can't create Polygon from relation if it is not in a OSMLib::Database\") if @db.nil?\n raise OSMLib::Error::NoDatabaseError.new(\"can't create Polygon from relation if it does not represent a polygon\") if self['type'] != 'multipolygon' and self['type'] != 'polygon'\n\n c = []\n member_objects.each do |way|\n raise TypeError.new(\"member is not a way so it can't be represented as Polygon\") unless way.kind_of? OSMLib::Element::Way\n raise OSMLib::Error::NotClosedError.new(\"way is not closed so it can't be represented as Polygon\") unless way.is_closed?\n raise OSMLib::Error::GeometryError.new(\"way with less then three nodes can't be turned into a polygon\") if way.nodes.size < 3\n c << way.node_objects.collect{ |node| [node.lon.to_f, node.lat.to_f] }\n end\n GeoRuby::SimpleFeatures::Polygon.from_coordinates(c)\n end",
"def georss_simple_representation(options)\r\n georss_ns = options[:georss_ns] || \"georss\"\r\n geom_attr = options[:geom_attr]\r\n \"<#{georss_ns}:polygon#{geom_attr}>\" + self[0].georss_poslist + \"</#{georss_ns}:polygon>\\n\"\r\n end",
"def geo_params\n params.require(:geo).permit(:country, :expectancy)\n end",
"def binary_geometry_type#:nodoc:\r\n 1\r\n end",
"def add_local\n add_default_values\n field_validation\n end",
"def geom_type\n FFIGeos.GEOSGeomType_r(Geos.current_handle_pointer, ptr)\n end",
"def geographic_item_params\n params.require(:geographic_item).permit(:point, :line_string, :polygon, :multi_point, :multi_line_string, :multi_polygon, :geometry_collection, :created_by_id, :updated_by_id)\n end",
"def to_gfa_field(datatype: nil)\n self << @datatype\n self << \"\\0\"\n to_json\n end",
"def build_geom(feature)\n if make_valid?\n geom = ActiveRecord::Base.connection.select_value(\"SELECT ST_CollectionExtract(ST_MakeValid(ST_Force_2D(ST_GeomFromKML('#{feature}'))),3)\")\n else\n geom = ActiveRecord::Base.connection.select_value(\"SELECT ST_Force_2D(ST_GeomFromKML('#{feature}'))\")\n end\n end",
"def add_layer\n puts \"made it to PL add layer\"\n Layer.create(:name => @new_table_name, :table_name => @new_table_name, :geometric_column_name => \"the_geom\")\n end",
"def save_geom( geom, max_area_km2: nil, max_observation_count: nil, **other_attrs )\n if geom.is_a?( GeoRuby::SimpleFeatures::Geometry )\n georuby_geom = geom\n geom = RGeo::WKRep::WKBParser.new.parse( georuby_geom.as_wkb ) rescue nil\n end\n\n return unless validate_with_geom( geom, max_area_km2: max_area_km2, max_observation_count: max_observation_count )\n\n build_place_geometry unless place_geometry\n begin\n if place_geometry.update( other_attrs.merge( geom: geom ) )\n update( points_from_geom( geom ).merge( updating_bbox: true ) )\n end\n rescue ActiveRecord::StatementInvalid, ActiveRecord::RecordInvalid => e\n Rails.logger.error \"[ERROR] \\tCouldn't save #{self.place_geometry}: #{e.message[0..200]}\"\n if e.message =~ /TopologyException/\n add_custom_error( :base, e.message[/TopologyException: (.+)/, 1] )\n else\n add_custom_error( :base, \"Boundary did not save: #{e.message[0..200]}\" )\n end\n end\n end",
"def add_field(field_name)\n result_table = table.map { |row| row.merge!(field_name => nil) }\n File.write(@table_path, JSON.generate(result_table))\n end",
"def add_empty_json_ld_schema(edited_document, schema, schema_name, schema_type, yaml) #:nodoc\r\n data = {}\r\n doc = DcJsonLd.new\r\n doc.name = schema_name\r\n doc.type = schema_type\r\n \r\n edited_document.dc_json_lds << doc\r\n schema.each do |element_name, element|\r\n next if element_name == 'level' # skip level element\r\n if yaml[element['type']]\r\n if element['n'].to_s == '1'\r\n # single element\r\n doc_1 = yaml[element['type'] ]\r\n data[element_name] = doc_1\r\n else\r\n # array\r\n add_empty_json_ld_schema(doc, yaml[element['type']], element_name, element['type'], yaml)\r\n end\r\n else\r\n data[element_name] = element['text']\r\n end\r\n end\r\n doc.data = data.to_yaml\r\n doc.save\r\nend",
"def assign_mounting_point_to_fields\n return if self.fields.blank?\n\n self.fields.each do |field|\n field.mounting_point = self.mounting_point\n end\n end",
"def get_geocloud_json\n { :country => self.country, \n :geo_settings => eval(self.geo_settings),\n :ref_point => eval(self.ref_point),\n :width => self.width,\n :height => self.height,\n :map_src => \"/assets/maps/#{self.map_file}\"}.to_json\n end",
"def add_field(name, type, options={})\n name = name.to_s\n \n # preconditions\n raise InvalidModelField.new(\"Duplicate field name\") if record_fields.key?(name)\n raise InvalidModelField.new(\"Type must be a known yodel field type\") unless valid_type?(type)\n raise InvalidModelField.new(\"Field name cannot start with an underscore\") if name.start_with?('_')\n \n # add the field to the model and subclasses\n field_type = Field.field_from_type(type.to_s)\n field = field_type.new(name, deep_stringify_keys(options.merge(type: type.to_s)))\n RecordIndex.add_index_for_field(self, field) if field.index?\n record_fields[name] = field\n end",
"def to_geo_json_feature\n retval = {\n 'type' => 'Feature',\n 'geometry' => RGeo::GeoJSON.encode(self.geographic_area.geographic_items.first.geo_object),\n 'properties' => {\n 'asserted_distribution' => {\n 'id' => self.id}\n }\n }\n retval\n end",
"def custom_fields_for(name)\n declare_embedded_in_definition_in_custom_field(name)\n\n # stores the relation name\n _custom_fields_for << name.to_s\n\n extend_for_custom_fields(name)\n end",
"def encode(object_)\n if @entity_factory.is_feature_collection?(object_)\n {\n 'type' => 'FeatureCollection',\n 'features' => @entity_factory.map_feature_collection(object_){ |f_| _encode_feature(f_) },\n }\n elsif @entity_factory.is_feature?(object_)\n _encode_feature(object_)\n elsif object_.nil?\n nil\n else\n _encode_geometry(object_)\n end\n end"
] |
[
"0.62719226",
"0.588863",
"0.5782519",
"0.56411237",
"0.5554195",
"0.55347544",
"0.5418438",
"0.53993815",
"0.53862447",
"0.5324835",
"0.5264566",
"0.52550924",
"0.52292585",
"0.5180059",
"0.516564",
"0.5143548",
"0.514169",
"0.5134572",
"0.5062158",
"0.5061737",
"0.49898568",
"0.4930389",
"0.48933637",
"0.4874601",
"0.48741975",
"0.48558745",
"0.48495623",
"0.48357207",
"0.4833393",
"0.4828475",
"0.48185378",
"0.4818497",
"0.48125094",
"0.48107395",
"0.47966838",
"0.47729212",
"0.47671747",
"0.47633445",
"0.4762296",
"0.476138",
"0.47595072",
"0.47497398",
"0.47469574",
"0.47269726",
"0.47129405",
"0.47100794",
"0.46865004",
"0.46845797",
"0.46829093",
"0.46709558",
"0.46697646",
"0.46646032",
"0.46596104",
"0.46555308",
"0.4648927",
"0.4646347",
"0.46374062",
"0.46335283",
"0.46332636",
"0.4633045",
"0.46262002",
"0.4619318",
"0.46147153",
"0.4610484",
"0.46102437",
"0.46021688",
"0.4601251",
"0.4599973",
"0.45972824",
"0.45673445",
"0.4567113",
"0.45591965",
"0.45591965",
"0.45537588",
"0.45522493",
"0.45389447",
"0.4537263",
"0.45325553",
"0.4531952",
"0.4526578",
"0.4520571",
"0.45202512",
"0.45181042",
"0.45160818",
"0.45121902",
"0.45113048",
"0.45047396",
"0.4502041",
"0.4492975",
"0.44866037",
"0.44817603",
"0.4479216",
"0.44780475",
"0.447197",
"0.44714305",
"0.44696522",
"0.44685492",
"0.44640303",
"0.4460169",
"0.44548592"
] |
0.7446773
|
0
|
Adds a record field to the nested schema of a record field. A block must be passed describing the nested fields of the record. For more information about nested and repeated records, see [Preparing Data for BigQuery]( This can only be called on fields that are of type `RECORD`.
|
def record name, description: nil, mode: nil
record_check!
# TODO: do we need to raise if no block was given?
raise ArgumentError, "a block is required" unless block_given?
nested_field = add_field name, :record, description: description, mode: mode
yield nested_field
nested_field
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fields_for(record_name, record_object = T.unsafe(nil), fields_options = T.unsafe(nil), &block); end",
"def semantic_fields_for(record_or_name_or_array, *args, &block)\n fields_for(record_or_name_or_array, *args, &block)\n end",
"def sub_field(named, human_name = nil, &block)\n human_name ||= named\n @sub_fields << QueryBuilder::Field.new(named, human_name, self.depth+1, &block)\n end",
"def semantic_fields_for(record_name, record_object = nil, options = {}, &block)\n options, record_object = record_object, nil if record_object.is_a?(Hash) && record_object.extractable_options?\n options[:builder] ||= @@builder\n options[:custom_namespace] = options.delete(:namespace)\n\n with_custom_field_error_proc do\n self.fields_for(record_name, record_object, options, &block)\n end\n end",
"def fields_for(record_name, record_object = T.unsafe(nil), options = T.unsafe(nil), &block); end",
"def formula_fields_for(record_or_name_or_array, *args, &block)\n options = args.extract_options!\n options[:builder] ||= @@builder\n fields_for(record_or_name_or_array, *(args << options), &block)\n end",
"def fields_for(record_or_name_or_array, *args, &block)\n options = args.extract_options!.merge(:builder => self.class)\n super(record_or_name_or_array, *(args + [options]), &block)\n end",
"def record_from_hash(data)\n attributes = data.delete('attributes')\n new_record = find_or_materialize(attributes[\"type\"]).new\n data.each do |name, value|\n field = new_record.description['fields'].find do |field|\n key_from_label(field[\"label\"]) == name || field[\"name\"] == name || field[\"relationshipName\"] == name\n end\n\n # Field not found\n if field == nil\n break\n end\n\n # If reference/lookup field data was fetched, recursively build the child record and apply\n if value.is_a?(Hash) and field['type'] == 'reference' and field[\"relationshipName\"]\n relation = record_from_hash( value )\n set_value( new_record, field[\"relationshipName\"], relation, 'reference' )\n\n # Apply the raw value for all other field types\n else\n set_value(new_record, field[\"name\"], value, field[\"type\"]) if field\n end\n end\n new_record\n end",
"def add_record(record)\n return unless @if_proc.call(record)\n\n condensed_record = condense_record(record)\n atoms = add_occurences(condensed_record, record.id)\n\n @storage.add(atoms)\n end",
"def formula_fields_for(record_or_name_or_array, *args, &block)\n options = args.extract_options!\n options[:builder] ||= self.class\n fields_for(record_or_name_or_array, *(args << options), &block)\n end",
"def add_raw(raw)\n @fields << Field.new(raw)\n self\n end",
"def fields_for(record, *args, &block)\n raise ArgumentError, \"Missing block\" unless block_given?\n options = args.extract_options!\n\n prefix = nil\n if record.kind_of?(Symbol) || record.kind_of?(String)\n prefix = \"#{record.to_s}\"\n object = args.first\n else\n object = record\n end\n\n if object.kind_of?(Array)\n if !object.empty?\n if prefix.nil?\n prefix = ActionController::RecordIdentifier.plural_class_name(object.first)\n end\n builder = options[:builder] || ActionView::Base.default_form_builder\n object.each_with_index do |object, index|\n yield builder.new(\"#{prefix}[#{index}]\", object, self, options, block), object\n end\n end\n else\n old_fields_for(record, *(args << options), &block)\n end\n end",
"def add(record, zone)\n new_answers = [{ answer: build_api_answer_from_record(record) }]\n\n record_fqdn = record.fqdn.sub(/\\.$/, '')\n\n existing_record = client.record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type\n )\n\n if existing_record.nil?\n client.create_record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type,\n params: {\n answers: new_answers,\n ttl: record.ttl,\n use_client_subnet: false, # only required for filter chains that are not supported by record_store\n }\n )\n return\n end\n\n existing_answers = existing_record['answers'].map { |answer| symbolize_keys(answer) }\n client.modify_record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type,\n params: { answers: existing_answers + new_answers, ttl: record.ttl }\n )\n end",
"def fields_for(record_or_name_or_array, *args, &block)\n raise ArgumentError, \"Missing block\" unless block_given?\n options = args.extract_options!\n \n case record_or_name_or_array\n when String, Symbol\n object_name = record_or_name_or_array\n object = args.first\n else\n object = record_or_name_or_array\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n end\n \n builder = options[:builder] || ActionView::Base.default_form_builder\n # to_s is required because capture result might be buffer object (which is not necessarily a string)\n result = capture(builder.new(object_name, object, self, options, block), &block).to_s\n \n if block_called_from_erb?(block)\n concat result\n else\n result\n end\n \n end",
"def record(record)\n @db.save_doc(record)\n end",
"def set_nested(hash, field_name, value)\n field_ref = Java::OrgLogstash::FieldReference.from(field_name)\n # create @metadata sub-hash if needed\n if field_ref.type == Java::OrgLogstash::FieldReference::META_CHILD\n nesting_hash = hash[\"@metadata\"]\n else\n nesting_hash = hash\n end\n\n field_ref.path.each do |token|\n nesting_hash[token] = {} unless nesting_hash.key?(token)\n nesting_hash = nesting_hash[token]\n end\n nesting_hash[field_ref.key] = value\n end",
"def semantic_fields_for(record_or_name_or_array, *args, &block)\n opts = args.extract_options!\n opts[:builder] ||= Formtastic::SemanticFormHelper.builder\n args.push(opts)\n fields_for(record_or_name_or_array, *args, &block)\n end",
"def deep_each( &blk ) #:yields: a Field\n @fields.each {|atom|\n if atom.is_a? Binstruct\n atom.deep_each &blk unless atom.fields.empty?\n else\n yield atom\n end\n }\n end",
"def each_field &block\n @fields.each(&block)\n end",
"def add_field! key, initial = nil, opts = {}, &block\n key = @schema.validate_new_key! key\n @values[key] = initial\n @schema.add_field! key, initial, opts, &block\n self\n end",
"def fields_for(record_or_name_or_array, *args, &block) #:nodoc:\n opts = args.extract_options!\n opts.merge!(:builder => Transit::Builders::FormBuilder)\n args.push(opts)\n super(record_or_name_or_array, *args, &block)\n end",
"def add_field_schema(name, type, schema)\n @field_names ||= [] ; @field_schemas ||= {}\n @field_names = @field_names | [name]\n schema = schema.symbolize_keys.merge({ :name => name })\n #\n # FIXME: this is terrible, especially given what's in TypeFactory anyway.\n #\n schema[:type] =\n case\n when type == Hash && schema.has_key?(:values) then Icss::Meta::TypeFactory.receive({ :type => :hash, :values => schema.delete(:values)})\n when type == Array && schema.has_key?(:items) then Icss::Meta::TypeFactory.receive({ :type => :array, :items => schema.delete(:items) })\n when type == Hash then IdenticalHashFactory\n when type == Array then IdenticalArrayFactory\n else\n Icss::Meta::TypeFactory.receive(type)\n end\n fld = (field_schemas[name] || make_field_schema).merge(schema)\n fld[:parent] = self\n @field_schemas[name] = fld\n end",
"def add_record(record)\n return unless allow_indexing?(record)\n\n condensed_record = condense_record(record)\n atoms = add_occurences(condensed_record, record.id)\n\n @storage.add(atoms)\n end",
"def after_create_save(record)\n if (nested? && nested.scope)\n parent = nested_parent_record(:read)\n record.send(\"#{nested.scope}\").send(:<<, parent) unless parent.nil?\n end\n end",
"def after_create_save(record)\n if nested? && nested.scope\n parent = nested_parent_record(:read)\n record.send(nested.scope.to_s).send(:<<, parent) unless parent.nil?\n end\n end",
"def add_record(record)\n condensed_record = condense_record(record)\n load_atoms(condensed_record)\n add_occurences(condensed_record,record.id)\n @records_size += 1\n end",
"def record(out, field_name, module_name, record_name)\n record_name = invalid_names[record_name] || record_name\n out << \" #{record_name.downcase()} :#{field_name}\\n\"\n end",
"def field(ffield, length, sourcetag, default = nil, &block)\n @fields << {\n afield: ffield,\n length: length, \n stag: sourcetag,\n default: default,\n block: block\n }\n end",
"def with_global_nested_field(&block)\n @parent_nested_field = RequestStore.store[GLOBAL_NESTED_FIELD_KEY]\n RequestStore.store[GLOBAL_NESTED_FIELD_KEY] = self\n\n block.call.tap do\n RequestStore.store[GLOBAL_NESTED_FIELD_KEY] = @parent_nested_field\n end\n end",
"def field(name, options={}, &block)\n field = AppKit::Field.new(model, name, options, &block)\n fields << field\n end",
"def update_field(field_name, &block)\n latest = Transaction.current.updated(self).record\n vector = increment_vector_clock(latest['_flowHeader']['vectorClock'])\n header = latest['_flowHeader'].merge('vectorClock' => vector)\n version = {\n 'lastWriterID' => Flow.peer_id,\n 'vectorClockSum' => vector.inject(0) {|sum, entry| sum + entry['count'] }\n }\n new_value = yield version\n self.class.new(latest.merge('_flowHeader' => header, field_name => new_value))\n end",
"def field(spec, name = nil, data_lambda = nil)\n @field_specs << spec\n add_field(name, data_lambda)\n end",
"def add_field(name, type, options={})\n name = name.to_s\n \n # preconditions\n raise InvalidModelField.new(\"Duplicate field name\") if record_fields.key?(name)\n raise InvalidModelField.new(\"Type must be a known yodel field type\") unless valid_type?(type)\n raise InvalidModelField.new(\"Field name cannot start with an underscore\") if name.start_with?('_')\n \n # add the field to the model and subclasses\n field_type = Field.field_from_type(type.to_s)\n field = field_type.new(name, deep_stringify_keys(options.merge(type: type.to_s)))\n RecordIndex.add_index_for_field(self, field) if field.index?\n record_fields[name] = field\n end",
"def add_field(name, data_lambda = nil)\n name = next_unknown_field_name if name.nil?\n @fields << name.to_sym\n @lambdas[name.to_sym] = data_lambda if data_lambda\n end",
"def each(&block)\n @fields.each(&block)\n end",
"def new_record(klass, &block)\n new_records(klass, 1, &block).first\n end",
"def extend_schema(schema, file = nil, &block)\n Rubyrel::DDL::extend_schema(schema, file, &block)\n end",
"def add_field(name, sample_name, container_name, role, opts)\n raise \"Can't add field to #{self.class} before it has been saved.\" unless id\n\n sample_names = sample_name.nil? || sample_name.is_a?(String) ? [sample_name] : sample_name\n container_names = container_name.nil? || container_name.is_a?(String) ? [container_name] : container_name\n\n ft = field_types.create({ parent_id: id, name: name, ftype: 'sample', role: role }.merge(opts))\n ft.save\n\n if sample_names\n (0..sample_names.length - 1).each do |i|\n sample = SampleType.find_by(name: sample_names[i]) if sample_names[i].present?\n container = ObjectType.find_by(name: container_names[i]) if container_names[i].present?\n\n ft.allowable_field_types.create(\n sample_type_id: sample ? sample.id : nil,\n object_type_id: container ? container.id : nil\n )\n end\n end\n\n self\n end",
"def field(label = nil, note = nil, &contents)\n @fields << Field.new(:label => label, :note => note, &contents)\n end",
"def yield_record\n if @record[:record].valid?\n @block.call(@record[:record])\n elsif @error_handler\n @error_handler.call(self, @record[:record], @block)\n else\n raise MARC::RecordException, @record[:record]\n end\n ensure\n @record[:record] = nil\n end",
"def pack(record, generate = false)\n vals = []\n # for each property, get the value\n # or generate one if there is a lambda/default value\n record.each_pair do |key, value|\n # if the value is nil and there is a lambda\n # generate it\n next if ignored?(key)\n\n if generate and value.nil?\n l = lambdas[key]\n if l\n if l.is_a?(Proc)\n # it's a proc. invoke it.\n value = l.call if l.is_a?(Proc)\n else\n value = l\n end\n end\n end\n # in general it would be inconsistent to flatten legitimate field values\n # (e.g. in case the value was actually nil or an array), however we know\n # that these are never legitimate field values so it must have been\n # explicitly set in order to support composite fields (or the user is crazy)\n if !value.nil?\n if value.is_a?(Array)\n vals += value\n else\n vals << value\n end\n end\n end\n\n packed = vals.pack(field_spec_string)\n raise \"Packed struct size #{packed.length} does not match struct size: \" + size.to_s if packed.length != size\n packed\n end",
"def insert_record(record, validate = true, raise = false, &block)\n if raise\n record.save!(validate: validate, &block)\n else\n record.save(validate: validate, &block)\n end\n end",
"def add_fields(fields)\n\t\tend",
"def addRecord(rec); @records[rec.key] = rec end",
"def each\n if block_given?\n while @parser.has_next?\n event = @parser.pull\n # if it's the start of a record element\n if event.start_element? && (strip_ns(event[0]) == \"record\")\n yield build_record\n end\n end\n else\n enum_for(:each)\n end\n end",
"def add_fields(fields, inline, embed = Discordrb::Webhooks::Embed.new)\n if fields.respond_to?(:each)\n fields.each do |field|\n embed.add_field(:name => field[:name].to_s, :value => field[:value].to_s, :inline => !inline.nil?)\n end\n embed\n else false end\n end",
"def as_block\n lambda do |rec|\n call(rec)\n end\n end",
"def add_record(value)\n @children['record'][:value] << value\n end",
"def add_record(value)\n @children['record'][:value] << value\n end",
"def define_schema\n yield schema if block_given?\n end",
"def field(model_attrib_sym, options = {}, &block)\n field_manager.add(scope, model_attrib_sym, options, &block)\n end",
"def wrap(object, &block)\n self.class.wrap(object, current_schema: current_schema, &block)\n end",
"def add_field!(field_name, value = T.unsafe(nil)); end",
"def db_column_func(&block)\n new_structure = self.class.db_structure\n\n yield(new_structure)\n self.class.update_db(new_structure)\n new_structure\n end",
"def add_field(field)\n\t\tend",
"def construct_target_record(row)\n record=(0..filtered_target_fields.size-1).collect do |index|\n field = filtered_target_fields[index]\n value = row[index]\n value = 'NULL' if value.nil?\n (filtered_map[field].class.name == \"Array\" ? filtered_map[field][1].call(value) : value)\n end\n embed_string_in_quotes(record)\n end",
"def field(*params)\n config = params.extract_options!\n config.assert_valid_keys(*::Schemaless::Field::VALID_OPTS)\n type = config.delete(:type)\n type ||= params.size > 1 ? params.pop : :string # TBD\n name = params.join\n schemaless_fields <<\n ::Schemaless::Field.new(name, type, config)\n end",
"def semantic_fields_for(name, *args, &block)\n use_semantic_builder(:fields_for, name, *args, &block)\n end",
"def set_metadata record_or_hash\n if record_or_hash.is_a?(Hash)\n hash = record_or_hash\n else\n record = record_or_hash\n end\n\n @metatags = helpers.metatags(record)\n @metatags = hash.reverse_merge(@metatags) unless hash.nil?\n @structured_data = helpers.structured_data(record)\n end",
"def set_metadata record_or_hash\n if record_or_hash.is_a?(Hash)\n hash = record_or_hash\n else\n record = record_or_hash\n end\n\n @metatags = helpers.metatags(record)\n @metatags = hash.reverse_merge(@metatags) unless hash.nil?\n @structured_data = helpers.structured_data(record)\n end",
"def process(record, &emit)\n yield record\n end",
"def create_record(attributes, raise_error = false)\n record = build_record(attributes)\n yield(record) if block_given?\n saved = record.save\n set_new_record(record)\n raise RecordInvalid.new(record) if !saved && raise_error\n record\nend",
"def create_record(attributes, raise_error = false)\n record = build_record(attributes)\n yield(record) if block_given?\n saved = record.save\n set_new_record(record)\n raise RecordInvalid.new(record) if !saved && raise_error\n record\nend",
"def renderRec(model, rec, result)\n nameSpace, base = assertNamespace(rec.name)\n L.info(\"Rendering record #{rec.name}\")\n result << %<\nmessage #{base} {\n>\n pbInt = 1\n rec.fields.each_key { | fldId|\n fld = rec.fields[fldId]\n ty = fld.dataType.type\n if fld.aggr && !fld.map?\n result << \"#{INDENT}repeated #{protoType(fld.dataType, model, rec)} #{fldId} = #{pbInt};\\n\"\n elsif fld.map?\n raise ArgumentError, %<Field \"#{fldId}\" of the rec \"#{base}\": for Protobuf, map can not be optional, it must be required> unless fld.isRequired\n result << \"#{INDENT}map<#{protoType(fld.dataType, model, rec)}, #{protoType(fld.trgType, model, rec)}> #{fldId} = #{pbInt};\\n\"\n elsif model.enums[ty] && model.enums[ty].is_a?(DataMetaDom::Mapping)\n raise ArgumentError, %<Field \"#{fldId}\" of the rec \"#{base}\": for Protobuf, map can not be optional, it must be required> unless fld.isRequired\n result << \"#{INDENT}map<#{protoType(model.enums[ty].fromT, model, rec)}, #{protoType(model.enums[ty].toT, model, rec)}> #{fldId} = #{pbInt};\\n\"\n elsif fld.isRequired\n result << \"#{INDENT}#{protoType(fld.dataType, model, rec)} #{fldId} = #{pbInt};\\n\"\n else\n result << \"#{INDENT}repeated #{protoType(fld.dataType, model, rec)} #{fldId} = #{pbInt};\\n\"\n end\n pbInt += 1\n }\n result << %q<}\n>\n end",
"def update_field_records(fsa, fieldset_child, value)\n # do nothing\n end",
"def add_record(name, record)\n klass_map = self.object_map[self.models[record.class]]\n\n # Panic if attempted to insert duplicate fixture record.\n if klass_map.include?(name.to_sym)\n raise \"Duplicate fixture for #{record.class} - #{name}\"\n end\n\n self.fixture_name_map[record] = name.to_s\n klass_map[name.to_sym] = record\n dot\n\n return record\n end",
"def create_record(line, line_number = -1) #:nodoc:\n h = Hash.new\n\n pack_format = self.class.get_subclass_variable 'pack_format'\n fields = self.class.get_subclass_variable 'fields'\n\n f = line.unpack(pack_format)\n (0..(fields.size-1)).map do |index|\n unless fields[index].is_padding?\n h.store fields[index].name, fields[index].pass_through_filters(f[index])\n end\n end\n Record.new(self.class, h, line_number)\n end",
"def each( &block )\n return self.fields.each( &block ) if block\n self.fields.each\n end",
"def create(record)\n raise Octothorpe::BadHash if record.nil?\n ot = Octothorpe.new(record)\n\n if id_ai\n ot = ot.reject{|k,_| k == id_fld}\n else\n raise(ArgumentError, \"ID field missing from record\") if ot[id_fld].nil?\n end\n\n sql, vals = sql_insert(ot)\n x = select sql_subst(sql, *vals.map{|v| quote v})\n x.first[id_fld]\n\n rescue Octothorpe::BadHash\n raise ArgumentError, \"Bad type for record parameter\"\n rescue\n handle_error $!\n end",
"def build_record\n record = MARC::Record.new\n data_field = nil\n control_field = nil\n subfield = nil\n text = \"\"\n attrs = nil\n if Module.constants.index(\"Nokogiri\") && @parser.is_a?(Nokogiri::XML::Reader)\n datafield = nil\n cursor = nil\n open_elements = []\n @parser.each do |node|\n if node.value? && cursor\n if cursor.is_a?(Symbol) && (cursor == :leader)\n record.leader = node.value\n else\n cursor.value = node.value\n end\n cursor = nil\n end\n next unless node.namespace_uri == @ns\n if open_elements.index(node.local_name.downcase)\n open_elements.delete(node.local_name.downcase)\n next\n else\n open_elements << node.local_name.downcase\n end\n case node.local_name.downcase\n when \"leader\"\n cursor = :leader\n when \"controlfield\"\n record << datafield if datafield\n datafield = nil\n control_field = MARC::ControlField.new(node.attribute(\"tag\"))\n record << control_field\n cursor = control_field\n when \"datafield\"\n record << datafield if datafield\n datafield = nil\n data_field = MARC::DataField.new(node.attribute(\"tag\"), node.attribute(IND1), node.attribute(IND2))\n datafield = data_field\n when \"subfield\"\n raise \"No datafield to add to\" unless datafield\n subfield = MARC::Subfield.new(node.attribute(CODE))\n datafield.append(subfield)\n cursor = subfield\n when \"record\"\n record << datafield if datafield\n return record\n end\n end\n\n else\n while @parser.has_next?\n event = @parser.pull\n\n if event.text?\n text += REXML::Text.unnormalize(event[0])\n next\n end\n\n if event.start_element?\n text = \"\"\n attrs = event[1]\n case strip_ns(event[0])\n when \"controlfield\"\n text = \"\"\n control_field = MARC::ControlField.new(attrs[TAG])\n when \"datafield\"\n text = \"\"\n data_field = MARC::DataField.new(attrs[TAG], attrs[IND1],\n attrs[IND2])\n when \"subfield\"\n text = \"\"\n subfield = MARC::Subfield.new(attrs[CODE])\n end\n end\n\n if event.end_element?\n case strip_ns(event[0])\n when \"leader\"\n record.leader = text\n when \"record\"\n return record\n when \"controlfield\"\n control_field.value = text\n record.append(control_field)\n when \"datafield\"\n record.append(data_field)\n when \"subfield\"\n subfield.value = text\n data_field.append(subfield)\n end\n end\n end\n end\n end",
"def field(spec, name = nil, data_lambda = nil)\n add_field Field.new(String, spec, name || next_unknown_field_name, data_lambda)\n end",
"def <<(fields)\n add_row(fields)\n end",
"def each_record\n return enum_for(:each_record) unless block_given?\n\n while (rec = record)\n yield rec\n end\n end",
"def add_section(name, *fields)\n send(\"#{name}=\", Struct.new(*fields).new)\n end",
"def test_record_accepts_a_block\n payload = generate_payload\n @event_aggregator.record(priority: 0.5) { TransactionEventPrimitive.create(payload) }\n\n assert_equal 1, last_transaction_events.size\n end",
"def add(field, val, boost=nil)\n return if val == nil\n return if val == ''\n if val.is_a? Array\n val.each {|v| self.add(field, v)}\n else\n self.addField(field, val)\n end\n self.boost = boost if boost\n end",
"def each_record(table, &block)\n columns = nil\n read_each(table) do |line|\n if columns\n yield Hash[columns.zip(line)]\n else\n columns = line.map(&:to_sym)\n end\n end\n end",
"def add(record)\n @server.add record.class.name, record.to_doc\n end",
"def to_field(field_name, aLambda = nil, &block)\n @index_steps << ToFieldStep.new(field_name, aLambda, block, Traject::Util.extract_caller_location(caller.first) )\n end",
"def to_field(field_name, aLambda = nil, &block)\n @index_steps << ToFieldStep.new(field_name, aLambda, block, Traject::Util.extract_caller_location(caller.first) )\n end",
"def write(record)\n case record\n when FlatKit::Jsonl::Record\n write_record(record)\n when FlatKit::Record\n converted_record = ::FlatKit::Jsonl::Record.from_record(record)\n write_record(converted_record)\n else\n raise FlatKit::Error, \"Unable to write records of type #{record.class}\"\n end\n rescue FlatKit::Error => fe\n raise fe\n rescue => e\n ::FlatKit.logger.error \"Error reading jsonl records from #{output.name}: #{e}\"\n raise ::FlatKit::Error, e\n end",
"def each_record(aLambda = nil, &block)\n @index_steps << EachRecordStep.new(aLambda, block, Traject::Util.extract_caller_location(caller.first) )\n end",
"def each_record(aLambda = nil, &block)\n @index_steps << EachRecordStep.new(aLambda, block, Traject::Util.extract_caller_location(caller.first) )\n end",
"def each(&block)\n @fields.each do |f|\n n = f.name\n yield(n, @values[n])\n end\n self\n end",
"def map_record(record)\n context = Context.new(:source_record => record, :settings => settings)\n map_to_context!(context)\n return context.output_hash\n end",
"def map_record(record)\n context = Context.new(:source_record => record, :settings => settings)\n map_to_context!(context)\n return context.output_hash\n end",
"def push(fieldlet)\n \t\tfield = @fields[fieldlet.class::FIELD_ID].last\n \t\tif field && field.instance_id == fieldlet[:instance_id]\n \t\t\treturn field << fieldlet\n \t\tend \n \n \t\tfield = fieldlet.class::FIELD.new(@entity)\n \t\tfield << fieldlet\n \n \t\t@fields[fieldlet.class::FIELD_ID] << field\n \n return field\n \tend",
"def add_field(identifier, value = nil)\n @fields << build_field(identifier, value)\n end",
"def render_field_with_block(label, &block)\n content = with_output_buffer(&block)\n render_field_content(label, content)\n end",
"def add_field!(field_name, value = nil)\n fields << Field.new({'name' => field_name}, value)\n end",
"def entry_fields(rec, user:, serialize: JSON_SERIALIZE)\n user = user_id(user) unless user.is_a?(Integer)\n ed = rec.emma_metadata(refresh: true)\n fd = rec.file_data\n mime = fd&.deep_symbolize_keys&.dig(:metadata, :mime_type)\n fmt = mime_to_fmt(mime)\n ext = fmt_to_ext(fmt)\n {\n user_id: user,\n repository: ed[:emma_repository],\n submission_id: ed[:emma_repositoryRecordId],\n fmt: ed[:dc_format] || FileFormat.metadata_fmt(fmt),\n ext: ext,\n state: 'completed',\n phase: 'create',\n file_data: (serialize ? fd.to_json : fd),\n emma_data: (serialize ? ed.to_json : ed),\n }\n end",
"def _create_record(&block)\n attributes_values = changes.map{|k, v| [k.to_sym, v.last]}.to_h\n attributes_values.delete(:Id)\n\n new_id = self.class.unscoped.insert attributes_values\n self.id ||= new_id if self.class.primary_key\n\n @new_record = false\n\n yield(self) if block_given?\n\n id\n end",
"def structure(name, &block)\n if existing = @base.structures.select { |s| s.name == name }.first\n structure = existing\n else\n structure = Moonrope::Structure.new(@base, name)\n @base.structures << structure\n end\n structure.dsl.instance_eval(&block) if block_given?\n structure\n end",
"def each_field(&blk)\n each do |k,v|\n str_v = if field_def(k).multivalued?\n v.join(', ')\n else\n v.to_s\n end\n\n yield k, str_v\n end\n end",
"def instance_fields(&block)\n @fields.each { |field| block[field] }\n @super_class.instance_fields(&block) if @super_class\n end",
"def new_line_type(record)\n @record_types ||= {}\n @record_order ||= []\n\n raise ArgumentError, \"Line type #{record.name} is already defined\" if @record_types.include?(record.name)\n\n @record_types[record.name] = record\n @record_order << record\n\n record\n end",
"def fields_from_record(options = {})\n field_attributes = _filter_field_attributes(options)\n field_attributes += [ options.fetch(:include, []) ]\n field_attributes.flatten!\n field_attributes.compact!\n field_attributes.uniq!\n\n field_attributes = field_attributes.inject({}) do |hash, field|\n if _protobuf_field_transformers.has_key?(field)\n hash[field] = _protobuf_field_transformers[field].call(self)\n else\n value = respond_to?(field) ? __send__(field) : nil\n hash[field] = _protobuf_convert_attributes_to_fields(field, value)\n end\n hash\n end\n\n field_attributes\n end",
"def request_schema(&block)\n request_class = const_defined?(:Request) ? const_get(:Request) : const_set(:Request, Class.new { include ::Proper::Api::Entity })\n request_class.schema(fields: true) do |s|\n s.instance_eval(&block)\n end\n end",
"def process_field(child)\n if ['complexContent', 'simpleContent', 'sequence', 'group', 'choice', 'extension', 'restriction'].include?(child.name)\n child.elements.each {|grandchild| process_field(grandchild)}\n elsif child.name == 'element'\n element = Element.new(child, self.schema, self)\n @elements[element.name] = element\n elsif child.name == 'attribute'\n attribute = Attribute.new(child, self.schema, self)\n @attributes[attribute.name] = attribute\n elsif child.name == 'complexType'\n type = ComplexType.build(child, self.schema)\n @types[type.name] = type\n elsif child.name == 'simpleType'\n type = SimpleType.build(child, self.schema)\n @types[type.name] = type\n elsif child.name == 'anyAttribute'\n @special_fields << SpecialField.new(\"##anyAttribute\")\n elsif child.name == 'anyElement'\n @special_fields << SpecialField.new(\"##anyElement\")\n elsif child.name == 'attributeGroup'\n # The only special case here...essentially we'll' transparently roll attribute groups into parent nodes,\n # while at the schema level global attribute groups get created as a type\n if self.kind_of?(Schema)\n type = ComplexType.build(child, self.schema)\n @types[type.name] = type\n else\n Type.find(child.attributes['ref'].value, nil, stix_version).attributes.each {|attrib| @attributes[attrib.name] = attrib}\n end\n else\n $logger.debug \"Skipping: #{child.name}\" if defined?($logger)\n end\n end",
"def record_fields\n mappings = {}\n if log_record?\n Rails.logger.debug(\"Aeon Fulfillment Plugin\") { \"Mapping Record: #{self.record}\" }\n end\n\n mappings['identifier'] = self.record.identifier || self.record['identifier']\n mappings['publish'] = self.record['publish']\n mappings['level'] = self.record.level || self.record['level']\n mappings['title'] = strip_mixed_content(self.record['title'])\n mappings['uri'] = self.record.uri || self.record['uri']\n\n resolved_resource = self.record['_resolved_resource'] || self.record.resolved_resource\n if resolved_resource\n resource_obj = resolved_resource[self.record['resource']]\n if resource_obj\n collection_id_components = [\n resource_obj[0]['id_0'],\n resource_obj[0]['id_1'],\n resource_obj[0]['id_2'],\n resource_obj[0]['id_3']\n ]\n\n mappings['collection_id'] = collection_id_components\n .reject {|id_comp| id_comp.blank?}\n .join('-')\n\n mappings['collection_title'] = resource_obj[0]['title']\n end\n end\n\n resolved_repository = self.record.resolved_repository\n if resolved_repository\n mappings['repo_code'] = resolved_repository['repo_code']\n mappings['repo_name'] = resolved_repository['name']\n end\n\n if self.record['creators']\n mappings['creators'] = self.record['creators']\n .select { |cr| cr.present? }\n .map { |cr| cr.strip }\n .join(\"; \")\n end\n\n if self.record.dates\n mappings['date_expression'] = self.record.dates\n .select{ |date| date['date_type'] == 'single' or date['date_type'] == 'inclusive'}\n .map{ |date| date['final_expression'] }\n .join(';')\n end\n\n if (self.record.notes['userestrict'])\n mappings['userestrict'] = self.record.notes['userestrict']\n .map { |note| note['subnotes'] }.flatten\n .select { |subnote| subnote['content'].present? and subnote['publish'] == true }\n .map { |subnote| subnote['content'] }.flatten\n .join(\"; \") \n end\n \n mappings\n end"
] |
[
"0.59745246",
"0.59244794",
"0.59064597",
"0.5882015",
"0.5728995",
"0.55676645",
"0.55551004",
"0.55478865",
"0.5523331",
"0.5452229",
"0.535457",
"0.53500193",
"0.5318665",
"0.53053296",
"0.5280825",
"0.5272067",
"0.52714926",
"0.52476114",
"0.5243147",
"0.5241524",
"0.5202088",
"0.5196849",
"0.51467115",
"0.51311773",
"0.5128846",
"0.5107511",
"0.51071423",
"0.5092013",
"0.507015",
"0.5016468",
"0.500572",
"0.50054264",
"0.4995372",
"0.49931037",
"0.4983215",
"0.49659058",
"0.49598226",
"0.49584267",
"0.49502116",
"0.4924693",
"0.49240515",
"0.49237564",
"0.4923559",
"0.49233317",
"0.49052638",
"0.48918673",
"0.4889693",
"0.4861149",
"0.4861149",
"0.48605785",
"0.48567316",
"0.48394513",
"0.48312256",
"0.48274636",
"0.48109868",
"0.47951618",
"0.4778946",
"0.47716525",
"0.4771478",
"0.47707543",
"0.47698635",
"0.4759221",
"0.4759221",
"0.4759121",
"0.47558907",
"0.47401157",
"0.4739679",
"0.47363353",
"0.47342673",
"0.47153404",
"0.47121477",
"0.47004744",
"0.4689529",
"0.468685",
"0.46837834",
"0.46789014",
"0.46767554",
"0.46765557",
"0.46625888",
"0.46625888",
"0.4662111",
"0.46515715",
"0.46515715",
"0.46501014",
"0.46434167",
"0.46434167",
"0.46388108",
"0.46362785",
"0.46313617",
"0.4620976",
"0.46080568",
"0.46077895",
"0.46050486",
"0.45983645",
"0.45978126",
"0.45939946",
"0.45918712",
"0.45903563",
"0.45888928",
"0.4588561"
] |
0.6552268
|
0
|
==Execute db migration tasks pdm database migrate up|down|reset PATH/TO/STEP1 PATH/TO/STEP2 task: up/down/reset/backup
|
def migrate(task, *step_files)
step_files = begin
Dir[File.join(File.dirname(__FILE__),"../../migrate/*.rb")]
end if step_files.empty?
establish! do
step_files.each do |step_file|
require step_file
File.basename(step_file) =~ /(.*)\.rb$/
migration = $1.camelize.constantize
step = migration.new
case task.to_s
when "up"
step.up unless step.migrated?
when "reset"
step.reset if step.migrated?
when "down"
step.down if step.migrated?
when "backup"
step.backup(options) if step.migrated?
else
raise "Unsupported sub command: #{task}"
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def migrate\n run_migrations pending_migrations, :up\n end",
"def migrate\n with_maintenance do\n backup if backup?\n run_migration\n restart\n end\n end",
"def migrate\n puts 'Migrating DBs on containers'\n puts Open3.capture3(\"pushd #{dot_futureadvisor} 2>&1; ./bin/dev restart 2>&1; popd 2>&1\")\n end",
"def do_migrations\n migration_path = File.join(\"generators\", \"talia\", \"templates\", \"migrations\")\n ActiveRecord::Migrator.migrate(migration_path, ENV[\"VERSION\"] ? ENV[\"VERSION\"].to_i : nil )\n end",
"def run_migrate\n manage_py_execute('migrate', '--noinput') if new_resource.migrate\n end",
"def rollback(step = 1)\n files = File.migrated.reverse.first(step)\n Migrate::Down.new(files).perform\n end",
"def upgrade(migrations, context, meta_node)\n migrations.each do |m|\n Neo4j.logger.info \"Running upgrade: #{m}\"\n m.execute_up(context, meta_node)\n end\n end",
"def start\n migration_task.update!(:state => 'migrate')\n handover_to_automate\n queue_signal(:poll_automate_state_machine)\n end",
"def run(*migration_classes)\n opts = migration_classes.extract_options!\n dir = opts[:direction] || :up\n dir = (dir == :down ? :up : :down) if opts[:revert]\n if reverting?\n # If in revert and going :up, say, we want to execute :down without reverting, so\n revert { run(*migration_classes, direction: dir, revert: true) }\n else\n migration_classes.each do |migration_class|\n migration_class.new.exec_migration(@connection, dir)\n end\n end\n end",
"def apply(db, direction, filename)\n raise(ArgumentError, \"Invalid migration direction specified (#{direction.inspect})\") unless %i[up down].include?(direction)\n\n @script = ['BEGIN;']\n prok = public_send(direction)\n return unless prok\n\n instance_exec(&prok)\n @script << if direction == :up\n \"INSERT INTO menu_migrations (filename) VALUES('#{filename}');\"\n else\n \"DELETE FROM menu_migrations WHERE filename = '#{filename}';\"\n end\n @script << 'COMMIT;'\n\n puts \"- #{direction == :up ? 'Applying' : 'Reversing'}: #{filename}\" unless ENV['TEST_RUN']\n if @dry_run\n puts @script.join(\"\\n\") unless ENV['TEST_RUN']\n @script\n else\n db.execute(@script.join(\"\\n\"))\n end\n end",
"def up\n Build.where(stage_id: nil).each_batch(of: BATCH_SIZE) do |relation, index|\n relation.each_batch(of: RANGE_SIZE) do |relation|\n range = relation.pluck('MIN(id)', 'MAX(id)').first\n\n BackgroundMigrationWorker\n .perform_in(index * 2.minutes, MIGRATION, range)\n end\n end\n end",
"def migrate(version = nil)\n @logger.fine('Running test migrations...')\n super(File.join(Automation::FRAMEWORK_ROOT, Automation::FET_DIR, 'test/database/migrations'), version)\n end",
"def run\n load_migrations\n @migrations.each do |mig_class, version|\n mig_class.up\n # Add it to the schema_migrations table as well\n # This will fail if auto-migrations is only and always used,\n # as the schema_migrations table will not exist.\n SchemaMigration.find_or_create_by_version(version) rescue nil\n end\n end",
"def up(&block)\n migration.up = block\n end",
"def migration\n end",
"def migrate\n count = 0\n client.token = kv.read(root_key_prefix, shard: 'root') if client.token.nil?\n with_lock do\n Dir[\"#{path}/*.rb\"].each do |file|\n version, class_name = parse_migration(file)\n next if latest >= version\n puts \"Starting migration #{file}\"\n count += 1\n require file\n klass = Object.const_get(\"::#{class_name}\")\n klass.new(client, fig, kv).migrate\n\n # All of the client methods will properly raise exceptions, which will\n # halt this loop. We don't want to swallow that backtrace so we'll just\n # let the error pass along\n update_version(version)\n end\n end\n if count.positive?\n puts \"Ran #{count} migration#{'s' unless count == 1 }.\"\n else\n puts \"No migrations to run. Up to date\"\n end\n end",
"def migrate(direction)\n return unless respond_to?(direction)\n\n case direction\n when :up then announce \"running\"\n when :down then announce \"reverting\"\n end\n\n time = nil\n ActiveRecord::Base.connection_pool.with_connection do |conn|\n time = Benchmark.measure do\n exec_migration(conn, direction)\n end\n end\n\n case direction\n when :up then announce \"ran (%.4fs)\" % time.real; write\n when :down then announce \"reverted (%.4fs)\" % time.real; write\n end\n end",
"def migrate\n maintenance = Heroku::PgMigrate::Maintenance.new(api, app)\n scale_zero = Heroku::PgMigrate::ScaleZero.new(api, app)\n rebind = Heroku::PgMigrate::RebindConfig.new(api, app)\n provision = Heroku::PgMigrate::Provision.new(api, app)\n foi_pgbackups = Heroku::PgMigrate::FindOrInstallPgBackups.new(api, app)\n transfer = Heroku::PgMigrate::Transfer.new(api, app)\n check_shared = Heroku::PgMigrate::CheckShared.new(api, app)\n release_num = Heroku::PgMigrate::ReleaseNumber.new(api, app)\n\n mp = Heroku::PgMigrate::MultiPhase.new()\n mp.enqueue(check_shared)\n mp.enqueue(foi_pgbackups)\n mp.enqueue(provision)\n mp.enqueue(release_num)\n mp.enqueue(maintenance)\n mp.enqueue(scale_zero)\n mp.enqueue(transfer)\n mp.enqueue(rebind)\n\n mp.engage()\n end",
"def migrate!\n @logger.fine('Dropping schema...')\n\n migrate(0) # migrate to version 0.\n migrate # migrate to latest version.\n end",
"def migrate(direction)\n return unless respond_to?(direction)\n\n case direction\n when :up then announce \"migrating\"\n when :down then announce \"reverting\"\n end\n\n time = nil\n ActiveRecord::Base.connection_pool.with_connection do |conn|\n time = Benchmark.measure do\n exec_migration(conn, direction)\n end\n end\n\n case direction\n when :up then announce \"migrated (%.4fs)\" % time.real; write\n when :down then announce \"reverted (%.4fs)\" % time.real; write\n end\n end",
"def run_migrations\n unless options[\"no-migrate\"]\n puts \"Running rake db:migrate\"\n `rake db:migrate`\n end\n end",
"def run_migration_file partial_filename, direction=:up\n id = get_migration_id partial_filename\n \"rake db:migrate:#{direction.to_s} VERSION=#{id}\"\n end",
"def run(direction, database, version)\n Tenant.switch(database) do\n if activerecord_below_5_2?\n ActiveRecord::Migrator.run(direction, ActiveRecord::Migrator.migrations_paths, version)\n else\n ActiveRecord::Base.connection.migration_context.run(direction, version)\n end\n end\n end",
"def run_migrations\n return unless pending_migrations?\n callback(:run_migrations) do\n notify(:run_migrations)\n heroku.run_migrations\n end\n end",
"def migrate!\n Migrator.migrate(name)\n end",
"def migrate!\n Migrator.migrate(name)\n end",
"def dbmigrate!\n ActiveRecord::Base.establish_connection(PuppetHerald.database.spec)\n ActiveRecord::Migrator.up 'db/migrate'\n ActiveRecord::Base.clear_active_connections!\n nil\n end",
"def deploy\n\t# This task is typiclly run after the site is updated but before the server is restarted.\n\tcall 'migrate'\nend",
"def downgrade(migrations, context, meta_node)\n migrations.each do |m|\n Neo4j.logger.info \"Running downgrade: #{m}\"\n m.execute_down(context, meta_node)\n end\n end",
"def auto_migrate!(repository_name = nil)\n auto_migrate_down!(repository_name)\n auto_migrate_up!(repository_name)\n end",
"def migrate\n ActiveRecord::Migrator.migrate(File.join(db_dir, \"migrate\"))\n end",
"def install_migrations\n rake(\"maintenance_tasks:install:migrations\")\n rake(\"db:migrate\")\n end",
"def run_migration\n return unless allow_migrations && db_migration_schema != DefaultMigrationSchema\n\n puts \"Running migration from #{db_migration_dirname}\"\n Rails.logger.warn \"Running migration from #{db_migration_dirname}\"\n\n Timeout.timeout(60) do\n # Outside the current transaction\n Thread.new do\n ActiveRecord::Base.connection_pool.with_connection do\n self.class.migration_context(db_migration_dirname).migrate\n # Don't dump until a build, otherwise differences in individual development environments\n # force unnecessary and confusing commits\n # pid = spawn('bin/rake db:structure:dump')\n # Process.detach pid\n end\n end.join\n end\n\n self.class.tables_and_views_reset!\n\n true\n rescue StandardError => e\n FileUtils.mkdir_p db_migration_failed_dirname\n FileUtils.mv @do_migration, db_migration_failed_dirname\n raise FphsException, \"Failed migration for path '#{db_migration_dirname}': #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n rescue FphsException => e\n FileUtils.mkdir_p db_migration_failed_dirname\n FileUtils.mv @do_migration, db_migration_failed_dirname\n raise FphsException, \"Failed migration for path '#{db_migration_dirname}': #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end",
"def run\n connect\n src = @source_connection\n dest = @destination_connection\n\n log \"BEGINNING MIGRATION\\n\" +\n \"-------------------\"\n\n # Iterate through table mappings\n maps.each do |table|\n log \"MIGRATING TABLE #{table.source}\"\n\n # Fetch all rows from source table\n rows = src[table.source.to_sym].all\n \n # Iterate through the records and migrate each one\n rows.each do |row|\n new_record = {}\n\n # Identify the columns we need to grab data from\n table.maps.each do |column|\n new_record.merge!(\n column.destination.to_sym => row[column.source.to_sym]\n )\n end\n\n # Insert new record to destination table\n log \" -> Inserting record into #{table.destination}\"\n dest[table.destination.to_sym].insert(new_record)\n end\n end\n\n log \"-------------------\\n\" +\n \"MIGRATION COMPLETED\"\n end",
"def run_local_migrations()\n setup_local_environment\n # Runs migrations against the local database.\n common = Common.new\n Dir.chdir('db') do\n common.run_inline %W{./run-migrations.sh main}\n end\n Dir.chdir('db-cdr/generate-cdr') do\n common.run_inline %W{./init-new-cdr-db.sh --cdr-db-name cdr}\n end\n common.run_inline %W{gradle :loadConfig -Pconfig_key=main -Pconfig_file=config/config_local.json}\n common.run_inline %W{gradle :loadConfig -Pconfig_key=cdrBigQuerySchema -Pconfig_file=config/cdm/cdm_5_2.json}\n common.run_inline %W{gradle :loadConfig -Pconfig_key=featuredWorkspaces -Pconfig_file=config/featured_workspaces_local.json}\n common.run_inline %W{gradle :updateCdrConfig -PappArgs=['config/cdr_config_local.json',false]}\nend",
"def up\n end",
"def migrate!\n connect! unless connected?\n Sequel.extension :migration\n Sequel::Migrator.run(db, File.join(__dir__, \"../../db/migrations\"), table: schema_table)\n end",
"def migrate_database(app_name, instance_name)\n Dir.chdir RailsPwnerer::Config[app_name, instance_name][:app_path] do\n # now migrate the database\n if File.exist?('Gemfile')\n Kernel.system 'bundle exec rake db:migrate RAILS_ENV=production'\n else\n Kernel.system 'rake db:migrate RAILS_ENV=production'\n end\n end\n end",
"def handover_to_automate\n migration_task.update_options(:workflow_runner => 'automate')\n end",
"def install_sequence\n stop\n \n backup_database\n install_pre_hook\n pre_migrate_database\n copy_files\n freeze_rails\n create_default_config_files\n fix_permissions\n create_directories\n create_initial_database\n set_initial_port_number\n expand_template_files\n \n migrate\n install_post_hook\n save\n \n run_rails_tests\n \n start\n end",
"def migrations\n rake 'admin:install:migrations'\n rake 'db:migrate SCOPE=admin'\n end",
"def reset_migrations!\n @migrations = nil\n @migrate_to = nil\n Neo4j::Transaction.run do\n Neo4j.ref_node[:_db_version] = nil\n end\n end",
"def apply\n migration.up\n end",
"def migrate(version = nil)\n pending = ->(_) { File.pending.map(&:version).include?(_) }\n migrated = ->(_) { File.migrated.map(&:version).include?(_) }\n\n case version\n when nil\n files = File.pending\n Migrate::Up.new(files).perform\n\n when pending\n files = File.pending.select { |f| f.version <= version }\n Migrate::Up.new(files).perform\n\n when migrated\n files = File.migrated.select { |f| f.version > version }.reverse\n Migrate::Down.new(files).perform\n\n else\n out.puts(\"Invalid Version: #{version} does not exist.\")\n end\n end",
"def up\n delete_queued_jobs(MIGRATION)\n\n requeue_background_migration_jobs_by_range_at_intervals(MIGRATION, DELAY_INTERVAL)\n end",
"def execute\n sessions.each_pair do |name, session|\n pending(name, session.with(safe: true, consistency: :strong)).each do |migration|\n migration.execute\n log_execution(migration, name)\n migration.mark_as_executed\n end\n end\n end",
"def run_migrations(manifest)\n\n # run bootstrap before user migrations to prepare database\n run_bootstrap\n\n # loop through the manifest, executing migrations in turn\n manifest.each_with_index do |migration, index|\n execute_migration(migration.name, migration.filepath)\n end\n\n end",
"def run_migration(&block)\n # Create a new migration class\n klass = Class.new(ActiveRecord::Migration[5.0])\n # Create a new `up` that executes the argument\n klass.send(:define_method, :up) { instance_exec(&block) }\n # Create a new instance of it and execute its `up` method\n klass.new.up\n end",
"def generate_migration options = {}\n options.to_options!\n chroot do\n before = Dir.glob \"./db/migrate/*\"\n n = Dir.glob(\"./db/migrate/*_bj_*\").size\n classname = \"BjMigration#{ n }\"\n util.spawn \"#{ Bj.ruby } ./script/generate migration #{ classname }\", options rescue nil\n after = Dir.glob \"./db/migrate/*\"\n candidates = after - before\n case candidates.size\n when 0\n false\n when 1\n generated = candidates.first\n open(generated, \"w\"){|fd| fd.puts Bj.table.migration_code(classname)}\n Bj.logger.info{ \"generated <#{ generated }>\" }\n generated\n else\n raise \"ambiguous migration <#{ candidates.inspect }>\"\n end\n end\n end",
"def auto_migrate!\n AutoMigrator.auto_migrate(name)\n end",
"def auto_migrate!\n AutoMigrator.auto_migrate(name)\n end",
"def migrate options = {}\n options.to_options!\n chroot do\n util.spawn \"rake RAILS_ENV=#{ Bj.rails_env } db:migrate\", options\n end\n end",
"def run_db_migrate_rake_task(rollback = false)\n run_custom_build_steps :before_database_migrations\n\n old_schema_version = 0\n old_schema_version = @metadata.read(schema_version_cache).chomp.to_i if @metadata.exists?(schema_version_cache)\n rollback = true if old_schema_version > schema_version\n old_schema_version = @metadata.read(rollback_schema_version_cache).chomp if @metadata.exists?(rollback_schema_version_cache) && rollback\n return true if schema_same_since?(old_schema_version)\n\n instrument \"rails3.run_db_migrate_rake_task\" do\n log(\"db_migrate\") do\n\n migrate = rake.task(\"db:migrate\")\n migrate = rake.task(\"db:rollback\") if rollback\n\n return true unless migrate.is_defined?\n\n if ENV['FORCE_DATABASE_MIGRATIONS']\n topic(\"Forcing database migrations.\")\n else\n topic(\"Running database migrations\") unless rollback\n topic(\"Rolling back database to version #{old_schema_version}\") if rollback\n end\n\n if user_env_hash.empty?\n default_env = {\n \"DATABASE_URL\" => ENV[\"DATABASE_URL\"] || default_database_url\n }\n else\n default_env = {\n \"DATABASE_URL\" => default_database_url\n }\n end\n\n default_env['VERSION'] = old_schema_version if rollback\n\n cache.load migrations_cache if rollback # we need the newer migrations to be able to rollback\n\n migrate.invoke(env: default_env.merge(user_env_hash).merge(\"RAILS_ENV\" => \"migrations\"))\n\n if migrate.success?\n log \"db_migrate\", :status => \"success\"\n puts \"Database migrations completed (#{\"%.2f\" % migrate.time}s)\" unless rollback\n puts \"Database rollback completed (#{\"%.2f\" % migrate.time}s)\" if rollback\n\n FileUtils.mkdir_p(heroku_metadata)\n @metadata.write(rollback_schema_version_cache, old_schema_version, false)\n @metadata.write(schema_version_cache, schema_version, false) unless rollback\n @metadata.write(schema_version_cache, old_schema_version, false) if rollback\n @metadata.save\n\n cache.store migrations_cache\n\n run_custom_build_steps :after_database_migrations\n else\n log \"db_migrate\", :status => \"failure\"\n error \"Database migrations failed.\" unless rollback\n error \"Database rollback failed.\" if rollback\n end\n end\n end\n end",
"def execute_migration(name, filepath)\n @log.info \"executing migration #{filepath}\"\n\n statements = @sql_reader.load_migration(filepath)\n if statements.length == 0\n raise 'no statements found in migration #{filepath}'\n end\n run_migration(name, statements)\n end",
"def migrate\n puts \"Migrating your database\"\n version = `ls db/migrate | wc -l`.to_i\n ActiveRecord::Base.establish_connection(Play.config['db'])\n ActiveRecord::Migrator.migrate(\"#{File.dirname(__FILE__)}/../db/migrate/\", version)\nend",
"def execute_generate_migration(name, options = nil)\n result = execute_generator 'migration', name, options\n result.last.last\n end",
"def reset_migrations!\n @migrations = nil\n @migrate_to = nil\n Neo4j::Transaction.run do\n migration_meta_node[:_db_version] = nil\n end\n end",
"def perform(class_name, arguments = [])\n Gitlab::BackgroundMigration.perform(class_name, arguments)\n end",
"def rake_migrate(namespace)\n puts 'Starting migration...'\n open_database_connection do\n database_uri = build_database_uri(namespace)\n puts '-> Running the rake db:migrate'\n puts `rake db:migrate DATABASE_URL=#{database_uri}`\n end\n end",
"def run(direction, database, version)\n ensure_schema_migrations_table_exists(database)\n Database.process(database) do\n ActiveRecord::Migrator.run(direction, migration_paths(database), version)\n end\n dump_schema(database)\n end",
"def run_active_record_migrations!\n ActiveRecord::Migration.verbose = false\n ActiveRecord::Migrator.migrate([\"test/fixtures/migrate\"])\n end",
"def up\n final_covers = Task.find_by_name(\"Final Covers\")\n return if final_covers.nil?\n\n # create Update PSD task\n new_task = Task.new\n new_task.name = 'Update PSD'\n new_task.tab_text = 'Update PSD'\n new_task.partial = 'update_psd'\n new_task.icon = 'icon-cloud-upload'\n new_task.next_id = nil\n new_task.team_only = true\n new_task.workflow = final_covers.workflow\n new_task.save\n\n # add Update PSD after Final Covers\n final_covers_tab = Tab.find_by_task_id(final_covers.id)\n new_tab = Tab.new\n new_tab.task = new_task\n new_tab.phase = final_covers_tab.phase\n new_tab.order = final_covers_tab.order + 1\n new_tab.save\n\n # adjust all remaining tabs\n remaining_tabs = new_tab.phase.tabs.joins(:task)\n .where(\"tabs.order >= ? and tasks.name != ? \", new_tab.order, new_task.name)\n remaining_tabs.each do | tab |\n tab.order = tab.order + 1\n tab.save\n end\n\n # unlock update_psd for everything beyond \"Final Covers\"\n task = final_covers\n while task.next_id\n task = Task.find(task.next_id)\n task.unlocked_tasks.create!(unlocked_task: new_task)\n end\n\n # retext some stuff so that the tabs will all fit in 1280px!\n @@renames.each do |rename|\n retext_tab(rename[:old_text], rename[:new_text])\n end\n end",
"def auto_migrate!(repository_name = self.repository_name)\n assert_valid\n auto_migrate_down!(repository_name)\n auto_migrate_up!(repository_name)\n end",
"def update_migration_files\n migration_templates = Dir.children(File.join(TEMPLATES, 'migrations')).sort\n migration_templates.each do |template_file|\n destination_file = template_file.match(/^\\d*_(.*\\.rb)/)[1] # 01_create_good_jobs.rb.erb => create_good_jobs.rb\n migration_template \"migrations/#{template_file}\", File.join(db_migrate_path, destination_file), skip: true\n end\n end",
"def migrate!(db = nil, &block)\n callback = migrate(db, &block)\n if callback.is_a?(Proc)\n callback.call\n else\n callback\n end\n end",
"def run_upwards\n result = request\n\n bond.applying_migrations.each do |migration|\n result = migration.up(result)\n end\n\n result\n end",
"def generate_migrations\n Dir[File.join(source_paths, 'db', 'migrate', '*.rb')].each do |file|\n migration_filepath = file.match(/\\A.+\\/(db\\/migrate\\/.+)\\Z/i)[1]\n raw_migration_filename = file.match(/\\d+\\_(.+)\\Z/i)[1] \n migration_template migration_filepath, \"db/migrate/#{raw_migration_filename}\" \n end\n end",
"def run_migrations(migrations)\n migrations.each do |direction, version_or_filenames|\n Array.wrap(version_or_filenames).each do |version_or_filename|\n version = File.basename(version_or_filename)[/\\d{3,}/]\n\n if defined? ActiveRecord::MigrationContext # >= 5.2\n ActiveRecord::Base.connection.migration_context.run(direction, version.to_i)\n else\n ActiveRecord::Migrator.run(direction, ActiveRecord::Migrator.migrations_paths, version.to_i)\n end\n end if version_or_filenames\n end\n if ActiveRecord::Base.schema_format == :ruby\n File.open(ENV['SCHEMA'] || \"#{Rails.root}/db/schema.rb\", 'w') do |file|\n ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)\n end\n end\n #TODO unload migraion classes\n end",
"def rollback(database, step = 1)\n Tenant.switch(database) do\n if activerecord_below_5_2?\n ActiveRecord::Migrator.rollback(ActiveRecord::Migrator.migrations_paths, step)\n else\n ActiveRecord::Base.connection.migration_context.rollback(step)\n end\n end\n end",
"def auto_upgrade!\n AutoMigrator.auto_upgrade(name)\n end",
"def auto_upgrade!\n AutoMigrator.auto_upgrade(name)\n end",
"def run_migrations(migrations)\n migrations.each do |direction, version_or_filenames|\n Array.wrap(version_or_filenames).each do |version_or_filename|\n /^(?<version>\\d{3,})/ =~ File.basename(version_or_filename)\n ActiveRecord::Migrator.run(direction, ActiveRecord::Migrator.migrations_path, version.to_i)\n end if version_or_filenames\n end\n if ActiveRecord::Base.schema_format == :ruby\n File.open(ENV['SCHEMA'] || \"#{Rails.root}/db/schema.rb\", 'w') do |file|\n ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)\n end\n end\n #TODO unload migraion classes\n end",
"def migrate( opts = {} )\n opts = {} if opts.nil?\n opts = { :target => opts } if opts.is_a?( Integer )\n raise \"setup must be run before migrate\" unless db\n profiles = Hooker.apply( [ :iudex, :migration_profiles ],\n opts[ :profiles ] || [] )\n\n migrate_ar_to_sequel( opts )\n\n pm = ProfileMigrator.new( db, profiles, opts )\n pm.run\n end",
"def migrate_database\n RFlow.logger.debug 'Applying default migrations to config database'\n migrations_path = File.join(File.dirname(__FILE__), 'configuration', 'migrations')\n ActiveRecord::Migration.verbose = false\n ActiveRecord::Migrator.migrate migrations_path\n end",
"def migrate!(db = nil, &block)\n callback = migrate(db, &block)\n if callback.is_a?(Proc)\n callback.call\n else\n callback\n end\n end",
"def perform_migration\n download_threads = []\n upload_threads = []\n\n @source_container.files.each { |f| @download_list.push(f) }\n\n DOWNLOAD_THREAD_COUNT.times do\n download_threads << download_thread\n end\n UPLOAD_THREAD_COUNT.times do\n upload_threads << upload_thread\n end\n\n download_threads.each { |t| t.join }\n @download_finished = true\n upload_threads.each { |t| t.join }\n true\n rescue => e\n if @options[:verbose]\n puts \"#{CLI.bold}#{CLI.red}*** Error ***#{CLI.reset}\"\n puts e.inspect\n puts e.backtrace\n puts\n end\n false\n end",
"def pre_migrate_database\n old_schema_version = get_schema_version\n new_schema_version = File.read(File.join(source_directory,'db','schema_version')).to_i\n \n return unless old_schema_version > 0\n \n # Are we downgrading?\n if old_schema_version > new_schema_version\n message \"Downgrading schema from #{old_schema_version} to #{new_schema_version}\"\n \n in_directory install_directory do\n unless system(\"rake -s migrate VERSION=#{new_schema_version}\")\n raise InstallFailed, \"Downgrade migrating from #{old_schema_version} to #{new_schema_version} failed.\"\n end\n end\n end\n end",
"def manage(app_name, instance_name, action)\n case action\n when :checkpoint\n dump_database app_name, instance_name\n when :rollback\n admin_database app_name, instance_name, :drop\n admin_database app_name, instance_name, :create\n load_database app_name, instance_name\n configure_rails app_name, instance_name\n migrate_database app_name, instance_name\n when :rekey\n admin_database app_name, instance_name, :rekey\n configure_rails app_name, instance_name\n when :db_reset\n admin_database app_name, instance_name, :drop\n admin_database app_name, instance_name, :create\n migrate_database app_name, instance_name\n end\n end",
"def generate_migration(tables)\n return if tables.empty? && @db_tables.empty?\n result.clear\n\n add_line \"Sequel.migration do\"\n indent do\n generate_migration_body(tables)\n end\n add_line \"end\\n\"\n\n result.join(\"\\n\")\n end",
"def migrate_to(version, direction = :up)\n version = version.to_i\n direction = direction.to_sym\n assert_valid_direction(direction)\n\n migrations = case direction\n when :up\n pending_migrations.select { |migration| migration.version <= version }\n when :down\n performed_migrations.select { |migration| migration.version > version }\n else\n []\n end\n\n run_migrations migrations, direction\n end",
"def migrate\n raise NotImplementedError\n end",
"def migrate(klass)\n # Validate\n raise \"Unable to perform migrations, class must be specified!\" unless klass.class == Class\n raise \"Unable to perform migrations for core class!\" if CORE.include?(klass)\n raise \"Class cannot be migrated!\" unless klass.respond_to?(:auto_migrate!)\n # Execute auto migrations for now\n klass.auto_migrate!\n end",
"def up\n builds_with_artifacts.find_each do |build|\n build.migrate_artifacts!\n end\n end",
"def migrate\n DataMapper.auto_migrate!\n end",
"def migrate(opts, &block)\n opts[:target] = resolve(opts[:target])\n # Migrate the input.\n CaTissue::Migrator.new(opts).migrate_to_database(&block)\n end",
"def install_migrations\n\t\tsay_status :copying, \"migrations\"\n\t\trake 'railties:install:migrations'\n\tend",
"def change_migration_content\n Dir.glob(\"#{plugin_path}/db/migrate/*.rb\").each do |f|\n content = \"\"\n file = File.open(f,\"r\")\n file.each do |line|\n content += \"#{line} \" \n end\n mig_array = [\"To\", \"From\", \"Create\" ,\"Remove\"]\n model_name = \"\"\n mig_array.each do |m_a|\n reg_exp = %r{#{m_a}(.+)\\s+<}\n model_name = reg_exp.match(content)[1] unless reg_exp.match(content).nil?\n if !model_name.blank?\n break\n end\n end\n migrate_connection =\"\"\n if !model_name.blank?\n migrate_connection = \"def self.connection\n #{model_name.singularize}.connection\n end\"\n end\n if !model_name.blank?\n content.sub!(/ActiveRecord::Migration\\s{1}/,\"ActiveRecord::Migration\\n #{migrate_connection} \\n\")\n end\n file = File.open(f,\"w\")\n file.write(content)\n file.close\n end\n \n end",
"def copy_migration_files \n Dir.glob(File.join(DoogleGenerator.source_root, 'db/migrate/*')).each do |source|\n destination = File.join(Rails.root, 'db/migrate', File.basename(source))\n puts \" \\e[1m\\e[34mcopying\\e[0m #{source} to #{destination}\"\n copy_file source, destination\n end\n end",
"def docker_updb\n rootFolder = Dir.pwd\n\n # execute updb cmds for each endpoints\n @endpoints.each do |ep|\n framework = ep[:frameworkname]\n Dir.chdir(\"#{rootFolder}/#{ep[:path]}\")\n\n # execute framework specific updb\n case framework\n when /Symfony/\n system \"docker pull nextdeploy/#{framework.downcase}console\"\n system \"docker run --net=#{@projectname}_default -v=#{Dir.pwd}:/var/www/html nextdeploy/#{framework.downcase}console doctrine:schema:update --force\"\n when /Drupal/\n system \"docker pull nextdeploy/drush\"\n system \"docker run --net=#{@projectname}_default -v=#{Dir.pwd}:/app nextdeploy/drush -y updb\"\n end\n end\n Dir.chdir(rootFolder)\n\n docker_cc\n end",
"def upgrade_tasks\n if ENV['UPGRADE'].present?\n ENV['UPGRADE'].split(',')\n else\n all_upgrade_tasks\n end\n end",
"def execute_task task\n puts \"starting #{task}...\"\n Rake::Task[\"railties:install:migrations\"].reenable\n Rake::Task[task].reenable\n r = Rake::Task[task].invoke\n puts \"#{task} done! #{r}\"\nend",
"def up\n Gitlab::BackgroundMigration.steal('MigrateBuildStageIdReference')\n end",
"def run_before_migrate_setup\n Chef::Log.info 'No before migrate setup defined.'\n end",
"def stage_database(db_names, admin_password, db_user_name, db_password)\n sql_command = \"\"\n \n db_names.each do |name|\n db_name = ActiveRecord::Base.configurations[name]['database']\n sql_command += \"drop database if exists #{db_name}; \" << \n \"create database #{db_name}; grant all privileges on #{db_name}.* \" << \n \"to #{db_user_name}@localhost identified by \\'#{db_password}\\';\"\n ActiveRecord::Base.configurations[name]['username'] = db_user_name\n ActiveRecord::Base.configurations[name]['password'] = db_password\n end\n\n if (!File.exist?(\"#{APP_ROOT}/tmp/stage.sql\"))\n File.open(\"#{APP_ROOT}/tmp/stage.sql\", \"w\") do |file|\n file.print sql_command\n end\n end\n\n # back up the original database.yml file just in case\n File.copy(\"#{APP_ROOT}/config/database.yml\", \n \"#{APP_ROOT}/config/database.yml.sample\") if !File.exist?(\"#{APP_ROOT}/config/database.yml.sample\")\n \n dbconfig = File.read(\"#{APP_ROOT}/config/database.yml\")\n dbconfig.gsub!(/username:.*/, \"username: #{db_user_name}\")\n dbconfig.gsub!(/password:.*/, \"password: #{db_password}\")\n \n File.open(\"#{APP_ROOT}/config/database.yml\", \"w\") do |file|\n file.print dbconfig\n end\n\n if system %(mysql -h localhost -u root --password=#{admin_password} < tmp/stage.sql)\n puts \"Updated config/database.yml and staged the database based on your settings\"\n File.delete(\"tmp/stage.sql\") if File.file?(\"tmp/stage.sql\")\n else\n puts \"Staging was not performed. Check console for errors. It is possible that 'mysql' executable was not found.\"\n end\n end",
"def find_migration_tuples # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity\n up_mts = []\n down_mts = []\n files.each do |path|\n f = File.basename(path)\n fi = f.downcase\n if target\n if migration_version_from_file(f) > target\n down_mts << [load_migration_file(path), f, :down] if applied_migrations.include?(fi)\n elsif !applied_migrations.include?(fi)\n up_mts << [load_migration_file(path), f, :up]\n end\n elsif !applied_migrations.include?(fi)\n up_mts << [load_migration_file(path), f, :up]\n end\n end\n up_mts + down_mts.reverse\n end",
"def cmd_migrate(*args)\n\t\tif (args.length == 0)\n\t\t\tprint_line(\n\t\t\t\t\"Usage: migrate pid\\n\\n\" +\n\t\t\t\t\"Migrates the server instance to another process.\\n\" +\n\t\t\t\t\"Note: Any open channels or other dynamic state will be lost.\")\n\t\t\treturn true\n\t\tend\n\n\t\tpid = args[0].to_i\n\t\tif(pid == 0)\n\t\t\tprint_error(\"A process ID must be specified, not a process name\")\n\t\t\treturn\n\t\tend\n\n\t\tprint_status(\"Migrating to #{pid}...\")\n\n\t\t# Do this thang.\n\t\tclient.core.migrate(pid)\n\n\t\tprint_status(\"Migration completed successfully.\")\n\tend",
"def jump_sql\n \n FileUtils.cd(@app_path+\"/lib/tasks\",:verbose => true)\n if File.directory? @d\n puts \"Directory #{@d} exists\"\n else\n FileUtils.mkdir @d, :mode => 0700, :verbose => true\n end\n \n FileUtils.cd(@d,:verbose => true)\n @n = Time.now.strftime(\"%H%M%S\")\n @h = File.open(@n,\"a+\")\n @h.write(\"\\n#{@sql}\\n\")\n \n end",
"def copy_migrations\n [\n 'create_file_view_stats.rb',\n 'create_file_download_stats.rb'\n ].each do |file|\n better_migration_template file\n end\n end",
"def migrate(table_arr)\n table_arr.each do |table_name|\n self.task_queue << {:name=>:migrate_table,:args=>[table_name]}\n end\n end",
"def rollback(database, step = 1)\n ensure_schema_migrations_table_exists(database)\n Database.process(database) do\n ActiveRecord::Migrator.rollback(migration_paths(database), step)\n end\n dump_schema(database)\n end"
] |
[
"0.7123244",
"0.6536604",
"0.64443934",
"0.640779",
"0.64054996",
"0.6379107",
"0.6359264",
"0.6316476",
"0.6315159",
"0.6297739",
"0.62144125",
"0.61788976",
"0.61778206",
"0.6170276",
"0.61682343",
"0.6162269",
"0.6156761",
"0.61159277",
"0.6076526",
"0.6068247",
"0.60658497",
"0.6020152",
"0.6016014",
"0.6014108",
"0.6012903",
"0.6012622",
"0.5985254",
"0.5980757",
"0.5980657",
"0.5970011",
"0.59694564",
"0.5958304",
"0.59480715",
"0.592931",
"0.5928369",
"0.59167564",
"0.5906383",
"0.5906045",
"0.5885702",
"0.58827883",
"0.58793044",
"0.58788496",
"0.5873191",
"0.5866091",
"0.58603144",
"0.58444613",
"0.58325535",
"0.58210266",
"0.5814881",
"0.5813749",
"0.5813749",
"0.5812289",
"0.5811231",
"0.57927436",
"0.5791054",
"0.57869214",
"0.5786332",
"0.576887",
"0.5763269",
"0.57591116",
"0.5747766",
"0.57403255",
"0.5737722",
"0.57333475",
"0.5719825",
"0.57098913",
"0.570528",
"0.57016873",
"0.56967735",
"0.5695647",
"0.5695647",
"0.5689603",
"0.5685811",
"0.5679682",
"0.56748164",
"0.5672302",
"0.56581014",
"0.56565624",
"0.5642328",
"0.5620264",
"0.5612735",
"0.56043524",
"0.56038994",
"0.5592469",
"0.5562042",
"0.55491877",
"0.55257523",
"0.551057",
"0.5503208",
"0.5499632",
"0.5495053",
"0.54655045",
"0.5459501",
"0.54548705",
"0.54405355",
"0.54389703",
"0.5435259",
"0.54152364",
"0.5414443",
"0.54063153"
] |
0.7597206
|
0
|
==Import analysis result from result file pdm database import ANALYSIS/RESULT
|
def import(*files)
require "models/user_task"
require "models/log_record"
require "timeout"
establish! do
unless( files.empty? )
files.each do |file|
puts "Loading %s" % file
File.open(file, "r:utf-8") do |stream|
import_from stream
end
end
else
begin
require "stringio"
str = Timeout::timeout(10) {
$stdin.set_encoding("utf-8")
$stdin.read # read as utf-8, ensured by top of this file comments
}
puts "Loading from stdin"
import_from StringIO.new(str,"r:utf-8")
rescue Timeout::Error
raise "You should specify several import file"
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def loadResult()\n json = nil ;\n file = scannedResultFilename() ;\n open(file,\"r\"){|strm|\n json = JSON.load(strm.read()) ;\n }\n\n json.each{|result|\n analyzer = AnalyzerExpA.new(@logBaseDir, nil) ;\n analyzer.scanResultJson(result) ;\n basename = analyzer.basename ;\n @basenameList.push(basename) ;\n @analyzerTable[basename] = analyzer ;\n }\n end",
"def add_result_distances(base)\n return nil unless result_files_exist?(base, %w[.Rdata .log .txt])\n r = MiGA::Result.new(\"#{base}.json\")\n r.add_file(:rdata, 'miga-project.Rdata')\n r.add_file(:matrix, 'miga-project.txt')\n r.add_file(:log, 'miga-project.log')\n r.add_file(:hist, 'miga-project.hist')\n r\n end",
"def add_result_distances(base)\n return nil unless result_files_exist?(base, %w[.Rdata .log .txt])\n r = MiGA::Result.new(\"#{base}.json\")\n r.add_file(:rdata, \"miga-project.Rdata\")\n r.add_file(:matrix, \"miga-project.txt\")\n r.add_file(:log, \"miga-project.log\")\n r.add_file(:hist, \"miga-project.hist\")\n r\n end",
"def run(result)\t\t\n\t\tcolumn_names = result.fields #store the column names\n\t\trow_count = result.num_tuples #get the number of rows in the result\n\t\tinitial_data = Array.new #payload holder\n result.each do |item|\n intial_data << item.to_ary\n end\t\t\n\t\tasrecordset = ASRecordset.new(row_count,column_names,initial_data)\n\t\tresult = asrecordset\n\t\tresults\n\tend",
"def import\n Rails.logger.info(\"Results::ResultsFile #{Time.zone.now} import\")\n\n Event.transaction do\n event.disable_notification!\n book = ::Spreadsheet.open(source.path)\n book.worksheets.each do |worksheet|\n race = nil\n create_rows(worksheet)\n\n rows.each do |row|\n Rails.logger.debug(\"Results::ResultsFile #{Time.zone.now} row #{row.spreadsheet_row.to_a.join(', ')}\") if debug?\n if race?(row)\n race = find_or_create_race(row)\n # This row is also a result. I.e., no separate race header row.\n if usac_results_format?\n create_result(row, race)\n end\n elsif result?(row)\n create_result(row, race)\n end\n end\n end\n event.enable_notification!\n CombinedTimeTrialResults.create_or_destroy_for!(event)\n end\n Rails.logger.info(\"Results::ResultsFile #{Time.zone.now} import done\")\n end",
"def result\n rows = File.readlines(file)\n\n result = Result.new\n unless rows.empty?\n row_number = 0\n row_number += 1 while rows[row_number].chomp.empty?\n\n result.cols = rows[row_number].chomp.split(';')\n result.col_count = result.cols.size\n\n row_number += 1\n row_number += 1 while rows[row_number].chomp.empty?\n\n result.row_count = rows.size - 1\n result.sample_row = rows[row_number].chomp\n end\n\n result\n end",
"def add_result_distances(base, _opts)\n return nil unless result_files_exist?(base, %w[.rds .txt])\n\n r = MiGA::Result.new(\"#{base}.json\")\n r.add_file(:rds, 'miga-project.rds')\n r.add_file(:rdata, 'miga-project.Rdata') # Legacy file\n r.add_file(:matrix, 'miga-project.txt')\n r.add_file(:log, 'miga-project.log') # Legacy file\n r.add_file(:hist, 'miga-project.hist')\n r\n end",
"def import\n scan_files\n # import non-imported files\n\tto_be_executed = Execution.where(:passerelle_id => @passerelle.id, :statut => \"nex\").order('created_at')\n\tto_be_executed.each{ |execution|\n\t\texecution.statut = \"ece\" #note : En Cours d'Execution\n\t\texecution.save!\n\t}\n\tto_be_executed.each{ |execution|\n\t\n\t\n\tbegin\n\t import_exe execution\n\t statut = \"ok\"\n\trescue Exception => e\n\t\t @rapport_import << \"Fail<\\br>\"\n\t\t @rapport_import << \"Error message => : #{e.message}<\\br>\"\n\t\t @rapport_import << \"Error backtrace => #{e.backtrace}<\\br>\"\n\t\t Logger.send(\"warn\",\"[Passerelle] Import FAIL !\")\n\t\t Logger.send(\"warn\",\"[Passerelle] Rapport : #{@rapport_import}\")\n\t\t statut = \"err\"\n\tend\n\t\t\n\t\texe_to_save = Execution.find execution.id\n\t\texe_to_save.statut = statut\n\t\texe_to_save.description = @result[:description]\n\t\texe_to_save.save!\n\t}\n @passerelle.updated_at = DateTime.now\n @passerelle.save!\n\t\n\tres = Hash.new\n\tres[\"updated\"] = true\n\t# res[\"message\"] = \"desc\"\n\t\n\treturn res\n end",
"def analyze\n format_results\n end",
"def run(result)\r\n\t\t\r\n\t\tcolumn_names = Array.new #store the column names\r\n\t\tfields = result.fetch_fields #get all the fields\r\n\t\tfields.each do |field|\r\n\t\t\tcolumn_names << field.name #push a field into the coumn_names\r\n\t\tend\r\n\t\t\r\n\t\trow_count = result.num_rows #get the number of rows in the Mysql::Result\r\n\t\tinitial_data = Array.new #payload holder\r\n\t\t\r\n\t\tresult.data_seek(0) #Seek the cursor to the beginning of the data\r\n\t\twhile row = result.fetch_row\r\n\t\t\tinitial_data << row # add a row to the payload\r\n\t\tend\r\n\t\t\t\t\r\n\t\tasrecordset = ASRecordset.new(row_count,column_names,initial_data)\r\n\t\tresult = asrecordset\r\n\t\treturn result\r\n\tend",
"def result(name)\n dir = @@RESULT_DIRS[name.to_sym]\n return nil if dir.nil?\n MiGA::Result.load(\"#{path}/data/#{dir}/miga-project.json\")\n end",
"def parseResults()\n puts \"Uploading results to LIMS\"\n summaryFile = Dir[@outputDir + \"/*CoverageReport.csv\"]\n\n if summaryFile == nil\n @captureResults = CaptureStatsResults.new(nil)\n else\n puts \"Found Summary file : \" + summaryFile[0].to_s\n @captureResults = CaptureStatsResults.new(summaryFile[0]) \n end\n end",
"def parse_output(_report, _result, _targets); end",
"def import_nem12\r\n\r\n truncate_records\r\n truncate_aggregations\r\n\r\n meters = get_meters\r\n #directory = \"homes/reuben/test\"\r\n #directory = \"homes/reuben/09-07-2015\"\r\n #directory = \"homes/reuben/1\"\r\n #directory = \"homes/testdata\"\r\n directory = \"homes/reuben/clariti\"\r\n result = Meter.import_nem12(directory, meters)\r\n logger.info result\r\n redirect_to action: 'index'\r\n end",
"def reference_dataset_result\n if p = @project and m = p.miga\n if ds = m.dataset(params[:dataset]) and res = ds.result(params[:result])\n if file = res.data[:files][params[:file].to_sym]\n send_result(file, res)\n return\n end\n end\n end\n render nothing: true, status: 200, content_type: 'text/html'\n end",
"def test_results_from_file\n @test_results_from_file = current_teacher.test_results_from_files.find(params[:id])\n end",
"def read_file(file)\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, \"load_file(#{file.strip.chomp.mysqlhex})\")\n if not results.nil? and not results == ''\n # Log Success for offline review\n logs = RESULTS + $config['INJECTOR']['MYSQL']['URL'].sub('http://', '').sub('https://', '').sub(/\\/$/, '').split(\"/\")[0]\n logdir = logs + '/load_file/'\n # Try to ensure filenames dont end up jacked up, no guarantees :p\n logfile = logdir + file.gsub('/', '_').gsub('\\\\', '_').gsub(/[;:'\",.~`!@#$\\%^&*\\(\\)=\\[\\]]/, '_')\n Dir.mkdir(logs) unless File.exists?(logs) and File.directory?(logs)\n Dir.mkdir(logdir) unless File.exists?(logdir) and File.directory?(logdir)\n f=File.open(logfile, 'w+')\n f.puts results\n f.close\n print_good(\"File: #{file}\")\n print_status(\"#########################################################\")\n print_line(\"#{results.chomp}\")\n print_status(\"#########################################################\\n\")\n return true\n else\n print_error(\"No results for: #{file}\")\n return false\n end\n end",
"def build_and_save_imported_result(hash, raw, user, competition, is_start_time)\n ImportResult.create!(\n hash.merge(\n raw_data: convert_array_to_string(raw),\n user: user,\n competition: competition,\n is_start_time: is_start_time\n )\n )\n end",
"def import_results(jmeter_plan, cluster_instance, result_file_path)\n logger.debug { \"#{self.class}.#{__method__}\" }\n jmeter_plan.update_column(:latest_threads_count, jmeter_plan.num_threads)\n client_stat = Hailstorm::Model::ClientStat.create_client_stats(self, jmeter_plan.id,\n cluster_instance,\n [result_file_path],\n rm_stat_file = false)\n\n self.update_attributes!(started_at: client_stat.first_sample_at, stopped_at: client_stat.last_sample_at)\n end",
"def add_result_project_stats(base, _opts)\n return nil unless\n result_files_exist?(base, %w[.taxonomy.json .metadata.db])\n\n r = MiGA::Result.new(\"#{base}.json\")\n r.add_file(:taxonomy_index, 'miga-project.taxonomy.json')\n r.add_file(:metadata_index, 'miga-project.metadata.db')\n r\n end",
"def test_import\n Log.remove(ArtworkDataPlugin.log_name)\n \n query = 'SELECT * FROM artwork'\n sth = $dbh_pg.execute(query)\n\n while row = sth.fetch\n ArtworkDataPlugin.new('data', row)\n end\n \n ArtworkDataPlugin.flush_logs\n Log.test_regression(ArtworkDataPlugin.log_name)\n ArtworkDataPlugin.write_report\n IdStore.write_report\n end",
"def get_analyzer_results(analyzer, the_samples)\n output = Array.new\n analyzer_base = analyzer.sub('.py', '')\n puts the_samples\n puts analyzer\n the_samples.each do |sample|\n output << \"results/#{$jobid}/#{$selection}#{$jetcorrection}/iso#{$isolation}/#{analyzer_base}/#{sample}.root\"\n #output << \"results/#{$jobid}/#{analyzer_base}/#{sample}.root\"\n end\n return output\nend",
"def results\n parse_results\n rescue StandardError => e\n Facter.log_exception(e, \"Failed to handle #{filename} as #{self.class} facts: #{e.message}\")\n nil\n end",
"def extract_data(output_file, options = {})\n log.info \"Exporting #{@cube} data via report script...\"\n\n rep_script = generate_script(options)\n save_query_to_file(rep_script, options[:query_file], '.rep')\n\n # Submit the report\n iter = nil\n instrument 'report.extract', script: rep_script, output_file: output_file do\n iter = cube.report(rep_script, false, false, true, false)\n end\n\n # Write the returned data to the file\n log.fine \"Writing data to #{output_file}\"\n file = File.new(output_file, \"w\")\n count = 0\n begin\n # TODO: Handle header, non-tab delimiters\n while !try{ iter.is_end_of_data } do\n chunk = try{ iter.next_string }\n file.puts chunk\n count += chunk.lines.count\n end\n ensure\n file.close\n end\n log.fine \"Output #{count} records\"\n end",
"def add_to_all_results_file(filename,output)\n self.add_to_file(filename,output)\n end",
"def parse_result(result)\n genus = nil\n spec = nil\n infra_sp = nil\n infra_g = nil\n authorships = []\n uni = nil\n attributes = {}\n warns = nil\n quality = 0\n norm = nil\n if result.key?('details')\n result['details'].each do |detail_type, value|\n # We can't parse these, because the results get confusing (there is more than one of each), and we don't do\n # anything with them anyway.\n next if detail_type == 'hybridFormula'\n if value.is_a?(Hash)\n value.each do |k, v|\n next if v.nil? # specific_epithet seems to do this occassionally and I don't know why. :|\n k = k.underscore.downcase # Looks like the format changed from this_style to thisStyle; change it back!\n next if k == 'annotation_identification'\n next if k == 'ignored'\n if k == 'infraspecific_epithets'\n attributes['infraspecific_epithet'] = v.map { |i| i['value'] }.join(' ; ')\n v.each do |i|\n add_authorship(authorships, i)\n end\n else\n if v.is_a?(Hash)\n add_authorship(authorships, v)\n elsif ScientificName.attribute_names.include?(k)\n attributes[k] = v['value']\n end\n end\n end\n end\n end\n end\n if result.key?('canonical')\n canonical = result['canonical']\n canon =\n if canonical.key?('simple')\n canonical['simple']\n elsif canonical.key?('stemmed')\n canonical['stemmed']\n elsif canonical.key?('full')\n canonical['full']\n end\n end\n if result['parsed']\n warns = if result.key?('qualityWarnings')\n result['qualityWarnings'].map { |w| w['warning'] }.join('|')\n else\n ''\n end\n quality = result['quality'] ? result['quality'].to_i : 0\n norm = result['normalized'] ? result['normalized'] : nil\n else\n warns = 'UNPARSED'\n quality = 0\n canon = result['verbatim']\n end\n norm = result['verbatim'] if norm.blank?\n if norm.size > 250\n norm = canon\n authorships.each do |authorship|\n norm += \" #{authorship[:first]}, et. al\"\n norm += \" #{authorship[:year]}\" if authorship[:year]\n end\n norm = norm[0..249] if norm.size > 250 # Forced to simply truncate it if we couldn't parse it.\n end\n norm = result['verbatim'] if norm.blank?\n\n attributes.merge(\n normalized: norm,\n canonical: canon,\n authorship: authorships.flat_map { |a| a[:authors].blank? ? [] : a[:authors].map { |n| n&.tr(';', '|') } }.join('; '),\n warnings: warns,\n parse_quality: quality,\n year: authorships.map { |a| a[:year] }.compact.sort.first # Yeeesh! We take the earliest year (we only get one!)\n )\n end",
"def analyze\n log_files = FileGate.filter(:log, @file_names)\n\n if log_files.any?\n analysis_config = APP_CONFIG[:analysis_config]\n analysis_types = analysis_config[:import_defaults].gsub(' ', '').split(',')\n analysis_types.each do |type|\n AnalysisService.new(type: type).analyze\n end\n info = \"+analysis: #{analysis_types}\"\n else\n info = \".no analysis run (no logs included in import)\"\n end\n\n self.results << info\n logger.info info\n end",
"def add_result_distances_nonref(base)\n return nil unless\n result_files_exist?(base, %w[.aai-medoids.tsv .aai.db]) ||\n result_files_exist?(base, %w[.ani-medoids.tsv .ani.db])\n\n add_files_to_ds_result(\n MiGA::Result.new(\"#{base}.json\"), name,\n aai_medoids: '.aai-medoids.tsv',\n haai_db: '.haai.db',\n aai_db: '.aai.db',\n ani_medoids: '.ani-medoids.tsv',\n ani_db: '.ani.db',\n ref_tree: '.nwk',\n ref_tree_pdf: '.nwk.pdf',\n intax_test: '.intax.txt'\n )\n end",
"def process_results\n # Clean up some of the files that are not needed\n %w(runmanager.db).each do |f|\n logger.debug \"Removing file: #{@simulation.run_path}/#{f}\"\n File.delete File.join(@simulation.run_path, f) if File.exist? File.join(@simulation.run_path, f)\n end\n\n json = {}\n Dir[\"#{@simulation.run_path}/*\"].each do |f|\n if f =~ /AnalysisResults-BEES.pdf/\n logger.info 'saving the compliance report path to model'\n @simulation.compliance_report_pdf_path = f\n elsif f =~ /.*\\s-\\sAnalysisResults-BEES.xml/\n logger.info \"BEES XML #{f}\"\n @simulation.compliance_report_xml = f\n elsif f =~ /.*\\s-\\sAnalysisResults.xml/\n logger.info \"XML #{f}\"\n @simulation.analysis_results_xml = f\n elsif f =~ /CbeccComWrapper.json/\n # Save the state based on the CbeccComWrapper.json file that is persisted\n json = MultiJson.load(File.read(f), symbolize_keys: true) if File.exist?(f)\n logger.info \"pyCBECC responded with: #{json}\"\n\n @simulation.cbecc_code = json.keys.first.to_s.to_i\n @simulation.cbecc_code_description = json.values.first\n elsif f =~ /.*\\s-\\sab.*/\n logger.info \"Annual baseline results #{f}\"\n @simulation.openstudio_model_baseline = f if File.extname(f) == '.osm'\n\n elsif f =~ /.*\\s-\\szb.*/\n logger.info \"Sizing simulation results #{f}\"\n elsif f =~ /.*\\s-\\sap.*/\n logger.info \"Annual proposed results #{f}\"\n @simulation.openstudio_model_proposed = f if File.extname(f) == '.osm'\n end\n end\n\n # TODO: remove other files\n\n # parse the log file for any errors\n errors = []\n log_file = find_log_file\n if log_file && File.exist?(log_file)\n s = File.read log_file\n s.scan(/Error:\\s{2}.*$/).each do |error|\n errors << error[/Error:\\s{2}(.*)/, 1].chomp\n end\n\n # This appeared once, but haven't seen it since.\n s.scan(/error\\(s\\) encountered simulating.*/i).each do |error|\n errors << error.chomp\n end\n\n # and this error: Compliance report(s) called for but bypassed due to report generator website not accessible.\n if s =~ /compliance report.*called for but bypassed due to report generator website not accessible/i\n @simulation.warning_messages << \"Could not generate Compliance Reports because report generate website was not accessible\"\n end\n\n @simulation.error_messages = errors\n end\n\n # TODO: zip up everything and remove what we don't care about\n\n # success is defined as no error messages\n if !json.keys.empty? && json.keys.first != :'0'\n return false\n end\n\n if !@simulation.error_messages.empty?\n return false\n end\n\n true\n end",
"def add_result_distances_nonref(base)\n return nil unless\n result_files_exist?(base, %w[.aai-medoids.tsv .aai.db]) ||\n result_files_exist?(base, %w[.ani-medoids.tsv .ani.db])\n\n add_files_to_ds_result(\n MiGA::Result.new(\"#{base}.json\"), name,\n aai_medoids: '.aai-medoids.tsv',\n haai_db: '.haai.db',\n aai_db: '.aai.db',\n ani_medoids: '.ani-medoids.tsv',\n ani_db: '.ani.db',\n ref_tree: '.nwk',\n ref_tree_pdf: '.nwk.pdf',\n intax_test: '.intax.txt'\n )\n end",
"def parse_result(result)\n genus = nil\n spec = nil\n infra_sp = nil\n infra_g = nil\n authorships = []\n uni = nil\n attributes = {}\n warns = nil\n quality = 0\n norm = nil\n if result.key?('details')\n result['details'].each do |hash|\n hash.each do |k, v|\n next if v.nil? # specific_epithet seems to do this occassionally and I don't know why. :|\n k = k.underscore.downcase # Looks like the format changed from this_style to thisStyle; change it back!\n next if k == 'annotation_identification'\n next if k == 'ignored'\n if k == 'infraspecific_epithets'\n attributes['infraspecific_epithet'] = v.map { |i| i['value'] }.join(' ; ')\n v.each do |i|\n add_authorship(authorships, i)\n end\n else\n begin\n attributes[k] = v['value']\n rescue => e\n @process.warn(\"ERROR: no '#{k}' value for attributes: #{v.inspect}\")\n raise e\n end\n add_authorship(authorships, v)\n end\n end\n end\n end\n if result.key?('canonicalName')\n canonical = result['canonicalName']\n canon =\n if canonical.is_a?(String)\n canonical\n elsif canonical.is_a?(Hash)\n if canonical.key?('valueRanked')\n canonical['valueRanked']\n elsif canonical.key?('value')\n canonical['value']\n elsif canonical.key?('extended')\n canonical['extended']\n elsif canonical.key?('simple')\n canonical['simple']\n elsif canonical.key?('full')\n canonical['full']\n end\n end\n end\n if result['parsed']\n warns = if result.key?('qualityWarnings')\n result['qualityWarnings'].map { |a| a[1] }.join('; ')\n end\n quality = result['quality'] ? result['quality'].to_i : 0\n norm = result['normalized'] ? result['normalized'] : nil\n else\n warns = 'UNPARSED'\n quality = 0\n canon = result['verbatim']\n end\n norm = result['verbatim'] if norm.blank?\n if norm.size > 250\n norm = canon\n authorships.each do |authorship|\n norm += \" #{authorship[:first]}, et. al\"\n norm += \" #{authorship[:year]}\" if authorship[:year]\n end\n norm = norm[0..249] if norm.size > 250 # Forced to simply truncate it if we couldn't parse it.\n end\n norm = result['verbatim'] if norm.blank?\n\n attributes.merge(\n normalized: norm,\n canonical: canon,\n authorship: authorships.flat_map { |a| a[:authors].blank? ? [] : a[:authors].map { |n| n&.tr(';', '|') } }.join('; '),\n warnings: warns,\n parse_quality: quality,\n year: authorships.map { |a| a[:year] }.compact.sort.first # Yeeesh! We take the earliest year (we only get one!)\n )\n end",
"def get_analyzer_results(analyzer, the_samples)\n output = Array.new\n analyzer_base = analyzer.sub('.py', '')\n the_samples.each do |sample|\n output << \"results/#{$jobid}/#{analyzer_base}/#{sample}.root\"\n end\n return output\nend",
"def get_analyzer_results(analyzer, the_samples)\n output = Array.new\n analyzer_base = analyzer.sub('.py', '')\n the_samples.each do |sample|\n output << \"results/#{$jobid}/#{analyzer_base}/#{sample}.root\"\n end\n return output\nend",
"def get_analyzer_results(analyzer, the_samples)\n output = Array.new\n analyzer_base = analyzer.sub('.py', '')\n the_samples.each do |sample|\n output << \"results/#{$jobid}/#{analyzer_base}/#{sample}.root\"\n end\n return output\nend",
"def get_analyzer_results(analyzer, the_samples)\n output = Array.new\n analyzer_base = analyzer.sub('.py', '')\n the_samples.each do |sample|\n output << \"results/#{$jobid}/#{analyzer_base}/#{sample}.root\"\n end\n return output\nend",
"def get_analyzer_results(analyzer, the_samples)\n output = Array.new\n analyzer_base = analyzer.sub('.py', '')\n the_samples.each do |sample|\n output << \"results/#{$jobid}/#{analyzer_base}/#{sample}.root\"\n end\n return output\nend",
"def get_analyzer_results(analyzer, the_samples)\n output = Array.new\n analyzer_base = analyzer.sub('.py', '')\n the_samples.each do |sample|\n output << \"results/#{$jobid}/#{analyzer_base}/#{sample}.root\"\n end\n return output\nend",
"def parse\n return false unless filecheck\n doc = REXML::Document.new(open(file))\n @result_set = []\n doc.elements.each(RESULT_PATH) do |e|\n result_array = [] # [0]: name, [1]: data type, [2]:null\n get_generic(e, result_array)\n @result_set.push(result_array)\n end\n return true\n end",
"def manage_record_result(id, result)\n separator = @global_opts[:csv] ? \",\" : \": \"\n if @client.is_success?\n @response_data.root << result.at_xpath(RECORD_XPATH,\n \"marc\" => XMLNS_MARC\n )\n @response_status << id + separator + PAST_TENSE[@cmd] + \"\\n\"\n puts id + separator + PAST_TENSE[@cmd] if @global_opts[:verbose]\n @successes += 1\n else\n if @global_opts[:csv]\n @response_status << [id, \"failed\", result.to_s].to_csv\n else\n @response_status << id + separator + \"failed\\n\"\n @response_status << result.to_s\n end\n puts id + separator + \"failed\" if @global_opts[:verbose]\n @failures += 1\n end\n end",
"def analyse(result)\n @show.call \"Retrieving extensions from database...\"\n extensions = Extension.not_in(name: @ignored_conf.ignored_exts).to_a\n @show.call \"Done!\\nSearching for duplicated files...\"\n extensions = Parallel.map(extensions) do |extension|\n nb = 0\n dups = []\n process(extension).each do |key, value|\n dups << {type: \"array\", header: [\"Files duplicated with #{key}\", \"percentage\"], rows: value}\n nb += value.length + 1\n end\n {name: extension.name, nb: nb, dups: dups}\n end\n nb = 0\n dups_extensions = []\n extensions.each do |value|\n next if value[:dups] == []\n nb += value[:nb]\n dups_extensions.push([value[:name], value[:nb]])\n value[:dups].each { |v| result.add_array(header: v[:header], rows: v[:rows]) }\n end\n dups_extensions.sort! {|a, b| b[1] <=> a[1]}\n result.add_array(header: [\"Extension\", \"number\"], rows: dups_extensions, title: \"Most duplicated extensions\")\n result.add_text(text: \"Total number of duplication: #{nb}\")\n result.add_text(text: \"Total number of files analyzed: #{FileSystem.count}\")\n @show.call \"Done!\"\n end",
"def post_process_results(original_results_directory = nil)\n puts ' ========================= Starting Results Post Process ================================'\n puts \"Current directory: #{@base_dir}\"\n puts \"Test results will be stored in: #{test_results_dir}\"\n\n results = OpenStudioMeasureTester::OpenStudioTestingResult.new(@base_dir, test_results_dir, original_results_directory)\n results.save_results # one single file for dashboard\n\n # call the create dashboard command now that we have results\n dashboard\n\n # return the results exit code\n return results.exit_code\n end",
"def index\n if(params.has_key?(:import) && params[:import] == \"true\")\n Dir.glob(Rails.public_path.join('import').join('*data.txt')) do |item|\n valueTypeDetail = ''\n valueType = nil\n stnDetail = ''\n stn = nil\n require 'csv'\n CSV.foreach(item, :headers => true, :col_sep => ';' ) do |row|\n\n # Get station ID\n if(row['stn'] != stnDetail)\n stn = Station.find_by( details: row['stn'])\n stnDetail = row['stn']\n end\n # Create Unix Timestamp\n tz =Time.zone = 'Bern'\n tz = Time.zone.parse(row[1])\n\n # puts row[1]\n # Get value_type ID\n if(row.to_hash.keys[2] != valueTypeDetail)\n valueType = ValueType.find_by(:details => row.to_hash.keys[2])\n valueTypeDetail = row.to_hash.keys[2]\n end\n Measurement.new(station_id: stn.id, value_type_id: valueType.id, measured_at: tz.utc.iso8601, measured_value: row[2] ).save!\n end\n end\n end\n # @measurements = Measurement.all\n @measurements = Measurement.order(:measured_at).limit(10)\n end",
"def check_file(file_result)\n begin\n ::YAML.load(File.read(file_result.path))\n rescue Psych::SyntaxError => e\n file_result.add_issue(\n line_number: e.line,\n character: e.column,\n level: :error,\n raw_message: e.problem,\n )\n end\n end",
"def calculate_results\n Repository::Config.new(@repo, @log, @process, @type).status(5) {\n files = files_to_analyze\n puts '-----Files to analyze done (Step 1)'\n files = prepare_files_to_rate files\n puts '-----Prepare files to rate done (Step 2)'\n files = count_total_lines files\n puts '-----Count total lines done (Step 3)'\n files = count_errors files\n puts '-----Count errors done (Step 4)'\n files = grade_categories files\n puts '-----Grade categories done (Step 5)'\n files = grade_files files\n puts '-----Grade files done (Step 6)' + files.to_s\n gpa = grade_repo files\n puts '-----Grade repos done (Step 7)' + gpa.to_s\n gpa_percent = get_overall_grades files\n puts '-----Grade overall percentage done (Step 8)' + gpa_percent.to_s\n cat_issues = get_category_issues files\n puts '-----Get categories issues done (Step 9)' + cat_issues.to_s\n store_cat_issues cat_issues\n puts '-----Store category issues done (Step 10)'\n store_grades gpa, gpa_percent\n puts '-----Store grades done (Step 11)'\n }\n end",
"def add_result_read_quality(base, _opts)\n return nil unless result_files_exist?(base, %w[.solexaqa .fastqc])\n\n add_files_to_ds_result(\n MiGA::Result.new(\"#{base}.json\"), name,\n solexaqa: '.solexaqa', fastqc: '.fastqc'\n )\n end",
"def add_result_distances_ref(base)\n pref = File.dirname(base)\n return nil unless File.exist?(\"#{pref}/01.haai/#{name}.db\")\n\n MiGA::Result.new(\"#{base}.json\").tap do |r|\n r.add_files(\n haai_db: \"01.haai/#{name}.db\",\n aai_db: \"02.aai/#{name}.db\",\n ani_db: \"03.ani/#{name}.db\"\n )\n end\n end",
"def add_result_distances_ref(base)\n pref = File.dirname(base)\n return nil unless File.exist?(\"#{pref}/01.haai/#{name}.db\")\n\n MiGA::Result.new(\"#{base}.json\").tap do |r|\n r.add_files(\n haai_db: \"01.haai/#{name}.db\",\n aai_db: \"02.aai/#{name}.db\",\n ani_db: \"03.ani/#{name}.db\"\n )\n end\n end",
"def add_result_distances_nonref(base)\n return nil unless\n result_files_exist?(base, %w[.aai-medoids.tsv .aai.db]) or\n result_files_exist?(base, %w[.ani-medoids.tsv .ani.db])\n r = MiGA::Result.new(\"#{base}.json\")\n add_files_to_ds_result(r, name, aai_medoids: \".aai-medoids.tsv\",\n haai_db: \".haai.db\", aai_db: \".aai.db\", ani_medoids: \".ani-medoids.tsv\",\n ani_db: \".ani.db\", ref_tree: \".nwk\", ref_tree_pdf: \".nwk.pdf\",\n intax_test: \".intax.txt\")\n end",
"def add_result_distances_ref(base)\n pref = File.dirname(base)\n return nil unless\n File.exist?(\"#{pref}/01.haai/#{name}.db\")\n r = MiGA::Result.new(\"#{base}.json\")\n r.add_files(haai_db: \"01.haai/#{name}.db\", aai_db: \"02.aai/#{name}.db\",\n ani_db: \"03.ani/#{name}.db\")\n r\n end",
"def import(filename=\"import/study_units.csv\")\n require 'csv'\n CSV.foreach(filename, headers: true) do |row|\n @row = row.to_hash\n @study_unit = StudyUnit.where(study_id: id, name: @row[\"study_unit.name\"]).first ||\n StudyUnit.create(study_id: id, name: @row[\"study_unit.name\"])\n @logical_product = LogicalProduct.where(study_unit_id: @study_unit.id, name: @row[\"logical_product.name\"]).first ||\n LogicalProduct.create(study_unit_id: @study_unit.id, name: @row[\"logical_product.name\"])\n @concept = Concept.find_or_create_by_name(@row[\"concept.name\"])\n @variable_group = VariableGroup.where(logical_product_id: @logical_product.id, concept_id: @concept.id,\n name: @row[\"variable_group.name\"]).first ||\n VariableGroup.create(logical_product_id: @logical_product.id, concept_id: @concept.id,\n name: @row[\"variable_group.name\"], label: @row[\"variable_group.label\"])\n end\n end",
"def read_result(index=nil)\n\t\tindex=0 if (!index)\n\t\tres=nil\n\t\tbegin\n\t\t\t0.upto(index-1) { |i| Marshal.load(@fp) }\n\t\t\tres=Marshal.load(@fp)\n\t\trescue\n\t\t\tSD::Log.msg('Err',\n\t\t\t \"BaseResultFile.read_result file reading error for index: #{index}\", $!)\n\t\t\tres=nil\n\t\tend\n\t\treturn res\n\tend",
"def uploadResultsToLIMS()\n uploadCmd = \"ruby \" + PathInfo::WRAPPER_DIR + \n \"/ResultUploader.rb ANALYSIS_FINISHED\"\n output = `#{uploadCmd}`\n puts output\n end",
"def uploadResultsToLIMS()\n uploadCmd = \"ruby \" + PathInfo::WRAPPER_DIR + \n \"/ResultUploader.rb ANALYSIS_FINISHED\"\n output = `#{uploadCmd}`\n puts output\n end",
"def run(results)\n columns_names = rows.first.inject([]) {|m, kv| m << kv[0]; m}\n row_count = rows.size\n initial_data = results.all.map {|r| columns.map {|c| r[c]}}\n asrecordset = ASRecordset.new(row_count,column_names,initial_data)\n \tresult = asrecordset\n \treturn result\n end",
"def result_tuples(result, id)\n Testing.read_tuples(result, id.to_s).map{|tuples| tuples.to_a}\nend",
"def log_results( executable, procedure, results )\n if Maadi::Generic::Executable.is_executable?( executable ) and Maadi::Procedure::Procedure::is_procedure?( procedure ) and Maadi::Procedure::Results::is_results?( results )\n t = Time.now\n log_time = \"#{t.strftime('%Y/%m/%d %H:%M:%S')}\"\n\n if @db != nil\n is_ok = false\n rId = -1\n\n begin\n stm = @db.prepare( 'INSERT INTO tblResults (rTestId, rTime, rApp, rProc, rProcId) VALUES (?, ?, ?, ?, ?)')\n stm.bind_params( procedure.key_id, log_time, executable.to_s, procedure.to_s, procedure.key_id )\n rs = stm.execute\n rId = @db.last_insert_row_id.to_s\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an INSERT Results error (#{e.message}).\")\n end\n\n if is_ok && rId != -1\n if results.key_id == -1\n results.key_id == rId\n end\n # attempt to insert the procedure's steps into the tblSteps, since the tblProcedure INSERT was successful\n # CREATE TABLE IF NOT EXISTS tblResultData ( dID integer primary key, rID integer, dStep varchar(255), dStatus varchar(255), dType varchar(255), dData TEXT)\n\n results.results.each do |result|\n is_ok = false\n rdId = -1\n\n begin\n stm = @db.prepare( 'INSERT INTO tblResultData (rID, dStep, dStepId, dStatus, dType, dData) VALUES (?, ?, ?, ?, ?, ?)' )\n stm.bind_params( rId, result.step_name, result.step_key, result.status, result.type, result.data.to_s )\n rs = stm.execute\n rdId = @db.last_insert_row_id.to_s\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an INSERT Result error (#{e.message}).\")\n end\n\n # if we have encountered any INSERT errors, do not attempt to process any more INSERTs\n break if !is_ok\n\n if result.key_id == -1\n result.key_id = rdId\n end\n end\n end\n end\n end\n end",
"def summarize_results!(all_results)\n \t summaries = {}\n \t all_results.each do |paramset, results|\n \t File.open(@dir + \"/results-#{param_string(paramset)}.yaml\", 'w' ) do |out|\n \t\t\tYAML.dump(results, out)\n \t\tend\n \t\tsummaries[paramset] = {}\n \t\t# create an array of arrays\n \t\tres = results.keys.map do |key| \n \t\t # calculate stats\n \t\t a = results[key]\n \t\t if a.all? {|el| el.is_a? Numeric }\n \t\t summaries[paramset][\"#{key} mean\"] = Stats::mean(a)\n \t\t summaries[paramset][\"#{key} SD\"] = Stats::standard_deviation(a)\n \t\t [key] + a + [Stats::mean(a), Stats::standard_deviation(a)]\n \t\t else\n \t\t [key] + a + [\"--\", \"--\"]\n \t end\n \t\t end\n\t\t \n \t\t ls = results.keys.map{|v| [7, v.to_s.length].max }\n \t\t\n \t\tls = [\"Std Deviation\".length] + ls\n \t\tres = header_column + res\n \t\tres = res.transpose\n \t\tout = build_table res, ls\n \t\tFile.open(@dir + \"/#{paramset}-summary.mmd\", 'w') do |f|\n \t\t f << \"## Results for #{@experiment} with parametres #{param_string(paramset, \", \")} ##\\n\\n\"\n \t\t f << out\n \t\t end\n\t\t end\n\t\t \n\t\t # Build CSV file with all of the results\n\t\t #puts summaries.inspect\n\t\t \n\t\t summaries = summaries.to_a\n #puts summaries.inspect\n\t\t keys1 = summaries.first.first.keys\n\t\t keys2 = summaries.first.last.keys\n\t\t #puts keys1.inspect, keys2.inspect, \"=====\"\n CSV.open(@dir + \"/results.csv\", \"w\") do |csv|\n \t csv << keys1 + keys2\n \t summaries.each do |summary|\n \t #puts summary.first.inspect\n \t #puts summary.first.values_at(*keys1).inspect + summary.last.values_at(*keys2).inspect\n \t csv << summary.first.values_at(*keys1) + summary.last.values_at(*keys2)\n \t \n \t end\n \t end\n\t\t \n\t end",
"def set_result\n results = result_params\n unless results.nil?\n if results.is_a?(String)\n parts = results.split(\"#\")\n @result = @measurement.results.find(parts[0].to_i)\n end\n end\n end",
"def process_result\n end",
"def scanResultJson(result)\n setBasename(result[\"basename\"]) ;\n @config = result[\"config\"] ;\n @demandStat = result[\"demandStat\"] ;\n end",
"def result(k)\n return nil if @@RESULT_DIRS[k.to_sym].nil?\n MiGA::Result.load(\n \"#{project.path}/data/#{@@RESULT_DIRS[k.to_sym]}/#{name}.json\" )\n end",
"def import_file_table\n @error = true\n scanned_data = ReadFile.scan(sale_params[:file_table], Sale.regex_read_file_table)\n if scanned_data\n begin\n sales_mapped = Sale.map_scanned_data scanned_data\n Sale.create(sales_mapped)\n @total_gross_income = Sale.calc_total_gross_income sales_mapped\n @error = false\n rescue\n end\n end\n end",
"def set_result\n @result = Api::V1::Result.find(params[:id])\n end",
"def add_result_essential_genes(base, _opts)\n return nil unless result_files_exist?(base, %w[.ess.faa .ess .ess/log])\n\n add_files_to_ds_result(\n MiGA::Result.new(\"#{base}.json\"), name,\n ess_genes: '.ess.faa',\n collection: '.ess',\n report: '.ess/log',\n alignments: '.ess/proteins.aln',\n fastaai_index: '.faix.db.gz',\n fastaai_index_2: '.faix',\n fastaai_crystal: '.crystal'\n )\n end",
"def import_from_index(errors)\n doc = Hpricot.XML(index_data)\n hyper_format = (doc.root.name == 'sigla')\n elements = hyper_format ? (doc/:siglum) : (doc/:url)\n puts \"Import from Index file, #{elements.size} elements\"\n # Read the Attributes from the urls\n source_attributes = []\n my_importer = importer.classify.constantize\n progressor.run_with_progress('Reading w/ index', elements.size) do |prog|\n elements.each do |element|\n url = make_url_from(\"#{element.inner_text}#{ENV['extension']}\")\n begin\n this_attribs = my_importer.sources_from_url(url, credentials)\n source_attributes = source_attributes + this_attribs\n rescue Exception => e\n message_stream.puts \"Problem importing #{url} (#{e.message})\"\n message_stream.puts e.backtrace\n end\n prog.inc\n end\n end\n # Write the data\n TaliaCore::ActiveSource.progressor = progressor\n TaliaCore::ActiveSource.create_multi_from(source_attributes, :errors => errors, :duplicates => duplicates)\n end",
"def result\n if @project && @project.miga &&\n (result = @project.miga.result(params[:result])) &&\n (file = result.data[:files][params[:file].to_sym])\n send_result(file, result)\n else\n head :ok, content_type: 'text/html'\n end\n end",
"def parse_results(results)\n results.rows.collect do |row|\n record = {}\n row.each_with_index{|val, i| \n val = val.force_encoding('utf-8') if val\n record[results.fields[i].name] = val\n }\n \n record\n end\n end",
"def process_result(body)\n if body =~ RESULT_TITLE\n # this is a result\n units, place = $1, $2\n if body =~ EX_TEMP\n temp = $1\n out = if EXTMODE\n overview = ((m = EX_OVERVIEW.match(body)) ? m[1] : '?')\n wind_dir, wind_speed = ((m = EX_WIND.match(body)) ? m[1,2] : ['?','?'])\n humidity = ((m = EX_HUMIDITY.match(body)) ? m[1] : '?')\n pressure = ((m = EX_PRESSURE.match(body)) ? m[1] : '?')\n visibility = ((m = EX_VISIBILITY.match(body)) ? m[1] : '?')\n\n \"\\n#{place}\\n\" +\n \" Temp : #{temp} degrees #{units}\\n\" +\n \" Wind : #{wind_dir} (#{wind_speed} mph)\\n\" +\n \" Humidity (%) : #{humidity}\\n\" +\n \" Pressure (mB): #{pressure.chop}\\n\" +\n \" Visibility : #{visibility}\"\n else\n \"#{place} - #{temp} degrees #{units}\"\n end\n\n puts out\n else\n puts \"No data for #{place}\"\n end\n elsif body =~ MULTI_RESULT_TITLE \n # multiple or no result\n if body =~ NO_LOCS \n puts \"No locations matched '#{$1}'\"\n else\n a = collect_results(body) \n\n if a.length > 0\n unless n = AUTOSELECT\n puts \"Multiple results:\\n\"\n puts \" [0]\\tCancel\"\n a.each_with_index do |e,i|\n puts \" [#{i+1}]\\t#{e.first}\"\n end\n\n puts \" [A]\\tAll\\n\\n\"\n\n begin\n print \"Select (separate with spaces): \"\n n = STDIN.gets.chomp \n end until n =~ SELECT_INPUT \n end\n\n if n != '0' # 0 is cancel\n n.split(' ').inject([]) do |ary,i|\n if i.upcase == 'A'\n ary + a.map { |e| e.last }\n else\n ary << a[i.to_i - 1].last\n end\n end.each do |id|\n fetch_process(\"http://www.bbc.co.uk/weather/5day.shtml?#{id}\")\n end\n end\n else\n puts \"No usable results found\"\n end\n end\n else\n puts \"Unknown location\"\n end\nend",
"def import_soepinfo1(filename=\"import/soepinfo1.csv\", group=\"v1\")\n @group = Group.find_or_create_by_name_and_study_id(group, id)\n Study.transaction do\n CSV.foreach(filename = filename, headers: true) do |row|\n @row = row.to_hash\n @study_unit = StudyUnit.find_or_create_by_name_and_study_id(@row[\"study_unit\"], id)\n @logical_product = LogicalProduct.find_or_create_by_name_and_study_unit_id(@row[\"product\"], @study_unit.id)\n @physical_data_product = PhysicalDataProduct.find_or_create_by_name_and_group_id(@row[\"product\"], @group.id)\n @concept = Concept.find_or_create_by_name(@row[\"concept\"])\n @variable_group = VariableGroup.find_or_create_by_name_and_logical_product_id_and_concept_id(@row[\"variable\"], @logical_product.id, @concept.id)\n @variable = Variable.find_or_create_by_name_and_physical_data_product_id_and_variable_group_id(@row[\"variable\"], @physical_data_product.id, @variable_group.id)\n @variable_category = VariableCategory.create(value: @row[\"category_val\"], label: @row[\"category_lab\"], variable_id: @variable.id)\n end\n end\n\n end",
"def report(result_set)\n print '.' and return if result_set.success?\n\n puts\n files = Hash.new { |h, k| h[k] = File.readlines(k) }\n result_set.each do |result|\n file = files[result.filename]\n node = result.node\n puts \"#{result.filename}:#{node.line}\"\n puts \"#{node.line-1}: #{file[node.line - 2]}\" if file[node.line - 2] && !(node.line - 2).negative?\n puts \"#{node.line}: #{file[node.line - 1]}\"\n puts \"#{node.line+1}: #{file[node.line]}\" if file[node.line]\n puts '-' * 16\n end\n puts\n end",
"def analyze\n @analysis = Analysis.new(directory)\n @analysis.scan\n #@analysis.save!\n end",
"def build_and_save_imported_result(row_hash, user, competition)\n result = ExternalResult.preliminary.create(\n competitor: CompetitorFinder.new(competition).find_by(bib_number: row_hash[:bib_number]),\n points: row_hash[:points],\n details: row_hash[:details],\n status: row_hash[:status],\n entered_at: Time.current,\n entered_by: user\n )\n if result.persisted?\n true\n else\n result.errors.full_messages.each do |message|\n @errors << message\n end\n false\n end\n rescue ActiveRecord::RecordNotFound\n @errors << \"Unable to find registrant (#{row_hash})\"\n false\n end",
"def load_results_archive\n @results_archive = load_component(Component::ResultDataType, 'results_archive')\n runtime.save(:results_archive, @results_archive)\n end",
"def add_result_essential_genes(base, _opts)\n return nil unless result_files_exist?(base, %w[.ess.faa .ess .ess/log])\n\n add_files_to_ds_result(\n MiGA::Result.new(\"#{base}.json\"), name,\n ess_genes: '.ess.faa',\n collection: '.ess',\n report: '.ess/log',\n alignments: '.ess/proteins.aln'\n )\n end",
"def import(date, file, min_page = 0, max_page)\r\n\r\n \tputs \"Importing data from: #{file}\"\r\n\r\n # Load date\r\n @date = date\r\n\r\n # Regex patterns\r\n id_regex = /^(0|\\d{6,9}|\\d{12,13}|X{13}|UPI\\d{8,10}(?:\\/\\d)?|U\\/I-\\d{4}\\/\\d{2}|UF\\/I\\d{4}\\/\\d{2}|\\d{2,3}-\\d{1,7}-\\d{1,7}(?:[\\/|\\-|\\s]\\d{1,4})?)$/\r\n\r\n # output dir\r\n out_dir = File.join(Rails.root, \"db\", \"export\")\r\n Dir.mkdir(out_dir) if !Dir.exist?(out_dir)\r\n\r\n @banks = Set.new\r\n\r\n # Output CSV files\r\n @result_csv = CSV.open(File.join(out_dir, \"#{date}.csv\"), \"w\")\r\n\r\n owner_lines = []\r\n\r\n # Statistics\r\n @total = {}\r\n @total.default = 0\r\n\r\n @cases = [0, 0, 0, 0, 0, 0]\r\n\r\n start = Time.now\r\n \tPDF::Reader.new(file).pages.each_with_index do |page, page_num|\r\n \t\t#Skip first min_page\r\n next if page_num < min_page\r\n\r\n # Stop after max_page \r\n \t\tbreak if page_num > max_page\r\n\r\n @total[:pages] += 1\r\n\r\n \t\t\tpage.text.lines.each do |line|\r\n # skip empty lines\r\n \t\t\t\tif !line.strip!.blank?\r\n\r\n \t\t\t\t\t# Match owner ID - this is new owner\r\n \t\t\t\t\tif line =~ id_regex\r\n \t\t\t\t\t\t# parse and save owner info but skip first line\r\n \t\t\t\t\t\tparse(owner_lines) if !owner_lines.empty?\r\n\r\n \t\t\t\t\t\t# start capturing data for new owner\r\n \t\t\t\t\t\towner_lines = [$~[1]]\r\n # skip strings which are not accounts: headers and footers\r\n \t\t\t\t\telsif !(line =~ /Broj racuna/i || line =~ /^\\d{2}\\/\\d{2}\\/\\d{4}/ || line =~ /^JIB/) && (!owner_lines.empty?)\r\n \t\t\t\t\t\towner_lines << line.gsub(/\\s{2,}/,'\\t')\r\n \t\t\t\t\tend\r\n \t\t\t\tend\r\n \t\t\tend\r\n \t\tend\r\n\r\n @result_csv.close\r\n\r\n puts \"Statistics: #{@total.to_yaml}\\n#{@cases}\"\r\n puts \"Loading finished in: %3d:%04.2f\"%(Time.now-start).divmod(60.0)\r\n \tend",
"def perform(filename)\n\n # checking if already imported\n if dataset_marked? filename, 'imported'\n puts \"#{filename} is already imported, skipping.\"\n return\n end\n\n articles_to_import = []\n\n with_locked_file filename do\n puts \"Opening file at #{filename}\"\n file = File.open filename\n puts \"creating a nokogiri document...\"\n doc = Nokogiri.XML(file)\n\n # checking for errors in file\n if doc.errors.length > 0\n puts \"error reading file #{filename}, marking 'errors'\"\n mark_dataset(filename, 'errors')\n # mark the file as incomplete\n raise 'bad file'\n end\n\n # inserting into array\n doc.css('PubmedArticle').each do |article|\n pmid = article.css('MedlineCitation PMID').first.text.to_i\n raw_xml = article.to_s\n title = article.css('MedlineCitation Article ArticleTitle').first.try(:text)\n abstract = article.css('MedlineCitation Article Abstract AbstractText').first.try(:text)\n\n articles_to_import << [pmid, raw_xml, title, abstract] if pmid\n end\n\n # we are pretty confident about validity of data\n cols = [:pubmed_id, :raw_pubmed_xml, :title, :abstract]\n Rails.logger.silence do\n Article.import cols, articles_to_import, validate: false\n end\n\n # mark the file as imported\n unmark_dataset(filename, 'errors')\n mark_dataset(filename, 'imported')\n end\n end",
"def import(cnf)\n #\n # Connect to databases\n #\n begin\n $dbh_pg = DBI.connect(\n \"dbi:Pg:#{cnf[:from_db_name]}:\",\n cnf[:from_db_user],\n cnf[:from_db_password]\n )\n rescue\n STDERR.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog.\"\n Log.write_log(:error, \"Could not connect to database. Message: #{$!}\\ncnf:#{cnf.inspect}\")\n exit\n end\n begin\n $dbh_ms = DBI.connect(\n \"dbi:Mysql:#{cnf[:to_db_name]}:\",\n cnf[:to_db_user],\n cnf[:to_db_password]\n )\n rescue\n STDERR.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog.\"\n Log.write_log(:error, \"Could not connect to database. Message: #{$!}\")\n exit\n end\n $dbh_ms.do(\"SET sql_mode='TRADITIONAL,ANSI'\")\n $dbh_ms.do(\"SET NAMES 'utf8'\")\n \n $reaktor_insert_count = 0\n $import_log = 'import'\n $debug = cnf[:debug]\n \n #\n # Initialize plugins\n #\n ArtworkDataPlugin::set_data_path(cnf[:path_data])\n \n #\n # Drop id_store table if it exists\n #\n begin\n sth = $dbh_pg.execute(\"SELECT relname FROM pg_class WHERE relname = 'id_store'\")\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not process query. Message: #{$!} query: #{get_query_string(sth)}.\")\n raise\n exit\n end\n relname = sth.fetch\n \n if relname\n begin\n sth = $dbh_pg.execute(%Q{DROP TABLE id_store})\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not process query. Message: #{$!} query: #{get_query_string(sth)}.\")\n raise\n exit\n end\n STDERR.puts \"Dropped id_store table from prototype.\"\n end\n \n #\n # Load the schema map\n #\n require 'schema_map'\n \n #\n # Process tables\n #\n $schema.each do |t|\n process_table(t)\n end\n \n #\n # Write reports\n #\n ArtworkDataPlugin.flush_logs\n ArtworkDataPlugin.write_report\n \n ArtworkTopicTaggingPlugin::flush_logs\n ArtworkTopicTaggingPlugin::write_report\n \n ArtworkInternalDiscussionPlugin::flush_logs\n ArtworkInternalDiscussionPlugin::write_report\n \n ReaktoruserArtworkgroupsPlugin::flush_logs\n ReaktoruserArtworkgroupsPlugin::write_report\nend",
"def process_page_results(output_file_name, result_items)\n file = output_file(output_file_name)\n\n result_items.each do |result|\n file.write(\"#{result['id']},#{result['full_name']},#{result['language']}\\n\")\n end\nend",
"def log_results( executable, procedure, results )\n if Maadi::Generic::Executable.is_executable?( executable ) and Maadi::Procedure::Procedure::is_procedure?( procedure ) and Maadi::Procedure::Results::is_results?( results )\n t = Time.now\n File.open( @options['FILENAME'], 'a') do |f|\n f.puts \"#{t.strftime('%Y%m%d%H%M%S')}\\tRESULTS\\t#{results.key_id}\\t#{results.source}\\t#{executable.to_s}\\t#{procedure.to_s}\\t#{procedure.key_id}\\t#{results.to_s}\"\n\n results.results.each do |result|\n f.puts \"\\tRESULT\\t#{result.key_id}\\t#{result.step_key}\\t#{result.step_name}\\t#{result.target}\\t#{result.status}\\t#{result.type}\\t#{result.data.to_s}\"\n end\n end\n end\n end",
"def stored_data\n synchronize_resultset do\n return unless File.exist?(resultset_path)\n\n return unless (data = File.read(resultset_path))\n\n return if data.length < 2\n\n data\n end\n end",
"def process_dataset_results( results )\n # Extract all of the needed index mapping data from \"attribute_map\"\n map_data = process_attribute_map( @current[:dataset_conf] )\n \n # Now loop through the result data...\n results[:data].each do |data_row|\n # First, create a hash out of the data_row and get the primary_attr_value\n data_row_obj = convert_array_to_hash( results[:headers], data_row )\n primary_attr_value = data_row_obj[ map_data[:primary_attribute] ]\n \n # First check we have something to map back to the index with - if not, move along...\n if primary_attr_value\n # Find us a doc object to map to...\n value_to_look_up_doc_on = extract_value_to_index( map_data[:primary_attribute], primary_attr_value, map_data[:attribute_map], data_row_obj )\n doc = find_document( map_data[:map_to_index_field], value_to_look_up_doc_on )\n \n # If we can't find one - see if we're allowed to create one\n unless doc\n if @current[:dataset_conf][\"indexing\"][\"allow_document_creation\"]\n set_document( value_to_look_up_doc_on, new_document() )\n doc = get_document( value_to_look_up_doc_on )\n end\n end\n \n # Okay, if we have a doc - process the biomart attributes\n if doc\n # Now do the processing\n data_row_obj.each do |attr_name,attr_value|\n # Extract and index our initial data return\n value_to_index = extract_value_to_index( attr_name, attr_value, map_data[:attribute_map], data_row_obj )\n \n if value_to_index and doc[ map_data[:attribute_map][attr_name][\"idx\"] ]\n if value_to_index.is_a?(Array)\n value_to_index.each do |value|\n doc[ map_data[:attribute_map][attr_name][\"idx\"] ].push( value )\n end\n else\n doc[ map_data[:attribute_map][attr_name][\"idx\"] ].push( value_to_index )\n end\n end\n \n # Any further metadata to be extracted from here?\n if value_to_index and map_data[:attribute_map][attr_name][\"extract\"]\n index_extracted_attributes( map_data[:attribute_map][attr_name][\"extract\"], doc, value_to_index )\n end\n end\n \n # Do we have any attributes that we need to group together?\n if @current[:dataset_conf][\"indexing\"][\"grouped_attributes\"]\n index_grouped_attributes( @current[:dataset_conf][\"indexing\"][\"grouped_attributes\"], doc, data_row_obj, map_data )\n end\n \n # Any ontology terms to index?\n if @current[:dataset_conf][\"indexing\"][\"ontology_terms\"]\n index_ontology_terms( @current[:dataset_conf][\"indexing\"][\"ontology_terms\"], doc, data_row_obj, map_data )\n end\n \n # Finally - save the document to the cache\n doc_primary_key = doc[@config[\"schema\"][\"unique_key\"].to_sym][0]\n set_document( doc_primary_key, doc )\n end\n end\n end\n end",
"def populate_results(test_result)\n # Note: id is not an XCCDF 1.2 compliant identifier and will need to be updated when that support is added.\n test_result.id = 'result_1'\n test_result.starttime = run_start_time\n test_result.endtime = run_end_time\n\n # Build out individual results\n all_rule_result = []\n\n @data['controls'].each do |control|\n next if control['results'].empty?\n\n control_results =\n control['results'].map do |result|\n populate_rule_result(control, result, xccdf_status(result['status'], control['impact']))\n end\n\n # Consolidate results into single rule result do to lack of multiple=true attribute on Rule.\n # 1. Select the unified result status\n selected_status = control_results.reduce(control_results.first.result) { |f_status, rule_result| xccdf_and_result(f_status, rule_result.result) }\n\n # 2. Only choose results with that status\n # 3. Combine those results\n all_rule_result << combine_results(control_results.select { |r| r.result == selected_status })\n end\n\n test_result.rule_result = all_rule_result\n test_result\n end",
"def process_excel_project(filename, output_path)\n analyses = OpenStudio::Analysis.from_excel(filename)\n if analyses.size != 1\n puts 'ERROR: EXCEL-PROJECT -- More than one seed model specified. This feature is deprecated'.red\n fail 1\n end\n analysis = analyses.first\n analysis.save \"#{output_path}.json\"\n analysis.save_zip \"#{output_path}.zip\"\n\n OpenStudio::Analysis.aws_instance_options(filename)\nend",
"def add_result_read_quality(base, _opts)\n return nil unless result_files_exist?(base, %w[.solexaqa .fastqc])\n r = MiGA::Result.new(\"#{base}.json\")\n add_files_to_ds_result(r, name,\n solexaqa: \".solexaqa\", fastqc: \".fastqc\")\n end",
"def data_import\n message = I18n.t(\"ag2_human.import.index.result_ok_message_html\")\n @json_data = { \"DataImport\" => message, \"Result\" => \"OK\" }\n # $alpha = \"\\xC1\\xC9\\xCD\\xD3\\xDA\\xDC\\xD1\\xC7\\xE1\\xE9\\xED\\xF3\\xFA\\xFC\\xF1\\xE7\\xBF\\xA1\\xAA\\xBA\".force_encoding('ISO-8859-1').encode('UTF-8')\n # $gamma = 'AEIOUUNCaeiouunc?!ao'\n # $ucase = \"\\xC1\\xC9\\xCD\\xD3\\xDA\\xDC\\xD1\\xC7\".force_encoding('ISO-8859-1').encode('UTF-8')\n # $lcase = \"\\xE1\\xE9\\xED\\xF3\\xFA\\xFC\\xF1\\xE7\".force_encoding('ISO-8859-1').encode('UTF-8')\n # $positions = \"presidentedirectorjeferesponsablegerentetecnicoauxauxiliaradmadminadministrativoadministrativa\"\n incidents = false\n message = ''\n first_name = ''\n last_name = ''\n\n # Read parameters from data import config\n data_import_config = DataImportConfig.find_by_name('workers')\n source = source_exist(data_import_config.source, nil)\n if source.nil?\n message = I18n.t(\"ag2_human.import.index.result_error_message_html\")\n @json_data = { \"DataImport\" => message, \"Result\" => \"ERROR\" }\n render json: @json_data\n return\n end\n # Loop thru 'empresa' records\n empresa = DBF::Table.new(source + \"empresa.dbf\")\n empresa.each do |e|\n # Do not import deleted 'empresa'\n if e.nil?\n next\n end\n # Search linked office\n office = Office.find_by_nomina_id(e.ccodemp)\n if !office.nil?\n company = office.company\n # Loop thru 'trabaja.dbf' records for current 'empresa/company' record\n source = source_exist(data_import_config.source, e.ccodemp)\n if !source.nil?\n # Import account code\n cctagene = nil\n empnomi = DBF::Table.new(source + \"empnomi.dbf\")\n enf = empnomi.first\n if !enf.nil?\n cctagene = enf.cctagene\n end\n # Import workers\n trabaja = DBF::Table.new(source + \"trabaja.dbf\")\n trabaja.each do |t|\n # Do not import deleted worker\n if t.nil?\n next\n end\n # Do not import worker with active withdrawal date\n if !t.dfecbaj.blank? && t.dfecbaj <= DateTime.now.to_date\n next\n end\n # Setup nomina_id & fiscal_id\n nomina_id = e.ccodemp + '-' + t.ccodtra\n fiscal_id = sanitize_string(t.cdni, true, false, false, false) unless t.cdni.blank?\n # Store names for error messages\n first_name = sanitize_string(t.cnomtra, true, false, false, true) unless t.cnomtra.blank?\n last_name = sanitize_string(t.capetra, true, false, false, true) unless t.capetra.blank?\n # Maybe worker & item exist\n new_worker = false\n new_worker_item = false\n new_worker_salary = false\n # Search for worker by fiscal_id\n worker = Worker.find_by_fiscal_id(fiscal_id)\n if worker.nil?\n # Yes, it's new, but do not import new worker with blank email\n if t.cemail.blank?\n next\n end\n # New worker\n new_worker = true\n new_worker_item = true\n new_worker_salary = true\n worker = Worker.new\n worker_item = WorkerItem.new\n worker_salary = WorkerSalary.new\n # Initialize worker (fiscal_id) & worker item (nomina_id)\n worker.fiscal_id = fiscal_id\n worker_item.nomina_id = nomina_id\n else # Worker exists, check for item\n # Search for worker_item by nomina_id\n worker_item = WorkerItem.find_by_nomina_id(nomina_id)\n if worker_item.nil?\n # New worker_item\n new_worker_item = true\n new_worker_salary = true\n worker_item = WorkerItem.new\n worker_salary = WorkerSalary.new\n # Initialize worker item (nomina_id)\n worker_item.nomina_id = nomina_id\n end\n end\n # Update worker first\n worker = update_worker(worker, t, company, office, new_worker, cctagene)\n # And then worker item\n worker_item = update_worker_item(worker_item, t, company, office, new_worker_item, cctagene)\n # Try save them\n if worker.user_id > 0\n # Save worker\n if !worker.save\n # Error: Workers Updater finished unexpectedly!\n incidents = true\n message += \"<br/>\".html_safe + e.ccodemp + \" - \" + last_name + \" \" + first_name + \" - \" + t.cemail\n #break # Import cancelled at company level\n else\n # Save worker item\n if new_worker_item\n worker_item.worker_id = worker.id\n end\n if !worker_item.save\n # Error: Workers Updater finished unexpectedly!\n incidents = true\n message += \"<br/>\".html_safe + e.ccodemp + \" - \" + last_name + \" \" + first_name + \" - \" + t.cemail\n else\n if new_worker_salary\n # Save worker salary\n worker_salary.worker_item_id = worker_item.id\n worker_salary.year = Date.today.year\n worker_salary.gross_salary = t.nbruto unless t.nbruto.blank?\n if !worker_salary.save\n # Error: Workers Updater finished unexpectedly!\n incidents = true\n message += \"<br/>\".html_safe + e.ccodemp + \" - \" + last_name + \" \" + first_name + \" - \" + t.cemail\n end # worker_salary.save if\n end # new_worker_salary if\n end # worker_item.save if\n end # worker.save if\n end # worker.user_id if\n end # trabaja do\n end # source if\n end # office if\n end # empresa do\n if incidents\n message = I18n.t(\"ag2_human.import.index.result_ok_with_error_message_html\") + message\n @json_data = { \"DataImport\" => message, \"Result\" => \"ERROR\" }\n end\n render json: @json_data\n end",
"def parse_result(data)\n Parser.process(data)\n end",
"def import()\n # TODO\n end",
"def test_result_file=(file)\n @test_result_file = file\n end",
"def write(file_path, query_result)\n line_number = 0\n CSV.open(file_path, \"w\") do |csv|\n query_result.get_result.stream_each do |row|\n csv << row.map{ |_,field| field.is_a?(String) ? field.gsub(\"\\n\", \" \") : field }\n line_number+=1\n end\n end\n line_number\n end",
"def getResultFileNames()\n resultDir = File.dirname(File.dirname(File.expand_path(Dir.pwd)))\n @demuxBustardSummaryXML = resultDir + \"/DemultiplexedBustardSummary.xml\"\n\n baseCallsStatsDir = Dir[resultDir + \"/Basecall_Stats_*\"]\n @demuxStatsHTM = baseCallsStatsDir[0] + \"/Demultiplex_Stats.htm\"\n\n if !File::exist?(@demuxBustardSummaryXML)\n raise \"File \" + @demuxBustardSummaryXML + \" does not exist or is unreadable\"\n end\n\n if !File::exist?(@demuxStatsHTM)\n raise \"File \" + @demuxStatsHTM + \" does not exist or is unreadable\"\n end\n \n end",
"def add(result_type)\n mf_debug \"result requested #{result_type}\"\n metric_options = metric_options_for_result_type(result_type)\n generator_class = MetricFu::Generator.get_generator(result_type)\n mf_debug \"result class found #{generator_class}\"\n generator = generator_class.new(metric_options)\n\n result_hash.merge!(generator.generate_result)\n\n generator.per_file_info(per_file_data) if generator.respond_to?(:per_file_info)\n end",
"def read_result(index=nil)\n\t\treturn nil if (!@fp)\n\t\t@fp.rewind\n\t\tsuper\n\tend",
"def add_result_raw_reads(base, _opts)\n return nil unless result_files_exist?(base, '.1.fastq')\n\n add_files_to_ds_result(\n MiGA::Result.new(\"#{base}.json\"), name,\n if result_files_exist?(base, '.2.fastq')\n { pair1: '.1.fastq', pair2: '.2.fastq' }\n else\n { single: '.1.fastq' }\n end\n )\n end",
"def extract_results testname, testdir\n \n for row in exec_query(NODEEVALSQL, \"#{CSPREFIX}#{File.join(testdir,'results.mdb')};\")\n \n # find the traveltime entry in order to gain additional insight\n node = @vissim.nodes.find{|n| n.number == row['NODE']}\n fromnum, tonum = row['FROMLINK'], row['TOLINK']\n fromlink = @vissim.link(fromnum)\n tolink = @vissim.link(tonum)\n \n results = {}\n COLS_TO_HEADERS.each{|k,h| results[k] = row[k]}\n \n self << NodeEvaluation.new(testname, node, fromlink, tolink, row['TSTART'], row['TEND'], results)\n end\n end",
"def collect_alma_data( source_dir:, source_file_name:, ingestConf:, options:)\n\n puts \"START COLLECTING\"\n ######################################################################################\n reiresConfJson = File.read(File.join(File.dirname(__FILE__), '../config/config.cfg'))\n reiresConf = JSON.parse(reiresConfJson)\n\n ######################### Dataset and Dataprovider Configuration ######################\n @dataset = ingestConf[\"dataset\"]\n @provider = ingestConf[\"provider\"]\n @license = ingestConf[\"license\"]\n\n @mediaUrlPrefix = ingestConf[\"mediaUrlPrefix\"]\n @same_as_template = ingestConf[\"same_as_template\"]\n\n @metaLanguage = ingestConf[\"metaLanguage\"]\n @unicode_script = ingestConf[\"unicode_script\"]\n @recordLanguage = ingestConf[\"recordLanguage\"]\n @defaulttype =ingestConf[\"defaulttype\"] \n @genericRecordDesc = ingestConf[\"genericRecordDesc\"]\n\n ingestdata = {\n \"provider\" => @provider,\n \"dataset\" => @dataset,\n \"license\" => @license,\n \"name\" => @genericRecordDesc\n }\n @isBasedOn = build_isBasedOn(ingestdata)\n\n #######################################################################################\n @url_prefix = reiresConf[\"url_prefix\"]\n @prefixid = \"#{reiresConf[\"prefixid\"]}_#{ @provider[\"@id\"] }_#{ @dataset[\"@id\"] }\"\n\n # @sdLicense = reiresConf[\"sdLicense\"]\n # @sdPublisher = reiresConf[\"sdPublisher\"]\n #######################################################################################\n\n \n #Link to Limo => bases on institution id\n #same_as_template = \"https://limo.libis.be/primo-explore/search?query=any,contains,<#record_id>&vid=KULeuven&lang=en_US\"\n #Link to Limo => bases on networkzone id (different publishing profile)\n # same_as_template = https://limo.libis.be/primo-explore/fulldisplay?docid=<#record_id>&context=L&vid=KULeuven&search_scope=ALL_CONTENT&tab=all_content_tab&lang=en_US\n\n records_dir = \"#{RECORDS_DIR}/Alma_KULeuven/#{@dataset[\"@id\"]}\"\n \n @counter = 0\n record_count = 0\n \n if options[:full_export] \n log(\"Clear records #{records_dir}/*.json\")\n Dir.glob(\"#{records_dir}/*.json\").each { |file| File.delete(file)}\n else\n log(\"DO NOT CLEAR RECORDS DIR; It is a partial export [#{records_dir}]\")\n end\n\n source_dir = source_dir || SOURCE_RECORDS_DIR\n log(\"SOURCE_RECORDS_DIR : #{ source_dir }\")\n log(\"source_file_name : #{ source_file_name }\")\n \n# filter(data, '$..collection.record').each do |record|\n\n nori = Nori.new(parser: :nokogiri, strip_namespaces: true, convert_tags_to: lambda {|tag| tag.gsub(/^@/, '_')})\n\n Dir[\"#{source_dir}/#{source_file_name}\"].each_with_index do |source_file, index| \n log(\" parsing #{source_file}\")\n timing_start = Time.now\n x = XmlSplit.new(source_file, 'record')\n x.each_with_index { |node,i| \n filter( nori.parse(node) , '$.record').each do |record|\n #@logger.debug(\" ReIReS parser - record : #{record} \")\n ## To debug a large xml-file.\n ## Split the xml-file in smal chunks; 1 json representation per file\n\n=begin\n #if i % 7 == 0\n split_dir = \"/app/records/split_records\"\n unless File.directory?(split_dir)\n FileUtils.mkdir_p(split_dir)\n end\n file_name = \"#{split_dir}/record_#{i}.json\"\n File.open(file_name, 'wb') do |f|\n f.puts record.to_json\n end\n #end\n=end \n #if i.between?(24660 , 24670)\n parse_record( record: record, index: i, records_dir: records_dir)\n #end\n end\n index += 1\n if index % 5000 == 0\n @logger.info(\" ReIReS parser - #{index} records already parsed \") \n end\n }\n record_count += index\n end\n\n####### PARSE A FEW RECORDS !!!!!!!!!!!!!!!!!!######################\n=begin\nfiles =[]\nfiles << \"/app/records/split_records/record_68138.xml\"\nfiles << \"/app/records/split_records/record_15489.xml\"\n###################################################################\nrecords_dir = \"/app/records/Alma_KULeuven/test/\"\nDir.glob(\"#{records_dir}/*.json\").each { |file| File.delete(file)}\n\nfiles.each_with_index do |file,i| \n record = JSON.parse(File.read(file))\n parse_record( record: record, index: 0, records_dir: records_dir)\nend\n=end\n\nend",
"def importing\n @dataset = Dataset.where(id: params.fetch(:id)).first\n render plain: @dataset.import_status\n end",
"def _parse_file_using_import(file, layout, model)\n attributes = {}\n count = 0\n value_sets = []\n column_names = model.columns.map{ |column| column.name }\n not_nces_fields = column_names.select { |name| name[/id/] }\n field_names = column_names - not_nces_fields\n options = { :validate => false }\n mstate_index = field_names.index(\"MSTATE\")\n while (line = file.gets) do\n next if line.strip == ''\n values = []\n layout.each do |label, start_pos, end_pos, length, data_type, description|\n data_str = line[(start_pos-1)..(end_pos-1)].strip.gsub(/[^[:print:]]/, '')\n data_value = case data_type\n when 'N'\n data_str.to_i\n when 'D'\n data_str.to_f\n else\n data_str\n end\n values << data_value\n end\n if @states_and_provinces\n if @states_and_provinces.include?(values[mstate_index])\n value_sets << values\n end\n else\n value_sets << values\n end\n if value_sets.length >= 10\n records = model.import(field_names, value_sets, options)\n value_sets = values = []\n end\n count += 1\n if count % 500 == 0\n print '.'\n STDOUT.flush\n end\n end\n if value_sets.length > 0\n model.import(field_names, value_sets, options)\n end\n puts \"\\n#{count} records processed from #{file.path}\"\n end",
"def fetch_and_import!(opts={})\n eve_table = opts[:eve_table]\n dest_table = opts[:dest_table]\n mapping = opts[:mapping]\n dbh = opts[:conn] || @dbh\n comment_label = opts[:label]\n \n # Fetch Data from crpActivities Table\n results = dbh.query(\"SELECT * FROM \"+eve_table)\n # Clear Destination Table to eliminate Redundancy\n dest_table.camelize.constantize.delete_all\n # Do some Meta programming FU magic\n results.each do |row|\n insert_map = {}\n mapping.each do |key,value|\n insert_map[key.to_sym] = row[value]\n end \n dest_table.camelize.constantize.create!(insert_map)\n # Just so you see something when running this script..\n p \"Creating Record for #{dest_table} : \" + row[comment_label].to_s\n end\nend",
"def process_result res\n call = res[-1]\n\n check = check_call call\n\n if check and not @results.include? call\n @results << call\n\n if include_user_input? call[3]\n confidence = CONFIDENCE[:high]\n else\n confidence = CONFIDENCE[:med]\n end\n \n warn :result => res, \n :warning_type => \"Mass Assignment\", \n :message => \"Unprotected mass assignment\",\n :line => call.line,\n :code => call, \n :confidence => confidence\n end\n res\n end",
"def add_result(result_type, save=true, opts={})\n dir = @@RESULT_DIRS[result_type]\n return nil if dir.nil?\n base = File.expand_path(\"data/#{dir}/#{name}\", project.path)\n if opts[:force]\n FileUtils.rm(\"#{base}.json\") if File.exist?(\"#{base}.json\")\n else\n r_pre = MiGA::Result.load(\"#{base}.json\")\n return r_pre if (r_pre.nil? and not save) or not r_pre.nil?\n end\n r = File.exist?(\"#{base}.done\") ?\n self.send(\"add_result_#{result_type}\", base, opts) : nil\n r.save unless r.nil?\n r\n end",
"def add_result_essential_genes(base, _opts)\n return nil unless result_files_exist?(base, %w[.ess.faa .ess .ess/log])\n r = MiGA::Result.new(\"#{base}.json\")\n add_files_to_ds_result(r, name, ess_genes: \".ess.faa\",\n collection: \".ess\", report: \".ess/log\")\n end"
] |
[
"0.6698966",
"0.58360744",
"0.58332217",
"0.5769422",
"0.56747824",
"0.56346846",
"0.56202394",
"0.5610332",
"0.5585038",
"0.55586696",
"0.5529023",
"0.5504612",
"0.54733765",
"0.54568714",
"0.5454552",
"0.54086775",
"0.5393493",
"0.53922594",
"0.53881264",
"0.5352325",
"0.53299093",
"0.53275466",
"0.53198475",
"0.5314306",
"0.53007466",
"0.52648586",
"0.52643156",
"0.526217",
"0.526147",
"0.52612066",
"0.5247192",
"0.5231765",
"0.5231765",
"0.5231765",
"0.5231765",
"0.5231765",
"0.5231765",
"0.52310425",
"0.52244425",
"0.5223191",
"0.52213544",
"0.51999474",
"0.5180213",
"0.51643574",
"0.51612526",
"0.5157793",
"0.5157793",
"0.51551217",
"0.515148",
"0.5149461",
"0.5148326",
"0.5146087",
"0.5146087",
"0.5139894",
"0.5129542",
"0.5128556",
"0.51275414",
"0.5123771",
"0.5116168",
"0.5112544",
"0.5097441",
"0.5096952",
"0.5089381",
"0.50892204",
"0.5085024",
"0.50828236",
"0.5080952",
"0.5080196",
"0.50687176",
"0.5066097",
"0.50638473",
"0.50575644",
"0.50469667",
"0.504623",
"0.5045415",
"0.50394756",
"0.50317925",
"0.50309885",
"0.5027469",
"0.50241053",
"0.50193775",
"0.50189865",
"0.5015892",
"0.5005404",
"0.5005215",
"0.5003198",
"0.49922138",
"0.4989646",
"0.49827427",
"0.49739447",
"0.49610707",
"0.49524292",
"0.49489862",
"0.49468288",
"0.494574",
"0.49439982",
"0.49411076",
"0.49382362",
"0.49312574",
"0.492335",
"0.4919705"
] |
0.0
|
-1
|
==Validate some tables pdm database validate user_tasks c "count(0) == 500" c "avg(cost) 10"
|
def validate(table)
establish! do
options[:conditions].each do |cond|
validate! table, cond
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate_workflow\n e = 0\n status_usage = Array.new( flow_list.count, 0 )\n obsolete_use = Array.new( flow_list.count, 0 )\n @flow_list.each_with_index do |f,i|\n # count usage\n if f.status_id < 0 or f.status_id >= status_usage.count then\n puts \" status_id outside range: (0,#{flow_list.count})\"\n e += 1\n else\n status_usage[ f.status_id ] += 1\n obsolete_use[ f.status_id ] += 1 if f.obsolete\n end\n # there must be no gaps = undefined flows in the flow_list\n if f.nil? then\n puts \" Missing Flow definition with id = #{ i }\"\n e += 1\n else\n # flow id must match index in flow_list\n if i != f.id then\n puts \" Mismatch of flow_list index #{ i } and flow.id #{ f.id } - they must be identical.\"\n e += 1\n end\n end\n end\n # check number of status labels\n status_usage_sum = status_usage.reduce(0,:+)\n if status_usage_sum != flow_list.count then\n puts \" Number of status labels (#{ status_usage_sum }) does not correspond to number of flows (#{ flow_list.count })\"\n e += 1\n end\n if permit_duplicate_status then\n if status_list.count > flow_list.count then\n puts \" Number of status labels (#{ status_list.count }) must be <= number of flows (#{ flow_list.count })\"\n e += 1\n end\n else\n if status_list.count != flow_list.count then\n puts \" Number of status labels (#{ status_list.count }) must be == number of flows (#{ flow_list.count })\"\n e += 1\n end\n end\n status_usage.each_with_index do |u,i| \n if obsolete_use[ i ] > 0 and obsolete_use[ i ] != u then\n puts \" Status '#{ status_list[ i ]}' must be obsolete for ALL flows or NONE:\\n\" + \\\n \" Remove single obsolete flows manually instead of marking them as obsolete\"\n e += 1\n end\n end\n # check tasks\n @task_list.each_with_index do |t,i|\n # there must be no gaps = undefined tasks in the task_list\n if t.nil? then\n puts \" Missing Task definition with id = #{ i }\"\n e += 1\n else\n # task id must match index in task_list\n if i != t.id then\n puts \" Mismatch of task_list index #{ i } and task.id #{ t.id } - they must be identical.\"\n e += 1\n end\n # all tasks but the initial task must have incoming flows\n if t == @task_list.first then\n if !t.inflows.empty? then\n puts \" Initial Task must not have any incoming flows.\"\n e += 1\n end\n else\n if t.inflows.empty? then\n puts \" Task #{ t.id } '#{ t.label }' cannot be reached: no incoming flows.\"\n e += 1\n end\n end\n # all tasks but the terminal task must have outgoing flows\n if t == @task_list.last then\n if !t.outflows.empty? then\n puts \" Terminal Task must not have any outgoing flows.\"\n e += 1\n end\n else\n if t.outflows.empty? then\n puts \" Task #{ t.id } '#{ t.label }' has no outgoing flows but is not the Terminal Task.\"\n e += 1\n end\n end\n # task label must be unique\n @task_list[ i+1 .. -1 ].each do |s|\n next if s.nil?\n if s.label == t.label then\n puts \" Identical label for tasks #{ t.id } and { s.id }: '#{ t.label }'\"\n e += 1\n end\n end\n t.outflows.each do |fo|\n # flow must be in flow_list\n if fo != @flow_list[ fo.id ] then\n puts \" Outgoing flow from #{ t.id } with status '#{ fo.status }' not found in worklist's flow_list.\"\n e += 1\n end\n # outgoing flow must have a corresponding incoming flow - this should always pass\n if !@task_list[ fo.target_task_id ].inflows.include?( fo ) then\n puts \" Outgoing flow from #{ t.id } with status '#{ status_list[ fo.status_id ]}' is not incoming flow to #{ fo.target_task_id }\"\n e += 1\n end\n # check if obsolete task has non-obsolete outgoing flow\n if t.obsolete and !fo.obsolete then\n puts \" Obsolete task #{ t.id } has non-obsolete outgoing flow\\n\"\\\n \" with status '#{ fo.status }' to task ##{ fo.target_task_id}\"\n e += 1\n end\n end\n t.inflows.each do |fi|\n # flow must be in flow_list\n if fi != @flow_list[ fi.id ] then\n puts \" Incoming flow to #{ t.id } with status '#{ status_list[ fi.status ]}' not found in worklist's flow_list.\"\n e += 1\n end\n # incoming flow must have a corresponding outgoing flow - this should always pass\n if !@task_list[ fi.source_task_id ].outflows.include?( fi ) then\n puts \" Incoming flow to #{ t.id } with status '#{ fi.status }' is not outgoing flow from #{ fi.source_task_id}\"\n e += 1\n end\n # check if obsolete task has non-obsolete incoming flow\n if t.obsolete and !fi.obsolete then\n puts \" Obsolete task #{ t.id } has non-obsolete incoming flow\\n\"\\\n \" with status '#{ fi.status }' from task ##{ fi.source_task_id}\"\n e += 1\n end\n end\n end\n end\n # test initial task\n if @task_list.first.outflows.length > 1 then\n puts\n puts \">>> Warning: Initial Task has more than one outgoing flow:\"\n @task_list.first.outflows.each do |f|\n puts \">>> #{f.to_s}\"\n end\n puts\n end\n # summarize\n puts \" Validation of Tasks: #{ e > 0 ? 'failed' : 'OK' }\"\n @validation_errors += e\n end",
"def occurance(cost, tip_percent, people)\n CONNECTION.execute(\"INSERT INTO check_splitter (cost, tip_percent, people) VALUES (#{cost}, #{tip_percent}, #{people} );\")\nend",
"def validate_tasks\n validated = false\n if tasks_completed?\n validated = tasks_completed!\n end\n\n validated\n end",
"def validate_database(vm)\n valid = true\n \n results = \"\"\n \n check_points.each do |cp, cmd|\n msg = \"\"\n \n if valid\n begin\n conn = ActiveRecord::Base.connection\n value = conn.select_value(cmd, cp)\n valid = false unless value.to_i > 0\n rescue Exception => ex\n msg = ex.to_s\n valid = false\n end\n end\n \n results << <<HTML_TAGS\n <tr>\n <td>#{cp.to_s.titleize}</td>\n <td><img src='/images/permissions/#{valid ? 'grant' : 'revoke'}_all.gif' title='#{msg.gsub(\",\",'')}' />\n </tr>\nHTML_TAGS\n end\n \n vm[:html] = <<HTML_TAGS\n<table>\n#{results}\n</table>\nHTML_TAGS\n \n vm[:valid] = valid\n\n VirtualMemory.store(:session, :database_setting, vm, :YAML)\n\n valid\n end",
"def check_table (db, log)\n conn = db.get_prod_conn();\n q = \"SELECT COUNT(*) AS c FROM holdings_htitem_htmember_jn_dev\";\n log.d(q);\n conn.query(q) do |res|\n log.d(res[:c]);\n end\n conn.close();\nend",
"def task_available\n return unless task\n\n validate_task_has_no_pending\n validate_task_has_no_approved\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 flexible_budget_checker(budget, total)\n\nend",
"def should_reload_measure_test_table?(tasks)\n tasks.each do |task|\n return true if measure_test_running_for_row?(task)\n end\n false\n end",
"def validate\n \n \n end",
"def test_ut_t4_mtv_pu_001\n pu = Pu.find(1)\n assert_equal TRUE, pu.has_analyzed_task?\n end",
"def simple_budget_checker(total)\n\nend",
"def perform(*args)\n user_id, task_id, task_type, empirical_value, obi, from = args[0][0][0], args[0][0][1], args[0][0][2], args[0][0][3], args[0][0][4], args[0][0][5]\n empirical_value = empirical_value.to_i\n obi = obi.to_i\n user = Core::User.find_by(id: user_id)\n return p \"#{Time.now}————————>error---------------->用户不对!\" unless user.present?\n size = Core::TaskAward.where(user_id: user_id, task_type: task_type).where(\"created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n case task_type\n when 'Shop::DynamicComment'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n comment = Shop::DynamicComment.find_by(id: task_id)\n comment.dynamic.topic.shop_task.get_obi user\n comment.dynamic.topic.shop_task.increment!(:participants)\n when 'Shop::VoteResult'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n vote_result = Shop::VoteResult.find_by(id: task_id)\n vote_result.resource.topic.shop_task.get_obi user\n vote_result.resource.topic.shop_task.increment!(:participants)\n when 'Shop::TopicDynamic'\n topic = Shop::TopicDynamic.find_by(id: task_id).topic\n if from.match(/._share/)\n topic.shop_task.share_state[\"#{Shop::Topic}:#{user.id}\"] += 1\n share_size = Core::TaskAward.where(user_id: user_id, task_type: task_type).where(\"`from` like '%_share' AND created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size #分享次数\n\n if share_size < 20\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from)\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n end\n #创建动态\n create_size = Core::TaskAward.where(user_id: user_id, task_type: task_type, from: \"create_topic_dynamic\").where(\"created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n #点赞\n like_size = Core::TaskAward.where(user_id: user_id, task_type: task_type, from: \"self\").where(\"created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n #被别人点赞次数\n liked_size = Core::TaskAward.where(user_id: user_id, task_type: task_type, from: \"other\").where(\"created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n\n if (from == 'self' && like_size <= 5) || (from == 'other' && liked_size <= 50) || from == 'create_topic_dynamic' && create_size <= 5\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n if from == 'self' || from == \"create_topic_dynamic\"\n topic.shop_task.get_obi user\n topic.shop_task.increment!(:participants)\n end\n when 'Shop::Comment'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n comment = Shop::Comment.find_by(id: task_id)\n comment.task.shop_task.get_obi user\n comment.task.shop_task.increment!(:participants)\n when 'Shop::FundingOrder'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n order = Shop::FundingOrder.find_by(id: task_id)\n task = order.owhat_product.shop_task\n #task.increment!(:participants)\n task.get_obi(user)\n when 'Shop::Order'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from)\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n order = Shop::Order.find_by(id: task_id)\n order.order_items.each do |item|\n #item.owhat_product.shop_task.increment!(:participants)\n item.owhat_product.shop_task.get_obi(user)\n end\n when 'Core::User', 'Core::Star', 'Qa::Poster', \"Shop::Event\", \"Shop::Product\", \"Shop::Topic\", \"Shop::Media\", \"Shop::Subject\", \"Shop::Funding\"\n if from.match(/._share/)\n if task_type != 'Core::User' && task_type != 'Core::Star'\n task = eval(task_type).find_by(id: task_id).shop_task\n task.share_state[\"#{task.shop_type}:#{user.id}\"] += 1\n task.get_obi(user, type: 'share')\n end\n share_size = Core::TaskAward.where(user_id: user_id, task_type: task_type).where(\"`from` like '%_share' AND created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n if share_size < 20\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from)\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n else\n #发任务暂时不送O元 包含媒体任务参与 打卡任务\n if task_type != 'Core::User' && task_type != 'Core::Star'\n task = eval(task_type).find_by(id: task_id).shop_task\n task.get_obi user\n task.increment!(:participants)\n end\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from)\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n end\n\n level, obi = user.update_obi_and_empirical_value(user.empirical_value, user)\n unless user.level == level\n Core::TaskAward.create(user_id: user_id, task_id: user.id, task_type: user.class, empirical_value: 0, obi: (obi - user.obi), from: 'level_up')\n user.update(level: level, obi: obi)\n end\n end",
"def check_costs(id)\n DATABASE.execute(\"SELECT * FROM split_checks WHERE id = #{id}\")\nend",
"def are_task_basic_fields_valid?(node)\n err = []\n\n err << \"Task status provided '#{node['task_status']}' is not supported\" if\n !valid_task_status?(node['task_status'])\n err << \"Task name is not provided\" if node['deployment_graph_task_name'].blank?\n\n err.any? ? fail_validation(node, err) : true\n end",
"def are_task_basic_fields_valid?(node)\n err = []\n\n err << \"Task status provided '#{node['task_status']}' is not supported\" if\n !valid_task_status?(node['task_status'])\n err << \"Task name is not provided\" if node['deployment_graph_task_name'].blank?\n\n err.any? ? fail_validation(node, err) : true\n end",
"def validate!\n\n reset = \"\\r\\e[0K\"\n\n @check_users = true\n line = reset_line\n\n add_check_all(validate_csv_header :user, @check_users)\n user_bar = ProgressBar.new(\"Users...\", csv_size(:user)) if @verbose\n csv_for_each :user do |row|\n user = true\n row.each do |col, value|\n user &= value.present?\n end\n\n print_error :err_missing, :user, line unless user\n\n @check_users &= user\n # cache user id\n user_ids[row[\"id\"]] = true\n user_bar.inc if @verbose\n line += 1\n break unless user\n end\n user_bar.finish if @verbose\n add_check_all(@check_users)\n\n @check_groups = true\n\n add_check_all(validate_csv_header :group, @check_groups)\n line = reset_line\n # This function will change the header\n # due to a very common typo on csv\n fix_csv_elp_name\n group_bar = ProgressBar.new(\"Groups...\", csv_size(:group)) if @verbose\n csv_for_each :group do |row|\n group = true\n row.each do |col, value|\n group &= value.present?\n end\n print_error :err_missing, :group, line unless group\n\n group &= row[\"privacy\"].downcase == \"public\" || row[\"privacy\"].downcase == \"private\"\n print_error :err_validity, :group, line, \"privacy\", \"Privacy\", row[\"privacy\"] unless group\n\n group &= !row[\"privacy\"].downcase!\n print_error :err_lowercase, :group, line, \"privacy\", \"Privacy\", row[\"privacy\"] unless group\n\n @check_groups &= group\n # cache group id\n groups[row[\"id\"]] = true\n group_bar.inc if @verbose\n line += 1\n break unless group\n end\n group_bar.finish if @verbose\n\n add_check_all(@check_groups)\n\n @check_memberships = true\n line = reset_line\n add_check_all(validate_csv_header :membership, @check_memberships)\n member_bar = ProgressBar.new(\"Memberships\", csv_size(:membership)) if @verbose\n csv_for_each :membership do |row|\n membership = true\n row.each do |col, value|\n membership &= value.present? unless col==\"creator_id\"\n end\n print_error :err_missing, :membership, line unless membership\n\n membership &= groups[row[\"group_id\"]] if membership\n print_error :err_foreign, :membership, line, \"group_id\" unless membership\n\n if row[\"creator_id\"].present?\n membership &= user_ids[row[\"creator_id\"]]\n print_error :err_foreign, :membership, line, \"creator_id\" unless membership\n end\n\n membership &= row[\"level\"].downcase == \"admin\" || row[\"level\"].downcase == \"member\"\n print_error :err_validity, :membership, line, \"level\", \"Access Level\", row[\"level\"] unless membership\n\n membership &= !row[\"level\"].downcase!\n print_error :err_lowercase, :membership, line, \"level\", \"Access Level\", row[\"level\"] unless membership\n\n @check_memberships &= membership\n line += 1\n member_bar.inc if @verbose\n\n break unless membership\n end\n member_bar.finish if @verbose\n add_check_all(@check_memberships)\n\n @check_lings = true\n line = reset_line\n add_check_all(validate_csv_header :ling, @check_lings)\n ling_bar = ProgressBar.new(\"Lings\", csv_size(:ling)) if @verbose\n csv_for_each :ling do |row|\n ling = true\n row.each do |col, value|\n ling &= value.present? unless col==\"creator_id\" || col==\"parent_id\"\n end\n print_error :err_missing, :ling, line unless ling\n\n ling &= groups[row[\"group_id\"]] if ling\n print_error :err_foreign, :ling, line, \"group_id\" unless ling\n\n if row[\"creator_id\"].present?\n ling &= user_ids[row[\"creator_id\"]] if ling\n print_error :err_foreign, :ling, line, \"creator_id\" unless ling\n end\n\n @check_lings &= ling\n # cache ling id\n ling_ids[row[\"id\"]] = row[\"group_id\"]\n\n line += 1\n ling_bar.inc if @verbose\n break unless ling\n end\n ling_bar.finish if @verbose\n add_check_all(@check_lings)\n line = reset_line\n @check_parents = true\n ling_ass_bar = ProgressBar.new(\"Lings Associations\", csv_size(:ling)) if @verbose\n csv_for_each :ling do |row|\n if row[\"parent_id\"].blank?\n ling_ass_bar.inc if @verbose\n next\n end\n\n parent = ling_ids[row[\"parent_id\"]].present?\n print_error :err_foreign, :ling, line, \"parent_id\" unless parent\n\n parent &= ling_ids[row[\"parent_id\"]] == row[\"group_id\"]\n print_error :err_foreign, :ling, line, \"group_id\" unless parent\n\n print_to_console \"\\n=> Should be '#{ling_ids[row[\"parent_id\"]]}' instead of '#{row[\"group_id\"]}'\" unless parent\n @check_parents &= parent\n\n line += 1\n ling_ass_bar.inc if @verbose\n break unless parent\n end\n ling_ass_bar.finish if @verbose\n add_check_all(@check_parents)\n\n @check_categories = true\n line = reset_line\n add_check_all(validate_csv_header :category, @check_categories)\n cat_bar = ProgressBar.new(\"Category\", csv_size(:category)) if @verbose\n csv_for_each :category do |row|\n category = true\n row.each do |col, value|\n category &= value.present? unless col==\"creator_id\" || col==\"description\"\n end\n print_error :err_missing, :category, line unless category\n\n category &= groups[row[\"group_id\"]] if category\n print_error :err_foreign, :category, line, \"group_id\" unless category\n\n if row[\"creator_id\"].present?\n category &= user_ids[row[\"creator_id\"]] if category\n print_error :err_foreign, :category, line, \"creator_id\" unless category\n end\n\n @check_categories &= category\n\n # cache category id\n category_ids[row[\"id\"]] = true\n\n line += 1\n cat_bar.inc if @verbose\n break unless category\n end\n cat_bar.finish if @verbose\n add_check_all(@check_categories)\n\n @check_properties = true\n line = reset_line\n add_check_all(validate_csv_header :property, @check_properties)\n prop_bar = ProgressBar.new(\"Property\", csv_size(:property)) if @verbose\n csv_for_each :property do |row|\n property = true\n row.each do |col, value|\n property &= value.present? unless col==\"creator_id\" || col==\"description\"\n end\n\n print_error :err_missing, :property, line unless property\n\n property &= groups[row[\"group_id\"]] if property\n print_error :err_foreign, :property, line, \"group_id\" unless property\n\n property &= category_ids[row[\"category_id\"]] if property\n print_error :err_foreign, :property, line, \"category_id\" unless property\n\n if row[\"creator_id\"].present?\n property &= user_ids[row[\"creator_id\"]] if property\n print_error :err_foreign, :property, line, \"creator_id\" unless property\n end\n\n @check_properties &= property\n # cache property id\n property_ids[row[\"id\"]] = true\n\n line += 1\n prop_bar.inc if @verbose\n break unless property\n end\n prop_bar.finish if @verbose\n add_check_all(@check_properties)\n\n @check_examples = true\n line = reset_line\n add_check_all(validate_csv_header :example, @check_examples)\n ex_bar = ProgressBar.new(\"Examples\", csv_size(:example)) if @verbose\n csv_for_each :example do |row|\n example = true\n row.each do |col, value|\n example &= value.present? unless col==\"creator_id\"\n end\n\n print_error :err_missing, :example, line unless example\n\n example &= groups[row[\"group_id\"]] if example\n print_error :err_foreign, :example, line, \"group_id\" unless example\n\n example &= ling_ids[row[\"ling_id\"]] if example\n print_error :err_foreign, :example, line, \"ling_id\" unless example\n\n if row[\"creator_id\"].present?\n example &= user_ids[row[\"creator_id\"]] if example\n print_error :err_foreign, :example, line, \"creator_id\" unless example\n end\n\n @check_examples &= example\n # cache example id\n example_ids[row[\"id\"]] = true\n\n line += 1\n ex_bar.inc if @verbose\n break unless example\n end\n ex_bar.finish if @verbose\n add_check_all(@check_examples)\n\n @check_lings_properties = true\n line = reset_line\n add_check_all(validate_csv_header :lings_property, @check_lings_properties)\n lp_bar = ProgressBar.new(\"Lings Properties\", csv_size(:lings_property)) if @verbose\n csv_for_each :lings_property do |row|\n lp = true\n row.each do |col, value|\n lp &= value.present? unless col==\"creator_id\"\n end\n\n print_error :err_missing, :lings_property, line unless lp\n\n lp &= groups[row[\"group_id\"]] if lp\n print_error :err_foreign, :lings_property, line, \"group_id\" unless lp\n\n lp &= ling_ids[row[\"ling_id\"]] if lp\n print_error :err_foreign, :lings_property, line, \"ling_id\" unless lp\n\n if row[\"creator_id\"].present?\n lp &= user_ids[row[\"creator_id\"]] if lp\n print_error :err_foreign, :lings_property, line, \"creator_id\" unless lp\n end\n\n @check_lings_properties &= lp\n lp_bar.inc if @verbose\n # cache lings_property id\n lings_property_ids[row[\"id\"]] = true\n\n break unless lp\n end\n lp_bar.finish if @verbose\n add_check_all(@check_lings_properties)\n\n @check_examples_lp = true\n line = reset_line\n add_check_all(validate_csv_header :examples_lings_property, @check_examples_lp)\n elp_bar = ProgressBar.new(\"Examples Lings Properties\", csv_size(:examples_lings_property)) if @verbose\n csv_for_each :examples_lings_property do |row|\n elp = true\n row.each do |col, value|\n elp &= value.present? unless col==\"creator_id\"\n end\n\n print_error :err_missing, :examples_lings_property, line unless elp\n\n elp &= groups[row[\"group_id\"]] if elp\n print_error :err_foreign, :examples_lings_property, line, \"group_id\" unless elp\n\n elp &= lings_property_ids[row[\"lings_property_id\"]] if elp\n print_error :err_foreign, :examples_lings_property, line, \"lings_property_id\" unless elp\n\n elp &= example_ids[row[\"example_id\"]] if elp\n print_error :err_foreign, :examples_lings_property, line, \"example_id\" unless elp\n\n if row[\"creator_id\"].present?\n elp &= user_ids[row[\"creator_id\"]] if elp\n print_error :err_foreign, :examples_lings_property, line, \"example_id\" unless elp\n end\n\n @check_examples_lp &= elp\n elp_bar.inc if @verbose\n line += 1\n break unless elp\n end\n elp_bar.finish if @verbose\n\n add_check_all(@check_examples_lp)\n\n @check_stored_values = true\n line = reset_line\n add_check_all(validate_csv_header :stored_value, @check_stored_values)\n sv_bar = ProgressBar.new(\"Stored Values\", csv_size(:stored_value)) if @verbose\n csv_for_each :stored_value do |row|\n stored_value = true\n row.each do |col, value|\n stored_value &= value.present?\n end\n\n print_error :err_missing, :stored_value, line unless stored_value\n\n stored_value &= groups[row[\"group_id\"]] if stored_value\n print_error :err_foreign, :stored_value, line, \"group_id\" unless stored_value\n\n stored_value &= example_ids[row[\"storable_id\"]] if stored_value\n print_error :err_foreign, :stored_value, line, \"storable_id\" unless stored_value\n\n @check_stored_values &= stored_value\n\n line += 1\n sv_bar.inc if @verbose\n break unless stored_value\n end\n sv_bar.finish if @verbose\n add_check_all(@check_stored_values)\n @check_all\n end",
"def validate\r\n\r\n end",
"def test_ut_t4_mtv_pu_002\n pu = Pu.find(2)\n assert_equal FALSE, pu.has_analyzed_task?\n end",
"def plan(tasks)\n\t\t\ttasks.each do |day,task|\n\t\t\t puts \"#{day}, we must complete the #{task}\"\n\t\t\tend\n\t\t\tputs \"I'm the Boss! No one must do anything without my knowledge!\"\n\t\tend",
"def test_ut_t4_mtv_pu_002\n pj = Pj.find(3)\n assert_equal FALSE, pj.has_analyzed_task?\n end",
"def check_sql_before_running; tarif_optimizator.check_sql_before_running; end",
"def validate_records\n have_enough_items_to_trade?\n end",
"def check_budget\n checks = []\n\n # Internal consistency\n checks << check_equal(\"Transferencias internas ingresos = gastos\", \n beautify(@income[:consolidado][:transferencias]),\n beautify(@expenses[:consolidado][:transferencias]) )\n\n # Expenses\n checks.concat check_expenses('R_6_2_801_1_3', \"Estado\", :estado)\n checks.concat check_expenses('R_6_2_802_1_3', \"Organismos Autónomos\", :ooaa)\n checks.concat check_expenses('R_6_2_803_1_3', \"Agencias estatales\", :agencias)\n checks.concat check_expenses('R_6_2_804_1_3', \"Otros organismos\", :otros)\n checks.concat check_expenses('R_6_2_805_1_3', \"Seguridad Social\", :seg_social)\n\n # Income\n checks.concat check_income('R_6_1_101_1_5_1', \"Estado\", :estado)\n checks.concat check_income('R_6_1_102_1_4_1', \"Organismos Autónomos\", :ooaa)\n checks.concat check_income('R_6_1_103_1_4_1', \"Agencias estatales\", :agencias)\n checks.concat check_income('R_6_1_104_1_4_1', \"Otros organismos\", :otros)\n checks.concat check_income('R_6_1_105_1_5_1', \"Seguridad Social\", :seg_social)\n\n # Return results\n checks.join(\"\\n\")\n end",
"def validate_over_1000_vendor_sells\n total_trokaAki = Interaction.by_month.joins(:user =>:roles).where(:user_id => self.user_id, :roles => { :name => \"vendor\"}).group(\"interactions.user_id\").count\n unless total_trokaAki.size == 0\n if total_trokaAki.first.last > 1000\n ValidatorMailer.vendor_over_1000_warning(self.user_id).deliver\n end\n end\n end",
"def exercise1\n parse_data MinMaxValidator\n validators.count(&:valid?)\n end",
"def valid?\n @errors = []\n # check thename exists and is not empty\n if name.to_s.empty?\n @errors << {message: \"Name cannot be empty.\", variable: \"name\"}\n end\n \n # check the description exists and is not empty\n if description.to_s.empty?\n @errors << {message: \"Description cannot be empty.\", variable: \"description\"}\n end\n \n # check the description exists and is not empty\n # if studio_id.to_s.empty?\n # @errors << {message: \"Studio id cannot be empty.\", variable: \"studio_id\"}\n # elsif studio.blank?\n # @errors << {message: \"Studio id must be a member of the studios table.\", variable: \"studio_id\"}\n # end \n \n if !studio_id.valid?\n @errors += studio_id.errors\n end\n \n # check the description exists and is not empty\n # if rating_id.to_s.empty?\n # @errors << {message: \"Rating id cannot be empty.\", variable: \"rating_id\"}\n # elsif rating.blank?\n # @errors << {message: \"Rating id must be a member of the ratings table.\", variable: \"rating_id\"}\n # end\n \n if !rating_id.valid?\n @errors += rating_id.errors\n end\n # checks the number of time slots\n if length.to_s.empty?\n @errors << {message: \"Length cannot be empty.\", variable: \"length\"}\n elsif length.is_a? Integer\n if length < 1\n @errors << {message: \"Length must be greater than 0.\", variable: \"length\"}\n end\n else\n @errors << {message: \"Length must be a number.\", variable: \"length\"}\n end\n \n # returns whether @errors is empty\n @errors.empty?\n end",
"def valid?\n @errors = []\n # check thename exists and is not empty\n if name.to_s.empty?\n @errors << {message: \"Name cannot be empty.\", variable: \"name\"}\n end\n \n # check the description exists and is not empty\n if description.to_s.empty?\n @errors << {message: \"Description cannot be empty.\", variable: \"description\"}\n end\n \n # check the description exists and is not empty\n if studio_id.to_s.empty? \n @errors << {message: \"Studio id cannot be empty.\", variable: \"studio_id\"}\n elsif studio.blank?\n @errors << {message: \"Studio id must be a member of the studios table.\", variable: \"studio_id\"}\n end \n \n # check the description exists and is not empty\n if rating_id.to_s.empty?\n @errors << {message: \"Rating id cannot be empty.\", variable: \"rating_id\"}\n elsif rating.blank?\n @errors << {message: \"Rating id must be a member of the ratings table.\", variable: \"rating_id\"}\n end\n \n # checks the number of time slots\n if length.to_s.empty?\n @errors << {message: \"Length cannot be empty.\", variable: \"length\"}\n elsif length.is_a? Integer\n if length < 0\n @errors << {message: \"Length must be greater than 0.\", variable: \"length\"}\n end\n else\n @errors << {message: \"Length must be a number.\", variable: \"length\"}\n end\n \n # returns whether @errors is empty\n @errors.empty?\n end",
"def test_cantidad_cuotas\n print validate(36, cantidad_cuotas(16,1900.0))\n print validate(24, cantidad_cuotas(29,2100.0)) \n print validate(12, cantidad_cuotas(19,700.0)) \n print validate(6, cantidad_cuotas(20,1000.0))\n print validate(3, cantidad_cuotas(15,3200.0)) \nend",
"def validate_all\n validate\n items.each do |item|\n definition.validate_item item\n end\n definition.validate_columns items\n end",
"def createTaskTable\n @Handle.execute( @TaskSchema ) \n end",
"def validate_tasks(options)\n tasks = []\n\n instances = base_class.where(:id => options[:ids]).order(Arel.sql(\"lower(name)\")).to_a\n return instances, tasks unless options[:invoke_by] == :task # jobs will be used instead of tasks for feedback\n\n instances.each do |instance|\n # create a task for each instance\n task = MiqTask.create(:name => \"#{instance.name}: '#{options[:task]}'\", :userid => options[:userid])\n tasks.push(task)\n\n validate_task(task, instance, options)\n end\n return instances, tasks\n end",
"def valid?\n @errors = []\n \n # checks each field type and adds error messages if it does not meet requirements from the table\n validate_field_types\n \n \n if integer?(\"num_quarter_hours\")\n if num_quarter_hours < 1\n @errors << {message: \"Number of quarter hours must be greater than 0.\", variable: \"num_quarter_hours\"}\n end\n end\n \n @errors.empty?\n end",
"def checks; end",
"def validate_tasks(options)\n tasks = []\n\n instances = base_class.where(:id => options[:ids]).order(\"lower(name)\").to_a\n return instances, tasks unless options[:invoke_by] == :task # jobs will be used instead of tasks for feedback\n\n instances.each do |instance|\n # create a task for each instance\n task = MiqTask.create(:name => \"#{instance.name}: '#{options[:task]}'\", :userid => options[:userid])\n tasks.push(task)\n\n validate_task(task, instance, options)\n end\n return instances, tasks\n end",
"def confirm_task\n\n @entity = Task.find(params[:id])\n concierge = User.find(params[:user_id])\n\n budget = @entity.budget\n\n if @entity.tender?\n budget = TaskSuggestion.find(params[:suggestion_id]).price unless params[:budget].present?\n end\n\n budget = params[:budget] if params[:budget].present?\n\n pending_tasks = UsersPendingsTask.where(task_id: @entity.id)\n pending_tasks.destroy_all unless pending_tasks.nil?\n\n unless @entity.accepted?\n\n #if @current_user.balance.to_f >= calculate_surcharge(@entity.budget, budget) #(budget + (budget.to_i*10)/100).to_f\n # @current_user.update_attribute(:balance, @current_user.balance.to_f - calculate_surcharge(@entity.budget, budget)) unless budget.to_f < @entity.budget.to_f #(budget + (budget.to_i*10)/100))\n\n if @entity.owner?(@current_user) && params.has_key?(:user_id) # && @entity.accepted?\n #if budget.to_f < @entity.budget.to_f # Do a return of money to hire balance\n\n # @current_user.update_attribute(:balance, @current_user.balance + (@entity.budget.to_f - budget.to_f))\n #@current_user.increase_balance(@entity.budget) #budget - (budget.to_i*10)/100) #@entity not budget\n # end\n\n @entity.update_attributes(status: 'confirmed', concierge_id: concierge.id,\n suggestion_id: params[:suggestion_id], budget: budget,\n confirmed_at: Time.now, fact_start: Date.current)\n pdf = @entity.generate_pdf\n UserMailer.accepted_task(@entity.concierge.email, @entity.id, @entity.title).deliver if pdf.present?\n UserMailer.accepted_task_astra(Settings['email.work_order'], @entity.id, @entity.title).deliver if pdf.present?\n message = Message.create(\n author_id: current_resource_owner.id,\n recipient_id: concierge.id,\n message_body: \"Congratulations! #{concierge.first_name} #{concierge.last_name}: Your bid was accepted.\",\n task_id: @entity.id,\n system: true,\n suggestion_id: params[:suggestion_id]\n )\n\n feed = FeedNotification.create(\n owner_id: @current_user.id,\n user_id: message.recipient_id,\n task_title: @entity.title,\n message: \"Congratulations! #{concierge.first_name} #{concierge.last_name}: Your bid was accepted. \",\n notification_type: 'new_message',\n task_id: @entity.id,\n suggestion_id: @entity.suggestion_id,\n task_owner_id: @entity.owner_id\n )\n if feed.save!\n NotificationsWorker.perform_async(feed.id)\n end\n\n\n #TaskPayment.create(user_id: concierge.id, concierge: true, task_id: @entity.id , budget: @entity.budget.to_f)\n\n render 'api/tasks/show'\n\n else\n unless @entity.tender?\n @entity.update_attributes(status: 'confirmed', concierge_id: concierge.id,\n suggestion_id: params[:suggestion_id], budget: budget,\n confirmed_at: Time.now, fact_start: Date.current)\n pdf = @entity.generate_pdf\n UserMailer.accepted_task_conc(@entity.concierge.email, @entity.id, @entity.title).deliver if pdf.present?\n UserMailer.accepted_task_astra(Settings['email.work_order'], @entity.id, @entity.title).deliver if pdf.present?\n message = Message.create(\n author_id: @entity.concierge_id,\n recipient_id: @entity.owner_id,\n message_body: \"#{@entity.concierge.first_name} #{@entity.concierge.last_name} has accepted your work offer\",\n task_id: @entity.id,\n system: true,\n suggestion_id: @entity.suggestion_id\n )\n\n feed = FeedNotification.create(\n owner_id: @entity.concierge_id,\n user_id: message.recipient_id,\n task_title: @entity.title,\n message: \"#{@entity.concierge.first_name} #{@entity.concierge.last_name} has accepted your work offer\",\n notification_type: 'new_message',\n task_id: @entity.id,\n suggestion_id: @entity.suggestion_id,\n task_owner_id: @entity.owner_id\n )\n if feed.save!\n NotificationsWorker.perform_async(feed.id)\n end\n render 'api/tasks/show'\n else\n render :json => {errors: {message: ['missed param user_id']}}, :status => 500\n end\n\n\n end\n # else\n # render :json => { message: [ 'not enough money' ]}, :status => 500\n # end\n\n else\n unless @entity.tender?\n @entity.update_attributes(status: 'confirmed', concierge_id: concierge.id,\n suggestion_id: params[:suggestion_id], budget: budget,\n confirmed_at: Time.now, fact_start: Date.current)\n pdf = @entity.generate_pdf\n UserMailer.accepted_task_conc(@entity.concierge.email, @entity.id, @entity.title).deliver if pdf.present?\n UserMailer.accepted_task_astra(Settings['email.work_order'], @entity.id, @entity.title).deliver if pdf.present?\n message = Message.create(\n author_id: @entity.concierge_id,\n recipient_id: @entity.owner_id,\n message_body: \"#{@entity.concierge.first_name} #{@entity.concierge.last_name} has accepted your work offer\",\n task_id: @entity.id,\n system: true,\n suggestion_id: @entity.suggestion_id\n )\n\n feed = FeedNotification.create(\n owner_id: @entity.concierge_id,\n user_id: message.recipient_id,\n task_title: @entity.title,\n message: \"#{@entity.concierge.first_name} #{@entity.concierge.last_name} has accepted your work offer\",\n notification_type: 'new_message',\n task_id: @entity.id,\n suggestion_id: @entity.suggestion_id,\n task_owner_id: @entity.owner_id\n )\n if feed.save!\n NotificationsWorker.perform_async(feed.id)\n end\n render 'api/tasks/show'\n else\n render :json => {errors: {message: ['task already confirmed']}}, :status => 500\n end\n\n end\n end",
"def validate_operations\n ops_by_program = group_ops_by_parameter(PROGRAM, operations)\n\n msg = nil\n\n if ops_by_program.length != 1\n programs = ops_by_program.keys.join(\", \")\n msg = \"Job contains Operations with more than one program (#{programs}).\"\n msg += \" Please replan.\"\n elsif operations.length > MAX_OPS\n msg = \"Max number of ops is #{MAX_OPS} for a single Job.\"\n msg += \" You have #{operations.length} ops. Please replan.\"\n elsif ops_by_program.keys.first == \"lib_qPCR2\" && operations.length > 12\n msg = \"lib_qPCR2 program is limited to 12 reactions.\"\n msg += \" You have #{operations.length} ops. Please replan.\"\n end\n\n if msg.present?\n operations.each do |op|\n op.error :job_failed_validation, msg\n end\n end\n\n ops_by_program.keys.first\n end",
"def test_friendly_fields_true\n while_logged_in do\n with_queries do\n assert_block do\n entities = @conn.tasks(query:@small_query,nice_keys:true)[:entities]\n entities.first.keys.include? \"Created By\"\n end\n end\n end\n end",
"def validate\n unless TrueClass === @obsolete or FalseClass === @obsolete then\n raise RuntimeError.new( 'task validation failed: obsolete must be true or false ')\n end\n unless @id.is_a? Integer then\n raise RuntimeError.new( 'task validation failed: id must be an Integer' )\n end\n unless @role_id.is_a? Integer or @role_id.nil? then\n raise RuntimeError.new( 'task validation failed: role_id must be nil or an Integer' )\n end\n unless @label.is_a? String then\n raise RuntimeError.new( 'task validation failed: label must be a String' )\n end\n unless @inflows.is_a? Array then\n raise RuntimeError.new( 'task validation failed: incoming flows must be an Array' )\n else\n @inflows.each do |f|\n unless f.is_a? WorkFlowFlow\n raise RuntimeError.new( 'task validation failed: an incoming flow is not a WorkFlowFlow' )\n end\n end\n end\n unless @outflows.is_a? Array then\n raise RuntimeError.new( 'task validation failed: outgoing flows must be an Array' )\n else\n @outflows.each do |f|\n unless f.is_a? WorkFlowFlow\n raise RuntimeError.new( 'task validation failed: an outgoing flow is not a WorkFlowFlow' )\n end\n end\n end\n end",
"def unsure_no_resources_still_working\n #todo: ver si cambio el estado comparando con el registro en la base de datos (cambio a cancelado o cerrado)\n #todo: si ha cambiado entonces hacer una query pura y dura, lo de abajo no funciona y es confuso, a la mierda, a la vieja usansa\n\n=begin\n users.projects.each do |project|\n if project.project_state.name != 'Cerrado'# || 'Cancelado'\n errors.add_to_base \"La empresa no puede eliminarse por tener recursos trabajando en proyectos en ejecucion\"\n return false\n end\n end\n\n users.each do |hr|\n hr.state_id = 2\n hr.user.state_id = 2\n hr.save\n hr.user.save\n end\n=end\n\n return true\n end",
"def validate(filters = %w(ldm, pdm, metric_filter, invalid_objects))\n response = GoodData.post \"#{GoodData.project.md['validate-project']}\", 'validateProject' => filters\n polling_link = response['asyncTask']['link']['poll']\n polling_result = GoodData.get(polling_link)\n while polling_result['wTaskStatus'] && polling_result['wTaskStatus']['status'] == 'RUNNING'\n sleep(3)\n polling_result = GoodData.get(polling_link)\n end\n polling_result\n end",
"def validate\n validate_amount\n validate_game\n validate_period\n end",
"def integrity_check\n start_values = condition.start_values\n generations.each do |g|\n # FIXME -- use the registered fitness function\n if IterativeLearning::FunctionLearning.sum_of_error(g.start_values, start_values) != 0\n return false\n end\n start_values = g.best_task_response\n end\n return true\n end",
"def errorCheck\r\n\r\n\tdef checkStatus\r\n\t\t\r\n\tend\r\n\r\n\tws = $ws1\r\n\trow = 1\r\n\tcolumn = $columnNumbers1[\"CSCRM\"]\r\n\t#Do as long as there are entries in the CSCRM column\r\n\twhile value = $ws1.cells(row,column).value\r\n\t\t#proceed if there is a valid CSCRM entry\r\n\t\tif /^\\s*CSCRM/i =~ value\r\n\t\t\tstatus = ws.cells(row,$columnNumbers1[\"Acceptence\"]).value\r\n\t\t\tstatus = status ? status.downcase : \"no\"\r\n\t\t\tif status == 'yes'\r\n\t\t\t\tdeveloper = ws.cells(row,$columnNumbers1[\"Developer\"]).value\r\n\t\t\t\tmonthlyBaseline = developer = ws.cells(row,$columnNumbers1[\"MonthlyBaseline\"]).value\r\n\t\t\t\tunless monthlyBaseline\r\n\t\t\t\t\tputs \"Task #{value} status is Yes and monthly baseline assigned to this task\"\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\t\trow = row + 1\r\n\tend\r\n\r\nend",
"def validate_required\n [\n :project_name,\n :status,\n :requester_id,\n :subject_expert_id,\n :sponsor_id,\n :vision,\n :goal,\n :description,\n :scope,\n :advice_required,\n :program_id,\n :train_id,\n :funding_method,\n :cost_center,\n :funding_status,\n :budget_allocated,\n :priority,\n :start_date,\n :end_date,\n :risk_rating,\n :risks,\n :projected_revenue,\n ].each do |field|\n if self.attributes[field.to_s].nil? || self.attributes[field.to_s].blank?\n # intentionally vague!\n add_validation 'All fields are required to perform further validations'\n return false\n end\n end\n true\n end",
"def check_data_validation\r\n if @tx_interest.text.to_f > 0 and \r\n @tx_interest.text.to_f < 0.1 and\r\n @tx_amount.text.to_i >= 1000 and\r\n @tx_years.text.to_i >= 1 then\r\n tf = true\r\n else\r\n tf = false\r\n end\r\n return tf\r\n end",
"def check_task_order\n # Checks if column is present\n # (not column id because an id that does not belong to a column can be provided)\n # in case this valdiation is run before the one that checks the presence of column\n # If column is nil the comparison inside the if failed\n # the same goes for column order\n if column.present? && self.task_order.present?\n if self.task_order > self.column.tasks.count + 1\n errors.add(:task_order, 'must be maximum last task order + 1')\n end\n end\n end",
"def findErrors(params)\n errors = []\n if !isNumericVal(params[:cost])\n errors << \"GP must be numeric value\"\n else\n if params[:cost].to_f < 0\n errors << \"GP must be a postivie value Nice try though ;)\"\n end\n end\n return errors\n end",
"def test_friendly_fields_false\n while_logged_in do\n with_queries do\n assert_block do\n entities = @conn.tasks(query:@small_query,nice_keys:false)[:entities]\n entities.first.keys.include? \"creation-time\"\n end\n end\n end\n end",
"def test_presence\n task = Task.new\n assert !task.valid?\n assert_equal @@error[:blank], task.errors.on(:date)\n assert_equal @@error[:blank], task.errors.on(:job_id)\n assert_equal @@error[:blank], task.errors.on(:minutes)\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def setup\n current_user = options[:currentuser]\n all_flag = options[:allflag]\n if current_user.percentcompleteenabled\n table = Table([:description, :category_label, :created_date, :last_updated_date, :percentcomplete]) do |t|\n if all_flag\n current_user.tasks.find(:all).each {|u| t << u.report_record() }\n else\n completed_category = current_user.category.find(:all, :conditions => [\n \"label = 'Completed'\"\n ])\n current_user.tasks.find(:all).each {|u| t << u.report_record unless u.category_id == completed_category[0].id}\n end\n end\n table.rename_columns(:description => \"Description\",\n :category_label => \"Task Category\",\n :created_date => \"Date Created\",\n :last_updated_date => \"Date Last Updated\",\n :percentcomplete => \"Percent Complete\")\n else\n table = Table([:description, :category_label, :created_date, :last_updated_date]) do |t|\n if all_flag\n current_user.tasks.find(:all).each {|u| t << u.report_record() }\n else\n completed_category = current_user.category.find(:all, :conditions => [\n \"label = 'Completed'\"\n ])\n current_user.tasks.find(:all).each {|u| t << u.report_record unless u.category_id == completed_category[0].id}\n end\n end\n table.rename_columns(:description => \"Description\",\n :category_label => \"Task Category\",\n :created_date => \"Date Created\",\n :last_updated_date => \"Date Last Updated\")\n end\n \n self.data = table\n end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate\n @errors = []\n validate_termination\n validate_freq\n validate_interval\n validate_int_by_list(:bysecond, (0..59))\n validate_int_by_list(:byminute, (0..59))\n validate_int_by_list(:byhour, (0..23))\n validate_int_by_list(:bymonth, (1..12))\n validate_bysetpos\n validate_byday_list\n validate_bymonthday_list\n validate_byyearday_list\n validate_byweekno_list\n validate_wkst\n end",
"def validate_qc(operations)\n failed_ops = get_qc_fails(operations)\n manage_failed_ops(operations, failed_ops)\n end",
"def valid?\n run_validations!\n true\n rescue InvalidTaskError => e\n false\n end",
"def validate_reachability\n node_has_path_to_terminal_node = Array.new( @task_list.size, false )\n work_stack = []\n work_stack.push @task_list.last # is always non-obsolete!\n begin\n t = work_stack.pop\n next if t.obsolete\n node_has_path_to_terminal_node[ t.id ] = true\n t.inflows.each do |f|\n next if f.obsolete\n if !node_has_path_to_terminal_node[ f.source_task_id ] then\n work_stack.push @task_list[ f.source_task_id ]\n end\n end\n end until work_stack.empty?\n e = 0\n node_has_path_to_terminal_node.each_with_index do |n,i|\n next if @task_list[ i ].nil?\n if !n and !@task_list[ i ].obsolete then\n puts \" task ##{ i } '#{ @task_list[i].label }' has no path to terminal task\"\n e += 1\n end\n end\n puts \" Validation of Reachability: #{ e > 0 ? 'failed' : 'OK' }\"\n @validation_errors += e\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if @total_servicos.nil?\n return false\n end\n\n \n \n \n \n \n if @total_parcelado_nacionais.nil?\n return false\n end\n\n \n \n \n \n \n if @total_parcelado_internacionais.nil?\n return false\n end\n\n \n \n \n \n end",
"def test_ut_da10b_t1_05\n p \"Test 05\"\n subtasks = @pu.get_paginate_subtasks(1,\n nil,\n nil,\n 0)\n\n # this list contain all of subtasks in subtasks table\n assert (Subtask.count >= subtasks.size)\n end",
"def validate_amounts_for state\n\t\tvalidate_confirmation_page\n\t\t\n\t\ttax_rate = state_tax_rate(state)\n\t\t \t\n \tsubtotal = @driver.find_element(:id, 'subtotal').text\n \ttaxes = @driver.find_element(:id, 'taxes').text\n \ttotal = @driver.find_element(:id, 'total').text\n \t\n \t# check the tax computation\n \tunless (currency_of taxes) == currency_limit((tax_rate) * (currency_of subtotal))\n \t\tp state + ' tax rate is incorrect'\n \tend\n \t\n \t# check the math while we're at it\n \texpect(currency_of total).to eq (currency_of subtotal) + (currency_of taxes)\n\tend",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate_stats\n seq_total = @seq_stats[\"Total Reads\"].to_i\n seq_pf = @seq_stats[\"Post-Filter Reads\"].to_i\n die \"seq_stats_file: missing total\" if @seq_stats[\"Total Reads\"].nil?\n die \"seq_stats_file: missing post-filter read count\" if @seq_stats[\"Post-Filter Reads\"].nil?\n die(\"seq_stats_file: #{seq_pf} post-filter reads > \" +\n \"#{seq_total} total reads\") if seq_pf > seq_total\n\n # check mapped-read statistics\n if @barcodes.empty? && (@eland || @bwa)\n mapper_pf = @mapper_pf_stats[\"Total Reads\"].to_i\n die(\"#{seq_pf} post-filter reads != \" +\n \"#{mapper_pf} mapped post-filter reads\") if seq_pf != mapper_pf\n if not @no_rejects\n mapper_reject = @mapper_reject_stats[\"Total Reads\"].to_i\n mapper_total = mapper_pf + mapper_reject\n die(\"#{seq_total} sequenced reads != #{mapper_total} mapped reads\") if\n seq_total != mapper_total\n end\n end\n\n # check barcode statistics\n #if !@barcodes.empty?\n # barcode_pf = count_and_validate_barcodes(:post_filter, :mapper_pf_stats)\n # die(\"#{seq_pf} post-filter reads != \" +\n # \"#{barcode_pf} barcoded post-filter reads\") if seq_pf != barcode_pf\n # if not @no_rejects\n # barcode_reject = count_and_validate_barcodes(:rejected, :mapper_reject_stats)\n # barcode_total = barcode_pf + barcode_reject\n # die(\"#{seq_total} sequenced reads != #{barcode_total} barcoded reads\") if\n # seq_total != barcode_total\n # end\n #end\n end",
"def validate_fields_for_calculations(params)\n rpe = params[:player_rpe_rating]\n performance = params[:player_personal_performance]\n full_practice = params[:participated_in_full_practice]\n minutes = params[:minutes_participated]\n # nill checks\n if rpe.nil? || performance.nil? || full_practice.nil?\n return false\n # type checks\n elsif (!validate_integer_type(rpe) || !validate_integer_type(performance) || !validate_boolean_type(full_practice) || !validate_integer_type(minutes))\n return false\n # practice + minutes check\n elsif (full_practice == false && minutes.nil?)\n return false\n # pass preliminary checks\n else\n return true\n end\n\n end",
"def calc_stats\n #puts \"bad_biz = #{@bad_business_records.length}\"\n #puts \"bad_user = #{@bad_user_records.length}\"\n #puts \"good_biz = #{@good_business_records.length}\"\n #puts \"good_user = #{@good_user_records.length}\"\n \n @total_rec_cnt = @bad_business_records.length + @bad_user_records.length +\n\t @good_business_records.length + @good_user_records.length\n @well_formed_rec_cnt = @good_business_records.length + @good_user_records.length\n @malformed_rec_cnt = @bad_business_records.length + @bad_user_records.length\n @biz_rec_cnt = @businesses.length\n @user_rec_cnt = @users.length\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def _validation_errors()\n errors = []\n @tasks.each_value { |t| errors += t._validation_errors() }\n errors\n end",
"def validate_data\n @state = true\n #store the original error count, if there is a chnage to the count, then we want to update all associated insurance_billings and balance_bills\n @original_count = self.dataerrors.count\n #first remove any old errors from the table\n self.dataerrors.clear\n\n @s = []\n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n @s.push self.dataerrors.build(:message => \"Group name is blank\", :created_user => self.created_user) if self.group_name.blank?\n @s.push self.dataerrors.build(:message => \"Office phone number is required\", :created_user => self.created_user) if self.office_phone.blank?\n @s.push self.dataerrors.build(:message => \"EIN number is required\", :created_user => self.created_user) if self.ein_number.blank?\n @s.push self.dataerrors.build(:message => \"NPI is required for group\", :created_user => self.created_user) if self.npi.blank?\n\n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s)\n @state = false\n end\n #if the error counts changed, then update all insurance_bill & balance bills\n if @original_count != @s.count\n self.insurance_billings.each { |billing| billing.validate_claim }\n #self.balance_bills.each { |balance| balance.validate_balance_bill }\n end\n return @state\n end",
"def test_total_cost\n assert_equal(46.0, @check_test.total_cost)\n end",
"def validate_time_entry\n errors.add :amount, :invalid if amount && (amount < 0 || amount >= 100000)\n errors.add :project_id, :invalid if project.nil?\n errors.add :issue_id, :invalid if (issue_id && !issue) || (issue && project!=issue.project)\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate_data\n #first remove any old errors from the table\n self.dataerrors.clear\n \n @s = [] \n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n # check for the relationships t other tables\n if self.rate_id.blank? && self.rate_override.blank?\n @s.push self.dataerrors.build(:message => \"A rate or override rate must be entered\", :created_user => self.created_user) \n end\n \n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s) \n return false\n end\n #everything is good, return true\n return true\n end",
"def validate\n (1..25).each do |i|\n if resulthash[\"ans\"+i.to_s].blank?\n self.errors.add_to_base \"Question ##{i} cannot be left blank.\"\n end\n end\n super\n end",
"def check_required_quota\n if @json.key?(KEYS[:user_variables])\n user_variables = @json[KEYS[:user_variables]]\n keys = user_variables.keys\n\n keys.each do |key|\n if user_variables[key][KEYS[:type]] == 'enum' && Configs::Blueprint::CONTAINER_SIZES.include?(user_variables[key][KEYS[:default]])\n @required_ram += (VagrantSubutai::Configs::Quota::RESOURCE[(user_variables[key][KEYS[:default]]).strip.to_sym][:RAM])\n @required_disk += (VagrantSubutai::Configs::Quota::RESOURCE[(user_variables[key][KEYS[:default]]).strip.to_sym][:DISK])\n end\n end\n\n @required_ram += VagrantSubutai::Configs::Quota::RESOURCE[:TINY][:RAM] if @json.key?(KEYS[:ansible_configuration]) # default ansible container ram\n @required_disk += VagrantSubutai::Configs::Quota::RESOURCE[:TINY][:DISK] if @json.key?(KEYS[:ansible_configuration]) # default ansible container disk\n else\n @json[KEYS[:containers]].each do |container|\n @required_ram += (VagrantSubutai::Configs::Quota::RESOURCE[(container[KEYS[:size]]).to_sym][:RAM])\n @required_disk += (VagrantSubutai::Configs::Quota::RESOURCE[(container[KEYS[:size]]).to_sym][:DISK])\n end\n end\n end",
"def custom_validations\n self.validate_baseline && validate_baseline_date && \n self.validate_trial_days && self.validates_goal_name && self.validation_due_date\n end",
"def valid_test_taking()\n if current_user.tenant.pricing_plan.plan_group == \"assessment_only_plan\" then\n if current_user.tenant.remaining_learner_credit > 0 then\n return true\n else\n return false\n end\n else\n return true\n end\n end",
"def checks\n [\n ->(name: 'database') { [name, (ActiveRecord::Base.connection.active? rescue false)] },\n ->(name: 'sidekiq') { [name, (Sidekiq::ProcessSet.new.size.positive? rescue false)] },\n ->(name: 'sidekiq_latency') { [name, (Sidekiq::Queue.all.sum(&:latency) rescue false)] },\n #->(name: 'courtfinder'){ [name, (C100App::CourtfinderAPI.new.is_ok? rescue false)] },\n ]\n end",
"def validate(parsed_data)\n graph_name = load_data parsed_data\n \n begin \n results = @tests.map do |test|\n run_test(test, graph_name)\n end\n ensure\n clear_graph graph_name\n end\n\n # Remove empty results\n results.flatten.reject(&:empty?)\n end",
"def exercise2\n parse_data PositionalValidator\n validators.count(&:valid?)\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate\n return HESResponder(\"Field and value required.\", \"ERROR\") unless params[:field] && params[:value]\n fs = ['email','username', 'altid']\n f = params[:field]\n if !fs.include?(f)\n return HESResponder(\"Can't check this field.\", \"ERROR\")\n end\n f = f.to_sym\n v = params[:value]\n if @promotion.users.where(\"LOWER(#{f}) = ?\", v.downcase).count > 0\n return HESResponder(f.to_s.titleize + \" is not unique within promotion.\", \"ERROR\")\n else\n return HESResponder()\n end\n end",
"def validate_check(check)\n validate_check_name(check)\n validate_check_execution(check)\n validate_check_source(check) if check[:source]\n validate_check_scheduling(check)\n validate_check_proxy_requests(check) if check[:proxy_requests]\n validate_check_handling(check)\n validate_check_ttl(check) if check[:ttl]\n validate_check_aggregate(check)\n validate_check_flap_detection(check)\n validate_check_hooks(check) if check[:hooks]\n validate_check_truncate_output(check)\n validate_check_subdue(check) if check[:subdue]\n end",
"def verify_dispatch_tables(h)\n\n h.each{|k,h|\n\n field = h['field']\n tbl = h['table']\n\n numrows = tbl.size\n numcols = tbl[0].size\n\n rowctr = 0\n\n tbl.each{|r|\n\n if (r.size != numcols)\n raise \"error: tbl #{k} error row #{rowctr}\"\n end\n\n rowctr += 1\n }\n }\nend",
"def validateProject(data, isSocialGood = false)\n fails = []\n # Check if project is private\n if data.private\n fails.push(\"Project is either private or doesn't exist!\")\n end \n # Check if project has license\n if data.license == nil\n fails.push(\"Project doesn't have a license\")\n end\n # Check if project has atleast 100 stars\n if data.stargazers_count < 100 && !isSocialGood\n fails.push(\"Project has less than 100 stars\")\n end\n return fails\nend",
"def exercise1\n parse_data\n passports.count(&:valid?)\n end",
"def test_import_with_validations_that_fail\n columns = [ 'title' ]\n values = [['LDAP'],['Rails Recipes']] # missing author names, these should fail\n\n # these should fail, so we should end up with the same count for Topics\n expected_count = Topic.count\n result = Topic.import( columns, values, :validate=>true )\n invalid_topics = result.failed_instances\n \n assert_equal expected_count, Topic.count\n assert_equal values.size, invalid_topics.size\n invalid_topics.each{ |e| assert_kind_of Topic, e }\n end",
"def test_single_item_result\n while_logged_in do\n with_queries do\n pass\n #assert_nothing_raised{ @conn.tasks(query:@single_page_query) }\n end\n end\n end",
"def run\n\nd,c,sum,tot=0\n\n memtotal=`grep MemTotal /proc/meminfo`\n x=memtotal.split(\" \")\n ramsize=x[1].to_i\n datasize=`mongo --eval \"printjson(db.stats().dataSize)\"`\n indexsize=`mongo --eval \"printjson(db.stats().indexSize)\"`\n datasize.each_line do |line|\n d=line if line.match /^[0-9]*/\n end\n indexsize.each_line do |line|\n c=line if line.match /^[0-9]*/\n end\n sum=d.to_i + c.to_i\n tot=(sum/ramsize)*100\n\n unknown \"invalid percentage\" if config[:crit] > 100 or config[:warn] > 100\n\n message \"#{tot}% storage used \"\n warning if tot.to_i > config[:warn]\n critical if tot.to_i > config[:crit]\n ok\n end",
"def test_006\n open_pu_management_page\n assert_equal _(\"Number of users\"), get_table(\"//div[@id='right_contents']/div[1]/table[2].0.2\")\n for i in 1..@@no_pu\n pu_id = get_table(\"//div[@id='right_contents']/div[1]/table[2].#{i}.0\").to_i\n pu_users = PusUsers.find_all_by_pu_id(pu_id)\n assert_equal pu_users.length.to_s, get_table(\"//div[@id='right_contents']/div[1]/table[2].#{i}.2\")\n end\n logout\n end",
"def run_validations\n true\n end",
"def test_empty_result\n while_logged_in do\n empty_query = Query.new.filter(id:'>50000')\n assert_nothing_raised{ @conn.tasks(query:empty_query) }\n end\n end",
"def validate_time_to_market\n # lead time based on priority!\n today = Date.today\n days = (self.start_date - today).to_i\n if days < LEAD_TIME[self.priority]\n add_validation 'Start date must be at least ' + LEAD_TIME[self.priority].to_s + ' days in advance for ' +\n EngagementRequest::PRIORITIES[self.priority] + ' priority'\n end\n\n # 30 day minimum!\n length = (self.end_date - self.start_date).to_i\n if length < 30\n add_validation 'Projects with a length of less than 30 days will not be considered'\n end\n\n # must start on a Monday and end on a Friday\n if self.start_date.wday != 1\n add_validation 'Start Date must be a Monday'\n end\n if self.end_date.wday != 5\n add_validation 'End Date must be a Friday'\n end\n\n # cost reduction projects!\n cost_reduction = ['Operations Streamlining', 'Manufacturing Efficiency'].include? self.program.name\n if cost_reduction && self.projected_revenue != 0\n add_validation self.program.name + ' is not expected to generate revenue'\n end\n if cost_reduction && ! self.low_risk?\n add_validation self.program.name + ' projects must be low risk'\n end\n\n # potential profit!\n profit = self.projected_revenue - self.budget_allocated\n if ! cost_reduction && profit < RISK_REWARD[self.risk_rating]\n add_validation EngagementRequest::RISK_RATINGS[self.risk_rating] +\n ' risk projects should be expected to produce at least ' +\n number_to_currency(RISK_REWARD[self.risk_rating]) + ' profit'\n end\n\n # risks should be defined! 5 sentences!\n validate_sentences_length 'Risks', self.risks, 100, 500, 5\n end",
"def define_task_validate(*args)\n desc 'Validate the git urls and branches, refs, or tags'\n task :validate do\n gitvalididation = Ra10ke::Validate::Validation.new(get_puppetfile.puppetfile_path)\n exit_code = 0\n if gitvalididation.bad_mods?\n exit_code = 1\n message = BAD_EMOJI + ' Not all modules in the Puppetfile are valid. '.red + BAD_EMOJI\n else\n message = GOOD_EMOJI + ' Puppetfile looks good. '.green + GOOD_EMOJI\n end\n tp gitvalididation.sorted_mods, :name, { url: { width: 50 } }, :ref, :status\n abort(message) if exit_code.positive?\n puts message\n end\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate_data\n @state = true\n #store the original error count, if there is a chnage to the count, then we want to update all associated insurance_billings and balance_bills\n @original_count = self.dataerrors.count\n #first remove any old errors from the table\n self.dataerrors.clear\n\n @s = []\n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n @s.push self.dataerrors.build(:message => \"Provider first name is blank\", :created_user => self.created_user) if self.first_name.blank?\n @s.push self.dataerrors.build(:message => \"Provider last name is blank\", :created_user => self.created_user) if self.last_name.blank?\n @s.push self.dataerrors.build(:message => \"Provider NPI is required\", :created_user => self.created_user) if self.npi.blank?\n #either the ein or ssn is required\n @s.push self.dataerrors.build(:message => \"EIN or SSN is required\", :created_user => self.created_user) if self.ssn_number.blank? && self.ein_number.blank?\n @s.push self.dataerrors.build(:message => \"Office phone is required\", :created_user => self.created_user) if self.office_phone.blank?\n\n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s)\n @state = false\n end\n #if the error counts changed, then update all insurance_bill & balance bills\n if @original_count != @s.count\n self.insurance_billings.each { |billing| billing.validate_claim }\n # need to rethink the validate\n # self.balance_bill_sessions.each { |balance| balance.validate_balance_bill }\n end\n return @state\n end",
"def check_count\n if FantasyPoint.count > 0\n errors[:base] << 'there are too many FantasyPoint records'\n end\n end",
"def check_phase_estimation\n return false if !life_cycle_phase\n planned_hours_phase = self.project.projects_phases_joins.where(\"life_cycle_phase_id = ?\", self.life_cycle_phase.id).first.planned_hours_phase\n if self.new_record?\n sum_hours_tasks = self.project.tasks.where(\"life_cycle_phase_id = ?\", self.life_cycle_phase.id).sum(\"planned_hours\")\n else\n sum_hours_tasks = self.project.tasks.where(\"life_cycle_phase_id = ? AND id <> ?\", self.life_cycle_phase.id, self.id).sum(\"planned_hours\")\n end\n sum_hours_tasks = sum_hours_tasks + self.planned_hours\n if (sum_hours_tasks) > planned_hours_phase\n errors.add(:planned_hours, I18n.t(\"screens.alerts.tasks_exceeded_in_hours\"))\n return false\n end\n return true\n end"
] |
[
"0.5699543",
"0.56384903",
"0.56208664",
"0.5521189",
"0.5519152",
"0.54761326",
"0.5417944",
"0.5401705",
"0.53787327",
"0.53584105",
"0.5356623",
"0.53564924",
"0.53563327",
"0.534639",
"0.5328587",
"0.5328587",
"0.5310493",
"0.52994883",
"0.5291515",
"0.52669436",
"0.52313524",
"0.52185875",
"0.5215469",
"0.5191913",
"0.51848996",
"0.5167374",
"0.51438195",
"0.51286983",
"0.51256734",
"0.51227134",
"0.5114822",
"0.51116216",
"0.50904524",
"0.50844234",
"0.5077526",
"0.50563794",
"0.5036713",
"0.5030698",
"0.5026159",
"0.50226516",
"0.5003144",
"0.5000563",
"0.49954253",
"0.49798697",
"0.4972499",
"0.49579218",
"0.49548373",
"0.49536717",
"0.49528646",
"0.49515536",
"0.49478132",
"0.49282184",
"0.49250197",
"0.49250197",
"0.49250197",
"0.49250197",
"0.49236315",
"0.490935",
"0.49083576",
"0.49082592",
"0.48987877",
"0.48968732",
"0.48958397",
"0.48898515",
"0.4886765",
"0.48694682",
"0.4869167",
"0.4868994",
"0.48672166",
"0.4864129",
"0.4859214",
"0.48553157",
"0.48552117",
"0.48552117",
"0.48532948",
"0.48515302",
"0.48497322",
"0.4841001",
"0.4840784",
"0.48366544",
"0.4832763",
"0.48296088",
"0.48284087",
"0.48282653",
"0.4827913",
"0.4826735",
"0.48254126",
"0.4823736",
"0.48234332",
"0.48215434",
"0.4820046",
"0.48158923",
"0.48139787",
"0.48071656",
"0.4806013",
"0.48056728",
"0.48050308",
"0.48043752",
"0.48011893",
"0.48008773"
] |
0.49331856
|
51
|
GET /music_discs GET /music_discs.json
|
def index
@music_discs = MusicDisc.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @music = Music.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music }\n end\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @musics }\n end\n end",
"def disc(id)\n get(\"/catalog/titles/discs/#{id.to_s}\")\n end",
"def show\n @music = Music.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @music }\n end\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @musics }\n end\n end",
"def index\n @musics = Music.all\n end",
"def index\n @musics = Music.all\n end",
"def index\n @musics = Music.all\n end",
"def index\n @musics = Music.all\n end",
"def index\n @tracks = @disc.tracks.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tracks }\n end\n end",
"def show\n @music = Music.friendly.find(URI.unescape(params[:id]))\n # select random genre from all the music\n # create a client object with your app credentials\n client = Soundcloud.new(:client_id => 'd99d78670c7f1d537d0ae3d67a7be95c')\n @embed_info = client.get('/oembed', :url => @music.song_api,:auto_play => true)\n end",
"def show\n @music_like = MusicLike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @music_like }\n end\n end",
"def show\n @music = Music.find(params[:id])\n @newest_musics=Music.limit(10).order('created_at asc')\n @hot_musics=Music.limit(10).order('counter desc')\n @recomand_musics=Music.limit(10)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music }\n end\n end",
"def destroy\n @music_disc.destroy\n respond_to do |format|\n format.html { redirect_to music_discs_url }\n format.json { head :no_content }\n end\n end",
"def show\n @musician = Musician.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @musician }\n end\n end",
"def index\n # @songs = Song.find_by_artist_id params[:artist_id]\n @songs = Song.find_all_by_artist_id params[:artist_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @songs }\n end\n end",
"def show\n @music = Music.find_by_sql(\"SELECT * FROM Musics M Where M.id = \" + params[:id]).first()\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music }\n end\n end",
"def list\n @audios = Audio.all\n\n respond_to do |format|\n format.html\n format.json { render json: @audios }\n end\n end",
"def show\n @music_category = MusicCategory.find(params[:id])\n @music_categories = MusicCategory.all\n @newest_musics=Music.limit(10).order('created_at desc')\n @hot_musics=Music.limit(10).order('counter desc')\n @recomand_musics=Music.limit(10)\n @musics=@music_category.musics.paginate(:page => params[:page],:per_page => 10).order('created_at DESC')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music_category }\n end\n end",
"def songs\n \t@songs = Album.find(params[:id])\n songs = RSpotify::Track.search(@songs.name)\n \t@songs = songs.map do |s_songs|\n \tSong.new_from_spotify_song(s_songs)\n end\n render json: {data:@songs}\n end",
"def index\n @music_likes = MusicLike.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @music_likes }\n end\n end",
"def show\n @music = Music.find(params[:id], :include => [{:comments => :user}, :user])\n if session[:user_id] and @rating = @music.ratings.find_by_user_id(session[:user_id])\n @my_rating = @rating.stars\n end\n\n unless session[:hits] and session[:hits].include? @music.id\n session[:hits] ||= []\n session[:hits] << @music.id\n\n @music.hits += 1\n @music.save\n end\n\n @playlists = Playlist.where(:user_id => session[:user_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music }\n end\n end",
"def show\n @track = @disc.tracks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @track }\n end\n end",
"def index\n @musicos = Musico.all\n end",
"def index\n @store = Store.find(params[:store_id])\n @dish_discounts = @store.dish_discounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dish_discounts }\n end\n end",
"def show\n song = Song.find(params[:id])\n render json: song.to_json(only: [:id, :title, :artist], methods: :path, include: {category: {only: [:id, :name]}})\n end",
"def show\n # FIXME: render 404 page\n unless @music\n render status: 404\n end\n end",
"def song\n fetch('cowboy_bebop.song')\n end",
"def index\n @musics = Music.paginate(:page => params[:page],:per_page => 10).order('created_at DESC')\n @newest_contents=Music.limit(10).order('created_at asc')\n @hot_contents=Music.limit(10).order('counter desc')\n @recomand_contents=Music.limit(10)\n @music_categories = MusicCategory.all\n @hot_title=\"热门广场舞曲下载\"\n @recomand_title=\"推荐广场舞曲下载\"\n @newest_title=\"最新广场舞曲下载\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @musics }\n end\n end",
"def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @song }\n end\n end",
"def show\n headers['Access-Control-Allow-Origin'] = \"*\"\n @song = Song.find(params[:id])\n @songs = [@song]\n @playlist = session[:playlist].nil? ? [] : Song.where(id: session[:playlist])\n\n gon.music_host = Rails.configuration.settings['filehost']\n gon.songs = @songs\n gon.song = @song\n gon.comments = Comment.song(@song.id)\n gon.playlist = @playlist\n\n \n respond_to do |format|\n format.html { render 'index' }\n format.json { render :show }\n end\n\n end",
"def set_music_disc\n id = params[:id].nil? ? params[:music_disc_id] : params[:id]\n @music_disc = MusicDisc.find(id)\n end",
"def index\n @discs = Disc.all\n end",
"def show\n @song_like = SongLike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song_like }\n end\n end",
"def index\n\t\tShow.includes( :links, :songs, :artists, :presses )\n\t\t@shows = Show.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shows }\n end\n end",
"def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end",
"def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end",
"def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end",
"def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end",
"def index\n \n @songs = Song.order 'id'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @songs }\n end\n end",
"def index\n @top_musics = TopMusic.all\n end",
"def show\n @music = Music.find(params[:id])\n @tag_data_hash=tag_info(\"public#{@music.audio.to_s}\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music }\n end\n end",
"def get_artist(id)\n @connection.get \"artists/#{id}\"\n end",
"def index\n @musicas = Musica.all\n end",
"def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @music }\n end\n \n end",
"def index\n @audio_mp3s = AudioMp3.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audio_mp3s }\n end\n end",
"def show\n client_playlist = Soundcloud.new(:client_id => Rails.application.secrets.soundcloud_client_id,\n :client_secret => Rails.application.secrets.soundcloud_secret,\n :username => Rails.application.secrets.soundcloud_username,\n :password => Rails.application.secrets.soundcloud_password)\n client_track = SoundCloud.new(:client_id => Rails.application.secrets.soundcloud_client_id)\n # create an array of track ids\n track_url = Post.find(params[:id]).try(:track_url)\n # puts track_url.inspect\n embed_info = client_track.get('/oembed', :url => track_url)\n @song = embed_info['html']\n @track_id = client_track.get('/resolve', :url => track_url).id\n @playlists = client_playlist.get(\"/me/playlists\")\n end",
"def index\n @songs = Song.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @songs }\n end\n end",
"def songs\n Song.all\n end",
"def show\n @query = params[:id].gsub('+', ' ')\n @autoplay = params[:autoplay]\n \n begin\n @artist = LastfmArtist.new(@query, @lastfm, true)\n rescue\n @artist = nil\n end\n \n unless @artist\n not_found\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @artist }\n end\n end",
"def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end",
"def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end",
"def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end",
"def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end",
"def index\n @songs = Song.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @songs }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end",
"def list\n @artist_name = get_artist_name\n @discogs_releases = get_discogs_releases_paginated(@artist_name) unless @artist_name.blank?\n\n respond_to do |format|\n format.html # show.html.erb\n #format.xml { render :xml => @artist }\n format.js\n end\n end",
"def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @song }\n end\n end",
"def show\n @song = Song.find(:id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @song }\n end\n end",
"def songs\n Song.find_by_album(@id)\n end",
"def index\n @muscle_diaries = MuscleDiary.all\n end",
"def sounds_list(params = {})\n get \"sounds\", params\n end",
"def update\n songs_to_remove = @music_disc.songs.select {|song| !music_disc_params[:music_category_ids].include?(song.music_category.id.to_s)}\n songs_to_remove.each do | song |\n @music_disc.songs.delete(song)\n end\n respond_to do |format|\n if @music_disc.update(music_disc_params)\n format.html { redirect_to @music_disc }\n format.json { render :show, status: :ok, location: @music_disc }\n else\n format.html { render :edit }\n format.json { render json: @music_disc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @music = Music.find(params[:id])\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @music = Music.find(params[:id])\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @music = Music.find(params[:id])\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end",
"def index\n @songs = Song.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @songs }\n format.mobile { render :json => @songs }\n end\n end",
"def destroy\n @music = Music.find(params[:id])\n @music.destroy\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end",
"def index\n respond_with Sound.all\n end",
"def view_api\n api_string = RestClient.get(\"https://itunes.apple.com/search?term=star+wars&entity=song&attribute=movieTerm\")\n api_hash = JSON.parse(api_string)\n\n end",
"def index\n @tracks = Track.all\n render json: {tracks: @tracks}\n end",
"def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend",
"def songs\n ret = Jbuilder.encode do |json|\n _songs = Song.where(category_id: params[:id])\n json.array! _songs do |song|\n json.(song, :title, :id, :artist, :category_id, :created_at) \n json.path song.path\n end\n end\n render json: ret\n end",
"def show\n\t\t@artist = Artist.find(params[:id])\n\t\tdownloader = ScDownloader.new\n\t\t@tracks = downloader.get_tracks(@artist)\n\tend",
"def show\n @feed_dislike = FeedDislike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed_dislike }\n end\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def index\n @music_types = MusicType.all\n end",
"def songs\n Song.all\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end",
"def read_moods\n raw_data = File.read(\"#{Dir.home}/desktop/terminalapp/public/moods.json\") \n mood_data = JSON.parse(raw_data) \n Track.convert(mood_data, :object)\nend",
"def albums\n if params[:artist_id]\n albums = Artist.find(params[:artist_id]).albums\n else\n albums = Album.all\n end\n render json: albums\n end",
"def show\n @comment = @song.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end",
"def show\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish_discount }\n end\n end",
"def index\n @dish_moods = DishMood.all\n end",
"def show\n @discos = @artista.discos.order(:publicacion => :desc)\n end",
"def show\n @album = Album.find(params[:id])\n @potential_songs = Song.where(:artist_id => @album.artist.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end",
"def index\n @dishes = Dish.all\n end",
"def index\n @dishes = Dish.all\n end",
"def index\n @dishes = Dish.all\n end",
"def show\n @dish = Dish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end",
"def show\n @audio_mp3 = AudioMp3.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @audio_mp3 }\n end\n end",
"def show\n @audio_mp3 = AudioMp3.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @audio_mp3 }\n end\n end",
"def artists\n # TODO: add param for albums and songs\n a = Artist.all\n render json: a\n end",
"def show\n @songs = Song.all\n end",
"def song\n fetch('bossa_nova.songs')\n end",
"def index\n @plsbgmusic_mediafiles = PlsbgmusicMediafile.all\n end"
] |
[
"0.66433537",
"0.66346246",
"0.6624503",
"0.65975785",
"0.6589996",
"0.6425613",
"0.6425613",
"0.6425613",
"0.6425613",
"0.63963896",
"0.6370514",
"0.6312383",
"0.62550277",
"0.62399554",
"0.61923176",
"0.6153997",
"0.6124523",
"0.61007077",
"0.6087293",
"0.60776764",
"0.6077651",
"0.6074734",
"0.59924096",
"0.59571874",
"0.5940368",
"0.59365654",
"0.5910561",
"0.58988476",
"0.5897752",
"0.58959883",
"0.58708334",
"0.58696836",
"0.5860091",
"0.5853071",
"0.5848904",
"0.58390933",
"0.58390933",
"0.58390933",
"0.5836549",
"0.58227646",
"0.5794698",
"0.5791826",
"0.5788717",
"0.57818675",
"0.57715166",
"0.5767254",
"0.5754347",
"0.5740641",
"0.57403344",
"0.5739381",
"0.57286",
"0.57286",
"0.57286",
"0.57286",
"0.56985253",
"0.5693349",
"0.56843424",
"0.5682554",
"0.56782985",
"0.5676231",
"0.5670799",
"0.5668843",
"0.5668546",
"0.5650642",
"0.5650642",
"0.5650642",
"0.5649696",
"0.5647001",
"0.5643922",
"0.5632927",
"0.5617009",
"0.5613385",
"0.5611571",
"0.56084716",
"0.56016785",
"0.5593986",
"0.5593986",
"0.5593986",
"0.5593986",
"0.5593986",
"0.5588818",
"0.55883276",
"0.5587805",
"0.5583939",
"0.55839187",
"0.5578042",
"0.55744666",
"0.5573023",
"0.55654866",
"0.5559505",
"0.5551006",
"0.5551006",
"0.5551006",
"0.5548184",
"0.5539081",
"0.5539081",
"0.55388033",
"0.5531287",
"0.55199844",
"0.5518828"
] |
0.7271684
|
0
|
GET /music_discs/1 GET /music_discs/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @music = Music.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music }\n end\n end",
"def show\n @music = Music.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @music }\n end\n end",
"def index\n @music_discs = MusicDisc.all\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @musics }\n end\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @musics }\n end\n end",
"def disc(id)\n get(\"/catalog/titles/discs/#{id.to_s}\")\n end",
"def show\n @music = Music.find_by_sql(\"SELECT * FROM Musics M Where M.id = \" + params[:id]).first()\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music }\n end\n end",
"def show\n @musician = Musician.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @musician }\n end\n end",
"def show\n @music_like = MusicLike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @music_like }\n end\n end",
"def show\n @music = Music.friendly.find(URI.unescape(params[:id]))\n # select random genre from all the music\n # create a client object with your app credentials\n client = Soundcloud.new(:client_id => 'd99d78670c7f1d537d0ae3d67a7be95c')\n @embed_info = client.get('/oembed', :url => @music.song_api,:auto_play => true)\n end",
"def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @song }\n end\n end",
"def show\n @music = Music.find(params[:id])\n @newest_musics=Music.limit(10).order('created_at asc')\n @hot_musics=Music.limit(10).order('counter desc')\n @recomand_musics=Music.limit(10)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music }\n end\n end",
"def index\n @tracks = @disc.tracks.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tracks }\n end\n end",
"def show\n song = Song.find(params[:id])\n render json: song.to_json(only: [:id, :title, :artist], methods: :path, include: {category: {only: [:id, :name]}})\n end",
"def index\n @musics = Music.all\n end",
"def index\n @musics = Music.all\n end",
"def index\n @musics = Music.all\n end",
"def index\n @musics = Music.all\n end",
"def show\n @track = @disc.tracks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @track }\n end\n end",
"def index\n # @songs = Song.find_by_artist_id params[:artist_id]\n @songs = Song.find_all_by_artist_id params[:artist_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @songs }\n end\n end",
"def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end",
"def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end",
"def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end",
"def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end",
"def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @song }\n end\n end",
"def show\n @song = Song.find(:id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @song }\n end\n end",
"def get_artist(id)\n @connection.get \"artists/#{id}\"\n end",
"def show\n @song_like = SongLike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song_like }\n end\n end",
"def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end",
"def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end",
"def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end",
"def show\n @music = Music.find(params[:id], :include => [{:comments => :user}, :user])\n if session[:user_id] and @rating = @music.ratings.find_by_user_id(session[:user_id])\n @my_rating = @rating.stars\n end\n\n unless session[:hits] and session[:hits].include? @music.id\n session[:hits] ||= []\n session[:hits] << @music.id\n\n @music.hits += 1\n @music.save\n end\n\n @playlists = Playlist.where(:user_id => session[:user_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music }\n end\n end",
"def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end",
"def show\n headers['Access-Control-Allow-Origin'] = \"*\"\n @song = Song.find(params[:id])\n @songs = [@song]\n @playlist = session[:playlist].nil? ? [] : Song.where(id: session[:playlist])\n\n gon.music_host = Rails.configuration.settings['filehost']\n gon.songs = @songs\n gon.song = @song\n gon.comments = Comment.song(@song.id)\n gon.playlist = @playlist\n\n \n respond_to do |format|\n format.html { render 'index' }\n format.json { render :show }\n end\n\n end",
"def song\n fetch('cowboy_bebop.song')\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end",
"def show\n @query = params[:id].gsub('+', ' ')\n @autoplay = params[:autoplay]\n \n begin\n @artist = LastfmArtist.new(@query, @lastfm, true)\n rescue\n @artist = nil\n end\n \n unless @artist\n not_found\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @artist }\n end\n end",
"def list\n @audios = Audio.all\n\n respond_to do |format|\n format.html\n format.json { render json: @audios }\n end\n end",
"def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @music }\n end\n \n end",
"def show\n @music_category = MusicCategory.find(params[:id])\n @music_categories = MusicCategory.all\n @newest_musics=Music.limit(10).order('created_at desc')\n @hot_musics=Music.limit(10).order('counter desc')\n @recomand_musics=Music.limit(10)\n @musics=@music_category.musics.paginate(:page => params[:page],:per_page => 10).order('created_at DESC')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music_category }\n end\n end",
"def songs\n \t@songs = Album.find(params[:id])\n songs = RSpotify::Track.search(@songs.name)\n \t@songs = songs.map do |s_songs|\n \tSong.new_from_spotify_song(s_songs)\n end\n render json: {data:@songs}\n end",
"def destroy\n @music_disc.destroy\n respond_to do |format|\n format.html { redirect_to music_discs_url }\n format.json { head :no_content }\n end\n end",
"def show\n @music = Music.find(params[:id])\n @tag_data_hash=tag_info(\"public#{@music.audio.to_s}\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music }\n end\n end",
"def index\n @music_likes = MusicLike.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @music_likes }\n end\n end",
"def show\n @audio_mp3 = AudioMp3.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @audio_mp3 }\n end\n end",
"def show\n @audio_mp3 = AudioMp3.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @audio_mp3 }\n end\n end",
"def index\n \n @songs = Song.order 'id'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @songs }\n end\n end",
"def show\n @audio = Audio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @audio }\n end\n end",
"def show\n @audio = Audio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @audio }\n end\n end",
"def show\n # FIXME: render 404 page\n unless @music\n render status: 404\n end\n end",
"def index\n @songs = Song.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @songs }\n end\n end",
"def show\n @audio = Audio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @audio }\n end\n end",
"def index\n\t\tShow.includes( :links, :songs, :artists, :presses )\n\t\t@shows = Show.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shows }\n end\n end",
"def set_music_disc\n id = params[:id].nil? ? params[:music_disc_id] : params[:id]\n @music_disc = MusicDisc.find(id)\n end",
"def show\n @comment = @song.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end",
"def index\n @songs = Song.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @songs }\n end\n end",
"def index\n @audio_mp3s = AudioMp3.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audio_mp3s }\n end\n end",
"def index\n @musics = Music.paginate(:page => params[:page],:per_page => 10).order('created_at DESC')\n @newest_contents=Music.limit(10).order('created_at asc')\n @hot_contents=Music.limit(10).order('counter desc')\n @recomand_contents=Music.limit(10)\n @music_categories = MusicCategory.all\n @hot_title=\"热门广场舞曲下载\"\n @recomand_title=\"推荐广场舞曲下载\"\n @newest_title=\"最新广场舞曲下载\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @musics }\n end\n end",
"def show\n @dish = Dish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end",
"def index\n @store = Store.find(params[:store_id])\n @dish_discounts = @store.dish_discounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dish_discounts }\n end\n end",
"def index\n @musicos = Musico.all\n end",
"def show\n render jsonapi: @song,\n fields: fields_params,\n include: include_params,\n fields: fields_params\n end",
"def show\n @song_genre = SongGenre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song_genre }\n end\n end",
"def show\n client_playlist = Soundcloud.new(:client_id => Rails.application.secrets.soundcloud_client_id,\n :client_secret => Rails.application.secrets.soundcloud_secret,\n :username => Rails.application.secrets.soundcloud_username,\n :password => Rails.application.secrets.soundcloud_password)\n client_track = SoundCloud.new(:client_id => Rails.application.secrets.soundcloud_client_id)\n # create an array of track ids\n track_url = Post.find(params[:id]).try(:track_url)\n # puts track_url.inspect\n embed_info = client_track.get('/oembed', :url => track_url)\n @song = embed_info['html']\n @track_id = client_track.get('/resolve', :url => track_url).id\n @playlists = client_playlist.get(\"/me/playlists\")\n end",
"def view_api\n api_string = RestClient.get(\"https://itunes.apple.com/search?term=star+wars&entity=song&attribute=movieTerm\")\n api_hash = JSON.parse(api_string)\n\n end",
"def index\n @songs = Song.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @songs }\n format.mobile { render :json => @songs }\n end\n end",
"def show\n @comment = Comment.find(params[:id])\n #@song = Song.find(params[:song_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end",
"def show\n @album = Album.find(params[:id])\n @potential_songs = Song.where(:artist_id => @album.artist.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end",
"def show\n\t\tShow.includes( :links, :songs, :artists, :presses )\n @show = Show.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @show }\n end\n end",
"def show\n @musician = Musician.find(params[:id])\n puts \"musician.music\"\n puts @musician.music\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @musician }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end",
"def show\n @side_dish = SideDish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @side_dish }\n end\n end",
"def show\n @album = Album.find(params[:id])\n if @album.artist != nil\n @songs = get_songs_from_album @album.artist.name, @album.name\n @song_list = []\n if @songs\n @songs.each do |song|\n entry = Hash.new\n entry['rank'] = song['rank']\n entry['title'] = song['name']\n entry['artist'] = @album.artist.name\n song_in_db = lookup_song song['name'], @album.artist.name\n if song_in_db != nil\n entry['available'] = true\n entry['song_id'] = song_in_db.id\n else\n entry['available'] = false\n end\n entry['duration'] = seconds_to_duration(song['duration'].to_i)\n @song_list << entry\n end\n end\n @album_cover = get_album_cover @album.artist.name, @album.name\n @description = get_description_from_album @album.artist.name, @album.name\n end\n\n @songs = [] if @songs == nil\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end",
"def show\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish_discount }\n end\n end",
"def show\n @song = Song.find(params[:id])\n end",
"def show\n @song = Song.find(params[:id])\n end",
"def show\n @song = Song.find(params[:id])\n\n end",
"def getSong\n\t\tid = params[:songId]\n\t\tresult = GetSongFromSpotify.build.call(id)\n\t\trender json: result\n\tend",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def show\n\t\t@artist = Artist.find(params[:id])\n\t\tdownloader = ScDownloader.new\n\t\t@tracks = downloader.get_tracks(@artist)\n\tend",
"def show\n @playlist_clip = PlaylistClip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @playlist_clip }\n end\n end",
"def song\n fetch('bossa_nova.songs')\n end",
"def show\n @podcast = Podcast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @podcast }\n end\n end",
"def show\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @artist }\n end\n end",
"def new\n @musician = Musician.new\n @instruments = Instrument.find(:all, :order => \"name\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @musician }\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 @musician = Musician.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @musician }\n end\n end",
"def show\n @song = Song.find(params[:id])\n @regions = Region.all()\n @kinds = Kind.all()\n @link = Link.new\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end",
"def new\n @music = Music.new\n @people = Person.find_by_sql(\"SELECT * FROM People\")\n @artists = Artist.find_by_sql(\"SELECT * FROM Artists\")\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end",
"def show\n @song = Song.find(params[:id])\n @yt_id = YoutubeSearch.search(\"#{@song.name} #{@song.artist.name}\").first['video_id']\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end",
"def show\n @feed_dislike = FeedDislike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed_dislike }\n end\n end",
"def index\n @tracks = Track.all\n render json: {tracks: @tracks}\n end",
"def songs\n Song.find_by_album(@id)\n end",
"def index\n @top_musics = TopMusic.all\n end",
"def read_moods\n raw_data = File.read(\"#{Dir.home}/desktop/terminalapp/public/moods.json\") \n mood_data = JSON.parse(raw_data) \n Track.convert(mood_data, :object)\nend",
"def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend",
"def show\n @talk = Talk.find(params[:id])\n\n respond_to do |format|\n # format.json { render json: {:talk => @talk, :audio => @talk.audio} }\n format.json { send_file @talk.audio.path, :type => \"audio/mp3\"}\n end\n end"
] |
[
"0.7170608",
"0.7126237",
"0.7124327",
"0.6898038",
"0.68556786",
"0.68189317",
"0.68025374",
"0.6752313",
"0.6698238",
"0.6689691",
"0.6612132",
"0.6558259",
"0.65356135",
"0.65115935",
"0.6469099",
"0.6469099",
"0.6469099",
"0.6469099",
"0.6455372",
"0.64298964",
"0.6392665",
"0.6392665",
"0.6392665",
"0.6392665",
"0.63477534",
"0.6347663",
"0.63118553",
"0.6306136",
"0.6304035",
"0.6304035",
"0.6304035",
"0.63034815",
"0.6298252",
"0.6288147",
"0.62653494",
"0.6239812",
"0.6238505",
"0.6237986",
"0.623536",
"0.62326986",
"0.61986107",
"0.61951464",
"0.6187352",
"0.6165667",
"0.61544555",
"0.61544555",
"0.6131501",
"0.6121311",
"0.6121311",
"0.6099281",
"0.6088484",
"0.60755926",
"0.60613155",
"0.605398",
"0.604756",
"0.60463506",
"0.6036618",
"0.6029473",
"0.6020906",
"0.60082763",
"0.59930867",
"0.5988925",
"0.5971412",
"0.59694374",
"0.5965444",
"0.5964231",
"0.59637296",
"0.595265",
"0.5949602",
"0.5941468",
"0.59278846",
"0.5922412",
"0.59193164",
"0.5917859",
"0.5904946",
"0.5904946",
"0.5900007",
"0.5899649",
"0.5895938",
"0.5895938",
"0.5895938",
"0.5895938",
"0.5895938",
"0.5895278",
"0.5893511",
"0.5889331",
"0.58812934",
"0.58799785",
"0.5871738",
"0.586557",
"0.5859729",
"0.5855333",
"0.5855145",
"0.58539236",
"0.583952",
"0.58351076",
"0.58333427",
"0.58326817",
"0.58265513",
"0.58153564",
"0.5811863"
] |
0.0
|
-1
|
POST /music_discs POST /music_discs.json
|
def create
@music_disc = MusicDisc.new(music_disc_params)
@music_disc.user = current_user
respond_to do |format|
if @music_disc.save
format.html { redirect_to @music_disc }
format.json { render :show, status: :created, location: @music_disc }
else
format.html { render :new }
format.json { render json: @music_disc.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def music_disc_params\n params.require(:music_disc).permit(:title, :discography, :group_name, { music_category_ids: []}, :image)\n end",
"def create\n @music = Music.new(params[:music])\n\n respond_to do |format|\n if @music.save\n format.html { redirect_to \"/musics\", notice: 'Music was successfully created.' }\n format.json { render json: @music, status: :created, location: @music }\n else\n format.html { render action: \"new\" }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @music = Music.new(params[:music])\n\n respond_to do |format|\n if @music.save\n format.html { redirect_to @music, notice: 'Music was successfully created.' }\n format.json { render json: @music, status: :created, location: @music }\n else\n format.html { render action: \"new\" }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @music = Music.new(params[:music])\n\n respond_to do |format|\n if @music.save\n format.html { redirect_to @music, notice: 'Music was successfully created.' }\n format.json { render json: @music, status: :created, location: @music }\n else\n format.html { render action: \"new\" }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @music = Music.new(music_params)\n\n respond_to do |format|\n if @music.save\n format.html { redirect_to @music, notice: 'Music was successfully created.' }\n format.json { render :show, status: :created, location: @music }\n else\n format.html { render :new }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @music = Music.new(music_params)\n\n respond_to do |format|\n if @music.save\n format.html { redirect_to @music, notice: 'Music was successfully created.' }\n format.json { render :show, status: :created, location: @music }\n else\n format.html { render :new }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @music_discs = MusicDisc.all\n end",
"def destroy\n @music_disc.destroy\n respond_to do |format|\n format.html { redirect_to music_discs_url }\n format.json { head :no_content }\n end\n end",
"def set_music_disc\n id = params[:id].nil? ? params[:music_disc_id] : params[:id]\n @music_disc = MusicDisc.find(id)\n end",
"def create\n @music = current_user.musics.build(music_params)\n\n respond_to do |format|\n if @music.save\n format.html { redirect_to @music, notice: 'Успешно создана запись о музыке.' }\n format.json { render :show, status: :created, location: @music }\n else\n format.html { render :new }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @song = Song.new(autofill_vorbis_comments(song_params()))\n # artist = Artist.find_by(name: params[\"song\"][\"artist\"])\n # @song.artist = artist\n\n respond_to do |format|\n if @song.save\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render :show, status: :created, location: @song }\n else\n format.html { render :new }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @music_like = MusicLike.new(params[:music_like])\n\n respond_to do |format|\n if @music_like.save\n format.html { redirect_to @music_like, :notice => 'Music like was successfully created.' }\n format.json { render :json => @music_like, :status => :created, :location => @music_like }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @music_like.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def music_params\n params.require(:music).permit(:artist, :song_name, :song_api, :genre, :slug)\n end",
"def update\n songs_to_remove = @music_disc.songs.select {|song| !music_disc_params[:music_category_ids].include?(song.music_category.id.to_s)}\n songs_to_remove.each do | song |\n @music_disc.songs.delete(song)\n end\n respond_to do |format|\n if @music_disc.update(music_disc_params)\n format.html { redirect_to @music_disc }\n format.json { render :show, status: :ok, location: @music_disc }\n else\n format.html { render :edit }\n format.json { render json: @music_disc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_songs\n 5.times do |i|\n url = \"https://stg-resque.hakuapp.com/songs.json?album_id=#{i+1}\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n songs = JSON.parse(response)\n\n songs.each do |song|\n Song.create!(song.except('id'))\n end\n end\nend",
"def create\n @music = Music.new(music_params)\n if @music.save\n redirect_to musics_path\n else\n render :new\n end\n end",
"def music_params\n params.permit(:title, :duration, :genre_id)\n end",
"def music_params\n params.require(:music).permit(:title, :track, :user_id)\n end",
"def create\n @music = Music.new(music_params)\n\n respond_to do |format|\n if @music.save\n format.html { redirect_to request.referrer, notice: 'Track has successfully dawnloaded.' }\n else\n format.html { redirect_to request.referrer, notice: 'Track has not downloaded.' }\n end\n end\n end",
"def create\n @music_category = MusicCategory.new(params[:music_category])\n\n respond_to do |format|\n if @music_category.save\n format.html { redirect_to @music_category, notice: 'Music category was successfully created.' }\n format.json { render json: @music_category, status: :created, location: @music_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @music_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @track = @disc.tracks.build(params[:track])\n\n respond_to do |format|\n if @track.save\n format.html { redirect_to disc_tracks_path(@disc), notice: 'Track was successfully created.' }\n format.json { render json: @track, status: :created, location: @track }\n else\n format.html { render action: \"new\" }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"def music_params\n params.require(:music).permit(:title, :description, :release_year, :artist, :image)\n end",
"def create\n render json: Dish.create(dish_params)\n end",
"def music_params\n params.require(:music).permit(:name)\n end",
"def create\n @disc = Disc.new(disc_params)\n\n respond_to do |format|\n if @disc.save\n format.html { redirect_to @disc, notice: 'Disc was successfully created.' }\n format.json { render :show, status: :created, location: @disc }\n else\n format.html { render :new }\n format.json { render json: @disc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end",
"def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end",
"def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end",
"def create\n\t\t\t@music_albums = current_user.music_albums\n @music = Music.new(params[:music])\n @music.user = current_user\n if @music.save\n begin\n mp3_info = Mp3Info.open(@music.music_attach.path)\n @music.length_in_seconds = mp3_info.length.to_i\n @music.artist = mp3_info.tag.artist\n @music.title ||= mp3_info.tag.title if mp3_info.tag.title\n @music.length_in_seconds = mp3_info.length.to_i\n @music.save!\n rescue\n # Nothing\n end\n flash[:notice] = 'Music was successfully created.'\n post_wall(@music) if !check_is_private(current_user, \"my_musics\")\n redirect_to user_music_album_path(current_user, @music.music_album)\n else\n\t\t\t\tflash[:error] = 'Music was error created.'\n \trender :action => \"new\"\n end\n end",
"def create\n if !params[\"music\"].nil?\n @music = Music.new(params[:music])\n @music.name=params[\"music\"][\"audio\"].original_filename\n @music.size=params[\"music\"][\"audio\"].size\n @music.content_type=params[\"music\"][\"audio\"].content_type\n else\n raise \"Please Choose file to upload\"\n end\n respond_to do |format|\n if @music.save\n format.html { redirect_to @music, notice: 'Music was successfully created.' }\n format.json { render json: @music, status: :created, location: @music }\n else\n format.html { render action: \"new\" }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @music }\n end\n \n end",
"def add(title, artist)\n payload = [{\n action: 'update',\n item: {\n item_id: \"#{title} - #{artist}\",\n song_id: get_song_id(title, artist),\n play_count: 1\n # favorite: true\n }\n }]\n\n ECHONEST.post '/catalog/update', id: id, data: payload.to_json\n end",
"def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end",
"def music_params\n params.require(:music).permit(:name, :file, :author, :image)\n end",
"def music_list\n @musics = Music.find_musics_by_user(current_user.id)\n \n music_like = MusicLike.new\n music_like.user_id = current_user.id\n hash = params[:like]\n if hash != nil\n hash_invert = hash.invert\n music_like.music_id = hash_invert.values_at(\"like\").first.to_i\n music_like.save\n\n music = music_like.music\n sql = ActiveRecord::Base.connection()\n sql.execute(\"UPDATE musics SET musics.popularity = musics.popularity + 1 WHERE musics.id = \" + music.id.to_s)\n end\n \n redirect_to '/musics/home'\n end",
"def create\n song = Song.new(song_params)\n song.artist_id = @artist.id\n\n if song.save\n render status: 201, json: {\n message: 'Song successfully created',\n song: song\n }.to_json\n else\n render status: 422, json: {\n errors: song.errors\n }.to_json\n end\n end",
"def create\n songs = get_kexp_songs()\n idx = 0\n\n while idx < songs['results'].length\n if songs['results'][idx]['playtype']['name'] != \"Media play\"\n idx += 1\n next\n end\n song_title = songs['results'][idx]['track']['name']\n song_artist = songs['results'][idx]['artist']['name']\n \n if !songs['results'][idx]['release']\n song_album = \"\"\n song_release_year = 0\n song_album_img = \"https://cdn.pixabay.com/photo/2019/04/04/18/50/cassette-4103530_1280.jpg\"\n else\n if song_album_img = songs['results'][idx]['release']['largeimageuri'] == nil\n song_album_img = \"https://cdn.pixabay.com/photo/2019/04/04/18/50/cassette-4103530_1280.jpg\"\n else\n song_album_img = songs['results'][idx]['release']['largeimageuri']\n end\n song_album = songs['results'][idx]['release']['name']\n song_release_year = songs['results'][idx]['releaseevent']['year'].to_i\n end\n \n song_is_local = songs['results'][idx]['artist']['islocal']\n #if song|artist|album don't exist -> create \n if Album.find_by(title: song_album) == nil\n song_artist = song_artist.split('feat.')[0]\n mod_artist = song_artist.strip().gsub(/[^0-9a-z ]/i, '').split(' ').join('+')\n parsed_response = get_song_genre(mod_artist)\n \n #if bad status code -> query by song instead\n if parsed_response[\"status_code\"] > 299 || parsed_response[\"status_code\"] < 200 || parsed_response[\"genre\"] == \"\"\n mod_song = song_title.strip().gsub(/[^0-9a-z ]/i, '').split(' ').join('+')\n parsed_response = get_song_genre(mod_song)\n end\n @album = Album.new(title: song_album, album_img: song_album_img, year: song_release_year, genre: parsed_response[\"genre\"])\n @album.save()\n else \n @album = Album.find_by(title: song_album)\n end\n\n if Artist.find_by(name: song_artist) == nil\n @artist = Artist.new(name: song_artist, is_local?: song_is_local, album: @album)\n @artist.save()\n else \n @artist = Artist.find_by(name: song_artist)\n @artist.update(album: @album)\n end\n if Song.find_by(title: song_title) == nil\n @song = Song.new(title: song_title, artist: @artist)\n @song.save()\n else \n @song = Song.find_by(title: song_title)\n @song.update(artist: @artist)\n end\n idx += 1\n end\n redirect_to songs_path\n end",
"def songs\n \t@songs = Album.find(params[:id])\n songs = RSpotify::Track.search(@songs.name)\n \t@songs = songs.map do |s_songs|\n \tSong.new_from_spotify_song(s_songs)\n end\n render json: {data:@songs}\n end",
"def plsbgmusic_params\n params.require(:plsbgmusic).permit(:name, :time, :device_ids => [], :mediafile_ids => [])\n end",
"def create\n @top_music = TopMusic.new(top_music_params)\n\n respond_to do |format|\n if @top_music.save\n format.html { redirect_to @top_music, notice: 'Top music was successfully created.' }\n format.json { render :show, status: :created, location: @top_music }\n else\n format.html { render :new }\n format.json { render json: @top_music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @track = @disc.tracks.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @track }\n end\n end",
"def create\n require 'feedzirra'\n feed = parse_feed params[:new_podcast_url]\n feed.sanitize_entries! # let's make sure this actually makes things usable'\n\n # Make the podcast entry\n @podcast = Podcast.new(\n :title => feed.title,\n :url => params[:new_podcast_url]\n )\n\n if @podcast.save\n feed.entries.each do |entry|\n song = Song.new(\"title\" => entry.title, \"location\" => entry.url, \"artist\" => entry.author, \"album\" => feed.title)\n song.audio = @podcast\n song.save! # TODO add exception handling\n end\n end\n\n respond_to do |format|\n if @podcast.blank?\n format.json { render json: @podcast.songs.to_json }\n format.html { redirect_to :songs_dashboard, notice: 'Podcast was successfully created.' }\n else\n format.json { render json: @podcast.errors }\n format.html { render action: \"new\" }\n end\n end\n end",
"def music_params\n params.require(:music).permit(:name, :user_id, :upload, :direct_upload_url, :upload_file_name, :processed)\n end",
"def create\n @song = Song.new(song_params)\n\n respond_to do |format|\n if @song.save\n format.html { redirect_to dashboard_songs_url, notice: \"歌曲新增成功。\" }\n format.json { render :show, status: :created, location: @song }\n else\n format.html { render :new }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend",
"def song_params\n params.require(:song).permit(:name, :chords)\n end",
"def create\n @music_type = MusicType.new(music_type_params)\n\n respond_to do |format|\n if @music_type.save\n format.html { redirect_to @music_type, notice: 'Music type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @music_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @music_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @music_like = MusicLike.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @music_like }\n end\n end",
"def index\n @tracks = @disc.tracks.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tracks }\n end\n end",
"def create\n @music = current_user.uploaded_tracks.new(music_params)\n\t\t@music.name = params[:filename]\n\t\t@music.save\n\t\t@track = @music.associated_track\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @musics }\n end\n end",
"def create\n @music = Music.new(params[:music])\n @music.file = params[:file]\n @music.user_id = session[:user_id]\n \n respond_to do |format|\n if @music.save\n format.html { redirect_to my_uploads_url, notice: 'Music was successfully created.' }\n format.json { render json: @music, status: :created, location: @music }\n else\n format.html { render action: \"new\" }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def song_params\n params.require(:song).permit(:title, :artist, :time, :fav)\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def index\n @albums = Album.all\n gracenote = Gracenote.new({\n :clientID => \"13347840\",\n :clientTag => \"D65E1D17F0A30742392E35C9717FA90E\",\n :userID => \"32185966555210305-3B5A796CF0A1B370B88F4258970932B7\"\n })\n\n #result = gracenote.findTrack(\"Perfume\", \"GAME\", \"チョコレイト・ディスコ\", '0').inspect\n # puts result\n # 1.アルバムを指定\n # 2.api実行\n\n #result = gracenote.findTrack(\"\", \"THE IDOLM@STER LIVE THE@TER COLLECTION Vol. 2 -765PRO ALLSTARS- [Disc 2]\", \"\", '0') # .inspect\n ## THE IDOLM@STER LIVE THE@TER DREAMERS 02 がない問題\n ## LTA LTFはない\n # result = gracenote.findTrack(\"\", \"\", \"創造は始まりの風を連れて\", '0') # .inspect\nif false\n @albums.each do |album|\n album.songs.each do |song|\n unless song.tempo.blank?\n tempo_ids = []\n song.tempo.split(',').each do |m|\n tempo_ids = tempo_ids.push(Tempo.find_or_create_by(name: m).id)\n end\n song.tempos = Tempo.where(id: tempo_ids)\n song.save\n end\n unless song.mood.blank?\n mood_ids = []\n song.mood.split(',').each do |m|\n mood_ids = mood_ids.push(Mood.find_or_create_by(name: m).id)\n end\n song.moods = Mood.where(id: mood_ids)\n song.save\n end\n end\n end\nend\nif false\n # 3.アルバムのデータをsave\n # gn_id:string artist title release_date:date track_count:integer genre url\n album = Album.new\n album.gn_id = result[0][:album_gnid]\n album.artist = result[0][:album_artist_name]\n album.title = result[0][:album_title]\n album.release_date = result[0][:album_year]\n album.track_count = result[0][:tracks].count\n album.genre = result[0][:genre].map{ |g| g[:text] }.join(',')\n album.url = result[0][:album_art_url]\n album.save\n\n # 4.トラックのデータをsave\n # song = Song.new\n # gn_id:string album_id:integer artist title track_num:integer genre modo tempo\n result[0][:tracks].each do |track|\n song = Song.new\n song.gn_id = track[:track_gnid]\n song.album_id = album.id\n song.artist = track[:track_artist_name]\n song.title = track[:track_title]\n song.track_num = track[:track_number]\n mood_ids = []\n if track[:mood].present?\n track[:mood].each do |mood|\n mood_ids = mood_ids.push(Mood.find_or_create_by(name: mood).id)\n end\n end\n song.moods = Mood.where(id: mood_ids)\n tempo_ids = []\n if track[:tempo].present?\n track[:tempo].each do |tempo|\n tempo_ids = tempo_ids.push(Tempo.find_or_create_by(name: tempo).id)\n end\n end\n song.tempos = Tempo.where(id: song.tempo_ids)\n song.save\n end\nend\n end",
"def create\n @song = Song.new(song_params)\n\n if @song.save\n render :show, status: :created, location: @song\n else\n render json: @song.errors, status: :unprocessable_entity\n end\n end",
"def create\n @song_like = SongLike.new(params[:song_like])\n\n respond_to do |format|\n if @song_like.save\n format.html { redirect_to @song_like, notice: 'Song like was successfully created.' }\n format.json { render json: @song_like, status: :created, location: @song_like }\n else\n format.html { render action: \"new\" }\n format.json { render json: @song_like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @musics }\n end\n end",
"def musicfile_params\n params.require(:musicfile).permit(:description, :audio)\n end",
"def create\n @song = Song.new(song_params)\n\n respond_to do |format|\n if @song.save\n album_id = params[\"album\"]\n \n if not album_id.nil?\n album = Album.find_by(id: album_id)\n if not album.nil?\n album.songs << @song\n album.save\n\n artist = album.artist\n\n if not artist.nil?\n artist_id = artist.id\n if not artist_id.nil?\n artist.songs << @song\n artist.save\n end\n end\n end\n end\n\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render :show, status: :created, location: @song }\n else\n format.html { render :new }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @music_category = MusicCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music_category }\n end\n end",
"def song_params\n params.require(:song).permit(:title, :artist, :rating, :last_practiced, :number_of_practices, :comment)\n end",
"def create\n @song = Song.new(params[:song])\n\n respond_to do |format|\n if @song.save\n format.html { redirect_to @song, :notice => 'Song was successfully created.' }\n format.json { render :json => @song, :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 create\n @musictrack = Musictrack.new(musictrack_params)\n\n respond_to do |format|\n if @musictrack.save\n format.html { redirect_to @musictrack, notice: 'Musictrack was successfully created.' }\n format.json { render :show, status: :created, location: @musictrack }\n else\n format.html { render :new }\n format.json { render json: @musictrack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @song = @artist.songs.new(song_params)\n\n respond_to do |format|\n if @song.save\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render action: 'show', 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 create\n respond_with AudioCollection.create(audio_collection_params)\n end",
"def create\n #@song = Song.new(song_params)\n @song = @artist.songs.new(song_params)\n\n respond_to do |format|\n if @song.save\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render action: 'show', 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 create\n @song = Song.new(song_params)\n @song.user = current_user\n @song.rating = 0\n @song.number_of_practices = 0\n @song.last_practiced = DateTime.now\n\n respond_to do |format|\n if @song.save\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render :show, status: :created, location: @song }\n else\n format.html { render :new }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def disc(id)\n get(\"/catalog/titles/discs/#{id.to_s}\")\n end",
"def create\n @song = Song.new(params[:song])\n\n respond_to do |format|\n if @song.save\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render json: @song, 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 create\n @song = Song.new(params[:song])\n\n respond_to do |format|\n if @song.save\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render json: @song, 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 destroy\n @music = Music.find(params[:id])\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @music = Music.find(params[:id])\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @music = Music.find(params[:id])\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end",
"def add_musician\r\n @band = Band.find(params[:id])\r\n end",
"def create\n discounts = []\n (1..params[:discount_number].to_i).each do |i|\n @discount = Discount.new(params[:discount])\n @discount.generate_token params[:discount_six_length].to_i\n @discount.save\n discounts << @discount\n end\n respond_to do |format|\n format.html { redirect_to discounts_url, notice: I18n.t(:discount_created, n: params[:discount][:name], c: params[:discount_number] ) }\n format.json { render json: discounts, status: :created, location: discounts }\n end\n end",
"def post_params(*args)\n params.require(:song).permit(*args)\n end",
"def create\n @song = Song.new(params[:song])\n\n respond_to do |format|\n if @song.save\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render json: @song, 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 @song\n end",
"def create\n @song = Song.new(song_params)\n @song.artist = get_artist(params)\n respond_to do |format|\n if @song.save\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render :show, status: :created, location: @song }\n else\n format.html { render :new }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @music = Music.new\n end",
"def new\n @music = Music.new\n end",
"def create\n @feed_dislike = FeedDislike.new(params[:feed_dislike])\n\n respond_to do |format|\n if @feed_dislike.save\n format.html { redirect_to @feed_dislike, notice: 'Feed dislike was successfully created.' }\n format.json { render json: @feed_dislike, status: :created, location: @feed_dislike }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feed_dislike.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @music = Music.find(params[:id])\n @music.destroy\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end",
"def muscle_params\n params.require(:muscle).permit(:name)\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 create\n @radioshow = Radioshow.new(radioshow_params)\n\n respond_to do |format|\n if @radioshow.save\n format.html { redirect_to music_path, notice: 'Radioshow was successfully created.' }\n format.json { render :show, status: :created, location: @radioshow }\n else\n format.html { render :new }\n format.json { render json: @radioshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:song][:user_id] = current_user.id\n @song = Song.new(params[:song])\n if @song.save\n redis_auth\n $redis.publish \"new song\", ActiveSupport::JSON.encode({ :station => params[:station_id], :user => current_user.name, :song => @song })\n render :js => \"ajaxCallback('#{params[:div]}', 1)\"\n else\n render :js => \"ajaxCallback('#{params[:div]}', -1)\"\n end\n end",
"def dish_mood_params\n params.require(:dish_mood).permit(:dish_id, :mood_id)\n end",
"def create\n @dish_mood = DishMood.new(dish_mood_params)\n\n respond_to do |format|\n if @dish_mood.save\n format.html { redirect_to @dish_mood, notice: 'Dish mood was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dish_mood }\n else\n format.html { render action: 'new' }\n format.json { render json: @dish_mood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def song_params\n params.require(:song).permit(:artist, :category, :mood, :genre, :title, :content, :content_html, :summary_html, :vidurl, :remote_thumburl_url, :publish_at, :approved)\n end",
"def dish_params\n params.require(:dish).permit(:name, :cafeteria_id)\n end",
"def index\n @musics = Music.all\n end",
"def index\n @musics = Music.all\n end",
"def index\n @musics = Music.all\n end",
"def index\n @musics = Music.all\n end",
"def dish_params\n params.require(:dish).permit(:name, :dish_type)\n end"
] |
[
"0.6636835",
"0.6348932",
"0.6282617",
"0.6282617",
"0.6168037",
"0.6168037",
"0.6167091",
"0.61183494",
"0.6093184",
"0.60146844",
"0.5986225",
"0.59618896",
"0.5864717",
"0.5846669",
"0.58346194",
"0.5820219",
"0.58141947",
"0.58125854",
"0.5804949",
"0.5793953",
"0.57938886",
"0.57660383",
"0.5730263",
"0.57086045",
"0.56912994",
"0.5682868",
"0.5682868",
"0.5682868",
"0.5656602",
"0.56560826",
"0.56435716",
"0.5641685",
"0.5616535",
"0.56028765",
"0.5549966",
"0.5538499",
"0.55383515",
"0.5499497",
"0.54472095",
"0.5442332",
"0.54380995",
"0.5436392",
"0.5426679",
"0.54205287",
"0.5419183",
"0.5414374",
"0.540118",
"0.53985095",
"0.53984594",
"0.53938127",
"0.5389854",
"0.53862137",
"0.53843105",
"0.53747994",
"0.53747994",
"0.53747994",
"0.53747994",
"0.53747994",
"0.5364699",
"0.5364539",
"0.5354721",
"0.5353074",
"0.5350003",
"0.5348866",
"0.53485304",
"0.5338916",
"0.53320575",
"0.5330406",
"0.5328648",
"0.53278977",
"0.53245324",
"0.5307029",
"0.53014386",
"0.5293968",
"0.5293968",
"0.52802575",
"0.52802575",
"0.52802575",
"0.52787954",
"0.52737415",
"0.52600306",
"0.52524143",
"0.5251692",
"0.5246037",
"0.5246037",
"0.52444327",
"0.52430737",
"0.52410734",
"0.5239215",
"0.5234879",
"0.5233097",
"0.52323043",
"0.5231722",
"0.52314794",
"0.5228828",
"0.52268344",
"0.52268344",
"0.52268344",
"0.52268344",
"0.5225647"
] |
0.65569896
|
1
|
PATCH/PUT /music_discs/1 PATCH/PUT /music_discs/1.json
|
def update
songs_to_remove = @music_disc.songs.select {|song| !music_disc_params[:music_category_ids].include?(song.music_category.id.to_s)}
songs_to_remove.each do | song |
@music_disc.songs.delete(song)
end
respond_to do |format|
if @music_disc.update(music_disc_params)
format.html { redirect_to @music_disc }
format.json { render :show, status: :ok, location: @music_disc }
else
format.html { render :edit }
format.json { render json: @music_disc.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @music = Music.find(params[:id])\n\n respond_to do |format|\n if @music.update_attributes(params[:music])\n format.html { redirect_to @music, :notice => 'Music was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @music.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @music = Music.find(params[:id])\n\n respond_to do |format|\n if @music.update_attributes(params[:music])\n format.html { redirect_to @music, notice: 'Music was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @music = Music.find(params[:id])\n\n respond_to do |format|\n if @music.update_attributes(params[:music])\n format.html { redirect_to @music, notice: 'Music was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @music = Music.find(params[:id])\n\n respond_to do |format|\n if @music.update_attributes(params[:music])\n format.html { redirect_to @music, notice: 'Music was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @music.update(music_params)\n format.html { redirect_to @music, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@music = Music.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @music.update(music_params)\n format.html { redirect_to @music, notice: 'Music was successfully updated.' }\n format.json { render :show, status: :ok, location: @music }\n else\n format.html { render :edit }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @music.update(music_params)\n format.html { redirect_to @music, notice: 'Music was successfully updated.' }\n format.json { render :show, status: :ok, location: @music }\n else\n format.html { render :edit }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n \n respond_to do |format|\n updated_params = song_params\n if (@song.artist != song_params[:artist] || @song.songname != song_params[:songname])\n uri = 'http://developer.echonest.com/api/v4/song/search?api_key=6XUOAXHJOW28GGGRH&format=json&results=1&artist=' + Rack::Utils.escape(song_params[:artist]) + '&title=' + Rack::Utils.escape(song_params[:songname]) + '&bucket=audio_summary'\n result = open(uri).read\n parsed = JSON.parse(result)\n if parsed[\"response\"][\"songs\"].length > 0\n updated_params[:bpm] = parsed[\"response\"][\"songs\"][0][\"audio_summary\"][\"tempo\"]\n updated_params[:key] = parsed[\"response\"][\"songs\"][0][\"audio_summary\"][\"key\"]\n notice = \"Song found on EchoNest!\"\n else\n notice = \"Could not find updated song on EchoNest.\"\n end\n \n end\n if @song.update(updated_params)\n format.html { redirect_to @song, notice: \"#{notice} #{updated_params} \" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @music.update(music_params)\n format.html { redirect_to @music, notice: 'Изменена запись о музыке.' }\n format.json { render :show, status: :ok, location: @music }\n else\n format.html { render :edit }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @music =Music.find_by_sql(\"SELECT * FROM Musics M Where M.id = \" + params[:id]).first()\n\n respond_to do |format|\n if @music.update_attributes(params[:music])\n format.html { redirect_to \"/musics\", notice: 'Music was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:song][:song_type] = params[:song][:songs].content_type.chomp\n params[:song][:song_in] = params[:song][:songs].read\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, :flash => {:success => 'Song was successfully updated.'} }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit,:flash => {:danger => 'Song was failed to update.'} }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, :notice => 'Song was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @song.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, :notice => 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @song.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n AudioData.update!(\n audio: \"aaaa\"#audioURL\n )\n\n audio = AudioData.find_by(2);\n\n render :json => audio;\n end",
"def update\n @song = Song.find(params[:id])\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @musician = Musician.find(params[:id])\n\n respond_to do |format|\n if @musician.update_attributes(params[:musician])\n format.html { redirect_to @musician, notice: 'Musician was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @musician.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @music_like = MusicLike.find(params[:id])\n\n respond_to do |format|\n if @music_like.update_attributes(params[:music_like])\n format.html { redirect_to @music_like, :notice => 'Music like was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @music_like.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n @master_song = MasterSong.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @master_song.update_attributes(params[:master_song])\r\n format.html { redirect_to @master_song, notice: 'Master song was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @master_song.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @music_type.update(music_type_params)\n format.html { redirect_to @music_type, notice: 'Music type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @music_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @top_music.update(top_music_params)\n format.html { redirect_to @top_music, notice: 'Top music was successfully updated.' }\n format.json { render :show, status: :ok, location: @top_music }\n else\n format.html { render :edit }\n format.json { render json: @top_music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @music_category = MusicCategory.find(params[:id])\n\n respond_to do |format|\n if @music_category.update_attributes(params[:music_category])\n format.html { redirect_to @music_category, notice: 'Music category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @music_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n @song = Song.find_by(id: params[:id])\n if @song.update(song_params)\n \n render 'api/songs/show'\n else\n # debugger\n render json: @song.errors.full_messages, status: 401\n end\n end",
"def update\n respond_to do |format|\n if @musictrack.update(musictrack_params)\n format.html { redirect_to @musictrack, notice: 'Musictrack was successfully updated.' }\n format.json { render :show, status: :ok, location: @musictrack }\n else\n format.html { render :edit }\n format.json { render json: @musictrack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @song = Song.find(params[:id])\n @song.name = params[:song][:name]\n if params[:song][:audio]\n @song.audio = params[:song][:audio]\n end\n respond_to do |format|\n if @song.save\n format.js\n format.html { redirect_to root_url }\n format.json { head :no_content }\n else\n format.js\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to artist_album_song_url(@artist,@album,@song), notice: 'song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @song.artist = get_artist(params)\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to dashboard_songs_url, notice: \"歌曲更新成功。\" }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @music.update(music_params)\n redirect_to musics_path\n else\n render :edit\n end\n end",
"def update\n if @song.update(song_params)\n render :show, status: :ok, location: @song\n else\n render json: @song.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to playlist_song_path(@playlist,@song), notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @song = Song.find(params[:id])\n\n redirect_to @song, notice: 'Song was successfully updated.'\n render action: \"edit\"\n end\n\n # DELETE /songs/1\n # DELETE /songs/1.json\n def destroy\n @song = Song.find(params[:id])\n @song.destroy\n redirect_to songs_path\n end",
"def update\n @song = Song.find(params[:id])\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n\n # NOTE: Clear the genres so we can update them if needed\n @song.genres.clear\n\n # NOTE: Update the genre relations.\n if params[:genres].present?\n params[:genres].each do |genre|\n @song.genres << @genres.find(genre)\n end\n end\n\n # NOTE: Clear the moods so we can update them if needed\n @song.moods.clear\n\n # NOTE: Update the mood relations.\n if params[:moods].present?\n params[:moods].each do |mood|\n @song.moods << @moods.find(mood)\n end\n end\n\n # NOTE: Clear the themes so we can update them if needed\n @song.themes.clear\n\n # NOTE: Update the theme relations.\n if params[:themes].present?\n params[:themes].each do |theme|\n @song.themes << @themes.find(theme)\n end\n end\n\n # flash[:notice] = song_params\n # flash[:alert] = params\n flash[:success] = 'Song was successfully updated.'\n format.html { redirect_to @song }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @music.update(music_params)\n format.html { redirect_to request.referrer, notice: 'Track has successfully dawnloaded.' }\n else\n format.html { redirect_to request.referrer, notice: 'Error.' }\n end\n end\n end",
"def update\n#require 'logger'\n\n\t\tparams = song_params\n\t\tsongkey = params['song_key']\n\t\tparams.delete('song_key')\n\n songtags = params['tags']\n params.delete('tags')\n\n\t\trespond_to do |format|\n\t\t\tif @song.update(params)\n\n\t\t\t\tif songkey.to_s.length > 0\n\t\t\t\t\t@song.song_keys = [SongKey.find(songkey)]\n\t\t\t\telse\n\t\t\t\t\t@song.song_keys.destroy_all\n\t\t\t\tend\n\n @song.tags.destroy_all\n\n if !songtags.nil?\n @tags = []\n for tagid in songtags\n @tags.push(Tag.find(tagid))\n end\n @song.tags = @tags\n end\n\n#\t\t\t\tformat.html { redirect_to songs_url, notice: \"#{@song.name} was successfully updated!\" }\n\t\t\t\tformat.html { redirect_to song_url, notice: \"#{@song.name} was successfully updated!\" }\n\t\t\t\tformat.json { render :show, status: :ok, location: @song }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @song.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @deck = Deck.find(params[:id])\n @deck.update(title: params[:title])\n render \"update.json.jbuilder\", status: :ok\n end",
"def update\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n if @artist.update_attributes(params[:artist])\n format.html { redirect_to @artist, notice: 'Artist was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @attribute = Attribute.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @song = Song.find(params[:id])\n # Hack? How to do this better...\n params[:song][:genre] = Genre.find(params[:song][:genre_id])\n params[:song].delete(:genre_id)\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to [@artist, @song], notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @playlist = Playlist.find(params[:id])\n\n if @playlist.update_attributes(params[:playlist])\n head :no_content\n else\n render json: @playlist.errors, status: :unprocessable_entity\n end\n end",
"def update_song\n head :ok\n end",
"def update\n # find our musician\n @musician = Musician.find(params[:id])\n\n # set the status to true\n @musician.update_attributes(:status => true)\n @musician.save\n\n respond_to do |format|\n format.js {render inline: \"location.reload();\" }\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 @artist = Artist.find(params[:id])\n\n respond_to do |format|\n if @artist.update_attributes(params[:artist])\n format.html { redirect_to artist_url(@artist), notice: 'Artist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @song_like = SongLike.find(params[:id])\n\n respond_to do |format|\n if @song_like.update_attributes(params[:song_like])\n format.html { redirect_to @song_like, notice: 'Song like was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song_like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @track = @disc.tracks.find(params[:id])\n\n respond_to do |format|\n if @track.update_attributes(params[:track])\n format.html { redirect_to disc_tracks_url(@disc), notice: 'Track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @artist.update(artist_params)\n format.html { redirect_to @artist, notice: t(:update_notice) }\n format.json { render :show, status: :ok, location: @artist }\n else\n format.html { render :edit }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @musician = Musician.find(params[:id])\n\n respond_to do |format|\n if @musician.update_attributes(params[:musician])\n format.html { redirect_to(@musician, :notice => 'Musician was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @musician.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @audio = Audio.find(params[:id])\n\n respond_to do |format|\n if @audio.update_attributes(params[:audio])\n format.html { redirect_to @audio, notice: 'Audio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @audio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @audio = Audio.find(params[:id])\n\n respond_to do |format|\n if @audio.update_attributes(params[:audio])\n format.html { redirect_to @audio, :notice => 'Audio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @audio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n album_id = params[\"album\"]\n \n if not album_id.nil?\n album = Album.find_by(id: album_id)\n if not album.nil?\n album.songs << @song\n album.save\n\n artist = album.artist\n\n if not artist.nil?\n artist_id = artist.id\n if not artist_id.nil?\n artist.songs << @song\n artist.save\n end\n end\n end\n end\n \n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n artist_id = update_artist_exist_or_new(params[:artist_name])\n\n album_id = update_album_exist_or_new(params[:album_name], params[:genre], artist_id)\n\n respond_to do |format|\n\n @song.album_id = album_id\n a = @song.album\n a.artist_id = artist_id\n a.save\n\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song 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 @artist.update(artist_params)\n format.html { redirect_to @artist, notice: 'Artist was successfully updated.' }\n format.json { render :show, status: :ok, location: @artist }\n else\n format.html { render :edit }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @artist.update(artist_params)\n format.html { redirect_to @artist, notice: 'Artist was successfully updated.' }\n format.json { render :show, status: :ok, location: @artist }\n else\n format.html { render :edit }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @artist.update(artist_params)\n format.html { redirect_to @artist, notice: 'Artist was successfully updated.' }\n format.json { render :show, status: :ok, location: @artist }\n else\n format.html { render :edit }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @artist.update(artist_params)\n format.html { redirect_to @artist, notice: 'Artist was successfully updated.' }\n format.json { render :show, status: :ok, location: @artist }\n else\n format.html { render :edit }\n format.json { render json: @artist.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 @dish_mood.update(dish_mood_params)\n format.html { redirect_to @dish_mood, notice: 'Dish mood was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dish_mood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @artist.update(artist_params)\n format.html { redirect_to @artist, notice: \"Artist was successfully updated.\" }\n format.json { render :show, status: :ok, location: @artist }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @radioshow.update(radioshow_params)\n format.html { redirect_to music_path, notice: 'Radioshow was successfully updated.' }\n format.json { render :show, status: :ok, location: @radioshow }\n else\n format.html { render :edit }\n format.json { render json: @radioshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @audio.update(audio_params)\n format.html { redirect_to @audio, notice: 'Audio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @audio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @song = Song.find(params[:id])\n @song.name = \"#{@song.title} by #{@song.user.name}\"\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to user_song_path(@song.user, @song), notice: 'Song was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @plsbgmusic.update(plsbgmusic_params)\n format.html { redirect_to @plsbgmusic, notice: 'Plsbgmusic was successfully updated.' }\n format.json { render :show, status: :ok, location: @plsbgmusic }\n else\n format.html { render :edit }\n format.json { render json: @plsbgmusic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end",
"def update\n @photo = Photo.find(params[:id])\n # url = @photo.song_url\n url = params[:photo][:song_url]\n embedly_photo(url)\n \n @photo.save\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @audio_clip = AudioClip.find(params[:id])\n\n respond_to do |format|\n if @audio_clip.update_attributes(params[:audio_clip])\n format.html { redirect_to @audio_clip, notice: 'Audio clip was successfully updated.' }\n format.json { render :json => @audio_clip }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @audio_clip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @audio_mp3 = AudioMp3.find(params[:id])\n\n respond_to do |format|\n if @audio_mp3.update_attributes(params[:audio_mp3])\n format.html { redirect_to audio_mp3_path(@audio_mp3), notice: 'Audio mp3 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @audio_mp3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to(@song, :notice => 'Song was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @song.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to(@song, :notice => 'Song was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @song.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to(@song, :notice => 'Song was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @song.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @artist.update(artist_params)\n\n format.html { redirect_to @artist, notice: 'Artist was successfully updated.' }\n\n format.json { render :show, status: :ok, location: @artist }\n\n else\n\n format.html { render :edit }\n\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n\n end\n end\n end",
"def update\n respond_to do |format|\n if @spotify_artist.update(spotify_artist_params)\n format.html { redirect_to @spotify_artist, notice: 'Spotify artist was successfully updated.' }\n format.json { render :show, status: :ok, location: @spotify_artist }\n else\n format.html { render :edit }\n format.json { render json: @spotify_artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lightshow = Lightshow.find(params[:id])\n @song = Song.find(params[:lightshow].delete(:song_id))\n @lightshow.song = @song\n @lightshow.save!\n respond_to do |format|\n if @lightshow.update_attributes(params[:lightshow])\n format.html { redirect_to @lightshow, notice: 'Lightshow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lightshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @featured_song = FeaturedSong.find(params[:id])\n\n respond_to do |format|\n if @featured_song.update_attributes(params[:featured_song])\n format.html { redirect_to @featured_song, notice: 'Featured song was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @featured_song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params.has_key? :like\n @client.put(\"/me/favorites/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :unlike\n @client.delete(\"/me/favorites/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :repost\n @client.put(\"/me/track_reposts/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :unpost\n @client.delete(\"/me/track_reposts/#{params[:id]}\")\n head :ok and return\n end\n\n head :bad_request\n end",
"def update\n @musicfile = Musicfile.find(params[:id]) \n\n if @musicfile.update(musicfile_params)\n redirect_to @musicfile, notice: 'Music File was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n @verse = Verse.find(params[:id])\n\n @song = @verse.song.id\n\n respond_to do |format|\n if @verse.update_attributes(params[:verse])\n format.html { redirect_to song_url(@song), notice: 'Verse was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @verse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dish.update(dish_params)\n format.html { redirect_to @dish, notice: 'Блюдо обновлено.' }\n format.json { render :show, status: :ok, location: @dish }\n else\n format.html { render :edit }\n format.json { render json: @dish.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6817732",
"0.68119",
"0.68086284",
"0.6807941",
"0.67412335",
"0.67118347",
"0.6629886",
"0.6629886",
"0.65945536",
"0.6555014",
"0.64799225",
"0.63981086",
"0.6296029",
"0.62937444",
"0.62895614",
"0.6287331",
"0.6286059",
"0.6282151",
"0.6282151",
"0.6282151",
"0.6281662",
"0.6263565",
"0.62555295",
"0.62142676",
"0.6198161",
"0.6186005",
"0.6186005",
"0.6186005",
"0.6185441",
"0.61682105",
"0.6155045",
"0.6143411",
"0.61380076",
"0.6133991",
"0.6133032",
"0.61272365",
"0.6108132",
"0.60972834",
"0.60878867",
"0.607941",
"0.607941",
"0.607941",
"0.607941",
"0.607941",
"0.607941",
"0.607941",
"0.607941",
"0.60718685",
"0.6045047",
"0.6035399",
"0.6030659",
"0.60253453",
"0.60244864",
"0.600777",
"0.6004429",
"0.60010207",
"0.6000964",
"0.59992987",
"0.59945077",
"0.59908485",
"0.598936",
"0.59805095",
"0.59775054",
"0.596625",
"0.59589076",
"0.5957395",
"0.5952151",
"0.5947885",
"0.59471136",
"0.5944668",
"0.59345406",
"0.59251076",
"0.591975",
"0.591975",
"0.591975",
"0.591975",
"0.59168494",
"0.5909335",
"0.5909191",
"0.5901843",
"0.58972466",
"0.589142",
"0.58831257",
"0.5877601",
"0.5877367",
"0.58677095",
"0.58562005",
"0.5855028",
"0.5854833",
"0.5848255",
"0.5848255",
"0.5848255",
"0.58387864",
"0.5836366",
"0.58362114",
"0.5829092",
"0.58171827",
"0.5816279",
"0.58153677",
"0.5811198"
] |
0.66096693
|
8
|
DELETE /music_discs/1 DELETE /music_discs/1.json
|
def destroy
@music_disc.destroy
respond_to do |format|
format.html { redirect_to music_discs_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @music = Music.find(params[:id])\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @music = Music.find(params[:id])\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @music = Music.find(params[:id])\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @musica.audios.purge\n @musica.destroy\n respond_to do |format|\n format.html { redirect_to musicas_url, notice: 'Álbum apagado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @music = Music.find_by_sql(\"SELECT * FROM Musics M Where M.id = \" + params[:id]).first()\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/musics\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @music = Music.find(params[:id])\n @music.destroy\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @music.destroy\n respond_to do |format|\n format.html { redirect_to musics_url, notice: 'Удалена запись о музыке.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @music = Music.find(params[:id])\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to home_url }\n format.json { head :ok }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @musician = Musician.find(params[:id])\n @musician.destroy\n\n respond_to do |format|\n format.html { redirect_to musicians_url }\n format.json { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @music.destroy\n respond_to do |format|\n format.html { redirect_to musics_url, notice: 'Music was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @music.destroy\n respond_to do |format|\n format.html { redirect_to musics_url, notice: 'Music was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song = Song.find(params[:id])\n #@song.remove_file_path!\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @music.destroy\n\t\tflash[:notice] = \"Song has been deleted.\"\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 @dish_mood.destroy\n respond_to do |format|\n format.html { redirect_to dish_moods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @music_type.destroy\n respond_to do |format|\n format.html { redirect_to music_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @music_like = MusicLike.find(params[:id])\n @music_like.destroy\n\n respond_to do |format|\n format.html { redirect_to music_likes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @master_song = MasterSong.find(params[:id])\r\n @master_song.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to master_songs_url }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @music_category = MusicCategory.find(params[:id])\n @music_category.destroy\n\n respond_to do |format|\n format.html { redirect_to music_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end",
"def delete(songpos)\n send_request('delete %s' % songpos)\n end",
"def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @audio_mp3 = AudioMp3.find(params[:id])\n @audio_mp3.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_audio_contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @musician = Musician.find(params[:id])\n @musics = Music.find_all_by_musician_id(@musician.id)\n @musics.each do |music|\n music.destroy\n end\n @musician.destroy\n\n respond_to do |format|\n format.html { redirect_to(musicians_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @disc.destroy\n respond_to do |format|\n format.html { redirect_to discs_url, notice: 'Disc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audio.destroy\n respond_to do |format|\n format.html { redirect_to audios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @music.destroy\n respond_to do |format|\n format.html { redirect_to request.referrer, notice: 'Track has successfully deleted.' }\n end\n end",
"def destroy\n @mp3.destroy\n respond_to do |format|\n format.html { redirect_to mp3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #File.delete(\"app/assets/songs/\"+@song.song)\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 @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url, notice: 'Блюдо уничтожено.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audio = Audio.find(params[:id])\n @audio.destroy\n\n respond_to do |format|\n format.html { redirect_to audios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audio = Audio.find(params[:id])\n @audio.destroy\n\n respond_to do |format|\n format.html { redirect_to audios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish_mixture.destroy\n respond_to do |format|\n format.html { redirect_to dish_mixtures_url }\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 @muscle_diary.destroy\n respond_to do |format|\n format.html { redirect_to muscle_diaries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @music.destroy\n redirect_to musics_path\n end",
"def destroy\n @dish = Dish.find(params[:id])\n @dish.destroy\n\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish = Dish.find(params[:id])\n @dish.destroy\n\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end",
"def delete_music\n \tputs \"Testing music deleting\"\n \t# Going to delete all the music of this user\n \tmediums = Medium.where(user_id:@id)\n \tfor medium in mediums\n \t\tmedium.music.destroy\n \t\tmedium.destroy\n \tend\n \t# Ensure the user's music got deleted \n \traise \"Music deletion failed \" unless not Medium.find_by(user_id:@id)\n \tputs \"Music deletion passed\"\n end",
"def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url, notice: 'El plato se ha eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_songs_url, notice: \"歌曲刪除成功。\" }\n format.json { head :no_content }\n end\n end",
"def update\n songs_to_remove = @music_disc.songs.select {|song| !music_disc_params[:music_category_ids].include?(song.music_category.id.to_s)}\n songs_to_remove.each do | song |\n @music_disc.songs.delete(song)\n end\n respond_to do |format|\n if @music_disc.update(music_disc_params)\n format.html { redirect_to @music_disc }\n format.json { render :show, status: :ok, location: @music_disc }\n else\n format.html { render :edit }\n format.json { render json: @music_disc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @top_music.destroy\n respond_to do |format|\n format.html { redirect_to top_musics_url, notice: 'Top music was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @musician = Musician.find(params[:id])\n @musician.destroy\n\n respond_to do |format|\n format.html { redirect_to(musicians_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n Track.destroy(params[:id])\n delete_file BSON::ObjectId(params[:id])\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Like.delete(params[\"id\"])\n end",
"def destroy\n @dart = Dart.find(params[:id])\n @dart.destroy\n\n respond_to do |format|\n format.html { redirect_to darts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @plsbgmusic.destroy\n respond_to do |format|\n format.html { redirect_to plsbgmusics_url, notice: 'Plsbgmusic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @song\n\n @song.mp3 = nil\n @song.destroy\n respond_to do |format|\n format.html { redirect_to user_album_path(@user, @album), notice: 'Song was successfully deleted!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @musictrack.destroy\n respond_to do |format|\n format.html { redirect_to musictracks_url, notice: 'Musictrack was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @muscle.destroy\n respond_to do |format|\n format.html { redirect_to user_muscles_path(@user), notice: 'Muscle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to category_dishes_url(@category) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lyric.destroy\n respond_to do |format|\n format.html { redirect_to lyrics_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def deleteid(songid)\n send_request('deleteid %s' % songid)\n end",
"def destroy\r\n @muscle_mass.destroy\r\n respond_to do |format|\r\n format.html { redirect_to muscle_masses_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @musica = Musica.find(params[:id])\n @musica.destroy\n\n respond_to do |format|\n format.html { redirect_to(musicas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url, notice: \"#{@song.name} was successfully deleted!\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @side_dish = SideDish.find(params[:id])\n @side_dish.destroy\n\n respond_to do |format|\n format.html { redirect_to side_dishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish = Dish.find(params[:id])\n @dish.destroy\n\n respond_to do |format|\n format.html { redirect_to my_page_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish_type.destroy\n respond_to do |format|\n format.html { redirect_to dish_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audio = Audio.find(params[:id])\n @audio.destroy\n\n respond_to do |format|\n format.html { redirect_to audios_url, :notice => \"Audio was successfully delete.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song = Song.find(params[:id])\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url, notice: 'Song was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @musician.destroy\n respond_to do |format|\n format.html { redirect_to musicians_url, notice: 'Musician was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @musico.destroy\n respond_to do |format|\n format.html { redirect_to musicos_url, notice: 'Musico was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url, notice: 'Dish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @audio.destroy\n respond_to do |format|\n format.html { redirect_to audios_url, notice: 'Categorie audio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cord.destroy\n respond_to do |format|\n format.html { redirect_to cords_url, notice: t('cords.destroy.success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audio_clip = AudioClip.find(params[:id])\n @audio_clip.destroy\n\n respond_to do |format|\n format.html { redirect_to audio_clips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Song was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @albumm = Albumm.find(params[:id])\n @albumm.destroy\n\n respond_to do |format|\n format.html { redirect_to albumms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @artist = Artist.find(params[:id])\n @artist.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 delete()\n sql = \"DELETE FROM albums\n WHERE id = $1;\"\n values = [@id]\n SqlRunner.run( sql, values )\n end",
"def destroy\n @song_like = SongLike.find(params[:id])\n @song_like.destroy\n\n respond_to do |format|\n format.html { redirect_to song_likes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sound_file = SoundFile.find(params[:id])\n @sound_file.destroy\n\n respond_to do |format|\n format.html { redirect_to sound_files_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @artist_medium.destroy\n respond_to do |format|\n format.html { redirect_to artist_mediums_url, notice: 'Artist was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @base_song.destroy\n respond_to do |format|\n format.html { redirect_to base_songs_url, notice: 'Base song was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audio_story.destroy\n respond_to do |format|\n format.html { redirect_to audio_stories_url, notice: 'Audio story was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @maudio.destroy\n respond_to do |format|\n format.html { redirect_to Maudios_url, notice: 'Maudio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lyric = Lyric.find(params[:id])\n @lyric.destroy\n\n respond_to do |format|\n format.html { redirect_to lyrics_url }\n format.json { head :no_content }\n end\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end"
] |
[
"0.729984",
"0.729984",
"0.729984",
"0.7267837",
"0.7264692",
"0.71721333",
"0.7161083",
"0.7139181",
"0.7012895",
"0.6947899",
"0.6940732",
"0.69337344",
"0.69337344",
"0.69007456",
"0.6861175",
"0.6856993",
"0.6849808",
"0.68394935",
"0.68394935",
"0.6828294",
"0.68102556",
"0.6799605",
"0.67860943",
"0.6764542",
"0.6764542",
"0.6764542",
"0.6764542",
"0.6764542",
"0.6764542",
"0.6760006",
"0.6752695",
"0.67491704",
"0.6748819",
"0.6745781",
"0.6736939",
"0.6723234",
"0.6723101",
"0.6722821",
"0.6719449",
"0.6719449",
"0.6719449",
"0.6719449",
"0.6719449",
"0.6719449",
"0.6719449",
"0.6718696",
"0.6713818",
"0.6713818",
"0.67107433",
"0.6710523",
"0.6700877",
"0.6698801",
"0.6698129",
"0.6698129",
"0.6685645",
"0.66823703",
"0.6679829",
"0.6669595",
"0.6664985",
"0.6664585",
"0.6653352",
"0.66514426",
"0.66404885",
"0.66244054",
"0.66205704",
"0.6613561",
"0.6606845",
"0.66063184",
"0.660143",
"0.6587164",
"0.6585608",
"0.6578053",
"0.6567669",
"0.65668374",
"0.65657616",
"0.6564693",
"0.6559419",
"0.6558143",
"0.6556954",
"0.65569264",
"0.65516526",
"0.65508413",
"0.6535366",
"0.6535366",
"0.65333706",
"0.652974",
"0.6524641",
"0.6514894",
"0.6513085",
"0.65125316",
"0.6511361",
"0.65087974",
"0.6507913",
"0.649485",
"0.6488501",
"0.6487764",
"0.6481922",
"0.6478171",
"0.647641",
"0.6473216"
] |
0.76910615
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_music_disc
id = params[:id].nil? ? params[:music_disc_id] : params[:id]
@music_disc = MusicDisc.find(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 music_disc_params
params.require(:music_disc).permit(:title, :discography, :group_name, { music_category_ids: []}, :image)
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
|
GET /points/1 GET /points/1.xml
|
def show
@point = Point.find(params[:id])
@user = User.find(:first, :joins => "inner join points on users.id = points.user_id", :conditions => [ "points.id = ?",params[:id]])
# respond_to do |format|
# format.html # show.html.erb
# format.xml { render :xml => @point }
# end
#タイムラインへリダイレクト
redirect_to_timelines
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @points = Point.all\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @points }\n end\n end",
"def show\n @point = Point.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def index\n @page_title = \"Data Points\"\n @data_points = DataPoint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @data_points }\n end\n end",
"def show\n @point = Point.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @point }\n format.kml # show.kml.erb\n end\n end",
"def show\n @page_title = \"Data Points\"\n @data_point = DataPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @data_point }\n end\n end",
"def show\n @route_point = RoutePoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route_point }\n end\n end",
"def show\n @graph_point = GraphPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @graph_point }\n format.json { render :json => @graph_point }\n end\n end",
"def show\n @point_type = PointType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @point_type }\n end\n end",
"def show\n @history_point = HistoryPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @history_point }\n end\n end",
"def show\n @waypoint = Waypoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @waypoint }\n end\n end",
"def show\n @point = Point.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @point }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def show\n @tourpoint = Tourpoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tourpoint }\n end\n end",
"def index\n @tourpoints = Tourpoint.paginate(:per_page => 10, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tourpoints }\n end\n end",
"def new\n @point = Point.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def show\n @old_point_tag = OldPointTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @old_point_tag }\n end\n end",
"def new\n @point = Point.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def show\n @checkpoint = Checkpoint.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @checkpoint }\n end\n end",
"def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end",
"def show\n @end_point = EndPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @end_point }\n format.xml { render xml: @end_point }\n end\n end",
"def show\n @point_of_interest = PointOfInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @point_of_interest }\n format.json { render :json => @point_of_interest.as_json_single() }\n end\n end",
"def index\n @user_points = UserPoint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @user_points }\n end\n end",
"def show\n @m_get_point = MGetPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @m_get_point }\n end\n end",
"def index\n @point_of_interest_comments = @point_of_interest.point_of_interest_comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @point_of_interest_comments }\n end\n end",
"def index\n @points = Point.all\n end",
"def index\n @points = Point.all\n end",
"def index\n @peeps = Peep.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @peeps }\n end\n end",
"def show\n @user_point = UserPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_point }\n end\n end",
"def show\n @approximate_service = ApproximateService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @approximate_service }\n end\n end",
"def show\n @p_stat = PStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @p_stat }\n end\n end",
"def show\n @peep = Peep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @peep }\n end\n end",
"def show\n @tracker = Tracker.find(params[:id])\n\n respond_to do |format|\n format.html # show.erb\n format.xml { render :xml => @tracker.to_xml }\n end\n end",
"def show\n @pneighbour = Pneighbour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end",
"def show\n @points_history = PointsHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @points_history }\n end\n end",
"def index\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.xml { render :xml => @maps }\n end\n end",
"def show\n @stop = Stop.where(:short_name => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stop.to_xml(\n :include => { \n :routes => {\n :only => [:name, :id] \n } \n }\n ) }\n format.kml\n end\n end",
"def show\n @node = Node.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.xml { render :xml => @node }\n format.kml { render :xml => @node }\n end\n end",
"def index\n authorize! :index, Por, :message => 'Acceso denegado.'\n @pors = @campus.pors.paginate(:per_page => 3, :page => params[:page])\n\t\t@points = @pors\n\t\t@point_name = \"por\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render \"points/index.json.erb\" } # index.json.erb\n end\n end",
"def show\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @spot }\n end\n end",
"def show\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @spot }\n end\n end",
"def index\n @location_points = LocationPoint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @location_points }\n end\n end",
"def show\n @points_spent = PointsSpent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @points_spent }\n end\n end",
"def index\n p params[:tour_id]\n if params[:tour_id].nil?\n @points = Point.all\n render json: @points, include: :tour, status: :ok\n else\n @points = Point.where(tour_id: params[:tour_id])\n render json: @points, status: :ok\n end\n end",
"def new\n @point = Point.new\n @users = User.all\n @user = User.find(params[:user_id])\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def show\n @data_point = DataPoint.find(params[:id])\n\n if @data_point\n render json: @data_point\n else\n render json: @data_point, status: 404\n end\n end",
"def new\n @graph_point = GraphPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @graph_point }\n end\n end",
"def show\n @cultural_heritage_culture = CulturalHeritage::Culture.find(params[:id])\n points = @cultural_heritage_culture.list_point\n\n if points.length > 0\n\n count = 0\n @json = \"[[\"\n points.each do |point|\n if (count == 0)\n @json = @json << '{\"lng\": ' << point.longitude.to_s << ', \"lat\": ' << point.latitude.to_s << \n ', \"strokeColor\": \"#FF0000\", \"strokeOpacity\": 0.3, \"strokeWeight\": 1, \"fillColor\": \"#FF0000\", \"fillOpacity\": 0.7}'\n else\n @json = @json << ', {\"lng\": ' << point.longitude.to_s << ', \"lat\": ' << point.latitude.to_s << '}'\n end\n count = count + 1\n end\n @json = @json << \"]]\"\n\n end \n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cultural_heritage_culture_point }\n end\n end",
"def new\n @point = Point.new({:layer => @layer})\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def show\n @path = Path.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @path }\n format.kml # show.kml.erb\n end\n end",
"def show\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tso.to_xml(:except => [ :created_at, :updated_at ]) }\n end\n end",
"def index\n @pos = Po.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pos }\n end\n end",
"def show\n @key_point = KeyPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @key_point }\n end\n end",
"def index\n @spots = Spot.find(:all) \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @spots }\n end\n end",
"def index\n @data_points = DataPoint.recent # cached_recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @data_points }\n end\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def show\n @design_detail_data_point = DesignDetailDataPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @design_detail_data_point }\n end\n end",
"def get_listings_xml(url)\n @client.get_content(url)\n end",
"def index\n if params[:x1]\n @places = Place.by_bounds( params[:x1], params[:y1], params[:x2], params[:y2], params )\n end\n #@places = Place.without_nodes\n respond_with(@places)\n end",
"def show\n @location_point = LocationPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_point }\n end\n end",
"def show\n @snap = Snap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @snap }\n end\n end",
"def new\n @route_point = RoutePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_point }\n end\n end",
"def index\n @allUsers = User.find(:all, :order => 'points DESC, last_request_at DESC')\n @users = @allUsers.paginate :per_page => 20, :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def show\n @point_consumption = PointConsumption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @point_consumption }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @measurement }\n end\n end",
"def new\n @page_title = \"Data Points\"\n @data_point = DataPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @data_point }\n end\n end",
"def show\n @xml_sample = XmlSample.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @xml_sample }\n end\n end",
"def index\n @presses = Press.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @presses }\n end\n end",
"def show\n @time_point = TimePoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_point }\n end\n end",
"def _api_call(method, args)\r\n uri = _uri(method, args)\r\n response = XmlSimple.xml_in(_http_get(uri))\r\n end",
"def show\n @st_pi = StPi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @st_pi }\n end\n end",
"def show\n\t\t@ptax = Ptax.find(params[:id])\n\t\trespond_to do |format|\t\t\n\t\t\tformat.html \n\t\t\tformat.xml { render :xml => @ptaxes }\t\t#Render to XML File\n\t\tend\n\tend",
"def show\n @tracker = Tracker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tracker }\n end\n end",
"def show\n @rip = Rip.find params[:id]\n respond_to do |format|\n format.html\n format.xml { render :xml => @rip.to_xml }\n end\n end",
"def index\n @points_spents = PointsSpent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @points_spents }\n end\n end",
"def new\n @waypoint = Waypoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @waypoint }\n end\n end",
"def index\n @degrees = Degree.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @degrees }\n end\n end",
"def index\n @exposures = Exposure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @exposures }\n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def show\n @touchpoint = Touchpoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @touchpoint }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @location }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calibration }\n end\n end",
"def show\n @pulve = Pulve.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pulve }\n end\n end",
"def index\n @xml_samples = XmlSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @xml_samples }\n format.xml { render xml: @xml_samples }\n end\n end",
"def timeline\n @bookings = Booking.find_waiting_pickup\n respond_to do |format|\n format.xml\n end\n end",
"def show\n @pto = Pto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pto }\n end\n end",
"def index\n @locations = Location.find(:all)\n\n respond_to do |format|\n format.html \n format.xml { render :xml => @locations }\n end\n end",
"def show\n @stat = Stat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def show\n @stat = Stat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def show\n @vertex = Vertex.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vertex }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @votes }\n end\n end",
"def show\n @pdig = Pdig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pdig }\n end\n end",
"def show\n @position = Position.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @position }\n end\n end",
"def show\n authorize! :show, PointsEntryType\n load_points_entry_type\n load_points_entries\n end",
"def index\n @viewpoints = Viewpoint.all\n end",
"def show\n @bill_point = BillPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bill_point }\n end\n end",
"def ping\n @status = Status.find(:first)\n respond_to do |format|\n format.html\n format.xml { render :xml => @status }\n end \n end",
"def show\n @checkpoint_removed = CheckpointRemoved.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @checkpoint_removed }\n end\n end",
"def show\n @entity_end_point_rel = EntityEndPointRel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entity_end_point_rel }\n end\n end",
"def show\n find_map\n respond_to do |format|\n format.html do\n redirect_to edit_map_path(@map)\n end\n format.any(:json, :xml) do\n respond_with @map, :include => :waypoints\n end\n end\n\n end",
"def index\n @st_pis = StPi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @st_pis }\n end\n end"
] |
[
"0.7296532",
"0.7027359",
"0.6543091",
"0.6534514",
"0.6531218",
"0.6466613",
"0.64239246",
"0.6422226",
"0.6357939",
"0.62904483",
"0.6287933",
"0.62184143",
"0.61791235",
"0.6151053",
"0.61253",
"0.6117815",
"0.60879695",
"0.60703325",
"0.60557103",
"0.6047401",
"0.60214186",
"0.5983197",
"0.5968626",
"0.59559095",
"0.59515846",
"0.59515846",
"0.59482914",
"0.5917374",
"0.5907239",
"0.5871951",
"0.5866874",
"0.5805215",
"0.57979476",
"0.57854974",
"0.57829976",
"0.57379144",
"0.5717572",
"0.5709329",
"0.57091326",
"0.570908",
"0.5706578",
"0.56910604",
"0.5689064",
"0.5686135",
"0.5685095",
"0.5680792",
"0.5680313",
"0.5667645",
"0.5665884",
"0.5660459",
"0.56594044",
"0.565769",
"0.5656398",
"0.565285",
"0.56440336",
"0.5643496",
"0.56423855",
"0.5635306",
"0.5634406",
"0.5632384",
"0.56234944",
"0.5622311",
"0.5608457",
"0.5602646",
"0.56019175",
"0.56008947",
"0.559886",
"0.5598432",
"0.55954623",
"0.5590636",
"0.5585945",
"0.5585488",
"0.5584805",
"0.558214",
"0.5580749",
"0.5576484",
"0.5567066",
"0.55669266",
"0.55669266",
"0.556578",
"0.5564783",
"0.5560594",
"0.55584335",
"0.5551365",
"0.5550199",
"0.5548596",
"0.5543557",
"0.5542066",
"0.5542066",
"0.5533075",
"0.5528418",
"0.55234057",
"0.5518497",
"0.5515459",
"0.5511223",
"0.5509776",
"0.55092293",
"0.55087817",
"0.5499835",
"0.5493945",
"0.54937106"
] |
0.0
|
-1
|
GET /points/new GET /points/new.xml
|
def new
@point = Point.new
@users = User.all
@user = User.find(params[:user_id])
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @point }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @point = Point.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def new\n @point = Point.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def new\n @old_point_tag = OldPointTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_point_tag }\n end\n end",
"def new\n @point = Point.new({:layer => @layer})\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def new\n @point_type = PointType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point_type }\n end\n end",
"def new\n @graph_point = GraphPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @graph_point }\n end\n end",
"def new\n @point = Point.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @point }\n end\n end",
"def new\n @route_point = RoutePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_point }\n end\n end",
"def new\n @waypoint = Waypoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @waypoint }\n end\n end",
"def new\n @history_point = HistoryPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @history_point }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @checkpoint = Checkpoint.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @checkpoint }\n end\n end",
"def new\n @tourpoint = Tourpoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tourpoint }\n end\n end",
"def new\n @page_title = \"Data Points\"\n @data_point = DataPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @data_point }\n end\n end",
"def new\n @m_get_point = MGetPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @m_get_point }\n end\n end",
"def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position }\n end\n end",
"def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end",
"def new\n @position = Position.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position }\n end\n end",
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to(@point, :notice => 'Point added') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @collection_point = CollectionPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection_point }\n end\n end",
"def new\n @checkpoint_removed = CheckpointRemoved.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @checkpoint_removed }\n end\n end",
"def new\n @points_history = PointsHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @points_history }\n end\n end",
"def new\n @p_stat = PStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @p_stat }\n end\n end",
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to(@point, :notice => 'Point was successfully created.') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @event = Event.find(params[:event_id])\n @point_of_interest = PointOfInterest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point_of_interest }\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @point_of_interest_comment = PointOfInterestComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point_of_interest_comment }\n end\n end",
"def new\n @peep = Peep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @peep }\n end\n end",
"def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @location }\n end\n end",
"def new\n @location_point = LocationPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_point }\n end\n end",
"def new\n @snap = Snap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @snap }\n end\n end",
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save_with_history!\n format.html { redirect_to(@point, :notice => 'Point was successfully created.') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @user_point = UserPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @user_point }\n end\n end",
"def new\n @st_pi = StPi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @st_pi }\n end\n end",
"def new\n @touchpoint = Touchpoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @touchpoint }\n end\n end",
"def new\n @pdig = Pdig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pdig }\n end\n end",
"def new\n @tracker = Tracker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tracker }\n end\n end",
"def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end",
"def new\n @path = Path.new({:layer => @layer})\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @path }\n end\n end",
"def new\n @time_point = TimePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_point }\n end\n end",
"def new\n @spent_point = SpentPoint.new\n @users = User.all\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spent_point }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @pool = Pool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pool }\n end\n end",
"def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def new\n @location = Location.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new\n @vertex = Vertex.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vertex }\n end\n end",
"def new\n @pulve = Pulve.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pulve }\n end\n end",
"def new\n @key_point = KeyPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @key_point }\n end\n end",
"def new\n @xpto = Xpto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @xpto }\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 @prime = Prime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prime }\n end\n end",
"def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end",
"def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end",
"def new\n @position_member = PositionMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position_member }\n end\n end",
"def new\n @feat = @person.feats.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feat }\n end\n end",
"def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poll }\n end\n end",
"def new\n @travel = Travel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel }\n end\n end",
"def new\n @travel = Travel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @po }\n end\n end",
"def new\n @tuple = Tuple.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tuple }\n end\n end",
"def new\n @positioncoefficient = Positioncoefficient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @positioncoefficient }\n end\n end",
"def new\n @origin = Origin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @origin }\n end\n end",
"def new\n @data_point = DataPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_point }\n end\n end",
"def new\n @data_point = DataPoint.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_point }\n end\n end",
"def new\n @post326 = Post326.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post326 }\n end\n end",
"def new\n @goal = Mg::Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goal }\n end\n end",
"def new\n @ship = Ship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ship }\n end\n end",
"def new\n @xml_sample = XmlSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @xml_sample }\n end\n end",
"def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position }\n end\n end",
"def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position }\n end\n end",
"def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position }\n end\n end",
"def new\n @pointcode = Pointcode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pointcode }\n end\n end",
"def new\n @location = Location.new\n @pages = {}\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def new\n @way = Way.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @way }\n end\n end",
"def new\n @press = Press.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @press }\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end",
"def new\n @stage = Stage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stage }\n end\n end",
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to([@layer, @point], :notice => 'Point was successfully created.') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @precio = Precio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @precio }\n end\n end",
"def new\n @spit = Spit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spit }\n end\n end",
"def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trial }\n end\n end",
"def new\n @newz = Newz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newz }\n end\n end",
"def new\n @approximate_service = ApproximateService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @approximate_service }\n end\n end",
"def new\n @bill_point = BillPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bill_point }\n end\n end",
"def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end",
"def new\n @resolved = Resolved.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resolved }\n end\n end",
"def new\n @ponto = Ponto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end",
"def new\n @pr = Pr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pr }\n end\n end",
"def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end"
] |
[
"0.7735251",
"0.7720217",
"0.73190683",
"0.72539216",
"0.71986854",
"0.71568376",
"0.7152423",
"0.71219134",
"0.70359784",
"0.70289856",
"0.6915471",
"0.69087225",
"0.6861539",
"0.68416256",
"0.6807912",
"0.6762097",
"0.67339164",
"0.66980016",
"0.66798794",
"0.6666676",
"0.66599673",
"0.66577363",
"0.6599935",
"0.6588264",
"0.6586417",
"0.6578186",
"0.6548821",
"0.6539714",
"0.65328157",
"0.6532107",
"0.65082204",
"0.6494515",
"0.6491219",
"0.64748746",
"0.645419",
"0.6453495",
"0.6444493",
"0.6438725",
"0.6422889",
"0.64221746",
"0.6415647",
"0.64114624",
"0.64114624",
"0.6411383",
"0.6401654",
"0.64013547",
"0.64013547",
"0.64013547",
"0.64013547",
"0.64013547",
"0.64013547",
"0.6397498",
"0.63959783",
"0.63959783",
"0.63892025",
"0.63876736",
"0.63814205",
"0.63808453",
"0.6372769",
"0.6372769",
"0.6357798",
"0.63521904",
"0.6336725",
"0.63263005",
"0.6321197",
"0.63210326",
"0.6316189",
"0.6316189",
"0.63141817",
"0.6314038",
"0.63113916",
"0.63045573",
"0.63022125",
"0.629854",
"0.62983376",
"0.62970644",
"0.62954974",
"0.6294493",
"0.629234",
"0.629234",
"0.629234",
"0.6280047",
"0.6278968",
"0.6278266",
"0.6277951",
"0.62760544",
"0.6272454",
"0.62672186",
"0.6265037",
"0.625649",
"0.6241418",
"0.6238091",
"0.62329847",
"0.62329394",
"0.62315565",
"0.6229254",
"0.6229191",
"0.62281585",
"0.6227712",
"0.6225853"
] |
0.6863745
|
12
|
POST /points POST /points.xml
|
def create
@point = Point.new(params[:point])
respond_to do |format|
if @point.save
format.html { redirect_to(@point, :notice => 'Point was successfully created.') }
format.xml { render :xml => @point, :status => :created, :location => @point }
else
format.html { render :action => "new" }
format.xml { render :xml => @point.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to(@point, :notice => 'Point added') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @spent_point = SpentPoint.new(params[:spent_point])\n\n respond_to do |format|\n if @spent_point.save\n format.html { redirect_to(@spent_point, :notice => 'SpentPoint was successfully created.') }\n format.xml { render :xml => @spent_point, :status => :created, :location => @spent_point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @spent_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to([@layer, @point], :notice => 'Point was successfully created.') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @point = Point.new(point_params)\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to @point, notice: 'Point was successfully created.' }\n format.json { render :show, status: :created, location: @point }\n else\n format.html { render :new }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to @point, notice: 'Point was successfully created.' }\n format.json { render json: @point, status: :created, location: @point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @points_transaction = PointsTransaction.new(points_transaction_params)\n\n respond_to do |format|\n if @points_transaction.save\n format.html { redirect_to @points_transaction, notice: 'Points transaction was successfully created.' }\n format.json { render :show, status: :created, location: @points_transaction }\n else\n format.html { render :new }\n format.json { render json: @points_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @route_point = RoutePoint.new(params[:route_point])\n\n respond_to do |format|\n if @route_point.save\n format.html { redirect_to(@route_point, :notice => 'Route point was successfully created.') }\n format.xml { render :xml => @route_point, :status => :created, :location => @route_point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @route_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user_point = UserPoint.new(params[:user_point])\n\n respond_to do |format|\n if @user_point.save\n format.html { redirect_to @user_point, :notice => 'User point was successfully created.' }\n format.json { render :json => @user_point, :status => :created, :location => @user_point }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save_with_history!\n format.html { redirect_to(@point, :notice => 'Point was successfully created.') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @page_title = \"Data Points\"\n @data_point = DataPoint.new(params[:data_point])\n\n respond_to do |format|\n if @data_point.save\n flash[:notice] = 'DataPoint was successfully created.'\n format.html { redirect_to(@data_point) }\n format.xml { render :xml => @data_point, :status => :created, :location => @data_point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @data_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def create\n @touchpoint = Touchpoint.new(params[:touchpoint])\n\n respond_to do |format|\n if @touchpoint.save\n format.html { redirect_to @touchpoint, notice: 'Touchpoint was successfully created.' }\n format.json { render json: @touchpoint, status: :created, location: @touchpoint }\n else\n format.html { render action: \"new\" }\n format.json { render json: @touchpoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def create\n @graph_point = GraphPoint.new(params[:graph_point])\n\n respond_to do |format|\n if @graph_point.save\n format.html { redirect_to(@graph_point, :notice => 'Graph point was successfully created.') }\n format.xml { render :xml => @graph_point, :status => :created, :location => @graph_point }\n format.json { render :json => @graph_point, :status => :created, :location => @graph_point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @graph_point.errors, :status => :unprocessable_entity }\n format.json { render :json => @graph_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tourpoint = Tourpoint.new(params[:tourpoint])\n\n respond_to do |format|\n if @tourpoint.save\n flash[:notice] = 'Tourpoint was successfully created.'\n format.html { redirect_to(@tourpoint) }\n format.xml { render :xml => @tourpoint, :status => :created, :location => @tourpoint }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tourpoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @points = Point.all\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @points }\n end\n end",
"def create\n @debate = Debate.new\n @debate.title = params[:title]\n @debate.image = params[:image]\n @debate.content = params[:content]\n @debate.user_id = current_user.id\n\n respond_to do |format|\n if @debate.save\n if params[:points]\n params[:points].each do |p|\n Point.create(user_id: current_user.id, debate_id: @debate.id, title: p)\n end\n end\n format.html { redirect_to @debate, notice: 'Debate was successfully created.' }\n format.json { render :show, status: :created, location: @debate }\n else\n format.html { render :new }\n format.json { render json: @debate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @point_of_sale = PointOfSale.new(point_of_sale_params)\n\n respond_to do |format|\n if @point_of_sale.save\n format.json { render :show, status: :created, location: @point_of_sale }\n else\n format.json { render json: @point_of_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def schedule_point\n validate(\n point: :security_json\n )\n\n custom_experiment = (@experiment.type == 'manual_points')\n raise ValidationError.\n new(:id, @experiment.id, 'Not a custom-points experiment') unless custom_experiment\n\n point_index = @experiment.add_point!(Utils::parse_json_if_string(params[:point]))\n\n respond_to do |format|\n format.json { render json: {status: 'ok', index: point_index}, status: :ok }\n end\n end",
"def create\n @waypoint = Waypoint.new(params[:waypoint])\n\n respond_to do |format|\n if @waypoint.save\n flash[:notice] = 'Waypoint was successfully created.'\n format.html { redirect_to(@waypoint) }\n format.xml { render :xml => @waypoint, :status => :created, :location => @waypoint }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @waypoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @point_type = PointType.new(params[:point_type])\n\n respond_to do |format|\n if @point_type.save\n format.html { redirect_to(admin_point_types_path, :notice => 'Point type was successfully created.') }\n format.xml { render :xml => @point_type, :status => :created, :location => @point_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @point_submission = PointSubmission.new(point_submission_params)\n\n respond_to do |format|\n if @point_submission.save\n format.html { redirect_to @point_submission, notice: 'Point submission was successfully created.' }\n format.json { render :show, status: :created, location: @point_submission }\n else\n format.html { render :new }\n format.json { render json: @point_submission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location_point = LocationPoint.new(params[:location_point])\n\n respond_to do |format|\n if @location_point.save\n format.html { redirect_to @location_point, notice: 'Location point was successfully created.' }\n format.json { render json: @location_point, status: :created, location: @location_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def create\n @point = Point.new(point_params)\n @point.goal_id = @goal.id\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to :goals, notice: 'Your progress has been updated!' }\n @goal.current_quantity += @point.quantity\n @goal.save!\n format.json { render action: 'show', status: :created, location: @point }\n else\n format.html { redirect_to goals_path, alert: 'Your progress could not be updated because your quantity was not a valid number. \n Please try again.' }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_point = TimePoint.new(params[:time_point])\n\n respond_to do |format|\n if @time_point.save\n format.html { redirect_to @time_point, notice: 'Time point was successfully created.' }\n format.json { render json: @time_point, status: :created, location: @time_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @point = Point.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def new\n @point = Point.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def create\n @key_point = KeyPoint.new(params[:key_point])\n\n respond_to do |format|\n if @key_point.save\n format.html { redirect_to :back, notice: 'Key point was successfully created.' }\n format.json { render json: @key_point, status: :created, location: @key_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @key_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @point_type = PointType.new(point_type_params)\n\n respond_to do |format|\n if @point_type.save\n format.html { redirect_to @point_type, notice: 'Point type was successfully created.' }\n format.json { render :show, status: :created, location: @point_type }\n else\n format.html { render :new }\n format.json { render json: @point_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @m_get_point = MGetPoint.new(params[:m_get_point])\n\n respond_to do |format|\n if @m_get_point.save\n format.html { redirect_to :controller => \"m_get_points\", :action => \"index\" }\n #format.html { redirect_to @m_get_point, notice: 'M get point was successfully created.' }\n format.json { render json: @m_get_point, status: :created, location: @m_get_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @m_get_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n points = params[:solution][:points_earned]\n unless current_user.posse.current_solution?\n solution = current_user.posse.solutions.create(solution_params)\n current_user.posse.add_points(points.to_i)\n end\n render json: solution\n end",
"def create\n @bill_point = BillPoint.new(params[:bill_point])\n\n respond_to do |format|\n if @bill_point.save\n format.html { redirect_to @bill_point, notice: 'Bill point was successfully created.' }\n format.json { render json: @bill_point, status: :created, location: @bill_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bill_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def POST; end",
"def create\n @end_point = EndPoint.new(params[:end_point])\n\n respond_to do |format|\n if @end_point.save\n format.html { redirect_to @end_point, notice: 'End point was successfully created.' }\n format.json { render json: @end_point, status: :created, location: @end_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @end_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end",
"def create\n @squat_data_point = SquatDataPoint.new(params[:squat_data_point])\n\n respond_to do |format|\n if @squat_data_point.save\n format.html { redirect_to @squat_data_point, notice: 'Squat data point was successfully created.' }\n format.json { render json: @squat_data_point, status: :created, location: @squat_data_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @squat_data_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n @post.user_id=params[:post][:user_id]\n @post.save\n \n\n \n @point = ['0', '0', '0', '0', '0']\n \n for i in 0..4\n @point[i] = Point.new\n end\n \n \n for i in 0..4\n @latitude = \"latitude\" + i.to_s\n @longitude = \"longitude\" + i.to_s\n @point_title = \"point_title\" + i.to_s\n @content = \"content\" + i.to_s\n @cardimg = \"cardimg\" + i.to_s\n \n if(@longitude)\n \n @point[i].latitude = params[:post][@latitude]\n @point[i].longitude = params[:post][@longitude]\n @point[i].point_title = params[:post][@point_title]\n @point[i].content = params[:post][@content]\n @point[i].cardimg = params[:post][@cardimg]\n @point[i].post_id = @post.id\n @point[i].save\n \n else\n \n end\n \n end\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n \n \n end\n end\n end",
"def create\n @studio_point = StudioPoint.new(studio_point_params)\n\n respond_to do |format|\n if @studio_point.save\n format.html { redirect_to @studio_point, notice: 'Studio point was successfully created.' }\n format.json { render :show, status: :created, location: @studio_point }\n else\n format.html { render :new }\n format.json { render json: @studio_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @point_consumption = PointConsumption.new(params[:point_consumption])\n\n respond_to do |format|\n if @point_consumption.save\n format.html { redirect_to @point_consumption, :notice => 'Point consumption was successfully created.' }\n format.json { render :json => @point_consumption, :status => :created, :location => @point_consumption }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @point_consumption.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:data_point].nil?\n DataPoint.createFromMailgun(params)\n # always return 200\n render :text => \"\"\n else\n @user = current_user\n if params[:data_point][:id]\n @data_point = DataPoint.duplicate(params[:data_point][:id],params[:data_point][:uploaded_at] )\n else\n @data_point = DataPoint.new(params[:data_point])\n @data_point.user_id = @user.id\n @data_point.uploaded_at = @user.now()\n @data_point.noObserver = true\n puts \">>>>>>>>>>>>> created photo from form\"\n end\n\n if @data_point && @data_point.save\n puts \"data point after saved: #{@data_point.inspect}\"\n # publish to facebook\n if @user.canPublishOnFacebook?\n @user.fb_publish(@data_point)\n end\n\n # set content type even if it's json because f... IE doesn't recognized json and prompt\n # download window when returning json\n render :json => @data_point, :content_type => 'text/plain'\n else\n puts \"data point not saved, errors: #{@data_point.errors.inspect}\"\n render :json => @data_point.errors\n end\n end\n end",
"def points_transaction_params\n params.require(:points_transaction).permit(:user_id, :transaction_type, :number_of_points, :value_of_points, :notes, :approval_required, :approval_received, :admin_id)\n end",
"def create\n @base_point = BasePoint.new(base_point_params)\n if @base_point.save\n flash[:success] = \"拠点登録完了しました\"\n else\n flash[:danger] = \"拠点登録に失敗しました\"\n end\n redirect_to base_points_path\n end",
"def create\n @deadlift_data_point = DeadliftDataPoint.new(params[:deadlift_data_point])\n\n respond_to do |format|\n if @deadlift_data_point.save\n format.html { redirect_to @deadlift_data_point, notice: 'Deadlift data point was successfully created.' }\n format.json { render json: @deadlift_data_point, status: :created, location: @deadlift_data_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @deadlift_data_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member_point = MemberPoint.new(member_point_params)\n @member_id = params[:member_id]\n @member = Member.find(@member_id)\n @event_id = params[:event_id]\n @event = Event.find(@event_id)\n @activity = Activity.find(@event.activity_id)\n @new_points = @member.totalPoints + @activity.num_points\n\n respond_to do |format|\n if @member_point.save\n Member.update(@member_id, totalPoints: @new_points)\n format.html { redirect_to @event, notice: 'You have checked into this event.' }\n format.json { render :show, status: :created, location: @member_point }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @member_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def point_params\n params.require(:point).permit(:quantity, :comments)\n end",
"def create\n @levels_point = LevelsPoint.new(levels_point_params)\n\n respond_to do |format|\n if @levels_point.save\n format.html { redirect_to @levels_point, notice: 'Levels point was successfully created.' }\n format.json { render :show, status: :created, location: @levels_point }\n else\n format.html { render :new }\n format.json { render json: @levels_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_elevations(points)\n points_elev = points.select { |p| p.key? :elevation }\n\n return ElevResultAlreadyValid.new(points) \\\n if points_elev.length == points.length\n\n return ElevResultInvalid.new('Only some points with elevation') \\\n unless points_elev.empty?\n\n points_json = []\n\n points.each do |p|\n points_json += [{ longitude: p[:longitude], latitude: p[:latitude] }]\n end\n\n params = { content_type: :json, accept: :json }\n contents = JSON.generate points_json\n response = RestClient.post(URL, contents, params)\n\n elevations = JSON.parse(response.body,\n {\n allow_nan: false,\n symbolize_names: true\n })\n\n return ElevResultInvalid.new('Invalid response from elevations server') \\\n unless elevations.is_a? Array\n\n return ElevResultInvalid.new('Invalid number of elevations from server') \\\n unless elevations.length == points.length\n\n points.each_index do |idx|\n return ElevResultInvalid.new('Elevation must be an integer') \\\n unless elevations[idx].is_a? Integer\n\n points[idx][:elevation] = elevations[idx]\n end\n\n ElevResultValid.new(points)\nend",
"def create\n Member.all.each { |member|\n member.assign_points\n }\n\n flash[:notice] = 'Puntos asignados correctamente'\n redirect_to matches_path\n end",
"def create\n @ecopoint = Ecopoint.new(ecopoint_params)\n\n respond_to do |format|\n if @ecopoint.save\n format.html { redirect_to @ecopoint, notice: 'Ecopoint was successfully created.' }\n format.json { render :show, status: :created, location: @ecopoint }\n else\n format.html { render :new }\n format.json { render json: @ecopoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n ap = activity_params\n if !ap[:points].nil?\n doc = Nokogiri::XML(ap[:points].read)\n parse_gpx(doc,ap)\n end\n @activity = Activity.new(ap)\n @activity.owner_id = current_user.id\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if @point_of_contact.save\n render json: @point_of_contact, status: :created, location: @point_of_contact\n else\n render json: @point_of_contact.errors, status: :unprocessable_entity\n end\n end",
"def create\n @history_point = HistoryPoint.new(params[:history_point])\n\n respond_to do |format|\n if @history_point.save\n format.html { redirect_to(@history_point, :notice => 'HistoryPoint was successfully created.') }\n format.xml { render :xml => @history_point, :status => :created, :location => @history_point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @history_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @trace = Trace.new\n if @trace.save\n @trace.import_points(points_data)\n status = :created\n else\n status = :bad_request\n end\n\n render json: @trace, status: status\n end",
"def create\n @plot_point = PlotPoint.new(plot_point_params)\n\n respond_to do |format|\n if @plot_point.save\n format.html { redirect_to @plot_point, notice: 'Plot point was successfully created.' }\n format.json { render :show, status: :created, location: @plot_point }\n else\n format.html { render :new }\n format.json { render json: @plot_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @collection_point = CollectionPoint.new(params[:collection_point])\n\n respond_to do |format|\n if @collection_point.save\n @collection_point.delay.create_collection_point_tag_on_contacts\n format.html { redirect_to @collection_point, notice: 'Collection point was successfully created.' }\n format.json { render json: @collection_point, status: :created, location: @collection_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @xpto = Xpto.new(params[:xpto])\n\n respond_to do |format|\n if @xpto.save\n format.html { redirect_to @xpto, notice: 'Xpto was successfully created.' }\n format.json { render json: @xpto, status: :created, location: @xpto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @xpto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n resource.post(request, response)\n end",
"def create\n @post = Post.new(post_params)\n @post.user_id = current_user.id\n \n respond_to do |format|\n if @post.save\n current_user.update(point: current_user.point + 1)\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n \n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def _send_point(body)\n body.each_slice(100) do |p|\n conn.post('/?f=wavefront', p.join(\"\\n\"), 'application/octet-stream')\n end\n end",
"def create\n @data_point = DataPoint.new data_point_params\n @data_point[:_type] = data_point_params[:type]\n\n if @data_point.save\n render json: @data_point, status: :created, location: @data_point\n else\n render json: @data_point.errors, status: :unprocessable_entity\n end\n end",
"def point_params\n params.require(:point).permit(:temperature, :pm25, :light, :analog, :digital, :group)\n end",
"def create\n @event = Event.find(params[:event_id])\n @point_of_interest = @event.point_of_interests.new(params[:point_of_interest])\n\n respond_to do |format|\n if @point_of_interest.save\n format.html { redirect_to(@event, :notice => 'Point of interest was successfully created.') }\n format.xml { render :xml => @event, :status => :created, :location => @event_point_of_interest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point_of_interest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_nodes_with_root\n serialize_service.post_nodes_serialized\n end",
"def member_point_params\n params.permit(:date, :points, :event_id, :member_id, :activity_id)\n end",
"def create\n @shop_point = ShopPoint.new(shop_point_params)\n\n respond_to do |format|\n if @shop_point.save\n format.html { redirect_to @shop_point, notice: 'Shop point was successfully created.' }\n format.json { render :show, status: :created, location: @shop_point }\n else\n format.html { render :new }\n format.json { render json: @shop_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def point_params\n params.require(:point).permit(:content, :block_id)\n end",
"def create\n @weight_point = WeightPoint.new(weight: params[:weight_point][:weight], date: Date.strptime(params[:weight_point][:date], \"%m/%d/%Y\"))\n @weight_point.user_id = current_user.id\n\n respond_to do |format|\n if @weight_point.save\n flash[:success] = 'Weight point was successfully created.' \n format.html { redirect_to action:\"index\" }\n format.json { render action: 'show', status: :created, location: @weight_point }\n else\n format.html { render action: 'new' }\n format.json { render json: @weight_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, options={})\n request :post, path, options\n end",
"def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params.to_xml, signature_params)\n end",
"def create\n @access_point = AccessPoint.new(params[:access_point])\n\n respond_to do |format|\n if @access_point.save\n format.html { redirect_to @access_point, notice: 'Access point was successfully created.' }\n format.json { render json: @access_point, status: :created, location: @access_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @access_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @padiddle_point = PadiddlePoint.new(padiddle_point_params)\n @padiddles = 0.10\n\n respond_to do |format|\n if @padiddle_point.save\n format.html { redirect_to root_path, notice: 'Padiddle point was successfully created.' }\n format.json { render :show, status: :created, location: @padiddle_point }\n else\n format.html { render :new }\n format.json { render json: @padiddle_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @old_point_tag = OldPointTag.new(params[:old_point_tag])\n\n respond_to do |format|\n if @old_point_tag.save\n format.html { redirect_to(@old_point_tag, :notice => 'Old point tag was successfully created.') }\n format.xml { render :xml => @old_point_tag, :status => :created, :location => @old_point_tag }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @old_point_tag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @point_type = PointType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point_type }\n end\n end",
"def post(endpoint)\n respond_with(\n connection(endpoint).post(prepare(endpoint.uri), custom_dump(endpoint.req_params)),\n endpoint\n )\n end",
"def create\n params[:water_point][:user_id] = @current_user.id\n\n # If GPS coords found, save as confirmed and skip confirmation page?\n if params[:photo_file] && !params[:photo_file].blank?\n @photo = Photo.new(:uploaded_data => params[:photo_file])\n @coords = @photo.getGPS\n # If photo GPS coords found, use those.\n if @coords && @coords[0] && @coords[1]\n params[:water_point][:lat] = @coords[0]\n params[:water_point][:lng] = @coords[1]\n end\n @water_point = WaterPoint.new(params[:water_point])\n @service = WaterPointService.new(@water_point, @photo)\n save_attempt = @service.save\n else\n @water_point = WaterPoint.new(params[:water_point])\n save_attempt = @water_point.save\n end\n\n respond_to do |format|\n if save_attempt\n if params[:notify]\n @water_point.reload\n @follower = Follower.new({:user_id => @water_point.posted_by.id,\n :water_point_id => @water_point.id})\n @follower.save\n end\n flash[:prompt] = t('flash.prompt.wp') #'WaterPoint loaded. Please confirm location to publish.'\n #format.html { redirect_to(@water_point) }\n format.any(:html,:iphone) { redirect_to(:action=>:edit,:id=>@water_point.id) }\n format.xml { render :xml => @water_point, :status => :created, :location => @water_point }\n else\n format.any(:html,:iphone) { render :action => \"new\" }\n format.xml { render :xml => @water_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\r\n @way_point = WayPoint.new(way_point_params)\r\n respond_to do |format|\r\n if @way_point.save\r\n format.html { redirect_to my_maps_path, notice: 'Way point was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: @way_point }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @way_point.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def post\n Rentlinx.client.post(self)\n end",
"def post_request(path, params={}, options={})\n request(:post, path, params, options)\n end",
"def post(url, post_vars={})\n send_request url, post_vars, 'POST'\n end",
"def after_create post\n \n # update points\n PointManager::add_points post.user, 'ppx' \n\n # update buyer address info\n update_contact_info post\n \n UserMailer.send_pixipost_request(post).deliver_later if post.status == 'active'\n UserMailer.send_pixipost_request_internal(post).deliver_later if post.status == 'active'\n end",
"def post(path, options={})\n send_request 'post', path, options\n end",
"def post(action, params={}, options={})\n request(:post, action, params, options)\n end",
"def create\n @outcome_timepoint = OutcomeTimepoint.new(params[:outcome_timepoint])\n\n respond_to do |format|\n if @outcome_timepoint.save\n format.html { redirect_to(@outcome_timepoint, :notice => 'Outcome timepoint was successfully created.') }\n format.xml { render :xml => @outcome_timepoint, :status => :created, :location => @outcome_timepoint }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @outcome_timepoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @route_point = RoutePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_point }\n end\n end",
"def create\n @geopoint = Geopoint.new(params[:geopoint])\n\n respond_to do |format|\n if @geopoint.save\n format.html { redirect_to @geopoint, notice: 'Geopoint was successfully created.' }\n format.json { render json: @geopoint, status: :created, location: @geopoint }\n else\n format.html { render action: \"new\" }\n format.json { render json: @geopoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n request :post, *args\n end",
"def post(uri, params = {})\n send_request(uri, :post, params)\n end",
"def new\n @point = Point.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @point }\n end\n end",
"def create\n @treatment_point_prescription = Treatment::PointPrescription.new(treatment_point_prescription_params)\n\n respond_to do |format|\n if @treatment_point_prescription.save\n format.html { redirect_to @treatment_point_prescription, notice: 'Point prescription was successfully created.' }\n format.json { render action: 'show', status: :created, location: @treatment_point_prescription }\n else\n format.html { render action: 'new' }\n format.json { render json: @treatment_point_prescription.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end",
"def post(*args)\n request(:post, *args)\n end",
"def point_submission_params\n params.require(:point_submission).permit(:proof_url, :scoring_statistic_id, :points, :player_id, :comment, :status, :scoring_statistic_override)\n end",
"def points_transaction_params\n params.require(:points_transaction).permit()\n end",
"def new\n @point = Point.new({:layer => @layer})\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end",
"def create\n @user_smart_point = UserSmartPoint.new(user_smart_point_params)\n\n respond_to do |format|\n if @user_smart_point.save\n format.html { redirect_to @user_smart_point, notice: 'User smart point was successfully created.' }\n format.json { render :show, status: :created, location: @user_smart_point }\n else\n format.html { render :new }\n format.json { render json: @user_smart_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, options = {})\n request(:post, path, options)\n end",
"def post(path, options = {})\n request(:post, path, options)\n end",
"def post(path, options = {})\n request(:post, path, options)\n end"
] |
[
"0.65661246",
"0.63137096",
"0.6232738",
"0.62048274",
"0.6202215",
"0.6144506",
"0.60958636",
"0.60784113",
"0.5952932",
"0.5941154",
"0.5929124",
"0.5846992",
"0.58336085",
"0.58318824",
"0.58300966",
"0.57990026",
"0.5783145",
"0.57431936",
"0.5743137",
"0.5733619",
"0.5728738",
"0.5715082",
"0.5700815",
"0.5673135",
"0.5672703",
"0.5651462",
"0.56320006",
"0.5629979",
"0.5626664",
"0.56247663",
"0.56076497",
"0.5606129",
"0.55770105",
"0.55746096",
"0.55521095",
"0.5550886",
"0.55400527",
"0.55316865",
"0.55237395",
"0.55127233",
"0.5507424",
"0.55038375",
"0.54991424",
"0.54925686",
"0.54812753",
"0.54745066",
"0.5470284",
"0.5468901",
"0.54619646",
"0.5454289",
"0.54373217",
"0.54363537",
"0.543467",
"0.54345447",
"0.5424651",
"0.5406588",
"0.5398646",
"0.53951144",
"0.5382631",
"0.5379721",
"0.53791726",
"0.53713405",
"0.5366458",
"0.5365619",
"0.53636533",
"0.5352797",
"0.5350412",
"0.5345681",
"0.53447396",
"0.53434557",
"0.53415364",
"0.5334449",
"0.5330817",
"0.5317503",
"0.5306337",
"0.53005344",
"0.52984416",
"0.5297565",
"0.529402",
"0.5280787",
"0.52793735",
"0.5265456",
"0.5262937",
"0.5253185",
"0.52493715",
"0.52478266",
"0.52474517",
"0.52473986",
"0.5244982",
"0.52447844",
"0.52422065",
"0.52321076",
"0.52240676",
"0.52047193",
"0.5200698",
"0.51943177",
"0.5194051",
"0.51913005",
"0.51913005",
"0.51913005"
] |
0.65305614
|
1
|
PUT /points/1 PUT /points/1.xml
|
def update
# @point = params[:point]
# @date = date[:date]
# render :text => 'hoge'
@point = Point.find(params[:id])
respond_to do |format|
if @point.update_attributes(params[:point])
format.html { redirect_to(@point, :notice => 'Point was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @point.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @point = Point.find(params[:id])\n \n respond_to do |format|\n if @point.update_attributes(params[:point])\n format.html { redirect_to(@point, :notice => 'Point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @point = Point.find(params[:id])\n\n respond_to do |format|\n if @point.update_attributes(params[:point])\n format.html { redirect_to(@point, :notice => 'Point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n @point = Point.find(params[:id])\n\n respond_to do |format|\n if @point.update_attributes(params[:point])\n format.html { redirect_to([@layer, @point], :notice => 'Point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @point = Point.find(params[:id])\n\n respond_to do |format|\n if @point.update_attributes(params[:point])\n format.html { redirect_to @point, notice: 'Point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @route_point = RoutePoint.find(params[:id])\n\n respond_to do |format|\n if @route_point.update_attributes(params[:route_point])\n format.html { redirect_to(@route_point, :notice => 'Route point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @spent_point = SpentPoint.find(params[:id])\n\n respond_to do |format|\n if @spent_point.update_attributes(params[:spent_point])\n format.html { redirect_to(@spent_point, :notice => 'SpentPoint was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spent_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @point.update(point_params)\n format.html { redirect_to @point, notice: 'Point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @point.update(point_params)\n format.html { redirect_to @point, notice: 'Point was successfully updated.' }\n format.json { render :show, status: :ok, location: @point }\n else\n format.html { render :edit }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n ap = activity_params\n if !ap[:points].nil?\n doc = Nokogiri::XML(ap[:points].read)\n parse_gpx(doc,ap)\n end\n\n respond_to do |format|\n if @activity.update(ap)\n @activity.save\n\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update\n @page_title = \"Data Points\"\n @data_point = DataPoint.find(params[:id])\n\n respond_to do |format|\n if @data_point.update_attributes(params[:data_point])\n flash[:notice] = 'DataPoint was successfully updated.'\n format.html { redirect_to(@data_point) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @data_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @graph_point = GraphPoint.find(params[:id])\n\n respond_to do |format|\n if @graph_point.update_attributes(params[:graph_point])\n format.html { redirect_to(@graph_point, :notice => 'Graph point was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => @graph_point }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @graph_point.errors, :status => :unprocessable_entity }\n format.json { render :json => @graph_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tourpoint = Tourpoint.find(params[:id])\n\n respond_to do |format|\n if @tourpoint.update_attributes(params[:tourpoint])\n flash[:notice] = 'Tourpoint was successfully updated.'\n format.html { redirect_to(@tourpoint) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tourpoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user_point = UserPoint.find(params[:id])\n\n respond_to do |format|\n if @user_point.update_attributes(params[:user_point])\n format.html { redirect_to @user_point, :notice => 'User point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @touchpoint = Touchpoint.find(params[:id])\n\n respond_to do |format|\n if @touchpoint.update_attributes(params[:touchpoint])\n format.html { redirect_to @touchpoint, notice: 'Touchpoint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @touchpoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @old_point_tag = OldPointTag.find(params[:id])\n\n respond_to do |format|\n if @old_point_tag.update_attributes(params[:old_point_tag])\n format.html { redirect_to(@old_point_tag, :notice => 'Old point tag was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @old_point_tag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @point_type = PointType.find(params[:id])\n\n respond_to do |format|\n if @point_type.update_attributes(params[:point_type])\n format.html { redirect_to([:admin,@point_type], :notice => 'Point type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @point_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def put!\n request! :put\n end",
"def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end",
"def update\n @history_point = HistoryPoint.find(params[:id])\n\n respond_to do |format|\n if @history_point.update_attributes(params[:history_point])\n format.html { redirect_to(@history_point, :notice => 'HistoryPoint was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @history_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @location_point = LocationPoint.find(params[:id])\n\n respond_to do |format|\n if @location_point.update_attributes(params[:location_point])\n format.html { redirect_to @location_point, notice: 'Location point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end",
"def update\n @key_point = KeyPoint.find(params[:id])\n\n respond_to do |format|\n if @key_point.update_attributes(params[:key_point])\n format.html { redirect_to :back, notice: 'Key point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @key_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n @waypoint = Waypoint.find(params[:id])\n\n respond_to do |format|\n if @waypoint.update_attributes(params[:waypoint])\n flash[:notice] = 'Waypoint was successfully updated.'\n format.html { redirect_to(@waypoint) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @waypoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def update\n @checkpoint = Checkpoint.find(params[:id])\n respond_to do |format|\n if @checkpoint.update_attributes(params[:checkpoint])\n ##format.html { redirect_to(@checkpoint, :notice => 'Checkpoint was successfully updated.') }\n ##format.xml { head :ok }\n format.html { redirect_to(:action => :index) }\n format.xml { redirect_to(:action => :index) }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @checkpoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put endpoint, data\n do_request :put, endpoint, data\n end",
"def update\n @time_point = TimePoint.find(params[:id])\n\n respond_to do |format|\n if @time_point.update_attributes(params[:time_point])\n format.html { redirect_to @time_point, notice: 'Time point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @xpto = Xpto.find(params[:id])\n\n respond_to do |format|\n if @xpto.update_attributes(params[:xpto])\n format.html { redirect_to @xpto, notice: 'Xpto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @xpto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def points_update\n command = Goal::GoalPointsUpdateCommand.new(params)\n run(command)\n end",
"def update\n @knowledge_point = KnowledgePoint.find(params[:id])\n\n respond_to do |format|\n if @knowledge_point.update_attributes(params[:knowledge_point])\n format.html { redirect_to @knowledge_point, :notice => 'Knowledge point was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @knowledge_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:event_id])\n @point_of_interest = PointOfInterest.find(params[:id])\n\n respond_to do |format|\n if @point_of_interest.update_attributes(params[:point_of_interest])\n format.html { redirect_to(event_point_of_interest_path, :notice => 'Point of interest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @point_of_interest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n if @spot.update_attributes(params[:spot])\n flash[:notice] = 'Spot was successfully updated.'\n format.html { redirect_to(@spot) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @control_point = ControlPoint.find(params[:id])\n respond_to do |format|\n if @control_point.update_attributes(params[:control_point])\n format.html { redirect_to(@control_point, :notice => 'Control Point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @control_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to(@point, :notice => 'Point added') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @point.update(point_params)\n format.js {}\n else\n format.html { render action: 'edit' }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @point_consumption = PointConsumption.find(params[:id])\n\n respond_to do |format|\n if @point_consumption.update_attributes(params[:point_consumption])\n format.html { redirect_to @point_consumption, :notice => 'Point consumption was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @point_consumption.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n respond_to do |format|\n if @points_transaction.update(points_transaction_params)\n format.html { redirect_to @points_transaction, notice: 'Points transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @points_transaction }\n else\n format.html { render :edit }\n format.json { render json: @points_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def update\n respond_to do |format|\n if @point_of_sale.update(point_of_sale_params)\n format.json { render :show, status: :ok, location: @point_of_sale }\n else\n format.json { render json: @point_of_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(point)\n\t\t\n\tend",
"def update(point)\n\t\t\n\tend",
"def update\n @squat_data_point = SquatDataPoint.find(params[:id])\n\n respond_to do |format|\n if @squat_data_point.update_attributes(params[:squat_data_point])\n format.html { redirect_to @squat_data_point, notice: 'Squat data point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squat_data_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to(@point, :notice => 'Point was successfully created.') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, options={})\n request :put, path, options\n end",
"def update\n @points_spent = PointsSpent.find(params[:id])\n\n respond_to do |format|\n if @points_spent.update_attributes(params[:points_spent])\n format.html { redirect_to @points_spent, notice: 'Points spent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @points_spent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meeting_point = MeetingPoint.find(params[:id])\n\n respond_to do |format|\n if @meeting_point.update_attributes(params[:meeting_point])\n format.html { redirect_to @meeting_point, notice: 'Meeting point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meeting_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @m_get_point = MGetPoint.find(params[:id])\n\n respond_to do |format|\n if @m_get_point.update_attributes(params[:m_get_point])\n format.html { redirect_to :controller => \"m_get_points\", :action => \"index\" }\n #format.html { redirect_to @m_get_point, notice: 'M get point was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @m_get_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request(:put, *args)\n end",
"def update\n respond_to do |format|\n if @ecopoint.update(ecopoint_params)\n format.html { redirect_to @ecopoint, notice: 'Ecopoint was successfully updated.' }\n format.json { render :show, status: :ok, location: @ecopoint }\n else\n format.html { render :edit }\n format.json { render json: @ecopoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @data_point = DataPoint.find(params[:id])\n\n respond_to do |format|\n if @data_point.update_attributes data_point_params\n format.html { redirect_to @data_point, notice: 'Data point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @data_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member_point.update(member_point_params)\n format.html { redirect_to @event, notice: 'Member point was successfully updated.' }\n format.json { render :show, status: :ok, location: @member_point }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @member_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, opts = {})\n request(:put, path, opts).body\n end",
"def update\n respond_to do |format|\n if @way_point.update(way_point_params)\n format.html { redirect_to @way_point, notice: 'Way point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @way_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def create\n @point = Point.new(point_params)\n @point.goal_id = @goal.id\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to :goals, notice: 'Your progress has been updated!' }\n @goal.current_quantity += @point.quantity\n @goal.save!\n format.json { render action: 'show', status: :created, location: @point }\n else\n format.html { redirect_to goals_path, alert: 'Your progress could not be updated because your quantity was not a valid number. \n Please try again.' }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bill_point = BillPoint.find(params[:id])\n\n respond_to do |format|\n if @bill_point.update_attributes(params[:bill_point])\n format.html { redirect_to @bill_point, notice: 'Bill point was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n load_points_entry_type\n authorize! :update, @points_entry_type\n build_points_entry_type\n save_points_entry_type or redirect_to :edit\n end",
"def set_point\n @point = Point.find(params[:id])\n end",
"def set_point\n @point = Point.find(params[:id])\n end",
"def set_point\n @point = Point.find(params[:id])\n end",
"def set_point\n @point = Point.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @check_point.update(check_point_params)\n format.html { redirect_to @check_point, notice: 'Check point was successfully updated.' }\n format.json { render :show, status: :ok, location: @check_point }\n else\n format.html { render :edit }\n format.json { render json: @check_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(uri, doc = nil, options = {})\n execute(uri, :put, options, doc)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def update\n @geopoint = Geopoint.find(params[:id])\n\n respond_to do |format|\n if @geopoint.update_attributes(params[:geopoint])\n format.html { redirect_to @geopoint, notice: 'Geopoint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @geopoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @outcome_timepoint = OutcomeTimepoint.find(params[:id])\n\n respond_to do |format|\n if @outcome_timepoint.update_attributes(params[:outcome_timepoint])\n format.html { redirect_to(@outcome_timepoint, :notice => 'Outcome timepoint was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @outcome_timepoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip_point.update(trip_point_params)\n format.html { redirect_to @trip_point, notice: 'Trip point was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip_point }\n else\n format.html { render :edit }\n format.json { render json: @trip_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(uri, params = {})\n send_request(uri, :put, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def update\r\n respond_to do |format|\r\n if @way_point.update(way_point_params)\r\n format.html { redirect_to @way_point, notice: 'Way point was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @way_point.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @end_point = EndPoint.find(params[:id])\n\n respond_to do |format|\n if @end_point.update_attributes(params[:end_point])\n format.html { redirect_to @end_point, notice: 'End point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @end_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, options={})\n send_request 'put', path, options\n end",
"def update\n @access_point = AccessPoint.find(params[:id])\n\n respond_to do |format|\n if @access_point.update_attributes(params[:access_point])\n format.html { redirect_to @access_point, notice: 'Access point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @access_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end",
"def update\n @terminate_point = TerminatePoint.find(params[:id])\n\n respond_to do |format|\n if @terminate_point.update_attributes(params[:terminate_point])\n format.html { redirect_to terminate_points_path, notice: 'Terminate point was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @terminate_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params={}, options={})\n request(:put, api_path(path), params, options)\n end"
] |
[
"0.6753766",
"0.6726449",
"0.66405857",
"0.661021",
"0.6510128",
"0.6332157",
"0.62724084",
"0.6266412",
"0.61282796",
"0.60895413",
"0.6084915",
"0.6059456",
"0.5927656",
"0.59264714",
"0.59192646",
"0.59190047",
"0.5906212",
"0.58911043",
"0.5883149",
"0.58527255",
"0.5834987",
"0.5820953",
"0.58144903",
"0.5808953",
"0.58036083",
"0.5803392",
"0.5777627",
"0.5771531",
"0.57519895",
"0.57288444",
"0.57142675",
"0.5702237",
"0.5677491",
"0.56732416",
"0.56646913",
"0.5660548",
"0.5650075",
"0.56492007",
"0.5648619",
"0.56476456",
"0.563552",
"0.5634568",
"0.56180143",
"0.5601411",
"0.559459",
"0.5577797",
"0.5574535",
"0.5574535",
"0.5569242",
"0.5568991",
"0.5564076",
"0.55612195",
"0.5554841",
"0.554992",
"0.5543473",
"0.5539247",
"0.5537317",
"0.5530289",
"0.5518748",
"0.5515734",
"0.5506528",
"0.5503679",
"0.5495616",
"0.5490664",
"0.5484468",
"0.54757947",
"0.54700184",
"0.54700184",
"0.54700184",
"0.54700184",
"0.54697907",
"0.5467502",
"0.5465685",
"0.5465685",
"0.5465685",
"0.5459398",
"0.54581046",
"0.54519796",
"0.5435747",
"0.54315704",
"0.5430121",
"0.5430121",
"0.5430121",
"0.5430121",
"0.5430121",
"0.5430121",
"0.5430121",
"0.5430121",
"0.5427572",
"0.54273117",
"0.5417998",
"0.5411607",
"0.5410803",
"0.5407568",
"0.5405463",
"0.5403765",
"0.5403765",
"0.5394705",
"0.5394705",
"0.5390464"
] |
0.60382855
|
12
|
DELETE /points/1 DELETE /points/1.xml
|
def destroy
@point = Point.find(params[:id])
@point.destroy
respond_to do |format|
format.html { redirect_to(points_url) }
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @route_point = RoutePoint.find(params[:id])\n @route_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_points_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @graph_point = GraphPoint.find(params[:id])\n @graph_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(graph_points_url) }\n format.xml { head :ok }\n format.json { render :nothing => true }\n end\n end",
"def destroy\n @page_title = \"Data Points\"\n @data_point = DataPoint.find(params[:id])\n @data_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_points_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @spent_point = SpentPoint.find(params[:id])\n @spent_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(spent_points_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @point_of_interest = PointOfInterest.find(params[:id])\n @point_of_interest.destroy\n\n respond_to do |format|\n format.html { redirect_to(point_of_interests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @history_point = HistoryPoint.find(params[:id])\n @history_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(history_points_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @old_point_tag = OldPointTag.find(params[:id])\n @old_point_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(old_point_tags_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @waypoint = Waypoint.find(params[:id])\n @waypoint.destroy\n\n respond_to do |format|\n format.html { redirect_to(waypoints_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @point.destroy\n respond_to do |format|\n format.html { redirect_to points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @point_type = PointType.find(params[:id])\n @point_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_point_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tourpoint = Tourpoint.find(params[:id])\n @tourpoint.destroy\n\n respond_to do |format|\n format.html { redirect_to(tourpoints_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @checkpoint_removed = CheckpointRemoved.find(params[:id])\n @checkpoint_removed.destroy\n\n respond_to do |format|\n format.html { redirect_to(checkpoint_removeds_url) }\n format.xml { head :ok }\n end\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @point.destroy\n respond_to do |format|\n format.html { redirect_to points_url, notice: 'Point was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end",
"def destroy\n @points_transaction.destroy\n respond_to do |format|\n format.html { redirect_to points_transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @collection_point = CollectionPoint.find(params[:id])\n @collection_point.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @key_point = KeyPoint.find(params[:id])\n @key_point.destroy\n\n respond_to do |format|\n format.html { redirect_to key_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @m_get_point = MGetPoint.find(params[:id])\n @m_get_point.destroy\n\n respond_to do |format|\n format.html { redirect_to m_get_points_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @design_detail_data_point = DesignDetailDataPoint.find(params[:id])\n @design_detail_data_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(design_detail_data_points_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @data_point = DataPoint.find(params[:id])\n @data_point.destroy\n\n respond_to do |format|\n format.html { redirect_to data_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_point = UserPoint.find(params[:id])\n @user_point.destroy\n\n respond_to do |format|\n format.html { redirect_to user_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @water_point = WaterPoint.find_by_id(params[:id])\n @water_point.destroy\n\n respond_to do |format|\n format.any(:html,:iphone) { redirect_to(water_points_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @xpto = Xpto.find(params[:id])\n @xpto.destroy\n\n respond_to do |format|\n format.html { redirect_to xptos_url }\n format.json { head :no_content }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n @snap = Snap.find(params[:id])\n @snap.destroy\n\n respond_to do |format|\n format.html { redirect_to(snaps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bill_point = BillPoint.find(params[:id])\n @bill_point.destroy\n\n respond_to do |format|\n format.html { redirect_to bill_points_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @squat_data_point = SquatDataPoint.find(params[:id])\n @squat_data_point.destroy\n\n respond_to do |format|\n format.html { redirect_to squat_data_points_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @pdig = Pdig.find(params[:id])\n @pdig.destroy\n\n respond_to do |format|\n format.html { redirect_to(pdigs_url) }\n format.xml { head :ok }\n end\n end",
"def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end",
"def destroy\n @access_point = AccessPoint.find(params[:id])\n @access_point.destroy\n\n respond_to do |format|\n format.html { redirect_to access_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @peep = Peep.find(params[:id])\n @peep.destroy\n\n respond_to do |format|\n format.html { redirect_to(peeps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @deadlift_data_point = DeadliftDataPoint.find(params[:id])\n @deadlift_data_point.destroy\n\n respond_to do |format|\n format.html { redirect_to deadlift_data_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entity_end_point_rel = EntityEndPointRel.find(params[:id])\n @entity_end_point_rel.destroy\n\n respond_to do |format|\n format.html { redirect_to(entity_end_point_rels_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @geopoint = Geopoint.find(params[:id])\n @geopoint.destroy\n\n respond_to do |format|\n format.html { redirect_to geopoints_url }\n format.json { head :no_content }\n end\n end",
"def deleteWaypoint _wp\n SQF.deleteWaypoint _wp\n end",
"def destroy\n @touchpoint = Touchpoint.find(params[:id])\n @touchpoint.destroy\n\n respond_to do |format|\n format.html { redirect_to touchpoints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @point_of_interest_comment = PointOfInterestComment.find(params[:id])\n @point_of_interest_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(point_of_interest_comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @visarequest = Visarequest.find(params[:id])\n @visarequest.destroy\n\n respond_to do |format|\n format.html { redirect_to(visarequests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @location_point = LocationPoint.find(params[:id])\n @location_point.destroy\n\n respond_to do |format|\n format.html { redirect_to location_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pneighbour = Pneighbour.find(params[:id])\n @pneighbour.destroy\n\n respond_to do |format|\n format.html { redirect_to(pneighbours_url) }\n format.xml { head :ok }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\n end",
"def destroy\n @approximate_service = ApproximateService.find(params[:id])\n @approximate_service.destroy\n\n respond_to do |format|\n format.html { redirect_to(approximate_services_url) }\n format.xml { head :ok }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n if @base_point.destroy\n flash[:success] = \"拠点情報削除しました\"\n else\n flash[:danger] = \"拠点情報削除に失敗しました\"\n end\n redirect_to base_points_path\n end",
"def destroy\n @point_of_contact.destroy\n\n head :no_content\n end",
"def destroy\n @tuple = Tuple.find(params[:id])\n @tuple.destroy\n\n respond_to do |format|\n format.html { redirect_to(tuples_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @qx = Qx.find(params[:id])\n @qx.destroy\n\n respond_to do |format|\n format.html { redirect_to(qxes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @xml_sample = XmlSample.find(params[:id])\n @xml_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to xml_samples_url }\n format.xml do\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n return render xml: xml\n end\n end\n end",
"def destroy\n @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end",
"def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @datapoint.destroy\n respond_to do |format|\n format.html { redirect_to datapoints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @person = Person.find(params[:id])\n pedigree = @person.pedigree\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(pedigree_url(pedigree)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @po = Po.find(params[:id])\n @po.destroy\n\n respond_to do |format|\n format.html { redirect_to(pos_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n end",
"def destroy\n @ecopoint.destroy\n respond_to do |format|\n format.html { redirect_to ecopoints_url, notice: 'Ecopoint was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @svgpost = Svgpost.find(params[:id])\n @svgpost.destroy\n\n respond_to do |format|\n format.html { redirect_to svgposts_url }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def deletepublish\n @question = Publishquiz.find(:all, :conditions=>\"question_id=\"+params[:question]+\" and quiz_id=\"+session[:quizid])\n @question[0].destroy\n\n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @serialize = Serialize.find(params[:id])\n @serialize.destroy\n\n respond_to do |format|\n format.html { redirect_to(serializes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post445 = Post445.find(params[:id])\n @post445.destroy\n\n respond_to do |format|\n format.html { redirect_to(post445s_url) }\n format.xml { head :ok }\n end\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @point_consumption = PointConsumption.find(params[:id])\n @point_consumption.destroy\n\n respond_to do |format|\n format.html { redirect_to point_consumptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @segment = Segment.find(params[:id])\n @segment.destroy\n\n respond_to do |format|\n format.html { redirect_to(worldreach_segments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @knowledge_point = KnowledgePoint.find(params[:id])\n @knowledge_point.destroy\n\n respond_to do |format|\n format.html { redirect_to knowledge_points_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @envelope = Envelope.find(params[:id])\n @envelope.destroy\n\n respond_to do |format|\n format.html { redirect_to(envelopes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @points_spent = PointsSpent.find(params[:id])\n @points_spent.destroy\n\n respond_to do |format|\n format.html { redirect_to points_spents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vertex = Vertex.find(params[:id])\n @vertex.destroy\n\n respond_to do |format|\n format.html { redirect_to(vertices_url) }\n format.xml { head :ok }\n end\n end",
"def deleteWaypoint _args\n \"deleteWaypoint _args;\" \n end",
"def destroy\n @pto = Pto.find(params[:id])\n @pto.destroy\n\n respond_to do |format|\n format.html { redirect_to(ptos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy; delete end",
"def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @accesspoint.destroy\n respond_to do |format|\n format.html { redirect_to accesspoints_url, notice: 'Accesspoint was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end",
"def destroy\n @check_point.destroy\n respond_to do |format|\n format.html { redirect_to check_points_url, notice: 'Check point was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @point_of_sale.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end"
] |
[
"0.6914002",
"0.67853105",
"0.6729424",
"0.6709959",
"0.6658105",
"0.65791404",
"0.65650725",
"0.65502757",
"0.650488",
"0.64979625",
"0.6478945",
"0.6455987",
"0.6444124",
"0.6424723",
"0.6391033",
"0.63118327",
"0.6302658",
"0.63005275",
"0.6248994",
"0.6241289",
"0.6234498",
"0.61965513",
"0.6193392",
"0.61890143",
"0.6180046",
"0.61771864",
"0.6172701",
"0.6161327",
"0.6161248",
"0.61557835",
"0.6145533",
"0.6138024",
"0.61223125",
"0.6109071",
"0.6106938",
"0.60942525",
"0.6085882",
"0.60841197",
"0.60826224",
"0.6070178",
"0.6064909",
"0.60634136",
"0.60634136",
"0.60634136",
"0.60634136",
"0.60634136",
"0.60591716",
"0.6058328",
"0.6056921",
"0.6055666",
"0.6054183",
"0.6045774",
"0.6027941",
"0.60215986",
"0.6015785",
"0.60151285",
"0.60139316",
"0.6008947",
"0.6008204",
"0.60053384",
"0.59868807",
"0.5985242",
"0.59838414",
"0.5975746",
"0.5959187",
"0.5956794",
"0.5956402",
"0.59511614",
"0.5949961",
"0.59484696",
"0.5938759",
"0.59264547",
"0.5922883",
"0.5917338",
"0.5915808",
"0.59157485",
"0.59157085",
"0.5915071",
"0.5912075",
"0.5907778",
"0.5905611",
"0.59036916",
"0.590224",
"0.5889891",
"0.588687",
"0.58849394",
"0.58845747",
"0.5878492",
"0.5876138",
"0.5873683",
"0.5872425",
"0.58708245",
"0.58706146",
"0.58706146",
"0.58706146",
"0.58706146",
"0.5870273",
"0.58682203"
] |
0.72460157
|
2
|
manage local jar dependency
|
def jar(name, **opts)
opts = {} if opts.nil?
opts = JSON[JSON[opts], symbolize_names: true]
opts[:vendor_path] = 'vendor/checkouts'
opts[:checkout_path] = File.join(opts[:vendor_path], name)
opts[:jar_path] = File.join(
opts[:checkout_path],
'target',
"#{name}-#{opts[:version]}.jar"
)
raise ArgumentError, "can't use path and git together" if opts[:git] && opts[:path]
system "mkdir -p #{opts[:vendor_path]}" unless Dir.exist?(opts[:vendor_path])
if opts[:git]
system "git clone #{opts[:git]} #{opts[:checkout_path]}" unless Dir.exist?(
opts[:checkout_path]
)
end
if opts[:build]
puts 'building...'
script = ''
script += "cd #{opts[:checkout_path]}"
script += "\n"
script += opts[:build]
system script
system "rm -rf ./lib/ext/*"
system "cp -r #{File.join(opts[:jar_path])} ./lib/ext"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def load_dependencies\r\n @local_gems.each do |gem_info|\r\n gem_file_name = gem_info.gem_file\r\n gem_name = installed_as_name_for( short_form_of_gem_name( gem_file_name ) )\r\n @required_gem_names.delete gem_file_name\r\n end\r\n @required_gem_paths.each do |gem_path|\r\n gem_short_name = short_form_of_gem_name gem_path\r\n if @required_gem_names.include? gem_short_name\r\n puts \"installing #{gem_path}\"\r\n installer = @force_require ? PreloadingInstaller.new( gem_path, @local_gems ) : Installer.new( gem_path )\r\n installer.install\r\n end\r\n end\r\n end",
"def add_bundled_gems\n return unless bundle_gems\n\n if bundle_local\n logger.trace 'Adding bundler filer to jar locally...'\n else\n logger.trace 'Adding bundler files to jar...'\n end\n\n require 'bundler'\n begin\n gemfile_path, lockfile_path = nil\n\n # Execute Bundler commands in the app_path, not in the Dir.pwd\n Bundler::SharedHelpers.chdir app_path do\n # No need to check ENV['BUNDLE_GEMFILE'], because Bundler will\n # take care of that\n gemfile_path = Bundler.default_gemfile\n lockfile_path = Bundler.default_lockfile\n end\n rescue Bundler::GemfileNotFound\n logger.warn 'No Gemfile found - skipping gem dependencies'\n return {}\n end\n\n # We need gemfile_root to properly locate the `vendor/bundle`\n gemfile_root = gemfile_path.parent\n vendor_cache_path = gemfile_root.join('vendor/cache')\n vendor_bundle_path = gemfile_root.join('vendor/bundle')\n\n unless lockfile_path.exist?\n logger.warn 'No Gemfile.lock found — this might lead to unexpected \\\n dependency tree, please consider running `bundle install` to resolve \\\n and lock dependencies.'\n end\n\n exclude_registed_jars = TorqueBox::Jars.list.map { |j| File.basename(j) }\n bundle_source = temp_dir\n\n # No need to run bundler at all. Just copy the contents of the\n # `vendor/bundle` to the jar\n if vendor_bundle_path.exist?\n logger.info 'Using existing `vendor/bundle`. Make sure that your \\\n dependencies is up to date.'\n\n bundle_source = vendor_bundle_path\n else\n vendor_bundle_gems :lockfile_exist => lockfile_path.exist?\n end\n\n add_files :source => bundle_source.to_s,\n :destination => 'app/vendor/bundle',\n :pattern => '/{**/*,.bundle/**/*}',\n :exclude => exclude_registed_jars\n\n copy_bundler_gem\n end",
"def require_gems; end",
"def require_faux_gem\n rel_main = \"./#{real_main_file_name}\"\n Dir.chdir( folder_lib ){\n require \"./#{real_main_file_name}\"\n }\n end",
"def patch_jars(jars)\n jars.each do |jar|\n tmp = File.new(\"MANIFEST.MF\", \"w\")\n Zip::ZipFile.open(jar) do |zip|\n cont = zip.read(\"META-INF/MANIFEST.MF\").rstrip\n tmp.puts(cont)\n if cont.match('DynamicImport-Package').nil? then\n tmp.puts(\"DynamicImport-Package: com.vladium.*\\n\")\n end\n\n tmp.close\n zip.replace(\"META-INF/MANIFEST.MF\", \"MANIFEST.MF\")\n end\n end\nend",
"def vendorize_with_symlink\n FileUtils.symlink \"#{JSPEC_ROOT}/lib\", normalize('lib'), :force => true\n end",
"def dependency(dep, ver = nil)\n @dep_loader.add_dependency dep, ver\n end",
"def local_require(lib)\n load_local_gem(lib)\n require(lib)\n end",
"def vendor_dependencies\n fetch_bundler\n bundle_install\n end",
"def vendorize_with_copy\n FileUtils.cp_r \"#{JSPEC_ROOT}/lib\", normalize('lib')\n end",
"def add_dependency(path, dependency); end",
"def load_minimal_gems\r\n end",
"def add_gem_paths; end",
"def add_bundler_files(jar)\n pwd = Pathname.new(Dir.pwd)\n gemfile = config.bundler[:gemfile].relative_path_from(pwd).to_s\n lockfile = config.bundler[:lockfile].relative_path_from(pwd).to_s\n jar.files[jar.apply_pathmaps(config, gemfile, :application)] = config.bundler[:gemfile].to_s\n if File.exist?(lockfile)\n jar.files[jar.apply_pathmaps(config, lockfile, :application)] = config.bundler[:lockfile].to_s\n end\n end",
"def dependency_to_jar(dependency)\n group, artifact, version = dependency.split(\"/\")\n \"#{artifact}-#{version}.jar\"\nend",
"def package_dependency(dep, bundle_info)\n info \"Starting packaging #{dep}\"\n\n instance = if dep.is_a? String\n dependency_object_by_name dep\n else\n dep\n end\n\n onError \"Invalid dependency name: #{dep}\" unless instance\n\n files = instance.getInstalledFiles\n\n if !files || files.empty?\n error \"Dependency '#{dep}' has no files to package\"\n return nil\n end\n\n # Add symbolic link targets\n links_found = true\n total_links = 0\n handled = []\n\n while links_found\n\n links_found = false\n\n files.each do |f|\n full = File.join(DependencyInstallFolder, f)\n\n next if handled.include? full\n\n next unless File.exist?(full) && File.symlink?(full)\n\n link_target = File.join(File.dirname(f), File.readlink(full))\n\n unless child_path?(DependencyInstallFolder,\n File.join(DependencyInstallFolder, link_target))\n onError 'symbolic link to be installed points outside the dependency folder: ' +\n link_target.to_s\n end\n\n links_found = true\n total_links += 1\n handled.append full\n files.append link_target\n end\n end\n\n handled = nil\n\n info \"Resolved #{total_links} symbolic links in packaged file list\" if total_links > 0\n\n precompiled_name = instance.getNameForPrecompiled + '_' + CurrentPlatform\n zip_name = precompiled_name + '.tar.xz'\n info_file = precompiled_name + '_info.txt'\n hash_file = precompiled_name + '_hash.txt'\n\n # Check that all exist\n Dir.chdir(DependencyInstallFolder) do\n files.each do |f|\n unless File.exist? f\n onError \"Dependency file that should be packaged doesn't exist: \" + f.to_s\n end\n end\n\n files_to_restore = strip_files_if_needed files\n\n File.open(info_file, 'w') do |f|\n f.puts \"RubySetupSystem precompiled library for #{CurrentPlatform}\"\n f.puts instance.Name + ' retrieved from ' + instance.RepoURL\n f.puts instance.Version.to_s + ' Packaged at ' + Time.now.to_s\n f.puts ''\n f.puts \"You can probably find license from the repo url if it isn't included here\"\n f.puts 'This info file is included in ' + zip_name\n end\n\n # When bundling everything needs to be made clean\n File.unlink zip_name if File.exist?(zip_name) && $options[:bundle]\n\n info \"Compressing files into #{zip_name}\"\n\n # Write a tar file with lzma compression\n runSystemSafe('tar', '-cJf', zip_name, info_file, *files)\n\n restore_stripped_files files_to_restore\n\n onError 'Failed to create zip file' unless File.exist? zip_name\n\n hash = SHA3::Digest::SHA256.file(zip_name).hexdigest\n\n # Write hash to file\n File.open(hash_file, 'w') do |f|\n f.puts hash\n end\n\n success \"Done with #{dep}, created: #{zip_name}\"\n info \"#{zip_name} SHA3: \" + hash\n # info \"#{zip_name} PLATFORM: \" + CurrentPlatform\n bundle_info[:dep_files].append zip_name\n return { name: precompiled_name, hash: hash }\n end\nend",
"def try_local(gem_name)\n if ENV['USE_LOCAL_GEMS']\n gem gem_name, path: \"../#{gem_name}\"\n else\n gem gem_name, github: \"omniscrapper/#{gem_name}\"\n end\nend",
"def update_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-d' : '-q')}\"\n end",
"def depend(location, type, *args)\n if type == :gemfile\n registry = GemInstaller::Registry.new\n config_builder = registry.config_builder\n path = args.pop\n config_builder.config_file_paths = path\n config = config_builder.build_config\n gems = config.gems\n \n gems.each do |agem|\n # gem() function defined in Capistrano's RemoteDependency class\n options = pluck_accessor_hash(agem, [:platform, :install_options, :check_for_upgrade, :no_autogem, :fix_dependencies])\n depend_without_gemfile(location, :gem, agem.name, agem.version, options)\n end\n else\n depend_without_gemfile(location, type, *args)\n end\n end",
"def inject_jar(jar_path)\n jar_dir = tmp_app_path.join('Contents/Java')\n jar_dir.rmtree\n jar_dir.mkdir\n cp Pathname.new(jar_path), jar_dir\n end",
"def jar(name)\n \"https://clojars.org/#{name}\"\n end",
"def libs; end",
"def install_gem; end",
"def build_dependency\n npm_install\nend",
"def depend_on_asset(path)\n filename = resolve(path).to_s\n @_dependency_assets << filename\n nil\n end",
"def installDeps(copy)\n deps = Buildr.artifacts(project('infra').compile.dependencies).map(&:to_s)\n deps << project('infra').package.to_s\n\t\t EXTRA_JARS.each do |jar|\n\t\t\t\t\tdeps << jar\n\t\t\t\tend\n deps = skipDeps(deps)\n\n classpathFile = File.new(GT4LIB + '/gndms-dependencies.xml', 'w')\n classpathFile.syswrite('<?xml version=\"1.0\"?>' + \"\\n\" + '<project><target id=\"setGNDMSDeps\"><path id=\"service.build.extended.classpath\">' + \"\\n\")\n depsFile = File.new(GT4LIB + '/gndms-dependencies', 'w')\n deps.select { |jar| jar[0, GT4LIB.length] != GT4LIB }.each { |file| \n basename = File.basename( file )\n newname = GT4LIB+'/'+basename\n if (copy)\n puts 'cp: \\'' + file + '\\' to: \\'' + newname + '\\''\n cp(file, newname)\n puts 'yay'\n chmod 0644, newname\n else\n puts 'ln_sf: \\'' + file + '\\' to: \\'' + newname + '\\''\n chmod 0644, file\n ln_sf(file, newname)\n end\n depsFile.syswrite(basename + \"\\n\") \n classpathFile.syswrite('<pathelement location=\"' + basename + '\" />' + \"\\n\")\n }\n depsFile.close\n classpathFile.syswrite('</path></target></project>' + \"\\n\\n\")\n classpathFile.close\n end",
"def local_requires\n require \"talia_cl\"\nend",
"def dependencies; end",
"def dependencies; end",
"def dependencies; end",
"def setup(install_dir, jar_dir)\n @install_dir = install_dir\n @jar_dir = jar_dir\n end",
"def all_in_one_jar(options)\n name = options[:id] || fail(\"Missing :id\")\n libs = options[:libs] || fail(\"Missing :id\")\n package(:jar, :id => fakesdb(name)).tap do |pkg|\n pkg.enhance [task(:retrieve)]\n # double-enhance so merge happens after base jar is created\n pkg.enhance do\n pkg.enhance do\n libs.each do |prefix|\n Dir[_(\"lib\") + \"/#{prefix}-*.jar\"].each do |dep|\n fast_merge_jar pkg, dep if dep !~ /-sources/\n end\n end\n end\n end\n end\n end",
"def lib_path; end",
"def lib_path; end",
"def lib_path; end",
"def main\n last_good_root = from_file($cache_dir + '/root.txt') ||\n from_file('config/root.txt') ||\n raise(\"Can't find root.txt\")\n\n repository = Gem::TUF::Repository.new(\n root: JSON.parse(last_good_root),\n bucket: FileCachingBucket.new(HttpBucket.new($host))\n )\n\n gem_name = ARGV.shift\n\n specs = repository.target('latest_specs.4.8.gz')\n raise \"could not find latest_specs.4.8.gz\" unless specs\n specs = unmarshal_gz specs\n gem = specs.detect {|x| x[0] == gem_name } || raise(\"Can't find gem #{gem}\")\n\n gem_with_version = \"#{gem[0]}-#{gem[1]}\"\n gem_path = \"gems/#{gem_with_version}.gem\"\n gemspec_path = \"quick/Marshal.4.8/#{gem_with_version}.gemspec.rz\"\n\n repository.target(gemspec_path)\n repository.target(gem_path)\n\n puts \"Downloaded #{gem_path} and #{gemspec_path}\"\nend",
"def additional_classpath\r\n list = super\r\n\r\n if FileTest.exist? ext=File.join(@lib, 'ext')\r\n current = Dir.getwd\r\n Dir.chdir ext\r\n\r\n list += Dir['*.jar'].collect { |jar| File.join(ext, jar) }\r\n\r\n Dir.chdir current\r\n end\r\n list\r\n end",
"def update_load_path\n require 'bundler'\n Bundler.setup\n end",
"def install(local: false)\n\tpath = self.build\n\t\n\t@helper.install_gem(path, local)\nend",
"def update_libraries(uri); end",
"def require_lib(*libs); end",
"def import_from_jar\n # Example\n # this is used to import java generated file from the jar \n # within the application which will be running in java\n # you need to put the name of all the required class\n %w[\n controller\n handler\n application_controller\n application_handler\n ].each do |c|\n require c\n end\n\nend",
"def fetch_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-v' : '-q')}\"\n end",
"def convert_dependencies_to_jars(dependencies = DEPENDENCIES, as_classpath = false)\n ret = dependencies.map{ |d| maven_filename(dependency_to_jar(d)) }\n ret = ret.join(\":\") if as_classpath\n ret\nend",
"def pre_install; end",
"def local_or_remote_gem(name, options = Hash.new)\n local_path = File.expand_path(\"../vendor/#{name}\", __FILE__)\n if File.exist?(local_path)\n gem name, options.merge(:path => local_path).delete_if { |key, _| [:git, :branch].include?(key) }\n else\n gem name, options\n end\nend",
"def core_fetch_dependency(package_name, vers, type, verbose)\n prerelease = false\n if vers == '>= 0-pre'\n prerelease = true\n vers = '>= 0'\n else\n prerelease = vers =~ /[a-zA-Z]/\n end\n\n dep = LibGems::Dependency.new(package_name, vers, type)\n cur_installed = LibGems.source_index.search(dep)\n\n begin\n installed = BPM::Remote.new.install(package_name, vers, prerelease)\n rescue LibGems::GemNotFoundException\n # If we have it locally but not remote, that's ok\n installed = []\n end\n\n cur_installed.each do |ci|\n installed.reject! { |i| ci.name == i.name && ci.version == i.version }\n end\n\n installed.each do |i|\n say \"~ Fetched #{i.name} (#{i.version}) from remote\"\n end\n\n end",
"def dependency(lib = nil)\n lib ? require(lib) : yield\n rescue LoadError, NameError => e\n self.load_error = e\n end",
"def install\n \n end",
"def check_dependencies!(dep)\n depend_on(dep)\n depend_on_asset(dep)\n rescue Sprockets::FileNotFound\n end",
"def install_dependencies\n raise 'Not implemented'\n end",
"def depends_on(mod)\n @log.info \"Loading module '#{mod}' as a dependency\"\n loaded = require \"#{File.dirname(__FILE__)}/modules/#{mod.to_s}.rb\"\n @log.info \"Module '#{mod}' already loaded, not re-loading\" if !loaded\nend",
"def install\n install_gems(dependencies)\n end",
"def add_gems\n Bundler.with_clean_env do\n run 'bundle install'\n end\n end",
"def build_gems; end",
"def post_install; end",
"def direct_dependencies; end",
"def library; end",
"def library; end",
"def enable_dependency_loading; end",
"def enable_dependency_loading; end",
"def add_info_from_m2(dep)\n m2_artifact_dir = @m2_path\n .join(dep['groupId'].tr('.', '/'))\n .join(dep['artifactId'])\n .join(dep['version'])\n artifact_basename = \"#{dep['artifactId']}-#{dep['version']}\"\n\n dep.store('jarFile', m2_artifact_dir.join(\"#{artifact_basename}.jar\"))\n\n add_info_from_pom(m2_artifact_dir.join(\"#{artifact_basename}.pom\"), dep)\n end",
"def library_project(dependencies, group, name, version, options = {:exclude => [\"META-INF/MANIFEST.MF\"], :include => [], :manifest => {}})\n options[:manifest] ||= {} \n options[:include] ||= []\n options[:exclude] ||= []\n deps_as_str = []\n # We create an object and we extend with the module so we can get access to the walk_libs method.\n walker = Object.new \n walker.extend Buildr4OSGi::BuildLibraries::LibraryProject\n walker.walk_libs(dependencies) {|lib|\n deps_as_str << lib.to_spec\n }\n deps_as_str = deps_as_str.flatten.inspect\n exclusion = options[:exclude].collect {|exclusion| \".exclude(#{exclusion.inspect})\"}.join if options[:exclude]\n inclusion = options[:include].collect {|inclusion| \".include(#{inclusion.inspect})\"}.join if options[:include]\n exclusion ||= \"\"\n inclusion ||= \"\"\n eval %{\n desc \"#{name}\"\n define \"#{name}\" do\n project.extend Buildr4OSGi::LibraryProject\n #{\"project.version = \\\"#{version}\\\"\" if version}\n #{\"project.group = \\\"#{group}\\\"\" if group}\n\n package(:library_project).tap {|jar|\n jar.enhance {|task|\n walk_libs(#{deps_as_str}) {|lib|\n lib.invoke # make sure the artifact is present.\n task.merge(lib)#{exclusion}#{inclusion}\n }\n }\n entries = []\n names = []\n walk_libs(#{deps_as_str}) {|lib|\n names << lib.to_spec \n lib.invoke # make sure the artifact is present.\n Zip::ZipFile.foreach(lib.to_s) {|entry| \n if /.*\\\\.class$/.match(entry.name)\n add_to_entries = true\n [#{options[:exclude].inspect}].flatten.each {|excluded|\n add_to_entries &&= !entry.name.match(excluded)\n }\n [#{options[:include].inspect}].flatten.each {|included|\n add_to_entries &&= included.match(entry.name)\n }\n entries << entry.name.sub(/(.*)\\\\/.*.class$/, '\\\\1').gsub(/\\\\//, '.') if add_to_entries\n end\n }\n }\n lib_manifest = { \n \"Bundle-Version\" => \"#{version}\",\n \"Bundle-SymbolicName\" => project.name,\n \"Bundle-Name\" => names.join(\", \"),\n \"Bundle-Vendor\" => \"Intalio, Inc.\"\n }\n lib_manifest[\"Export-Package\"] = entries.uniq.sort.join(\",\") unless entries.empty?\n lib_manifest[\"Bundle-ManifestVersion\"] = \"2\"\n jar.with :manifest => lib_manifest.merge(#{options[:manifest].inspect})\n \n \n }\n package(:sources).tap do |task|\n task.enhance do\n walk_libs(#{deps_as_str}) {|lib|\n lib_src = Buildr::artifact(lib.to_hash.merge(:classifier => \"sources\"))\n lib_src.extend Buildr4OSGi::SkipSourceDownload\n lib_src.invoke # make sure the artifact is present.\n \n task.merge(lib_src)#{exclusion}#{inclusion} if File.exist?(lib_src.to_s)\n }\n end\n end\n end\n }\n end",
"def require_libs(*libs); end",
"def build_remote_dependencies\n modules_json_path = \"#{@mod.cache_dir}/.terraform/modules/modules.json\"\n return unless File.exist?(modules_json_path)\n\n initialized_modules = JSON.load(IO.read(modules_json_path))\n # For example of structure see spec/fixtures/initialized/modules.json\n initialized_modules[\"Modules\"].each do |meta|\n build_remote_mod(meta)\n end\n end",
"def install\n end",
"def install\n end",
"def local_ruby_dep name, *other_deps\n other_deps_string = other_deps.inject(\"\") do | a, e |\n a + \" \" + e\n end\n new_entry \"#{name}: #{name}.rb#{other_deps_string}\"\n tab \"ruby $(RUBYOPT) #{name}.rb >$@.t\"\n commit\n end",
"def load_libs; end",
"def bower_version(library)\n BOWER[\"dependencies\"][library] || BOWER[\"devDependencies\"][library]\nend",
"def copy_project_dependencies_for_awestruct_image\n\n puts \"- Copying project dependencies into '_docker/awestruct' for build...\"\n\n parent_gemfile = File.open '../Gemfile'\n parent_gemlock = File.open '../Gemfile.lock'\n\n target_gemfile = FileHelpers.open_or_new('awestruct/Gemfile')\n target_gemlock = FileHelpers.open_or_new('awestruct/Gemfile.lock')\n #Only copy if the file has changed. Otherwise docker won't cache optimally\n FileHelpers.copy_if_changed(parent_gemfile, target_gemfile)\n FileHelpers.copy_if_changed(parent_gemlock, target_gemlock)\n\n puts \"- Successfully copied project dependencies into '_docker/awestruct' for build.\"\n\nend",
"def bundle\n raise \"Paths not given! Call setup first.\" if @install_dir.nil? || @jar_dir.nil?\n gems_jar = File.join(jar_dir, 'gems.jar')\n default_options = { :generate_rdoc => false, \n :generate_ri => false,\n :install_dir => install_dir }\n FileUtils.rm_rf install_dir if File.exists? install_dir\n FileUtils.mkdir_p install_dir\n installer = Gem::DependencyInstaller.new(default_options)\n @gems.each do |name, version|\n puts \"Installing #{name} (#{version})\"\n installer.install(name, version || Gem::Requirement.default) \n end\n Dir.glob(\"#{install_dir}/**/*.jar\").each do |jar|\n FileUtils.mv jar, File.join(jar_dir, jar.split(\"/\").last)\n end\n FileUtils.rm gems_jar if File.exists? gems_jar\n `jar cf #{gems_jar} -C #{install_dir} .`\n end",
"def add_explicit_dependencies(cookbook)\n graph.populate_local(cookbook)\n end",
"def connectorj_jar\n ::File.basename(new_resource.url, '.tar.gz') + if connectorj_ver.split('.')[0].to_i >= 8\n '.jar'\n else\n '-bin.jar'\n end\n end",
"def check_for_libraries; end",
"def activate(library)\n name = library.name\n\n lib = $LEDGER.index[name]\n\n if Library === lib\n raise VersionConflict.new(library, lib) if lib != library\n else\n library.absolute_loadpath.each do |path|\n $LOAD_PATH.unshift(path)\n end\n\n $LEDGER.index[name] = library\n\n# TODO\n #if library.requirements.exist?\n # library.requirements.verify(true)\n # # complete collapse\n #end\n end\n end",
"def libfile\n Pathname.new(resource[:lib]).absolute? ? resource[:lib] : \"modules/#{resource[:lib]}\"\n end",
"def standard_dependency(code, group, base_artifact, target_version, options = {})\n artifacts = []\n\n options = options.dup\n\n standard_suffixes = %w(\n shared:jar\n model:jar model-qa-support:jar\n replicant-shared:jar replicant-qa-support:jar\n gwt:jar gwt-qa-support:jar\n server:war\n server:jar server-qa-support:jar\n db:jar\n integration-qa-support:jar\n sync_model:jar\n soap-client:jar soap-qa-support:jar\n )\n\n %W(#{group} #{group}.pg).each do |g|\n ((options[:additional_artifacts] || []) + %W(domains-#{base_artifact}:json) + standard_suffixes).\n each do |artifact_suffix|\n artifacts << \"#{g}:#{base_artifact}-#{artifact_suffix}\"\n end\n end\n\n desc \"Update the #{code} dependencies in build.yaml\"\n command(:\"patch_#{code}_dep\") do |app|\n patch_versions(app, artifacts, target_version, options)\n end\n end",
"def bundle_dependencies\r\n if options[:run_bundle]\r\n say \"Bundling application dependencies using bundler...\"\r\n in_root { run 'bundle install' }\r\n end\r\n end",
"def vendor_gems\n cd 'cookbooks/example'\n unset_bundler_env_vars\n run_simple 'bundle install --path vendor/bundle'\n cd '../..'\n end",
"def manifest_task\n # Load all the gem's files using \"git ls-files\"\n repository_files = `#{git} ls-files`.split(\"\\n\")\n test_files = Dir[test_pattern] + Dir[spec_pattern]\n\n update_gemspec(:files, repository_files)\n update_gemspec(:test_files, repository_files & test_files)\n end",
"def build_gem; end",
"def add_hardcoded_gem(path)\n # make sure gem dir has a gemspec\n gemspec = File.join path, File.basename(path) + '.gemspec'\n return unless File.exists? gemspec\n # make sure gem dir has a lib dir\n libpath = File.join path, 'lib'\n return unless File.exists? libpath\n # all is ok, so add to loadpath\n @paths << libpath\n end",
"def load_local_gem(library)\n if path = config[:gems][library]\n path = [path] unless path.is_a?(Array)\n path.map {|e| File.expand_path(e) }.each do |f|\n $:.unshift(f) unless $:.include?(f)\n end\n true\n else\n false\n end\n end",
"def util_bake_gem(name = \"a\", *extra, &block)\n files = [\"lib/#{name}.rb\"].concat(extra)\n\n spec = new_spec name, \"1\", nil, files, &block\n\n File.join @tempdir, \"gems\", \"#{spec.full_name}.gem\"\n end",
"def maven_auto_artifact (module_name)\n builder = artifacts_builder\n builder.collect(File.join(build_repository, module_name, \"target\"), /classes/, /test-classes/, /maven-archiver/)\n builder.to_set\nend",
"def reshuffle_jars()\n FileUtils.mkdir_p(\"#{self.build_dir()}/src/edit-webapp/WEB-INF/lib/\")\n FileUtils.cp(Dir[\"#{UcbDeployer::RESOURCES_DIR}/soulwing-casclient-*\"],\n \"#{self.build_dir()}/src/edit-webapp/WEB-INF/lib/\")\n # These have been placed in $CATALINA_HOME/lib\n [\"mail\", \"activation\", \"javamail\", \"commons-logging\", \"log4j\"].each do |jar|\n FileUtils.rm_rf(Dir[\"#{self.build_dir()}/src/webapp/WEB-INF/lib/#{jar}-*\"])\n end\n end",
"def library_for(uri); end",
"def lib(name)\n\t\tlib = YAML::load(File.open(File.join(\"lib\", \"#{name}.yml\")))\n\tend",
"def util_bake_gem(name = \"a\", *extra, &block)\n files = [\"lib/#{name}.rb\"].concat(extra)\n\n spec = if Gem::VERSION >= \"3.0.0\"\n util_spec name, \"1\", nil, files, &block\n else\n new_spec name, \"1\", nil, files, &block\n end\n\n util_build_gem spec\n\n spec.cache_file\n end",
"def install\n end",
"def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end",
"def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end",
"def cache_thin_dependencies(java_home, application_root, thin_root)\n shell \"#{java_home + 'bin/java'} -Dthin.dryrun -Dthin.root=#{thin_root} -cp #{application_root} #{THIN_WRAPPER}\"\n end",
"def dependency_to_url(dependency)\n #Each dependency is in the form group/artifact/version.\n group, artifact, version = dependency.split(\"/\")\n jar_filename = dependency_to_jar(dependency)\n group_with_slash = group.split(\".\").join(\"/\")\n \"https://repo1.maven.org/maven2/#{group_with_slash}/#{artifact}/#{version}/#{jar_filename}\"\nend",
"def download_mut_deps( mut_dir )\n FileUtils.chdir mut_dir, :verbose => verbose?\n cmd = \"puppet module build --render-as=json\"\n puts cmd if verbose?\n tgz = `#{cmd}`.split(\"\\n\").last.gsub('\"','')\n puts \"built module archive: #{tgz}\" if verbose?\n cmd = \"puppet module install #{tgz} \" +\n \"--module_repository=#{@upstream_puppet_forge} \" +\n \"--modulepath=#{@mods_dir} --target-dir=#{@mods_dir}\"\n v1 cmd\n out = `#{cmd}`\n v1 out\n\n # add the\n FileUtils.cp tgz, @tars_dir, :verbose => verbose?\n end",
"def additional_classpath\r\n lib = File.join(@root, 'lib')\r\n if FolderClasspath.valid_location?(lib)\r\n Dir.entries(lib).map { |e| File.join(lib, e) }.find_all { |e| JarClasspath.valid_location?(e) }\r\n else\r\n []\r\n end\r\n end",
"def gem(name, options={})\n puts \"vendoring gem #{name}\"\n if options[:git]\n in_root(\"vendor/gems\") do\n Git.clone(options[:git], options[:branch])\n end\n elsif options[:svn]\n in_root(\"vendor/gems\") do\n Svn.checkout(options[:svn], options[:branch])\n end\n else \n # TODO: Gem dependencies. Split output on \\n, iterate lines looking for Downloaded...\n in_root(\"vendor/gems\") do\n # Filename may be different than gem name\n filename = (`gem fetch #{name}`).chomp.gsub(/Downloaded /, '')\n\n `gem unpack #{filename}.gem`\n File.delete(\"#{filename}.gem\")\n end\n end\n end",
"def maven_get(dependencies = DEPENDENCIES)\n #First, make sure the TMPMAVENDIR exists and create it if not.\n FileUtils.mkdir_p(TMPMAVENDIR)\n\n #Now make sure all the dependencies exist.\n dependencies.each do |dependency|\n jar_filename = dependency_to_jar(dependency)\n\n #Check if we already have the jar. Get it if not.\n if !File.exists?(maven_filename(jar_filename))\n url = dependency_to_url(dependency)\n uri = URI(dependency_to_url(dependency))\n $stderr.puts(\"downloading #{jar_filename} from #{uri}...\")\n\n File.open(maven_filename(jar_filename), \"wb\") do |f|\n begin\n f.print open(url, 'User-Agent' => 'ruby').read\n $stderr.puts \"Successfully downloaded #{jar_filename}!\"\n rescue SocketError => e\n $stderr.puts \"SocketError in downloading #{jar_filename}: #{e}\"\n rescue SystemCallError => e\n $stderr.puts \"SystemCallError in downloading #{jar_filename}: #{e}\"\n end\n end\n end\n end\nend",
"def install_plugin(plugin, opts = {})\n @logger.info \"install #{plugin}\"\n dependency = Gem::Dependency.new plugin, opts[:version]\n path = dependency.name =~ /\\.gem$/i ? dependency.name : Gem::RemoteFetcher.fetcher.download_to_cache(dependency) \n raise \"Gem '#{plugin}' not fetchable.\" unless path\n basename = File.basename path, '.gem'\n # remvoe version\n basename = basename.gsub(/-[\\d]+\\.[\\d]+\\.[\\d]+$/, \"\")\n target_dir = File.join(@plugin_dir, basename)\n if opts[:force] == true\n @logger.info \"remove old #{target_dir}\"\n FileUtils.rm_r target_dir if File.exist?(target_dir)\n else\n raise \"#{target_dir} alrady exist\" if File.exist?(target_dir)\n end\n FileUtils.mkdir_p target_dir\n if opts[:unpack]\n installer = Gem::Installer.new(path, :unpack=>true)\n installer.unpack target_dir\n else\n installer = Gem::DependencyInstaller.new\n installer.install path\n installed_dir = Gem::Installer.new(path).dir\n init_rb = File.join(installed_dir, \"init.rb\")\n FileUtils.cp(init_rb, target_dir)\n end\n @logger.info \"#{path} installed: #{target_dir}'\"\n end"
] |
[
"0.63151515",
"0.6307941",
"0.6174609",
"0.6017502",
"0.6017384",
"0.59447604",
"0.59206504",
"0.5870142",
"0.5844417",
"0.582656",
"0.5812739",
"0.5796482",
"0.57960397",
"0.5780335",
"0.57800645",
"0.5756384",
"0.5736056",
"0.57155585",
"0.5715019",
"0.5683574",
"0.5664403",
"0.56336737",
"0.5618493",
"0.5594781",
"0.5550057",
"0.5549981",
"0.55326",
"0.5528996",
"0.5528996",
"0.5528996",
"0.55205333",
"0.5515227",
"0.5488163",
"0.5488163",
"0.5488163",
"0.5458326",
"0.54564655",
"0.5456256",
"0.54445374",
"0.5444112",
"0.54433715",
"0.54431343",
"0.54362243",
"0.54300904",
"0.54221517",
"0.54146737",
"0.5406837",
"0.5389985",
"0.53895015",
"0.5377952",
"0.5372424",
"0.5340261",
"0.5338726",
"0.5335264",
"0.5328871",
"0.53180087",
"0.53172106",
"0.53141856",
"0.53141856",
"0.5310806",
"0.5310806",
"0.5295487",
"0.52883774",
"0.52874994",
"0.52749693",
"0.5273032",
"0.5273032",
"0.52714604",
"0.52654636",
"0.5262214",
"0.52593696",
"0.5254349",
"0.52447563",
"0.5242151",
"0.5240745",
"0.5240152",
"0.52309996",
"0.5227016",
"0.5226101",
"0.5224596",
"0.5224168",
"0.52227426",
"0.5220761",
"0.52170426",
"0.52081895",
"0.52049685",
"0.5200547",
"0.5199314",
"0.51986116",
"0.51974875",
"0.51974607",
"0.5193452",
"0.5193452",
"0.5192915",
"0.51918966",
"0.5191465",
"0.51883996",
"0.5183032",
"0.51777476",
"0.5177336"
] |
0.5855401
|
8
|
GET /store_managers GET /store_managers.json
|
def index
@store_managers = StoreManager.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def managers\n response = request(:get, \"/manager\")\n response_to_array(response, \"managers\", KontaktIo::Resource::Manager)\n end",
"def _manager_list\n\t\t\t# Author\n\t\t\treturn render json: { status: 6 } if cannot? :manage, User\n\t\t\t\n\t\t\t# Check unless exists is_add, type\n\t\t\treturn render json: { status: 3 } unless params.has_key?(:is_add) && params.has_key?(:type)\n\n\t\t\tper = Rails.application.config.item_per_page\n\t\t\tpage = params.has_key?(:page) ? params[:page].to_i : 1\n\t\t\tis_add = params[:is_add] === 'true'\n\t\t\ttype = params[:type]\n\n\t\t\tusers = User.search_by_type params[:keyword], type, !is_add\n\n\t\t\tcount = users.count\n\n\t\t\treturn render json: { status: 1 } if count === 0\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0,\n\t\t\t\tresult: {\n\t\t\t\t\tlist: render_to_string(partial: 'users/manager_list', locals: { users: users.page(page, per), is_add: is_add }),\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per })\n\t\t\t\t}\n\t\t\t}\n\t\tend",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manager }\n end\n end",
"def index\n if current_user.admin?\n @stores = Store.all\n else\n @stores = current_user.stores\n end\n\n render json: @stores\n end",
"def _manager_list\r\n\t\t\t# Author\r\n\t\t\tauthorize! :manage, Project\r\n\r\n\t\t\tper = Rails.application.config.item_per_page\r\n\r\n\t\t\tparams[:page] ||= 1\r\n\t\t\tparams[:page] = params[:page].to_i\r\n\r\n\t\t\tprojects = Project.manager_search_with_params params\r\n\r\n\t\t\tcount = projects.count\r\n\r\n\t\t\treturn render json: { status: 1 } if count == 0\r\n\r\n\t\t\trender json: {\r\n\t\t\t\tstatus: 0,\r\n\t\t\t\tresult: {\r\n\t\t\t\t\tlist: render_to_string(partial: 'projects/manager_list', locals: { projects: projects.page(params[:page], per) }),\r\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per, page: params[:page] })\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\tend",
"def index\n @admin_stores = Admin::Store.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_stores }\n end\n end",
"def show\n\n @marina = Marina.find(params[:id])\n @marina.active_managers.each do |manager|\n if manager == current_user\n @manager = current_user\n end\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @marina }\n end\n end",
"def manager\n\t\t\t# Author\n\t\t\tauthorize! :manage, User\n\n\t\t\t@system_managers = User.search_by_type '', 'system_manager', true\n\t\t\t@user_managers = User.search_by_type '', 'user_manager', true\n\t\t\t@real_estate_managers = User.search_by_type '', 'real_estate_manager', true\n\t\t\t@project_managers = User.search_by_type '', 'project_manager', true\n\t\t\t@appraisers = User.search_by_type '', 'appraiser', true\n\t\t\t@statisticians = User.search_by_type '', 'statistician', true\n\t\tend",
"def index\n @admin_managers = Admin::Manager.all\n end",
"def set_store_manager\n @store_manager = StoreManager.find(params[:id])\n end",
"def list_customers_manager\n @manager = User.find(params[:id])\n @employees = @manager.employee\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end",
"def show\n @manager = Manager.find(params[:id])\n end",
"def show\n @admin_store = Admin::Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_store }\n end\n end",
"def index\n @stores = Store.all\n render json: @stores\n end",
"def index\n @service_managers = ServiceManager.paginate(page: params[:page])\n end",
"def index\n @stores = Store.all.includes(:admin)\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n @store_manager_statistic = Store::Manager::Statistic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_statistic }\n end\n end",
"def create\n @store_manager = StoreManager.new(store_manager_params)\n\n respond_to do |format|\n if @store_manager.save\n format.html { redirect_to @store_manager, notice: 'Store manager was successfully created.' }\n format.json { render :show, status: :created, location: @store_manager }\n else\n format.html { render :new }\n format.json { render json: @store_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @payment_managers = PaymentManager.all\n end",
"def index\n @estate_managers = EstateManager.all\n end",
"def list_stores\n @stores = Store.where(\"level = ?\", 2)\n if @stores.present?\n render :index, status: :ok\n else\n @message = \"no store found\"\n render :error, status: :not_found\n end\n end",
"def index\n @store = Store.find(params[:store_id])\n @menus = @store.menus\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @menus }\n end\n end",
"def index\n @api_v1_stores = Store.all\n json_response(@api_v1_stores)\n end",
"def show\n @store_manager_order = Store::Manager::Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_order }\n end\n end",
"def new\n @store_owner = StoreOwner.new(store_id: @store.id)\n @users = @group.users\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_owner }\n end\n end",
"def manager\n users(:jolly)\n end",
"def show\n render json: @store\n end",
"def show\n render json: @store\n end",
"def managed(manager_id)\n return Manage.where(\"manager_id = ?\", manager_id)\n end",
"def show\n @store = Store.find(params[:store_id])\n @menu = @store.menus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @menu }\n end\n end",
"def index\n @manager_associations = ManagerAssociation.all\n end",
"def managers\n find_related_frbr_objects( :is_managed_by, :which_roles?) \n end",
"def managers\n if @data_object.team_id\n Role.team_managers(@data_object.team_id)\n else\n []\n end\n end",
"def index\n @online_stores = OnlineStore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @online_stores }\n end\n end",
"def index\n @admin_stores = Store.all\n end",
"def index\n @stores = current_account.stores.find(:all)\t\n end",
"def show\n\t\t\t\t @store = Spree::Store.find(params[:id])\n\t\t\t\t respond_to do |format|\n\t\t\t\t format.html # show.html.erb\n\t\t\t\t format.json { render json: @store }\n\t\t\t\t end\n\t\t\t\t end",
"def managers\n @members = self.user_workspace_memberships.where({:manager => 1})\n @users = []\n @members.each do |member|\n @users.push member.user if member.user\n end\n return @users\n end",
"def set_manager\n @manager = Manager.find(params[:id])\n end",
"def new\n @manager = Manager.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manager }\n end\n end",
"def managers\n [] << [user_id, contact_person_name]\n end",
"def new\n @admin_store = Admin::Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_store }\n end\n end",
"def result_type\n :client_managers\n end",
"def admin_store\n\t\t@store = current_store\n\t\t@stores = Store.all.page(params[:page]).per(10)\n\t\trender :layout => 'store_application'\n\tend",
"def index\n if current_user.role?(\"admin\")\n @stores=Store.all\n else\n @stores = current_user.stores\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stores }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def set_manager\n @manager = Manager.find(params[:id])\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n @manager_account = ManagerAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manager_account }\n end\n end",
"def index\n @managers_positions = Managers::Position.all\n end",
"def index\n query = []\n unless params[:key].blank?\n query << { name: /.*#{params[:key]}.*/ }\n end\n query << {} if query.blank?\n @managers = paginate(Manager.app.and('$or' => query))\n end",
"def show\n respond_to do |format|\n format.html do\n gon.stores = [\"AppEstablishmentStore\"] \n gon.jbuilder \n end\n\n format.json { render :show }\n end \n end",
"def index\n @stores = Store.all\n @storesFollowed = Array.new\n \n @stores.each do |store|\n if (isfollowingstore? store)\n @storesFollowed << store\n\n end\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @storesFollowed }\n end\n end",
"def new\n @manager = Manager.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @manager }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @store }\n end\n end",
"def show\n @store_manager_policy = Store::Manager::Policy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_policy }\n end\n end",
"def index\n @managers_projects = ManagersProject.all\n end",
"def show\n json_response(@api_v1_store)\n end",
"def create\n @manager = Manager.new(manager_params)\n\n if @manager.save\n render :show, status: :created, location: @manager\n else\n render json: @manager.errors, status: :unprocessable_entity\n end\n end",
"def index\n #authorize! :index, @login, :message => 'Not authorized as an administrator.'\n #É preciso ir buscar a clinica do gestor atual para carregar a informação\n manager = Manager.first(:conditions => \"login_id = #{current_login.id}\")\n @clinic = manager.clinic\n\n @managers = Manager.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @managers }\n end\n end",
"def index\n employees = manager.employees.active\n render json: employees.all, each_serializer: EmployeeSerializer, status: 200\n end",
"def show\n @store_manager_policies_payment = Store::Manager::Policies::Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_policies_payment }\n end\n end",
"def set_manager\n @manager = Manager.find(params[:id])\n end",
"def new\n @store_manager_statistic = Store::Manager::Statistic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_manager_statistic }\n end\n end",
"def show\n @created_stores = @user.created_stores.search(params[:search])\n @created_stores = @created_stores.by_state(params[:state]) if params[:state].present?\n @created_stores = @created_stores.by_type(params[:type]) if params[:type].present?\n @created_stores = @created_stores.order(:name).page(params[:page])\n end",
"def index\n @job_managers = JobManager.where(job_id: @job.id)\n end",
"def update\n respond_to do |format|\n if @store_manager.update(store_manager_params)\n format.html { redirect_to @store_manager, notice: 'Store manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_manager }\n else\n format.html { render :edit }\n format.json { render json: @store_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def _managers_specials\n @_managers_specials ||= Hash.new\n end",
"def index\n\t\t@stores = Store.all\n\tend",
"def get_component_managers\n debug 'GET Component Managers.'\n path = COMP_MNGS_PATH\n resp = get_object_to_sysmgr(path)\n unless resp.status_code == Response::OK\n return nil\n end\n begin\n comp_mgrs = {}\n resp.body.each do |prop|\n objp = ObjectProperty.new(prop)\n comp_mgrs[objp.remote_object_id] = objp\n end\n return comp_mgrs\n rescue => ex\n return dump_error(ex)\n end\n end",
"def show\n\t@store = current_account.stores.find(params[:id])\n end",
"def fetch_logged_in_manager\n\n return success unless is_logged_in_manager?\n\n @manager_obj = Manager.where(id: @manager_id).first\n\n return validation_error(\n 'dm_sdav_4',\n 'invalid_api_params',\n ['invalid_manager_id'],\n GlobalConstant::ErrorAction.default\n ) if @manager_obj.blank? || @manager_obj[:status] != GlobalConstant::Manager.active_status\n\n success\n\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def destroy\n @store_manager.destroy\n respond_to do |format|\n format.html { redirect_to store_managers_url, notice: 'Store manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @store_manager_message = Store::Manager::Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_message }\n end\n end",
"def managers\n self.parent.managers\n end",
"def manager_name\n self.manager.name\n end",
"def index\n @api_v1_campaigns_managers = Api::V1::CampaignsManager.all\n end",
"def retrive_employees_by_manager\n @employees = \n if params[:manager_id].present? \n Employee.includes(:department)\n .where(manager_id: params[:manager_id])\n else\n Employee.includes(:department).all\n end\n\n render :partial => \"employees\", :object => @employees\n end",
"def index\n @projects_managers = ProjectsManager.all\n end",
"def show\n @manager_user = ManagerUser.find(params[:id])\n\n respond_to do |format| \n format.js\n format.json { render json: @manager_user }\n format.html\n end\n end",
"def show\n @online_store = OnlineStore.find(params[:id])\n @products = @online_store.products\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_store }\n end\n end",
"def index\n #@shares = Share.all\n @stores = Store.find_my_stores(session[:user_id])\n @sharedStores = Store.find_my_share_stores(session[:user_id])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shares }\n end\n end",
"def new\n @store_manager_order = Store::Manager::Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_manager_order }\n end\n end",
"def index\n @task_managers = TaskManager.all\n end",
"def isStoreManager(user) \t \t\t\t\n\t \t\t\tif user.nil?\n\t \t\t\t\treturn false\n\t \t\t\telse\n\t \t\t\t\t# returns all stores that this user is a storemanager of\n\t \t\t\t\tstores = Store.with_role(:storemanager, user)\t \t\t\t\t\n\t \t\t\t\t\n\t \t\t\t\tif stores.empty? #returns empty array, not nil\n\t \t\t\t\t\treturn false\n\t \t\t\t\telse \n\t \t\t\t\t\treturn true\n\t \t\t\t\tend\n\t \t\t\tend\n\t \t\tend",
"def manager_name\n manager.name\n end",
"def manager\n Manager\n end",
"def index\n @admins = Admin.all\n\n render json: @admins\n end",
"def list\n @list ||= manager_list\n end",
"def update\n if @manager.update(manager_params)\n render :show, status: :ok, location: @manager\n else\n render json: @manager.errors, status: :unprocessable_entity\n end\n end",
"def show\n @manager = Manager.find(params[:id])\n add_breadcrumb @manager.person.try(:first_last_name), manager_path(@manager)\n\n respond_to do |format|\n format.html {\n render :html => @manager\n } # show.html.erb\n format.json { render json: @manager, :callback => params[:callback] }\n format.js { render json: @manager, :callback => params[:callback] }\n end\n end",
"def index\n @stores = @stores.page(params[:page]).per(10)\n end"
] |
[
"0.7572758",
"0.71441805",
"0.6855907",
"0.6815052",
"0.66974133",
"0.6695657",
"0.6676692",
"0.6665478",
"0.6645525",
"0.6615003",
"0.6614031",
"0.6568612",
"0.6517625",
"0.64856637",
"0.6463473",
"0.6438148",
"0.6399849",
"0.6394502",
"0.63829434",
"0.6374996",
"0.6374236",
"0.6328847",
"0.62773293",
"0.6276897",
"0.622276",
"0.6218536",
"0.619578",
"0.6177684",
"0.61643165",
"0.61540246",
"0.6148841",
"0.6145032",
"0.61349547",
"0.61177146",
"0.60982835",
"0.6093504",
"0.60835606",
"0.60744697",
"0.6058202",
"0.6051356",
"0.6050625",
"0.60370797",
"0.6023931",
"0.60125256",
"0.6006567",
"0.6005833",
"0.60054976",
"0.5986589",
"0.5986589",
"0.5986589",
"0.5986589",
"0.59844404",
"0.5970683",
"0.59705526",
"0.59520936",
"0.5933809",
"0.5915011",
"0.59142447",
"0.59071934",
"0.5904845",
"0.59038705",
"0.59021205",
"0.5897757",
"0.5873899",
"0.5867734",
"0.5866361",
"0.58648086",
"0.5860703",
"0.5847048",
"0.58208233",
"0.58190346",
"0.58159345",
"0.5811661",
"0.5793633",
"0.57838845",
"0.57731503",
"0.57731503",
"0.57731503",
"0.57731503",
"0.57731503",
"0.5758921",
"0.5757913",
"0.57495856",
"0.57437223",
"0.57361764",
"0.57203007",
"0.57069176",
"0.5706443",
"0.5695095",
"0.5692632",
"0.56908923",
"0.5677996",
"0.5669927",
"0.5668434",
"0.5649513",
"0.5639424",
"0.56389385",
"0.5623013",
"0.56139565",
"0.55770665"
] |
0.76231325
|
0
|
GET /store_managers/1 GET /store_managers/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @store_managers = StoreManager.all\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manager }\n end\n end",
"def show\n @manager = Manager.find(params[:id])\n end",
"def show\n @store_manager_statistic = Store::Manager::Statistic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_statistic }\n end\n end",
"def _manager_list\n\t\t\t# Author\n\t\t\treturn render json: { status: 6 } if cannot? :manage, User\n\t\t\t\n\t\t\t# Check unless exists is_add, type\n\t\t\treturn render json: { status: 3 } unless params.has_key?(:is_add) && params.has_key?(:type)\n\n\t\t\tper = Rails.application.config.item_per_page\n\t\t\tpage = params.has_key?(:page) ? params[:page].to_i : 1\n\t\t\tis_add = params[:is_add] === 'true'\n\t\t\ttype = params[:type]\n\n\t\t\tusers = User.search_by_type params[:keyword], type, !is_add\n\n\t\t\tcount = users.count\n\n\t\t\treturn render json: { status: 1 } if count === 0\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0,\n\t\t\t\tresult: {\n\t\t\t\t\tlist: render_to_string(partial: 'users/manager_list', locals: { users: users.page(page, per), is_add: is_add }),\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per })\n\t\t\t\t}\n\t\t\t}\n\t\tend",
"def show\n @admin_store = Admin::Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_store }\n end\n end",
"def managers\n response = request(:get, \"/manager\")\n response_to_array(response, \"managers\", KontaktIo::Resource::Manager)\n end",
"def set_store_manager\n @store_manager = StoreManager.find(params[:id])\n end",
"def show\n\n @marina = Marina.find(params[:id])\n @marina.active_managers.each do |manager|\n if manager == current_user\n @manager = current_user\n end\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @marina }\n end\n end",
"def show\n @store_manager_order = Store::Manager::Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_order }\n end\n end",
"def list_customers_manager\n @manager = User.find(params[:id])\n @employees = @manager.employee\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end",
"def create\n @store_manager = StoreManager.new(store_manager_params)\n\n respond_to do |format|\n if @store_manager.save\n format.html { redirect_to @store_manager, notice: 'Store manager was successfully created.' }\n format.json { render :show, status: :created, location: @store_manager }\n else\n format.html { render :new }\n format.json { render json: @store_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @admin_stores = Admin::Store.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_stores }\n end\n end",
"def index\n if current_user.admin?\n @stores = Store.all\n else\n @stores = current_user.stores\n end\n\n render json: @stores\n end",
"def new\n @manager = Manager.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manager }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def index\n @api_v1_stores = Store.all\n json_response(@api_v1_stores)\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store }\n end\n end",
"def show\n render json: @store\n end",
"def new\n @store_owner = StoreOwner.new(store_id: @store.id)\n @users = @group.users\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_owner }\n end\n end",
"def show\n render json: @store\n end",
"def index\n @stores = Store.all\n render json: @stores\n end",
"def show\n\t\t\t\t @store = Spree::Store.find(params[:id])\n\t\t\t\t respond_to do |format|\n\t\t\t\t format.html # show.html.erb\n\t\t\t\t format.json { render json: @store }\n\t\t\t\t end\n\t\t\t\t end",
"def _manager_list\r\n\t\t\t# Author\r\n\t\t\tauthorize! :manage, Project\r\n\r\n\t\t\tper = Rails.application.config.item_per_page\r\n\r\n\t\t\tparams[:page] ||= 1\r\n\t\t\tparams[:page] = params[:page].to_i\r\n\r\n\t\t\tprojects = Project.manager_search_with_params params\r\n\r\n\t\t\tcount = projects.count\r\n\r\n\t\t\treturn render json: { status: 1 } if count == 0\r\n\r\n\t\t\trender json: {\r\n\t\t\t\tstatus: 0,\r\n\t\t\t\tresult: {\r\n\t\t\t\t\tlist: render_to_string(partial: 'projects/manager_list', locals: { projects: projects.page(params[:page], per) }),\r\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per, page: params[:page] })\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\tend",
"def show\n @manager_account = ManagerAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manager_account }\n end\n end",
"def show\n @store = Store.find(params[:store_id])\n @menu = @store.menus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @menu }\n end\n end",
"def new\n @store_manager_statistic = Store::Manager::Statistic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_manager_statistic }\n end\n end",
"def show\n @store = Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @store }\n end\n end",
"def new\n @manager = Manager.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @manager }\n end\n end",
"def set_manager\n @manager = Manager.find(params[:id])\n end",
"def new\n @admin_store = Admin::Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_store }\n end\n end",
"def index\n @stores = Store.all.includes(:admin)\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def index\n @service_managers = ServiceManager.paginate(page: params[:page])\n end",
"def show\n json_response(@api_v1_store)\n end",
"def index\n @store = Store.find(params[:store_id])\n @menus = @store.menus\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @menus }\n end\n end",
"def show\n @store_manager_policy = Store::Manager::Policy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_policy }\n end\n end",
"def set_manager\n @manager = Manager.find(params[:id])\n end",
"def create\n @manager = Manager.new(manager_params)\n\n if @manager.save\n render :show, status: :created, location: @manager\n else\n render json: @manager.errors, status: :unprocessable_entity\n end\n end",
"def index\n @admin_managers = Admin::Manager.all\n end",
"def index\n @payment_managers = PaymentManager.all\n end",
"def manager\n\t\t\t# Author\n\t\t\tauthorize! :manage, User\n\n\t\t\t@system_managers = User.search_by_type '', 'system_manager', true\n\t\t\t@user_managers = User.search_by_type '', 'user_manager', true\n\t\t\t@real_estate_managers = User.search_by_type '', 'real_estate_manager', true\n\t\t\t@project_managers = User.search_by_type '', 'project_manager', true\n\t\t\t@appraisers = User.search_by_type '', 'appraiser', true\n\t\t\t@statisticians = User.search_by_type '', 'statistician', true\n\t\tend",
"def show\n @store_manager_policies_payment = Store::Manager::Policies::Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_policies_payment }\n end\n end",
"def show\n respond_to do |format|\n format.html do\n gon.stores = [\"AppEstablishmentStore\"] \n gon.jbuilder \n end\n\n format.json { render :show }\n end \n end",
"def managed(manager_id)\n return Manage.where(\"manager_id = ?\", manager_id)\n end",
"def list_stores\n @stores = Store.where(\"level = ?\", 2)\n if @stores.present?\n render :index, status: :ok\n else\n @message = \"no store found\"\n render :error, status: :not_found\n end\n end",
"def show\n\t@store = current_account.stores.find(params[:id])\n end",
"def set_manager\n @manager = Manager.find(params[:id])\n end",
"def new\n @store_manager_order = Store::Manager::Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_manager_order }\n end\n end",
"def update\n respond_to do |format|\n if @store_manager.update(store_manager_params)\n format.html { redirect_to @store_manager, notice: 'Store manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_manager }\n else\n format.html { render :edit }\n format.json { render json: @store_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @store_manager_message = Store::Manager::Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_message }\n end\n end",
"def index\n @online_stores = OnlineStore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @online_stores }\n end\n end",
"def index\n @estate_managers = EstateManager.all\n end",
"def manager\n users(:jolly)\n end",
"def show\n @manager_user = ManagerUser.find(params[:id])\n\n respond_to do |format| \n format.js\n format.json { render json: @manager_user }\n format.html\n end\n end",
"def index\n @stores = current_account.stores.find(:all)\t\n end",
"def result_type\n :client_managers\n end",
"def update\n if @manager.update(manager_params)\n render :show, status: :ok, location: @manager\n else\n render json: @manager.errors, status: :unprocessable_entity\n end\n end",
"def show\n @manager = Manager.find(params[:id])\n add_breadcrumb @manager.person.try(:first_last_name), manager_path(@manager)\n\n respond_to do |format|\n format.html {\n render :html => @manager\n } # show.html.erb\n format.json { render json: @manager, :callback => params[:callback] }\n format.js { render json: @manager, :callback => params[:callback] }\n end\n end",
"def destroy\n @store_manager.destroy\n respond_to do |format|\n format.html { redirect_to store_managers_url, notice: 'Store manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @admin_stores = Store.all\n end",
"def show\n @shopping_mall = ShoppingMall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shopping_mall }\n end\n end",
"def fetch_logged_in_manager\n\n return success unless is_logged_in_manager?\n\n @manager_obj = Manager.where(id: @manager_id).first\n\n return validation_error(\n 'dm_sdav_4',\n 'invalid_api_params',\n ['invalid_manager_id'],\n GlobalConstant::ErrorAction.default\n ) if @manager_obj.blank? || @manager_obj[:status] != GlobalConstant::Manager.active_status\n\n success\n\n end",
"def show\n @online_store = OnlineStore.find(params[:id])\n @products = @online_store.products\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_store }\n end\n end",
"def show\n @data_store = DataStore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @data_store }\n end\n end",
"def admin_store\n\t\t@store = current_store\n\t\t@stores = Store.all.page(params[:page]).per(10)\n\t\trender :layout => 'store_application'\n\tend",
"def index\n query = []\n unless params[:key].blank?\n query << { name: /.*#{params[:key]}.*/ }\n end\n query << {} if query.blank?\n @managers = paginate(Manager.app.and('$or' => query))\n end",
"def create\n @manager = Manager.new(params[:manager])\n\n respond_to do |format|\n if @manager.save\n format.html { redirect_to @manager, notice: 'Manager was successfully created.' }\n #format.json { render json: @manager, status: :created, location: @manager }\n else\n format.html { render action: \"new\" }\n #format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n employees = manager.employees.active\n render json: employees.all, each_serializer: EmployeeSerializer, status: 200\n end",
"def new\n\t\t\t\t @store = Store.new\n\n\t\t\t\t respond_to do |format|\n\t\t\t\t format.html # new.html.erb\n\t\t\t\t format.json { render json: @store }\n\t\t\t\t end\n\t\t\t\t end",
"def manager_name\n self.manager.name\n end",
"def index\n #authorize! :index, @login, :message => 'Not authorized as an administrator.'\n #É preciso ir buscar a clinica do gestor atual para carregar a informação\n manager = Manager.first(:conditions => \"login_id = #{current_login.id}\")\n @clinic = manager.clinic\n\n @managers = Manager.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @managers }\n end\n end",
"def index\n @manager_associations = ManagerAssociation.all\n end",
"def new\n @store = Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store }\n end\n end",
"def new\n @store = Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store }\n end\n end",
"def new\n @store = Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store }\n end\n end",
"def new\n @store = Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store }\n end\n end",
"def new\n @store = Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store }\n end\n end",
"def new\n @online_store = OnlineStore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @online_store }\n end\n end",
"def fetch_and_validate_manager(manager_id, err_prefix = 'u_eh_m')\n return manager_not_found_response(\"#{err_prefix}:l_u_eh_fvm_1\") if manager_id.blank?\n manager = CacheManagement::Manager.new([manager_id]).fetch[manager_id]\n return manager_not_found_response(\"#{err_prefix}:l_u_eh_fvm_2\") if manager[:status] != GlobalConstant::Manager.active_status\n success_with_data(manager)\n end",
"def show\n @created_stores = @user.created_stores.search(params[:search])\n @created_stores = @created_stores.by_state(params[:state]) if params[:state].present?\n @created_stores = @created_stores.by_type(params[:type]) if params[:type].present?\n @created_stores = @created_stores.order(:name).page(params[:page])\n end",
"def show\n @general_manager = GeneralManager.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @general_manager }\n end\n end",
"def set_mstore\n @mstore = Mstore.find(params[:id])\n end",
"def manager\n @technician = Team.find(params[:id]).technicians.where(\"manager is true\").first\n respond_to do |format|\n format.html { render html: \"/technicians/#{@technician.id}\" }\n format.json { render json: @technician }\n end\n end",
"def index\n if current_user.role?(\"admin\")\n @stores=Store.all\n else\n @stores = current_user.stores\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stores }\n end\n end",
"def new\n @store_manager_policy = Store::Manager::Policy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_manager_policy }\n end\n end",
"def new\n @store = Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store }\n end\n end",
"def new\n @manager_account = ManagerAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manager_account }\n end\n end",
"def manager_name\n manager.name\n end",
"def index\n @managers_projects = ManagersProject.all\n end",
"def index\n @stores = Store.all\n @storesFollowed = Array.new\n \n @stores.each do |store|\n if (isfollowingstore? store)\n @storesFollowed << store\n\n end\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @storesFollowed }\n end\n end",
"def managers\n [] << [user_id, contact_person_name]\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 show\n @salesperson = Salesperson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @salesperson }\n end\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end"
] |
[
"0.73541504",
"0.71646",
"0.695529",
"0.6889706",
"0.68418545",
"0.68341535",
"0.6814278",
"0.67253274",
"0.67013144",
"0.667647",
"0.66573733",
"0.6656402",
"0.66502243",
"0.6604766",
"0.65105337",
"0.6472337",
"0.6472337",
"0.6472337",
"0.6472337",
"0.6467869",
"0.64596945",
"0.644535",
"0.6437653",
"0.6434101",
"0.6430351",
"0.64265126",
"0.6410183",
"0.6403862",
"0.6401661",
"0.6399083",
"0.6398327",
"0.6375619",
"0.63742226",
"0.6364719",
"0.63590395",
"0.6337271",
"0.63272285",
"0.63194937",
"0.63083535",
"0.6281211",
"0.6234549",
"0.62238693",
"0.6203086",
"0.6188557",
"0.61856884",
"0.6162552",
"0.612991",
"0.61297363",
"0.6128633",
"0.61246675",
"0.6113955",
"0.6110439",
"0.61033356",
"0.6098735",
"0.6077487",
"0.60540915",
"0.60538477",
"0.60011744",
"0.59851635",
"0.5969046",
"0.5964878",
"0.5939282",
"0.5925138",
"0.59249485",
"0.59208953",
"0.5918542",
"0.590806",
"0.59057695",
"0.59007066",
"0.58994716",
"0.5896555",
"0.5885825",
"0.5884839",
"0.58819246",
"0.58660316",
"0.58624476",
"0.58624476",
"0.58624476",
"0.58624476",
"0.58624476",
"0.58508956",
"0.5848883",
"0.5847132",
"0.583063",
"0.5826709",
"0.58260983",
"0.5820223",
"0.5811394",
"0.5801538",
"0.5783485",
"0.57721597",
"0.5760954",
"0.57580847",
"0.57562906",
"0.57556397",
"0.5740905",
"0.57396066",
"0.57396066",
"0.57396066",
"0.57396066",
"0.57396066"
] |
0.0
|
-1
|
POST /store_managers POST /store_managers.json
|
def create
@store_manager = StoreManager.new(store_manager_params)
respond_to do |format|
if @store_manager.save
format.html { redirect_to @store_manager, notice: 'Store manager was successfully created.' }
format.json { render :show, status: :created, location: @store_manager }
else
format.html { render :new }
format.json { render json: @store_manager.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @manager = Manager.new(manager_params)\n\n if @manager.save\n render :show, status: :created, location: @manager\n else\n render json: @manager.errors, status: :unprocessable_entity\n end\n end",
"def create\n @manager = Manager.new(params[:manager])\n\n respond_to do |format|\n if @manager.save\n format.html { redirect_to @manager, notice: 'Manager was successfully created.' }\n #format.json { render json: @manager, status: :created, location: @manager }\n else\n format.html { render action: \"new\" }\n #format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def store_manager_params\n params.require(:store_manager).permit(:email, :phone, :name, :location_id)\n end",
"def create\n @mstore = Mstore.new(mstore_params)\n\n respond_to do |format|\n if @mstore.save\n format.html { redirect_to @mstore, notice: 'Mstore was successfully created.' }\n format.json { render :show, status: :created, location: @mstore }\n else\n format.html { render :new }\n format.json { render json: @mstore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_store = current_user.stores.build(admin_store_params)\n respond_to do |format|\n if @admin_store.save\n format.html { redirect_to admin_store_path(@admin_store), notice: 'Store was successfully created.' }\n format.json { render :show, status: :created, location: @admin_store }\n else\n format.html { render :new }\n format.json { render json: @admin_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_manager = Admin::Manager.new(admin_manager_params)\n\n respond_to do |format|\n if @admin_manager.save\n format.html { redirect_to @admin_manager, notice: 'Manager was successfully created.' }\n format.json { render :show, status: :created, location: @admin_manager }\n else\n format.html { render :new }\n format.json { render json: @admin_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_store = Admin::Store.new(params[:admin_store])\n\n respond_to do |format|\n if @admin_store.save\n format.html { redirect_to @admin_store, notice: 'Store was successfully created.' }\n format.json { render json: @admin_store, status: :created, location: @admin_store }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @store_managers = StoreManager.all\n end",
"def set_store_manager\n @store_manager = StoreManager.find(params[:id])\n end",
"def create\n login_id = params[:manager].delete(:login_id)\n gender_id = params[:manager].delete(:gender_id)\n clinic_id = params[:manager].delete(:clinic_id)\n @manager = Manager.new(params[:manager])\n \n @manager.login_id = login_id\n @manager.gender_id = gender_id\n @manager.clinic_id = clinic_id\n\n respond_to do |format|\n if @manager.save\n format.html { redirect_to @manager, notice: 'Manager was successfully created.' }\n format.json { render json: @manager, status: :created, location: @manager }\n else\n format.html { render action: \"new\" }\n format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to admin_partners_stores_url, notice: 'Store was successfully created.' }\n format.json { render action: 'show', status: :created, location: @store }\n else\n format.html { render action: 'new' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(params[:store])\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to '/stores/admin', notice: 'Store was successfully created.' }\n format.json { render json: @store, status: :created, location: @store }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createManager\n if params[:op] == 'local'\n params_map = ActiveSupport::HashWithIndifferentAccess.new(params[:manager])\n user = Manager.new(params_map)\n if !user.save\n render 'create'\n return\n end\n session[:user_id] = user.id \n redirect_to '/managers/show' \n else\n auth = session[:auth]\n if Manager.find_by(:email => auth[\"info\"][\"email\"])\n flash[:notice] = 'Email already used.'\n redirect_to '/create'\n else\n user=Manager.create_with_omniauth(session[:auth])\n session[:user_id] = user.id\n redirect_to '/managers/show'\n end\n end\n end",
"def create\n @store = Store.new(params[:store])\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to \"/admin/stores/\"+@store.id.to_s(), notice: 'Store was successfully created.' }\n format.json { render json: @store, status: :created, location: @store }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@manager=Manager.new(model_params)\n\t\tif @manager.save\n\t\t\tredirect_to managers_path\n\t\telse\n\t\t\trender :new\n\t\tend\n\tend",
"def create\n @store = Store.new(store_params)\n\n @store.api_path = @store.name unless @store.api_path.present?\n\n # make sure the store can connect to shopify\n # will return 4xx code if shopify login is bad\n # 401 is bad api secret\n # 403 is bad api key\n # 404 implies bad store name\n\n # validate the return code\n adapter = @store.get_adapter\n return_data = adapter.validate_store(@store)\n if return_data[:return_code] != 200\n render json: return_data, :status => return_data[:return_code] and return\n end\n\n current_user.stores << @store\n\n if @store.save\n render json: @store, status: :created\n else\n render json: @store.errors, status: :unprocessable_entity\n end\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: \"Loja cadastrada com sucesso!\" }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def manager_params\n params.require(:manager).permit(:name, :address)\n end",
"def create #创建\n @manager = Manager.new(manager_params)\n\n @manager.save!\n redirect_to managers_path, notice: '操作成功'\n end",
"def create\n @estate_manager = EstateManager.new(estate_manager_params)\n\n respond_to do |format|\n if @estate_manager.save\n format.html { redirect_to @estate_manager, notice: 'Estate manager was successfully created.' }\n format.json { render :show, status: :created, location: @estate_manager }\n else\n format.html { render :new }\n format.json { render json: @estate_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(params[:store])\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, :notice => 'Store was successfully created.' }\n format.json { render :json => @store, :status => :created, :location => @store }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n @store.user_id = current_user.id\n current_user.update!(type: \"Owner\")\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to myStore_stores_path, notice: 'Store was successfully created.' }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @store_owner = StoreOwner.new(store_id: @store.id)\n @users = @group.users\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_owner }\n end\n end",
"def create\n @store_owner = StoreOwner.new(params[:store_owner])\n\n authorize! :create, @store_owner\n\n @users = @group.users\n respond_to do |format|\n if @store_owner.save\n format.html { redirect_to group_store_path(@group,@store), notice: 'Store Owner was successfully created.' }\n format.json { render json: @store_owner, status: :created, location: @store_owner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n @store.user = current_user\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'Store was successfully created.' }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def managers\n response = request(:get, \"/manager\")\n response_to_array(response, \"managers\", KontaktIo::Resource::Manager)\n end",
"def create\n @store = Store.new(params[:store])\n \n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'Store was successfully created.' }\n format.json { render json: @store, status: :created, location: @store }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @manager = Manager.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manager }\n end\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'Store was successfully created.' }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'Store was successfully created.' }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(params[:store])\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'Store was successfully created.' }\n format.json { render json: @store, status: :created, location: @store }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'Store was successfully created.' }\n format.json { render action: 'show', status: :created, location: @store }\n else\n format.html { render action: 'new' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @payment_manager = PaymentManager.new(payment_manager_params)\n\n respond_to do |format|\n if @payment_manager.save\n format.html { redirect_to @payment_manager, notice: 'Payment manager was successfully created.' }\n format.json { render :show, status: :created, location: @payment_manager }\n else\n format.html { render :new }\n format.json { render json: @payment_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(params.require(:store).permit(:break_even, :capacity, :city, :county_id, :manager_id,\n :name, :number, :number_of_lifts, :phone, :region_id,\n :state_id, :street_address, :zip))\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to stores_url,\n notice: 'Store was successfully created.' }\n format.json { render json: @store, status: :created, location: @store }\n else\n prepFormVariables\n format.html { render action: \"new\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t\t\t @store = Store.new(params[:store])\n\n\t\t\t\t respond_to do |format|\n\t\t\t\t if @store.save\n\t\t\t\t\tformat.html { redirect_to @store, notice: 'Store was successfully created.' }\n\t\t\t\t\tformat.json { render json: @store, status: :created, location: @store }\n\t\t\t\t else\n\t\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\t\tformat.json { render json: @store.errors, status: :unprocessable_entity }\n\t\t\t\t end\n\t\t\t\t end\n\t\t\t\t end",
"def new\n @manager = Manager.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @manager }\n end\n end",
"def new\n @admin_store = Admin::Store.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_store }\n end\n end",
"def create\n @store_manager_order = Store::Manager::Order.new(params[:store_manager_order])\n\n respond_to do |format|\n if @store_manager_order.save\n format.html { redirect_to @store_manager_order, notice: 'Order was successfully created.' }\n format.json { render json: @store_manager_order, status: :created, location: @store_manager_order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store_manager_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @employee =\n Employee.new(employee_params.merge({ manager_id: params[:manager_id] }))\n\n if @employee.save\n @employee.active!\n render json: @employee, status: :created\n else\n render json: @employee.errors, status: :unprocessable_entity\n end\n end",
"def create\n @todo_manager = TodoManager.new(todo_manager_params)\n\n respond_to do |format|\n if @todo_manager.save\n format.html { redirect_to @todo_manager, notice: 'Todo manager was successfully created.' }\n format.json { render :show, status: :created, location: @todo_manager }\n else\n format.html { render :new }\n format.json { render json: @todo_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @manager = Manager.create(manager_params)\n\n respond_to do |format|\n if @manager.save\n format.html { redirect_to '/administrator/managers', notice: 'Product category was successfully created.' }\n format.json { render :show, status: :created, location: @manager }\n else\n format.html { render :new }\n format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_manager\n @manager = Manager.find(params[:id])\n end",
"def create\n @store = Store.new(params[:admin_store])\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to([:admin,@store], :notice => 'Store was successfully created.') }\n format.xml { render :xml => @store, :status => :created, :location => @store }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'Store was successfully created.' }\n params[:books].each{\n |id|\n StoreBook.create(:store_id=>@store.id,:book_id=>id)\n }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assign_manager\n \tuser = User.find(params[:user_id].to_i)\n manager = user.my_manager\n \tif manager.blank?\n\t UserLeadGenerator.create(user_id: params[:manager_id], lead_generator_id: user.id)\t\t\n else\n manager.update_attributes(user_id: params[:manager_id])\n end\t\t\n \tredirect_to admin_list_users_path\n end",
"def create\n @store_manager_statistic = Store::Manager::Statistic.new(params[:store_manager_statistic])\n\n respond_to do |format|\n if @store_manager_statistic.save\n format.html { redirect_to @store_manager_statistic, notice: 'Statistic was successfully created.' }\n format.json { render json: @store_manager_statistic, status: :created, location: @store_manager_statistic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store_manager_statistic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def _manager_list\n\t\t\t# Author\n\t\t\treturn render json: { status: 6 } if cannot? :manage, User\n\t\t\t\n\t\t\t# Check unless exists is_add, type\n\t\t\treturn render json: { status: 3 } unless params.has_key?(:is_add) && params.has_key?(:type)\n\n\t\t\tper = Rails.application.config.item_per_page\n\t\t\tpage = params.has_key?(:page) ? params[:page].to_i : 1\n\t\t\tis_add = params[:is_add] === 'true'\n\t\t\ttype = params[:type]\n\n\t\t\tusers = User.search_by_type params[:keyword], type, !is_add\n\n\t\t\tcount = users.count\n\n\t\t\treturn render json: { status: 1 } if count === 0\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0,\n\t\t\t\tresult: {\n\t\t\t\t\tlist: render_to_string(partial: 'users/manager_list', locals: { users: users.page(page, per), is_add: is_add }),\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per })\n\t\t\t\t}\n\t\t\t}\n\t\tend",
"def create\n @store = Store.new(store_params)\n @store.commerce = @commerce\n @seller = Seller.new\n respond_to do |format|\n if @store.save\n @seller.store=@store\n @seller.commerce = @commerce\n @seller.user_id=current_user.id\n @seller.slug=current_user.cedula\n puts \"DATOS DE VENDEDOR *******\"\n puts @seller.to_json\n @seller.save\n format.html { redirect_to owner_commerce_stores_path(@store.commerce.slug), notice: 'Tienda creada exitosamente.' }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to account_stores_path(account_id: current_account.id), notice: 'Store was successfully created.' }\n format.json { render action: 'show', status: :created, location: @store }\n else\n format.html { render action: 'new' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def manager_params\n params.require(:manager).permit(:name, :surname, :phone)\n end",
"def create\n @manager_association = ManagerAssociation.new(manager_association_params)\n\n respond_to do |format|\n if @manager_association.save\n format.html { redirect_to @manager_association, notice: 'Manager association was successfully created.' }\n format.json { render :show, status: :created, location: @manager_association }\n else\n format.html { render :new }\n format.json { render json: @manager_association.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @store_manager.destroy\n respond_to do |format|\n format.html { redirect_to store_managers_url, notice: 'Store manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @store_manager.update(store_manager_params)\n format.html { redirect_to @store_manager, notice: 'Store manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_manager }\n else\n format.html { render :edit }\n format.json { render json: @store_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def manager_params\n params.fetch(:manager, {}).permit!\n end",
"def create\n @store_add = StoreAdd.new(store_add_params)\n\n respond_to do |format|\n if @store_add.save\n format.html { redirect_to @store_add, notice: 'Store add was successfully created.' }\n format.json { render :show, status: :created, location: @store_add }\n else\n format.html { render :new }\n format.json { render json: @store_add.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_manager\n @manager = Manager.find(params[:id])\n end",
"def create\n @general_manager = GeneralManager.new(params[:general_manager])\n\n respond_to do |format|\n if @general_manager.save\n format.html { redirect_to(@general_manager, :notice => 'General manager was successfully created.') }\n format.xml { render :xml => @general_manager, :status => :created, :location => @general_manager }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @general_manager.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @task_manager = TaskManager.new(task_manager_params)\n\n respond_to do |format|\n if @task_manager.save\n format.html { redirect_to @task_manager, notice: 'Task manager was successfully created.' }\n format.json { render :show, status: :created, location: @task_manager }\n else\n format.html { render :new }\n format.json { render json: @task_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def managers\n [] << [user_id, contact_person_name]\n end",
"def create_manager\n user = User.new(first_name: \"Ralph\", last_name: \"Wiggum\", username: \"rwiggum\", email: \"chris+rwiggum@cryptographi.com\", password: 'muffins1', password_confirmation: 'muffins1', job_title: 'Manager')\n company_domain = \"cryptographi.com\"\n team = Team.find_by(domain_name: company_domain)\n if !team\n create_admin\n end\n user.team = team\n manager = User.find_by(email: 'chris+jsmith@cryptographi.com')\n user.manager_id = manager.id\n if user.save\n user.add_role :manager\n end\n end",
"def create(add_params = nil)\n params = {\n }\n api_call('/stores(.:format)',:post,params,add_params)\n end",
"def create\n @bread_store = BreadStore.new(bread_store_params)\n @bread_store.bread_store_manager_id = current_bread_store_manager.id\n\n respond_to do |format|\n if @bread_store.save\n format.html { redirect_to @bread_store, notice: 'パン屋を作成した.' }\n format.json { render action: 'show', status: :created, location: @bread_store }\n else\n format.html { redirect_to bread_store_managers_url, notice_error: 'エラーが発生した。'}\n end\n end\n end",
"def store_params\n params.require(:store).permit(:access_token, :name)\n end",
"def create_manager\n #@event_user = EventUser.new(event_user_params)\n @event_user = EventUser.new(event: @event)\n authorize @event_user\n\n @event_user.user = User.find(permitted_attributes(@event_user)[:user])\n @event_user.role = EventUser.roles[:organizador]\n\n respond_to do |format|\n if @event_user.save\n format.html { redirect_to admin_event_users_path(:code => @event.code),\n notice: 'Paticipante foi CRIADO com sucesso.' }\n format.json { render :show, status: :created, location:[:admin, @event_user] }\n else\n format.html {\n flash[:Error] = \"O Organizador já está inscrito no evento.\"\n redirect_to new_manager_admin_event_users_path(:code => @event.code)}\n format.json { render json: [:admin, @event_user].errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to [:phone, @store], notice: 'Store was successfully created.' }\n format.json { render action: 'show', status: :created, location: @store }\n else\n format.html { render action: 'new' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n begin\n @api_v1_store = Store.create!(api_v1_store_params)\n\n json_response @api_v1_store, :created\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def create\n @itemstore = ItemStore.new(item_store_params)\n\n respond_to do |format|\n if @itemstore.save\n format.html { redirect_to @itemstore, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @itemstore }\n else\n format.html { render :new }\n format.json { render json: @itemstore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_manager\n self.manager = Manager.where(email: regestrar_details[\"email\"]).first\n\n unless manager\n self.manager = Manager.create(email: regestrar_details[\"email\"], password: DEFAULT_PASSWORD, password_confirmation: DEFAULT_PASSWORD)\n end\n end",
"def new\n @store_manager_order = Store::Manager::Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_manager_order }\n end\n end",
"def manager=(user)\n self.manager_id = user.id\n end",
"def create\n # @account_manager = AccountManager.new(params[:account_manager])\n\n # respond_to do |format|\n # if @account_manager.save\n # format.html { redirect_to @account_manager, notice: 'Account manager was successfully created.' }\n # format.json { render json: @account_manager, status: :created, location: @account_manager }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @account_manager.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manager }\n end\n end",
"def create\n @league = League.find(params[:league_id])\n @team = Team.new(params[:team])\n @team.league = @league\n\n # Manager needs to be sent the email to come manage his team.\n # If he needs to sign-up, then he will be directed at the signup_before_action pat\n email = @team.manager_email_address\n\n @team.managers.push(manager_account = Account.create_pending_or_find_existing(email))\n\n respond_to do |format|\n if @team.save\n url_for_manager = team_path(@team)\n\n # The manager is a pending manager so we need to send the link through the onboard url\n if (manager_account.pending?)\n description = \"league_teams/new_manager_description\"\n url_for_manager = onboard_new_account_path_generator(manager_account, url_for_manager, description)\n end\n\n manager_account.send_invite!(:team_created, :team_id => @team.id, :url => url_for_manager)\n\n format.html { redirect_to @team, notice: 'Team was successfully created. Manager was emailed a link to the team.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_manager\n @manager = Manager.find(params[:id])\n end",
"def create\n @manager_session = ManagerSession.create(ManagerSession.all_sessions_endpoint)\n respond_to do |format|\n format.html { redirect_to manager_sessions_path }\n format.json { render :show, status: :created, location: @manager_session }\n end\n if @manager_session.count > 50000000\n @manager_session.first.delete\n end\n end",
"def create\n @manager_account = ManagerAccount.new(params[:manager_account])\n\n respond_to do |format|\n if @manager_account.save\n format.html { redirect_to @manager_account, notice: 'Manager account was successfully created.' }\n format.json { render json: @manager_account, status: :created, location: @manager_account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @manager_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n if params[:product][:store_ids].present?\n params[:product][:store_ids].each do |store_id|\n unless store_id.empty?\n store = Store.find(store_id)\n @product.stores << store\n end\n end\n end\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: \"Product was successfully created.\" }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store_manager_policy = Store::Manager::Policy.new(params[:store_manager_policy])\n\n respond_to do |format|\n if @store_manager_policy.save\n format.html { redirect_to @store_manager_policy, notice: 'Policy was successfully created.' }\n format.json { render json: @store_manager_policy, status: :created, location: @store_manager_policy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store_manager_policy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @manager.update(manager_params)\n render :show, status: :ok, location: @manager\n else\n render json: @manager.errors, status: :unprocessable_entity\n end\n end",
"def create\n @store = current_owner.stores.build(store_params)\n @store.owner = current_owner\n\n # @store = Store.find(params[:id])\n @comment = @store.comments.build\n #tenemos que mostrar todos los comentarios del post y pasarlos a la vista\n @comments = @store.comments.includes(:user).all.reverse #muestra el arreglo de todos los comentarios\n\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store}\n format.json { render :show, status: :created, store: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job_manager = JobManager.new(job_manager_params)\n @job_manager.job_id = @job.id\n\n respond_to do |format|\n if @job_manager.job_manager_id && @job_manager.save\n @job.pipeline_status_id = 2\n @job.save\n @user = @job_manager.job_manager\n @job.track 'Manager Assigned', current_user, @job_manager\n if @user.email\n UserMailer.manager_assignment(@user, @job_manager).deliver_later\n end\n format.html { redirect_to job_job_managers_path(@job), notice: 'Job manager was successfully created.' }\n format.json { render :show, status: :created, location: @job_manager }\n else\n format.html { render :new }\n format.json { render json: @job_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @admin_stores = Admin::Store.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_stores }\n end\n end",
"def manager_params\n params[:manager][:name] ||= \"user#{Manager.auto_increment_value}\"\n\n unless params[:manager][:password]\n token = Devise.friendly_token\n params[:manager][:password] ||= token\n params[:manager][:password_confirmation] ||= token\n params[:manager][:invite_confirmation_token] ||= token\n end\n\n params.require(:manager).permit(:name, :email, :password, :password_confirmation, :invite_confirmation_token)\n end",
"def create\n @mall = Mall.new(mall_params)\n shops_in_mall = Shop.where(id: JSON.parse(params[:mall][:shops_in_mall])) if params[:mall][:shops_in_mall]\n @mall.shops << shops_in_mall\n\n respond_to do |format|\n if @mall.save\n format.html { redirect_to director_malls_path, notice: 'Mall was successfully created.' }\n format.json { render :show, status: :created, location: @mall }\n else\n format.html {\n @shops = Shop.to_options.to_json\n render :new\n }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @store_manager_statistic = Store::Manager::Statistic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_manager_statistic }\n end\n end",
"def create\n @text_manager = TextManager.new(text_manager_params)\n\n respond_to do |format|\n if @text_manager.save\n format.html { redirect_to text_managers_path, notice: 'Text manager was successfully created.' }\n format.json { render action: 'index', status: :created, location: @text_manager }\n else\n format.html { render action: 'new' }\n format.json { render json: @text_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.find(params[:store_id])\n @menu = @store.menus.create(params[:menu])\n\n respond_to do |format|\n if @menu.save\n format.html { redirect_to store_menus_url(@store), notice: 'Menu was successfully created.' }\n format.json { render json: @menu, status: :created, location: @menu }\n else\n format.html { render action: \"new\" }\n format.json { render json: @menu.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(params[:store])\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to(@store, :notice => 'Store was successfully created.') }\n format.xml { render :xml => @store, :status => :created, :location => @store }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @store = Store.find(params[:store_id])\n @menu = @store.menus.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @menu }\n end\n end",
"def new\n\t\t\t\t @store = Store.new\n\n\t\t\t\t respond_to do |format|\n\t\t\t\t format.html # new.html.erb\n\t\t\t\t format.json { render json: @store }\n\t\t\t\t end\n\t\t\t\t end",
"def create\n \n @store_detail = StoreDetail.new(store_detail_params)\n @store_detail.member =current_member\n authorize @store_detail, :create?\n MemberMailer.welcome_store_email(@store_detail).deliver!\n logger = MyLogger.instance\n logger.storeInformation(@store_detail.store_name)\n respond_to do |format|\n if @store_detail.save\n format.html { redirect_to @store_detail, notice: 'Store detail was successfully created.' }\n format.json { render :show, status: :created, location: @store_detail }\n else\n format.html { render :new }\n format.json { render json: @store_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop = Shop.new(shop_params)\n @shopkeeper = current_user.shopkeeper\n @shop.shopkeeper_id = @shopkeeper.id\n\n if @shop.save\n render json: @shop, status: :created, location: @shop\n else\n render json: @shop.errors, status: :unprocessable_entity\n end\n end",
"def new\n @store_manager_policy = Store::Manager::Policy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_manager_policy }\n end\n end",
"def create_managers\n @managers = configuration.managers.each_with_object({}) do |(name, configurator), hash|\n hash[name] = ObjectManager.new(name, self, &configurator)\n end\n end",
"def index\n @payment_managers = PaymentManager.all\n end",
"def create\n @storepromotion = Storepromotion.new(storepromotion_params)\n\n respond_to do |format|\n if @storepromotion.save\n format.html { redirect_to @storepromotion, notice: 'Storepromotion was successfully created.' }\n format.json { render :show, status: :created, location: @storepromotion }\n else\n format.html { render :new }\n format.json { render json: @storepromotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def admin_store_params\n params.require(:store).permit(:name)\n end",
"def manager\n end",
"def manager\n end",
"def list_customers_manager\n @manager = User.find(params[:id])\n @employees = @manager.employee\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end"
] |
[
"0.69857246",
"0.6829435",
"0.6551086",
"0.6466746",
"0.6425457",
"0.6420798",
"0.6373931",
"0.63274926",
"0.62881345",
"0.62680864",
"0.62455356",
"0.62400454",
"0.6219898",
"0.6170301",
"0.61547476",
"0.6133173",
"0.61242354",
"0.6064748",
"0.60476995",
"0.60435224",
"0.60328317",
"0.6032497",
"0.60321367",
"0.60246176",
"0.6021559",
"0.6006375",
"0.60009253",
"0.59851766",
"0.5968028",
"0.5968028",
"0.5962672",
"0.5953748",
"0.5936018",
"0.59308314",
"0.5929752",
"0.59186786",
"0.5904316",
"0.59011805",
"0.5895152",
"0.5886279",
"0.5870736",
"0.5867883",
"0.58655524",
"0.5831197",
"0.5826417",
"0.58147675",
"0.5811545",
"0.5796329",
"0.57956743",
"0.5795205",
"0.5795082",
"0.5793995",
"0.5792397",
"0.57746506",
"0.57732713",
"0.57702994",
"0.57237273",
"0.57113004",
"0.57067925",
"0.56896913",
"0.56748885",
"0.56725216",
"0.5659536",
"0.56453",
"0.5636485",
"0.5632961",
"0.5626267",
"0.5622055",
"0.56152153",
"0.5605616",
"0.560039",
"0.55876833",
"0.5587433",
"0.5579302",
"0.55783087",
"0.5575062",
"0.55660385",
"0.5565398",
"0.5549858",
"0.5530524",
"0.55297697",
"0.5512786",
"0.54977363",
"0.54929245",
"0.5488665",
"0.54774326",
"0.54556584",
"0.54440916",
"0.542983",
"0.5429543",
"0.54265344",
"0.5425459",
"0.54140633",
"0.54117525",
"0.54059136",
"0.54057527",
"0.5402228",
"0.5400015",
"0.5400015",
"0.5389477"
] |
0.75044817
|
0
|
PATCH/PUT /store_managers/1 PATCH/PUT /store_managers/1.json
|
def update
respond_to do |format|
if @store_manager.update(store_manager_params)
format.html { redirect_to @store_manager, notice: 'Store manager was successfully updated.' }
format.json { render :show, status: :ok, location: @store_manager }
else
format.html { render :edit }
format.json { render json: @store_manager.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n if @manager.update(manager_params)\n render :show, status: :ok, location: @manager\n else\n render json: @manager.errors, status: :unprocessable_entity\n end\n end",
"def update\n @manager = Manager.find(params[:id])\n\n respond_to do |format|\n if @manager.update_attributes(params[:manager])\n format.html { redirect_to @manager, notice: 'Manager was successfully updated.' }\n #format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n #format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @store.update(store_params)\n render json: @store\n else\n render json: @store.errors, status: :unprocessable_entity\n end\n end",
"def update\n @manager = current_manager.rolable\n\n respond_to do |format|\n if @manager.update_attributes(params[:manager])\n format.html { redirect_to manager_root_path, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mstore.update(mstore_params)\n format.html { redirect_to @mstore, notice: 'Mstore was successfully updated.' }\n format.json { render :show, status: :ok, location: @mstore }\n else\n format.html { render :edit }\n format.json { render json: @mstore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n login_id = params[:manager].delete(:login_id)\n gender_id = params[:manager].delete(:gender_id)\n clinic_id = params[:manager].delete(:clinic_id)\n @manager = Manager.find(params[:id])\n\n @manager.login_id = login_id\n @manager.gender_id = gender_id\n @manager.clinic_id = clinic_id\n\n respond_to do |format|\n if @manager.update_attributes(params[:manager])\n format.html { redirect_to @manager, notice: 'Manager was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n @api_v1_store.update!(api_v1_store_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def update\n @admin_store = Admin::Store.find(params[:id])\n\n respond_to do |format|\n if @admin_store.update_attributes(params[:admin_store])\n format.html { redirect_to @admin_store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to '/stores/admin', notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to stores_path, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store }\n format.json { render :show, status: :ok, store: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to [:phone, @store], notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params.require(:store).permit(:break_even, :capacity, :city, :county_id, :manager_id,\n :name, :number, :number_of_lifts, :phone, :region_id,\n :state_id, :street_address, :zip))\n format.html { redirect_to stores_url,\n notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n prepFormVariables\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to @store, :notice => 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_store.update(admin_store_params)\n format.html { redirect_to @admin_store, notice: 'Store was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_store }\n else\n format.html { render :edit }\n format.json { render json: @admin_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to action 'show', notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n # update shops\n shops_edit = JSON.parse(params[:mall][:shops_in_mall])\n\n respond_to do |format|\n if @mall.update_with_shops(mall_params, shops_edit)\n format.html { redirect_to director_malls_path, notice: 'Mall was successfully updated.' }\n format.json { render :show, status: :ok, location: @mall }\n else\n format.html {\n @shops = Shop.to_options.to_json\n @shops_in_mall = @mall.shops.to_options.to_json\n render :edit\n }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store_manager_order = Store::Manager::Order.find(params[:id])\n\n respond_to do |format|\n if @store_manager_order.update_attributes(params[:store_manager_order])\n format.html { redirect_to @store_manager_order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store_manager_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to account_stores_path(account_id: current_account.id), notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @manager.update(manager_params)\n format.html { redirect_to home_index_url, notice: \"The profile of the manager #{@manager.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t\t\t @store = Store.find(params[:id])\n\n\t\t\t\t respond_to do |format|\n\t\t\t\t if @store.update_attributes(params[:store])\n\t\t\t\t\tformat.html { redirect_to @store, notice: 'Store was successfully updated.' }\n\t\t\t\t\tformat.json { head :no_content }\n\t\t\t\t else\n\t\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\t\tformat.json { render json: @store.errors, status: :unprocessable_entity }\n\t\t\t\t end\n\t\t\t\t end\n\t\t\t\t end",
"def update\n authorize @store_detail, :update?\n respond_to do |format|\n if @store_detail.update(store_detail_params)\n format.html { redirect_to @store_detail, notice: 'Store detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_detail }\n else\n format.html { render :edit }\n format.json { render json: @store_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store, notice: \"Loja atualizada com sucesso!\" }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @todo_manager.update(todo_manager_params)\n format.html { redirect_to @todo_manager, notice: 'Todo manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @todo_manager }\n else\n format.html { render :edit }\n format.json { render json: @todo_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store_manager_statistic = Store::Manager::Statistic.find(params[:id])\n\n respond_to do |format|\n if @store_manager_statistic.update_attributes(params[:store_manager_statistic])\n format.html { redirect_to @store_manager_statistic, notice: 'Statistic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store_manager_statistic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @manager = Manager.find(params[:id])\n if @manager.update(model_params)\n redirect_to manager_path(@manager)\n else\n render :edit\n end\n end",
"def update!(**args)\n @manager_customer = args[:manager_customer] if args.key?(:manager_customer)\n @manager_link_id = args[:manager_link_id] if args.key?(:manager_link_id)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @status = args[:status] if args.key?(:status)\n end",
"def update\n respond_to do |format|\n if @store_add.update(store_add_params)\n format.html { redirect_to @store_add, notice: 'Store add was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_add }\n else\n format.html { render :edit }\n format.json { render json: @store_add.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n @stores = Store.by_id\n format.js {render layout: false, notice: 'Se modificó el estado de la tienda.'}\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @storeinfo.update(storeinfo_params)\n format.html { redirect_to @storeinfo, notice: 'Storeinfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @storeinfo }\n else\n format.html { render :edit }\n format.json { render json: @storeinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store_status.update(store_status_params)\n format.html { redirect_to @store_status, notice: 'Store status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:admin_store])\n format.html { redirect_to([:admin,@store], :notice => 'Store was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_manager.update(admin_manager_params)\n format.html { redirect_to @admin_manager, notice: 'Manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_manager }\n else\n format.html { render :edit }\n format.json { render json: @admin_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @manager.update(manager_params)\n format.html { redirect_to '/administrator/managers', notice: 'Product category was successfully updated.' }\n format.json { render :show, status: :ok, location: @manager }\n else\n format.html { render :edit }\n format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_campaigns_manager.update(api_v1_campaigns_manager_params)\n format.html { redirect_to @api_v1_campaigns_manager, notice: 'Campaigns manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_campaigns_manager }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_campaigns_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @itemstore.update(item_store_params)\n format.html { redirect_to @itemstore, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @itemstore }\n else\n format.html { render :edit }\n format.json { render json: @itemstore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n params[:books].each{\n |id|\n StoreBook.create(:store_id=>@store.id,:book_id=>id)\n }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n attributes = fulfillment_bill_params.clone\n puts attributes\n @store = Store.find(attributes[\"store_id\"])\n puts \"Found Store = #{@store.StoreName}\" if !@store.nil?\n attributes = attributes.merge(\"store_name\" => @store.StoreName)\n puts attributes\n respond_to do |format|\n if @fulfillment_bill.update(attributes)\n format.html { redirect_to @fulfillment_bill, notice: 'Fulfillment bill was successfully updated.' }\n format.json { render :show, status: :ok, location: @fulfillment_bill }\n else\n format.html { render :edit }\n format.json { render json: @fulfillment_bill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @online_store = OnlineStore.find(params[:id])\n\n respond_to do |format|\n if @online_store.update_attributes(online_store_params)\n format.html { redirect_to @online_store, notice: 'Online store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @online_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to admin_pin_path(@store), notice: t('views.admin.stores.pin_edited_successfully') }\n else\n flash.now[:alert] = @store.errors.full_messages\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store_item.update(store_item_params)\n format.html { redirect_to @store_item, notice: 'Store item was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_item }\n else\n format.html { render :edit }\n format.json { render json: @store_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @estate_manager.update(estate_manager_params)\n format.html { redirect_to @estate_manager, notice: 'Estate manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @estate_manager }\n else\n format.html { render :edit }\n format.json { render json: @estate_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_store_manager\n @store_manager = StoreManager.find(params[:id])\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to(@store, :notice => 'Store was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task_manager.update(task_manager_params)\n format.html { redirect_to @task_manager, notice: 'Task manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_manager }\n else\n format.html { render :edit }\n format.json { render json: @task_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @store.slug=nil\n if @store.update(store_params)\n format.html { redirect_to owner_commerce_stores_path(@store.commerce.slug), notice: 'Tienda actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store_manager_policy = Store::Manager::Policy.find(params[:id])\n\n respond_to do |format|\n if @store_manager_policy.update_attributes(params[:store_manager_policy])\n format.html { redirect_to @store_manager_policy, notice: 'Policy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store_manager_policy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @manager = Manager.find(params[:id])\n end",
"def update\n @general_manager = GeneralManager.find(params[:id])\n\n respond_to do |format|\n if @general_manager.update_attributes(params[:general_manager])\n format.html { redirect_to(@general_manager, :notice => 'General manager was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @general_manager.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit_store(edited_store)\n store = Store.find(edited_store.uid)\n store.attributes = edited_store.attributes\n store.save!\n end",
"def update\n stores = []\n if params[:product][:store_ids].present?\n params[:product][:store_ids].each do |store_id|\n unless store_id.empty?\n store = Store.find(store_id)\n stores << store\n end\n end\n end\n\n unless stores.empty?\n @product.stores = stores\n else\n @product.stores.clear\n end\n \n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: \"Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_manager.update(job_manager_params)\n @user = @job_manager.job_manager\n if @user.email\n UserMailer.manager_assignment(@user, @job_manager).deliver_later\n end\n format.html { redirect_to job_job_managers_path(@job), notice: 'Job manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_manager }\n else\n format.html { render :edit }\n format.json { render json: @job_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book_store.update(book_store_params)\n format.html { redirect_to @book_store, notice: 'Book store was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_store }\n else\n format.html { render :edit }\n format.json { render json: @book_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_manager\n @manager = Manager.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @storepromotion.update(storepromotion_params)\n format.html { redirect_to @storepromotion, notice: 'Storepromotion was successfully updated.' }\n format.json { render :show, status: :ok, location: @storepromotion }\n else\n format.html { render :edit }\n format.json { render json: @storepromotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @manager_association.update(manager_association_params)\n format.html { redirect_to @manager_association, notice: 'Manager association was successfully updated.' }\n format.json { render :show, status: :ok, location: @manager_association }\n else\n format.html { render :edit }\n format.json { render json: @manager_association.errors, status: :unprocessable_entity }\n end\n end\n end",
"def store_manager_params\n params.require(:store_manager).permit(:email, :phone, :name, :location_id)\n end",
"def update\n @store_manager_message = Store::Manager::Message.find(params[:id])\n\n respond_to do |format|\n if @store_manager_message.update_attributes(params[:store_manager_message])\n format.html { redirect_to @store_manager_message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store_manager_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cakestore.update(cakestore_params)\n format.html { redirect_to @cakestore, notice: 'Cakestore was successfully updated.' }\n format.json { render :show, status: :ok, location: @cakestore }\n else\n format.html { render :edit }\n format.json { render json: @cakestore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fetch_manager_to_be_updated\n\n @manager_to_be_updated_obj = Manager.where(id: @to_update_client_manager.manager_id).first\n\n return validation_error(\n 's_mm_sa_usar_3',\n 'resource_not_found',\n [],\n GlobalConstant::ErrorAction.default\n ) if @manager_to_be_updated_obj.blank?\n\n return validation_error(\n 's_mm_sa_usar_4',\n 'invalid_api_params',\n ['to_update_client_manager_id_inactive'],\n GlobalConstant::ErrorAction.default\n ) if @manager_to_be_updated_obj.status != GlobalConstant::Manager.active_status\n\n success\n\n end",
"def update(add_params = nil)\n params = {\n uid: uid,\n }\n api_call('/stores/:uid(.:format)',:put,params,add_params)\n end",
"def update\n authorize! :update, @user, :message => t('errors.messages.not_authorized_as_manager')\n @marina = Marina.find(params[:id])\n\n respond_to do |format|\n if @marina.update_attributes(params[:marina])\n format.html { redirect_to @marina, notice: 'Marina was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @marina.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @indirect_manager = args[:indirect_manager] if args.key?(:indirect_manager)\n @metadata = args[:metadata] if args.key?(:metadata)\n @status = args[:status] if args.key?(:status)\n end",
"def update\n @bread_store.bread_store_manager_id = current_bread_store_manager.id\n respond_to do |format|\n if @bread_store.update(bread_store_params)\n format.html { redirect_to @bread_store, notice: 'パン屋情報を編集した.' }\n format.json { head :no_content }\n else\n format.html { redirect_to @bread_store, notice_error: 'エラーが発生した。'}\n end\n end\n end",
"def update_store_with_http_info(store_id, request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StoresApi.update_store ...\"\n end\n # verify the required parameter 'store_id' is set\n fail ArgumentError, \"Missing the required parameter 'store_id' when calling StoresApi.update_store\" if store_id.nil?\n # verify the required parameter 'request' is set\n fail ArgumentError, \"Missing the required parameter 'request' when calling StoresApi.update_store\" if request.nil?\n # resource path\n local_var_path = \"/v2/user/customer/stores/{storeId}\".sub('{format}','json').sub('{' + 'storeId' + '}', store_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(request)\n auth_names = ['api_key']\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: StoresApi#update_store\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n authorize @payment_manager\n respond_to do |format|\n if @payment_manager.update(payment_manager_params)\n format.html { redirect_to @payment_manager, notice: 'Payment manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment_manager }\n else\n format.html { render :edit }\n format.json { render json: @payment_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store_manager_policies_payment = Store::Manager::Policies::Payment.find(params[:id])\n\n respond_to do |format|\n if @store_manager_policies_payment.update_attributes(params[:store_manager_policies_payment])\n format.html { redirect_to @store_manager_policies_payment, notice: 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store_manager_policies_payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_manager\n @manager = Manager.find(params[:id])\n end",
"def create\n @store_manager = StoreManager.new(store_manager_params)\n\n respond_to do |format|\n if @store_manager.save\n format.html { redirect_to @store_manager, notice: 'Store manager was successfully created.' }\n format.json { render :show, status: :created, location: @store_manager }\n else\n format.html { render :new }\n format.json { render json: @store_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @promo = Promo.find(params[:id])\n brand = Brand.find(params[:promo][:brand_id])\n @promo.stores = brand.stores\n respond_to do |format|\n if @promo.update_attributes(params[:promo])\n format.html { redirect_to @promo, notice: 'Promo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @promo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n format.html { redirect_to controller: \"sites\", action: \"checklists_manager\" }\n format.json { head :no_content }\n end\n end",
"def set_api_v1_store\n begin\n @api_v1_store = Store.find(params[:id])\n rescue => ex\n json_response({error: ex.message}, :not_found)\n end\n end",
"def update\n if @store.update(store_update_params)\n render :show, status: :ok\n else\n @message = @store.errors\n render :error, status: :unprocessable_entity\n end\n end",
"def update\n @manager_account = ManagerAccount.find(params[:id])\n\n respond_to do |format|\n if @manager_account.update_attributes(params[:manager_account])\n format.html { redirect_to @manager_account, notice: 'Manager account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manager_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n staff = Staff.find(params[:id])\n #assign new attributes\n staff.assign_attributes(staff_params)\n ## check for any validations \n if staff.valid?\n staff.save \n render json: staff\n else \n reder json: staff.errors.full_messages\n end \n\n end",
"def update\n @store = Store.find(params[:id])\n @store.categories = Category.find(params[:category_ids]) if params[:category_ids]\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to(@store, :notice => 'Store was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @store_detail = StoreDetail.find(params[:store_detail_id])\n @addon = Addon.find(params[:id])\n respond_to do |format|\n if @addon.update(addon_params)\n format.html { redirect_to store_detail_addon_url, notice: 'addon detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @addon }\n else\n format.html { render :edit }\n format.json { render json: @addon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end",
"def update\n respond_to do |format|\n if @contact_store.update(contact_store_params)\n format.html { redirect_to @contact_store, notice: 'Contact store was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact_store }\n else\n format.html { render :edit }\n format.json { render json: @contact_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store_to_visit.update(store_to_visit_params)\n format.html { redirect_to root_path, notice: 'Store to visit was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_to_visit }\n else\n format.html { render :edit }\n format.json { render json: @store_to_visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @data_store = DataStore.find(params[:id])\n\n respond_to do |format|\n if @data_store.update_attributes(params[:data_store])\n format.html { redirect_to @data_store.data_source, notice: 'Data store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @data_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offers_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store_order.update(store_order_params)\n format.html { redirect_to @store_order, notice: 'Store order was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_order }\n else\n format.html { render :edit }\n format.json { render json: @store_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store_transaction.update(store_transaction_params)\n format.html { redirect_to @store_transaction, notice: 'Store transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_transaction }\n else\n format.html { render :edit }\n format.json { render json: @store_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:store_id])\n @menu = @store.menus.find(params[:id])\n\n respond_to do |format|\n if @menu.update_attributes(params[:menu])\n format.html { redirect_to store_menus_url(@store), notice: 'Menu was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @menu.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:book_shelf]['user'] = User.where(:id => params[:book_shelf]['user']).first\n params[:book_shelf]['book'] = Book.where(:id => params[:book_shelf]['book']).first\n @book_shelf = BookShelf.find(params[:id])\n respond_to do |format|\n if @book_shelf.update_attributes(params[:book_shelf])\n format.html { redirect_to @book_shelf, notice: 'Book shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_shelf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @maker_master.update(maker_master_params)\n format.html { redirect_to @maker_master, notice: 'Maker master was successfully updated.' }\n format.json { render :show, status: :ok, location: @maker_master }\n else\n format.html { render :edit }\n format.json { render json: @maker_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee_master.update(employee_master_params)\n format.html { redirect_to @employee_master, notice: '社員情報が更新されました' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @employee_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @yarn.update_attributes(params[:yarn])\n format.html { redirect_to @yarn, notice: 'Yarn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @yarn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(stock_params)\n format.html { redirect_to @store, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Store.new(store_params)\n @store.user_id = current_user.id\n current_user.update!(type: \"Owner\")\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to myStore_stores_path, notice: 'Store was successfully created.' }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @managers_position.update(managers_position_params)\n format.html { redirect_to @managers_position, notice: 'Position was successfully updated.' }\n format.json { render :show, status: :ok, location: @managers_position }\n else\n format.html { render :edit }\n format.json { render json: @managers_position.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.68259954",
"0.67671925",
"0.67176247",
"0.654345",
"0.64958966",
"0.6468298",
"0.6430893",
"0.64291024",
"0.64241815",
"0.63655216",
"0.63577807",
"0.635734",
"0.63391775",
"0.63195163",
"0.6317951",
"0.6317951",
"0.6317951",
"0.6317951",
"0.63138616",
"0.63138616",
"0.63089263",
"0.6305924",
"0.6287572",
"0.62556475",
"0.624493",
"0.6211915",
"0.6206101",
"0.6203904",
"0.6178639",
"0.61594206",
"0.6149151",
"0.61141723",
"0.6112065",
"0.6107084",
"0.6086394",
"0.6082821",
"0.60690653",
"0.60599416",
"0.60523695",
"0.6035303",
"0.59786856",
"0.5970212",
"0.592327",
"0.59229445",
"0.5907276",
"0.58881354",
"0.58859307",
"0.58696103",
"0.5864347",
"0.58631766",
"0.58509237",
"0.5846981",
"0.58423406",
"0.5838601",
"0.58351177",
"0.5825672",
"0.5793467",
"0.5772335",
"0.57614595",
"0.57537544",
"0.57178384",
"0.57163316",
"0.57106936",
"0.5701393",
"0.56810606",
"0.56744814",
"0.56602216",
"0.56534946",
"0.56494737",
"0.56468844",
"0.564377",
"0.56248677",
"0.5612826",
"0.56002706",
"0.5599763",
"0.55976164",
"0.559644",
"0.55938816",
"0.5589637",
"0.55801",
"0.5576452",
"0.5564987",
"0.5557414",
"0.5552946",
"0.5547291",
"0.55080014",
"0.5504374",
"0.5501907",
"0.5500966",
"0.54925525",
"0.5484557",
"0.5481427",
"0.5471502",
"0.5461746",
"0.5458533",
"0.5455286",
"0.54253644",
"0.5424555",
"0.5422698",
"0.5414643"
] |
0.72280097
|
0
|
DELETE /store_managers/1 DELETE /store_managers/1.json
|
def destroy
@store_manager.destroy
respond_to do |format|
format.html { redirect_to store_managers_url, notice: 'Store manager was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @admin_store = Admin::Store.find(params[:id])\n @admin_store.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manager = Manager.find(params[:id])\n @manager.destroy\n\n respond_to do |format|\n format.html { redirect_to managers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manager = Manager.find(params[:id])\n @manager.destroy\n\n respond_to do |format|\n format.html { redirect_to managers_url }\n #format.json { head :ok }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to '/stores/admin' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n\n render json: @store\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_store.destroy\n respond_to do |format|\n format.html { redirect_to admin_stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mstore.destroy\n respond_to do |format|\n format.html { redirect_to mstores_url, notice: 'Mstore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t\t\t @store = Store.find(params[:id])\n\t\t\t\t @store.destroy\n\n\t\t\t\t respond_to do |format|\n\t\t\t\t format.html { redirect_to stores_url }\n\t\t\t\t format.json { head :no_content }\n\t\t\t\t end\n\t\t\t\t end",
"def destroy\n @admin_store = Store.find(params[:id])\n @admin_store.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_stores_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @store_manager_statistic = Store::Manager::Statistic.find(params[:id])\n @store_manager_statistic.destroy\n\n respond_to do |format|\n format.html { redirect_to store_manager_statistics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url notice: 'Store was successfully deleted.'}\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/admin/stores\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t@store = current_account.stores.find(params[:id])\n @store.destroy\n respond_to do |format|\n format.html { redirect_to account_stores_path(account_id: current_account.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url, notice: \"Loja deletada com sucesso!\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n begin\n @api_v1_store.destroy!\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to phone_stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bread_store.destroy\n respond_to do |format|\n format.html { redirect_to bread_store_managers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \t@manager = Manager.find(params[:id])\n \t@manager.destroy\n \tredirect_to managers_path\n end",
"def destroy\n @online_store = OnlineStore.find(params[:id])\n @online_store.destroy\n\n respond_to do |format|\n format.html { redirect_to online_stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_add.destroy\n respond_to do |format|\n format.html { redirect_to store_adds_url, notice: 'Store add was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_status.destroy\n respond_to do |format|\n format.html { redirect_to store_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_manager_order = Store::Manager::Order.find(params[:id])\n @store_manager_order.destroy\n\n respond_to do |format|\n format.html { redirect_to store_manager_orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to(stores_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to(stores_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @store_manager_policy = Store::Manager::Policy.find(params[:id])\n @store_manager_policy.destroy\n\n respond_to do |format|\n format.html { redirect_to store_manager_policies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storeinfo.destroy\n respond_to do |format|\n format.html { redirect_to storeinfos_url, notice: 'Storeinfo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n #tib_res = Tibbr::ExternalResource.find_by_resource_key({:resource => {:key => \"ID_#{@store.id}\", :resource_type => \"ad:store\"}, :client_id => session[:app_id]})\n # tib_res.destroy\n @store.destroy\n \n \n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_to_visit.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Store to visit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @store_detail, :destroy?\n @store_detail.destroy\n respond_to do |format|\n format.html { redirect_to store_details_url, notice: 'Store detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estate_manager.destroy\n respond_to do |format|\n format.html { redirect_to estate_managers_url, notice: 'Estate manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @general_manager = GeneralManager.find(params[:id])\n @general_manager.destroy\n\n respond_to do |format|\n format.html { redirect_to(general_managers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @store = Store.find(params[:store_id])\n @menu = @store.menus.find(params[:id])\n @menu.destroy\n\n respond_to do |format|\n format.html { redirect_to store_menus_url(@store) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cakestore.destroy\n respond_to do |format|\n format.html { redirect_to cakestores_url, notice: 'Cakestore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n #也要處理相關tags的刪除?\n\n @store.destroy\n respond_to do |format|\n format.html { redirect_to admin_stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_item.destroy\n respond_to do |format|\n format.html { redirect_to store_items_url, notice: 'Store item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datastore = Datastore.find(params[:id])\n @datastore.destroy\n\n respond_to do |format|\n format.html { redirect_to datastores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manager_user = ManagerUser.find(params[:id])\n @manager_user.destroy\n\n respond_to do |format|\n format.html { redirect_to manager_users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_campaigns_manager.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_campaigns_managers_url, notice: 'Campaigns manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo_manager.destroy\n respond_to do |format|\n format.html { redirect_to todo_managers_url, notice: 'Todo manager was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_owner = StoreOwner.find(params[:id])\n\n authorize! :destroy, @store_owner\n\n @store_owner.destroy\n\n respond_to do |format|\n flash[:notice] = \"Store Owner #{@store_owner.user.display_name} was removed.\"\n format.html { redirect_to group_store_path(@group, @store) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storepromotion.destroy\n respond_to do |format|\n format.html { redirect_to storepromotions_url, notice: 'Storepromotion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_store = DataStore.find(params[:id])\n @data_store.destroy\n\n respond_to do |format|\n format.html { redirect_to data_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment_manager.destroy\n respond_to do |format|\n format.html { redirect_to payment_managers_url, notice: 'Payment manager was successfully destroyed.' }\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 @shelf.destroy\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book_store.destroy\n respond_to do |format|\n format.html { redirect_to book_stores_url, notice: 'Book store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manager.destroy\n end",
"def destroy\n @store_section = StoreSection.find(params[:id])\n @store_section.destroy\n\n respond_to do |format|\n format.html { redirect_to store_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store.destroy\n redirect_to store_path, notice: \"store destroyed.\"\n end",
"def destroy\n @store_manager_policies_payment = Store::Manager::Policies::Payment.find(params[:id])\n @store_manager_policies_payment.destroy\n\n respond_to do |format|\n format.html { redirect_to store_manager_policies_payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tweet_store.destroy\n respond_to do |format|\n format.html { redirect_to tweet_stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_detail = StoreDetail.find(params[:store_detail_id])\n @addon = Addon.find(params[:id])\n @addon.destroy\n respond_to do |format|\n format.html { redirect_to store_detail_addons_path(@store_detail), notice: 'addon detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_manager_message = Store::Manager::Message.find(params[:id])\n @store_manager_message.destroy\n\n respond_to do |format|\n format.html { redirect_to store_manager_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_manager.destroy\n respond_to do |format|\n format.html { redirect_to admin_managers_url, notice: 'Manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def user_stores_delete_single_store user_id, id\n # the base uri for api requests\n query_builder = Configuration.BASE_URI.dup\n\n # prepare query string for API call\n query_builder << \"/v1/users/{user_id}/stores/{id}\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\n \"user_id\" => user_id,\n \"id\" => id,\n }\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.delete query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif response.code == 500\n raise APIException.new \"Internal Server Error\", 500, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end",
"def destroy\n file_store = FileStore.find_by_sha1_hash!(params[:id])\n if user['id'] == file_store.user_id || user['role'] == 'admin' ||\n (user['uname'] == 'file_store' && user['role'] == 'system')\n file_store.destroy\n head :no_content\n else\n render_error 403\n end\n end",
"def destroy\n @store = StoreProduct.find(params[:id])\n @store.destroy\n respond_to do |format|\n format.html { redirect_to store_products_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\nend",
"def destroy\n @drug_store.destroy\n respond_to do |format|\n format.html { redirect_to drug_stores_url, notice: 'Drug store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n if @store.destroyed?\n flash[:notice] = \"El almacen fue eliminado.\"\n redirect_to stores_path\n else\n flash[:warning] = \"El almacen no puede ser eliminado debido a que tiene datos relacionados.\"\n redirect_to @store\n end\n\n end",
"def destroy\n @admin.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end",
"def destroy\n @manager_account = ManagerAccount.find(params[:id])\n @manager_account.destroy\n\n respond_to do |format|\n format.html { redirect_to manager_accounts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\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 @manager_session.destroy\n respond_to do |format|\n format.html { redirect_to manager_sessions_url, notice: 'Manager session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @glass_store_link.destroy\n respond_to do |format|\n format.html { redirect_to glass_store_links_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @msale.destroy\n respond_to do |format|\n format.html { redirect_to msales_url, notice: 'Machine sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task_manager.destroy\n respond_to do |format|\n format.html { redirect_to task_managers_url, notice: 'Task manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_transaction.destroy\n respond_to do |format|\n format.html { redirect_to store_transactions_url, notice: 'Store transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_geonode = Admin::Geonode.find(params[:id])\n @admin_geonode.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_geonodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @water_manager.destroy\n respond_to do |format|\n format.html { redirect_to water_managers_url, notice: 'Water manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact_store.destroy\n respond_to do |format|\n format.html { redirect_to contact_stores_url, notice: 'Contact store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storeloc = Storeloc.find(params[:id])\n @storeloc.itemlocs.each do |loc|\n loc.destroy\n end\n\n @storeloc.destroy\n\n respond_to do |format|\n format.html { redirect_to(storelocs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @merchant.destroy\n respond_to do |format|\n format.html { redirect_to merchants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shopping_mall = ShoppingMall.find(params[:id])\n @shopping_mall.destroy\n\n respond_to do |format|\n format.html { redirect_to shopping_malls_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",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @admin = Admin.find(params[:id])\n @admin.destroy\n\n render json: {:ok => true}\n end",
"def destroy\n @job_manager.destroy\n respond_to do |format|\n format.html { redirect_to job_managers_url, notice: 'Job manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to itemstores_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @osm.destroy\n respond_to do |format|\n format.html { redirect_to osms_url, notice: 'Osm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mall.put_to_trash\n respond_to do |format|\n format.html { redirect_to director_malls_path, notice: 'Mall was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @mate = Mate.find(params[:id])\n @mate.destroy\n\n respond_to do |format|\n format.html { redirect_to mates_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @go = Go.find(params[:id])\n @go.destroy\n\n respond_to do |format|\n format.html { redirect_to manager_gos_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.75522566",
"0.74253094",
"0.7415629",
"0.74060535",
"0.72904855",
"0.7289748",
"0.7289748",
"0.7289748",
"0.7289748",
"0.72742367",
"0.72742367",
"0.72742367",
"0.72742367",
"0.72740823",
"0.72718334",
"0.72522384",
"0.7247328",
"0.71995854",
"0.71833086",
"0.7179625",
"0.71769017",
"0.71559066",
"0.7155686",
"0.71210915",
"0.71106696",
"0.7086632",
"0.7086632",
"0.7086632",
"0.7086632",
"0.70819247",
"0.7025021",
"0.70096445",
"0.6999895",
"0.6992349",
"0.6987068",
"0.69616807",
"0.6959312",
"0.6939147",
"0.69312614",
"0.69037193",
"0.6901123",
"0.6841799",
"0.68370265",
"0.68306947",
"0.6805976",
"0.67989355",
"0.6782859",
"0.67748326",
"0.6770722",
"0.67588234",
"0.6756166",
"0.67252344",
"0.6698169",
"0.6678204",
"0.6662012",
"0.6621211",
"0.6621054",
"0.6620434",
"0.66084427",
"0.660197",
"0.6589399",
"0.657993",
"0.65748274",
"0.6573037",
"0.65654486",
"0.6565125",
"0.65486753",
"0.6534299",
"0.6532302",
"0.65070325",
"0.6504275",
"0.6501734",
"0.6499361",
"0.6488636",
"0.6483914",
"0.6471106",
"0.64624935",
"0.6457943",
"0.645493",
"0.64496034",
"0.644656",
"0.64148253",
"0.64008003",
"0.6399962",
"0.6381326",
"0.6379848",
"0.637486",
"0.6374571",
"0.63742566",
"0.63715345",
"0.63711214",
"0.63637584",
"0.63547575",
"0.6350035",
"0.6338407",
"0.6337155",
"0.6336629",
"0.6325939",
"0.63190836",
"0.6318306"
] |
0.7751048
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_store_manager
@store_manager = StoreManager.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 store_manager_params
params.require(:store_manager).permit(:email, :phone, :name, :location_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n 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
|
Show Current User's Profile
|
def show_current
user = current_user
profile = Profile.find_by user_id: user.id
render json: profile
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def profile\n @user = @current_user\n\n render :show\n\n end",
"def profile\n\t\t@user = User.find(current_user)\n\tend",
"def profile\n\t\t\n\t\tif !current_user\n\t\t\tredirect_to root_url and return\n\t\tend\n\t\t\n\t\t@user = current_user\n\t\t\n\tend",
"def profile\n\t\t@user = current_user\n\tend",
"def profile\n\t@user = current_user\n\t@title = \"This is your profile page\"\n end",
"def profile\n @user = current_user\n end",
"def profile\n @profile = current_user\n end",
"def show\n if current_user.is_normal?\n @user = User.find( params[:id] )\n render :profile\n else\n redirect_to user_profile_path\n end\n end",
"def show\n\n\t\t@current_profile = Profile.get_profile params[:id], \"asdf\"\n\n\t\tpretty_render \"api/public_user\"\t\n\n\tend",
"def show\n @profile = @user.profile\n end",
"def show\n if current_user\n @user = User.find(params[:id])\n @user = current_user\n render :show\n else\n flash[:error] = \"Must be signed in to see your profile!!\"\n redirect_to \"/\"\n end\n end",
"def show\n @profile = Profile.find(params[:id]) || current_user.profile\n end",
"def show\n op = present User::Show\n redirect_to edit_user_profile_path(current_user, op.model.profile) && return if op.new_profile?\n redirect_to user_profile_path(current_user, op.model.profile)\n end",
"def profile\n if !GraderConfiguration['system.user_setting_enabled']\n redirect_to :controller => 'main', :action => 'list'\n else\n @user = current_user;\n end\n end",
"def profile\n if(current_user)\n render 'layouts/loggedin'\n else\n render \"layouts/guest\"\n end\n end",
"def show\r\n jump_to(\"/profiles/#{session[:account_id]}/basic\")\r\n end",
"def show\n @user = User.find(params[:id])\n if $current_user.nil? or $current_user.id != @user.id\n redirect_to signin_path\n else\n @title = \"#{@user.userName}'s profile\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end\n end",
"def profile\n check_auth :profile\n \n response = connection.post do |req|\n req.url '/user/profile'\n req.body = { :format => @format }\n end\n response.body[0]\n end",
"def show_current_user\n return \"\" unless logged_in?\n \"User: #{current_user.display_name} - (#{current_user.role.display_name})\"\n end",
"def user_profile\n @current_user = current_user\n\n if params[:id] == 'me'\n @user = @current_user\n else\n @user = User.find_by_id(params[:id])\n end\n end",
"def show\n @profile = current_user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show_current_user_profile\n @user = User.find(params[:id])\n render json: @user\n end",
"def index\n @profiles = current_user\n end",
"def show\n @profile = Profile.find(:first, :conditions => {:user_id => params[:user_id]})\n end",
"def profile_edit\n @user = User.find(current_user.id)\n end",
"def profile\r\n if params[:id] && User.exists?(params[:id])\r\n @prof = User.find(params[:id])\r\n else\r\n redirect_to_info_page t(:redir)\r\n return\r\n end\r\n end",
"def show\n @user = User.find(current_user.id)\n end",
"def show\n\t\t@user = current_user\n\tend",
"def show\n @me = current_user\n end",
"def show\n # @profile = Profile.find(params[:id])\n redirect_to user_page_url(@profile.user)\n end",
"def current_profile\n current_session.profile\n end",
"def show\n\n if @user.id == current_user.id\n add_breadcrumb \"My Profile\"\n else\n add_breadcrumb @user.name\n end\n\n # get the @prev_record_path and @next_record_path view vars\n get_next_and_prev_object_keys(@user, INDEX_KEY_LIST_VAR)\n @prev_record_path = @prev_record_key.nil? ? \"#\" : user_path(@prev_record_key)\n @next_record_path = @next_record_key.nil? ? \"#\" : user_path(@next_record_key)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user }\n end\n end",
"def set_profile\n if current_user.nil?\n redirect_to :home, notice: t( 'profiles.notice.pls_signon') \n else\n @person = Person.find( current_user.person_id )\n @user_id = current_user.id\n set_final_breadcrumb( action_name )\n end\n self.feature_help_file = :profile\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n if user_signed_in?\n @user = User.find(current_user.id)\n end\n end",
"def show\n @user = current_user\n end",
"def show\n unless @user==User.find(params[:id])\n flash[:notice]= \"You can only see your own profile.\"\n redirect_to root_path\n end\n @user=User.find(params[:id])\n end",
"def show\n user = User.find(current_user.username)\n redirect_to user_path(user)\n end",
"def show\n @user = User.find(params[:id]) \n @user_me = retrieve_authenticated_user\n end",
"def go_to_profile\n\t\tif login?\n\t\t\t#Queries the database for the handle and id of all users that are followed by the session user by \n\t\t\t#performing a join between the relationships and users tables.\n\t\t\t@followees = Relationship.find_followees(userid)\n\t\t\terb :profile\n\t\telse\n\t\t\terb :login\n\t\tend\n\tend",
"def show\n @user=current_user\n end",
"def show\n @my_accounts=@current_user\n\tend",
"def show\n unless params[:id].blank?\n @user = User.find_by_id(params[:id])\n else\n if logged_in?\n @user = current_user\n else\n require_login and return\n end\n end\n \n if @user.blank?\n flash[:error] = \"User not found\"\n redirect_to root_path and return\n end\n\n @own_profile = (logged_in? && (@user.id == current_user.id))\n\n @page_title = @own_profile ? \"My profile\" : \"View profile\"\n\n @memberships = @user.liga_users.approved.map(&:league)\n end",
"def profile\n @user = current_user_with_auths\n @connected = @user.authorizations.collect{|a| a.provider}\n @to_connect = providers - @connected\n unless @user\n redirect_to root_path, :notice => \"Sorry, try logging back in\"\n end\n end",
"def profile\n self.profilelink.click\n end",
"def profile\n end",
"def profile\n end",
"def profile\n end",
"def profile\n end",
"def profile\n end",
"def profile\n end",
"def profile\n @user = User.find(params[:id])\n end",
"def profile\n render json: @current_user\n end",
"def profile\n\n end",
"def show\n @profile = current_user\n @projects = Project.all \n @user = current_user\n end",
"def show\n # @u = current_user\n end",
"def show\n @user = User.find(params[:id])\n\n if @user.state != 'active' or @user.login == 'admin'\n return redirect_to users_path\n end\n \n @page_ancestors = [{:name=>'Community', :url=> users_path}]\n @bc_title = 'User Profile'\n \n respond_to do |format|\n format.html # show.html.erb\n format.iphone\n format.xml { render :xml => @user }\n end\n end",
"def show\n @page_title = 'Profile for ' + @person.full_name\n end",
"def profile\n \t@user = UsersService.findUserById(params[:id])\n end",
"def set_profile\n @profile = Profile.where(user_id: current_user).first\n end",
"def show\n @profile = current_user.profile\n\n # ToDo: error message if no profile is found for user\n\n puts 'Got profile='\n pp @profile\n \n\n puts 'got other_names='\n pp @profile.other_names\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile }\n format.json { render :json => @profile }\n end\n \n end",
"def profile\n \n end",
"def show\n #@user=current_user\n end",
"def profile_show\n @user = User.find(current_user.id)\n\n $admin = User.where(\"admin = ? AND signed_in = ?\", true, true).first\n if $admin.nil?\n $admin = User.where(\"admin = ?\", true).first\n end\n $conversation = Conversation.between(current_user.id,$admin.id).first\n if $conversation.nil?\n $conversation = Conversation.create(sender_id: current_user.id, recipient_id: $admin.id)\n end\n gon.open = $conversation.open\n end",
"def current_user\n current_user_for_profile_management\n end",
"def name\n profile.user.name\n end",
"def show\n set_user\n end",
"def user_information\n @current_user = current_user\n\n render :partial => 'home/user_info'\n end",
"def show\n @title = \"#{@profile.forenames} #{@profile.surnames}\"\n end",
"def set_profile\n @profile = current_user\n end",
"def show\n @flag = @profile.country_code + \" flag\" unless @profile.country_code.nil?\n\n if @profile.user_id == current_user.id\n @title = \"My Profile Card\"\n else\n @title = \"#{@profile.nickname}'s Profile Card\"\n end\n end",
"def show\n @user_picture = @user.profile_image.expiring_url(3600, :square)\n @bookmarks = @user.bookmarks\n @enrollments = @user.courses\n @enrollments_visible = @user.course_enrollments_visible_for_user(current_user)\n @completions_visible = @user.course_results_visible_for_user(current_user)\n end",
"def profile\n @presenter = Users::ProfilePresenter.new(current_user.id)\n @message = Message.new\n end",
"def display_name\n display_name = @current_profile.display_name\n end",
"def show\n @title = \"Perfil del Candidato: #{@profile.forenames} #{@profile.surnames}\"\n end",
"def display_name\n self.display_name = self.profile.nickname? ? self.profile.nickname : self.username\n end",
"def profile\n render_json 0,\"ok\",current_member.as_profile\n end",
"def index\n @profiles = current_user.profiles\n end",
"def index\n @profiles = current_user.profiles\n end",
"def show\n redirect_to(default_url) unless logged_in? || User.count > 0\n @user = current_user\n end",
"def show\n @users = User.all\n @user = current_user\n end",
"def profile\n \t\t@patient = Patient.all\n #@current_user = User.find(params[:id])\n end",
"def profile\n\t\t# determine which user's profile page\n\t\t@user = User.find_by_login(params[:username])\n\t\t# retrieve all bids by this user\n\t @bids = Bid.find_all_by_bidder_id(@user.id, :group => 'item_id')\n\t\t# get all comments for this user\n\t @comments = @user.user_comments\n\t\t# get all user_items by this user\n\t @user_items = @user.posted_items\n\n\t\t# code for facebox\n\t respond_to do |format|\n\t\t\tformat.html\n format.js { render_to_facebox }\n end\n\tend",
"def show\n\n @user = User.get(params[:id])\n \n if signed_in? && @user.id == current_user.id\n @menu = \"home\"\n @board = \"user\"\n @section = \"show\"\n \n render 'user'\n else\n redirect_to '/'\n end\n end",
"def show\n user = load_user\n expose user, serializer: UserProfileSerializer\n end"
] |
[
"0.82534546",
"0.81467056",
"0.8145606",
"0.8032345",
"0.80232215",
"0.7981136",
"0.7885248",
"0.7856213",
"0.77986467",
"0.77817374",
"0.7776848",
"0.7709753",
"0.7695782",
"0.7595749",
"0.7578902",
"0.7562654",
"0.756189",
"0.7434994",
"0.73932105",
"0.7388019",
"0.7363732",
"0.7342034",
"0.73244524",
"0.73230934",
"0.72965723",
"0.72742504",
"0.7269206",
"0.7258089",
"0.72395575",
"0.7220592",
"0.71919185",
"0.7156948",
"0.7117867",
"0.7114325",
"0.71141803",
"0.71141803",
"0.71141803",
"0.71141803",
"0.71141803",
"0.71141803",
"0.71141803",
"0.71141803",
"0.71141803",
"0.71141803",
"0.71141803",
"0.71141803",
"0.71141803",
"0.71141803",
"0.71132445",
"0.71132016",
"0.7112235",
"0.7108092",
"0.70942056",
"0.7092044",
"0.7072046",
"0.70620626",
"0.7053106",
"0.70479727",
"0.704165",
"0.7024431",
"0.69985324",
"0.69985324",
"0.69985324",
"0.69985324",
"0.69985324",
"0.69985324",
"0.6998311",
"0.69969064",
"0.69946486",
"0.6993916",
"0.6983545",
"0.6982165",
"0.6972567",
"0.69719684",
"0.69683176",
"0.69672453",
"0.69631284",
"0.69562674",
"0.69543505",
"0.69497246",
"0.6944314",
"0.69442534",
"0.69437534",
"0.69339085",
"0.6933612",
"0.69326115",
"0.69307405",
"0.6928944",
"0.6921794",
"0.6918911",
"0.69174135",
"0.6913628",
"0.6912386",
"0.6912386",
"0.6910431",
"0.6906812",
"0.6904198",
"0.68990594",
"0.68882227",
"0.6886084"
] |
0.752924
|
17
|
Public: Mark a course completed Returns the save state. true means success
|
def complete!
self.is_completed = true
self.save
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def mark_as_completed!\n mark_state_complete!\n end",
"def save_completed\n self.status = :completed\n self.save!\n\n StudentMailer.application_completed(student, self).deliver_later\n StudentMessenger.new.application_completed(student, self)\n\n true\n end",
"def mark_as_complete_and_save\n self.complete = true\n save\n end",
"def complete!\n self.completed = true\n self.completed_at = Time.now.utc\n save! # TODO: With a bang?\n end",
"def mark_complete\n self.complete = true\n self.save\n end",
"def completed()\n @completed=true\n @tCompleted=Time.now\n end",
"def complete!\n self.update_attribute(:is_completed, true)\n # TODO: send an email to teacher about taks completion\n end",
"def completed\n @status = 'complete'\n end",
"def complete!\n self.status = 'completed'\n self.save\n end",
"def save_new\n self.completed = false\n save\n end",
"def complete!\n # this should change the boolean to true\n self.complete = true\n self.save!\n end",
"def mark_as_done!\n @status = :finished\n end",
"def complete_course(course, grade, term = nil)\n user_completed_course = completed_courses.where(:course => course).first\n if user_completed_course.nil?\n course_scenarios.each do |scenario|\n taking_course = scenario.taking_courses.where(:course_id => course.id).first\n unless taking_course.nil?\n term ||= taking_course.term\n taking_course.destroy\n end\n end\n user_completed_course = UserCompletedCourse.new\n user_completed_course.course = course\n user_completed_course.user = self\n end\n user_completed_course.term = term\n user_completed_course.grade= grade\n if user_completed_course.save\n true\n else\n self.errors.add :completed_courses, user_completed_course.errors.full_messages\n false\n end\n end",
"def complete!\n @completed = true\n @completed_at = Time.now\n end",
"def mark_as_completed\n completed_at.nil? ? self.completed = true : errors.add(:completed, '- This task has already been completed!')\n end",
"def successfully_completed\n self.update(status: SUCCESSFUL)\n changed\n notify_observers(self)\n end",
"def set_as_complete\n mark_as_complete_and_save\n end",
"def completed?\n @completed\n end",
"def mark_as_done!\n @done = true\n end",
"def mark_as_done\n @is_done = true\n end",
"def check_completion_status\n\t\trace = Race.find_by_id(self.race_id)\n\t\treturn if (race.nil?)\n\t\t\n\t\tself.is_complete = race.is_complete \n\t\tself.save\n\tend",
"def completed?\n @completed\n end",
"def done!(status = 0)\n @completed_at = Time.now\n @exitstatus = status\n save\n end",
"def completed?\n\t\t@completed\n\tend",
"def mark_done\n @done = true\n end",
"def became_completed?\n completed_changed? && completed\n end",
"def setCompleted(completed)\r\n\t\t\t\t\t@completed = completed\r\n\t\t\t\tend",
"def setCompleted(completed)\r\n\t\t\t\t\t@completed = completed\r\n\t\t\t\tend",
"def completed?\n @completed\n end",
"def completed?\n @completed\n end",
"def set_completed\n\t@artwork = Artwork.find(params[:id])\n\t@artwork.update_attribute(:completed, true)\n\tredirect_to @artwork\nend",
"def complete\n if @todo_item.update_attribute(:completed, 1)\n flash[:success] = \"todo item marked as completed\"\n redirect_to todo_path(@todo)\n else\n flash[:error] = \"failed to mark item as completed\"\n render 'todos/show'\n end\n end",
"def markDone\n if @complete == \"Item incomplete\"\n @complete = \"Item complete\"\n else\n @complete = \"Item complete\"\n end\n end",
"def finalize!\n update_attribute(:completed_at, Time.now)\n end",
"def completed_it\n self.complete = true\n end",
"def save_courses\n if self.course_selections.empty?\n self.errors.add(:you, 'must apply for at least one course')\n return false\n end\n self.current_stage = :submit_stage\n self.save validate: false # don't want to worry about rest of application here.\n end",
"def completed?\n completed\n end",
"def finish!\n update_attributes!(:status => :done)\n self\n end",
"def completed?\n completed == '1'\n end",
"def update_completed? ; false ; end",
"def completed\n end",
"def completed\n proptime 'COMPLETED'\n end",
"def completed?\n return @completed\n end",
"def complete\n self.update_attribute('state', 'complete')\n end",
"def is_finished\n\t\tif self.completed_at \n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def completed=(value)\n return @completed = value\n end",
"def complete!\n @completed_at = Time.now\n end",
"def complete!\n @completed_at = Time.now\n end",
"def check_completed\n\t\tend",
"def completed?\n self.state == :completed\n end",
"def subject_done(subject)\n @serialized[subject] = true\n end",
"def finish\n question = 'Are you done with this task? [yes/no] :'\n if ret = !! Readline.readline(question).match(/^yes/i)\n @issue.mark_finished!\n @issue.save\n end\n ret end",
"def finished\n @finished = true\n end",
"def mark_complete\n if self.completed\n self.progress = \"COMP\"\n self.progress_percentage = \"100\"\n elsif self.progress and !self.progress.eql?('COMP') and self.progress_percentage\n self.progress = self.progress\n self.progress_percentage = self.progress_percentage\n else\n self.progress = \"INPR\"\n self.progress_percentage = \"0\"\n end\n end",
"def mark_state_complete!\n get[state.to_s] = :complete\n end",
"def update_done\n self.done = true if COMPLETE_STATUSES.include? self.detailed_status\n end",
"def completed?\n !!completed\n end",
"def complete\n @ride = Ride.find(params[:ride_id])\n @ride.completed = true\n @ride.save\n UserMailer.complete_ride(@ride).deliver_later\n redirect_to user_path(current_user)\n end",
"def mark_as_finished\n result = V1::StudyHour::MarkAsFinished.(params, current_user: @current_user)\n if result.success?\n render json: result['model'], status: :ok\n elsif result['result.policy.failure']\n render json: { 'errors': [] }, status: :unauthorized\n else\n render json: {\n 'errors': result['model'].errors.full_messages\n }, status: :unprocessable_entity\n end\n end",
"def will_course_be_completed(course, term)\n taking_course = taking_courses.where(:course_id => course).first\n if taking_course.nil?\n false\n else\n taking_course.year < term.year or (taking_course.year <= term.year and taking_course.semester.order < term.semester.order)\n end\n end",
"def completed()\n end",
"def isCompleted\r\n\t\t\t\t\treturn @completed\r\n\t\t\t\tend",
"def isCompleted\r\n\t\t\t\t\treturn @completed\r\n\t\t\t\tend",
"def move_to_completed(id)\n @store.transaction do\n @store[id].categories[\"completed\"] = true\n end\n end",
"def mark_completed\n puts 'Enter task number(ID), please'\n\n entered_id = get_id_input\n\n if @tasks[entered_id]\n\n @tasks[entered_id].status = 'completed'\n\n else\n\n no_entry_message\n\n end\n\n end",
"def finish_quiz\n quiz = Quiz.find(cookies[:quiz_id])\n quiz.update(completed: true)\n cookies.permanent[:completed] = true\n redirect_to results_path\n end",
"def mark_program_as_completed_if_it_is\n if self.passed? and !self.program_player.completed? and self.program_budge.level >= self.program_player.program.last_level\n self.program_player.update_attributes(:completed => true, :victorious => (self.program_player.victorious == false ? nil : self.program_player.victorious))\n # self.program_player.user.contact_them(:email, :completed_program_congrats, self.program_player)\n Mailer.message_for_habit_labbers(\"#{self.program_player.user.name} completed #{self.program_player.program.name}!\",\n \"One of you Labbers should take a look at their progress through the program and \"+\n \"congratulate them on Twitter! \\n\\nhttp://#{DOMAIN}/dash/user/#{self.program_player.user.id}\").deliver rescue nil\n end\n end",
"def completed?\n return @complete\n end",
"def completed?\n return @complete\n end",
"def completed?\n self.is_completed\n end",
"def completed?\n job_completed?\n end",
"def finished\n @finished.to_s == 'true'\n end",
"def completed?\n @state.to_s =~ /finished|aborted|failed/\n end",
"def complete?\n status == \"Completed\"\n end",
"def done\n @status = true\n end",
"def completed?\n status.completed?\n end",
"def mask_as_done!\n @completed = true\n end",
"def complete!\n return if completed?\n self.status = \"complete\"\n self.stop = Time.now.to_s\n end",
"def mark_as_finished \n if self.used_quantity + self.scrapped_quantity == self.quantity\n self.is_finished = true \n end\n self.save\n end",
"def mark_as_finished \n if self.used_quantity + self.scrapped_quantity == self.quantity\n self.is_finished = true \n end\n self.save\n end",
"def completed?\n attributes['percentDone'] >= 1\n end",
"def complete?\n\tstatus == \"Completed\"\n end",
"def complete!\n update_attributes(completed_at: Time.now)\n pause! if running?\n end",
"def completed?\n self.status == STATUS_COMPLETED\n end",
"def set_completed\n\t\t@post = Post.find(params[:id])\n\t\t@post.update_attribute(:completed, true)\n\t\tredirect_to @post\n\tend",
"def complete?\n return state == \"complete\"\n end",
"def marked_as_complete?\n get[state.to_s] and get[state.to_s].to_sym == :complete\n end",
"def action_complete() self.finished = true; end",
"def mark_task_complete\n system \"clear\"\n # If task was set\n\n loop do\n task = get_task_choice(\"mark complete\")\n if task && task != :back\n task.status = :completed\n\n system \"clear\"\n display_tasks(:completed)\n display_tasks(:failed)\n\n # Cancel notifications\n task.cancel_reminder_notification\n task.cancel_failed_notification\n\n puts \"Congratulations on completing this task!\".light_white\n break unless CLI.agree(\"\\nMark another task complete? (y/n)\".light_white)\n else\n break\n end\n end\n end",
"def finish\n @Done = true \n end",
"def complete?\n @complete\n end",
"def done\n update_attribute(:finished_at, Time.now) if finished_at.blank?\n end",
"def complete\n @task.task_completed\n @task.update_completed_at\n redirect_to task_path(@task.id)\n end",
"def complete?\n @complete\n end",
"def mark_info_completed(ride)\n # update_attributes(Conversation.ride_conversation_attrs(ride))\n update(Conversation.ride_conversation_attrs(ride))\n ride_created!\n end",
"def complete?\r\n @is_complete\r\n end",
"def finished?\n @status[:description] == :finished\n end",
"def finished?\n @finished\n end",
"def finished?\n @finished\n end",
"def finished?\n @finished\n end"
] |
[
"0.7193529",
"0.70810956",
"0.7052469",
"0.6901005",
"0.6878384",
"0.6779308",
"0.6746624",
"0.6745381",
"0.6730323",
"0.66763574",
"0.6670148",
"0.6591815",
"0.6591056",
"0.654552",
"0.65284604",
"0.65116674",
"0.6428214",
"0.6416912",
"0.63879466",
"0.63848895",
"0.636623",
"0.6346758",
"0.63460547",
"0.6342076",
"0.6337563",
"0.6325696",
"0.6315936",
"0.6315936",
"0.6293091",
"0.6293091",
"0.6281273",
"0.6281067",
"0.6274501",
"0.6269351",
"0.6264288",
"0.6259961",
"0.6259288",
"0.6239047",
"0.62307066",
"0.6210636",
"0.620248",
"0.6169801",
"0.6135587",
"0.61350125",
"0.61274374",
"0.6119347",
"0.61193466",
"0.61193466",
"0.6117931",
"0.611786",
"0.6109706",
"0.6105038",
"0.60997057",
"0.60981417",
"0.6087314",
"0.60769963",
"0.6056195",
"0.605463",
"0.6051232",
"0.60340387",
"0.6021488",
"0.60113597",
"0.60113597",
"0.6008812",
"0.59994864",
"0.5995735",
"0.5988746",
"0.59768045",
"0.59768045",
"0.5974886",
"0.5969476",
"0.5964976",
"0.5964953",
"0.59416103",
"0.59372455",
"0.59325314",
"0.5930032",
"0.59253186",
"0.5924653",
"0.5924653",
"0.59170103",
"0.59163",
"0.5889039",
"0.5882504",
"0.5875663",
"0.5861904",
"0.5853761",
"0.5848634",
"0.5846171",
"0.58421904",
"0.5838651",
"0.583758",
"0.58327794",
"0.5831568",
"0.5830555",
"0.58223933",
"0.5796602",
"0.5783939",
"0.5783939",
"0.5783939"
] |
0.7039356
|
3
|
Public: whether a course is marked completed Returns the state, true means completed.
|
def completed?
self.is_completed
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def completed?\n self.state == :completed\n end",
"def completed?\n @completed\n end",
"def completed?\n @completed\n end",
"def completed?\n @state.to_s =~ /finished|aborted|failed/\n end",
"def completed?\n !!completed\n end",
"def completed?\n status.completed?\n end",
"def completed?\n return @completed\n end",
"def completed?\n\t\t@completed\n\tend",
"def completed?\n @completed\n end",
"def completed?\n @completed\n end",
"def completed?\n completed == '1'\n end",
"def completed?\n self.status == STATUS_COMPLETED\n end",
"def completed?\n return @complete\n end",
"def completed?\n return @complete\n end",
"def completed?\n COMPLETED_STATES.include?(status)\n end",
"def completed?\n @__status == TaskStatus::COMPLETED\n end",
"def complete?\n return state == \"complete\"\n end",
"def isCompleted\r\n\t\t\t\t\treturn @completed\r\n\t\t\t\tend",
"def isCompleted\r\n\t\t\t\t\treturn @completed\r\n\t\t\t\tend",
"def marked_as_complete?\n get[state.to_s] and get[state.to_s].to_sym == :complete\n end",
"def became_completed?\n completed_changed? && completed\n end",
"def completed?\n completed\n end",
"def completed?\n job_completed?\n end",
"def completed?\n attributes['percentDone'] >= 1\n end",
"def completed?\n return true unless @state == PENDING_STATE\n @lock.lock\n begin\n @state != PENDING_STATE\n ensure\n @lock.unlock\n end\n end",
"def complete?\n self.state == 'complete'\n end",
"def complete?\r\n @is_complete\r\n end",
"def completed?\n\t\t\treturn request_status == REQUEST_STATUS['completed']\n\t\tend",
"def completed?(item)\n state_group(item) == :done\n end",
"def completed?\n self.status_sym == :completed\n end",
"def complete? c\n c.complete?\n end",
"def complete?\n status == \"Completed\"\n end",
"def completed?\n contact_completed? && company_completed? && finance_completed?\n end",
"def complete?\n @complete\n end",
"def crawling_complete?\n @completed\n end",
"def is_complete?\n return ApprovalState::COMPLETED_STATES.include? self.status.to_i\n end",
"def complete?\n @complete\n end",
"def is_finished\n\t\tif self.completed_at \n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def complete?\n\tstatus == \"Completed\"\n end",
"def iscompleted?\n status == \"completed\"\n end",
"def is_complete?\n # if complete check that still valid\n if self.state == Activity::COMPLETE\n if self.count < self.count_goal\n if self.expiration_date.nil? or \n self.expiration_date >= Date.current\n self.state = Activity::INCOMPLETE\n else\n self.state = Activity::EXPIRED\n end\n self.completed_date = nil\n self.save!\n return false\n else\n return true # state did not change - still complete\n end\n else\n # not complete, is it now?\n if self.count >= self.count_goal\n self.state = Activity::COMPLETE\n self.completed_date = DateTime.current\n self.save!\n return true\n\n else\n return false\n end\n end\n end",
"def became_incompleted?\n completed_changed? && !completed\n end",
"def finished?\n @__status == TaskStatus::COMPLETED ||\n @__status == TaskStatus::FAULTED ||\n @__status == TaskStatus::CANCELED\n end",
"def completed?\n if self.completed == true\n true\n end\n\n if( self.user_quiz_answers.count == self.quiz.quiz_phases.collect{ |p| p.quiz_questions }.size )\n self.completed = true\n true\n else\n false\n end\n end",
"def completed?(chapter)\n chapters_completed.include? chapter\n end",
"def completed?\n !completed_at.blank?\n end",
"def completed?\n \t\tlatest_transaction.completed? unless transactions.empty?\n \tend",
"def finished?\n @status[:description] == :finished\n end",
"def finished?\n attributes['isFinished']\n end",
"def complete?\n self.complete\n end",
"def completed?\n \tcompleted_at?\n end",
"def completed?\n @progress != 'PENDING'\n end",
"def finished?\n @state == :finished\n end",
"def on_completed?\n @kind == :on_completed\n end",
"def completed?\n completed_at ? true : false\n end",
"def completed?\n completed_at ? true : false\n end",
"def finished?\n @state == STATE_FINISHED\n end",
"def complete?\n checkbox_text =~ COMPLETE\n end",
"def finished?\n self.completed? || self.failed?\n end",
"def complete?\n complete == true\n end",
"def finished?\n if self.status == self.statuses[\"Finished\"]\n return true\n end\n return false\n end",
"def completed?\n !self.finished_at.nil?\n end",
"def complete?\n !incomplete?\n end",
"def complete?\n !incomplete?\n end",
"def pedia_complete?\n return status == COMPLETE\n end",
"def completed?\n !!completed_at\n end",
"def finished?\n FINAL_STATUSES.include?(transaction_status) || status == COMPLETED\n end",
"def completed? # Is task completed? method\n completed_status # True or false\n end",
"def complete?\n self.status == STATUS[:complete] \n #self.status == 1\n end",
"def completed?\n !@time_started.nil? && !@time_completed.nil?\n end",
"def is_complete?\n if self.state == COMPLETE\n self.children.each do |child|\n if !child.is_complete?\n return false\n end\n end\n return true\n\n else\n return false\n end\n end",
"def incomplete?\n !completed\n end",
"def done?\n @state == :done\n end",
"def completed?\n !completed_at.blank?\n end",
"def finished\n @finished.to_s == 'true'\n end",
"def finished?\n\t\tfinished_on.present?\n\tend",
"def finished?\n\t\tfinished_on.present?\n\tend",
"def will_course_be_completed(course, term)\n taking_course = taking_courses.where(:course_id => course).first\n if taking_course.nil?\n false\n else\n taking_course.year < term.year or (taking_course.year <= term.year and taking_course.semester.order < term.semester.order)\n end\n end",
"def finished?\n\t\t\tif @finished.nil? then\n\t\t\t\tfalse\n\t\t\telse\n\t\t\t\t@finished\n\t\t\tend\n\t\tend",
"def completed?\n self.completed_at.present?\n end",
"def finished?\n\t\tif @finished.nil? then\n\t\t\tfalse\n\t\telse\n\t\t\t@finished\n\t\tend\n\tend",
"def complete?\n true\n end",
"def complete?\n true\n end",
"def finished?\n self.status == STATUS_FINISHED\n end",
"def complete?\n status == \"verified\"\n end",
"def completed?\n @step == @total_steps\n end",
"def finished?\n FINISHED_STATUSES.include? status or tasks_are_finished?\n end",
"def complete?\n !! completed_at\n end",
"def is_complete?\n self.audit_state == AUDIT_COMPLETE\n end",
"def completed?\n raise \"completed? should be implemented by the extending class\"\n end",
"def complete?\n pending == failures && (child_count == 0 || child_count == @completed)\n end",
"def finished?\n !!@finished\n end",
"def is_complete?\n # check if an individual rep, complete reps of day if not\n if self.rep_parent.nil?\n self.repititions.\n where(:show_date => Date.current).each do |rep|\n if !rep.is_complete?\n return false\n end\n end\n return true\n\n else\n return self.state == Activity::COMPLETE\n end\n end",
"def finished?\n @finished\n end",
"def finished?\n @finished\n end",
"def finished?\n @finished\n end",
"def finished?\n @finished\n end",
"def finished?\n self.status == 'finished'\n end",
"def finished?\n self.status == 'finished'\n end",
"def instructor_has_completed_orientation?\n return true if Features.disable_onboarding?\n TrainingModulesUsers\n .where(training_module_id: ORIENTATION_ID)\n .where(user_id: current_user.id)\n .where.not(completed_at: nil).any?\n end"
] |
[
"0.8017763",
"0.7988873",
"0.7971955",
"0.7916201",
"0.78749657",
"0.7863431",
"0.7859596",
"0.7812236",
"0.7801383",
"0.7801383",
"0.77808994",
"0.77301496",
"0.7711255",
"0.7711255",
"0.77064085",
"0.7663645",
"0.76507324",
"0.76351213",
"0.76351213",
"0.7623263",
"0.76222676",
"0.7572444",
"0.75684404",
"0.7536307",
"0.751202",
"0.74848485",
"0.74521166",
"0.74063665",
"0.7386173",
"0.7353037",
"0.73462796",
"0.73458433",
"0.7302018",
"0.72688836",
"0.724908",
"0.72381216",
"0.72249",
"0.7221943",
"0.7163516",
"0.712703",
"0.71082854",
"0.70996827",
"0.70985186",
"0.7069965",
"0.7054608",
"0.70441794",
"0.70426375",
"0.7016132",
"0.70065844",
"0.69961184",
"0.6978804",
"0.69777226",
"0.6977293",
"0.6957165",
"0.69408345",
"0.69408345",
"0.6917216",
"0.6902137",
"0.6883193",
"0.6880188",
"0.6864682",
"0.6863706",
"0.68301386",
"0.68301386",
"0.6814934",
"0.68135965",
"0.6794919",
"0.6793352",
"0.677802",
"0.67777646",
"0.6753999",
"0.6727957",
"0.6722352",
"0.6715987",
"0.6672753",
"0.66714454",
"0.66714454",
"0.6660575",
"0.6654701",
"0.6653484",
"0.6649478",
"0.6642614",
"0.6632995",
"0.66262305",
"0.6620145",
"0.661313",
"0.66026753",
"0.6600688",
"0.6595326",
"0.6590967",
"0.6582738",
"0.6578068",
"0.6577675",
"0.65742916",
"0.65742916",
"0.65742916",
"0.65742916",
"0.6555644",
"0.6555644",
"0.6546588"
] |
0.7650922
|
16
|
Public: Search for schedules that was already overdued Returns the Mongoid::Criteria
|
def overdue
schedules.where(:when.lte => Time.now)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def intersecting_event_schedules\n room.event_schedules.where(start_time: start_time, schedule: schedule).where.not(id: id)\n end",
"def possibly_coliding_schedules\n Schedule.where(possibly_coliding_schedules_query)\n end",
"def existing_reservations\n start_dt = self.start_dt.try(:to_datetime).try(:change, offset: \"+0000\")\n end_dt = self.end_dt.try(:to_datetime).try(:change, offset: \"+0000\")\n room_id = self.room.try(:id)\n results_size = (self.is_block?) ? 1000 : 1\n\n return [] if room_id.blank? || start_dt.blank? || end_dt.blank?\n block_query = [{ term: { is_block: false } }, { range: { end_dt: { gte: Time.zone.now.to_datetime.change(offset: \"+0000\") } } }]\n query =\n {\n query: {\n constant_score: {\n filter: {\n bool: {\n must: [\n { term: { room_id: room_id } },\n { term: { deleted: false }},\n { bool:\n {\n should: [\n {\n bool: {\n must: [\n { range: { start_dt: { gte: start_dt } } },\n { range: { start_dt: { lt: end_dt } } }\n ]\n }\n },\n {\n bool: {\n must: [\n { range: { end_dt: { gt: start_dt } } },\n { range: { end_dt: { lte: end_dt } } }\n ]\n }\n },\n {\n bool: {\n must: [\n { range: { start_dt: { lte: start_dt } } },\n { range: { end_dt: { gte: end_dt } } }\n ]\n }\n }\n ]\n }\n }\n ]\n }\n }\n }\n },\n size: results_size\n }\n query[:query][:constant_score][:filter][:bool][:must] += block_query if self.is_block?\n return Reservation.search(query).results\n end",
"def shifts_cannot_overlap\n # day = weekday\n # shifts = employee.shifts.exclude_self(id).where(weekday: day)\n range = Range.new(time_start, time_end)\n # shifts = employee.shifts.exclude_self(id).on_day(weekday).valid_at(valid_from)\n # overlaps = shifts.in_range(range)\n overlaps = employee.shifts.exclude_self(id).on_day(weekday).valid_at(valid_from).in_range(range)\n overlap_error unless overlaps.empty?\n end",
"def exclusive_schedule\n if Schedule.where('init >= ? AND init <= ?', init, finish).any?\n errors.add(:base, \"Já existe uma reserva para esse horário\")\n end\n end",
"def overlapping_reservations\n\t\t# =? prevents sql injection\n\t\treservations = Reservation.where(\"listing_id =?\", self.listing_id)\n\n\t\tif reservations.count > 0\n\t\t\treservations.each do |r|\n\t\t\t\tif overlaps?(r)\n\t\t\t\t\treturn errors.add(:unavailable, \"dates!\")\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def occurrences(params={count: MAX_OCCURRENCE_COUNT})\n if(recurs?)\n if(params[:after])\n search_offset = params[:after].localtime.utc_offset - schedule.start_time.localtime.utc_offset\n elsif(params[:until])\n search_offset = params[:until].localtime.utc_offset - schedule.start_time.localtime.utc_offset\n end\n \n #reset schedule to utc\n schedule.start_time.utc\n schedule.end_time.utc\n \n schedules = if(params[:until])\n if(params[:after])\n schedule.occurrences_between(params[:after] - self.schedule.duration + search_offset, params[:until] + search_offset)\n else\n schedule.occurrences(params[:until] + search_offset)\n end\n elsif params[:count]\n if params[:after]\n schedule.next_occurrences(params[:count], params[:after] - self.schedule.duration + search_offset)\n else\n schedule.next_occurrences(params[:count], Time.zone.now - self.schedule.duration)\n end \n end\n \n if(schedules)\n \n #turn schedules [Time] into self.classes\n schedules.map { |time| duplicate(time - schedule.start_time + (self.start.localtime.utc_offset - time.localtime.utc_offset)) }\n else\n []\n end\n else\n [self]\n end\n end",
"def filter_schedule\n if !NcsNavigatorCore.configuration.with_specimens?\n scheduled_activity_report.without_collection!\n end\n end",
"def overlaps?\n self.class.all.any? do |other|\n (start_hour > other.start_hour && start_hour < other.end_hour) ||\n (end_hour > other.start_hour && end_hour < other.end_hour)\n end\n end",
"def overlapping\n return unless start_date && end_date && room && program.try(:tracks)\n\n (program.tracks.accepted + program.tracks.confirmed - [self]).each do |existing_track|\n next unless existing_track.room == room && existing_track.start_date && existing_track.end_date\n\n if start_date >= existing_track.start_date && start_date <= existing_track.end_date ||\n end_date >= existing_track.start_date && end_date <= existing_track.end_date ||\n start_date <= existing_track.start_date && end_date >= existing_track.end_date\n errors.add(:track, 'has overlapping dates with a confirmed or accepted track in the same room')\n break\n end\n end\n end",
"def schedule(startAt,endAt,opts={})\n ## Caching ##\n @schedules ||= {}\n if @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash]\n return @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash]\n end\n ## End Caching ##\n\n # TODO Handle events starting within the range but ending outside of it?\n\n # TODO Offload this selection to the database; okay for testing though\n # NOTE This is actually faster thanks to the query cache for small numbers of operating times, but not very scalable\n #all_regular_operating_times = OperatingTime.find(:all, :conditions => {:place_id => self.id, :override => 0}).select{|t| (t.startDate - 1) <= endAt.to_date and startAt.to_date <= (t.endDate + 1)}\n #all_special_operating_times = OperatingTime.find(:all, :conditions => {:place_id => self.id, :override => 1}).select{|t| (t.startDate - 1) <= endAt.to_date and startAt.to_date <= (t.endDate + 1)}\n # Select all relevant times (1 day buffer on each end)\n # NOTE Make sure to use generous date comparisons to allow for midnight rollovers\n all_regular_operating_times = OperatingTime.regular.by_place_id(self.id).in_range(startAt..endAt).find(:all)\n all_special_operating_times = OperatingTime.special.by_place_id(self.id).in_range(startAt..endAt).find(:all)\n\n puts \"\\nRegular OperatingTimes: #{all_regular_operating_times.inspect}\" if DEBUG\n puts \"\\nSpecial OperatingTimes: #{all_special_operating_times.inspect}\" if DEBUG\n\n regular_times = []\n special_times = []\n special_ranges = []\n\n all_special_operating_times.each do |ot|\n puts \"\\nSpecial Scheduling for: #{ot.inspect}\" if DEBUG\n\n # Special Case: Overriding with NO times (e.g. closed all day)\n if ot.start == 0 and ot.length == 0 and startAt.to_date <= ot.startDate\n # Block out the range, but don't add the \"null Times\"\n special_ranges << Range.new(ot.startDate,ot.endDate)\n next\n end\n\n # Start a day early if possible\n earlyStart = startAt-1.day < ot.startDate.midnight ? startAt.midnight : startAt - 1.day\n puts \"EarlyStart: #{earlyStart.inspect}\" if DEBUG\n\n # Calculate the next set up open/close times\n open,close = ot.next_times(earlyStart)\n next if open.nil? # No valid occurrences in the future\n\n while not open.nil? and open <= endAt do\n if DEBUG\n puts \"Open: #{open}\"\n puts \"Close: #{close}\"\n puts \"Start Date: #{ot.startDate} (#{ot.startDate.class})\"\n puts \"End Date: #{ot.endDate} (#{ot.endDate.class})\"\n end\n\n if close < startAt # Skip forward to the first occurrance in our time range\n puts \"Seeking: #{close} < #{startAt}\" if DEBUG\n open,close = ot.next_times(close)\n next\n end\n\n special_times << [open,close]\n special_ranges << Range.new(ot.startDate,ot.endDate)\n open,close = ot.next_times(close)\n end\n\n end\n\n puts \"\\nSpecial Times: #{special_times.inspect}\" if DEBUG\n puts \"\\nSpecial Ranges: #{special_ranges.inspect}\" if DEBUG\n\n all_regular_operating_times.each do |ot|\n puts \"\\nRegular Scheduling for: #{ot.inspect}\" if DEBUG\n\n # Start a day early if possible\n earlyStart = startAt-1.day < ot.startDate.midnight ? startAt : startAt - 1.day\n puts \"EarlyStart: #{earlyStart.inspect}\" if DEBUG\n\n # Calculate the next set up open/close times\n open,close = ot.next_times(earlyStart)\n if DEBUG\n puts \"\"\n puts \"Open: #{open}\"\n puts \"Close: #{close}\"\n end\n\n if open.nil? # No valid occurrences in the future\n puts \"Skipping: No valid occurrences in the future.\" if DEBUG\n next\n end\n\n while not open.nil? and open <= endAt do\n if DEBUG\n puts \"\"\n puts \"Open: #{open}\"\n puts \"Close: #{close}\"\n end\n\n if close < startAt # Skip forward to the first occurrance in our time range\n puts \"Seeking: #{close} < #{startAt}\" if DEBUG\n open,close = ot.next_times(close)\n next\n end\n\n overridden = false\n special_ranges.each do |sr|\n overridden ||= sr.member?(open.to_date)\n end\n if overridden\n puts \"Overridden\" if DEBUG\n open,close = ot.next_times(close)\n next\n end\n\n # FIXME Causing an infinite loop; would be nice if this worked\n #open = startAt if open < startAt\n #close = endAt if close > endAt\n\n regular_times << [open,close]\n open,close = ot.next_times(close)\n end\n\n end\n\n puts \"\\nRegular Times: #{regular_times.inspect}\" if DEBUG\n\n # TODO Handle schedule overrides\n # TODO Handle combinations (i.e. part special, part regular)\n\n final_schedule = (regular_times+special_times).sort{|a,b|a[0] <=> b[0]}\n\n ## Truncate times larger than range ##\n if opts[:truncate]\n final_schedule.each_index do |i|\n final_schedule[i][0] = startAt.dup if final_schedule[i][0] < startAt\n final_schedule[i][1] = endAt.dup if final_schedule[i][1] > endAt\n end\n end\n ## End truncating ##\n\n ## Caching ##\n @schedules ||= {}\n @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash] = final_schedule\n ## End caching ##\n\n final_schedule\n end",
"def does_not_overlap\n found_overlap = false\n start_date_time = params[:start_date_time]\n stop_date_time = params[:stop_date_time]\n deliverable_id = params[:deliverable_id]\n \n tmp_effort_log = EffortLog.new(:deliverable_id => deliverable_id, \n :start_date_time => start_date_time, \n :stop_date_time => stop_date_time)\n \n EffortLog.all.each do |effort_log|\n if tmp_effort_log.overlaps? (effort_log)\n found_overlap = true\n end\n end \n \n # return a json string\n respond_to do |format|\n format.json { render :json => {:doesNotOverlap => !found_overlap} }\n end \n end",
"def overlaps_with_resource_reservation(resource_reservation)\n\t\t\t\t\t\twhere(\n\t\t\t\t\t\t\t\"\n\t\t\t\t\t\t\t\t(#{ActiveRecord::Base.connection.quote_column_name(\"date_from\")} = :date_from) AND \n\t\t\t\t\t\t\t\t(#{ActiveRecord::Base.connection.quote_column_name(\"time_from\")} < :time_to) AND \n\t\t\t\t\t\t\t\t(:time_from < #{ActiveRecord::Base.connection.quote_column_name(\"time_to\")})\n\t\t\t\t\t\t\t\", \n\t\t\t\t\t\t\tdate_from: resource_reservation.date_from, # TODO suppor multi-day events/reservations\n\t\t\t\t\t\t\ttime_from: resource_reservation.time_from, \n\t\t\t\t\t\t\ttime_to: resource_reservation.time_to\n\t\t\t\t\t\t)\n\t\t\t\t\tend",
"def conflicts\n if new_record?\n query = 'unit_id = ? AND daterange(start_at, end_at) && daterange(?, ?)'\n Reservation.where(query, unit_id, start_at, end_at)\n else\n query = 'id <> ? AND unit_id = ? AND daterange(start_at, end_at) && daterange(?, ?)'\n Reservation.where(query, id, unit_id, start_at, end_at)\n end\n end",
"def load_filtered_ended_workshops\n # Default to the last week, by schedule\n end_date = params[:end] || Date.today\n start_date = params[:start] || end_date - 1.week\n query_by = params[:query_by] || QUERY_BY_SCHEDULE\n course = params[:course]\n\n workshops = Pd::Workshop.in_state(::Pd::Workshop::STATE_ENDED)\n unless current_user.permission?(UserPermission::WORKSHOP_ADMIN)\n workshops = workshops.organized_by current_user\n end\n\n # optional '-' (meaning not) followed by a course name\n if course && (match = /^(-)?(.+)$/.match course)\n course_name = COURSE_MAP[match[2]]\n workshops =\n if match[1]\n workshops.where.not(course: course_name)\n else\n workshops.where(course: course_name)\n end\n end\n\n workshops =\n if query_by == QUERY_BY_END\n workshops.end_on_or_after(start_date).end_on_or_before(end_date)\n else # assume by schedule\n workshops.scheduled_start_on_or_after(start_date).scheduled_start_on_or_before(end_date)\n end\n\n workshops\n end",
"def refresh_trip_schedules!\n excluded_dates = exclusion_dates.order(:excluded_date).map(&:excluded_date)\n\n # Try to build a list of valid trip schedules between the two trip\n # boundries\n updated_trip_schedules = [] \n working_date = boundry_start\n while working_date + duration.days < boundry_end do\n potential_start = working_date.to_date\n potential_end = (working_date + duration.days).to_date\n potential_range = (potential_start..potential_end)\n\n # tick the working date\n working_date = working_date + 1.day\n\n # Check trip day of week exclusions\n # next unless potential_range.any? { |date| dow_restriction_indexes.any? { |exclusion| exclusion.include? date.wday }}\n next unless dow_restriction_indexes.any? { |required_dows| required_dows.all? { |required_dow| potential_range.any? { |date| required_dow == date.wday }}}\n\n # Check excluded dates\n next if excluded_dates.any? { |excluded_date| (potential_range).include? excluded_date.to_date }\n\n # Create a trip schedule if it doesn't already exist\n ap potential_start\n updated_trip_schedules << TripSchedule.where(\n :trip => self,\n :start_date => potential_start.in_time_zone('EST'),\n :end_date => potential_end.in_time_zone('EST')\n ).first_or_initialize\n end\n\n self.trip_schedules = updated_trip_schedules\n save!\n end",
"def coliding_events\n \n\n # TODO scope this by room. ie an event is only in\n # collision when it is in the same room as another\n\n e0 = Event.arel_table\n e1 = Event.arel_table.alias # because we do a self join\n\n # compare self events \n j0 = e0[:schedule_id].eq(id)\n j1 = e1[:schedule_id].not_eq(id)\n \n # and find events on the same dates\n j2 = overlap_query \\\n e0[:start_at],\n e0[:end_at],\n e1[:start_at],\n e1[:end_at],\n false\n\n\n q = e0.join(e1).on(j0.and(j1))\n\n Event.joins(q.join_sql).where(j2)\n end",
"def create_schedule_conflict(rname,day,stime,etime)\r\n #flag=false\r\n @statuss=Status.find(:all,:conditions => [\"room_name = ? AND schedule_day = ?\",rname,day])\r\n if @statuss\r\n @statuss.each do |s|\r\n if time_conflict(stime,etime,s[\"start_time\"],s[\"end_time\"])\r\n return true\r\n end\r\n end\r\n end\r\n return false\r\n end",
"def scheduleConflict(course, applicant)\n\t# splits applicant schedule into information about individual days\n\t@daySchedule = applicant[:schedule].split(';')\n\t@classAppSchedule = []\n\t# fills in info for days with schedule not given by some values which are not supposed to trigger any overlaps\n\t@daySchedule.each{ |day| \n\tunless day =~ /\\A(\\d{2}:\\d{2}-\\d{2}:\\d{2},)*\\d{2}:\\d{2}-\\d{2}:\\d{2}\\z/\n\t\tday = \"00 : 03 - 00 : 04\"\n\tend\n\t# reformats schedule with values which are easier to work with\n\t@classAppSchedule.append(day.split(',').map{|time| timeIntervalToNumberInterval(time)})}\n\t@classCourseSchedule = []\n\t# obtains and reformats class time. Here we assume each class has same time different week days, because if it has different times, they would be split into different instances by our schema, and thus handled by this function separately. \n\t@courseTime = course[:time]\n\tif (@courseTime == \"ARR\")\n\t\t@courseTime = \"00 : 00 - 00 : 01\"\n\tend\n\twhile(!(@courseTime[0] =~ /\\d/)) \n\t\t@courseTime = @courseTime[1..-1]\n\tend\n\t@courseTime = timeIntervalToNumberInterval(@courseTime)\n\t@nil = timeIntervalToNumberInterval(\"00 : 00 - 00 : 01\")\n\t# append course time if there is a class that day, otherwise append nil time, which will cause no overlaps\n\tif (course[:time].include?(\"M\"))\n \t\t@classCourseSchedule.append(@courseTime)\n\n\telse \n\t\t@classCourseSchedule.append(@nil)\n\tend\n\tif (course[:time].include?(\"T\") )\n\t\t@classCourseSchedule.append(@courseTime)\n\n\telse \n\t\t@classCourseSchedule.append(@nil)\n\tend\n\tif (course[:time].include?(\"W\")) \n\t\t@classCourseSchedule.append(@courseTime)\n\n\telse \n\t\t@classCourseSchedule.append(@nil)\n\tend\n\tif (course[:time].include?(\"R\")) \n\t\t@classCourseSchedule.append(@courseTime)\n\n\telse \n\t\t@classCourseSchedule.append(@nil)\n\tend\n\tif (course[:time].include?(\"F\")) \n\t\t@classCourseSchedule.append(@courseTime)\n\n\telse \n\t\t@classCourseSchedule.append(@nil)\n\tend\n\n\n\toverlapWeek(@classAppSchedule, @classCourseSchedule)\n\n\nend",
"def not_overlapping\n @meetingsRD = Meeting.where(\"day = ? and room = ?\", day, room)\n overlap = false\n @meetingsRD.each do |mtng|\n if (id != mtng.id)\n if ((finish <= mtng.start) || (start >= mtng.finish))\n overlap = false\n else\n overlap = true\n errors.add(:finish, 'Sorry! It overlaps ' + (mtng.subject).upcase + ' meeting')\n errors.add(:start, 'Sorry! It overlaps ' + (mtng.subject).upcase + ' meeting')\n break #if overlap, finish the loop\n end\n end\n end\n end",
"def search\n '''\n param: date - string\n param: start - string\n param: capacity - string\n param: length - string\n\n '''\n\n avail_rooms_id = []\n i = 1\n start_date_time = Time.parse(params[:date] + \" \" + params[:start])\n end_date_time = start_date_time + (60 * 60 * Integer(params[:length]))\n curr_date_time = start_date_time + (60 * 60)\n meal_room_cap = Integer(params[:capacity]) * 6/10\n comp_room_cap = Integer(params[:capacity]) * 1/10\n\n # Finds and adds conference to desired schedule id's\n conf_room = Schedule.where(\"cap > ? and time = ? and date = ? and avail = true\", \n params[:capacity], \n params[:start], \n params[:date]\n ).ids.first\n\n avail_rooms_id << conf_room\n\n while(curr_date_time != end_date_time - (60 * 60)) do\n \n curr_hour = curr_date_time.strftime('%I:%M %p')\n curr_date = curr_date_time.strftime('%F')\n \n # If i % 6, find room to eat with 60% of participants \n if i % 6 == 0\n\n meal_room = Schedule.where(\"cap > ? and time = ? and date = ? and food = true and avail = true\",\n meal_room_cap,\n curr_hour,\n curr_date\n ).ids.first\n\n avail_rooms_id << meal_room\n\n # else find room with computers to support 10% of participants\n else\n\n comp_room = Schedule.where(\"cap > ? and time = ? and date = ? and comp_avail = true and avail = true\",\n comp_room_cap,\n curr_hour,\n curr_date\n ).ids.first\n \n avail_rooms_id << comp_room\n \n end\n \n # Increments iteration, date, and time\n i += 1\n curr_date_time += (60 * 60)\n end\n\n # Finds and adds final room to desired schedule id's\n final_room = Schedule.where(\"cap > ? and time = ? and date = ?\",\n params[:capacity],\n end_date_time.strftime('%I:00 %p'),\n end_date_time.strftime('%F')\n ).ids.first\n \n avail_rooms_id << final_room\n\n # Checks if rooms were found and assigns them to instance variable\n if avail_rooms_id.empty? == false\n @avail_rooms = Schedule.find(avail_rooms_id)\n end\n end",
"def all_schedules\n non_persistent_schedules.merge(persistent_schedules)\n end",
"def unscheduled_maintenances(start_time, end_time)\n unsched_maintenances = @check.unscheduled_maintenances_by_start.\n intersect_range(start_time, end_time, :by_score => true).all\n\n # to see if we start in an unscheduled maintenance period, we must check all unscheduled\n # maintenances before the period and their durations\n start_in_unsched = start_time.nil? ? [] :\n @check.unscheduled_maintenances_by_start.\n intersect_range(nil, start_time, :by_score => true).all.select {|pu|\n pu.end_time >= start_time\n }\n\n {:unscheduled_maintenances => (start_in_unsched + unsched_maintenances)}\n end",
"def schedules\n\t\t@schedules = Schedule.includes(:schedulable).all\n\tend",
"def overlapping_requests\n CatRentalRequest\n .where('? >= start_date', self.end_date)\n .where('? <= end_date', self.start_date)\n .where('? IS NULL OR id != ?', self.id, self.id)\n end",
"def available_criteria\n @available_criteria ||= Redmine::Helpers::TimeReport.get_available_criteria(project)\n end",
"def schedules\n\t\t@schedules = Schedule.all\n\tend",
"def no_time_overlap\n @other_bookings = Booking.where(:date => date)\n @other_bookings.each do |other_booking|\n if other_booking.time.strftime(\"%I:%M%p\") == time.strftime(\"%I:%M%p\") && other_booking.room_id == room_id\n errors.add(:time, \"Cannot book, overlapping sessions!\")\n end\n end\n end",
"def article_schedule(date_cond)\n # current_user's schedules\n schedule_ids = schedule_ids_during(date_cond, @current_user)\n \n unless @other_user.blank?\n other_schedule_ids = schedule_ids_during(date_cond, @other_user)\n schedule_ids = (schedule_ids.to_set & other_schedule_ids.to_set).to_a\n end\n# return [] if schedule_ids.blank?\n schedule_ids.blank? and return [] \n \n Article.find schedule_ids,\n :select => Article_Schedule_Item,\n :scope => \":self >> thread:ArticleThread\",\n :conditions=> forum_cond,\n :group => \"articles.id\"\n end",
"def is_scheduled_to_be_off\n offset_to_pdt = -25200\n current_time = Time.now.utc + offset_to_pdt\n current_time_minutes = (current_time.hour * 60) + current_time.min\n self.schedules.each do |schedule|\n return true if (current_time_minutes > schedule.start_time) && (current_time_minutes < schedule.end_time)\n end\n false\n end",
"def schedule\n @schedule ||= all_schedules\n @schedule || {}\n end",
"def find_resident_session_conflict(resident_session)\n conflicting_resident_session = nil\n resident = resident_session.resident\n session = resident_session.session \n\n self.sessions.resident_sessions.all.each do |existing_resident_session|\n\n if existing_resident_session.resident.name == resident.name \n if existing_resident_session.session.overlaps? session\n #puts \" >>> found overlap...<<<\"\n conflicting_resident_session = existing_resident_session\n end\n \n #puts \">>> printing all conflicts after adding\"\n #puts all_conflicts\n #puts \"<<<\"\n end\n end\n \n conflicting_resident_session\n end",
"def cur_calendars\n Article.find(:all, :conditions => ['issue_id = ? AND ((priority >= 50 AND priority < 55) OR (priority >= 70 AND priority < 75))', id], :order => 'priority')\n end",
"def schedule\n \t\n \t@attributes[:schedule].empty? ? nil : self.belongs_to.schedules.find { |schedule| schedule.name == @attributes[:schedule].intern }\n end",
"def overlaps\n siblings.overlaps date, date_ended\n end",
"def find_reservation_by_timeslot(timeslot, existing_reservations)\n t_next = timeslot + 30.minutes #next iteration's time\n timeslot = timeslot\n\n # Get existing reservations in this room from previously queried elasticsearch result\n room_reservations = existing_reservations.find {|r| r[id.to_i]}\n unless room_reservations.blank?\n # Return a has with the reservation information if it is found in the collection of reservations for this room in this timeslot\n reservation = room_reservations[id.to_i].find {|r| (r._source.start_dt.to_datetime >= timeslot and r._source.end_dt.to_datetime <= t_next) or (r._source.start_dt.to_datetime <= timeslot and r._source.end_dt.to_datetime >= t_next) }\n return reservation\n end\n\n end",
"def check_conflict\n\n params[:id] = params[:id] ? params[:id] : 0\n flag = false\n arr_wd_sche_now = params[:a_day_check].each.map{|c| c.to_i}\n if params[:repeat_sche] == \"false\"\n start_date = format_date(params[:start_date])\n end_date = format_date(params[:end_date])\n @schedules = current_user.working_schedules.where(\"(:start_date BETWEEN start_date AND end_date) AND (:end_date BETWEEN start_date AND end_date) AND active = TRUE\",start_date: start_date, end_date: end_date).where.not(id: params[:id])\n @schedules.each do |sc|\n arr_wd_sches = sc.working_days.select(\"day_of_week\").where(open: true).map{ |w| w.day_of_week}\n arr_wd_sches.each do |c|\n if arr_wd_sche_now.include? c\n flag = true\n end\n end\n end\n render json: flag\n else\n start_date = format_date(params[:start_date])\n @schedules = current_user.working_schedules.where(\"(end_date >= :today) AND active = TRUE\",today: Date.today).where.not(id: params[:id])\n @schedules.each do |sc|\n arr_wd_sches = sc.working_days.select(\"day_of_week\").where(open: true).map{ |w| w.day_of_week}\n arr_wd_sches.each do |c|\n if arr_wd_sche_now.include? c\n flag = true\n end\n end\n end\n render json: flag\n end\n end",
"def front_rear_and_internal_collisions\n colliding_with.where(ended: false).where('reservations.starts_at' => range) + colliding_with.where('reservations.ends_at' => range)\n end",
"def awake_overnights\n\t\tPerson.find(:all,\n\t\t\t\t\t\t\t\t:conditions => \"people.position = 'Awake Overnight' AND house_id = #{self.id}\", \n\t\t\t\t\t\t\t\t:joins => :houses, \n\t\t\t\t\t\t\t\t:order => \"last_name, first_name ASC\")\n\tend",
"def soon range=4.days\n schedules.where(:when.lte => range.from_now)\n end",
"def is_conflict?(param_start, param_end, room_object)\n check = room_object.reservations.where(\"(? < start_date AND end_date < ?) AND status = ?\", param_start, param_end, 1)\n check.size > 0 ? true : false\n end",
"def schedule(schedule)\n @filing_1.rows_like(schedule.to_sym) - @filing_2.rows_like(schedule.to_sym)\n end",
"def schedule\n schedule = start_time > Time.current ? UPCOMING_MATCH : PLAYED_MATCH\n\n schedule\n end",
"def overtime_staff\n\t\tPerson.find(:all, \n\t\t\t\t\t\t\t\t:conditions => \"people.position = 'Heritage Specialty' AND house_id = #{self.id} OR people.position = 'Middleton 4' AND house_id = #{self.id}\",\n\t\t\t\t\t\t\t\t:joins => :houses,\n\t\t\t\t\t\t\t\t:order => \"last_name, first_name ASC\")\n\tend",
"def relevant_check_for_schedule(schedule)\n schedules\n .select { |_, value| value == schedule.to_s }\n .map(&:first)\n .min_by { |check| CHECKS.index(check) }\n end",
"def overlapping_requests\n CatRentalRequest.where(\"(start_date BETWEEN '#{self.start_date}' AND '#{self.end_date}' OR\n end_date BETWEEN '#{self.start_date}' AND '#{self.end_date}') AND\n cat_id = #{self.cat_id}\")\n end",
"def overdue?\n schedules.each do |schedule|\n # date the next scheduled occurence should be calculated from\n calc_date = [last_run, modified_on || created_on].max\n next_occurence = schedule.get_scheduled_date(calc_date)\n logger.debug \"Next scheduled occurence for schedule id \\\n #{schedule.id} is #{next_occurence}\"\n return true if next_occurence < Time.now\n end\n false\n end",
"def should_not_overlap\n if table.reservations.where(\"time_from <= ? AND time_to > ? AND NOT id = ?\", time_from, time_from, id).count > 0\n errors.add(:time_from, \"shouldn't overlap with existing reservation\")\n end\n if table.reservations.where(\"time_from < ? AND time_to >= ? AND NOT id = ?\", time_to, time_to, id).count > 0\n errors.add(:time_from, \"shouldn't overlap with existing reservation\")\n end\n if table.reservations.where(\"time_from >= ? AND time_to <= ? AND NOT id = ?\", time_from, time_to, id).count > 0\n errors.add(:time_from, \"shouldn't overlap with existing reservation\")\n end\n end",
"def get_all_schedules\n pluck_fields = {\n \"id\": \"id\",\n \"day_of_the_week\": \"day_of_the_week\",\n \"schedules.departure_time\": \"departure_time\",\n \"frequency\": \"schedule_frequency\",\n \"trains.seats\": \"available_seats\",\n \"cities.name\": \"from_city\",\n \"to_cities_trains.name\": \"to_city\",\n \"dispatchers.name\": \"dispatcher_name\"\n }.to_a\n\n query = TrainSchedule.joins(train: [:from_city, :to_city, :dispatcher]).\n joins(:schedule)\n \n\n return _execute_schedule_query(query, pluck_fields) \n end",
"def filter_schedules(schedules)\n # filter out all the false and invalid entries from the array\n schedules = schedules.select {|s| s && valid_schedule?(s) && !s.empty?}\n\n if (schedules.empty?)\n return false\n end\n\n return schedules\n end",
"def open_occurrences(days_out = 90, date_start = Time.zone.now)\n schedule = IceCube::Schedule.new(date_start)\n date_end = date_start + days_out.days\n\n # add a recurrence for each business day\n business_days.each do |bd|\n day = bd.name.downcase.to_sym\n schedule.add_recurrence_rule IceCube::Rule.weekly.day(day)\n end\n\n return schedule.occurrences(date_end)\n end",
"def _find_train_schedule(date = \"2017-06-30\", start_location = 3, end_location = 1)\n day = _string_to_date(date).day\n week = _convert_day_to_week(day)\n \n frequencies_to_search = []\n frequencies_to_search << \"every_week\"\n frequencies_to_search << \"biweekly_odd_weeks\" if week%2 == 1\n frequencies_to_search << \"biweekly_even_weeks\" if week%2 != 1\n frequencies_to_search << \"monthly_week\" + week.to_s\n\n pluck_fields = {\n \"schedules.departure_time\": \"departure_time\",\n \"trains.seats\": \"available_seats\",\n \"cities.name\": \"from_city\",\n \"to_cities_trains.name\": \"to_city\",\n \"dispatchers.name\": \"dispatcher_name\",\n \"day_of_the_week\": \"day_of_the_week\"\n }.to_a\n\n day_of_the_week = _day_of_the_week(date)\n day_of_the_week_enum = Schedule.day_of_the_weeks[day_of_the_week]\n\n query = TrainSchedule.joins(train: [:from_city, :to_city, :dispatcher]).\n joins(:schedule).\n where(schedules: { frequency: frequencies_to_search, day_of_the_week: day_of_the_week_enum }, \n trains: {from_city_id: start_location, to_city_id: end_location} \n )\n\n return _execute_schedule_query(query, pluck_fields)\n end",
"def query_by_date\n # find the wdays of the trip\n dates = dates_to_wdays(\n Date.parse(params[:from]),\n Date.parse(params[:to])\n )\n\n # find schedules that fit the wdays of the trip\n schedules = Schedule.where.overlap(wdays: dates)\n\n respond_with TripsBySchedulePresenter.new(schedules).as_json\n end",
"def client_tasks_overdue\n self.find_all {|e| (e.completed.nil? or !e.completed) and e.complete_by < Time.zone.now }\n end",
"def add_schedule(schedule_name)\n return nil if schedule_name == nil or schedule_name == \"\"\n # First check model and return schedule if it already exists\n self.getSchedules.each do |schedule|\n if schedule.name.get.to_s == schedule_name\n OpenStudio::logFree(OpenStudio::Debug, 'openstudio.standards.Model', \"Already added schedule: #{schedule_name}\")\n return schedule\n end\n end\n \n require 'date'\n\n #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"Adding schedule: #{schedule_name}\") \n \n # Find all the schedule rules that match the name\n rules = self.find_objects(self.standards['schedules'], {'name'=>schedule_name})\n if rules.size == 0\n OpenStudio::logFree(OpenStudio::Warn, 'openstudio.standards.Model', \"Cannot find data for schedule: #{schedule_name}, will not be created.\")\n return false #TODO change to return empty optional schedule:ruleset?\n end\n \n # Helper method to fill in hourly values\n def add_vals_to_sch(day_sch, sch_type, values)\n if sch_type == \"Constant\"\n day_sch.addValue(OpenStudio::Time.new(0, 24, 0, 0), values[0])\n elsif sch_type == \"Hourly\"\n for i in 0..23\n next if values[i] == values[i + 1]\n day_sch.addValue(OpenStudio::Time.new(0, i + 1, 0, 0), values[i]) \n end \n else\n #OpenStudio::logFree(OpenStudio::Info, \"Adding space type: #{template}-#{clim}-#{building_type}-#{spc_type}\")\n end\n end\n \n # Make a schedule ruleset\n sch_ruleset = OpenStudio::Model::ScheduleRuleset.new(self)\n sch_ruleset.setName(\"#{schedule_name}\") \n\n # Loop through the rules, making one for each row in the spreadsheet\n rules.each do |rule|\n day_types = rule['day_types']\n start_date = DateTime.parse(rule['start_date'])\n end_date = DateTime.parse(rule['end_date'])\n sch_type = rule['type']\n values = rule['values']\n \n #Day Type choices: Wkdy, Wknd, Mon, Tue, Wed, Thu, Fri, Sat, Sun, WntrDsn, SmrDsn, Hol\n \n # Default\n if day_types.include?('Default')\n day_sch = sch_ruleset.defaultDaySchedule\n day_sch.setName(\"#{schedule_name} Default\")\n add_vals_to_sch(day_sch, sch_type, values)\n end\n\n # Winter Design Day\n if day_types.include?('WntrDsn')\n day_sch = OpenStudio::Model::ScheduleDay.new(self)\n sch_ruleset.setWinterDesignDaySchedule(day_sch)\n day_sch = sch_ruleset.winterDesignDaySchedule\n day_sch.setName(\"#{schedule_name} Winter Design Day\")\n add_vals_to_sch(day_sch, sch_type, values)\n end \n\n # Summer Design Day\n if day_types.include?('SmrDsn')\n day_sch = OpenStudio::Model::ScheduleDay.new(self)\n sch_ruleset.setSummerDesignDaySchedule(day_sch)\n day_sch = sch_ruleset.summerDesignDaySchedule\n day_sch.setName(\"#{schedule_name} Summer Design Day\")\n add_vals_to_sch(day_sch, sch_type, values)\n end\n \n # Other days (weekdays, weekends, etc)\n if day_types.include?('Wknd') ||\n day_types.include?('Wkdy') ||\n day_types.include?('Sat') ||\n day_types.include?('Sun') ||\n day_types.include?('Mon') ||\n day_types.include?('Tue') ||\n day_types.include?('Wed') ||\n day_types.include?('Thu') ||\n day_types.include?('Fri')\n \n # Make the Rule\n sch_rule = OpenStudio::Model::ScheduleRule.new(sch_ruleset)\n day_sch = sch_rule.daySchedule\n day_sch.setName(\"#{schedule_name} #{day_types} Day\")\n add_vals_to_sch(day_sch, sch_type, values)\n \n # Set the dates when the rule applies\n sch_rule.setStartDate(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(start_date.month.to_i), start_date.day.to_i))\n sch_rule.setEndDate(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(end_date.month.to_i), end_date.day.to_i))\n \n # Set the days when the rule applies\n # Weekends\n if day_types.include?('Wknd')\n sch_rule.setApplySaturday(true)\n sch_rule.setApplySunday(true)\n end\n # Weekdays\n if day_types.include?('Wkdy')\n sch_rule.setApplyMonday(true)\n sch_rule.setApplyTuesday(true)\n sch_rule.setApplyWednesday(true)\n sch_rule.setApplyThursday(true)\n sch_rule.setApplyFriday(true)\n end\n # Individual Days\n sch_rule.setApplyMonday(true) if day_types.include?('Mon')\n sch_rule.setApplyTuesday(true) if day_types.include?('Tue')\n sch_rule.setApplyWednesday(true) if day_types.include?('Wed')\n sch_rule.setApplyThursday(true) if day_types.include?('Thu')\n sch_rule.setApplyFriday(true) if day_types.include?('Fri')\n sch_rule.setApplySaturday(true) if day_types.include?('Sat')\n sch_rule.setApplySunday(true) if day_types.include?('Sun')\n\n end\n \n end # Next rule \n \n return sch_ruleset\n \n end",
"def non_persistent_schedules\n @non_persistent_schedules ||= {}\n end",
"def overlapping_dates\n reservation = Reservation.find(params[:id])\n space = reservation.space\n\n start_date = reservation.start_date.to_date\n end_date = reservation.end_date.to_date\n\n confirmed_bookings = space.reservations.where(approved: true)\n\n check = confirmed_bookings.where('? <= DATE(start_date) AND DATE(end_date) <= ?', start_date, end_date)\n return unless check.any?\n\n flash[:danger] = 'You already confirmed another booking request with overlapping dates.'\n redirect_to your_reservations_path\n end",
"def schedule_expired\n return @schedule.end_date && @date > @schedule.end_date\n end",
"def check_overlaps_cargo_department\n\t\t# if some day of availabilityes overlaps whith new period availability.\t\n\t\tav=Availability.where(:department_id => department_id).where('upper(cargo) like ?',\"#{cargo.upcase}\")\n\t\t\t.where(\"((desde - ?) * (? - hasta)) >= 0\", hasta, desde).where(:status => true)\n\n\t\tif av.count>0 # availabilit\n\t\t\t\t\terrors.add(:cargo,\" Ya existe un periodo de disponibilidad mínima para el cargo: '#{cargo}' cuyas fechas coinciden.\")\t\n\t\tend\n\tend",
"def scheduling_index\n @scheduling_index ||= SchedulingIndexByWeekDay.new(y_attribute).with_records_added(records)\n end",
"def time_in_schedule?(schedule, time)\n return schedule.occurring_at? time\n end",
"def no_overlap\n self.class.where(user_id: user.id, time_type: time_type).each do |other_time|\n errors.add(:start_time, \"i'm a sad error\") if overlaps?(other_time)\n end\n end",
"def rule_filter\n x = @game_time_ps_avail.reject { |_k, v| v.empty? }\n return unless x.empty?\n\n if @cur_rule_index < @rules.size - 1\n last_rule = @cur_rule\n @cur_rule_index += 1\n @cur_rule = @rules[@cur_rule_index]\n # Go to the next date (except if the new rule is for the same weekday)\n @cur_date = next_game_date(@cur_date += 1, @cur_rule.wday) if last_rule.wday != @cur_rule.wday\n else\n @cur_rule_index = 0\n @cur_rule = @rules[@cur_rule_index]\n @cur_date = next_game_date(@cur_date += 1, @cur_rule.wday)\n end\n reset_resource_availability\n end",
"def schedules\n params = init_params\n request_url = UrlGenerator.url_for(\"schedules\")\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end",
"def check_overlap\n appointments = Appointment.all\n current_start = DateTime.strptime(self.start_time,\"%m/%d/%y %H:%M\").to_time\n current_end = DateTime.strptime(self.end_time,\"%m/%d/%y %H:%M\").to_time\n\n appointments.each do |appt|\n appt_start = DateTime.strptime(appt.start_time,\"%m/%d/%y %H:%M\").to_time\n appt_end = DateTime.strptime(appt.end_time,\"%m/%d/%y %H:%M\").to_time\n\n ## if the appointment being checked is a new appointment ##\n if @new_appt\n if current_start >= appt_start && current_start <= appt_end\n @valid = false\n elsif current_end >= appt_start && current_end <= appt_end\n @valid = false\n end\n\n ## if the appointment being checked is an old appointment being updated ##\n else\n if current_start > appt_start && current_start < appt_end\n @valid = false\n elsif current_end > appt_start && current_end < appt_end\n @valid = false\n end\n end\n\n end\n @valid\n p @valid\n end",
"def unregistered_events\n tournament\n .schedules\n .keep_if { |s| s.is_scheduled_online? && s.division == division } -\n sign_ups.map{|x| x.try(:timeslot).try(:schedule) }\n end",
"def rule_filter\n x = @game_time_ps_avail.reject{|k,v| v.empty? }\n if x.empty?\n if @cur_rule_index < @rules.size - 1\n last_rule = @cur_rule\n @cur_rule_index += 1\n @cur_rule = @rules[@cur_rule_index]\n # Go to the next date (except if the new rule is for the same weekday)\n @cur_date = next_game_date(@cur_date += 1, @cur_rule.wday) if last_rule.wday != @cur_rule.wday\n else\n @cur_rule_index = 0\n @cur_rule = @rules[@cur_rule_index]\n @cur_date = next_game_date(@cur_date += 1, @cur_rule.wday)\n end\n reset_resource_availability\n end\n end",
"def find_schedules(season, day)\n return add_regular \"#{season}_#{day}\" if @schedules.key? \"#{season}_#{day}\"\n\n (1..13).to_a.reverse_each do |hearts|\n if @schedules.key? \"#{day}_#{hearts}\"\n add_possibility \"#{day}_#{hearts}\", \"At least #{hearts} hearts with #{@person}\"\n end\n end\n\n return add_regular day.to_s if @schedules.key? day.to_s\n\n add_possibility 'bus', MAIL['ccVault'] if @person == 'Pam'\n\n add_possibility 'rain', 'If raining', rain: true if @schedules.key? 'rain'\n add_possibility 'rain2', 'If raining', rain: true, increment: false if @schedules.key? 'rain2'\n\n (13..1).each do |hearts|\n if @schedules.key? \"#{season}_#{day_of_week(day)}_#{hearts}\"\n add_possibility \"#{season}_#{day_of_week(day)}_#{hearts}\", \"At least #{hearts} hearts with #{@person}\"\n end\n end\n\n return add_regular \"#{season}_#{day_of_week(day)}\" if @schedules.key? \"#{season}_#{day_of_week(day)}\"\n return add_regular day_of_week(day) if @schedules.key? day_of_week(day)\n return add_regular season.to_s if @schedules.key? season.to_s\n return add_regular \"spring_#{day_of_week(day)}\".to_s if @schedules.key? \"spring_#{day_of_week(day)}\"\n return add_regular 'spring' if @schedules.key? 'spring'\n\n add_regular 'noschedule'\n end",
"def check_overlapping_dates\n # compare this new reservation againsts existing reservations\n if start_date.present? and end_date.present?\n listing.reservations.each do |old_reservation|\n if overlap?(self, old_reservation)\n return errors.add(:The_dates_are_not_available, \"\")\n end\n end\n end\n end",
"def get_active_workouts_for_day(date)\n self.workouts.where(\"? = start_date OR (? BETWEEN workouts.start_date AND workouts.end_date)\", date, date)\n end",
"def neighborhood_openings(start_date, end_date)\n self.listings.select {|l| l.reservations.where(\"checkout < start_date OR checkin > end_date\")}\n end",
"def check_for_sport_event\n events = SportEvent.where('sport_events.event_date = ? AND sport_events.team_first = ? AND sport_events.team_second = ? AND sport_events.sport = ? AND sport_events.scenario_name = ?', self.event_date, self.team_first, self.team_second, self.sport, self.scenario_name)\n # Second round to found nearly same events\n if events.empty?\n events = SportEvent.where('sport_events.event_date = ? AND sport_events.team_first ILIKE ? AND sport_events.team_second ILIKE ? AND sport_events.sport = ? AND sport_events.scenario_name = ?', self.event_date, \"%#{self.team_first}%\", \"%#{self.team_second}%\", self.sport, self.scenario_name)\n end\n\n if events.empty?\n event = SportEvent.create_from_sport_trade(self)\n else\n event = events.first\n end\n\n # Add the Sport Trade to the Sport Event\n event.sport_trades << self\n end",
"def matches\n @same_location = Ride.where(\"lower(start) like ? AND lower(destination) like ? AND id != ?\", self.start.downcase, self.destination.downcase, self.id)\n @same_location.where(\"start_time between ? and ? or end_time between ? and ?\", self.start_time, self.end_time, self.start_time, self.end_time)\n end",
"def past_calendar_events\n self.calendar_events.joins(:event).where(\"DATEDIFF(`start_time`,?) < 0\", Time.now.beginning_of_day)\n end",
"def check_overlap\n bookings = @parking_space.booking.all\n booking = booking_params.values\n for currentBooking in bookings\n if booking.at(3).to_i < currentBooking.finish_time.to_i && currentBooking.start_time.to_i < booking.at(4).to_i\n return true\n end \n end\n return false\n end",
"def future from=7.days\n schedules.where(:when.gte => from.from_now)\n end",
"def update_occurrences\n occurrences.destroy_all\n if recurrence_rules.any?\n recurrence_horizon = Time.now + (Radiant::Config['event_calendar.recurrence_horizon'] || 10).to_i.years\n to_ri_cal.occurrences(:before => recurrence_horizon).each do |occ|\n occurrences.create!(self.attributes.merge(:start_date => occ.dtstart, :end_date => occ.dtend, :uuid => nil)) unless occ.dtstart == self.start_date\n end\n end\n end",
"def equipment_overlap\n Event.all.each do |event|\n if event.starttime && starttime && event.endtime && endtime && event.date && event.kind == \"Shoot\" && kind == \"Shoot\"\n if overlaps?(event) && (event.equipment & equipment) != [] && event.date == date\n errors.add(:equipment, \"There is an equipment overlap with: \" + \" \" + event.kind + \" on \" + event.date.strftime(\"%m/%d/%y\") + \" at \" + event.starttime.strftime(\"%I:%m %p\"))\n errors.add(:equipment, \"Equipment: \" + (event.equipment & equipment).to_sentence)\n end\n end\n end\n end",
"def overlapping\n return unless calendar && sibling_overlappings?\n errors.add(:base, :overlapping)\n end",
"def list_production_schedules\n\n return if authorise_for_web('runs', 'view') == false\n\n if session[:runs_schedules]!= nil\n render_list_production_schedules\n return\n end\n\n list_query = \"ProductionSchedule.find_all_by_production_schedule_status_code('closed',\n\t\t\t\t :order => 'production_schedule_name')\"\n session[:query] = list_query\n session[:runs_schedules]= list_query\n render_list_production_schedules\n\n\n end",
"def index\n @schedules = Schedule.where(start: params[:start]..params[:end])\n end",
"def check_overlapping_dates\n #compare this new reservation against existing reservations\n listing.reservations.each do |old_booking|\n if overlap?(self, old_booking)\n return errors.add(:overlapping_dates, \"The booking dates are not available\")\n end\n end\n\n end",
"def index\n if params[:from] && params[:to]\n @schedules = Schedule.term_between(\n Date.new(params[:from][:year].to_i, params[:from][:month].to_i, params[:from][:day].to_i),\n Date.new(params[:to][:year].to_i, params[:to][:month].to_i, params[:to][:day].to_i).tomorrow)\n else\n @schedules = Schedule.all\n end\n end",
"def can_create_overdue_or_under_repair_schedule?\n kit_schedule = KitSchedule.new\n kit_schedule.current_user = User.current_user\n return kit_schedule.can_create_overdue_or_under_repair?(self.center_ids)\n end",
"def overlaps?(other)\n start <= other.end_date && other.start <= self.end_date\n end",
"def schedules\n @doc.at_xpath('/a:akomaNtoso/a:components/a:component/a:doc[@name=\"schedules\"]/a:mainBody', a: NS)\n end",
"def has_schedule?\n self.schedule != nil\n end",
"def deduplicate\n @schedule = @schedule.group_by(&:date).map do |date, day|\n # Sort by configured priorty and return only the first\n day.sort { |a, b| COST_PRIORITY[b.city] <=> COST_PRIORITY[a.city] }.first\n end\n end",
"def reserveRoom(date, time, scheduleTable)\n j=0\n reservedRooms = []\n while j < scheduleTable.size\n if date == scheduleTable[j][\"Date\"] && time == scheduleTable[j][\"Time\"] && self.building == scheduleTable[j][\"Building\"] && self.roomNum == scheduleTable[j][\"Room\"]\n scheduleTable[j][\"Available\"] = \"false\"\n end\n j+=1\n end\n end",
"def past_teams\n Team.find_by_sql([\"SELECT t.* FROM teams t INNER JOIN team_assignments ta ON ( t.id = ta.team_id) INNER JOIN users u ON (ta.user_id = u.id) INNER JOIN courses c ON (t.course_id = c.id) WHERE u.id = ? AND (c.semester <> ? OR c.year <> ?)\", self.id, AcademicCalendar.current_semester(), Date.today.year])\n end",
"def saisieable_organisms_with_room\n rooms.select {|r| r.look_for {r.organism.periods.any?} }\n end",
"def poolplay_team_objects\n self.teams.select { |team| !team.playoffs }\n end",
"def check_overlapping_dates\n\t # compare this new booking againsts existing bookings\n\t listing.reservations.each do |old_reservation|\n\t if overlap?(self, old_reservation)\n\t return errors.add(:overlapping_dates, \"The booking dates conflict with existing bookings\") \n\t end\n\t end\n\tend",
"def reservations_by_room_and_range(room_num_query, range_query)\n return @reservations.find_all { |res| res.room_num == room_num_query && res.range.overlap?(range_query) }\n end",
"def find_matches(start_time, end_time)\n\n\t\tstations_and_observations_join = DB[:stations].join(DB[:weather_data], :station_id => :id)\n\n\t\tinitial_match_query = stations_and_observations_join.where(\n\t\t\t:temp => (temp - 1)..(temp + 1)).where(\n\t\t\t:dewpoint => (dewpoint - 1)..(dewpoint + 1)).where(\n\t\t\t:weather_primary_coded => weather_primary_coded).where{\n\t\t\ttime >= start_time}.where{\n\t\t\ttime <= end_time}.exclude(\n\t\t\t:station_id => station.id)\n\n\t\tquery = initial_match_query\n\n# have example where this is not filtering out a match with a difference greater than 5\n# if this was working properly you wouldn't need the more specific humidity/windspeed scoring\n\t\tif wind_kph\n\t\t\tquery = query.where(\n\t\t\t\t:wind_kph => (wind_kph - 5)..(wind_kph + 5))\n\t\tend\n\n\t\tif humidity\n\t\t\tquery = query.where(\n\t\t\t\t:humidity => (humidity - 5)..(humidity + 5))\n\t\tend\n\n\t\tquery.all\n\n\tend",
"def get_workouts_ending_for_day(date)\n self.workouts.where([\"(? = workouts.start_date AND workouts.end_date is null) OR (? = workouts.end_date)\", date, date]).order('start_date ASC')\n end",
"def filter_events_schedules(conference, filter)\n conference.program.selected_event_schedules(\n includes: [:event, :room, { event:\n %i[event_type speakers speaker_event_users track program] }]\n ).select(&filter)\n end",
"def week_schedule\n object.employees.uniq{|u| u.id}.map{|u|\n ::EmployeeSerializer.new(u, scope: scope, root: false, event: object)\n }\n end",
"def set_schedule\n @schedule = Schedule.where(id: params[:id].to_i, organization_id: current_organization.id).take!\n end",
"def overlaps?(other)\n a, b = [self, other].map(&:range)\n #\n # Although a Shift which passes through midnight is stored\n # internally as lasting more than TimeOfDay::NUM_SECONDS_IN_DAY\n # seconds from midnight, that's not how it is meant to be\n # handled. Rather, it consists of two chunks:\n #\n # range.first => Midnight\n # Midnight => range.last\n #\n # The second one is *before* the first. None of it is more than\n # TimeOfDay::NUM_SECONDS_IN_DAY after midnight. We thus need to shift\n # each of our ranges to cover all overlapping possibilities.\n #\n one_day = TimeOfDay::NUM_SECONDS_IN_DAY\n ashifted =\n Range.new(a.first + one_day, a.last + one_day, a.exclude_end?)\n bshifted =\n Range.new(b.first + one_day, b.last + one_day, b.exclude_end?)\n #\n # For exclusive ranges we need:\n #\n # a.ending > b.beginning && b.ending > a.beginning\n #\n # and for inclusive we need:\n #\n # a.ending >= b.beginning && b.ending >= a.beginning\n #\n aop = a.exclude_end? ? :> : :>=\n bop = b.exclude_end? ? :> : :>=\n #\n (a.last.send(aop, b.first) && b.last.send(bop, a.first)) ||\n (ashifted.last.send(aop, b.first) && b.last.send(bop, ashifted.first)) ||\n (a.last.send(aop, bshifted.first) && bshifted.last.send(bop, a.first))\n end"
] |
[
"0.6640494",
"0.61551124",
"0.5504792",
"0.54813284",
"0.5408912",
"0.5375715",
"0.536107",
"0.5329269",
"0.52939874",
"0.52747977",
"0.52722156",
"0.5187178",
"0.51775956",
"0.5169996",
"0.5168714",
"0.5148303",
"0.51482743",
"0.51025355",
"0.5051192",
"0.5040364",
"0.5028705",
"0.49961057",
"0.4988579",
"0.4977401",
"0.49716136",
"0.49592152",
"0.4954626",
"0.49535674",
"0.49385735",
"0.48967466",
"0.487952",
"0.48673114",
"0.48566896",
"0.48450568",
"0.48332",
"0.48284593",
"0.48276874",
"0.48157054",
"0.47955346",
"0.47736043",
"0.47722664",
"0.4755336",
"0.47547558",
"0.475347",
"0.4753024",
"0.4752561",
"0.47495446",
"0.47494036",
"0.47401887",
"0.4739934",
"0.47347966",
"0.47215924",
"0.47158173",
"0.47149155",
"0.47081664",
"0.47011992",
"0.4689742",
"0.46814185",
"0.46788242",
"0.46787885",
"0.46783686",
"0.46744162",
"0.46720546",
"0.4660171",
"0.4655375",
"0.46509457",
"0.4641214",
"0.46408448",
"0.46400797",
"0.4620859",
"0.46166265",
"0.46163794",
"0.46076947",
"0.45917818",
"0.45879143",
"0.45838177",
"0.45831424",
"0.45803037",
"0.45802382",
"0.4571308",
"0.45661744",
"0.45644113",
"0.4563124",
"0.45626408",
"0.45625848",
"0.45577526",
"0.45566913",
"0.45494926",
"0.45450482",
"0.45270678",
"0.45242095",
"0.45152238",
"0.4514686",
"0.45116422",
"0.45079347",
"0.45056626",
"0.45019424",
"0.45010322",
"0.44915596",
"0.44897875"
] |
0.60602003
|
2
|
Public: Search for schedules that will soon overdue range The overdue time, must be UTC int (Default: 4.days) Returns the Mongoid::Criteria
|
def soon range=4.days
schedules.where(:when.lte => range.from_now)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def overdue\n schedules.where(:when.lte => Time.now)\n end",
"def client_tasks_overdue\n self.find_all {|e| (e.completed.nil? or !e.completed) and e.complete_by < Time.zone.now }\n end",
"def future from=7.days\n schedules.where(:when.gte => from.from_now)\n end",
"def overdue?\n if is_appointment?\n start_date.to_date < Time.zone.now.to_date\n else\n open? && end_date.to_date < Time.zone.now.to_date\n end\n end",
"def issues_due_in_days\n due_date = options.days.day.from_now.to_date\n s = ARCondition.new [\"#{Issue.table_name}.due_date <= ?\", due_date]\n s << issue_statuses\n s << projects\n s << trackers\n Issue.find(:all, :include => [:status, :assigned_to, :author, :project, :watchers, :tracker],\n :conditions => s.conditions,\n :order => \"#{Issue.table_name}.due_date, #{Project.table_name}.name\")\n end",
"def available_criteria\n @available_criteria ||= Redmine::Helpers::TimeReport.get_available_criteria(project)\n end",
"def overdue\n TodosList.new(@todos.filter { |todo| todo.overdue? })\n end",
"def specific_payment_schedule(from_date, on_date = Date.today)\n payment_schedule(from_date).reverse.detect { |item| item[:due_on] <= on_date }\n end",
"def overdue?\r\n @overdue = Time.now > @due_date\r\n end",
"def due\n @invoices = @account_invoices.where(invoices: { due_on_date: @start_date...@end_date })\n end",
"def overdue?\n schedules.each do |schedule|\n # date the next scheduled occurence should be calculated from\n calc_date = [last_run, modified_on || created_on].max\n next_occurence = schedule.get_scheduled_date(calc_date)\n logger.debug \"Next scheduled occurence for schedule id \\\n #{schedule.id} is #{next_occurence}\"\n return true if next_occurence < Time.now\n end\n false\n end",
"def client_tasks_upcoming\n today = Time.zone.now\n self.find_all {|e| (e.completed.nil? or !e.completed) and (e.complete_by >= today and e.complete_by <= (today + 6.days)) }\n end",
"def overdue?\n Date.today > to_date\n end",
"def overdue?\n return true if @past_due\n false\n end",
"def find_events_in_range(start_min, start_max,options = {})\n options[:max_results] ||= 25\n options[:order_by] ||= 'lastmodified' # other option is 'starttime'\n formatted_start_min = start_min.strftime(\"%Y-%m-%dT%H:%M:%S\")\n formatted_start_max = start_max.strftime(\"%Y-%m-%dT%H:%M:%S\")\n query = \"?start-min=#{formatted_start_min}&start-max=#{formatted_start_max}&recurrence-expansion-start=#{formatted_start_min}&recurrence-expansion-end=#{formatted_start_max}\"\n query = \"#{query}&orderby=#{options[:order_by]}&max-results=#{options[:max_results]}\"\n event_lookup(query)\n end",
"def overdue\n @date > Date.today\n end",
"def closed(opts={})\n ordered(:closed_at)\n date_time_filter(:closed_at, time_range(opts[:on], opts[:during], opts[:since], opts[:until]))\n self\n end",
"def find_completed(conditions = {})\n self.all({\n :completed_at.not => nil, \n :order => [:completed_at.desc]\n }.merge(conditions))\n end",
"def overdue_by\n @overdue_str = \"minutes\"\n @overdue_or_left = \"expired\"\n \n return \"never expires\" if self.expiration_date.nil?\n overdue = (Time.zone.now - self.expiration_date.to_datetime)\n \n if (overdue < 0)\n overdue *= -1\n @overdue_or_left = \"left\"\n end\n \n overdue /= 60\n \n if overdue > 60\n overdue /= 60\n @overdue_str = \"hours\"\n if overdue > 24\n overdue /= 24\n @overdue_str = \"days\"\n if overdue > 7\n overdue /= 7\n @overdue_str = \"weeks\"\n if overdue > 4\n overdue /= 4\n @overdue_str = \"months\"\n if overdue > 12\n overdue /= 12\n @overdue_str = \"yrs\"\n end\n end\n end\n end\n end\n \n @overdue_str = @overdue_str[0..-2] if overdue == 1\n \n overdue.round\n end",
"def overdue_by\n @overdue_str = \"minutes\"\n \n overdue = (((self.is_due?) ? (Time.zone.now - self.datetime) : (self.datetime - Time.zone.now)) / 60).to_i \n\n if overdue > 60\n overdue /= 60\n @overdue_str = \"hours\"\n if overdue > 24\n overdue /= 24\n @overdue_str = \"days\"\n if overdue > 7\n overdue /= 7\n @overdue_str = \"weeks\"\n if overdue > 4\n overdue /= 4\n @overdue_str = \"months\"\n end\n end\n end\n end\n \n @overdue_str = @overdue_str[0..-2] if overdue == 1\n \n overdue\n end",
"def open_occurrences(days_out = 90, date_start = Time.zone.now)\n schedule = IceCube::Schedule.new(date_start)\n date_end = date_start + days_out.days\n\n # add a recurrence for each business day\n business_days.each do |bd|\n day = bd.name.downcase.to_sym\n schedule.add_recurrence_rule IceCube::Rule.weekly.day(day)\n end\n\n return schedule.occurrences(date_end)\n end",
"def overdue\n @attributes[:overdue]\n end",
"def check_over_due\n time = Time.now\n @time_table.each{ |book, date|\n if date <= time\n puts \"Bro #{book} is overdue\"\n @overdue = true\n end\n }\n end",
"def exclusive_schedule\n if Schedule.where('init >= ? AND init <= ?', init, finish).any?\n errors.add(:base, \"Já existe uma reserva para esse horário\")\n end\n end",
"def find_overdue_books\n raise 'The library is not open!' unless @open\n raise 'No member is currently being served' unless @serve\n current_date = calendar.get_date\n\n book_list = @serve.get_books\n book_list.each_index do |n|\n if current_date > book_list[n].get_due_date\n puts \"#{@serve.get_name} #{book_list[n].to_s} \"\n else\n puts 'None'\n end\n end\n end",
"def overdue? ()\n\t\t@due_date < Time.now\n end",
"def overdue_days\n (Date.today - expires_at.to_date).to_i\n end",
"def overdue_days\n (Date.today - expires_at.to_date).to_i\n end",
"def schedule(startAt,endAt,opts={})\n ## Caching ##\n @schedules ||= {}\n if @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash]\n return @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash]\n end\n ## End Caching ##\n\n # TODO Handle events starting within the range but ending outside of it?\n\n # TODO Offload this selection to the database; okay for testing though\n # NOTE This is actually faster thanks to the query cache for small numbers of operating times, but not very scalable\n #all_regular_operating_times = OperatingTime.find(:all, :conditions => {:place_id => self.id, :override => 0}).select{|t| (t.startDate - 1) <= endAt.to_date and startAt.to_date <= (t.endDate + 1)}\n #all_special_operating_times = OperatingTime.find(:all, :conditions => {:place_id => self.id, :override => 1}).select{|t| (t.startDate - 1) <= endAt.to_date and startAt.to_date <= (t.endDate + 1)}\n # Select all relevant times (1 day buffer on each end)\n # NOTE Make sure to use generous date comparisons to allow for midnight rollovers\n all_regular_operating_times = OperatingTime.regular.by_place_id(self.id).in_range(startAt..endAt).find(:all)\n all_special_operating_times = OperatingTime.special.by_place_id(self.id).in_range(startAt..endAt).find(:all)\n\n puts \"\\nRegular OperatingTimes: #{all_regular_operating_times.inspect}\" if DEBUG\n puts \"\\nSpecial OperatingTimes: #{all_special_operating_times.inspect}\" if DEBUG\n\n regular_times = []\n special_times = []\n special_ranges = []\n\n all_special_operating_times.each do |ot|\n puts \"\\nSpecial Scheduling for: #{ot.inspect}\" if DEBUG\n\n # Special Case: Overriding with NO times (e.g. closed all day)\n if ot.start == 0 and ot.length == 0 and startAt.to_date <= ot.startDate\n # Block out the range, but don't add the \"null Times\"\n special_ranges << Range.new(ot.startDate,ot.endDate)\n next\n end\n\n # Start a day early if possible\n earlyStart = startAt-1.day < ot.startDate.midnight ? startAt.midnight : startAt - 1.day\n puts \"EarlyStart: #{earlyStart.inspect}\" if DEBUG\n\n # Calculate the next set up open/close times\n open,close = ot.next_times(earlyStart)\n next if open.nil? # No valid occurrences in the future\n\n while not open.nil? and open <= endAt do\n if DEBUG\n puts \"Open: #{open}\"\n puts \"Close: #{close}\"\n puts \"Start Date: #{ot.startDate} (#{ot.startDate.class})\"\n puts \"End Date: #{ot.endDate} (#{ot.endDate.class})\"\n end\n\n if close < startAt # Skip forward to the first occurrance in our time range\n puts \"Seeking: #{close} < #{startAt}\" if DEBUG\n open,close = ot.next_times(close)\n next\n end\n\n special_times << [open,close]\n special_ranges << Range.new(ot.startDate,ot.endDate)\n open,close = ot.next_times(close)\n end\n\n end\n\n puts \"\\nSpecial Times: #{special_times.inspect}\" if DEBUG\n puts \"\\nSpecial Ranges: #{special_ranges.inspect}\" if DEBUG\n\n all_regular_operating_times.each do |ot|\n puts \"\\nRegular Scheduling for: #{ot.inspect}\" if DEBUG\n\n # Start a day early if possible\n earlyStart = startAt-1.day < ot.startDate.midnight ? startAt : startAt - 1.day\n puts \"EarlyStart: #{earlyStart.inspect}\" if DEBUG\n\n # Calculate the next set up open/close times\n open,close = ot.next_times(earlyStart)\n if DEBUG\n puts \"\"\n puts \"Open: #{open}\"\n puts \"Close: #{close}\"\n end\n\n if open.nil? # No valid occurrences in the future\n puts \"Skipping: No valid occurrences in the future.\" if DEBUG\n next\n end\n\n while not open.nil? and open <= endAt do\n if DEBUG\n puts \"\"\n puts \"Open: #{open}\"\n puts \"Close: #{close}\"\n end\n\n if close < startAt # Skip forward to the first occurrance in our time range\n puts \"Seeking: #{close} < #{startAt}\" if DEBUG\n open,close = ot.next_times(close)\n next\n end\n\n overridden = false\n special_ranges.each do |sr|\n overridden ||= sr.member?(open.to_date)\n end\n if overridden\n puts \"Overridden\" if DEBUG\n open,close = ot.next_times(close)\n next\n end\n\n # FIXME Causing an infinite loop; would be nice if this worked\n #open = startAt if open < startAt\n #close = endAt if close > endAt\n\n regular_times << [open,close]\n open,close = ot.next_times(close)\n end\n\n end\n\n puts \"\\nRegular Times: #{regular_times.inspect}\" if DEBUG\n\n # TODO Handle schedule overrides\n # TODO Handle combinations (i.e. part special, part regular)\n\n final_schedule = (regular_times+special_times).sort{|a,b|a[0] <=> b[0]}\n\n ## Truncate times larger than range ##\n if opts[:truncate]\n final_schedule.each_index do |i|\n final_schedule[i][0] = startAt.dup if final_schedule[i][0] < startAt\n final_schedule[i][1] = endAt.dup if final_schedule[i][1] > endAt\n end\n end\n ## End truncating ##\n\n ## Caching ##\n @schedules ||= {}\n @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash] = final_schedule\n ## End caching ##\n\n final_schedule\n end",
"def overdue?\n @due_date < Date.today\n end",
"def overdue_days\n (Time.now.utc.to_date - expires_at.to_date).to_i\n end",
"def is_overdue\n if @due_date\n if ( (Time.now - @due_date) > 0 )\n @status = \"overdue\"\n puts \"#{@title} is overdue! Please return!\"\n else\n days_left = @due_date.yday - Time.now.yday\n puts \"You have #{days_left} days before you need to return #{@title}.\"\n end\n\n else\n puts \"#{@title} has not been checked out.\"\n end \n end",
"def overdue?(test)\r\n\t\tif self.overdue.present?\r\n\t\t\tself.overdue.overdue?(test)\r\n\t\telse\r\n\t\t\tfalse\r\n\t\tend\r\n\tend",
"def cur_calendars\n Article.find(:all, :conditions => ['issue_id = ? AND ((priority >= 50 AND priority < 55) OR (priority >= 70 AND priority < 75))', id], :order => 'priority')\n end",
"def workdays_in_range\n end_time ? (start_time.to_date..end_time.to_date).select { |d| (1..5).cover?(d.wday) }.size - offset : 1\n end",
"def due_today\n @due_date_task_list.select { |duedatetask| (duedatetask.status == \"incomplete\") && (duedatetask.due_date == Date.today) }\n end",
"def neighborhood_openings(start_date, end_date)\n self.listings.select {|l| l.reservations.where(\"checkout < start_date OR checkin > end_date\")}\n end",
"def unscheduled_maintenances(start_time, end_time)\n unsched_maintenances = @check.unscheduled_maintenances_by_start.\n intersect_range(start_time, end_time, :by_score => true).all\n\n # to see if we start in an unscheduled maintenance period, we must check all unscheduled\n # maintenances before the period and their durations\n start_in_unsched = start_time.nil? ? [] :\n @check.unscheduled_maintenances_by_start.\n intersect_range(nil, start_time, :by_score => true).all.select {|pu|\n pu.end_time >= start_time\n }\n\n {:unscheduled_maintenances => (start_in_unsched + unsched_maintenances)}\n end",
"def overdue?\n return false if due_at.nil?\n due_at < Time.now \n end",
"def find_events_in_range(start_min, start_max, options = {})\n formatted_start_min = encode_time(start_min)\n formatted_start_max = encode_time(start_max)\n query = \"?timeMin=#{formatted_start_min}&timeMax=#{formatted_start_max}#{parse_options(options)}\"\n event_lookup(query)\n end",
"def is_scheduled_to_be_off\n offset_to_pdt = -25200\n current_time = Time.now.utc + offset_to_pdt\n current_time_minutes = (current_time.hour * 60) + current_time.min\n self.schedules.each do |schedule|\n return true if (current_time_minutes > schedule.start_time) && (current_time_minutes < schedule.end_time)\n end\n false\n end",
"def scheduled_projects(start_date, end_date)\n suitable_entries = Entry.for_user_period(self.id, start_date, end_date)\n Project.find(suitable_entries.map(&:project_id))\n end",
"def overdue?\n due < Date.current\n end",
"def reminders_within_due_date\n return if due_in_days_after.blank?\n\n REMINDERS.each do |reminder|\n reminder_value = self.send(reminder)\n \n next if reminder_value.blank?\n\n if reminder_value < 0 \n errors[:base] = \"#{reminder.titleize} cannot be less than zero\"\n elsif reminder_value >= due_in_days_after\n errors[:base] = \"#{reminder.titleize} cannot be greater than the due date\"\n end\n end\n end",
"def upcoming_calendar_events\n self.calendar_events.joins(:event).where(\"DATEDIFF(`start_time`,?) >= 0\", Time.now.beginning_of_day)\n end",
"def find_future_events(options={})\n formatted_start_min = encode_time(Time.now)\n query = \"?timeMin=#{formatted_start_min}#{parse_options(options)}\"\n event_lookup(query)\n end",
"def can_create_overdue_or_under_repair_schedule?\n kit_schedule = KitSchedule.new\n kit_schedule.current_user = User.current_user\n return kit_schedule.can_create_overdue_or_under_repair?(self.center_ids)\n end",
"def within_range\n @site.loads.desc(:time).where(:time.gt => @timeframe.from, :time.lt => @timeframe.to)\n end",
"def check_for_closed_incidents\n incidents.where(status: 'Closed').each(&:check_closed_at_time)\n end",
"def date_range\n earliest = WorkPacket.find_earliest_by_tasks( @task_ids )\n latest = WorkPacket.find_latest_by_tasks( @task_ids )\n\n # If the earliest or latest work packet value is nil, both should be\n # nil (obviously) and this means there are no work packets for the\n # tasks. In that case we just span 'all of time' so that the user\n # can see explicitly there's no booked time. Generating a report over\n # some single day range just looks odd (user thinks \"why hasn't it\n # covered all dates\"). The hide-zero-columns option can be employed\n # to clear up the report.\n\n end_of_range = latest.nil? ? Date.current : latest.date.to_date\n start_of_range = earliest.nil? ? Date.new( Timesheet.allowed_range().min, 1, 1 ) : earliest.date.to_date\n\n return ( start_of_range..end_of_range )\n end",
"def time_over?\r\n return self.due_date <= Time.now\r\n end",
"def __evolve_time__\n { \"$gte\" => min.__evolve_time__, \"$lte\" => max.__evolve_time__ }\n end",
"def in_hot_list\n where(:added_to_hot_list.gte => 4.days.ago.utc)\n end",
"def intersecting_event_schedules\n room.event_schedules.where(start_time: start_time, schedule: schedule).where.not(id: id)\n end",
"def coming_due_events\n candidate_events.select(&:coming_due?)\n end",
"def schedule_expired\n return @schedule.end_date && @date > @schedule.end_date\n end",
"def time_is_within_scheduled_days\n \tif start_time\n \t\tschedule = Schedule.find_by(id: Piece.find_by(id: piece_id).schedule_id)\n\t update_day = nil\n\t schedule.days.each do |day|\n\t \t\tupdate_day = day if start_time >= day.start_time and start_time <= day.end_time\n\t \t\tbreak if !update_day.nil?\n\t end\n\t update_day.nil? ? errors.add(:start_time, \"must be during one of the scheduled times\") : update_attribute(:day, update_day)\n\t else\n\t \tupdate_attribute(:day, nil)\n\t end\n end",
"def upcoming_events\n attended_events.where('date >= :current_date AND accepted',\n current_date: DateTime.now)\n end",
"def incomplete_project_issues(proj, basis_date)\n Issue.cross_project_scope(proj, 'descendants')\n .where(\"#{SQL_COM} AND start_date <= ? AND (closed_on IS NULL OR closed_on > ?)\", basis_date, basis_date.end_of_day)\n end",
"def existing_reservations\n start_dt = self.start_dt.try(:to_datetime).try(:change, offset: \"+0000\")\n end_dt = self.end_dt.try(:to_datetime).try(:change, offset: \"+0000\")\n room_id = self.room.try(:id)\n results_size = (self.is_block?) ? 1000 : 1\n\n return [] if room_id.blank? || start_dt.blank? || end_dt.blank?\n block_query = [{ term: { is_block: false } }, { range: { end_dt: { gte: Time.zone.now.to_datetime.change(offset: \"+0000\") } } }]\n query =\n {\n query: {\n constant_score: {\n filter: {\n bool: {\n must: [\n { term: { room_id: room_id } },\n { term: { deleted: false }},\n { bool:\n {\n should: [\n {\n bool: {\n must: [\n { range: { start_dt: { gte: start_dt } } },\n { range: { start_dt: { lt: end_dt } } }\n ]\n }\n },\n {\n bool: {\n must: [\n { range: { end_dt: { gt: start_dt } } },\n { range: { end_dt: { lte: end_dt } } }\n ]\n }\n },\n {\n bool: {\n must: [\n { range: { start_dt: { lte: start_dt } } },\n { range: { end_dt: { gte: end_dt } } }\n ]\n }\n }\n ]\n }\n }\n ]\n }\n }\n }\n },\n size: results_size\n }\n query[:query][:constant_score][:filter][:bool][:must] += block_query if self.is_block?\n return Reservation.search(query).results\n end",
"def past_calendar_events\n self.calendar_events.joins(:event).where(\"DATEDIFF(`start_time`,?) < 0\", Time.now.beginning_of_day)\n end",
"def find_between(min, max)\n @coll.find(\n :secs => {:$gt => min, :$lt => max}\n )\n end",
"def reservations_by_date_range(date_range)\n res_by_date_range = @reservations.select do |res|\n res.date_range.overlaps?(date_range)\n end\n return res_by_date_range\n end",
"def upcoming_critical_period(date)\n future_critical_periods.upcoming(date).first\n end",
"def overlaps_with_resource_reservation(resource_reservation)\n\t\t\t\t\t\twhere(\n\t\t\t\t\t\t\t\"\n\t\t\t\t\t\t\t\t(#{ActiveRecord::Base.connection.quote_column_name(\"date_from\")} = :date_from) AND \n\t\t\t\t\t\t\t\t(#{ActiveRecord::Base.connection.quote_column_name(\"time_from\")} < :time_to) AND \n\t\t\t\t\t\t\t\t(:time_from < #{ActiveRecord::Base.connection.quote_column_name(\"time_to\")})\n\t\t\t\t\t\t\t\", \n\t\t\t\t\t\t\tdate_from: resource_reservation.date_from, # TODO suppor multi-day events/reservations\n\t\t\t\t\t\t\ttime_from: resource_reservation.time_from, \n\t\t\t\t\t\t\ttime_to: resource_reservation.time_to\n\t\t\t\t\t\t)\n\t\t\t\t\tend",
"def is_overdue\r\n\t\tif (Time.now).to_i > book.due_date && book.status == \"Checked Out\"\r\n\t\t\tbook.status = \"Overdue\"\r\n\t\t\tputs \"#{book.title} is overdue!\"\r\n\t\telsif book.status == \"Avalable\"\r\n\t\t\tputs \"#{book.title} is available.\"\r\n\t\telse\r\n\t\t\tputs \"#{book.title} is checked out but not overdue.\"\r\n\t\tend\r\n\tend",
"def by_star(start_time, end_time, options = {})\n field = options[:field] || \"created_at\"\n scoped :conditions => { field => start_time.utc..end_time.utc }\n end",
"def finances_started_reservations(date_from, date_to)\n\n repository.adapter.select(query_finances_started_reservations, date_from, date_to).sort do |x,y|\n comp = x.date_from <=> y.date_from\n comp.zero? ? Time.parse(x.time_from) <=> Time.parse(y.time_from) : comp\n end\n\n end",
"def by_star(start_time, end_time, options = {}, &block)\n start_time = parse(start_time) \n end_time = parse(end_time)\n\n\n raise ParseError, \"End time is before start time, searching like this will return no results.\" if end_time < start_time\n field = options.delete(:field)\n ensure_valid_options(options)\n\n scoping = { :conditions => conditions_for_range(start_time, end_time, field) }.merge(options)\n result = scoped(scoping)\n result = result.scoped(block.call) if block_given?\n result\n end",
"def is_closed_at?(evaluation_date = Date.today)\n get_end_date < evaluation_date\n end",
"def search\n '''\n param: date - string\n param: start - string\n param: capacity - string\n param: length - string\n\n '''\n\n avail_rooms_id = []\n i = 1\n start_date_time = Time.parse(params[:date] + \" \" + params[:start])\n end_date_time = start_date_time + (60 * 60 * Integer(params[:length]))\n curr_date_time = start_date_time + (60 * 60)\n meal_room_cap = Integer(params[:capacity]) * 6/10\n comp_room_cap = Integer(params[:capacity]) * 1/10\n\n # Finds and adds conference to desired schedule id's\n conf_room = Schedule.where(\"cap > ? and time = ? and date = ? and avail = true\", \n params[:capacity], \n params[:start], \n params[:date]\n ).ids.first\n\n avail_rooms_id << conf_room\n\n while(curr_date_time != end_date_time - (60 * 60)) do\n \n curr_hour = curr_date_time.strftime('%I:%M %p')\n curr_date = curr_date_time.strftime('%F')\n \n # If i % 6, find room to eat with 60% of participants \n if i % 6 == 0\n\n meal_room = Schedule.where(\"cap > ? and time = ? and date = ? and food = true and avail = true\",\n meal_room_cap,\n curr_hour,\n curr_date\n ).ids.first\n\n avail_rooms_id << meal_room\n\n # else find room with computers to support 10% of participants\n else\n\n comp_room = Schedule.where(\"cap > ? and time = ? and date = ? and comp_avail = true and avail = true\",\n comp_room_cap,\n curr_hour,\n curr_date\n ).ids.first\n \n avail_rooms_id << comp_room\n \n end\n \n # Increments iteration, date, and time\n i += 1\n curr_date_time += (60 * 60)\n end\n\n # Finds and adds final room to desired schedule id's\n final_room = Schedule.where(\"cap > ? and time = ? and date = ?\",\n params[:capacity],\n end_date_time.strftime('%I:00 %p'),\n end_date_time.strftime('%F')\n ).ids.first\n \n avail_rooms_id << final_room\n\n # Checks if rooms were found and assigns them to instance variable\n if avail_rooms_id.empty? == false\n @avail_rooms = Schedule.find(avail_rooms_id)\n end\n end",
"def test_filter_mneme_assignment_open_in_past\n assign_hash = {\n 'published' => true,\n 'openDate' => @mock_today_epoch - 1000,\n 'closeDate' => @mock_today_epoch\n }\n r = MnemeAPIResponse.filter_out_irrelevant_assignments(assign_hash, @mock_today_epoch)\n refute_nil r, \"keep open date in past\"\n end",
"def city_openings(start_date, end_date)\n listings.collect do |listing|\n reservations_in_range = listing.reservations.collect do |reservation|\n reservation.checkin <= end_date.to_date && reservation.checkout >= start_date.to_date\n end\n listing unless reservations_in_range.include?(true)\n end\n end",
"def index\n if params[:from] && params[:to]\n @schedules = Schedule.term_between(\n Date.new(params[:from][:year].to_i, params[:from][:month].to_i, params[:from][:day].to_i),\n Date.new(params[:to][:year].to_i, params[:to][:month].to_i, params[:to][:day].to_i).tomorrow)\n else\n @schedules = Schedule.all\n end\n end",
"def to_range_within(range)\n nb_weeks_offset = self.weekly_recurring ? ((range.end - self.starts_at.to_datetime) / 7).to_i : 0\n r = Range.new(self.starts_at + nb_weeks_offset.week, self.ends_at + nb_weeks_offset.week)\n range.cover?(r.begin)&&range.cover?(r.end) ? r : nil\n end",
"def overdue?(name, since)\n interval = registered.fetch(name).fetch(:execution_interval)\n since < (interval * 2).seconds.ago\n end",
"def events_in_time_range(start_date_string, end_date_string)\n return self.events if self.events.nil?\n\n if(start_date_string.is_a?(String))\n # I was told there would be no timezones :/\n start_time = DateTime.parse(start_date_string).to_time.utc\n end_time = DateTime.parse(end_date_string).to_time.utc\n else\n start_time = start_date_string\n end_time = end_date_string\n end\n\n self.events.select do |e| \n created_at_time = DateTime.parse(e.created_at).to_time.utc\n created_at_time >= start_time && created_at_time < end_time\n end\n end",
"def overdue?\n next_payment_at && next_payment_at.to_date < Date.today\n end",
"def finances_finished_reservations(date_from, date_to)\n\n repository.adapter.select(query_finances_finished_reservations, date_from, date_to).sort do |x,y|\n comp = x.date_to <=> y.date_to\n comp.zero? ? Time.parse(x.time_to) <=> Time.parse(y.time_to) : comp\n end\n\n end",
"def overdue_timesheet(user, dates)\n @site_name = APP_CONFIG['env_config']['site_name']\n @site_host = APP_CONFIG['env_config']['site_host']\n @user = user\n @dates = dates\n @account = user.account\n mail(to: MailerTasks.recipients(user.email),\n subject: MailerTasks.rendered_subject('Your timesheet is overdue!'))\n end",
"def index\n @date = params[:date] ? Time.parse(params[:date]).in_time_zone : Time.zone.now\n @start = @date.beginning_of_day.in_time_zone\n @finish = @date.end_of_day.in_time_zone\n @tense = determine_tense @date\n @day_name = @start == @now.beginning_of_day ? \"Today\" : @start.strftime(\"%a, %b %-d\")\n \n @tasks = case @tense\n when \"past\"\n @member.tasks.where(\"(complete = :false and due_at >= :start and due_at <= :finish) or (complete = :true and completed_at >= :start and completed_at <= :finish)\", \n true: true,\n false: false,\n nil: nil,\n start: @start,\n finish: @finish\n )\n when \"present\", \"future\"\n @member.tasks.where(\"(due_at is :nil and complete = :false) or (complete = :false and due_at is not :nil and due_at >= :start and due_at <= :finish) or (complete = :true and completed_at is not :nil and completed_at >= :start and completed_at <= :finish)\",\n true: true,\n false: false,\n nil: nil,\n start: @start,\n finish: @finish\n )\n end\n \n @incomplete = @member.tasks.where(\"due_at < ?\", @start).incomplete.by_ordinal.order(:due_at).group_by{ |t| p t.due_at.to_date }\n @complete = @tasks.complete.by_completed_at\n end",
"def selectIncompleteDueDate\n @due_items.select{|item| item.dueToday? && item.done? == 'Item incomplete'}\n end",
"def upcoming_events\n events.where(\"date > ?\", Time.now)\n end",
"def due_tasks\n tasks = []\n\n all_tasks.each do |task|\n due = task.due_date.get\n\n if due.is_a?(Time) && due > Time.new\n tasks << Task.new(task.name.get, due)\n end\n end\n\n # Sorts the array of tasks by due_date\n tasks.sort! { |a,b| a.due_date <=> b.due_date }\n end",
"def progressive_find\n swap = false\n range = 7\n while(!swap)\n check_excess_range(range)\n available_days = swappable_days(range)\n if available_days.count > 0\n return available_days\n end\n range *= 2\n end\n end",
"def events_in_range(start_date_time, end_date_time, home_time_zone = \"UTC\")\n # fetch not repeating events first\n event_instances = events.where(date: start_date_time...end_date_time, repeat: nil).to_a\n\n # then repeating events\n events.includes(:repeat_exceptions, category: :repeat_exceptions).where.not(repeat: nil).each do |rep_event| # get all repeating events\n event_instances.concat(rep_event.events_in_range(start_date_time, end_date_time, home_time_zone)) # and add them to the event array\n end\n\n event_instances = event_instances.sort_by(&:date) # and of course sort by date\n\n event_instances # and return\n end",
"def city_openings(start_date, end_date)\n self.listings.each do |listing|\n listing.reservations.each do |res|\n start_date <= res.checkout.to_s && end_date <= res.checkin.to_s\n end\n end\n end",
"def occurrences(params={count: MAX_OCCURRENCE_COUNT})\n if(recurs?)\n if(params[:after])\n search_offset = params[:after].localtime.utc_offset - schedule.start_time.localtime.utc_offset\n elsif(params[:until])\n search_offset = params[:until].localtime.utc_offset - schedule.start_time.localtime.utc_offset\n end\n \n #reset schedule to utc\n schedule.start_time.utc\n schedule.end_time.utc\n \n schedules = if(params[:until])\n if(params[:after])\n schedule.occurrences_between(params[:after] - self.schedule.duration + search_offset, params[:until] + search_offset)\n else\n schedule.occurrences(params[:until] + search_offset)\n end\n elsif params[:count]\n if params[:after]\n schedule.next_occurrences(params[:count], params[:after] - self.schedule.duration + search_offset)\n else\n schedule.next_occurrences(params[:count], Time.zone.now - self.schedule.duration)\n end \n end\n \n if(schedules)\n \n #turn schedules [Time] into self.classes\n schedules.map { |time| duplicate(time - schedule.start_time + (self.start.localtime.utc_offset - time.localtime.utc_offset)) }\n else\n []\n end\n else\n [self]\n end\n end",
"def search\n\n #@reservations = Reservation.new \n @user= User.new \n \n #t = Time.zone.parse(\"2013-12-12 16:35:00\")\n #@reservations = Reservation.where(:inicio =>t)\n\n #ahora con between\n\n iniciof = Time.zone.parse(\"2012-12-12 16:35:00\")\n finf = Time.zone.parse(\"2014-12-12 16:35:00\")\n\n #iniciof = \"2012-12-12 16:35:00\"\n #finf = \"2014-12-12 16:35:00\"\n\n @reservations = Reservation.where(:inicio => iniciof .. finf)\n\n end",
"def deadline_over?(risk_register)\n return date_difference(Date.today, risk_register.target_date) < 0\n end",
"def current_deals\n if params[:start_time] && params[:end_time]\n @deals = Deals.find(:all, :conditions => {:dateTime.now => start_date..end_date})\n end\n end",
"def show_due_today\n task = Task.where(due_date: Date.today).all\nend",
"def trucks_currently_open\n trucks = self.class.get_truck_data\n date = self.class.get_time\n\n trucks_open_now = []\n trucks.each do |truck|\n if date.strftime('%H:%M') <= truck[\"end24\"] && \n date.strftime('%H:%M') > truck[\"start24\"]\n trucks_open_now << truck[\"applicant\"]\n end \n end\n p trucks_open_now\n end",
"def future_events\n instances = []\n Event.where(place: self).each do |e|\n instances << e.occurrences.where(date: Date.current..2.weeks.from_now)\n end\n instances.flatten!.sort_by(&:date) unless instances.empty?\n end",
"def past_courses\n\t\treturn self.courses.where([\"end_date < ?\", DateTime.now - 2.weeks])\n\tend",
"def availabilities(from_date: Time.now, until_date: Time.now+(60*60*24*21))\n PrioTicket::Availabilities.find(distributor_id: distributor_id, ticket_id: ticket_id, identifier: identifier, from_date: from_date, until_date: until_date) \n end",
"def show_due_tasks\n task = Task.where.not(due_date: nil).all\nend",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end"
] |
[
"0.7787857",
"0.6186143",
"0.5992936",
"0.56769466",
"0.566428",
"0.5557885",
"0.555084",
"0.55211115",
"0.5510264",
"0.5500905",
"0.5485369",
"0.53618103",
"0.5327263",
"0.52653277",
"0.5250627",
"0.5248456",
"0.5218757",
"0.5200439",
"0.51879436",
"0.5132213",
"0.51033014",
"0.5090495",
"0.5077518",
"0.50688654",
"0.5052417",
"0.5049125",
"0.5042894",
"0.5042894",
"0.50287956",
"0.5022402",
"0.5017264",
"0.50159335",
"0.5006323",
"0.4989989",
"0.49624294",
"0.49586597",
"0.4942581",
"0.49341974",
"0.49328226",
"0.49235624",
"0.49169245",
"0.49117917",
"0.49113962",
"0.48993298",
"0.48771968",
"0.48579222",
"0.48556578",
"0.48500946",
"0.48289818",
"0.4824113",
"0.48132297",
"0.48088303",
"0.48065618",
"0.47949842",
"0.47927496",
"0.47757775",
"0.477496",
"0.47574082",
"0.47416675",
"0.47346213",
"0.4733015",
"0.47283557",
"0.47061178",
"0.470148",
"0.46996903",
"0.46976298",
"0.46963152",
"0.46957788",
"0.4695399",
"0.46934015",
"0.46893546",
"0.4688192",
"0.46878862",
"0.46848243",
"0.46798435",
"0.46793783",
"0.4675246",
"0.46698135",
"0.46639544",
"0.46607068",
"0.46585956",
"0.46525732",
"0.4649074",
"0.464474",
"0.46444762",
"0.46324044",
"0.46323907",
"0.4628742",
"0.46286485",
"0.46249485",
"0.46149638",
"0.46060327",
"0.45995763",
"0.4598261",
"0.4591636",
"0.45893276",
"0.45859772",
"0.45765588",
"0.45765588",
"0.45765588"
] |
0.6626659
|
1
|
Public: Search for schedules that will not due so soon range The overdue time, must be UTC int (Default: 7.days) Returns the Mongoid::Criteria
|
def future from=7.days
schedules.where(:when.gte => from.from_now)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def overdue\n schedules.where(:when.lte => Time.now)\n end",
"def soon range=4.days\n schedules.where(:when.lte => range.from_now)\n end",
"def client_tasks_overdue\n self.find_all {|e| (e.completed.nil? or !e.completed) and e.complete_by < Time.zone.now }\n end",
"def available_criteria\n @available_criteria ||= Redmine::Helpers::TimeReport.get_available_criteria(project)\n end",
"def exclusive_schedule\n if Schedule.where('init >= ? AND init <= ?', init, finish).any?\n errors.add(:base, \"Já existe uma reserva para esse horário\")\n end\n end",
"def specific_payment_schedule(from_date, on_date = Date.today)\n payment_schedule(from_date).reverse.detect { |item| item[:due_on] <= on_date }\n end",
"def unscheduled_maintenances(start_time, end_time)\n unsched_maintenances = @check.unscheduled_maintenances_by_start.\n intersect_range(start_time, end_time, :by_score => true).all\n\n # to see if we start in an unscheduled maintenance period, we must check all unscheduled\n # maintenances before the period and their durations\n start_in_unsched = start_time.nil? ? [] :\n @check.unscheduled_maintenances_by_start.\n intersect_range(nil, start_time, :by_score => true).all.select {|pu|\n pu.end_time >= start_time\n }\n\n {:unscheduled_maintenances => (start_in_unsched + unsched_maintenances)}\n end",
"def overdue\n TodosList.new(@todos.filter { |todo| todo.overdue? })\n end",
"def client_tasks_upcoming\n today = Time.zone.now\n self.find_all {|e| (e.completed.nil? or !e.completed) and (e.complete_by >= today and e.complete_by <= (today + 6.days)) }\n end",
"def filter_schedule\n if !NcsNavigatorCore.configuration.with_specimens?\n scheduled_activity_report.without_collection!\n end\n end",
"def issues_due_in_days\n due_date = options.days.day.from_now.to_date\n s = ARCondition.new [\"#{Issue.table_name}.due_date <= ?\", due_date]\n s << issue_statuses\n s << projects\n s << trackers\n Issue.find(:all, :include => [:status, :assigned_to, :author, :project, :watchers, :tracker],\n :conditions => s.conditions,\n :order => \"#{Issue.table_name}.due_date, #{Project.table_name}.name\")\n end",
"def possibly_coliding_schedules\n Schedule.where(possibly_coliding_schedules_query)\n end",
"def due\n @invoices = @account_invoices.where(invoices: { due_on_date: @start_date...@end_date })\n end",
"def show_due_tasks\n task = Task.where.not(due_date: nil).all\nend",
"def overdue?\n if is_appointment?\n start_date.to_date < Time.zone.now.to_date\n else\n open? && end_date.to_date < Time.zone.now.to_date\n end\n end",
"def scheduled_tasks\n self.tasks.select { \n |t| t.interval != :startup && t.interval != :shutdown\n }\n end",
"def schedule(startAt,endAt,opts={})\n ## Caching ##\n @schedules ||= {}\n if @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash]\n return @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash]\n end\n ## End Caching ##\n\n # TODO Handle events starting within the range but ending outside of it?\n\n # TODO Offload this selection to the database; okay for testing though\n # NOTE This is actually faster thanks to the query cache for small numbers of operating times, but not very scalable\n #all_regular_operating_times = OperatingTime.find(:all, :conditions => {:place_id => self.id, :override => 0}).select{|t| (t.startDate - 1) <= endAt.to_date and startAt.to_date <= (t.endDate + 1)}\n #all_special_operating_times = OperatingTime.find(:all, :conditions => {:place_id => self.id, :override => 1}).select{|t| (t.startDate - 1) <= endAt.to_date and startAt.to_date <= (t.endDate + 1)}\n # Select all relevant times (1 day buffer on each end)\n # NOTE Make sure to use generous date comparisons to allow for midnight rollovers\n all_regular_operating_times = OperatingTime.regular.by_place_id(self.id).in_range(startAt..endAt).find(:all)\n all_special_operating_times = OperatingTime.special.by_place_id(self.id).in_range(startAt..endAt).find(:all)\n\n puts \"\\nRegular OperatingTimes: #{all_regular_operating_times.inspect}\" if DEBUG\n puts \"\\nSpecial OperatingTimes: #{all_special_operating_times.inspect}\" if DEBUG\n\n regular_times = []\n special_times = []\n special_ranges = []\n\n all_special_operating_times.each do |ot|\n puts \"\\nSpecial Scheduling for: #{ot.inspect}\" if DEBUG\n\n # Special Case: Overriding with NO times (e.g. closed all day)\n if ot.start == 0 and ot.length == 0 and startAt.to_date <= ot.startDate\n # Block out the range, but don't add the \"null Times\"\n special_ranges << Range.new(ot.startDate,ot.endDate)\n next\n end\n\n # Start a day early if possible\n earlyStart = startAt-1.day < ot.startDate.midnight ? startAt.midnight : startAt - 1.day\n puts \"EarlyStart: #{earlyStart.inspect}\" if DEBUG\n\n # Calculate the next set up open/close times\n open,close = ot.next_times(earlyStart)\n next if open.nil? # No valid occurrences in the future\n\n while not open.nil? and open <= endAt do\n if DEBUG\n puts \"Open: #{open}\"\n puts \"Close: #{close}\"\n puts \"Start Date: #{ot.startDate} (#{ot.startDate.class})\"\n puts \"End Date: #{ot.endDate} (#{ot.endDate.class})\"\n end\n\n if close < startAt # Skip forward to the first occurrance in our time range\n puts \"Seeking: #{close} < #{startAt}\" if DEBUG\n open,close = ot.next_times(close)\n next\n end\n\n special_times << [open,close]\n special_ranges << Range.new(ot.startDate,ot.endDate)\n open,close = ot.next_times(close)\n end\n\n end\n\n puts \"\\nSpecial Times: #{special_times.inspect}\" if DEBUG\n puts \"\\nSpecial Ranges: #{special_ranges.inspect}\" if DEBUG\n\n all_regular_operating_times.each do |ot|\n puts \"\\nRegular Scheduling for: #{ot.inspect}\" if DEBUG\n\n # Start a day early if possible\n earlyStart = startAt-1.day < ot.startDate.midnight ? startAt : startAt - 1.day\n puts \"EarlyStart: #{earlyStart.inspect}\" if DEBUG\n\n # Calculate the next set up open/close times\n open,close = ot.next_times(earlyStart)\n if DEBUG\n puts \"\"\n puts \"Open: #{open}\"\n puts \"Close: #{close}\"\n end\n\n if open.nil? # No valid occurrences in the future\n puts \"Skipping: No valid occurrences in the future.\" if DEBUG\n next\n end\n\n while not open.nil? and open <= endAt do\n if DEBUG\n puts \"\"\n puts \"Open: #{open}\"\n puts \"Close: #{close}\"\n end\n\n if close < startAt # Skip forward to the first occurrance in our time range\n puts \"Seeking: #{close} < #{startAt}\" if DEBUG\n open,close = ot.next_times(close)\n next\n end\n\n overridden = false\n special_ranges.each do |sr|\n overridden ||= sr.member?(open.to_date)\n end\n if overridden\n puts \"Overridden\" if DEBUG\n open,close = ot.next_times(close)\n next\n end\n\n # FIXME Causing an infinite loop; would be nice if this worked\n #open = startAt if open < startAt\n #close = endAt if close > endAt\n\n regular_times << [open,close]\n open,close = ot.next_times(close)\n end\n\n end\n\n puts \"\\nRegular Times: #{regular_times.inspect}\" if DEBUG\n\n # TODO Handle schedule overrides\n # TODO Handle combinations (i.e. part special, part regular)\n\n final_schedule = (regular_times+special_times).sort{|a,b|a[0] <=> b[0]}\n\n ## Truncate times larger than range ##\n if opts[:truncate]\n final_schedule.each_index do |i|\n final_schedule[i][0] = startAt.dup if final_schedule[i][0] < startAt\n final_schedule[i][1] = endAt.dup if final_schedule[i][1] > endAt\n end\n end\n ## End truncating ##\n\n ## Caching ##\n @schedules ||= {}\n @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash] = final_schedule\n ## End caching ##\n\n final_schedule\n end",
"def find_completed(conditions = {})\n self.all({\n :completed_at.not => nil, \n :order => [:completed_at.desc]\n }.merge(conditions))\n end",
"def incomplete_project_issues(proj, basis_date)\n Issue.cross_project_scope(proj, 'descendants')\n .where(\"#{SQL_COM} AND start_date <= ? AND (closed_on IS NULL OR closed_on > ?)\", basis_date, basis_date.end_of_day)\n end",
"def not_scheduled_applications\n accepted_applications.select do |a|\n been_in_stage_for(a, 7.days.ago)\n end\n end",
"def overdue?\r\n @overdue = Time.now > @due_date\r\n end",
"def overdue?\n schedules.each do |schedule|\n # date the next scheduled occurence should be calculated from\n calc_date = [last_run, modified_on || created_on].max\n next_occurence = schedule.get_scheduled_date(calc_date)\n logger.debug \"Next scheduled occurence for schedule id \\\n #{schedule.id} is #{next_occurence}\"\n return true if next_occurence < Time.now\n end\n false\n end",
"def overdue?\n return true if @past_due\n false\n end",
"def scheduled_projects(start_date, end_date)\n suitable_entries = Entry.for_user_period(self.id, start_date, end_date)\n Project.find(suitable_entries.map(&:project_id))\n end",
"def overdue?\n Date.today > to_date\n end",
"def overdue\n @date > Date.today\n end",
"def is_scheduled_to_be_off\n offset_to_pdt = -25200\n current_time = Time.now.utc + offset_to_pdt\n current_time_minutes = (current_time.hour * 60) + current_time.min\n self.schedules.each do |schedule|\n return true if (current_time_minutes > schedule.start_time) && (current_time_minutes < schedule.end_time)\n end\n false\n end",
"def find_events_in_range(start_min, start_max,options = {})\n options[:max_results] ||= 25\n options[:order_by] ||= 'lastmodified' # other option is 'starttime'\n formatted_start_min = start_min.strftime(\"%Y-%m-%dT%H:%M:%S\")\n formatted_start_max = start_max.strftime(\"%Y-%m-%dT%H:%M:%S\")\n query = \"?start-min=#{formatted_start_min}&start-max=#{formatted_start_max}&recurrence-expansion-start=#{formatted_start_min}&recurrence-expansion-end=#{formatted_start_max}\"\n query = \"#{query}&orderby=#{options[:order_by]}&max-results=#{options[:max_results]}\"\n event_lookup(query)\n end",
"def date_range\n earliest = WorkPacket.find_earliest_by_tasks( @task_ids )\n latest = WorkPacket.find_latest_by_tasks( @task_ids )\n\n # If the earliest or latest work packet value is nil, both should be\n # nil (obviously) and this means there are no work packets for the\n # tasks. In that case we just span 'all of time' so that the user\n # can see explicitly there's no booked time. Generating a report over\n # some single day range just looks odd (user thinks \"why hasn't it\n # covered all dates\"). The hide-zero-columns option can be employed\n # to clear up the report.\n\n end_of_range = latest.nil? ? Date.current : latest.date.to_date\n start_of_range = earliest.nil? ? Date.new( Timesheet.allowed_range().min, 1, 1 ) : earliest.date.to_date\n\n return ( start_of_range..end_of_range )\n end",
"def test_filter_mneme_assignment_open_in_past\n assign_hash = {\n 'published' => true,\n 'openDate' => @mock_today_epoch - 1000,\n 'closeDate' => @mock_today_epoch\n }\n r = MnemeAPIResponse.filter_out_irrelevant_assignments(assign_hash, @mock_today_epoch)\n refute_nil r, \"keep open date in past\"\n end",
"def weekly_tasks_pending_cashier_approval\n self.weekly_tasks.where(\n :is_weekly_attendance_marking_done => true ,\n :is_weekly_payment_collection_finalized => true,\n :is_weekly_payment_approved_by_cashier => false\n )\n end",
"def intersecting_event_schedules\n room.event_schedules.where(start_time: start_time, schedule: schedule).where.not(id: id)\n end",
"def reminders_within_due_date\n return if due_in_days_after.blank?\n\n REMINDERS.each do |reminder|\n reminder_value = self.send(reminder)\n \n next if reminder_value.blank?\n\n if reminder_value < 0 \n errors[:base] = \"#{reminder.titleize} cannot be less than zero\"\n elsif reminder_value >= due_in_days_after\n errors[:base] = \"#{reminder.titleize} cannot be greater than the due date\"\n end\n end\n end",
"def find_overdue_books\n raise 'The library is not open!' unless @open\n raise 'No member is currently being served' unless @serve\n current_date = calendar.get_date\n\n book_list = @serve.get_books\n book_list.each_index do |n|\n if current_date > book_list[n].get_due_date\n puts \"#{@serve.get_name} #{book_list[n].to_s} \"\n else\n puts 'None'\n end\n end\n end",
"def listNotDue\n Todo.where(\"duedate is null\")\nend",
"def progressive_find\n swap = false\n range = 7\n while(!swap)\n check_excess_range(range)\n available_days = swappable_days(range)\n if available_days.count > 0\n return available_days\n end\n range *= 2\n end\n end",
"def workdays_in_range\n end_time ? (start_time.to_date..end_time.to_date).select { |d| (1..5).cover?(d.wday) }.size - offset : 1\n end",
"def can_create_overdue_or_under_repair_schedule?\n kit_schedule = KitSchedule.new\n kit_schedule.current_user = User.current_user\n return kit_schedule.can_create_overdue_or_under_repair?(self.center_ids)\n end",
"def open_occurrences(days_out = 90, date_start = Time.zone.now)\n schedule = IceCube::Schedule.new(date_start)\n date_end = date_start + days_out.days\n\n # add a recurrence for each business day\n business_days.each do |bd|\n day = bd.name.downcase.to_sym\n schedule.add_recurrence_rule IceCube::Rule.weekly.day(day)\n end\n\n return schedule.occurrences(date_end)\n end",
"def check_over_due\n time = Time.now\n @time_table.each{ |book, date|\n if date <= time\n puts \"Bro #{book} is overdue\"\n @overdue = true\n end\n }\n end",
"def existing_reservations\n start_dt = self.start_dt.try(:to_datetime).try(:change, offset: \"+0000\")\n end_dt = self.end_dt.try(:to_datetime).try(:change, offset: \"+0000\")\n room_id = self.room.try(:id)\n results_size = (self.is_block?) ? 1000 : 1\n\n return [] if room_id.blank? || start_dt.blank? || end_dt.blank?\n block_query = [{ term: { is_block: false } }, { range: { end_dt: { gte: Time.zone.now.to_datetime.change(offset: \"+0000\") } } }]\n query =\n {\n query: {\n constant_score: {\n filter: {\n bool: {\n must: [\n { term: { room_id: room_id } },\n { term: { deleted: false }},\n { bool:\n {\n should: [\n {\n bool: {\n must: [\n { range: { start_dt: { gte: start_dt } } },\n { range: { start_dt: { lt: end_dt } } }\n ]\n }\n },\n {\n bool: {\n must: [\n { range: { end_dt: { gt: start_dt } } },\n { range: { end_dt: { lte: end_dt } } }\n ]\n }\n },\n {\n bool: {\n must: [\n { range: { start_dt: { lte: start_dt } } },\n { range: { end_dt: { gte: end_dt } } }\n ]\n }\n }\n ]\n }\n }\n ]\n }\n }\n }\n },\n size: results_size\n }\n query[:query][:constant_score][:filter][:bool][:must] += block_query if self.is_block?\n return Reservation.search(query).results\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def is_grace_period?\n self.weekly_tasks.where(:is_weekly_payment_approved_by_cashier => true ).count == self.total_weeks \n end",
"def cur_calendars\n Article.find(:all, :conditions => ['issue_id = ? AND ((priority >= 50 AND priority < 55) OR (priority >= 70 AND priority < 75))', id], :order => 'priority')\n end",
"def cancel_appointment appointment\n time_range = TimeRange.new appointment.started_at, appointment.finished_at\n if appointment.daily_schedule_id == self.id\n self.free time_range\n true\n end\n false\n end",
"def past_calendar_events\n self.calendar_events.joins(:event).where(\"DATEDIFF(`start_time`,?) < 0\", Time.now.beginning_of_day)\n end",
"def closed(opts={})\n ordered(:closed_at)\n date_time_filter(:closed_at, time_range(opts[:on], opts[:during], opts[:since], opts[:until]))\n self\n end",
"def upcoming_calendar_events\n self.calendar_events.joins(:event).where(\"DATEDIFF(`start_time`,?) >= 0\", Time.now.beginning_of_day)\n end",
"def not_completed_due_today\n @not_done = @to_do_with_date.select { |x| x.is_done? == false }\n return @not_done.select { |x| x.due_date == Date.today }\n end",
"def time_is_within_scheduled_days\n \tif start_time\n \t\tschedule = Schedule.find_by(id: Piece.find_by(id: piece_id).schedule_id)\n\t update_day = nil\n\t schedule.days.each do |day|\n\t \t\tupdate_day = day if start_time >= day.start_time and start_time <= day.end_time\n\t \t\tbreak if !update_day.nil?\n\t end\n\t update_day.nil? ? errors.add(:start_time, \"must be during one of the scheduled times\") : update_attribute(:day, update_day)\n\t else\n\t \tupdate_attribute(:day, nil)\n\t end\n end",
"def overdue? ()\n\t\t@due_date < Time.now\n end",
"def overdue?\n @due_date < Date.today\n end",
"def coming_due_events\n candidate_events.select(&:coming_due?)\n end",
"def due_today\n @due_date_task_list.select { |duedatetask| (duedatetask.status == \"incomplete\") && (duedatetask.due_date == Date.today) }\n end",
"def past_courses\n\t\treturn self.courses.where([\"end_date < ?\", DateTime.now - 2.weeks])\n\tend",
"def shifts_cannot_overlap\n # day = weekday\n # shifts = employee.shifts.exclude_self(id).where(weekday: day)\n range = Range.new(time_start, time_end)\n # shifts = employee.shifts.exclude_self(id).on_day(weekday).valid_at(valid_from)\n # overlaps = shifts.in_range(range)\n overlaps = employee.shifts.exclude_self(id).on_day(weekday).valid_at(valid_from).in_range(range)\n overlap_error unless overlaps.empty?\n end",
"def overdue?\n return false if due_at.nil?\n due_at < Time.now \n end",
"def todays_recurrences\n today = Time.zone.today\n Recurrence.where('recurrences.date = ? OR recurrences.date ISNULL', today)\n end",
"def show_no_date\n task = Task.where(due_date: nil).all\nend",
"def search\n '''\n param: date - string\n param: start - string\n param: capacity - string\n param: length - string\n\n '''\n\n avail_rooms_id = []\n i = 1\n start_date_time = Time.parse(params[:date] + \" \" + params[:start])\n end_date_time = start_date_time + (60 * 60 * Integer(params[:length]))\n curr_date_time = start_date_time + (60 * 60)\n meal_room_cap = Integer(params[:capacity]) * 6/10\n comp_room_cap = Integer(params[:capacity]) * 1/10\n\n # Finds and adds conference to desired schedule id's\n conf_room = Schedule.where(\"cap > ? and time = ? and date = ? and avail = true\", \n params[:capacity], \n params[:start], \n params[:date]\n ).ids.first\n\n avail_rooms_id << conf_room\n\n while(curr_date_time != end_date_time - (60 * 60)) do\n \n curr_hour = curr_date_time.strftime('%I:%M %p')\n curr_date = curr_date_time.strftime('%F')\n \n # If i % 6, find room to eat with 60% of participants \n if i % 6 == 0\n\n meal_room = Schedule.where(\"cap > ? and time = ? and date = ? and food = true and avail = true\",\n meal_room_cap,\n curr_hour,\n curr_date\n ).ids.first\n\n avail_rooms_id << meal_room\n\n # else find room with computers to support 10% of participants\n else\n\n comp_room = Schedule.where(\"cap > ? and time = ? and date = ? and comp_avail = true and avail = true\",\n comp_room_cap,\n curr_hour,\n curr_date\n ).ids.first\n \n avail_rooms_id << comp_room\n \n end\n \n # Increments iteration, date, and time\n i += 1\n curr_date_time += (60 * 60)\n end\n\n # Finds and adds final room to desired schedule id's\n final_room = Schedule.where(\"cap > ? and time = ? and date = ?\",\n params[:capacity],\n end_date_time.strftime('%I:00 %p'),\n end_date_time.strftime('%F')\n ).ids.first\n \n avail_rooms_id << final_room\n\n # Checks if rooms were found and assigns them to instance variable\n if avail_rooms_id.empty? == false\n @avail_rooms = Schedule.find(avail_rooms_id)\n end\n end",
"def to_range_within(range)\n nb_weeks_offset = self.weekly_recurring ? ((range.end - self.starts_at.to_datetime) / 7).to_i : 0\n r = Range.new(self.starts_at + nb_weeks_offset.week, self.ends_at + nb_weeks_offset.week)\n range.cover?(r.begin)&&range.cover?(r.end) ? r : nil\n end",
"def unavailable_date_ranges_from_today\n self.reservations\n .where('end_date > ?', Date.today())\n .where(status: [1, 5])\n .map {|item| [item.start_date, item.end_date]}\n end",
"def overdue?\n due < Date.current\n end",
"def unpublished_conditions\r\n \"(#{table_name}.publish_at IS NOT NULL AND #{table_name}.publish_at > '#{Time.now.to_s(:db)}') OR (#{table_name}.unpublish_at IS NOT NULL AND #{table_name}.unpublish_at < '#{Time.now.to_s(:db)}')\"\r\n end",
"def index\n if params[:from] && params[:to]\n @schedules = Schedule.term_between(\n Date.new(params[:from][:year].to_i, params[:from][:month].to_i, params[:from][:day].to_i),\n Date.new(params[:to][:year].to_i, params[:to][:month].to_i, params[:to][:day].to_i).tomorrow)\n else\n @schedules = Schedule.all\n end\n end",
"def __evolve_time__\n { \"$gte\" => min.__evolve_time__, \"$lte\" => max.__evolve_time__ }\n end",
"def overdue?(test)\r\n\t\tif self.overdue.present?\r\n\t\t\tself.overdue.overdue?(test)\r\n\t\telse\r\n\t\t\tfalse\r\n\t\tend\r\n\tend",
"def cancel_reservations_in_my_range\n \tself.conflicts.each { |o| o.cancel }\t\n\tend",
"def my_events_in_past_30_days\n self.events.select do |event|\n event.start >= DateTime.now - 30.day\n end\n end",
"def room_finder(searching_range)\n\t\t\tpossible_rooms = @rooms\n\t\n\t\t\t@reservations.each do |reservation|\n\t\t\t\tif reservation.range.include_range?(:booking, searching_range) == false\n\t\t\t\t\tpossible_rooms.delete(reservation.room)\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\traise ArgumentError.new(\"No rooms left for this time range\") if possible_rooms.length == 0\n\n\t\t\treturn possible_rooms\n\t\tend",
"def selectIncompleteDueDate\n @due_items.select{|item| item.dueToday? && item.done? == 'Item incomplete'}\n end",
"def listAllDue\n Todo.where(\"duedate is not null\")\nend",
"def find_future_events(options={})\n formatted_start_min = encode_time(Time.now)\n query = \"?timeMin=#{formatted_start_min}#{parse_options(options)}\"\n event_lookup(query)\n end",
"def time_over?\r\n return self.due_date <= Time.now\r\n end",
"def future_events\n instances = []\n Event.where(place: self).each do |e|\n instances << e.occurrences.where(date: Date.current..2.weeks.from_now)\n end\n instances.flatten!.sort_by(&:date) unless instances.empty?\n end",
"def completed_weekly_tasks\n self.weekly_tasks.where(\n :is_weekly_attendance_marking_done => true ,\n :is_weekly_payment_collection_finalized => true, \n :is_weekly_payment_approved_by_cashier => true \n )\n end",
"def overdue_by\n @overdue_str = \"minutes\"\n \n overdue = (((self.is_due?) ? (Time.zone.now - self.datetime) : (self.datetime - Time.zone.now)) / 60).to_i \n\n if overdue > 60\n overdue /= 60\n @overdue_str = \"hours\"\n if overdue > 24\n overdue /= 24\n @overdue_str = \"days\"\n if overdue > 7\n overdue /= 7\n @overdue_str = \"weeks\"\n if overdue > 4\n overdue /= 4\n @overdue_str = \"months\"\n end\n end\n end\n end\n \n @overdue_str = @overdue_str[0..-2] if overdue == 1\n \n overdue\n end",
"def next_meeting(after_time = Time.now.utc )\n # puts \"Looking up next meeting after #{after_time}\"\n if recurrence_frequency.blank?\n return start_time\n end\n\n if after_time < start_time\n return start_time\n end \n\n after_time = after_time.local_from_utc(self.time_zone) \n\n\n # Advance the starting time in the case when it falls after the beginning of\n # a meeting on the same day. We do this so that we can use \"day precision\"\n # (PDate.day) in the Runt library instead of \"minute precision\" (PDate.min),\n # which performs terribly.\n start_time = start_time_local\n if(after_time.hour > start_time.hour or ( after_time.hour == start_time.hour and after_time.min > start_time.min))\n after_time = after_time + 1.day\n after_time = Time.gm(after_time.year, after_time.month, after_time.day, 0, 0)\n end\n\n case recurrence_frequency\n when 'daily'\n end_time = after_time + 25.hours \n # after_time -= 1.day\n start_date = PDate.day(after_time.year, after_time.month, after_time.day , after_time.hour, after_time.min)\n end_date = PDate.day(end_time.year, end_time.month, end_time.day, end_time.hour, end_time.min)\n when 'weekdays'\n # Make the range over 3 days so that Friday night searches will still turn\n # up Monday as the next day.\n end_time = after_time + 3.days\n start_date = PDate.day(after_time.year, after_time.month, after_time.day, after_time.hour, after_time.min)\n end_date = PDate.day(end_time.year, end_time.month, end_time.day, end_time.hour, end_time.min)\n when 'monthly'\n eom = (after_time + 40.days)\n start_date = PDate.day(after_time.year, after_time.month, after_time.day)\n end_date = PDate.day(eom.year, eom.month, eom.day)\n when 'weekly'\n eow = (after_time + 8.days)\n start_date = PDate.day(after_time.year, after_time.month, after_time.day)\n end_date = PDate.day(eow.year, eow.month, eow.day)\n when 'yearly'\n # Just doing \"after_time + 367.days\" results in a bit of a performance hit\n # as hundreds of days are compared. We'll try to narrow it a bit. Not too\n # much, because we don't have time to actually write unit tests and make\n # sure the narrowing code works. :) Which is why the comment is here.\n st = after_time + 250.days\n et = st + 150.days\n start_date = PDate.day(st.year, st.month, st.day)\n end_date = PDate.day(et.year, et.month, et.day)\n end \n # puts \" Range #{start_date.to_s} - #{end_date.to_s}\"\n d_range = DateRange.new(start_date, end_date)\n sched = Schedule.new\n event = Event.new((self.invitation.name rescue \"no name\"))\n sched.add(event,self.runt_expression)\n dates = sched.dates(event,d_range)\n\n next_mtg = dates.first\n next_mtg_time = Time.gm(next_mtg.year, next_mtg.month, next_mtg.day, start_time_local.hour, start_time_local.min)\n result = nil\n begin\n result = next_mtg_time.local_to_utc(self.time_zone)\n rescue TZInfo::PeriodNotFound\n # This only happens when the time is during the one hour which is skipped\n # during the transition to DST. For example, only on Sun Mar 08 02:15:00\n # (see ticket #744).\n next_hour = start_time_local.hour + 1\n next_mtg_time = Time.gm(next_mtg.year, next_mtg.month, next_mtg.day, next_hour, start_time_local.min)\n retry\n end\n return result\n end",
"def recurring(opts={})\n all({DataMapper::Events.recurrence_key.not => nil}.merge(opts))\n end",
"def valid_tickets\n @nearby_tickets.filter_map do |ticket|\n in_ranges = ticket.map do |val|\n merged_rules.map {|val_range| val_range.include?(val)}.include?(true)\n end\n ticket unless in_ranges.include?(false)\n end\n end",
"def workdays(calendar = Spok.default_calendar)\n (@start_date..@end_date).to_a.delete_if{ |date| Workday.restday?(date, calendar: calendar) }\n end",
"def restrict_date_range( objects )\n # set start_date to either passed param, or beginning of time\n start_date = params[:start_date].blank? ? Date.new(0) : Date.strptime(params[:start_date], \"%Y-%m-%d\")\n # set end_date to either passed param or now\n end_date = params[:end_date].blank? ? Date.today : Date.strptime(params[:end_date], \"%Y-%m-%d\")\n\n filtered = []\n objects.each do |obj|\n # apperantly things can have nil created_at\n if obj.created_at.blank?\n if params[:start_date].blank? && params[:end_date].blank?\n filtered += [obj]\n end\n elsif start_date <= obj.created_at.to_date && end_date >= obj.created_at.to_date\n filtered += [obj]\n end\n end\n return filtered\n end",
"def restrict_date_range( objects )\n # set start_date to either passed param, or beginning of time\n start_date = params[:start_date].blank? ? Date.new(0) : Date.strptime(params[:start_date], \"%Y-%m-%d\")\n # set end_date to either passed param or now\n end_date = params[:end_date].blank? ? Date.today : Date.strptime(params[:end_date], \"%Y-%m-%d\")\n\n filtered = []\n objects.each do |obj|\n # apperantly things can have nil created_at\n if obj.created_at.blank?\n if params[:start_date].blank? && params[:end_date].blank?\n filtered += [obj]\n end\n elsif start_date <= obj.created_at.to_date && end_date >= obj.created_at.to_date\n filtered += [obj]\n end\n end\n return filtered\n end",
"def restrict_date_range( objects )\n # set start_date to either passed param, or beginning of time\n start_date = params[:start_date].blank? ? Date.new(0) : Date.strptime(params[:start_date], \"%Y-%m-%d\")\n # set end_date to either passed param or now\n end_date = params[:end_date].blank? ? Date.today : Date.strptime(params[:end_date], \"%Y-%m-%d\")\n\n filtered = []\n objects.each do |obj|\n # apperantly things can have nil created_at\n if obj.created_at.blank?\n if params[:start_date].blank? && params[:end_date].blank?\n filtered += [obj]\n end\n elsif start_date <= obj.created_at.to_date && end_date >= obj.created_at.to_date\n filtered += [obj]\n end\n end\n return filtered\n end",
"def neighborhood_openings(start_date, end_date)\n self.listings.select {|l| l.reservations.where(\"checkout < start_date OR checkin > end_date\")}\n end",
"def overdue\n @attributes[:overdue]\n end",
"def due_tasks\n tasks = []\n\n all_tasks.each do |task|\n due = task.due_date.get\n\n if due.is_a?(Time) && due > Time.new\n tasks << Task.new(task.name.get, due)\n end\n end\n\n # Sorts the array of tasks by due_date\n tasks.sort! { |a,b| a.due_date <=> b.due_date }\n end",
"def schedule_expired\n return @schedule.end_date && @date > @schedule.end_date\n end",
"def due_today\n TodosList.new(@todos.filter { |todo| todo.due_today? })\n end",
"def within_range\n @site.loads.desc(:time).where(:time.gt => @timeframe.from, :time.lt => @timeframe.to)\n end",
"def overdue_days\n (Date.today - expires_at.to_date).to_i\n end",
"def overdue_days\n (Date.today - expires_at.to_date).to_i\n end",
"def overdue_by\n @overdue_str = \"minutes\"\n @overdue_or_left = \"expired\"\n \n return \"never expires\" if self.expiration_date.nil?\n overdue = (Time.zone.now - self.expiration_date.to_datetime)\n \n if (overdue < 0)\n overdue *= -1\n @overdue_or_left = \"left\"\n end\n \n overdue /= 60\n \n if overdue > 60\n overdue /= 60\n @overdue_str = \"hours\"\n if overdue > 24\n overdue /= 24\n @overdue_str = \"days\"\n if overdue > 7\n overdue /= 7\n @overdue_str = \"weeks\"\n if overdue > 4\n overdue /= 4\n @overdue_str = \"months\"\n if overdue > 12\n overdue /= 12\n @overdue_str = \"yrs\"\n end\n end\n end\n end\n end\n \n @overdue_str = @overdue_str[0..-2] if overdue == 1\n \n overdue.round\n end",
"def past\n without_temporal_condition.where('valid_to < ?', Time.zone.now)\n end",
"def not_in_past\n return unless due_date < Time.zone.today || start_date < Time.zone.today\n errors.add(:base, \"Cannot create reservation in the past.\\n\")\n end",
"def in_hot_list\n where(:added_to_hot_list.gte => 4.days.ago.utc)\n end",
"def occurrences(params={count: MAX_OCCURRENCE_COUNT})\n if(recurs?)\n if(params[:after])\n search_offset = params[:after].localtime.utc_offset - schedule.start_time.localtime.utc_offset\n elsif(params[:until])\n search_offset = params[:until].localtime.utc_offset - schedule.start_time.localtime.utc_offset\n end\n \n #reset schedule to utc\n schedule.start_time.utc\n schedule.end_time.utc\n \n schedules = if(params[:until])\n if(params[:after])\n schedule.occurrences_between(params[:after] - self.schedule.duration + search_offset, params[:until] + search_offset)\n else\n schedule.occurrences(params[:until] + search_offset)\n end\n elsif params[:count]\n if params[:after]\n schedule.next_occurrences(params[:count], params[:after] - self.schedule.duration + search_offset)\n else\n schedule.next_occurrences(params[:count], Time.zone.now - self.schedule.duration)\n end \n end\n \n if(schedules)\n \n #turn schedules [Time] into self.classes\n schedules.map { |time| duplicate(time - schedule.start_time + (self.start.localtime.utc_offset - time.localtime.utc_offset)) }\n else\n []\n end\n else\n [self]\n end\n end",
"def overdue_days\n (Time.now.utc.to_date - expires_at.to_date).to_i\n end"
] |
[
"0.7614393",
"0.6538048",
"0.62380904",
"0.5976157",
"0.55274296",
"0.5461416",
"0.54331154",
"0.5427395",
"0.54065764",
"0.5353948",
"0.5310081",
"0.5299713",
"0.52915895",
"0.5232938",
"0.52284855",
"0.52060425",
"0.51913404",
"0.5183644",
"0.5140631",
"0.5137245",
"0.5134772",
"0.51168877",
"0.5085558",
"0.50854945",
"0.5066056",
"0.50655377",
"0.5061042",
"0.50051856",
"0.49958837",
"0.49776986",
"0.49736372",
"0.49635676",
"0.49584287",
"0.4954847",
"0.49389383",
"0.49380854",
"0.4935613",
"0.4922711",
"0.49052376",
"0.48920137",
"0.48755676",
"0.48678374",
"0.48678374",
"0.48678374",
"0.48668322",
"0.48639497",
"0.48556408",
"0.48517102",
"0.48470187",
"0.48470157",
"0.48346108",
"0.48313376",
"0.48212624",
"0.4820751",
"0.48198515",
"0.4813559",
"0.47971633",
"0.47969648",
"0.47954643",
"0.47734326",
"0.47644058",
"0.4759972",
"0.4759133",
"0.4758103",
"0.47566724",
"0.4754359",
"0.47491416",
"0.47478884",
"0.47476423",
"0.47461948",
"0.47407702",
"0.4738826",
"0.47373646",
"0.47283262",
"0.47261706",
"0.4722149",
"0.471929",
"0.47189352",
"0.47170252",
"0.47154117",
"0.47113112",
"0.47097802",
"0.47019905",
"0.46910042",
"0.46910042",
"0.46910042",
"0.46877757",
"0.46873018",
"0.46862957",
"0.46818262",
"0.4677027",
"0.4672789",
"0.46727854",
"0.46727854",
"0.4657717",
"0.46552107",
"0.46532398",
"0.46477178",
"0.46447524",
"0.46437576"
] |
0.6211193
|
3
|
Lazily fetches all builds.
|
def builds(filters = {})
fetch_resources_lazily("builds", filters)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list_all\n response_json = @client.api_get_request(\"/api/build\")\n\n return nil unless response_json\n\n response_json[\"builds\"].map do |build|\n {\n :name => build[\"uri\"].sub(/^\\//,''),\n :uri => build[\"uri\"],\n :lastStarted => build[\"lastStarted\"]\n }\n end.sort{ |x,y| x[:name] <=> y[:name]}\n\n end",
"def get_builds_by_repo(repo)\n\t\treturn self.fetch(\"repos/#{repo}/builds\")\n\tend",
"def remote_builds\n @remote_builds ||= url_request(url_of_file('builds_list')).lines.map(&:strip)\n end",
"def index\n @builds = Build.all\n end",
"def index\n @builds = Build.all\n end",
"def build_me\n # Download all softwares in parallel\n download\n build\n end",
"def builds\n servers.flat_map { |server| server.builds }\n end",
"def builds_for_project(name, num = 100)\n count = 0\n next_token = nil\n builds = []\n loop do\n r = client.list_builds_for_project(project_name: name, next_token: next_token)\n builds += r.ids\n break if (count += r.ids.count) >= num\n break if (next_token = r.next_token).nil?\n end\n builds.first(num)\n end",
"def builds(platform: nil)\n all = TestFlight::Build.all(app_id: self.apple_id, platform: platform || self.platform)\n return all unless block_given?\n all.each { |build| yield(build) }\n end",
"def recent_builds(params = {})\n CircleCi.request(conf, base_path, params).get\n end",
"def index\n @builds = @repo.builds.order('created_at DESC')\n end",
"def build_everything\n puts 'building posts'\n build_posts\n puts 'building tags'\n build_tags\n puts 'building index'\n build_index\n puts 'building feed'\n build_feed\n end",
"def all(options = {})\n request_model = @request_model_factory.all_builds_request_model(options)\n response = @network_client.perform_request(request_model)\n JSON.parse(response.body)['instances'].map do |hash|\n Fabricio::Model::Build.new(hash)\n end\n end",
"def recent_builds(params = {})\n CircleCi.request(@conf, \"/project/#{username}/#{project}\", params).get\n end",
"def build_results\n CircleCi::Project.recent_builds_branch('salsify', 'dandelion', 'develop')\n end",
"def show\n @builds = @job_matrix.latest_builds.group_by(&:job_id)\n @build_results = BuildResult\n .where(build_id: @job_matrix.latest_builds.pluck(:id))\n .where(ubuntu_release: Rails.application.config_for(:uosci)['supported_combinations'].keys)\n .order(created_at: :desc).includes(:user).group_by(&:build_id)\n end",
"def index\n @os_builds = OsBuild.all\n end",
"def list_builds 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_list_builds_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::Build::V1::ListBuildsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def possible_builds\n commits = [@job.commit]\n\n if defined?(SamsonKubernetes) && @job.deploy.kubernetes_reuse_build\n previous_scope = @job.deploy.stage.deploys.prior_to(@job.deploy).where(kubernetes_reuse_build: false)\n previous = previous_scope.first&.job&.commit\n commits.unshift previous if previous\n end\n\n Build.where(git_sha: commits).sort_by { |build| [commits.index(build.git_sha), -build.updated_at.to_i] }\n end",
"def fetch\n @github.fetch\n @stackoverflow.fetch\n @acuk.fetch\n @jobs = data.shuffle\n end",
"def latest_builds(project, amount = 5)\n project.builds.order('build_number DESC').limit(amount).to_a\n end",
"def fetch\n Repository::GitMirror.active.find_each(&:fetch)\n end",
"def fetch_all_archives\n fetch_archives\n rescue\n []\n end",
"def get_latest_build_for_xml_publish\n ReportLog.entering(@@class_name, __method__.to_s)\n test_suite_build_list = Array.new\n # set up RTC client\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_getLatestBuildTestResults])\n @params = nil\n @payload = nil\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_GET, @api, @params, @payload)\n # run API\n ReportLog.info('Retrieving latest test results (builds) for all test suites...')\n rtc_client.run_api\n if rtc_client.run_successfully\n ReportLog.info('All latest test results (builds) retrieved. Constructing test suite build list...')\n result_hash = rtc_client.response_body.fetch(Constants::JSON_KEY_RESULT).fetch('Latest Test Suite Results')\n result_hash.each do |result|\n test_suite_build = Hash.new\n test_suite_build['build'] = result['Build']['Build Name'].to_s\n test_suite_build['git_branch'] = result['Build']['Git Branch'].to_s\n test_suite_build['sprint'] = result['Build']['Sprint'].to_s\n test_suite_build['Test Suite'] = result['Test Suite']['Name'].to_s\n\n test_suite_build_list.push(test_suite_build)\n end\n ReportLog.info('Test suite build list constructed.')\n else\n raise construct_api_failure_msg(rtc_client)\n end\n ReportLog.exiting(@@class_name, __method__.to_s)\n return test_suite_build_list\n end",
"def getprojects()\n printRepoHeader\n \n loop do\n # Print each of the new returned repositories\n begin\n get.each do |repo|\n printRepo(repo) if (@slugs.add?(repo['slug']))\n\n # Flush to prevent data loss if we crash\n STDOUT.flush\n end\n rescue Exception => msg\n STDERR.puts \"WARNING: Poll failed at #{Time.now}\"\n STDERR.puts msg\n end\n\n # Poll every 5 minutes\n sleep 300\n end\n end",
"def run_all\n build_all_assets \"Rebuilding all assets\", true\n end",
"def all_builds_for_train(train: nil, platform: nil)\n return TestFlight::Build.builds_for_train(app_id: self.apple_id, platform: platform || self.platform, train_version: train)\n end",
"def index\n @builds = current_application.builds\n @build = current_application.builds.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @builds }\n end\n end",
"def index\n @builds = Build.all\n render json: @builds\n end",
"def fetch_branches\n refs = @github_client.fetch_refs(@repo_user,@repo_name) \n branch_refs = filter_branch_refs refs \n branch_refs = fetch_and_set_dates(branch_refs)\n branch_refs = sort_by_date(branch_refs) \n branches(branch_refs)\n end",
"def fetch_gems_data\n puts \"Fetching data for...\"\n # slice 100 to avoid too many requests on RubyGems and GitHub APIs\n gems.each_slice(100) do |batch|\n each_concurrently(batch) do |gem|\n begin\n retries ||= 0\n # set verbose to true to stdout the gem name\n gem.prepare_data(verbose: true)\n # rescue SocketError, Faraday::ConnectionFailed...\n rescue StandardError\n (retries += 1) <= RETRIES ? retry : nil\n end\n end\n end\n end",
"def show\n @buildq = @project.builds.ransack params[:q]\n @builds = @buildq.result.page(params[:page]).order('id desc')\n end",
"def fetch_all!\n fetch_all(true)\n end",
"def build_cache\n []\n end",
"def build_list(hero)\n\t\tbuilds = hero.builds\n\t\t#This Line is just to limit the initial amount of builds shown. Possibly implement a way to search further.\n\t\tif builds.size >= 5\n\t\t\tbuilds = builds.slice(0,5)\n\t\tend\n\t\tlist = builds.map{|build| \"#{hero.builds.index(build) + 1}. #{build.name} #{build.votes}\"}.join(\"\\n\")\n\tend",
"def all(slug = @curry_with[0])\n response = @connection.get(\"/repos/#{slug}/pulls\", per_page: 100)\n PullRequest.parse(@connection, response.body)\n end",
"def build_cache\n all_files = []\n\n Find.find(@root) do |path|\n if FileTest.directory?(path)\n if File.basename(path)[0] == ?.\n Find.prune\n else\n next\n end\n else\n path.slice!(\"#{@root}/\")\n all_files << path\n end\n end\n\n return all_files\n end",
"def filtered_builds\n @filtered_builds ||= filter_builds\n end",
"def all\n repos = self.class.load_json(repos_url)\n repos.map! { |repo| self.class.filter_repo_info(repo) }\n self.class.slice_in(repos, 3)\n end",
"def get_commits\n # get the last build number\n build_tag = last_build_git_data\n @last_build_number = build_tag[:build_number]\n if @last_build_number == 0\n puts \"unable to get last build number using git describe. It returned #{build_tag[:describe]} but \\\nexpecting something that has letters followed by numbers. Unable to continue\"\n exit 1\n end\n\n # Jenkins will tag the build before running the deploy, @last_build_number - 1 will get the previous built version to get the diff.\n # However, if prev_build is set, use that instead. \n from_build = (@prev_build.nil?) ? (@last_build_number.to_i - 1) : @prev_build.to_i\n \n # now fetch all commits for anything between the current revision and the last build number\n last_build_tag = \"#{build_tag[:tag_name]}#{from_build}\"\n # puts \"looking for commits between #{last_build_tag} and #{@build_revision}\"\n \n commits = @repo.commits_between(last_build_tag, @build_revision)\n if (commits && commits.length > 0)\n load_tasks(commits)\n else\n puts \"No commits logs (other than possibly merges) were found between tag #{last_build_tag} and build revision #{build_revision}. \\n\nNothing to report on, exiting. \"\n exit 1\n end\n end",
"def all_deliverable_projects\n all_digest_projects\n end",
"def build_all\n create_categories\n puts \"Built categories\"\n create_contacts\n puts \"Built contacts\"\n create_locations\n puts \"Built locations\"\n create_services\n puts \"Built services\"\n create_service_types\n puts \"Built service types\"\n create_comments\n puts \"Built comments\"\n create_costs\n puts \"Built costs\"\n create_service_locations\n puts \"Built service locations\"\n create_service_contacts\n puts \"Built service locations\" \n create_users\n puts \"Built users\" \n end",
"def get\n CircleCi.request(conf, \"#{base_path}/#{build}\").get\n end",
"def find_all\n Regulate::Git::Interface.find_all.collect do |resource_data|\n self.new_from_git( resource_data )\n end\n end",
"def index\n @github_loads = GithubLoad.all\n end",
"def all\n @all ||= ENV['DOCKER_REGISTRIES'].to_s.split(',').map { |url| new(url) }\n end",
"def display_all_by_build\n\n genome = Genome.find(params[:genome_build])\n reference = Reference.where(name: params[:build_name]).first\n\n unless reference.nil? || genome.nil?\n reference_id = reference.id\n @genomeName = genome.build_version\n @experiments = genome.experiments\n @features = Array.new\n\n @experiments.each do |exp|\n @features.concat exp.features.where(reference_id: reference_id)\n end\n\n render\n\n else\n redirect_to features_path, flash: {alert: \"Selected reference could not be found in the current genome\"}\n end\n\n end",
"def all_buildings\n @all_buildings ||= Buildings.new( ranges, fill_gaps: true )\n end",
"def fetch_build(path)\n\n is_remote = opensdg_is_path_remote(path)\n build = {}\n get_endpoints().each do |key, value|\n endpoint = is_remote ? path + '/' + value : File.join(path, fix_path(value))\n\n begin\n json_file = is_remote ? URI.open(endpoint) : File.open(endpoint)\n build[key] = JSON.load(json_file)\n rescue StandardError => e\n # For backwards compatibility, forego the exception in some cases.\n abort_build = true\n if ['translations', 'indicator_downloads', 'disaggregation', 'data_packages'].include? key\n abort_build = false\n elsif endpoint.include? '/untranslated/'\n abort_build = false\n end\n if abort_build\n puts e.message\n abort 'Unable to read data from: ' + endpoint\n end\n end\n end\n\n return build\n end",
"def builds_for_shared_runner\n strategy.builds_for_shared_runner\n end",
"def fetch_build(path)\n\n is_remote = opensdg_is_path_remote(path)\n build = {}\n get_endpoints().each do |key, value|\n endpoint = is_remote ? path + '/' + value : File.join(path, fix_path(value))\n\n begin\n json_file = is_remote ? open(endpoint) : File.open(endpoint)\n build[key] = JSON.load(json_file)\n rescue StandardError => e\n # For backwards compatibility, forego the exception in some cases.\n abort_build = true\n if ['translations', 'indicator_downloads', 'disaggregation', 'data_packages'].include? key\n abort_build = false\n elsif endpoint.include? '/untranslated/'\n abort_build = false\n end\n if abort_build\n puts e.message\n abort 'Unable to read data from: ' + endpoint\n end\n end\n end\n\n return build\n end",
"def fetch\n @jobs = fetch_rss(url, Sources::STACKOVERFLOW)\n end",
"def build!(silent: false)\n configure!(mode: :build, target: :production)\n index_prebuilt!\n # First we build prebuilt pages that need digests calculated by build_page\n digested = sitemap.select { |_path, page| page[:digest] == true }\n digested.each { |path, _page| build_page(path, silent: silent) }\n # Then we build all other pages\n undigested = sitemap.reject { |_path, page| page[:digest] == true }\n undigested.each { |path, _page| build_page(path, silent: silent) }\n end",
"def fetch_queries(queries)\n raise ArgumentError, 'Error: Must have queries' unless queries.is_a?(Array)\n build = CircleCi::Build.new @username, @reponame, nil, @build, @config\n artifacts = build.artifacts\n\n if artifacts.nil?\n STDERR.puts 'Error: No artifacts'\n return Results.new\n end\n parse(artifacts: artifacts, queries: queries)\n end",
"def expand_all\n expand\n @cache\n end",
"def build_gems; end",
"def fetch_changesets\n puts \"Calling fetch changesets on #{clone_path}\"\n # runs git fetch\n self.fetch\n super\n end",
"def refresh_all\n\t\tputs \"Refresh all the entries within the local site store ... \"\n\t\tchanges=Hash.new\n\t\tchanges=bulk_refresh(@known_sites.keys)\n\t\t@known_sites.merge!(changes)\n\t\tputs \"Done refresh all entries.\"\n\t\treturn changes\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\tend",
"def refresh\n list.clear\n\n Ginatra.load_config[\"git_dirs\"].map do |git_dir|\n if Dir.exist?(git_dir.chop)\n dirs = Dir.glob(git_dir).sort\n else\n dir = File.expand_path(\"../../../#{git_dir}\", __FILE__)\n dirs = Dir.glob(dir).sort\n end\n\n dirs = dirs.select {|f| File.directory? f }\n dirs.each {|d| add(d) }\n end\n\n list\n end",
"def fetch_snapshots\n @snapshots = ::Refinery::Snapshots::Snapshot.all\n end",
"def promise_all\n _class_fetch_states[:all] = 'i'\n _promise_get(\"#{resource_base_uri}.json?timestamp=#{`Date.now() + Math.random()`}\").then do |response|\n collection = _convert_array_to_collection(response.json[self.to_s.underscore.pluralize])\n _class_fetch_states[:all] = 'f'\n _notify_class_observers\n warn_message = \"#{self.to_s}.all has been called. This may potentially load a lot of data and cause memory and performance problems.\"\n `console.warn(warn_message)`\n collection\n end.fail do |response|\n error_message = \"#{self.to_s}.all failed to fetch records!\"\n `console.error(error_message)`\n response\n end\n end",
"def all_jobs\n\n find_jobs()\n end",
"def all(opts={})\n\n res = fetch_all(opts)\n\n res.is_a?(Array) ? res.map { |hwi| Ruote::Workitem.new(hwi) } : res\n end",
"def get_my_repos\n repos = []\n\n (1..get_total_repo_pages_count.to_i).each do |index|\n get_json( \"#{ GITHUB_USER_REPOS_URL }?per_page=100&page=#{ index }\" ).each do |item|\n repos << item[ 'full_name' ]\n end\n end\n\n return repos\nend",
"def manage_all_projects\n projects= [ \n [\"barjob\", \"git@github.com/foo/bar.git\"],\n [\"quxjob\", \"git@github.com/baz/qux.git\"],\n ]\n projects.each do |project_name, git_repo|\n manage_dynamic_branches_for_project(project_name, git_repo)\n end\nend",
"def build()\n HP.logger.debug(\"~ Build Mode: #{build_mode}\")\n HP.logger.debug(\"~ Source Root: #{source_root}\")\n HP.logger.debug(\"~ Build Root: #{build_root}\")\n build_entries(entries())\n end",
"def perform\n @project.repo &:fetch\n end",
"def find_buildings(architect)\n name = architect.name\n url = Addressable::URI.parse('https://www.googleapis.com/freebase/v1/search')\n url.query_values = {\n query: name,\n type: \"/architecture/structure\",\n key: GOOGLE_CLIENT_ID\n }\n from_freebase = HTTParty.get(url, :format => :json)\n @results = from_freebase[\"result\"]\n @buildings_designed = @results.map { |building| building[\"name\"]}\n end",
"def build_all_listings\n all_listings = []\n @raw_master.each do |listing|\n all_listings << build_listing(listing)\n end\n return all_listings\n end",
"def build_all_listings\n all_listings = []\n @raw_master.each do |listing|\n all_listings << build_listing(listing)\n end\n return all_listings\n end",
"def build_all_listings\n all_listings = []\n @raw_master.each do |listing|\n all_listings << build_listing(listing)\n end\n return all_listings\n end",
"def filter_builds\n # Retrieve the build numbers from the latest poll\n build_nums = build_failures.flatten.map do |build_result|\n build_result['build_num']\n end\n # Remove the saved build numbers\n remainder = build_nums - existing_builds_numbers(build_nums)\n # Select the winners\n build_failures.select do |build_result|\n remainder.include?(build_result['build_num'])\n end\n end",
"def last_five_builds\n last_builds(5)\n end",
"def all\n @cache ||= Request.get('/data')\n\n end",
"def fetch_watched_repos\n toggle! :fetching_repos\n\n sidekiq_logger.info { \"[#{username}] Fetching watched repos...\" }\n\n github_watched.each do |wr|\n attrs = wr.slice(:name, :language, :description, :fork, :private, :size,\n :forks, :open_issues, :pushed_at, :created_at, :updated_at)\n\n if repo = Repo.find_by_id(wr.id)\n repo.attributes = attrs.merge({:watchers_count => wr.watchers})\n else\n repo = Repo.new(attrs.merge({:watchers_count => wr.watchers}))\n repo.id = wr.id\n end\n\n repo.owner = User.find_or_create_by_username(wr.owner.login)\n repo.save\n\n unless watchings.exists?(repo.id)\n watchings << repo\n sidekiq_logger.info { \"[#{username}] now watching #{wr.name}\" }\n end\n end\n\n sidekiq_logger.info { \"[#{username}] Completed fetching watched repos\" }\n\n prune_unwatched_repos\n\n toggle! :fetching_repos\n end",
"def fetch_all\n klass_name = Starwars.const_get(name.split('::').last).const_get('RESOURCE_NAME')\n object = Starwars.const_get(\"#{klass_name.capitalize}\").new(url: \"#{Starwars::Base::BASE_URL}/#{klass_name}/\")\n Starwars::Request.new(resource: object, uri: object.url, params: {}).perform_request\n end",
"def save_builds\n filtered_builds.each do |build|\n b = Build.new\n b.build_number = build['build_num']\n b.user = build['committer_name']\n b.stop_time = build['stop_time']\n b.queued_at = build['queued_at']\n b.build_time = build['build_time_millis']\n b.save\n end\n end",
"def build\n Bob.logger.info \"Building #{buildable.commit} of the #{buildable.scm} repo at #{buildable.uri}\"\n\n in_background do\n buildable.start_building if buildable.respond_to?(:start_building)\n\n scm.with_commit(buildable.commit) { |commit_info|\n buildable.finish_building(commit_info, *run_build_script)\n }\n end\n end",
"def get_build\n @progressIndicator.setIndeterminate(true)\n @progressIndicator.startAnimation(nil)\n @downloadLabel.stringValue = \"Getting build number...\"\n chrome_build = ChromeBuild.new\n chrome_build.delegate = lambda do |data|\n result = NSString.alloc.initWithData data, encoding:NSUTF8StringEncoding\n @buildLabel.stringValue = \"Build: #{result}\"\n get_zip(result)\n end\n chrome_build.buf = NSMutableData.new\n chrome_build.response = nil\n\n url = NSURL.URLWithString(\"http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/LATEST\")\n req = NSURLRequest.requestWithURL(url)\n chrome_build.conn = NSURLConnection.alloc.initWithRequest(req, delegate:chrome_build)\n end",
"def build_new_docs\n FileUtils.mkdir_p @temp_root\n @automations.each do |auto|\n \n debug_msg \"Working with #{auto.short_name}\"\n build = @builds_map[auto.short_name]\n versions_to_build = []\n debug_msg \" fetching available verions\"\n if build\n max_build_version = build.versions.max\n versions_to_build += auto.available_versions.select{|v| v > max_build_version}\n else\n n = (auto.respond_to? :versions_to_build) ? auto.versions_to_build : 1\n versions_to_build += auto.available_versions.sort[-n..-1]\n end\n \n if versions_to_build.size > 0\n debug_msg \" versions to build: #{versions_to_build.join(', ')}\"\n else\n debug_msg \" nothing to build\"\n end\n versions_to_build.each do |version|\n build_version auto, version\n end\n \n debug_msg \"\"\n end\n \n clean_up\n end",
"def index\n @buildings = Building.all\n end",
"def build_projects(options = {})\n # Start builds and store data\n @data_store.transaction do\n @ciservice.build_active_projects\n @data_store[:builds] = @ciservice.builds\n end\n end",
"def build_games\n until @match.games.size == 3\n @match.games.build\n end\n end",
"def fetch_all_remote_specs(&blk)\n Bundler.ui.info \"Fetching source index for #{@remote_uri}\"\n Bundler.ui.debug \"Fetching modern index\"\n Gem.sources = [\"#{@remote_uri}\"]\n begin\n # Fetch all specs, minus prerelease specs\n Gem::SpecFetcher.new.list(true, false).each(&blk)\n # Then fetch the prerelease specs\n begin\n Gem::SpecFetcher.new.list(false, true).each(&blk)\n rescue Gem::RemoteFetcher::FetchError\n Bundler.ui.warn \"Could not fetch prerelease specs from #{@remote_uri}\"\n end\n rescue Gem::RemoteFetcher::FetchError\n raise Bundler::HTTPError, \"Could not reach #{@remote_uri}\"\n end\n end",
"def get_all_assets\n return_array = []\n ctr = 0\n loop do\n sleep(0.5)\n ctr = ctr + 1\n res = get_page_assets(ctr)\n unless res['assets'].empty?\n return_array.push(res['assets'])\n else\n break\n end\n end\n return_array.flatten\nend",
"def run_all\n \n projects.each do |project|\n project.targets.each do |target|\n config = target.config('Debug')\n UI.info((\"*\" * 80))\n UI.info \"Building #{project.name} - #{target.name} - #{config.name}\"\n UI.info((\"*\" * 80))\n config.builder.build\n end\n end\n \n end",
"def acquire_repo_list\n set_auth\n set_github_repo_name\n repo_list = []\n (@github.repos.list org: GITHUB_ORG).each do |l|\n repo_list << l[:name]\n end\n repo_list\nend",
"def get_all_versions\n []\n end",
"def execute site\n @cache = Aweplug::Cache.default site # default cache here shouldn't matter.\n init_faraday(site)\n\n ids = []\n if @url.start_with? 'http'\n demos = YAML.load(@faraday.get(@url).body)\n else\n demos = YAML.load(File.open(@url))\n end\n if demos\n Parallel.each(demos, :in_threads => (site.build_threads || 0)) do |url|\n next if @excludes.include?(url)\n begin\n build(url, site, ids)\n rescue Exception => e\n Awestruct::ExceptionHelper.log_message \"Error building demo from #{url}\"\n Awestruct::ExceptionHelper.log_building_error e, '' # We don't have a page source for this\n end\n end\n end\n end",
"def cache_all_repos_for_user\n raise InvalidToken unless test_authentication\n repos = []\n repos += get_user_repos\n get_user_orgs.each do |org|\n repos += get_org_repos( org['login'] )\n end\n File.open(@cache_file, 'w') do |f|\n f.write repos.to_json\n end\n repos\n end",
"def build; end",
"def all\n api_get(path)\n end",
"def fetch_changesets\n # Save ourselves an expensive operation if we're already up to date\n return if scm.num_revisions == changesets.count\n\n revisions = scm.revisions('', nil, nil, :all => true)\n return if revisions.nil? || revisions.empty?\n\n # Find revisions that redmine knows about already\n existing_revisions = changesets.find(:all).map!{|c| c.scmid}\n\n # Clean out revisions that are no longer in git\n Changeset.delete_all([\"scmid NOT IN (?) AND repository_id = (?)\", revisions.map{|r| r.scmid}, self.id])\n\n # Subtract revisions that redmine already knows about\n revisions.reject!{|r| existing_revisions.include?(r.scmid)}\n\n # Save the remaining ones to the database\n revisions.each{|r| r.save(self)} unless revisions.nil?\n end",
"def load_servers\n if File.directory?(cache_directory)\n Dir.entries(cache_directory).each do |server_json|\n server_json = File.join(cache_directory, server_json)\n next unless server_json.end_with?(\".json\")\n next if File.directory?(server_json)\n build_url = JSON.parse(IO.read(server_json))[\"jobs\"].first[\"url\"]\n server(build_url)\n end\n end\n end",
"def pull_requests\n uri = URI(uri_string_for_pull_requests)\n execute_http_request(:get, uri).body\n end",
"def all(params = {})\n Iterable.request(conf, base_path, params).get\n end",
"def everything\n raw = JSON.parse(`curl -sX GET 'https://api.nirvanahq.com/?api=rest&appid=gem&authtoken=#{@token}&method=everything&since=0'`)\n raw['results']\n end",
"def all\n load[:results]\n end",
"def build\n from_branches + from_tags + from_refs\n end",
"def index\n if params[:search].nil? || params[:search].empty?\n @buildings = Building.paginate(page: params[:page])\n else\n @buildings = search_buildings(params[:search])\n end\n end"
] |
[
"0.7296129",
"0.6667138",
"0.6655257",
"0.64318824",
"0.64318824",
"0.6394068",
"0.6388178",
"0.63228804",
"0.6315594",
"0.63138396",
"0.62459344",
"0.62009",
"0.61851406",
"0.6077386",
"0.60382944",
"0.6001163",
"0.5963967",
"0.5928858",
"0.59113204",
"0.5886723",
"0.588318",
"0.58526015",
"0.58206517",
"0.5796104",
"0.57549906",
"0.57316566",
"0.57003397",
"0.5655911",
"0.56462014",
"0.5572145",
"0.5569726",
"0.55450475",
"0.55429584",
"0.55413073",
"0.55272585",
"0.55144584",
"0.5504633",
"0.5493187",
"0.5477984",
"0.54765457",
"0.54671985",
"0.54581994",
"0.5454129",
"0.5448242",
"0.5446723",
"0.5432911",
"0.5429772",
"0.5417562",
"0.54062223",
"0.53923863",
"0.53900343",
"0.5375061",
"0.5361883",
"0.5360927",
"0.5344226",
"0.5336848",
"0.5329433",
"0.5326311",
"0.53145397",
"0.53107387",
"0.5306712",
"0.52546936",
"0.5253282",
"0.52515036",
"0.52414536",
"0.5236211",
"0.5228674",
"0.5219117",
"0.52187145",
"0.52187145",
"0.52187145",
"0.52166",
"0.5216244",
"0.52153957",
"0.5213349",
"0.52129024",
"0.52041215",
"0.5202956",
"0.52016914",
"0.52006847",
"0.5189502",
"0.51882464",
"0.5186317",
"0.5180113",
"0.51797193",
"0.517781",
"0.5174516",
"0.5167245",
"0.51590735",
"0.5153196",
"0.51515454",
"0.5146814",
"0.51418227",
"0.5140378",
"0.513721",
"0.51324046",
"0.51313645",
"0.5111617",
"0.510925",
"0.5103331"
] |
0.75809765
|
0
|
find node by full node_name or by matching prefix of node_name
|
def find_node(node_name)
puts "*"*80
raise(Thor::Error, "Node not specified.") if node_name.nil? || node_name.empty?
return {node_name => nodes_in_stage[node_name]} if nodes_in_stage[node_name]
puts "-"*80
nodes_in_stage.each do |key, value|
puts key
return {key => value} if key.start_with?(node_name)
end
raise(Thor::Error, "Not found: #{node_name} in #{stage_name}.")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def node(node_name)\n nodes(node_name).first\nend",
"def find_node(root,path)\n name_array = path.split('.')\n node = root[name_array[0]]\n name_array.each do |n|\n node.children.each do |c|\n if c.name == n\n node = c\n break\n end\n end\n end\n node\n end",
"def get_node_by_name(str)\n self.each_node do |node|\n if get_node_name(node) == str\n return node\n end\n end\n nil\n end",
"def search(dataset, prefix)\n tree = dataset.root\n prefix.each_char do |ch|\n node = tree.find_child(ch)\n\n if node\n tree = node\n else\n return nil\n end\n end\n\n get_leaves(tree)\nend",
"def get_node(node,path)\n name = path.split(\"/\")[0]\n rest = path.split(\"/\")\n rest.delete(name)\n rest = rest.join(\"/\")\n node.each_element do |element|\n if element.name == name\n if rest == \"\"\n return element\n else\n return get_node(element,rest)\n end\n end\n end\n end",
"def get_node_name(_name, _prefix)\n nil\n end",
"def node(name)\n if name =~ /\\./\n # probably got a fqdn, since periods are not allowed in node names.\n # so, take the part before the first period as the node name\n name = name.split('.').first\n end\n @nodes[name]\n end",
"def find_by_prefix(start_key, reverse)\n dir = dir_for_reverse(reverse)\n x = anchor(reverse)\n # if no prefix given, just return a first node\n !start_key and return node_next(x, 0, dir)\n \n level = node_level(x)\n while level > 0\n level -= 1\n xnext = node_next(x, level, dir)\n if reverse\n # Note: correct key CAN be greater than start_key in this case \n # (like \"bb\" > \"b\", but \"b\" is a valid prefix for \"bb\")\n while node_compare2(xnext, start_key) > 0\n x = xnext\n xnext = node_next(x, level, dir)\n end\n else\n while node_compare(xnext, start_key) < 0\n x = xnext\n xnext = node_next(x, level, dir)\n end\n end\n end\n xnext == anchor(!reverse) and return nil\n node_key(xnext)[0, start_key.size] != start_key and return nil\n xnext\n end",
"def find_node(nd_name)\n chef_nodes.find{|nd| nd.name == nd_name }\n end",
"def get_node_containing(node,path,content)\n if path == \"\" then\n return nil\n end\n name = path.split(\"/\")[0]\n rest = path.split(\"/\")\n rest.delete(name)\n rest = rest.join(\"/\")\n node.each_element do |element|\n if element.name == name\n if rest == \"\" && element.content == content\n return element.parent\n else\n node = get_node_containing(element,rest,content)\n if node == nil\n next\n else\n return node\n end\n end\n end\n end\n end",
"def find_node(results, node_name)\n document = ::Nokogiri::XML(results.body)\n document.remove_namespaces!\n document.xpath(\"//#{node_name}\").first\n end",
"def find_node_by_name(name)\n @nodes[name]\n end",
"def search_prefix(prefix)\n current_node = @root_node\n i = 0\n while i < prefix.length\n node = current_node.children[prefix[i]]\n if node.nil?\n return false\n end\n current_node = node\n i += 1\n end\n # we return true if we have successfully iterated through the prefix\n true\n end",
"def node(name)\n name = name.to_sym\n @nodes.detect{|node|\n node.name == name\n }\n end",
"def get_node_by_name(name, options={})\n options[:exactget] ||= {}\n options[:exactget][:name] = name\n ret = get_nodes(options)\n if ret.empty?\n warn \"Cannot find node #{name}\"\n ret = nil\n elsif ret.values.size == 1\n ret = ret.values[0]\n else\n raise \"Multiple nodes returned for #{name}\"\n end\n ret \n end",
"def find_node(*args)\n nodes = find_all_nodes(*args)\n raise AmbiguousNode if nodes.size > 1\n nodes.first\n end",
"def find_prefix(prefix)\n if @trie.children(prefix).length > 0\n return true\n else\n return false\n end\nend",
"def find_by_name(node_id, node = @root_node, list = [])\n if node.name.to_s == node_id.to_s\n list << node\n else\n node.children.each { |child| find_by_name(node_id, child, list) }\n end\n list.compact\n end",
"def search(word)\n search_prefix(root, word, 0)\n end",
"def node(name)\n return node_manager.find(name)\n end",
"def find_node(heads, node_tag, parent_tag = nil)\n heads.flat_map { |item, head| head.nodes.to_a }.find do |node|\n node.to_s == node_tag && (parent_tag.nil? || node.parent.to_s == parent_tag)\n end\n end",
"def starts_with(prefix)\n if search_node(prefix) == nil\n return false\n else\n return true\n end\n end",
"def starts_with(prefix)\n node=@root\n i=0\n while i <prefix.length \n char=prefix[i]\n order=char.ord-97\n return false if node[order].nil?\n node=node[order]\n i+=1\n end\n true\n end",
"def get_matching_strings(prefix)\n puts \"Matching for #{prefix}\"\n ptr = @root\n for i in 0..prefix.size-1\n ptr = ptr.children[prefix[i]]\n return nil unless ptr\n end\n arr = []\n arr << prefix if ptr.is_leaf\n arr << get_strings(ptr, prefix)\n arr\n end",
"def find(word, node = @root)\n new_node = nil\n word.each_char do |char|\n new_node = node.find_child_node(char)\n if new_node == nil\n return nil\n end\n node = new_node\n end\n node\n end",
"def starts_with(prefix)\n node = @root\n prefix.each_char do |c|\n node = node[c]\n return false if node.nil?\n end\n true\n end",
"def match_node(node, *args)\n match_nodes([node], *args)\n end",
"def [](n)\n if n.class == String\n ret = @lookup_name[n]\n ret = @lookup_mac[n] if !ret\n return ret\n end\n @nodes[n]\n end",
"def find_node(*args)\n node = @nodes.find_node(*args)\n node if context?(node)\n end",
"def find_node(options)\n options[:id] = options.delete(:stem) if options[:stem]\n\n unless options[:word] || options[:id]\n raise ArgumentError, 'no find option specified'\n end\n\n if options[:word]\n word = options[:word].mb_chars.downcase.to_s\n nodes.find do |n|\n n.words.include?(word)\n end\n else\n id = options[:id].mb_chars.downcase.to_s\n nodes.find do |n|\n n.id == id\n end\n end\n end",
"def find_target_node\n fullname = @fullname\n mark = ''\n if fullname.end_with?(Position::With_Singular_Leaf)\n mark = Position::With_Singular_Leaf\n elsif fullname.end_with?(Position::Without_Singular_Leaf)\n mark = Position::Without_Singular_Leaf\n end\n fullname.gsub!(/#{mark}/, '')\n @position = Position.find :first, :scope => :self, :conditions => {:fullname => fullname}\n end",
"def node(path)\n current_nodes = root_nodes\n matching_node = nil\n path.each_with_index do |target_node, index|\n case current_nodes\n when Array\n matching_node = current_nodes.find {|node| node.name == target_node} #TODO: make this work with regexes as well as strings...\n raise Bewildr::ElementDoesntExist if matching_node.nil?\n when Bewildr::Element\n if current_nodes.name == target_node #TODO: make this work with regexes as well as strings...\n matching_node = current_nodes\n else\n raise Bewildr::ElementDoesntExist\n end\n end\n raise Bewildr::ElementDoesntExist if matching_node.nil?\n if path.size != index + 1\n matching_node.expand\n load_all_items_hack\n current_nodes = matching_node.child_nodes\n end\n end\n return matching_node\n end",
"def get_node(string)\n # Let's do a case insensitive search..\n string = string.downcase()\n results = @graph.vertices[0].select { |k,v|\n d = v.description\n d.downcase().include? string\n }\n if results.count >= 1\n if results.count > 1\n puts \"WARNING: More than one node matches '#{string}'! Simply using the first one...\"\n end\n # Just use the \"first\" node available, whatever that might mean...\n node = Array(results)[0][1]\n else\n puts \"WARNING: No nodes matches '#{string}'!\"\n node = nil\n end\n return node\n end",
"def lookup_node(request_path)\n\t\t\tname = request_path.last\n\t\t\tname_xnode = name.to_s + XNODE_EXTENSION\n\n\t\t\tnode_path = File.join(@root, request_path.dirname.components, name_xnode)\n\n\t\t\tif File.exist? node_path\n\t\t\t\treturn Node.new(self, request_path.dirname + name, request_path, node_path)\n\t\t\tend\n\n\t\t\treturn nil\n\t\tend",
"def starts_with(prefix)\n curr = @root\n prefix.each_char.all? do |char|\n curr = curr[char]\n end \n end",
"def get_namespace(node, prefix); end",
"def find_by_starts_with(name)\n return nil unless name.present?\n names.select {|e| e.starts_with?(name)}\n end",
"def match(prefix)\n result = []\n current = @root\n current_prefix = prefix\n\n while current != nil && current_prefix != \"\"\n previous, previous_prefix = current, current_prefix\n current, current_prefix = next_node(current, current_prefix)\n end\n\n unless current\n if current_prefix\n return []\n else\n next_nodes = previous[:nodes].select { |prefix, node| prefix.start_with?(previous_prefix) }.values\n end\n else\n next_nodes = [current]\n end\n\n until next_nodes.empty?\n current = next_nodes.pop\n result << current[:value]\n current[:nodes].each { |prefix, node| next_nodes.push(node) }\n end\n\n return result.compact\n end",
"def find(prefix)\n prefix.downcase!\n @base.each_key do |name|\n if name.start_with? prefix\n puts base[name].to_s()\n end\n end\n end",
"def [](name)\n name = name.to_sym\n @nodes.detect { |node| node.name == name }\n end",
"def starts_with(prefix)\n current_node = @root\n prefix.chars.each do |char|\n if !current_node.children[char]\n return false\n break\n else\n current_node = current_node.children[char]\n end\n end\n true\n end",
"def starts_with(prefix)\n current = @root\n prefix.chars.each do |c|\n current = current.siblings.find { |node| node.val == c }\n return false unless current\n end\n\n true\n end",
"def match(node)\n raise_unless_xpath!(node)\n pos = node.xpath('descendant::pos').first\n return nil if pos.nil?\n {:matched => node.respond_to?(:name) ? node.name : '',\n :line => pos['line'].to_i, :column => pos['column'].to_i}\n end",
"def node_name\n path = self.class.to_s\n if i = path.rindex('::')\n path = path[(i+2)..-1]\n end\n path[0] = path[0].chr.downcase\n path\n end",
"def search(word)\n node = @root\n word.each_char { |c|\n unless node.children.key?(c)\n return nil\n end\n node = node.children[c]\n }\n return node\n end",
"def find(name); end",
"def find_node_for(str)\n c = str[0..0]\n return nil if @value==\"\" and !@children.keys.include?(c)\n if @children.keys.include?(c)\n if( str.length<=1 )\n\t ret = @children[c]\n else\n ret = @children[c].find_node_for(str[1..100])\n end\n else\n ret = self\n end\n return ret\n end",
"def searchForABC(node)\n #find first letter of first name of given contact\n letter = node.data.name[0]\n curNode = @head\n while curNode != nil\n\n # if the given name comes before curNode in the alphabet\n if letter <= curNode.data.name[0]\n node.setNext(curNode)\n node.setPrev(curNode.prev)\n if curNode.prev != nil\n curNode.prev.setNext(node)\n end\n if @head == curNode\n @head = node\n end\n curNode.setPrev(node)\n @size = @size + 1\n return\n # if the end of the list is reached and the name has not come before any other name in the list\n elsif curNode.next == nil\n node.setPrev(curNode)\n curNode.setNext(node)\n @tail = node\n @size = @size + 1\n return\n else\n curNode = curNode.next\n end\n end\n end",
"def name_matches?(xml_node, name)\n return false unless xml_node.respond_to?(:name)\n\n return xml_node.name == name || name == '*'\n end",
"def find_prefix(prefix)\n node = find_word prefix.downcase\n if node.nil?\n [false, false, 0]\n else\n count = node.word_count\n count -= 1 if node.is_word\n [true, node.is_word, count]\n end\n end",
"def find_node_by_uri(uri)\n doc.at(\"[xmlns|Id='#{uri}']\", xmlns: OASIS_UTILITY)\n end",
"def lookup(name, *tags)\n xpath(tags.map{ |tag| \"./xs:#{tag}[@name='#{name}']\" }.join('|'))[0]\n end",
"def find(prefix)\n # Iterate over BasicFoods for prefix\n @basic_foods.keys.each do |name|\n if name.downcase.start_with? prefix.downcase # convert both to downcase as case insensitive\n print(name)\n end\n end\n # Iterate over Recipes for prefix\n @recipes.keys.each do |name|\n if name.downcase.start_with? prefix.downcase # convert both to downcase as case insensitive\n print(name)\n end\n end\n end",
"def test_nodesetprefix01\n doc = nil\n docFragment = nil\n element = nil\n elementTagName = nil\n elementNodeName = nil\n appendedChild = nil\n doc = load_document(\"staff\", true)\n docFragment = doc.createDocumentFragment()\n element = doc.createElementNS(\"http://www.w3.org/DOM/Test\", \"emp:address\")\n appendedChild = docFragment.appendChild(element)\n element.prefix = \"dmstc\"\n elementTagName = element.tagName()\n elementNodeName = element.nodeName()\n assert_equal(\"dmstc:address\", elementTagName, \"nodesetprefix01_tagname\")\n assert_equal(\"dmstc:address\", elementNodeName, \"nodesetprefix01_nodeName\")\n \n end",
"def search(node,contactname,index) \n #Break the Contact char by char and have the contact stored at the last node\n charsplit=contactname.split(//)\n asciicode=charsplit[index].ord #Gets the ASCII code for the character\n \n if node.link[asciicode]==nil then\n return Array[node,index] # An array with node and the index upto which we have traver\n elsif node.link[asciicode]!=nil && index==contactname.name.length-1 #we have come all the way to last char or we couldnt find it. We get the last node anyways\n return node\n else\n #Recursively call search\n search(node.link[asciicode],contactname,index=index+1)\n end\n end",
"def findentry(f, name, start)\n f.seek(start)\n myname = getname(f, start)\n if name == myname\n return start\n end\n left = leftchild(f, start)\n right = rightchild(f, start)\n if name < myname\n if left < f.stat.size and left != 0\n res = findentry(f, name, leftchild(f, start))\n else\n res = nil # this should perolate up\n end\n end\n if name > myname\n if right < f.stat.size and right != 0\n res = findentry(f, name, rightchild(f, start))\n else\n res = nil\n end\n end\n return res\n end",
"def get_from_nodes(nodes, string)\n string_len = string.length\n\n (0..nodes.length).each do |n|\n if node = nodes[n]\n trunk = node[0]\n trunk_len = trunk.length\n simdex = string.simdex(trunk)\n\n # if simdex > 0\n if simdex == trunk_len\n if simdex < string_len\n return get_from_nodes(node[2], string.leaf(simdex))\n else\n return node[1]\n end\n end\n # end\n end\n end\n\n return nil\n end",
"def search_node(ip)\n found = nil\n @known_nodes.each do |node|\n if node.is_you? ip\n found = node\n end\n end\n return found\n end",
"def value_of_node(node_name)\n value_of_nodes(node_name).first\nend",
"def findName(podling, list)\n if list.include?(podling.name)\n return podling.name\n end\n podling.resourceAliases.each do |a|\n if list.include? a\n return a\n end\n end\n return nil\nend",
"def get_node(fqn)\n @database.all_nodes.find { |node| node.fqn == fqn }\n end",
"def get_node(node)\n\t\t\t@nodes[node]\n\t\tend",
"def get_node(letter)\n @node_pointers[letter.to_sym]\n end",
"def search_key key\n node = self.head\n while node\n return node if node.key == key\n nc = node.child \n while nc\n return nc if nc.key == key\n ncs = nc.sibling\n while ncs \n return ncs if ncs.key == key\n ncs = ncs.sibling\n end\n nc = nc.child\n end\n node = node.sibling\n end\n end",
"def find_by_prefix(prefix)\n @machines.each do |uuid, data|\n return data.merge(\"id\" => uuid) if uuid.start_with?(prefix)\n end\n\n nil\n end",
"def find_name name\n find_element :name, name\n end",
"def search_prefixes(str, pos= 0, len= -1)\n end",
"def find_node ast, klass\n ast.find {|n| n.content.class == klass }\nend",
"def query_by_nodename(nodename)\n query = {\"query\" => \"SELECT NodeName, NodeID FROM Orion.Nodes WHERE NodeName=@name\", \"parameters\" => {\"name\" => \"#{nodename}\"}}\n do_http_request(@querypath, query)\n end",
"def find_elem(line, index = 1)\n delim = line.chomp.split(' ')\n prefix = delim[index]\nend",
"def get_name(node)\n node.content.titleize.gsub('/', ' / ').squish unless node.nil? || node.content.nil?\n end",
"def get_sub_word(node, prefix)\n return [] if !starts_with(prefix)\n keys = node.children.keys\n result = []\n keys.each do |char|\n if node.children[char].end_of_word\n result << prefix + char\n end\n result.concat(get_sub_word(node.children[char], prefix + char))\n end\n result\n end",
"def node_name\n name = self.class.name.gsub(/^.*::/, '')\n name.gsub!(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2')\n name.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n name.downcase!\n name\n end",
"def test_accessing_node_name\n\t\tassert_equal \"Hillman\", @location2.nodes[0].name\n\tend",
"def districts_by_prefix(districts, prefix)\n name_eng = case prefix\n when :hk\n \"Hong Kong Island\"\n when :kln\n \"Kowloon\"\n when :nt\n \"New Territories\"\n when :is\n \"Islands\"\n else\n nil\n end\n \n districts.select{|district| district.name_eng == name_eng}.first if name_eng\nend",
"def getNode(*args)\n if(args.size == 1)\n return retNode(args[0])\n else\n if (@nodeValues.size > @INDEX)\n tmp = @nodeValues[@INDEX]\n #puts \"----------------\\nSearch For #{@node}\\n#{tmp}\\n--------------------------\"\n retStr = @xmlTool.searchForValue(tmp, @node)\n #puts \"----------------\\nSearch For #{@node}\\n#{retStr}\\n--------------------------\"\n return retStr\n else\n return \"\"\n end\n end\n end",
"def gen_if_match(context, node_name)\n \"#{node_name}.name == '#{name}' && #{node_name}.namespace == #{context.current.module_name}::NAMESPACE\"\n end",
"def find_by_uri(uri, principal_prefix)\n end",
"def node(name)\n nodes[name]\n end",
"def find(prefix)\n\t\tfound_entries = entries.select do |key, value|\n\t\t\tkey[0...prefix.length] == prefix\n\t\tend\n\tend",
"def get_node_name(node)\n begin\n node.name\n rescue NoMethodError\n node.to_s\n end\n end",
"def node_exists?(name)\n exists?(\"node\", name)\n end",
"def xpath_for(string, prefix, visitor); end",
"def find(path, opts = {})\n path = path.to_s\n return self if path.empty?\n\n # remove duplicate slashes\n path = path.gsub(%r{/+}, \"/\")\n\n case path\n # ./foo/...\n when %r{^\\./?} then\n parent ? parent.find($', opts) : root.find($', opts)\n\n # /foo/...\n when %r{^/} then\n root.find($', opts)\n\n # foo/...\n when %r{^([^/]+)/?} then\n # Use the next path part to find a child by that name.\n # If no child can't be found, try to emit a child, but\n # not if the requested name starts with an underscore.\n if child = find_child($1, opts) || (emit_child($1) unless $1.start_with?(\"_\"))\n # Depending on the tail of the requested find expression,\n # either return the found node, or ask it to find the tail.\n $'.empty? ? child : child.find($', opts)\n end\n end\n end",
"def find_node name\n node = ColumnTopologyNode.new(name, @locator)\n node.is_present? ? node : nil\n end",
"def node\n datasource.document.xpath(xpath).first\n end",
"def search_prefixes(data)\n _search_prefixes(data, SEARCHABLE)\n end",
"def child_with_exact_name(name)\n normal_children.find{|n| n.name == name}\n end",
"def find(thing)\n case thing\n when Symbol\n find_by_tag(thing)\n when String\n find_by_string(thing)\n when Array\n find_by_string(thing.join(' '))\n when Node\n thing\n end\n end",
"def get_prefixed_words(prefix)\n # FILL ME IN\n # return [@trie.is_word(prefix)]\n prefix_copy = prefix\n answer = []\n current_node = My_trie.root\n # p \"val is: \"\n # p My_trie.root.val\n # return ['alphabet']\n\n while prefix.length > 0\n # p \"node is: \", current_node.keys\n node = current_node.keys[prefix[0]]\n prefix = prefix[1..-1]\n if node\n current_node = node\n else\n return \"Sorry, we can't find any words with that prefix\"\n end\n end\n #we now have the final letter of the prefix as the current node, I hope.\n # p \"CURRENT NODE.VAL: \", current_node.val\n answer = dfs(current_node, prefix_copy[0...-1])\n return answer\n end",
"def first( path_stack, node )\n return nil if path.size == 0\n\n case path[0]\n when :document\n # do nothing\n return first( path[1..-1], node )\n when :child\n for c in node.children\n r = first( path[1..-1], c )\n return r if r\n end\n when :qname\n name = path[2]\n if node.name == name\n return node if path.size == 3\n return first( path[3..-1], node )\n else\n return nil\n end\n when :descendant_or_self\n r = first( path[1..-1], node )\n return r if r\n for c in node.children\n r = first( path, c )\n return r if r\n end\n when :node\n return first( path[1..-1], node )\n when :any\n return first( path[1..-1], node )\n end\n return nil\n end",
"def search(xpath)\n context = current_context\n begin\n if namespaces.default && !xpath.include?(':') \n find(namespaced(xpath),\n in_default_namespace(namespaces.default.href))\n else \n #find(xpath)\n context.find(xpath) \n end\n rescue Exception => ex\n raise ex, xpath\n end\n end",
"def find_node(value)\n met_resp = find_node_support(value)\n return nil if met_resp[:node].nil?\n\n met_resp[:node]\n end",
"def find_node(value)\n met_resp = find_node_support(value)\n return nil if met_resp[:node].nil?\n\n met_resp[:node]\n end",
"def linear_search(input)\n \n search_name = input.downcase.split(' ')\n search_name.each do |name_el|\n \n entries.each do |entry|\n \n name_array = entry.name.downcase.split(' ')\n \n if name_array.include?(name_el)\n return entry\n end\n end\n end\n return nil\n end",
"def find_order(name)\n page.find(:xpath, \"//a/span/p[contains(text(), '#{name}')]\")\nend",
"def find_node(node_number)\n @_node_map[node_number]\n end",
"def Node(node_id)\n return group(\"node#{node_id}\")\n end",
"def get_node_name(chef_node_name, prefix)\n return chef_node_name unless chef_node_name.nil?\n\n # lazy uuids, 15 chars cause windows has limits\n (\"#{prefix}-\" + rand.to_s.split(\".\")[1]).slice(0, 14)\n end",
"def get_name(prefix)\n if(md = prefix.match(/(?u:^[<'](\\w+)[>']$)/))\n md[1]\n else\n nil\n end\n end"
] |
[
"0.6563202",
"0.64931077",
"0.6474571",
"0.63965887",
"0.63177985",
"0.62740976",
"0.62528414",
"0.6174903",
"0.6162795",
"0.61566484",
"0.6149624",
"0.61342674",
"0.6101362",
"0.60712624",
"0.5991016",
"0.5983769",
"0.5922772",
"0.59211916",
"0.59132427",
"0.59070194",
"0.58940715",
"0.58653647",
"0.5864909",
"0.58560133",
"0.5839487",
"0.58376116",
"0.5814669",
"0.5790333",
"0.5779763",
"0.576632",
"0.5763914",
"0.5763513",
"0.5743294",
"0.5728166",
"0.57133937",
"0.5705993",
"0.57055855",
"0.56865746",
"0.56777364",
"0.5663944",
"0.5656661",
"0.5639816",
"0.56274676",
"0.55967665",
"0.55934185",
"0.5585217",
"0.55766916",
"0.5544615",
"0.5536048",
"0.5516065",
"0.5494986",
"0.5489605",
"0.54858786",
"0.5471616",
"0.5469394",
"0.54677606",
"0.5436877",
"0.5435664",
"0.5403548",
"0.5396638",
"0.539629",
"0.5392769",
"0.5388893",
"0.5377047",
"0.5371721",
"0.5371292",
"0.5366594",
"0.53639424",
"0.536101",
"0.53144485",
"0.5311652",
"0.5307611",
"0.5303354",
"0.5283253",
"0.52790153",
"0.5278633",
"0.52735376",
"0.527001",
"0.52613664",
"0.5252127",
"0.5232861",
"0.52317065",
"0.5219814",
"0.52040607",
"0.5197363",
"0.51951426",
"0.519167",
"0.51881576",
"0.51784503",
"0.51717174",
"0.51710516",
"0.5168739",
"0.51676095",
"0.51676095",
"0.5166262",
"0.516488",
"0.5158887",
"0.5156957",
"0.5152456",
"0.51509464"
] |
0.5686777
|
37
|
ENV['PVC_DEPLOY_TO_BASE'] = stage_data[:deploy_to] || '/sites'
|
def deploy_to_base_dir
# stage[:deploy_to] || '/sites' # TODO: verify if server setup supports `:deploy_to` override
Pvcglue.configuration.web_app_base_dir # TODO: server setup does not yet support `:deploy_to` override, and would have to be refactored at a higher level than stage.
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def deploy_to\n fetch(:deploy_to, nil) || \"/opt/apps/#{fetch(:application)}\"\n end",
"def deploy_to\n \"/data/#{app_name.downcase}/app\"\n end",
"def deploy?; run_options[:deploy]; end",
"def defaults \n default_run_options[:pty] = true\n\tset :deploy_to, \"/usr/local/www/#{application}-#{rails_env}\"\n\tset :apache_config_file, \"#{application}-#{rails_env}.conf\"\n\tset :apache_logs, \"/var/log/apache2/#{application}-#{rails_env}\"\n set :files_dir, \"#{deploy_to}/files\"\n\n # Environment specific tasks\n case rails_env\n when \"staging\"\n after \"deploy:symlink\", \"deploy:cleanup\" # cleanup older versions if successful\n when \"preview\"\n # nothing yet\n when \"production\"\n # nothing yet\n end\nend",
"def stage_wp_site\n # Note - this assumes that the wordpress files are saved in the repository that\n # the WPDeploy script will look for them in a particular directory\n begin \n if AppConfig.wp_deploy_enabled?\n LOGGER.debug \"Staging original wordpress site for project #{self.label}\"\n wpd = WpDeploy.new(self.label)\n wpd.deploy\n else\n LOGGER.info \"Skipping staging of WordPress site for #{self.label} as wp_deploy is disabled\"\n end\n rescue Exception => e\n LOGGER.error \"Error occurred staging original wordpress site: #{e.message}\"\n end\n end",
"def frontend_deploy_path\n deploy_path.join('frontend')\nend",
"def target_root\n APP_ROOT.join(\"deployments/#{target_id}\")\n end",
"def deploySite\n verifyOS\n timeDate = Time.new\n vConfig(CONFIG['configWebsite'])\n read_json(CONFIG['configWebsite'])\n compileP = @parse_json_config['deploy']['compile']['built']\n branchBuilt = @parse_json_config['deploy']['branch']['built']\n msgCommit = @parse_json_config['deploy']['github']['config']['commit']\n if compileP == \"yes\"\n system_commands(\"rake build\")\n end\n # enter_folder(\"./_site\") # DEPRECATED\n add_repo_git(SITEDIR)\n add_remoteurl(SITEDIR)\n pull_execute(branchBuilt, SITEDIR)\n system_commands(\"echo Deploy source files. Wait ...\")\n git_checkout(branchBuilt, SITEDIR)\n system_commands(\"cd #{SITEDIR}; git add .\")\n system_commands(\"cd #{SITEDIR}; git commit -m \\\"#{msgCommit} - #{timeDate.inspect}\\\"\")\n system_commands(\"cd #{SITEDIR}; git push origin -u #{branchBuilt}\")\n\n end",
"def test_app_deploy\n set_env 'APP_DEPLOY', \"test\"\n assert_equal('test', Config.app_deploy)\n end",
"def deploy\n\t# This task is typiclly run after the site is updated but before the server is restarted.\nend",
"def deploy\n\t# This task is typiclly run after the site is updated but before the server is restarted.\nend",
"def deploy_dir\n return @deploy_dir if @deploy_dir # user configuration\n\n case @server\n when 'Tomcat'\n raise 'Configure container root directory' unless @root\n return File.join(@root,'webapps')\n\n when 'JBoss/Tomcat'\n raise \"Please configure deploy directory for JBoss.\"\n\n end\n end",
"def copy_stage_config\n run \"if [ -f #{release_path}/config/stage_configs/#{stage}.rb ]; then cp #{release_path}/config/stage_configs/#{stage}.rb #{release_path}/config/environments/stage.rb; fi\"\n end",
"def server_url\n 'dkdeploy.dev'\n end",
"def deploy_dir\n '/usr/bin'\n end",
"def get_app_dir(deploy_to)\n \"#{deploy_to}/current/\"\n end",
"def create_deploy\n @@tpl = CapistranoDeployGenerator.source_root\n empty_directory \"config/deploy\"\n\n say <<-EOF\n\nconfig/deploy.rb generator\n\nThis menu will help you creating deployment configuration file\ndeploy.rb for Capistrano. It is safe to acceppt defulat values for\nmost or all questions. Just hit Enter if default is provided.\n\nAll values can be changed later in the file itself or you can re-run\ngenerator again.\n\nEOF\n template \"deploy.rb.erb\", \"config/deploy.rb\"\n @stages.each do |stage|\n template \"staging.rb.erb\", \"config/deploy/#{stage}.rb\" \n end\n say \"Please edit manually configuration of the multi-staging files:\"\n @stages.map { |x| say \"./confg/deploy/#{x}.rb\\n\"}\n end",
"def cap_deploy(site, env, maintenance_flag, action=\"deploy\")\n\t\tif action == \"deploy\"\n\t\t\ts3object = @options[:s3object] || \"\"\n\t\t\tprint_disclaimer(\"call cap #{env} #{site}\")\n\t\t\tsystem \"cap #{env} #{site} BEAVER_S3_OBJECT_PATH=#{s3object}\"\n\t\telsif action == \"rollback\"\n\t\t\tprint_disclaimer(\"call cap #{env} #{site}:#{action}\")\n\t\t\tsystem \"cap #{env} #{site}:#{action}\"\n\t\tend\n\tend",
"def set_base_url\n $base_url = (ENV['base_url'].nil? || ENV['base_url'].empty?) ? CONFIG['default_base_url'] : ENV['base_url']\nend",
"def stage!\n build_to self[:staging_path]\n end",
"def deploy_disabled?\n ENV['NO_DEPLOY'] == '1'\nend",
"def deploy_disabled?\n ENV['NO_DEPLOY'] == '1'\nend",
"def deploy_disabled?\n ENV['NO_DEPLOY'] == '1'\nend",
"def deploy_to_for(app)\n # XXX: to_sym\n application = applications[app.to_sym] || applications[app.to_s]\n application && application[:deploy_to] && Pathname.new(application[:deploy_to])\n end",
"def environment \n if exists?(:stage)\n stage\n elsif exists?(:rails_env)\n rails_env \n elsif(ENV['RAILS_ENV'])\n ENV['RAILS_ENV']\n else\n \"production\" \n end\nend",
"def deploy_local(appdir, appname, params={})\n @vespa.deploy_local(appdir, appname, @vespa.nodeproxies[hostlist.first], selfdir, params)\n end",
"def deploy_url\n if @yaml[\"deployment\"][\"url\"] != \"http://example.com\"\n @yaml[\"deployment\"][\"url\"]\n end\n end",
"def deploy\n unless ITEMS[:project].has_value? SETTINGS[:project]\n raise \"Invalid project: #{SETTINGS[:project]}.\"\n end\n\n # Call the original deploy method.\n orig_deploy\n end",
"def deploy\n @operation = \"Deploy\"\n build_env = project[:build_env] || \"\"\n\n prepare_local_dir do\n run_cmd \"cap -q deploy #{build_env}\"\n run_cmd \"cap -q deploy:migrate #{build_env}\"\n run_cmd \"cap -q deploy:cleanup #{build_env}\"\n end\n end",
"def get_env_mappings()\n {\n 'prd' => 'production',\n 'prv' => 'preview',\n 'rev' => 'review',\n 'stg' => 'staging',\n 'qa' => 'qa',\n 'dev' => 'development',\n 'dvp' => 'devops',\n }\nend",
"def deploy\n cmd = \"deploy #{@resource[:source]} --name=#{@resource[:name]}#{runtime_name_param_with_space_or_empty_string}\"\n if @resource[:runasdomain]\n cmd = append_groups_to_cmd(cmd, @resource[:servergroups])\n end\n cmd = \"#{cmd} --force\" if force_deploy?\n display_lines 100\n bring_up 'Deployment', cmd\n @resource[:name]\n end",
"def prepare_deploy\n `cd #{self.project_root} && BUNDLE_GEMFILE=Gemfile bundle exec cap #{self.environment} deploy:setup -S phase=node_prepare HOSTS=#{self.hostname}`\n `cd #{self.project_root} && BUNDLE_GEMFILE=Gemfile bundle exec cap #{self.environment} deploy -S phase=node_prepare HOSTS=#{self.hostname}`\n end",
"def before_deploy_site\n create\n end",
"def deploy\n if phase.has_key?('deploy')\n execute(\"deploy\", phase['deploy'])\n end\n end",
"def environment\n if exists?(:stage)\n stage\n elsif exists?(:rails_env)\n rails_env\n elsif(ENV['RAILS_ENV'])\n ENV['RAILS_ENV']\n else\n \"production\"\n end\nend",
"def environment\n if exists?(:stage)\n stage\n elsif exists?(:rails_env)\n rails_env\n elsif(ENV['RAILS_ENV'])\n ENV['RAILS_ENV']\n else\n \"production\"\n end\nend",
"def deploy!(options={})\n params = {}\n params['api_key'] = @api_key\n params['deploy[rails_env]'] = options[:framework_env] || 'development'\n params['deploy[local_username]'] = options[:username] || %x(whoami).strip\n params['deploy[scm_repository]'] = options[:scm_repository]\n params['deploy[scm_revision]'] = options[:scm_revision]\n response(@deploy_url, params)\n end",
"def update_deployable\n self.deployable = log_path.present? and (roles.present? or hosts.present?)\n true\n end",
"def setup_path\n # The Java Buildpack for WLS creates the complete domain structure and other linkages during staging.\n # The directory used for staging is at /tmp/staged/app\n # But the actual DEA execution occurs at /home/vcap/app. This discrepancy can result in broken paths and non-startup of the server.\n # So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution\n # Also, this script needs to be invoked before starting the server as it will create the links and also tweak the server args\n # (to listen on correct port, use user supplied jvm args)\n\n File.open(@application.root.to_s + '/' + SETUP_ENV_SCRIPT, 'w') do |f|\n\n f.puts '#!/bin/sh '\n f.puts '# There are 4 things handled by this script '\n f.puts ' '\n f.puts '# 1. Create links to mimic staging env and update scripts with jvm options '\n f.puts '# The Java Buildpack for WLS creates complete domain structure and other linkages during staging at '\n f.puts '# /tmp/staged/app location '\n f.puts '# But the actual DEA execution occurs at /home/vcap/app. '\n f.puts '# This discrepancy can result in broken paths and non-startup of the server. '\n f.puts '# So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution '\n f.puts '# Create paths that match the staging env, as otherwise scripts will break!! '\n f.puts ' '\n f.puts 'if [ ! -d \\\"/tmp/staged\\\" ]; then '\n f.puts ' /bin/mkdir /tmp/staged '\n f.puts 'fi; '\n f.puts 'if [ ! -d \\\"/tmp/staged/app\\\" ]; then '\n f.puts ' /bin/ln -s `pwd` /tmp/staged/app '\n f.puts 'fi; '\n f.puts ' '\n f.puts ' '\n end\n end",
"def install_dest\n ENV[\"DOTFILES_HOME\"] || ENV[\"HOME\"]\n end",
"def deploy_application\n deploy(selfdir + \"app\")\n end",
"def web_copy_boot_prop_file\r\n Puppet.alert(\" begin : web_copy_boot_prop_file.bsh \")\r\n lcl_bash_fle_location = get_value4key(\"bash_file_location\", resource[:web_scripts_location] )\r\n lcl_ps_location_arr = resource[:web_location_attrib]\r\n env_action_cmd = lcl_bash_fle_location + \"/web_copy_boot_prop_file.bsh \"\r\n\r\n\r\n ##Even if SOURCE_HOST and TARGET_HOST are same then copy boot properties\r\n ##PS_CONFIG_HOME\r\n env_action_cmd += \" '\" + get_value4key(\"ps_config_home\", resource[:web_location_attrib])+ \"' \"\r\n\r\n ##SOURCE_HOST\r\n env_action_cmd += \" '\" + get_value4key(\"webadminserverhost\", resource[:webadmin_server_attrib])+ \"' \"\r\n\r\n ##SOURCE_DOMAIN\r\n ##env_action_cmd += \" '\" + (get_value4key(\"websitename\", resource[:webadmin_server_attrib])).upcase + \"1_1' \"\r\n env_action_cmd += \" '\" + get_value4key(\"webadmindomainname\", resource[:webadmin_server_attrib]) + \"' \"\r\n ##TARGET_DOMAIN\r\n env_action_cmd += \" '\" + get_value4key(\"webdomainname\", resource[:webdomain_attrib])+ \"' \"\r\n ##DOMAIN_ADMIN_USER\r\n env_action_cmd += \" '\" + get_value4key(\"webadminloginid\", resource[:webadmin_server_attrib]) + \"' \"\r\n ##DOMAIN_ADMIN_PWD\r\n env_action_cmd += \" '\" + get_decrypt_str( get_value4key2(\"webadminloginpwd\", resource[:web_pwd_attrib])) + \"' \"\r\n\r\n ##Puppet.debug(\" env_action_cmd: #{env_action_cmd}\")\r\n Puppet.alert(\" env_action_cmd: #{env_action_cmd}\")\r\n\r\n command_output = execute_command(env_action_cmd, true)\r\n Puppet.alert(\" dapps_start_stop_PIA_domain : #{command_output}\")\r\n if command_output.include? \"COPY\"\r\n return true\r\n else\r\n return false\r\n end\r\n return true \r\n end",
"def default_app_variables_path\n Hanami.root.join(\"apps\", Concierge.app.to_s, \"config\", \"environment_variables.yml\").to_s\n end",
"def sas_python_virtualenv_path\n (fetch(:sas_python_shared_virtualenv) ? shared_path : release_path).join(fetch(:sas_python_virtualenv_name))\n end",
"def go_artifact_uri\n server = ENV['ADMIN_SERVER']\n pipeline_counter = ENV['GO_PIPELINE_LABEL']\n stage_counter = ENV['GO_STAGE_COUNTER']\n \"http://#{server}:8153/go/files/MainBuild/#{pipeline_counter}/MainBuild/#{stage_counter}/MainBuild/dist/companyNews.war\"\n end",
"def deploy_to(arg = nil)\n set_or_return(\n :deploy_to,\n arg,\n kind_of: [ String ]\n )\n end",
"def default_concierge_variables_path\n Hanami.root.join(\"config\", \"environment_variables.yml\").to_s\n end",
"def get_site_pp_path(master_host, opts = {})\n opts[:env] ||= 'production'\n\n return File.join(get_manifests_path(master_host, opts), 'site.pp')\n end",
"def deploy\n what = ARGV.shift\n\n case what\n when 'packages'\n deploy_packages\n else\n ARGV.unshift what\n original_deploy\n end\n end",
"def default_deploy\n setup\n update_repo_tag\n push_repo\n maintenance_mode do\n run_migrations\n app_restart\n end\n warm_instance\n teardown\n end",
"def staging?\n self.environment == ENV_STAGE\n end",
"def cloud_service_deployment_environment=(value)\n @cloud_service_deployment_environment = value\n end",
"def deploy(sites, env, action=\"deploy\")\n\t\t# Detect if we need to go into maintenance mode\n\t\tmaintenance_flag = maintenance?()\n\n\t\tif maintenance_flag\n\t\t\tvalidate_execution(maintenance('on', @maintenance_list, env))\n\t\tend\n\n\t\t#Deploy...\n\t\tsites.each do |site| \n\t\t\tvalidate_execution(cap_deploy(site, env, maintenance_flag, action))\n\t end\n\n\t # Go out from maintenance if needed\n\t\tif maintenance_flag\n\t\t\tvalidate_execution(maintenance('off', @maintenance_list, env))\n\t\tend\n\n\tend",
"def prepare_for_deploy(services:, secrets:, local_environment:, why_run:)\n @local_env = local_environment\n end",
"def repo_dir\n @repo_dir ||= File.join(staging_dir, \"publish\", \"repo\")\n end",
"def deploy\n\n $active_deploy = true\n bucket = JSON.parse($deploy_bucket.last.to_json)\n unless bucket.nil?\n puts \"Deploying code for: #{bucket.inspect}\"\n system(\"./deploy.sh #{bucket['git_account']} #{bucket['launch_branch_name']} #{bucket['git_appname']} #{bucket['heroku_appname']} #{bucket['folder_name']}\")\n end\n $deploy_bucket.pop\n puts \"Now making active_deploy as false\"\n $active_deploy = false\n check_build bucket\nend",
"def environment\n \"production\"\n end",
"def current_path\n @current_path ||= @deploy_to + '/current'\n end",
"def root_path_location\n dmptool_url = 'https://dmptool.org/' if Rails.env.production?\n dmptool_url = 'https://dmptool-dev.cdlib.org/' if dashboard_url.include?('-dev.cdlib.org')\n dmptool_url = 'https://dmptool-stg.cdlib.org/' unless dmptool_url.present?\n dmptool_url\n end",
"def deploySource\n verifyOS\n timeDate = Time.new\n vConfig(CONFIG['configWebsite'])\n read_json(CONFIG['configWebsite'])\n branchSource = @parse_json_config['deploy']['branch']['source']\n msgCommit = @parse_json_config['deploy']['github']['config']['commit']\n add_repo_git(\".\")\n add_remoteurl(\".\")\n pull_execute(branchSource, \".\")\n git_checkout(branchSource, \".\")\n system_commands(\"echo Deploy source files. Wait ...\")\n system_commands(\"git add .\")\n system_commands(\"git commit -m \\\"#{msgCommit} - #{timeDate.inspect}\\\"\")\n system_commands(\"git push origin -u #{branchSource}\")\n end",
"def regional_rolling_deploy(stack_id:, layer_id:, app_id:, revision: '')\n log(\"Starting opsworks deploy for app #{app_id}\\n\\n\")\n\n instances = @opsworks_client.describe_instances(layer_id: layer_id)[:instances]\n\n instances_by_group = instances.map {|v| v.to_h}.group_by { |d| d[:availability_zone] }\n\n instances_by_group.each do |region, instance_group|\n # Only deploy to online instances\n online_instance = instance_group.select{|k| k[:status] == 'online'}\n instances_ids = online_instance.map{|k| k[:instance_id]}\n instances_names = online_instance.map{|k| k[:hostname]}\n\n next if instances_names.empty?\n\n puts \"#{instances_names} in #{region}\"\n\n begin\n load_balancers = {}\n log(\"=== Starting deploy for #{instances_names} ===\")\n\n online_instance.each do |instance|\n instance = Aws::OpsWorks::Types::Instance.new(instance)\n load_balancers[instance.instance_id] = detach_from_elbs(instance: instance)\n end\n\n wait_for_detach(@lb_wait_params)\n\n deploy(\n stack_id: stack_id,\n app_id: app_id,\n instance_id: instances_ids,\n revision: revision\n )\n ensure\n online_instance.each do |instance|\n instance = Aws::OpsWorks::Types::Instance.new(instance)\n attach_to_elbs(instance: instance, load_balancers: load_balancers[instance.instance_id]) if load_balancers[instance.instance_id]\n end\n\n wait_for_re_attach(@lb_wait_params)\n\n log(\"=== Done deploying on #{instances_names} ===\\n\\n\")\n end\n end\n\n log(\"SUCCESS: completed opsworks deploy for all instances on app #{app_id}\")\n end",
"def set_project_and_stage_names(config)\n config.set(:webistrano_project, deployment.stage.project.webistrano_project_name)\n config.set(:webistrano_stage, deployment.stage.webistrano_stage_name)\n end",
"def deploy\n update_repositories\n sync_service_environment_files\n # deploy_services\n response\n end",
"def app_dir\n \"#{node[:splunk][:home]}/etc/apps/#{new_resource.app}\"\nend",
"def railsenv\n config['environment_variables']['RAILS_ENV'] || 'production'\nend",
"def cloud_service_deployment_environment\n return @cloud_service_deployment_environment\n end",
"def main_site_host\n case Rails.env\n when 'development'\n # '192.168.1.140' # to test in ie\n # 'ngoaidmap.dev'\n 'iom.dev'\n when 'test'\n 'example.com'\n when 'staging'\n Settings.main_site_host\n when 'production'\n Settings.main_site_host\n end\n end",
"def go_back_env_url_prefix\n params[GlobalConstant::Environment.go_back_env_url_prefix_param] == GlobalConstant::Environment.main_sub_env_url_prefix ?\n GlobalConstant::Environment.main_sub_env_url_prefix : GlobalConstant::Environment.sandbox_sub_url_prefix\n end",
"def deploy(_)\n OneProvisionLogger.info('(Deploy skipped)')\n\n [@hosts.map do |h|\n h.to_hash['HOST']['TEMPLATE']['PROVISION']['HOSTNAME']\n end,\n nil,\n nil]\n end",
"def generate_deploy_files\n template_name = (self.name == 'vagrant') ? 'vagrant' : \"environment\"\n # Generate capistrano specific steps recipes\n Bebox::PROVISION_STEPS.each do |step|\n generate_file_from_template(\"#{Bebox::FilesHelper.templates_path}/project/config/deploy/steps/#{step}.erb\", \"#{self.project_root}/config/environments/#{name}/steps/#{step}.rb\", {})\n end\n # Generate capistrano recipe for environment\n generate_file_from_template(\"#{Bebox::FilesHelper.templates_path}/project/config/deploy/#{template_name}.erb\", \"#{self.project_root}/config/environments/#{name}/deploy.rb\", {nodes: nil, environment: self.name})\n end",
"def configure var={}\n \t{path: './', version: '0.1.0', mode: 'production'}.merge(var)\n end",
"def deploy\n params = {\n :migrate => migrate,\n :ref => ref,\n }\n params[:serverside_version] = serverside_version if serverside_version\n params[:migrate_command] = migrate_command if migrate\n update_with_response api.post(collection_uri + \"/deploy\", 'deployment' => params)\n end",
"def deploy_organization\n name, app_url = configure_heroku\n log_url = \"https://dashboard.heroku.com/apps/#{name}/logs\"\n success_box(\"Your app #{name} is now deployed at #{app_url}! If you encounter any issues, check the logs at #{log_url}.\")\n dns_target = get_heroku_dns_target(name, app_url)\n unless dns_target.nil?\n box(\"NOTE: Since you configured a custom host URL (#{app_url}), you must set your URL's DNS settings to point to #{dns_target} before using the app if you haven't already. You can find more info #{TTY::Link.link_to(\"here.\", \"http://url.perlmutterapp.com/custom-url\")}\")\n end\nend",
"def deploy\n\t# This task is typiclly run after the site is updated but before the server is restarted.\n\tcall 'migrate'\nend",
"def get_ordercup_path\n if Rails.env.production?\n @ordercup_path = \"https://ship.ordercup.com/connect-to-ordercup\"\n elsif Rails.env.staging?\n @ordercup_path = \"https://ship.ordercup4.com/connect-to-ordercup\"\n else\n @ordercup_path = \"http://localhost:3000/connect-to-ordercup\"\n end \n end",
"def project_root\n if server_environment\n server_environment['project-root'] || ''\n end\n end",
"def copy_site\n target_dir = File.join(@deploy_dir, @remote_path).sub(/\\/$/,'')\n FileUtils.cp_r @local + '/.', target_dir\n message = \"Site updated at: #{Time.now.utc}\"\n `git add --all .`\n `git commit -m \\\"#{message}\\\"`\n end",
"def application_url\n tenant = use_shared_configservers ? @tenant_name : \"default\"\n application = use_shared_configservers ? @application_name : \"default\"\n \"https://#{vespa.nodeproxies.first[1].addr_configserver[0]}:#{19071}/application/v2/tenant/#{tenant}/application/#{application}/environment/prod/region/default/instance/default/\"\n end",
"def project_name\n # using Dir.pwd will return something like: \n # /var/www/apps/staging.sweetspot.dm/releases/20061006155448\n # instead of\n # /var/www/apps/staging.sweetspot.dm/current\n pwd = ENV['PWD'] || Dir.pwd\n #another hack..ugh. If using standard capistrano setup, pwd will be the 'current' symlink.\n pwd = File.dirname(pwd) if File.symlink?(pwd)\n File.basename(pwd)\n end",
"def desired_hostname\n if path.start_with?('/foo/en')\n Rails.env.staging? ? 'foo-staging.infopark.com' : 'www.foo.com'\n else\n # Default hostname\n Rails.env.staging? ? 'website-staging.infopark.com' : 'www.website.com'\n end\n end",
"def ci_base_url\n # Assume we're in dev if we don't have this url\n return ENV[\"FASTLANE_CI_BASE_URL\"] || \"http://localhost:8080\"\n end",
"def deploy(deploy_params, servers)\n params = deploy_params.join(\" \")\n cmd = nil\n if ENV['TPKG_HOME']\n # Preserve TPKG_HOME when deploying to remote systems so that users can\n # perform operations against different tpkg base directories.\n cmd = \"tpkg #{params} --base #{ENV['TPKG_HOME']} -n\"\n else\n cmd = \"tpkg #{params} -n\"\n end\n user = @user\n\n if @user.nil? && !@use_ssh_key\n @user = prompt_username\n end\n\n if @password.nil? && !@use_ssh_key\n @password = prompt_password\n end\n\n tp = ThreadPool.new(@max_worker)\n statuses = {}\n deploy_to = []\n if servers.kind_of?(Proc)\n deploy_to = servers.call\n elsif servers.size == 1 && File.exists?(servers[0])\n puts \"Reading server list from file #{servers[0]}\"\n File.open(servers[0], 'r') do |f|\n while line = f.gets\n deploy_to << line.chomp.split(\",\")\n end\n end\n deploy_to.flatten!\n else\n deploy_to = servers\n end\n\n deploy_to.each do | server |\n tp.process do\n status = ssh_execute(server, @user, @password, @ssh_key, cmd).call\n statuses[server] = status\n end\n end\n tp.shutdown\n puts \"Exit statuses: \"\n puts statuses.inspect\n\n return statuses\n end",
"def currently_deployed_param\n if defined?(@currently_deployed_param)\n @currently_deployed_param\n else\n @currently_deployed_param = params(default: {})[:currentlyDeployed]\n end\n end",
"def deploy_app(app, deploy_params = {})\n deploy_generated(app.services_xml, app.sd_files,\n deploy_params.merge(app.deploy_params), app.hosts_xml, nil, app.validation_overrides_xml)\n end",
"def deploy\n system %Q[ssh -lroot \"#{server}\" <<'EOF'\n \tcat >\"#{remote_script_name}\" <<'EOS'\n#{generate}EOS\nchmod +x \"#{remote_script_name}\"\nsource \"#{remote_script_name}\"\nEOF\n ]\n end",
"def caproot\n File.dirname(capfile)\n end",
"def assign_local_app_attr name, options={}\n @name = name\n @deploy_name = options[:deploy_name] || Time.now.to_i\n\n default_root = File.join(Sunshine.web_directory, @name)\n @root_path = options[:root_path] || default_root\n\n @current_path = \"#{@root_path}/current\"\n @deploys_path = \"#{@root_path}/deploys\"\n @shared_path = \"#{@root_path}/shared\"\n @log_path = \"#{@shared_path}/log\"\n @checkout_path = \"#{@deploys_path}/#{@deploy_name}\"\n @scripts_path = \"#{@current_path}/script\"\n end",
"def deployDeploy (deploy)\n \n puts \"Chargement des variables\"\n settings = load_settings deploy\n \n puts \"Mise à jour de Parse\"\n objectId = updateParse settings\n deploy[\"parse\"][\"objectId\"] = objectId\n \nend",
"def shared_path\n @shared_path ||= @deploy_to + '/shared'\n end",
"def deploy_id\n self['DEPLOY_ID']\n end",
"def deploy_password\n set :password, deploy_script_password rescue nil\nend",
"def config_service_location(project, deploy_group, display:)\n prefix = \"samson/#{project.permalink}\"\n\n if display\n return unless bucket = ENV[\"CONFIG_SERVICE_BUCKET\"]\n \"s3://#{bucket}/#{prefix}\"\n else\n bucket = ENV.fetch \"CONFIG_SERVICE_BUCKET\"\n [bucket, \"#{prefix}/#{deploy_group.permalink}.yml\"]\n end\n end",
"def create\n deploy\n end",
"def baseURL\n Rails.env.development? ? GeventAnalysis::Application::CONSTS[:dev_host] : GeventAnalysis::Application::CONSTS[:app_host]\n end",
"def default_branch\n config.deploy_branch\n end",
"def destination_path\n if @site.respond_to?(:in_dest_dir)\n @site.in_dest_dir(\"app.yaml\")\n else\n Jekyll.sanitized_path(@site.dest, \"app.yaml\")\n end\n end",
"def capistrano_application\n @@capistrano_application ||= load_capistrano_application\n end",
"def run(params={})\n config_name = params.has_key?(:config_name) ? params[:config_name].to_sym : :default\n\n # Validate config\n error 'No deploy configuration found' if @site.config[:deploy].nil?\n error \"No deploy configuration found for #{config_name}\" if @site.config[:deploy][config_name].nil?\n \n src_branch = @site.config[:deploy][config_name][:src_branch]\n dst_branch = @site.config[:deploy][config_name][:dst_branch]\n dst_remote = @site.config[:deploy][config_name][:dst_remote]\n \n error 'No source branch found in deployment configuration' if src_branch.nil?\n error 'No destination branch found in deployment configuration' if dst_branch.nil?\n error 'No destination remote found in deployment configuration' if dst_remote.nil?\n \n git = ::Git::Base.open('.')\n \n # Compile the site from scratch\n Nanoc::Tasks::Clean.new(@site).run\n \n # Check out the source branch\n puts \"Checking out #{src_branch}.\"\n git.checkout(src_branch)\n \n # Compile the site from scratch\n puts \"Compiling site.\"\n @site.compiler.run\n \n # Check out the destination branch\n puts \"Checking out destination branch.\"\n git.checkout(dst_branch)\n \n # Copy output files recursively into the current directory\n puts \"Copying files.\"\n FileUtils.cp_r(@site.config[:output_dir].chomp('/') + '/.', '.')\n \n # Automatically add and commit changes\n puts \"Committing changes.\"\n git.add\n git.commit(\"updated #{Time.now.to_s}\", :add_all => true)\n \n # Push changes to the destination repo/branch\n puts \"Pushing to #{dst_remote} #{dst_branch}.\"\n git.push(dst_remote, dst_branch)\n \n # Switch back to the source branch\n puts \"Checking out #{src_branch}.\"\n git.checkout(src_branch)\n end",
"def remote_deploy(options={})\n @cartridge_model.do_control('update-configuration',\n @cartridge_model.primary_cartridge,\n pre_action_hooks_enabled: false,\n post_action_hooks_enabled: false,\n out: options[:out],\n err: options[:err])\n\n deploy(options)\n\n if options[:init]\n primary_cart_env_dir = PathUtils.join(@container_dir, @cartridge_model.primary_cartridge.directory, 'env')\n primary_cart_env = ::OpenShift::Runtime::Utils::Environ.load(primary_cart_env_dir)\n ident = primary_cart_env.keys.grep(/^OPENSHIFT_.*_IDENT/)\n _, _, version, _ = Runtime::Manifest.parse_ident(primary_cart_env[ident.first])\n\n @cartridge_model.post_install(@cartridge_model.primary_cartridge,\n version,\n out: options[:out],\n err: options[:err])\n\n end\n end",
"def target_microbosh_config_path\n deployed_microboshes[\"deployment\"][target_bosh_host]\n end"
] |
[
"0.736962",
"0.6881185",
"0.64545506",
"0.63965285",
"0.6289924",
"0.62297416",
"0.6101152",
"0.60693705",
"0.6054623",
"0.60220146",
"0.60220146",
"0.6010095",
"0.5999325",
"0.5978251",
"0.59468144",
"0.58942914",
"0.5858668",
"0.5810374",
"0.5801588",
"0.57986265",
"0.5781551",
"0.5781551",
"0.57796836",
"0.5773818",
"0.57495034",
"0.57465404",
"0.5744641",
"0.5725262",
"0.57129914",
"0.5704208",
"0.5702491",
"0.56977767",
"0.5687556",
"0.56761545",
"0.5640199",
"0.5640199",
"0.5639735",
"0.5632131",
"0.56125504",
"0.55766195",
"0.55749196",
"0.5561296",
"0.55568266",
"0.5547853",
"0.55434215",
"0.55263674",
"0.5488118",
"0.5480896",
"0.5461186",
"0.5445214",
"0.5442122",
"0.5439217",
"0.5413039",
"0.5402482",
"0.539779",
"0.5394298",
"0.53885174",
"0.538632",
"0.536137",
"0.5347728",
"0.534241",
"0.5342181",
"0.53377837",
"0.53286064",
"0.5317496",
"0.53172225",
"0.5316375",
"0.53099823",
"0.53049624",
"0.5304191",
"0.5300923",
"0.52990013",
"0.52989936",
"0.5295569",
"0.52799696",
"0.5278747",
"0.5267351",
"0.5263522",
"0.5250237",
"0.5250032",
"0.52473587",
"0.5240333",
"0.52388203",
"0.5229428",
"0.5226167",
"0.5224872",
"0.5220212",
"0.5215548",
"0.52105325",
"0.5209965",
"0.5209176",
"0.520838",
"0.5208268",
"0.52012426",
"0.51960653",
"0.5192997",
"0.5190818",
"0.5185729",
"0.5174981",
"0.5173999"
] |
0.80964094
|
0
|
GET /cooperatives GET /cooperatives.json
|
def index
@cooperatives = Cooperative.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @coasters = Coaster.all\n\n render json: @coasters\n end",
"def index\n @creatives = @org.creatives\n end",
"def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def index\n @citations = Citation.all\n\n render json: @citations\n end",
"def index\n @api_v1_initiatives = Api::V1::Initiative.all\n end",
"def index\n @creatives = @campaign.creatives\n end",
"def index\n @coats = Coat.all\n end",
"def index\n @congressos = Congresso.all\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def index\n @cousins = Cousin.all\n end",
"def index\n @ocats = Ocat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ocats }\n end\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def index\n @cages = current_user.cages\n\n respond_to do |format|\n format.json { render json: @cages }\n end\n end",
"def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end",
"def index\n @corges = Corge.all\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def index\n render json: @owner.cats\n end",
"def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end",
"def index\n @congties = Congty.all\n end",
"def index\n @care_plans = CarePlan.all\n render json: @care_plans\n end",
"def index\n @cat_polies = CatPoly.all\n end",
"def index\n @coments = Coment.all\n end",
"def index\n @coments = Coment.all\n end",
"def index\n @clients = current_user.clients\n render json: @clients\n end",
"def index\n @careers = Career.all\n json_response(@careers)\n end",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def listCon\n @opportunities = Opportunity.where(\"status = ?\", \"Publish\")\n render json: @opportunities\n end",
"def index\n @communities = Community.all\n render json: {items: @communities}\n end",
"def index\n @objectives = @goal.objectives.all \n render json: @objectives \n end",
"def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end",
"def index\n @given_circumstances = GivenCircumstance.all\n render json: @given_circumstances\n end",
"def index\n @cannings = Canning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cannings }\n end\n end",
"def index\n @crates = Crate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crates }\n end\n end",
"def index\n confessions = Confession.all.order(\"created_at DESC\")\n\n render json: confessions\n end",
"def index\n @mycometer_cocs = MycometerCoc.all\n end",
"def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end",
"def get_current_occasions\n\n \tcurrent_occasions = Array.new\n recipients = current_user.recipients.live # only get the live recipients!\n\n recipients.each do |recipient|\n \tcurrent_occasions << recipient.recipient_occasions.live\n end\n\n respond_to do |format|\n format.json { render json: current_occasions }\n end\n end",
"def council\n @councils = []\n \n if current_user.has_role? :admin\n councils = Council.all\n else\n councils = get_following_councils\n end\n\n councils.each do |council|\n observation = council.comments.find_by(user_id: current_user)\n observation = observation ? observation.body : ''\n\n @councils << {\n title: council.title,\n number: council.number,\n commission: council.commission,\n status: council.status,\n topic: council.topic,\n aval: council.aval ? 'SÍ' : 'NO',\n warning: council.warning ? 'SÍ' : 'NO',\n created_at: council.created_at.strftime('%d %b %Y'),\n filing_at: council.filing_at ? council.filing_at.strftime('%d %b %Y') : '',\n monitoring_at: council.monitoring_at ? council.monitoring_at.strftime('%d %b %Y') : '',\n commission_at: council.commission_at ? council.commission_at.strftime('%d %b %Y') : '',\n plenary_at: council.plenary_at ? council.plenary_at.strftime('%d %b %Y') : '',\n authors: council.councillors.authors.map { |author| author.name }.join(', '),\n speakers: council.councillors.speakers.map { |speaker| speaker.name }.join(', '),\n city: 'Bogotá',\n observation: observation\n }\n end\n end",
"def index\n @applicants = Applicant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applicants }\n end\n end",
"def index\n @coatings = do_index(Coating, params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @coatings }\n end\n end",
"def index\n @coocos = Cooco.all\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end",
"def index\n @representatives = Representative.all\n end",
"def index\n @copons = Copon.all\n end",
"def index\n @coin_icos = CoinIco.where(is_approved: true).order(\"created_at desc\")\n end",
"def show\n @circulation = Circulation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @circulation }\n end\n end",
"def index\n lat = request.headers['lat'].to_f\n long = request.headers['long'].to_f\n\n @user = User.find(current_user)\n @concerts = @user.artists.map do |a|\n a.concerts.select{|c| Date.parse(c.date) > Date.today && Date.parse(c.date) < (Date.today + 7)}\n end\n @concerts = @concerts.flatten.sort do |concert1, concert2|\n order = Date.parse(concert1.date) <=> Date.parse(concert2.date)\n if order != 0\n order\n else\n concert1.distance(lat, long) <=> concert2.distance(lat, long)\n end\n end\n render json: {concerts: @concerts}\n end",
"def index\n @cover_cats = CoverCat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cover_cats }\n end\n end",
"def index\n @representatives = Representative.page(params[:page])\n end",
"def index\n @citizenship_classes = @grantee.citizenship_classes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @citizenship_classes }\n end\n end",
"def index\n sanitized_params = parse_params(client_where_params)\n clients = Client.find_all(sanitized_params)\n render json: clients\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def index\n @cogs = Cog.all\n end",
"def index\n #@portfolio = Portfolio.find(params[:portfolio_id])\n\n @opinionable = find_opinionable\n\n @opinion = @opinionable.opinions.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @opinions }\n end\n end",
"def index\n @coyotes = Coyote.all\n end",
"def index\n @company_authorities = CompanyAuthority.all\n\n render json: @company_authorities\n end",
"def index\n colorizers = Colorizer.all\n\n render json: colorizers\n end",
"def index\n @oceans = Ocean.all\n end",
"def index\n @connaissances = Connaissance.all\n end",
"def index\n @pend_crates = Overview.get_pending_crates \n @paid_crates = Overview.get_last_paid_crates \n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render :json => @crates }\n end\n end",
"def index\n getProfile\n @consents = TherapistConsent.where('therapist_id = ? ', @therapist.id)\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render :status => 200, :json => { action: 'index', consents: @consents }}\n end\n end",
"def index\n @contracts = Contract\n .where(customer_id: @customer.id)\n .order(:created_at)\n .page params[:page]\n\n respond_to do |format|\n format.html {}\n format.js { render json: @contracts.to_json }\n format.json { render json: @contracts.to_json }\n end\n\n end",
"def index\n @coches = Coche.all\n end",
"def index\n @affiliates = Affiliate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @affiliate }\n end\n end",
"def show\n @ocat = Ocat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ocat }\n end\n end",
"def set_cooperative\n @cooperative = Cooperative.find(params[:id])\n end",
"def index\n @capacites = Capacite.paginate(page: params[:page], per_page: 25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @capacites }\n end\n end",
"def show\n @colaboration = Colaboration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colaboration }\n end\n end",
"def index\n @address_cocoons = AddressCocoon.all\n end",
"def index\n @consorciots = Consorciot.all\n end",
"def index\n @cicts = Cict.all\n end",
"def index\n #@csosns = Csosn.all\n @csosns = Csosn.paginate(:page => params[:page], :per_page => 10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @csosns }\n end\n end",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def index\n @ocupations = Ocupation.all\n end",
"def index\n @circuses = Circus.all\n end",
"def index\n render json: @chapter.reposoitories, status: :ok\n end",
"def index\n @citacaos = Citacao.all\n end",
"def index\n init_oco if !session[:organization]\n if session[:organization] != '0'\n @insurances = Insurance.where(organization_id: session[:organization]).paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n else\n @insurances = Insurance.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @insurances }\n end\n end",
"def index\n @coupones = Coupone.all\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 index\n @opportunities = Opportunity.all\n\n render json: @opportunities\n end",
"def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end",
"def index\n @colaborators = Colaborator.all\n end",
"def show\n\n respond_to do |format|\n format.json { render json: @cage }\n end\n end",
"def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end",
"def index\n @communities = Community.all\n\n render json: @communities.to_json(include: {posts: {include: :replies} })\n end",
"def show\n @comming_soon = CommingSoon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comming_soon }\n end\n end",
"def index\n @charges = Charge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @charges }\n end\n end",
"def index\n @crate_priorities = CratePriority.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_priorities }\n end\n end",
"def index\n @concerts = Concert.all\n end",
"def index\n @concerts = Concert.all\n end",
"def index\n @concerts = Concert.all\n end",
"def index\n @concerts = Concert.all\n end",
"def index\n @proposals = Proposal.all\n\n render json: @proposals\n end",
"def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end",
"def index\n @contenders = Contender.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contenders }\n end\n end",
"def index\n @clients = Client.all\n render json: @clients\n end"
] |
[
"0.6678411",
"0.6565149",
"0.6411777",
"0.63552314",
"0.63453263",
"0.6303329",
"0.6295732",
"0.6292242",
"0.6262387",
"0.6251463",
"0.62386984",
"0.62302285",
"0.6222405",
"0.6180417",
"0.61521375",
"0.6135253",
"0.61308223",
"0.61206263",
"0.6118713",
"0.61167467",
"0.6073532",
"0.60606253",
"0.60457337",
"0.6035014",
"0.6035014",
"0.60327315",
"0.5994989",
"0.59795034",
"0.59747285",
"0.59694195",
"0.5963044",
"0.59620667",
"0.5941346",
"0.5940527",
"0.59396744",
"0.591967",
"0.5905777",
"0.59021467",
"0.5892854",
"0.5874292",
"0.58689666",
"0.5862437",
"0.58545995",
"0.58516335",
"0.58493227",
"0.58460385",
"0.5843584",
"0.5843353",
"0.5840824",
"0.5837598",
"0.58282286",
"0.5827053",
"0.58270013",
"0.5826762",
"0.5816832",
"0.581598",
"0.5813779",
"0.57972157",
"0.5796082",
"0.5791939",
"0.57915705",
"0.5780607",
"0.57800406",
"0.5778823",
"0.57761276",
"0.5760315",
"0.5755881",
"0.5752672",
"0.57507056",
"0.5750417",
"0.57500184",
"0.57422537",
"0.57402587",
"0.5740016",
"0.573328",
"0.5724926",
"0.5721168",
"0.57164586",
"0.5712425",
"0.57108235",
"0.5710034",
"0.57094675",
"0.5706868",
"0.5699865",
"0.5697068",
"0.5697017",
"0.5696742",
"0.5696556",
"0.5695121",
"0.56928396",
"0.5689264",
"0.5684985",
"0.5676488",
"0.5676488",
"0.5676488",
"0.5676488",
"0.5673916",
"0.56727344",
"0.56724405",
"0.56722814"
] |
0.7567936
|
0
|
GET /cooperatives/1 GET /cooperatives/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @cooperatives = Cooperative.all\n end",
"def index\n @coasters = Coaster.all\n\n render json: @coasters\n end",
"def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def index\n @creatives = @org.creatives\n end",
"def index\n @citations = Citation.all\n\n render json: @citations\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def show\n @colaboration = Colaboration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colaboration }\n end\n end",
"def show\n @circulation = Circulation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @circulation }\n end\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def index\n @api_v1_initiatives = Api::V1::Initiative.all\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 index\n @creatives = @campaign.creatives\n end",
"def index\n @coats = Coat.all\n end",
"def index\n @cousins = Cousin.all\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def index\n render json: @owner.cats\n end",
"def index\n @ocats = Ocat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ocats }\n end\n end",
"def index\n @congressos = Congresso.all\n end",
"def index\n @care_plans = CarePlan.all\n render json: @care_plans\n end",
"def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end",
"def show\n @ocat = Ocat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ocat }\n end\n end",
"def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end",
"def index\n @crates = Crate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crates }\n end\n end",
"def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end",
"def first\n @comic = Comic.order(\"created_at ASC\").first\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @comic }\n end\n end",
"def first\n @comic = Comic.order(\"created_at ASC\").first\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @comic }\n end\n end",
"def index\n @corges = Corge.all\n end",
"def index\n @clients = current_user.clients\n render json: @clients\n end",
"def index\n @cannings = Canning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cannings }\n end\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cocktail }\n end\n end",
"def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def index\n @careers = Career.all\n json_response(@careers)\n end",
"def index\n @cages = current_user.cages\n\n respond_to do |format|\n format.json { render json: @cages }\n end\n end",
"def index\n @congties = Congty.all\n end",
"def show\n @cerc = Cerc.find(params[:id])\n\n render json: @cerc\n end",
"def show\n\n respond_to do |format|\n format.json { render json: @cage }\n end\n end",
"def show\n @comming_soon = CommingSoon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comming_soon }\n end\n end",
"def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cocktail }\n end\n end",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def set_cooperative\n @cooperative = Cooperative.find(params[:id])\n end",
"def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end",
"def index\n @given_circumstances = GivenCircumstance.all\n render json: @given_circumstances\n end",
"def index\n confessions = Confession.all.order(\"created_at DESC\")\n\n render json: confessions\n end",
"def index\n @applicants = Applicant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applicants }\n end\n end",
"def index\n @objectives = @goal.objectives.all \n render json: @objectives \n end",
"def index\n @coments = Coment.all\n end",
"def index\n @coments = Coment.all\n end",
"def show\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cso }\n end\n end",
"def index\n render json: Client.all\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def index\n @coupones = Coupone.all\n end",
"def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end",
"def show\n @corgi = Corgi.find(params[:id])\n respond_to do |format|\n format.html \n format.json { render json: @corgi }\n end \n end",
"def index\n @communities = Community.all\n render json: {items: @communities}\n end",
"def show\n @climate = Climate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climate }\n end\n end",
"def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end",
"def index\n @copons = Copon.all\n end",
"def index\n @bill_cargos = @bill.bill_cargos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bill_cargos }\n end\n end",
"def show\n @cofi = Cofi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cofi }\n end\n end",
"def show\n @complaint = Complaint.find(params[:id])\n\n render json: @complaint\n end",
"def listCon\n @opportunities = Opportunity.where(\"status = ?\", \"Publish\")\n render json: @opportunities\n end",
"def index\n @pend_crates = Overview.get_pending_crates \n @paid_crates = Overview.get_last_paid_crates \n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render :json => @crates }\n end\n end",
"def index\n @affiliates = Affiliate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @affiliate }\n end\n end",
"def index\n @company_authorities = CompanyAuthority.all\n\n render json: @company_authorities\n end",
"def index\n @cover_cats = CoverCat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cover_cats }\n end\n end",
"def index\n sanitized_params = parse_params(client_where_params)\n clients = Client.find_all(sanitized_params)\n render json: clients\n end",
"def index\n @coocos = Cooco.all\n end",
"def index\n #@csosns = Csosn.all\n @csosns = Csosn.paginate(:page => params[:page], :per_page => 10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @csosns }\n end\n end",
"def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end",
"def show\n @compromise = Compromise.find(params[:id])\n\n render json: @compromise\n end",
"def index\n @contracts = Contract\n .where(customer_id: @customer.id)\n .order(:created_at)\n .page params[:page]\n\n respond_to do |format|\n format.html {}\n format.js { render json: @contracts.to_json }\n format.json { render json: @contracts.to_json }\n end\n\n end",
"def index\n @charges = Charge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @charges }\n end\n end",
"def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @cat_polies = CatPoly.all\n end",
"def index\n @cfos = Cfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cfos }\n end\n end",
"def index\n @coatings = do_index(Coating, params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @coatings }\n end\n end",
"def index\n @circuses = Circus.all\n end",
"def index\n @clients = Client.all\n render json: @clients\n end",
"def show\n @comic_page = ComicPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic_page }\n end\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end",
"def index\n @mycometer_cocs = MycometerCoc.all\n end",
"def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end",
"def show\n @crate = Crate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crate }\n end\n end",
"def index\n @cogs = Cog.all\n end",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def show\n if params[:id]\n @cooperativa = Cooperativa.find(params[:id])\n else\n @cooperativa = Cooperativa.find(params[:cooperativa_id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cooperativa }\n end\n end",
"def show\n @golf_cource = GolfCource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @golf_cource }\n end\n end",
"def index\n @address_cocoons = AddressCocoon.all\n end",
"def show\n @condolence = Condolence.find(params[:id])\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condolence }\n end\n end",
"def latest\n @comic = Comic.order(\"created_at ASC\").last\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @comic }\n end\n end",
"def latest\n @comic = Comic.order(\"created_at ASC\").last\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @comic }\n end\n end",
"def show\n @conductor = Conductor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conductor }\n end\n end",
"def show\n @conductor = Conductor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conductor }\n end\n end",
"def index\n @crate_priorities = CratePriority.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_priorities }\n end\n end",
"def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end"
] |
[
"0.7288006",
"0.68301636",
"0.6526426",
"0.643757",
"0.6427576",
"0.6426255",
"0.629142",
"0.62764746",
"0.6247336",
"0.6244709",
"0.6234328",
"0.6234245",
"0.61898535",
"0.61868864",
"0.61759335",
"0.61556685",
"0.6153337",
"0.6150835",
"0.6149681",
"0.6143451",
"0.61296695",
"0.6117214",
"0.6106977",
"0.60944617",
"0.6085035",
"0.60832167",
"0.6057352",
"0.6057352",
"0.60534096",
"0.60493416",
"0.60361534",
"0.6033872",
"0.6019421",
"0.60126823",
"0.59977674",
"0.59977674",
"0.599155",
"0.59877604",
"0.59833866",
"0.5980204",
"0.5975335",
"0.59716254",
"0.5965906",
"0.59651613",
"0.59394974",
"0.5924659",
"0.5919533",
"0.5913294",
"0.5904051",
"0.5885197",
"0.5874776",
"0.5874776",
"0.5867284",
"0.5860305",
"0.5859669",
"0.58593565",
"0.5856471",
"0.5856314",
"0.58562833",
"0.58547187",
"0.5853073",
"0.5844514",
"0.58414435",
"0.5833672",
"0.583306",
"0.5828637",
"0.58248067",
"0.5824339",
"0.58226854",
"0.5822503",
"0.5822421",
"0.5814936",
"0.5810152",
"0.5809901",
"0.58078754",
"0.5807605",
"0.5803888",
"0.57983",
"0.57944906",
"0.5790753",
"0.5786137",
"0.57822007",
"0.57788944",
"0.5771632",
"0.5763029",
"0.57555133",
"0.5754655",
"0.57534117",
"0.57515204",
"0.57507104",
"0.5747381",
"0.5745823",
"0.5745297",
"0.5744236",
"0.574348",
"0.5741729",
"0.5741729",
"0.5737181",
"0.5737181",
"0.57367635",
"0.5735191"
] |
0.0
|
-1
|
POST /cooperatives POST /cooperatives.json
|
def create
@cooperative = Cooperative.new(cooperative_params)
respond_to do |format|
if @cooperative.save
format.html { redirect_to @cooperative, notice: 'Cooperative was successfully created.' }
format.json { render :show, status: :created, location: @cooperative }
else
format.html { render :new }
format.json { render json: @cooperative.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @congresso = Congresso.new(congresso_params)\n\n respond_to do |format|\n if @congresso.save\n format.html { redirect_to @congresso, notice: 'Congresso was successfully created.' }\n format.json { render :show, status: :created, location: @congresso }\n else\n format.html { render :new }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @cooperatives = Cooperative.all\n end",
"def create\n @cooco = Cooco.new(cooco_params)\n\n respond_to do |format|\n if @cooco.save\n format.html { redirect_to @cooco, notice: 'Cooco was successfully created.' }\n format.json { render :show, status: :created, location: @cooco }\n else\n format.html { render :new }\n format.json { render json: @cooco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @circulation = Circulation.new(params[:circulation])\n\n respond_to do |format|\n if @circulation.save\n format.html { redirect_to @circulation, notice: 'Circulation was successfully created.' }\n format.json { render json: @circulation, status: :created, location: @circulation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @circulation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @congress = Congress.new(congress_params)\n @congress.responsible_id = current_user.id\n respond_to do |format|\n if @congress.save\n format.html { redirect_to @congress, notice: 'Congress was successfully created.' }\n format.json { render :show, status: :created, location: @congress }\n else\n format.html { render :new }\n format.json { render json: @congress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @coat = Coat.new(coat_params)\n\n respond_to do |format|\n if @coat.save\n format.html { redirect_to @coat, notice: 'Coat was successfully created.' }\n format.json { render :show, status: :created, location: @coat }\n else\n format.html { render :new }\n format.json { render json: @coat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n cartoon_ad = CartoonAd.create(cartoon_ad_params)\n render json: cartoon_ad\n end",
"def create\n @coment = Coment.new(coment_params)\n\n respond_to do |format|\n if @coment.save\n format.html { redirect_to @coment, notice: \"Coment was successfully created.\" }\n format.json { render :show, status: :created, location: @coment }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @coment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cooperative_params\n params.require(:cooperative).permit(:nombre)\n end",
"def create\n @ocat = Ocat.new(params[:ocat])\n\n respond_to do |format|\n if @ocat.save\n format.html { redirect_to @ocat, notice: 'Ocat was successfully created.' }\n format.json { render json: @ocat, status: :created, location: @ocat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ocat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @colegiatura = Colegiatura.new(params[:colegiatura])\n\n respond_to do |format|\n if @colegiatura.save\n format.html { redirect_to @colegiatura, notice: 'Colegiatura was successfully created.' }\n format.json { render json: @colegiatura, status: :created, location: @colegiatura }\n else\n format.html { render action: \"new\" }\n format.json { render json: @colegiatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @creative = @org.creatives.build(creative_params)\n\n respond_to do |format|\n if @creative.save\n format.html { redirect_to [@creative.org, @creative], notice: 'Creative was successfully created.' }\n format.json { render :show, status: :created, location: [@creative.org, @creative] }\n else\n format.html { render :new }\n format.json { render json: @creative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @corge = Corge.new(corge_params)\n\n respond_to do |format|\n if @corge.save\n format.html { redirect_to @corge, notice: 'Corge was successfully created.' }\n format.json { render :show, status: :created, location: @corge }\n else\n format.html { render :new }\n format.json { render json: @corge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @address_cocoon = AddressCocoon.new(address_cocoon_params)\n\n respond_to do |format|\n if @address_cocoon.save\n format.html { redirect_to @address_cocoon, notice: 'Address cocoon was successfully created.' }\n format.json { render :show, status: :created, location: @address_cocoon }\n else\n format.html { render :new }\n format.json { render json: @address_cocoon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cocoon_example = CocoonExample.new(cocoon_example_params)\n\n respond_to do |format|\n if @cocoon_example.save\n format.html { redirect_to @cocoon_example, notice: 'Cocoon example was successfully created.' }\n format.json { render :show, status: :created, location: @cocoon_example }\n else\n format.html { render :new }\n format.json { render json: @cocoon_example.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def create\n @areco = Areco.new(params[:areco])\n\n respond_to do |format|\n if @areco.save\n format.html { redirect_to @areco, notice: 'Areco was successfully created.' }\n format.json { render json: @areco, status: :created, location: @areco }\n else\n format.html { render action: \"new\" }\n format.json { render json: @areco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n \n @cocktail = Cocktail.new(params[:cocktail])\n @cocktail.prise = 20000\n @cocktail.grade = 0\n @cocktail.oficial = false\n respond_to do |format|\n if @cocktail.save\n format.html { redirect_to @cocktail, :notice => 'Cocktail was successfully created.' }\n format.json { render :json => @cocktail, :status => :created, :location => @cocktail }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cocktail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @cargo = Cargo.new(cargo_params)\n if @cargo.save\n render json: @cargo\n else\n render json: @cargo.errors, status: :unprocessable_entity\n end\n end",
"def create\n @cage = current_user.cages.new(params[:cage])\n\n respond_to do |format|\n if @cage.save\n format.json { render json: @cage, status: :created, location: @cage }\n else\n format.json { render json: @cage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @society_recuritment = SocietyRecuritment.new(society_recuritment_params)\n\n respond_to do |format|\n if @society_recuritment.save\n format.html { redirect_to @society_recuritment, notice: 'Society recuritment was successfully created.' }\n format.json { render :show, status: :created, location: @society_recuritment }\n else\n format.html { render :new }\n format.json { render json: @society_recuritment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cat_poly = CatPoly.new(cat_poly_params)\n\n respond_to do |format|\n if @cat_poly.save\n format.html { redirect_to @cat_poly, notice: 'Cat poly was successfully created.' }\n format.json { render :show, status: :created, location: @cat_poly }\n else\n format.html { render :new }\n format.json { render json: @cat_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cerc = Cerc.new(params[:cerc])\n\n if @cerc.save\n render json: @cerc, status: :created, location: @cerc\n else\n render json: @cerc.errors, status: :unprocessable_entity\n end\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def create\n @colaborator = Colaborator.new(colaborator_params)\n\n respond_to do |format|\n if @colaborator.save\n format.html { redirect_to @colaborator, notice: 'Colaborator was successfully created.' }\n format.json { render :show, status: :created, location: @colaborator }\n else\n format.html { render :new }\n format.json { render json: @colaborator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cta = Cta.new(cta_params)\n\n respond_to do |format|\n if @cta.save\n format.html { redirect_to @cta, notice: 'cta was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cta }\n else\n format.html { render action: 'new' }\n format.json { render json: @cta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cuisine = Cuisine.new(spice_params)\n\n if @cuisine.save\n render json: @cuisine, status: :created\n else\n render json: @cuisine.errors, status: :unprocessable_entity\n end\n end",
"def create\n # authorize preorder_conversition\n member = Member.where(id: params[:preorder_conversition][:member_id]).first\n @preorder_conversition = @site.preorder_conversitions.new(permitted_attributes(PreorderConversition).merge(user_id: current_user.id, member_name: member.name, member_phone: member.mobile_phone))\n if @preorder_conversition.save\n render json: {status: 'ok', url: agent_preorder_conversitions_path}\n else\n render json: {status: 'error', message:@preorder_conversition.errors.full_messages.join(',')}\n end\n end",
"def create\n @care_plan = CarePlan.new(care_plan_params)\n\n if @care_plan.save\n render json: @care_plan, status: :created, location: @care_plan\n else\n render json: @care_plan.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @cooperative.destroy\n respond_to do |format|\n format.html { redirect_to cooperatives_url, notice: 'Cooperative was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @competency = Competency.new(competency_params)\n respond_to do |format|\n if @competency.save\n format.json { render :show, status: :created, location: @competency }\n else\n format.json { render json: @competency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @connaissance = Connaissance.new(connaissance_params)\n\n respond_to do |format|\n if @connaissance.save\n format.html { redirect_to @connaissance, notice: 'Connaissance was successfully created.' }\n format.json { render :show, status: :created, location: @connaissance }\n else\n format.html { render :new }\n format.json { render json: @connaissance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @concert = Concert.new(concert_params)\n\n respond_to do |format|\n if @concert.save\n @concert.create_activity :create, owner: current_user\n format.html { redirect_to @concert, notice: 'Concert was successfully created.' }\n format.json { render :show, status: :created, location: @concert }\n else\n format.html { render :new }\n format.json { render json: @concert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cobertura = Cobertura.new(cobertura_params)\n\n @apolice.page = \"proposta\"\n\n respond_to do |format|\n if @cobertura.save\n format.html { redirect_to @cobertura, notice: 'Cobertura was successfully created.' }\n format.json { render :show, status: :created, location: @cobertura }\n else\n format.html { render :new }\n format.json { render json: @cobertura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @colegio = Colegio.new(params[:colegio])\n\n respond_to do |format|\n if @colegio.save\n format.html { redirect_to @colegio, notice: 'El colegio fue creado satisfactoriamente.' }\n format.json { render json: @colegio, status: :created, location: @colegio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contestant = Contestant.new(contestant_params)\n\n \n if @contestant.save\n render json: @contestant\n else\n render json: @contestant.errors\n end\n \n end",
"def create\n @discipline = Discipline.new(discipline_params)\n @discipline.users_id = current_user.id\n\n respond_to do |format|\n if @discipline.save\n @discipline.codigo = \"DISC-%04d\" % [@discipline.id]\n @discipline.save\n if params[:anexos]\n\n params[:anexos].each { |anx|\n @discanexo = Discanexo.new\n @discanexo.anexo = anx\n @discanexo.Discipline_id = @discipline.id\n @discanexo.save\n }\n end\n flash[:success] = \"Disciplina cadastrada com sucesso.\"\n format.html { redirect_to @discipline}\n format.json { render :show, status: :created, location: @discipline }\n else\n format.html { render :new }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @greenhouse = Greenhouse.find(params[:greenhouse_id])\n @customer = Customer.new(customer_params)\n @customer.greenhouse_id = @greenhouse.id\n respond_to do |format|\n if @customer.save\n format.html { redirect_to greenhouse_customers_path(@greenhouse.id), notice: 'Customer was successfully created.' }\n #format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n #format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @citacao = Citacao.new(citacao_params)\n\n respond_to do |format|\n if @citacao.save\n format.html { redirect_to @citacao, notice: 'Citacao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @citacao }\n else\n format.html { render action: 'new' }\n format.json { render json: @citacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_cooperative\n @cooperative = Cooperative.find(params[:id])\n end",
"def create\n\n respond_to do |format|\n if @coating.save\n format.html { redirect_to(@coating, :notice => t(\"screens.notice.successfully_created\")) }\n format.xml { render :xml => @coating, :status => :created, :location => @coating }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @coating.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @complaint = Complaint.new(complaint_params)\n @complaint.customer_id = current_user.customer_id\n @complaint.region_id = current_user.customer.region_id\n\n if @complaint.save\n render json: @complaint, status: :created, location: api_v1_complaint_url(@complaint)\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end",
"def create\n @candy = PendingCandy.new(params[:candy])\n\n respond_to do |format|\n if @candy.save\n logger.info \"candy saved successfully\"\n\tlogger.info @candy.to_json\n format.html { redirect_to @candy, :notice => 'Candy was successfully created.' }\n format.json { render :json => { :status => 200, :candy => @candy } }\n else\n logger.info \"error saving candy\"\n logger.info @candy.errors.full_messages\n format.html { render :action => \"new\" }\n format.json { render :json => {:message => @candy.errors.full_messages.join(\"\\n\"), :status => 404} }\n end\n end\n end",
"def create\n @faleconosco = Faleconosco.new(faleconosco_params)\n\n respond_to do |format|\n if @faleconosco.save\n format.html { redirect_to @faleconosco, notice: 'Faleconosco was successfully created.' }\n format.json { render :show, status: :created, location: @faleconosco }\n else\n format.html { render :new }\n format.json { render json: @faleconosco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cof = Cof.new(cof_params)\n\n respond_to do |format|\n if @cof.save\n format.html { redirect_to @cof, notice: 'Cof was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cof }\n else\n format.html { render action: 'new' }\n format.json { render json: @cof.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cooperative.update(cooperative_params)\n format.html { redirect_to @cooperative, notice: 'Cooperative was successfully updated.' }\n format.json { render :show, status: :ok, location: @cooperative }\n else\n format.html { render :edit }\n format.json { render json: @cooperative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @colaborattor = Colaborattor.new(colaborattor_params)\n\n respond_to do |format|\n if @colaborattor.save\n format.html { redirect_to colaborattors_path, notice: I18n.t('messages.created_with', item: @colaborattor.colaborattorname) }\n format.json { render :show, status: :created, location: @colaborattor }\n else\n format.html { render :new }\n format.json { render json: @colaborattor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # { clinic: {\"license_id\"=>nil, \"name\"=>string } }\n clinic = @license.clinics.new(params[:clinic])\n clinic.api_license = @api_license\n if clinic.save\n render json: clinic, status: :created\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end",
"def create\n @comming_soon = CommingSoon.new(params[:comming_soon])\n\n respond_to do |format|\n if @comming_soon.save\n format.html { redirect_to @comming_soon, notice: 'Comming soon was successfully created.' }\n format.json { render json: @comming_soon, status: :created, location: @comming_soon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comming_soon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_tobacco_cessation(options={})\n options = {\n access_token: options[:access_token],\n tobacco_cessation: {\n cigarettes_allowed: options[:cigarettes_allowed],\n cigarettes_smoked: options[:cigarettes_smoked],\n cravings: options[:cravings],\n last_smoked: options[:last_smoked],\n timestamp: options[:timestamp],\n source: options[:source]\n }\n }\n\n response = post(\"/#{Validic.api_version}/tobacco_cessation.json\", options)\n response if response\n end",
"def create\n @chocolate = Chocolate.new(chocolate_params)\n\n respond_to do |format|\n if @chocolate.save\n format.html { redirect_to @chocolate, notice: \"Chocolate was successfully created.\" }\n format.json { render :show, status: :created, location: @chocolate }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @chocolate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cliente = Cliente.new\n if params[:type] == \"PessoaFisica\"\n @cliente.pessoa = PessoaFisica.new\n else\n @cliente.pessoa = PessoaJuridica.new\n end\n @cliente.assign_attributes(cliente_params)\n respond_to do |format|\n if @cliente.save\n format.html { redirect_to action: \"index\"}\n format.json { render json: @cliente.to_json(include: [:pessoa]) }\n else\n format.html { render :new }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @consumo = Consumo.new(params[:consumo])\n\n respond_to do |format|\n if @consumo.save\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo adicionado com sucesso.' }\n format.json { render :json => @consumo, :status => :created, :location => @consumo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @coisa = Coisa.new(params[:coisa])\n\n respond_to do |format|\n if @coisa.save\n format.html { redirect_to @coisa, :notice => 'Coisa was successfully created.' }\n format.json { render :json => @coisa, :status => :created, :location => @coisa }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @coisa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @cso = Cso.new(params[:cso])\n\n respond_to do |format|\n if @cso.save\n format.html { redirect_to @cso, notice: 'Cso was successfully created.' }\n format.json { render json: @cso, status: :created, location: @cso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @coaching = Coaching.new(coaching_params)\n @coaching.save\n redirect_to coaches_path\n end",
"def create\n @trein_consul_comercial = TreinConsulComercial.new(trein_consul_comercial_params)\n\n respond_to do |format|\n if @trein_consul_comercial.save\n format.html { redirect_to @trein_consul_comercial, notice: 'Trein consul comercial was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trein_consul_comercial }\n else\n format.html { render action: 'new' }\n format.json { render json: @trein_consul_comercial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @octopus = Octopus.new(octopus_params)\n\n respond_to do |format|\n if @octopus.save\n format.html { redirect_to @octopus, notice: 'Octopus was successfully created.' }\n format.json { render :show, status: :created, location: @octopus }\n else\n format.html { render :new }\n format.json { render json: @octopus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agency = Agency.new(agency_params)\n\n if @agency.save\n render json: @agency, status: :created, location: @agency\n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end",
"def create\n @complaint = Complaint.new(params[:complaint])\n\n if @complaint.save\n render json: @complaint, status: :created, location: @complaint\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end",
"def create\n @ccosto = Ccosto.new(ccosto_params)\n\n respond_to do |format|\n if @ccosto.save\n format.html { redirect_to @ccosto, notice: 'Ccosto was successfully created.' }\n format.json { render :show, status: :created, location: @ccosto }\n else\n format.html { render :new }\n format.json { render json: @ccosto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customizing = Customizing.new(customizing_params)\n # params[:goal][:user_id]\n # params :c, :freigabe_status_id\n respond_to do |format|\n if @customizing.save\n format.html { redirect_to @customizing, notice: 'Customizing was successfully created.' }\n format.json { render :show, status: :created, location: @customizing }\n else\n format.html { render :new }\n format.json { render json: @customizing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cabine = Cabine.new(cabine_params)\n\n if @cabine.save\n render :show, status: :created, location: @cabine\n else\n render json: @cabine.errors, status: :unprocessable_entity\n end\n end",
"def create\n @coyote = Coyote.new(coyote_params)\n\n respond_to do |format|\n if @coyote.save\n format.html { redirect_to @coyote, notice: 'Coyote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @coyote }\n else\n format.html { render action: 'new' }\n format.json { render json: @coyote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @causale = Causale.new(params[:causale])\n\n respond_to do |format|\n if @causale.save\n format.html { redirect_to @causale, notice: 'Causale creata con successo.' }\n format.json { render json: @causale, status: :created, location: @causalo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @causale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @coin_ico = CoinIco.new(coin_ico_params)\n\n respond_to do |format|\n if @coin_ico.save\n format.html { redirect_to coin_icos_path, notice: 'Coin ico was successfully created.' }\n format.json { render :show, status: :created, location: @coin_ico }\n else\n format.html { render :new }\n format.json { render json: @coin_ico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def medieval_composers\n response = RestClient.get 'https://api.openopus.org/composer/list/epoch/Medieval.json'\n json = JSON.parse response\n puts json\n\n if !json.nil?\n json[\"composers\"].map do |composer|\n Composer.create(name: \"#{composer[\"complete_name\"]}\", birth: \"#{composer[\"birth\"]}\", death: \"#{composer[\"death\"]}\", portrait: \"#{composer[\"portrait\"]}\", period_id: 1)\n end\n else\n puts \"Error seeding composers\"\n end\nend",
"def create\n @contest = Contest.new(params[:contest])\n @contest.contractor_id = current_user.id\n \n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, :notice => 'Contest was successfully created.' }\n format.json { render :json => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_initiative = Api::V1::Initiative.new(api_v1_initiative_params)\n\n respond_to do |format|\n if @api_v1_initiative.save\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_initiative }\n else\n format.html { render :new }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @colaborador = Colaborador.new(colaborador_params)\n\n respond_to do |format|\n if @colaborador.save\n format.html { redirect_to @colaborador, notice: 'Colaborador was successfully created.' }\n format.json { render :show, status: :created, location: @colaborador }\n else\n format.html { render :new }\n format.json { render json: @colaborador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @additive = Additive.new(additive_params)\n\n respond_to do |format|\n if @additive.save\n format.html { redirect_to @additive, success: 'Additive was successfully created.' }\n format.json { render :show, status: :created, location: @additive }\n else\n format.html { render :new }\n format.json { render json: @additive.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fact = @cat.facts.create!({ fact: api_request })\n if @fact.save\n render json: @fact\n else\n render error: { message: \"Não foi possível criar esse fato para este gatinho! :(\" }, status: 400\n end\n end",
"def create\n \n @coference = Coference.new(coference_params)\n\n @user = User.find(session[:user_id]) \n respond_to do |format|\n if @coference.save\n @user.coferences << @coference\n format.html { redirect_to @coference, notice: 'La actividad se registro con exito.' }\n format.json { render :show, status: :created, location: @coference }\n else\n format.html { render :new }\n format.json { render json: @coference.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def create\n @coche = Coche.new(coche_params)\n\n respond_to do |format|\n if @coche.save\n format.html { redirect_to @coche, notice: 'Coche was successfully created.' }\n format.json { render action: 'show', status: :created, location: @coche }\n else\n format.html { render action: 'new' }\n format.json { render json: @coche.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comic = Comic.new(params[:comic])\n\n respond_to do |format|\n if @comic.save\n format.html { redirect_to @comic, notice: 'Comic was successfully created.' }\n format.json { render json: @comic, status: :created, location: @comic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comic = Comic.new(comic_params)\n\n respond_to do |format|\n if @comic.save\n format.html { redirect_to root_path, notice: 'Comic was successfully created.' }\n format.json { redirect_to root_path, status: :created }\n else\n format.html { render :new }\n format.json { render json: @comic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profesor = Profesor.new(profesor_params)\n\n if @profesor.save\n render json: @profesor, status: :created, location: @profesor\n else\n render json: @profesor.errors, status: :unprocessable_entity\n end\n end",
"def create\n @colaboradore = Colaboradore.new(colaboradore_params)\n authorize @colaboradore\n\n respond_to do |format|\n if @colaboradore.save\n format.html { redirect_to @colaboradore, notice: 'Colaborador creado.' }\n format.json { render :show, status: :created, location: @colaboradore }\n else\n format.html { render :new }\n format.json { render json: @colaboradore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @representative = Representative.new(representative_params)\n\n respond_to do |format|\n if @representative.save\n format.html { redirect_to [:admin, @representative], notice: 'Representative was successfully created.' }\n format.json { render :show, status: :created, location: @representative }\n else\n format.html { render :new }\n format.json { render json: @representative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cocktail = Cocktail.new(params[:cocktail])\n\n respond_to do |format|\n if @cocktail.save\n format.html { redirect_to @cocktail, notice: 'Cocktail was successfully created.' }\n format.json { render json: @cocktail, status: :created, location: @cocktail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cocktail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @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 @ingresso = Ingresso.new(ingresso_params)\n\n respond_to do |format|\n if @ingresso.save\n format.html { redirect_to @ingresso, notice: 'Ingresso was successfully created.' }\n format.json { render :show, status: :created, location: @ingresso }\n else\n format.html { render :new }\n format.json { render json: @ingresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @consumable = Consumable.new(consumable_params)\n\n respond_to do |format|\n if @consumable.save\n format.html { redirect_to @consumable, notice: \"Consumable was successfully created.\" }\n format.json { render :show, status: :created, location: @consumable }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @consumable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @councils = Council.order(title: :asc)\n @post = @council.posts.build(post_params) \n respond_to do |format|\n if @post.save \n format.html { redirect_to council_posts_path(@council), notice: 'Posten skapades!' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @posts.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @competency = Competency.new(params[:competency])\n\n respond_to do |format|\n if @competency.save\n format.html { redirect_to @competency, notice: 'Competency was successfully created.' }\n format.json { render json: @competency, status: :created, location: @competency }\n else\n format.html { render action: \"new\" }\n format.json { render json: @competency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n clinic_id = params[:payment].delete(:clinic_id)\n @payment = Payment.new(params[:payment])\n @payment.clinic_id = clinic_id\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: @payment, status: :created, location: @payment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @colaborador = Colaborador.new(colaborador_params)\n respond_to do |format|\n if @colaborador.save\n format.html { redirect_to @colaborador, notice: 'Colaborador criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @colaborador }\n else\n format.html { render action: 'new' }\n format.json { render json: @colaborador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @coupan = Coupan.new(coupan_params)\n\n respond_to do |format|\n if @coupan.save\n format.html { redirect_to @coupan, notice: 'Coupan was successfully created.' }\n format.json { render :show, status: :created, location: @coupan }\n else\n format.html { render :new }\n format.json { render json: @coupan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @poc = Poc.new(poc_params)\n\n respond_to do |format|\n if @poc.save\n format.html { redirect_to @poc, notice: 'Poc was successfully created.' }\n format.json { render :show, status: :created, location: @poc }\n else\n format.html { render :new }\n format.json { render json: @poc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @custodian = Custodian.new(custodian_params)\n\n respond_to do |format|\n if @custodian.save\n format.html { redirect_to @custodian, notice: \"Custodian was successfully created.\" }\n format.json { render :show, status: :created, location: @custodian }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @custodian.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cooperativa = Cooperativa.new(params[:cooperativa])\n\n respond_to do |format|\n if @cooperativa.save\n format.html { redirect_to [:admin, @cooperativa], :notice => 'Exemplo was successfully created.' }\n format.json { render :json => @cooperativa, :status => :created, :location => @cooperativa }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cooperativa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @customer_relationship = @business_model_canvase.customer_relationships.build(customer_relationship_params)\n\n respond_to do |format|\n if @customer_relationship.save\n format.html { redirect_to @business_model_canvase, notice: 'Customer relationship was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer_relationship }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cict = Cict.new(cict_params)\n\n respond_to do |format|\n if @cict.save\n format.html { redirect_to @cict, notice: 'Cict was successfully created.' }\n format.json { render :show, status: :created, location: @cict }\n else\n format.html { render :new }\n format.json { render json: @cict.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @consorciot = Consorciot.new(consorciot_params)\n\n respond_to do |format|\n if @consorciot.save\n format.html { redirect_to @consorciot, notice: 'Consorciot was successfully created.' }\n format.json { render :show, status: :created, location: @consorciot }\n else\n format.html { render :new }\n format.json { render json: @consorciot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tboat = Boat.new(boat_params)\n \tif boat.save\n \t\trender json: boat, status: 201\n \tend\n\tend",
"def create\n # TODO fix until strong params\n @merchant.approved = false\n\n if @merchant.save\n render json: @merchant, status: :created, location: @merchant\n else\n render json: @merchant.errors, status: :unprocessable_entity\n end\n end",
"def create\n @concert = Concert.new(concert_params)\n\n respond_to do |format|\n if @concert.save\n format.html { redirect_to @concert, notice: 'Concert was successfully created.' }\n format.json { render :show, status: :created, location: @concert }\n else\n format.html { render :new }\n format.json { render json: @concert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @concert = Concert.new(concert_params)\n\n respond_to do |format|\n if @concert.save\n format.html { redirect_to @concert, notice: 'Concert was successfully created.' }\n format.json { render :show, status: :created, location: @concert }\n else\n format.html { render :new }\n format.json { render json: @concert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ocupation = Ocupation.new(ocupation_params)\n\n respond_to do |format|\n if @ocupation.save\n format.html { redirect_to @ocupation, notice: 'Ocupation was successfully created.' }\n format.json { render :show, status: :created, location: @ocupation }\n else\n format.html { render :new }\n format.json { render json: @ocupation.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.5972425",
"0.5955439",
"0.58297646",
"0.57903653",
"0.57780814",
"0.5767716",
"0.5766921",
"0.5761265",
"0.57344115",
"0.5729172",
"0.57279915",
"0.5706497",
"0.56831455",
"0.56721836",
"0.5669756",
"0.5666183",
"0.5648887",
"0.5643536",
"0.5633182",
"0.5628177",
"0.5622933",
"0.5618696",
"0.5598653",
"0.55798095",
"0.5562312",
"0.55300194",
"0.551236",
"0.5511336",
"0.55028546",
"0.5501951",
"0.5492056",
"0.54920554",
"0.5476935",
"0.5476567",
"0.54708815",
"0.545663",
"0.5454887",
"0.5440456",
"0.54262507",
"0.54245657",
"0.5421183",
"0.5414127",
"0.5413588",
"0.54134923",
"0.5402185",
"0.540092",
"0.5399645",
"0.53967285",
"0.5396636",
"0.539637",
"0.5392124",
"0.538429",
"0.5376183",
"0.5373735",
"0.5371816",
"0.5367148",
"0.5364724",
"0.5359091",
"0.53577393",
"0.5357214",
"0.53558195",
"0.53535664",
"0.5351148",
"0.5347774",
"0.53410023",
"0.53379893",
"0.5334965",
"0.53331715",
"0.53331107",
"0.53317255",
"0.5330242",
"0.53259635",
"0.5322824",
"0.53213555",
"0.53127855",
"0.53073704",
"0.53070575",
"0.53067356",
"0.5294954",
"0.5294506",
"0.5282947",
"0.52814525",
"0.52800745",
"0.52787244",
"0.5276146",
"0.5274253",
"0.5270332",
"0.5267495",
"0.5266844",
"0.5266823",
"0.5265537",
"0.5264441",
"0.52643645",
"0.5263523",
"0.5263197",
"0.5262418",
"0.52596277",
"0.5257638",
"0.5257638",
"0.52573645"
] |
0.6995013
|
0
|
PATCH/PUT /cooperatives/1 PATCH/PUT /cooperatives/1.json
|
def update
respond_to do |format|
if @cooperative.update(cooperative_params)
format.html { redirect_to @cooperative, notice: 'Cooperative was successfully updated.' }
format.json { render :show, status: :ok, location: @cooperative }
else
format.html { render :edit }
format.json { render json: @cooperative.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @cof.update(cof_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cof.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n respond_to do |format|\n if @cooco.update(cooco_params)\n format.html { redirect_to @cooco, notice: 'Cooco was successfully updated.' }\n format.json { render :show, status: :ok, location: @cooco }\n else\n format.html { render :edit }\n format.json { render json: @cooco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @coating.update_attributes(params[:coating])\n format.html { redirect_to(@coating, :notice => t(\"screens.notice.successfully_updated\")) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @coating.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cocoon_example.update(cocoon_example_params)\n format.html { redirect_to @cocoon_example, notice: 'Cocoon example was successfully updated.' }\n format.json { render :show, status: :ok, location: @cocoon_example }\n else\n format.html { render :edit }\n format.json { render json: @cocoon_example.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n respond_to do |format|\n if @cage.update_attributes(params[:cage])\n format.json { head :no_content }\n else\n format.json { render json: @cage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ocat = Ocat.find(params[:id])\n\n respond_to do |format|\n if @ocat.update_attributes(params[:ocat])\n format.html { redirect_to @ocat, notice: 'Ocat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ocat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @congress.update(congress_params)\n format.html { redirect_to @congress, notice: 'Congress was successfully updated.' }\n format.json { render :show, status: :ok, location: @congress }\n else\n format.html { render :edit }\n format.json { render json: @congress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n respond_to do |format|\n if @coffer.update(coffer_params)\n format.html { redirect_to @coffer, notice: 'Coffer was successfully updated.' }\n format.json { render :show, status: :ok, location: @coffer }\n else\n format.html { render :edit }\n format.json { render json: @coffer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @congresso.update(congresso_params)\n format.html { redirect_to @congresso, notice: 'Congresso was successfully updated.' }\n format.json { render :show, status: :ok, location: @congresso }\n else\n format.html { render :edit }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coat.update(coat_params)\n format.html { redirect_to @coat, notice: 'Coat was successfully updated.' }\n format.json { render :show, status: :ok, location: @coat }\n else\n format.html { render :edit }\n format.json { render json: @coat.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 @client.update(client_params)\n render json: @client\n end",
"def update\n respond_to do |format|\n if @coyote.update(coyote_params)\n format.html { redirect_to @coyote, notice: 'Coyote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @coyote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end",
"def update\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n if @areco.update_attributes(params[:areco])\n format.html { redirect_to @areco, notice: 'Areco was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @areco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def set_cooperative\n @cooperative = Cooperative.find(params[:id])\n end",
"def update\n @cocktail = Cocktail.find(params[:id])\n respond_to do |format|\n if @cocktail.update_attributes(params[:cocktail])\n format.html { redirect_to @cocktail, :notice => 'Cocktail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cocktail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end",
"def patch!\n request! :patch\n end",
"def update\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n if @cocktail.update_attributes(params[:cocktail])\n format.html { redirect_to @cocktail, notice: 'Cocktail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cocktail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \n end",
"def update\n respond_to do |format|\n if @colaborator.update(colaborator_params)\n format.html { redirect_to @colaborator, notice: 'Colaborator was successfully updated.' }\n format.json { render :show, status: :ok, location: @colaborator }\n else\n format.html { render :edit }\n format.json { render json: @colaborator.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 @contact = Contact.find(params[:id])\n if params[:contact][:clientId] == \"\"\n params[:contact][:clientId] = nil\n end \n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contato atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n if @colegio.update_attributes(params[:colegio])\n format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @colaboration = Colaboration.find(params[:id])\n @colaboration.user_id=current_user.id\n\n respond_to do |format|\n if @colaboration.update_attributes(params[:colaboration])\n format.html { redirect_to @colaboration, notice: 'Colaboracion actualizada exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colaboration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @couch.update(couch_params)\n format.html { redirect_to @couch, notice: 'Couche was successfully updated.' }\n format.json { render :show, status: :ok, location: @couch }\n else\n format.html { render :edit }\n format.json { render json: @couch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cat_poly.update(cat_poly_params)\n format.html { redirect_to @cat_poly, notice: 'Cat poly was successfully updated.' }\n format.json { render :show, status: :ok, location: @cat_poly }\n else\n format.html { render :edit }\n format.json { render json: @cat_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coche.update(coche_params)\n format.html { redirect_to @coche, notice: 'Coche was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @coche.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @circulation = Circulation.find(params[:id])\n\n respond_to do |format|\n if @circulation.update_attributes(params[:circulation])\n format.html { redirect_to @circulation, notice: 'Circulation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @circulation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @cta.update(cta_params)\n format.html { redirect_to @cta, notice: 'cta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @octopus.update(octopus_params)\n format.html { redirect_to octopi_path, notice: 'Octopus was successfully updated.' }\n format.json { render :show, status: :ok, location: @octopus }\n else\n format.html { render :edit }\n format.json { render json: @octopus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n if @cso.update_attributes(params[:cso])\n format.html { redirect_to @cso, notice: 'Cso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trein_consul_comercial.update(trein_consul_comercial_params)\n format.html { redirect_to @trein_consul_comercial, notice: 'Trein consul comercial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trein_consul_comercial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contractor_feature = ContractorFeature.find(params[:id])\n\n respond_to do |format|\n if @contractor_feature.update_attributes(params[:contractor_feature])\n format.html { redirect_to @contractor_feature, notice: 'Contractor feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contractor_feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coment.update(coment_params)\n format.html { redirect_to @coment, notice: \"Coment was successfully updated.\" }\n format.json { render :show, status: :ok, location: @coment }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @coment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coment.update(coment_params)\n format.html { redirect_to @coment, notice: 'Coment was successfully updated.' }\n format.json { render :show, status: :ok, location: @coment }\n else\n format.html { render :edit }\n format.json { render json: @coment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n if @compromise.update_attributes(params[:compromise])\n format.html { redirect_to @compromise, notice: 'Compromise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compromise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @catched.update(catched_params)\n format.html { redirect_to @catched, notice: 'Catched was successfully updated.' }\n format.json { render :show, status: :ok, location: @catched }\n else\n format.html { render :edit }\n format.json { render json: @catched.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fale_conosco.update(fale_conosco_params)\n format.html { redirect_to @fale_conosco, notice: 'Fale conosco was successfully updated.' }\n format.json { render :show, status: :ok, location: @fale_conosco }\n else\n format.html { render :edit }\n format.json { render json: @fale_conosco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chocolate.update(chocolate_params)\n format.html { redirect_to @chocolate, notice: \"Chocolate was successfully updated.\" }\n format.json { render :show, status: :ok, location: @chocolate }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @chocolate.errors, status: :unprocessable_entity }\n end\n end\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 respond_to do |format|\n if @address_cocoon.update(address_cocoon_params)\n format.html { redirect_to @address_cocoon, notice: 'Address cocoon was successfully updated.' }\n format.json { render :show, status: :ok, location: @address_cocoon }\n else\n format.html { render :edit }\n format.json { render json: @address_cocoon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end",
"def update\n @golf_cource = GolfCource.find(params[:id])\n\n respond_to do |format|\n if @golf_cource.update_attributes(params[:golf_cource])\n format.html { redirect_to scaffold_golf_cource_url(@golf_cource), notice: 'Golf cource was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @golf_cource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @consumable_object.update(consumable_object_params)\n format.html { redirect_to @consumable_object, notice: 'Consumable object was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @consumable_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @corge.update(corge_params)\n format.html { redirect_to @corge, notice: 'Corge was successfully updated.' }\n format.json { render :show, status: :ok, location: @corge }\n else\n format.html { render :edit }\n format.json { render json: @corge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @collaborator = Collaborator.find(params[:id])\n\n respond_to do |format|\n if @collaborator.update_attributes(params[:collaborator])\n format.html { redirect_to @collaborator, notice: 'Collaborator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collaborator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clonet = Clonet.find(params[:id])\n\n respond_to do |format|\n if @clonet.update_attributes(params[:clonet])\n format.html { redirect_to @clonet, notice: 'Clonet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clonet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n if @consumo.update_attributes(params[:consumo])\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @curso = Curso.find(params[:id])\n\n respond_to do |format|\n if @curso.update_attributes(params[:curso])\n format.html { redirect_to(:back) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @couch.update(couch_params)\n format.html { redirect_to @couch, notice: 'Couch was successfully updated.' }\n format.json { render :show, status: :ok, location: @couch }\n else\n format.html { render :edit }\n format.json { render json: @couch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cerc = Cerc.find(params[:id])\n\n if @cerc.update_attributes(params[:cerc])\n head :no_content\n else\n render json: @cerc.errors, status: :unprocessable_entity\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @coisa = Coisa.find(params[:id])\n\n respond_to do |format|\n if @coisa.update_attributes(params[:coisa])\n format.html { redirect_to @coisa, :notice => 'Coisa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @coisa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @caso.update_attributes(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @caso.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 if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end",
"def update\n respond_to do |format|\n if @apologetic.update(apologetic_params)\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @colaborattor.update(colaborattor_params)\n format.html { redirect_to colaborattors_path, notice: I18n.t('messages.updated_with', item: @colaborattor.colaborattorname) }\n format.json { render :show, status: :ok, location: @colaborattor }\n else\n format.html { render :edit }\n format.json { render json: @colaborattor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @conductor = Conductor.find(params[:id])\n\n respond_to do |format|\n if @conductor.update_attributes(params[:conductor])\n format.html { redirect_to @conductor, notice: 'Conductor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conductor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end",
"def update\n respond_to do |format|\n if @cto.update(cto_params)\n format.html { redirect_to @cto, notice: 'Cto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_initiative_update\n @api_v1_initiative_update = Api::V1::InitiativeUpdate.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @court_complex.update(court_complex_params)\n format.html { redirect_to @court_complex, notice: 'Court complex was successfully updated.' }\n format.json { render :show, status: :ok, location: @court_complex }\n else\n format.html { render :edit }\n format.json { render json: @court_complex.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @conpany.update(conpany_params)\n format.html { redirect_to conpanies_path , notice: 'Conpany was successfully updated.' }\n format.json { render :show, status: :ok, location: @conpany }\n \n else\n format.html { render :edit }\n format.json { render json: @conpany.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coconut1.update(coconut1_params)\n format.html { redirect_to @coconut1, notice: 'Coconut1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @coconut1 }\n else\n format.html { render :edit }\n format.json { render json: @coconut1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n client_id = params[:contact].delete(:client_id)\n @contact = Contact.find(params[:id])\n @contact.client = Client.find(client_id.to_i)\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.js\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.js { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @consumable.update(consumable_params)\n format.html { redirect_to @consumable, notice: \"Consumable was successfully updated.\" }\n format.json { render :show, status: :ok, location: @consumable }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @consumable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_collaborator = Admin::Collaborator.find(params[:id])\n\n respond_to do |format|\n if @admin_collaborator.update_attributes(params[:admin_collaborator])\n format.html { redirect_to @admin_collaborator, notice: 'Collaborator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_collaborator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cog.update(cog_params)\n format.html { redirect_to @cog, notice: 'Cog was successfully updated.' }\n format.json { render :show, status: :ok, location: @cog }\n else\n format.html { render :edit }\n format.json { render json: @cog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(update_params)\n format.html { redirect_to_leaf_notice(UPDATE_SUCCESS) }\n format.json { render :show, status: :ok, location: @contract }\n else\n unprocessable_response(format)\n end\n end\n end",
"def update\n respond_to do |format|\n if @coffeeshop.update(coffeeshop_params)\n format.html { redirect_to @coffeeshop, notice: 'Coffeeshop was successfully updated.' }\n format.json { render :show, status: :ok, location: @coffeeshop }\n else\n format.html { render :edit }\n format.json { render json: @coffeeshop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(data = :object || :json)\n end",
"def update\n respond_to do |format|\n if @faleconosco.update(faleconosco_params)\n format.html { redirect_to @faleconosco, notice: 'Faleconosco was successfully updated.' }\n format.json { render :show, status: :ok, location: @faleconosco }\n else\n format.html { render :edit }\n format.json { render json: @faleconosco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_concern.update(api_v1_concern_params)\n format.html { redirect_to @api_v1_concern, notice: 'Concern was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_concern }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_concern.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @small_concert.update(small_concert_params)\n format.html { redirect_to '/admin/small_concerts', notice: 'Small concert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @small_concert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @colaboradore\n respond_to do |format|\n if @colaboradore.update(colaboradore_params)\n format.html { redirect_to @colaboradore, notice: 'Colaborador actualizado.' }\n format.json { render :show, status: :ok, location: @colaboradore }\n else\n format.html { render :edit }\n format.json { render json: @colaboradore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n if @colegiatura.update_attributes(params[:colegiatura])\n format.html { redirect_to @colegiatura, notice: 'Colegiatura was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegiatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mycometer_coc.update(mycometer_coc_params)\n format.html { redirect_to @mycometer_coc, notice: 'Mycometer coc was successfully updated.' }\n format.json { render :show, status: :ok, location: @mycometer_coc }\n else\n format.html { render :edit }\n format.json { render json: @mycometer_coc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative_field.update(api_v1_initiative_field_params)\n format.html { redirect_to @api_v1_initiative_field, notice: 'Initiative field was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_field }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_field.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n if @comic.update_attributes(params[:comic])\n format.html { redirect_to @comic, notice: 'Comic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @squishee_cup = SquisheeCup.find(params[:id])\n puts params.to_json\n respond_to do |format|\n if @squishee_cup.update_attributes(params[:squishee_cup])\n format.html { redirect_to @squishee_cup, notice: 'Squishee cup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squishee_cup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @circle = Circle.find(params[:id])\n\n respond_to do |format|\n if @circle.update_attributes(params[:circle])\n format.html { redirect_to @circle, :notice => 'Circle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @circle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # TODO: Add cron_str updating\n respond_to do |format|\n if @chore.update_attributes(params[:chore])\n format.html { redirect_to @chore, notice: 'Chore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @chore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cofi = Cofi.find(params[:id])\n\n respond_to do |format|\n if @cofi.update_attributes(params[:cofi])\n format.html { redirect_to cofis_url, notice: 'Cofi was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cofi.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.64254296",
"0.6286189",
"0.61793596",
"0.6178764",
"0.6149227",
"0.6079479",
"0.6067912",
"0.60595495",
"0.605646",
"0.6055527",
"0.602482",
"0.6000337",
"0.5922706",
"0.59148216",
"0.59128577",
"0.59127146",
"0.591116",
"0.5909698",
"0.5906518",
"0.5878436",
"0.58767176",
"0.5872922",
"0.587156",
"0.5856542",
"0.5846094",
"0.5835892",
"0.58327484",
"0.58281344",
"0.58263457",
"0.58192337",
"0.5806715",
"0.58045655",
"0.5790537",
"0.57877487",
"0.5787148",
"0.5775385",
"0.57723993",
"0.577024",
"0.57652056",
"0.5763782",
"0.5758887",
"0.5754609",
"0.5744651",
"0.57336247",
"0.5733353",
"0.57086116",
"0.57073015",
"0.5706719",
"0.5705799",
"0.56979954",
"0.5696479",
"0.56959724",
"0.56946653",
"0.56944877",
"0.5688301",
"0.5683293",
"0.5683093",
"0.5682666",
"0.567462",
"0.56681776",
"0.56652164",
"0.56631744",
"0.5659803",
"0.5659803",
"0.5659193",
"0.56524",
"0.5645154",
"0.56429726",
"0.56410086",
"0.563899",
"0.56264055",
"0.5624835",
"0.56201774",
"0.56183183",
"0.56160223",
"0.56128925",
"0.5611036",
"0.56109214",
"0.5609433",
"0.5600313",
"0.5598979",
"0.55961967",
"0.5592232",
"0.5583797",
"0.558299",
"0.55784404",
"0.55766356",
"0.557625",
"0.5573529",
"0.5571891",
"0.5570397",
"0.556917",
"0.5564849",
"0.5561856",
"0.5561304",
"0.55439895",
"0.5542448",
"0.55420226",
"0.5541646",
"0.55385566"
] |
0.66824746
|
0
|
DELETE /cooperatives/1 DELETE /cooperatives/1.json
|
def destroy
@cooperative.destroy
respond_to do |format|
format.html { redirect_to cooperatives_url, notice: 'Cooperative was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @cage.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def delete_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 @ocat = Ocat.find(params[:id])\n @ocat.destroy\n\n respond_to do |format|\n format.html { redirect_to ocats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @areco = Areco.find(params[:id])\n @areco.destroy\n\n respond_to do |format|\n format.html { redirect_to arecos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @creative.destroy\n respond_to do |format|\n format.html { redirect_to creatives_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cof.destroy\n respond_to do |format|\n format.html { redirect_to cofs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @coche.destroy\n respond_to do |format|\n format.html { redirect_to coches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couche was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_initiative.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiatives_url, notice: 'Initiative was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @congress.destroy\n respond_to do |format|\n format.html { redirect_to congresses_url, notice: 'Congress was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @covariate = Covariate.find(params[:id])\n @covariate.destroy\n\n respond_to do |format|\n format.html { redirect_to(covariates_url) }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @cict.destroy\n respond_to do |format|\n format.html { redirect_to cicts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @congresso.destroy\n respond_to do |format|\n format.html { redirect_to congressos_url, notice: 'Congresso was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@clinica.destroy\n @clinica.update(:status => 0)\n respond_to do |format|\n format.html { redirect_to clinicas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @initiative = Initiative.find(params[:id])\n @initiative.destroy\n\n respond_to do |format|\n format.html { redirect_to initiatives_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cta.destroy\n respond_to do |format|\n format.html { redirect_to cta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @colaboration = Colaboration.find(params[:id])\n @colaboration.destroy\n\n respond_to do |format|\n format.html { redirect_to colaborations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coat.destroy\n respond_to do |format|\n format.html { redirect_to coats_url, notice: 'Coat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @curso.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @initiative = Initiative.find(params[:id])\n @initiative.destroy\n\n respond_to do |format|\n format.html { render :nothing => true }\n #format.html { redirect_to initiatives_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @cocktail = Cocktail.find(params[:id])\n @cocktail.destroy\n\n respond_to do |format|\n format.html { redirect_to cocktails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cocktail = Cocktail.find(params[:id])\n @cocktail.destroy\n\n respond_to do |format|\n format.html { redirect_to cocktails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @circulation = Circulation.find(params[:id])\n @circulation.destroy\n\n respond_to do |format|\n format.html { redirect_to circulations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cooco.destroy\n respond_to do |format|\n format.html { redirect_to coocos_url, notice: 'Cooco was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_json(url)\n JSON.parse(delete(url, :json, :json))\n end",
"def destroy\n @consumable_object.destroy\n respond_to do |format|\n format.html { redirect_to consumable_objects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cow.destroy\n respond_to do |format|\n format.html { redirect_to kine_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @competency.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_contabanco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contabancos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def soccer_delete\n base_delete(params, \"Soccer\")\n end",
"def destroy\n @crate = Crate.find(params[:id])\n @crate.destroy\n\n respond_to do |format|\n format.html { redirect_to crates_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @octopus.destroy\n respond_to do |format|\n format.html { redirect_to octopi_url, notice: 'Octopus was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n @coisa = Coisa.find(params[:id])\n @coisa.destroy\n\n respond_to do |format|\n format.html { redirect_to coisas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @climate = Climate.find(params[:id])\n @climate.destroy\n\n respond_to do |format|\n format.html { redirect_to climates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @creative = Creative.find(params[:id])\n @creative.destroy\n\n respond_to do |format|\n format.html { redirect_to creatives_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comic = Comic.find(params[:id])\n @comic.destroy\n\n respond_to do |format|\n format.html { redirect_to comics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contestant = Contestant.find(params[:id])\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @observation = Observation.find(params[:id])\n # @observation.destroy\n\n @coral = Coral.find(params[:coral_id])\n @observation = @coral.observations.find(params[:id])\n @observation.destroy\n # redirect_to coral_path(@coral)\n \n respond_to do |format|\n format.html { redirect_to coral_path(@coral) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @one = One.find(params[:id])\n @one.destroy\n\n respond_to do |format|\n format.html { redirect_to ones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_banco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_bancos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @coconut1.destroy\n respond_to do |format|\n format.html { redirect_to coconut1s_url, notice: 'Coconut1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dco_resource.destroy\n respond_to do |format|\n format.html { redirect_to dco_resources_url }\n format.json { head :no_content }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @cso = Cso.find(params[:id])\n @cso.destroy\n\n respond_to do |format|\n format.html { redirect_to csos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clonet = Clonet.find(params[:id])\n @clonet.destroy\n\n respond_to do |format|\n format.html { redirect_to clonets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apologetic.destroy\n respond_to do |format|\n format.html { redirect_to apologetics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @client = Client.find(params[:id])\n \n if @client.deleted_at.blank?\n @client.destroy\n else\n @client.revive\n end\n \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end",
"def destroy\n @causale = Causale.find(params[:id])\n @causale.destroy\n\n respond_to do |format|\n format.html { redirect_to causali_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @catebg = Catebg.find(params[:id])\n @catebg.destroy\n\n respond_to do |format|\n format.html { redirect_to catebgs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @secubat_client = SecubatClient.find(params[:id])\n @secubat_client.destroy\n\n respond_to do |format|\n format.html { redirect_to secubat_clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @fale_conosco.destroy\n respond_to do |format|\n format.html { redirect_to fale_conoscos_url, notice: 'Fale conosco was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doc_ponto_comer.destroy\n respond_to do |format|\n format.html { redirect_to doc_ponto_comers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coyote.destroy\n respond_to do |format|\n format.html { redirect_to coyotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coment.destroy\n respond_to do |format|\n format.html { redirect_to coments_url, notice: \"Coment was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @consumo = Consumo.find(params[:id])\n @consumo.destroy\n\n respond_to do |format|\n format.html { redirect_to consumos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @capacitacion = Capacitacion.find(params[:id])\n @capacitacion.destroy\n\n respond_to do |format|\n format.html { redirect_to capacitacions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @conductor = Conductor.find(params[:id])\n @conductor.destroy\n\n respond_to do |format|\n format.html { redirect_to conductors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commtent1 = Commtent1.find(params[:id])\n @commtent1.destroy\n\n respond_to do |format|\n format.html { redirect_to commtent1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_initiative_update.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiative_updates_url, notice: 'Initiative update was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end",
"def destroy\n @deco1.destroy\n respond_to do |format|\n format.html { redirect_to deco1s_url, notice: 'Deco1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cta = Cta.find(params[:id])\n @cta.destroy\n\n respond_to do |format|\n format.html { redirect_to ctas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crate.destroy\n respond_to do |format|\n format.html { redirect_to tenant_crates_url, notice: 'Crate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coordinador = Coordinador.find(params[:id])\n @coordinador.destroy\n\n respond_to do |format|\n format.html { redirect_to coordinadors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cocoon_example.destroy\n respond_to do |format|\n format.html { redirect_to cocoon_examples_url, notice: 'Cocoon example was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comic = Comic.find(params[:id])\n @comic.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_comics_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cateroty.destroy\n respond_to do |format|\n format.html { redirect_to cateroties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socio = Socio.find(params[:id])\n @socio.destroy\n\n respond_to do |format|\n format.html { redirect_to socios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socio = Socio.find(params[:id])\n @socio.destroy\n\n respond_to do |format|\n format.html { redirect_to socios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.70096076",
"0.6769179",
"0.6762237",
"0.6703216",
"0.6689681",
"0.66804343",
"0.664934",
"0.6637919",
"0.6627466",
"0.6621922",
"0.66214293",
"0.66147023",
"0.66145146",
"0.6606146",
"0.6596792",
"0.6576839",
"0.65711504",
"0.65647215",
"0.6559654",
"0.6548392",
"0.6541989",
"0.65416235",
"0.652986",
"0.65174353",
"0.6502136",
"0.6501553",
"0.6499644",
"0.6492237",
"0.6492237",
"0.64904296",
"0.64843684",
"0.6479835",
"0.6469525",
"0.6467204",
"0.64618933",
"0.6461224",
"0.6460551",
"0.6460544",
"0.64593476",
"0.6458982",
"0.64549726",
"0.64472175",
"0.64375025",
"0.64357793",
"0.64354146",
"0.6428313",
"0.64175093",
"0.641585",
"0.64124113",
"0.64115584",
"0.64109665",
"0.64101386",
"0.640541",
"0.6404934",
"0.6404214",
"0.64040345",
"0.64031076",
"0.64031076",
"0.6402276",
"0.63987935",
"0.63940626",
"0.63930935",
"0.63911057",
"0.63896054",
"0.63851523",
"0.63839763",
"0.63828003",
"0.6379646",
"0.63709563",
"0.63695866",
"0.6367007",
"0.6363487",
"0.6363487",
"0.6363487",
"0.6363487",
"0.6363106",
"0.63614583",
"0.6359871",
"0.63563263",
"0.63549805",
"0.635203",
"0.6351952",
"0.6346889",
"0.63464206",
"0.63441056",
"0.6343522",
"0.6341805",
"0.63413036",
"0.63392454",
"0.6336033",
"0.6332105",
"0.6329182",
"0.6329182",
"0.63259196",
"0.63259196",
"0.63259196",
"0.63259196",
"0.63259196",
"0.63259196",
"0.63259196"
] |
0.7141181
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_cooperative
@cooperative = Cooperative.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 cooperative_params
params.require(:cooperative).permit(:nombre)
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
|
string Paired api key username
|
def username
@attributes[:username]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def api_key\n\t\t\t@username || 'unknown'\n\t\tend",
"def key\n return \"#{user}\"\n end",
"def apikey(username, password)\n md5 = Digest::MD5.new\n digest = md5.update(password).hexdigest\n\n query = { action: 'apikey', userName: username, password: digest }\n get('apikey', query) { |x| x['apikey'] }\n end",
"def user_name_with_api\n \"#{user_name} #{apiname_with_brackets}\"\n end",
"def user_name_with_api\n \"#{user_name} #{apiname_with_brackets}\"\n end",
"def generate_api_key\n @url = 'https://ericssonbasicapi2.azure-api.net/v1_0/apiuser/' +\n @uuid + '/apikey'\n response = Faraday.post(@url) do |req|\n req.headers['Ocp-Apim-Subscription-Key'] = @key\n end\n\n unless response.status == 201\n raise Momoapi::Error.new(response.body, response.status)\n end\n\n key = JSON.parse(response.body)\n puts \"\\n User ID: #{@uuid} \\n API key: #{key['apiKey']} \\n\\n\"\n end",
"def api_key\n api_key_div.text.gsub(/API Key:/,'').gsub(/\\(create\\)/,'').gsub(/\\(delete\\)/,'').strip\n end",
"def secret_username\n return nil if gml_uniquekey_hash.blank?\n \"anon-\"+gml_uniquekey_hash[-5..-1]\n end",
"def me_api_key\n api_key = ApiKey.find(me.api_key_id) if auth?\n api_key.api_key || ''\n end",
"def generate_api_key(id)\n response = request(:post, \"/users/#{id}/make_new_api_key.json\")\n response[\"user\"]\n end",
"def api_name\n return @api_name if @api_name\n sanitized = @username.gsub(/[\\W_]+/, '_')\n @api_name ||= sanitized[0..15]\n end",
"def generate_auth_key\n name = \"fasdfadf\"\n puts self.name\n puts name\n end",
"def username\n ENV['IVAPI_USERNAME']\n end",
"def generate_auth_key\n key = Base64.encode64(\"#{Filepreviews.api_key}:#{Filepreviews.secret_key}\").gsub(/\\n/, '')\n \"Basic #{key}\"\n end",
"def formatted_login\n [ZerigoDNS.config.user, ZerigoDNS.config.api_key].join(':')\n end",
"def username\n response = get 'v1/market/private/user/username.json'\n response[:username]\n end",
"def authorized_by_to_s\n unless authorized_by.nil?\n r = authorized_by.name\n r = \"#{r} via #{api_key.name}\" unless api_key.nil?\n else\n r = ' - '\n r = \"Unknown via #{api_key.name}\" unless api_key.nil?\n end\n r\n end",
"def to_s\n user_key\n end",
"def to_s\n user_key\n end",
"def username\r\n Key.find(object.key_id).streamer\r\n end",
"def getkey\n user = User.try_to_login(params[:username], params[:password])\n if user.nil?\n render :text => \"Not Authorized\", :status => 403\n return\n elsif user.new_record?\n render :text => \"Not Authorized\", :status => 403\n return\n else \n render :text => user.api_key\n end\n end",
"def api_key\n key\n end",
"def username\n @obj['username']\n end",
"def show_api_key\n if @current_user.api_key != nil\n # If the user already has an api key, return it\n render json: { api_key: @current_user.api_key }, status: :ok\n else\n head :not_found\n end\n end",
"def username\n @digest_parts['username']\n end",
"def api_key email = nil\n account(email)[:api_key]\n end",
"def username\n \"rocky\"\n end",
"def apikey(site_url, username, password) \n site_url = CGI.escape(site_url)\n self.class.basic_auth username, password\n response = CreateSend.get(\"/apikey.json?SiteUrl=#{site_url}\")\n # Revert basic_auth to use @@api_key, 'x'\n self.class.basic_auth @@api_key, 'x'\n Hashie::Mash.new(response)\n end",
"def username\n profile['Username']\n end",
"def add_api_key\n @user = current_user\n if @user.present?\n @user.api_key = generate_api_key(16, 'user')\n @user.save\n end\n end",
"def username\n @data['username']\n end",
"def username\n @data['username']\n end",
"def generate_api_key\n\t\tloop do\n\t\t\ttoken = SecureRandom.base64.tr('+/=', 'Qrt')\n\t\t\tbreak token unless User.exists?(api_key: token)\n\t\tend\n\tend",
"def get_key(aliaz, password)\n\n end",
"def r_key_auth_code\n \"auth_code:#{telephone}\"\n end",
"def generate_api_key(id)\n request(:post, \"/users/#{id}/make_new_api_key.json\")\n end",
"def generate_api_key\n @user.api_key = BCrypt::Engine.generate_salt\n end",
"def username; datastore['USERNAME']; end",
"def api_key; end",
"def api_key; end",
"def api_key\n token = self.api_token || self.create_api_token(:action => 'api')\n token.value\n end",
"def api_key\n request.headers['HTTP_AUTHORIZATION']\n end",
"def api_key\n @key\n end",
"def api_key\n ENV['UNLEASHED_API_KEY']\n end",
"def api_key\n @key\n end",
"def api_key=(_arg0); end",
"def api_key=(_arg0); end",
"def api_key=(_arg0); end",
"def username\n @username || @token['data']\n end",
"def api_key\n @api_key ||= config_value.split('-')[1].chomp\n end",
"def username\n Shellwords.shellescape(SabreDAVExport.username)\n end",
"def generate_api_key!\n\t\t@api_key = Digest::SHA1.hexdigest((Time.now.to_f + rand(100) * rand()).to_s) \n\tend",
"def salted_name\n [api_name,rand_salt].join('--')\n end",
"def get_api_key\n @api = Hash.new\n if authenticate!\n if current_user.api_key.nil?\n current_user.generate_new_api_key!\n end\n @api = {:api_key => current_user.api_key}\n else\n @api = {:error => \"The combination of login and password is invalid.\"}\n end\n respond_to do |format|\n format.json do\n render :json => @api.as_json, :callback => params[:jsoncallback]\n end\n end\n end",
"def public_key\n as_public_key(rpc(:account_key, _access: :key))\n end",
"def generate_api_key\n SecureRandom.random_number(2 ** 256).to_s(36)\n end",
"def wsu_id\n \"UsernameToken-#{count}\"\n end",
"def send_username( socket, username )\n socket.puts username\n socket.flush\n authkey = socket.gets.chomp\n return authkey\n end",
"def get_api_key\n if api_key = params[:auth_token].blank? && request.headers[\"X-API-KEY\"]\n params[:auth_token] = api_key\n end\n #Rails.logger.debug params #.to_yaml\n #Rails.logger.debug \"API KEY passed is #{request.headers['X-API-KEY']}\"\n end",
"def getUsername\n return @username\n end",
"def api_signature\n ts = timestamp\n [\n Rackspace::Email::Api.configuration.user_key,\n ts,\n hash(ts)\n ].join(':')\n end",
"def username\n credentials.first\n end",
"def to_s\n \"#{username}\"\n end",
"def string_username\n CaseInsensitiveString.str(current_user.getUsername())\n end",
"def user\n conf['api']['user']\n end",
"def username\n @json['profile']['preferredUsername'] rescue nil\n end",
"def get_Username()\n \t return @outputs[\"Username\"]\n \tend",
"def get_Username()\n \t return @outputs[\"Username\"]\n \tend",
"def env_var_to_hold_api_client_primary_key\n @env_var_to_hold_api_client_primary_key.to_s\n end",
"def api_key_id\n @attributes[:api_key_id]\n end",
"def api_key\n @@api_key ||= ''\n end",
"def username\n config['couch_username_key'] ? \"#{ENV[config['couch_username_key']]}\" : \"\"\n end",
"def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end",
"def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end",
"def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end",
"def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end",
"def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end",
"def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end",
"def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end",
"def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end",
"def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end",
"def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end",
"def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end",
"def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end",
"def generate_api_key\n self.api_key = SecureRandom.hex(16)\n end",
"def username\n @config[\"username\"]\n end",
"def default_key \n Digest::SHA1.hexdigest(\"riaque:#{name}\")\n end",
"def security_key\n params['callbackPW']\n end",
"def raw_key\n key = read['pem']\n raise \"There is no key for some reason for user @#{@login}\" if key.nil?\n key\n end",
"def basic_auth\n \"#{username}:#{access_token}\"\n end",
"def inspect\n \"API key hidden for protection. Using the target URL #{@base_url}\"\n end",
"def heroku_key(apikey)\n CircleCi.request(conf, '/user/heroku-key').post(apikey: apikey)\n end",
"def api_key\n configuration.api_key\n end",
"def public_key; end",
"def public_key; end",
"def public_key; end",
"def get_user_name(user_id)\n if self.is_api then\n user = begin \n HuiMain.plugin_data.find_one(\"_id\" => BSON::ObjectId(user_id))\n rescue BSON::InvalidObjectId\n nil\n end\n if user then \n user[\"name\"]\n else\n nil\n end\n else # not api\n session[:current_user_name]\n end\n end",
"def api_key\n @api_key\n end",
"def username\n @username\n end",
"def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end",
"def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end"
] |
[
"0.8133858",
"0.7506096",
"0.7257325",
"0.7124224",
"0.7124224",
"0.68401325",
"0.6829724",
"0.6785307",
"0.66959405",
"0.66836804",
"0.6682597",
"0.66704744",
"0.6655688",
"0.66376173",
"0.6620571",
"0.66049427",
"0.6597253",
"0.6581595",
"0.6581595",
"0.6564794",
"0.6546738",
"0.6503977",
"0.64851105",
"0.648062",
"0.646401",
"0.64169586",
"0.64143693",
"0.6379011",
"0.63704884",
"0.6356063",
"0.6341291",
"0.6341291",
"0.63393086",
"0.6333811",
"0.6318662",
"0.63141704",
"0.63129544",
"0.63104117",
"0.63001704",
"0.63001704",
"0.6280331",
"0.6271041",
"0.62521845",
"0.62461466",
"0.6221446",
"0.6214939",
"0.6214939",
"0.6214939",
"0.6193575",
"0.61930037",
"0.61869776",
"0.6168866",
"0.6165248",
"0.6163974",
"0.615989",
"0.61420816",
"0.6124617",
"0.61231",
"0.61188275",
"0.60955244",
"0.608186",
"0.6081835",
"0.6080844",
"0.6076577",
"0.60714674",
"0.60702187",
"0.60665166",
"0.60665166",
"0.60657364",
"0.6063091",
"0.6060579",
"0.6047573",
"0.604442",
"0.604442",
"0.604442",
"0.604442",
"0.604442",
"0.604442",
"0.604442",
"0.604442",
"0.604442",
"0.604442",
"0.604442",
"0.604442",
"0.6042987",
"0.60427135",
"0.60372263",
"0.60237557",
"0.6023187",
"0.6022034",
"0.6018918",
"0.60177547",
"0.6010087",
"0.60063154",
"0.60063154",
"0.60063154",
"0.60012835",
"0.6000235",
"0.5991802",
"0.5991716",
"0.5991716"
] |
0.0
|
-1
|
string Paired api key password
|
def password
@attributes[:password]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_key(aliaz, password)\n\n end",
"def apikey(username, password)\n md5 = Digest::MD5.new\n digest = md5.update(password).hexdigest\n\n query = { action: 'apikey', userName: username, password: digest }\n get('apikey', query) { |x| x['apikey'] }\n end",
"def password\n conf['api']['password']\n end",
"def password\n ENV['IVAPI_PASSWORD']\n end",
"def ipa_directory_service_password\n 'd1r3ct0ry=P@ssw0r!'\n end",
"def generate_auth_key\n key = Base64.encode64(\"#{Filepreviews.api_key}:#{Filepreviews.secret_key}\").gsub(/\\n/, '')\n \"Basic #{key}\"\n end",
"def password\n Shellwords.shellescape(SabreDAVExport.password)\n end",
"def standard_password\n \"!@Cd5678\"\n end",
"def password\n [@password, @security_token].join('')\n end",
"def password\n connect\n password = self.class.query('CMD_API_VERIFY_PASSWORD',\n :user => resource[:username],\n :passwd => resource[:password]\n )\n if password[\"valid\"] == \"1\"\n return resource[:password]\n else\n return \"********\"\n end\n end",
"def get_password(password)\n password\n end",
"def secretkey(apikey)\n get 'secretkey', {apikey: apikey} { |x| x['secretkey'] }\n end",
"def ipa_bulk_enroll_password\n 'en0llm3nt=p@ssWor^'\n end",
"def passphrase\n Digistore24.configuration.passphrase\n end",
"def generate_api_key\n @user.api_key = BCrypt::Engine.generate_salt\n end",
"def generate_api_key(length = 20)\n self.api_secret_key = SecureRandom.hex(length)\n end",
"def getpassword()\r\n return getvalue(SVTags::PASSWORD)\r\n end",
"def security_key\n params['callbackPW']\n end",
"def _inki_password\n\t\t@_inki_password\n\tend",
"def account_password\n\t\tif self[:account_password].blank?\n\t\t\treturn \"\"\n\t\tend\n\t\n\t\tBase64.decode64(self[:account_password])\n\tend",
"def generate_api_key\n SecureRandom.random_number(2 ** 256).to_s(36)\n end",
"def password\n @hash.to_s\n end",
"def generate_api_key\n digest = Digest::SHA2.new(512)\n # generate a unique token\n unique_seed = SecureRandom.hex(20)\n digest.update(\"#{unique_seed} SECRET! #{Time.current.to_f}\").to_s\n end",
"def generate_api_key\n digest = Digest::SHA2.new(512)\n # generate a unique token\n unique_seed = SecureRandom.hex(20)\n digest.update(\"#{unique_seed} SECRET! #{Time.current.to_f}\").to_s\n end",
"def password; datastore['PASSWORD']; end",
"def password\n if !@password_insync && resource[:api_admin] == :true\n update_admin_pass_with_rake\n end\n return resource[:password] if @password_insync\n return nil\n end",
"def set_APIPassword(value)\n set_input(\"APIPassword\", value)\n end",
"def create_api_key(string, pepper = rand(9**99).to_s)\n # Hash then encrypt our seed string\n 10.times do\n # Run our string through 10 rounds of SHA512, each time \"peppering\" it with random data\n 10.times do\n string = sha512(string.to_s + pepper)\n end\n # Encrypt the end result to further obfuscate things\n string = encrypt(string + pepper)\n end\n return string[0...64] # return the end result, stripping to 64 characters\nend",
"def password\n 'password'.gsub('', '')\n end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def generate_api_key\n self.api_key = SecureRandom.hex(16)\n end",
"def api_token_cryp(value)\n encrypted_api_token = EncryptionService.encrypt(value)\n end",
"def r_key_auth_code\n \"auth_code:#{telephone}\"\n end",
"def authentication_string\n pwd = escape(@account.password)\n user = escape(@account.username)\n sig = escape(@account.signature) \n \"PWD=#{pwd}&USER=#{user}&SIGNATURE=#{sig}\"\n end",
"def apikey(site_url, username, password) \n site_url = CGI.escape(site_url)\n self.class.basic_auth username, password\n response = CreateSend.get(\"/apikey.json?SiteUrl=#{site_url}\")\n # Revert basic_auth to use @@api_key, 'x'\n self.class.basic_auth @@api_key, 'x'\n Hashie::Mash.new(response)\n end",
"def encoding\n Dotenv.load #Charge les cles depuis le .env#\n keys = \"#{ENV[\"Client_ID\"]}:#{ENV[\"Client_Secret\"]}\"\n key_encoded = Base64.strict_encode64(keys)\n key_encoded = \"Basic #{key_encoded}\"\n return key_encoded\nend",
"def generate_api_key\n @url = 'https://ericssonbasicapi2.azure-api.net/v1_0/apiuser/' +\n @uuid + '/apikey'\n response = Faraday.post(@url) do |req|\n req.headers['Ocp-Apim-Subscription-Key'] = @key\n end\n\n unless response.status == 201\n raise Momoapi::Error.new(response.body, response.status)\n end\n\n key = JSON.parse(response.body)\n puts \"\\n User ID: #{@uuid} \\n API key: #{key['apiKey']} \\n\\n\"\n end",
"def password=(value)\n conf['api']['password'] = value\n end",
"def secret_key; end",
"def password\n ENV['DESK_PASSWORD']\n end",
"def account_password\n get_account_password\n end",
"def encryption_password\n res = @resource[:encryption_password]\n ph = @property_hash[:encryption_password]\n return ph if res.nil?\n return :default if res == :default &&\n ph == @tacacs_server_host.default_encryption_password\n unless res.start_with?('\"') && res.end_with?('\"')\n ph = ph.gsub(/\\A\"|\"\\Z/, '')\n end\n ph\n end",
"def generate_and_print_password\n password = Simp::Cli::Utils.generate_password\n logger.say ('~'*80).green + \"\\n\"\n logger.say 'NOTE: '.green.bold + \" The generated password is: \\n\\n\"\n logger.say ' ' + password.yellow.bold + \"\\n\\n\"\n logger.say ' >>>> Please remember this password! <<<<'.bold\n logger.say ' It will ' + '**NOT**'.bold + ' be written to the log or hieradata.'\n logger.say ('~'*80).green + \"\\n\"\n logger.say '*** Press enter to continue ***'.cyan.bold.blink\n ask ''\n password\n end",
"def password\n password = Base64.decode64(@config.fetch(:password, nil))\n if password\n cipher.decrypt_string(password).gsub(\"\\0\", \"\")\n else\n password\n end\n end",
"def encryption_password\n res = @resource[:encryption_password]\n ph = @property_hash[:encryption_password]\n return ph if res.nil?\n return :default if res == :default &&\n ph == @tacacs_server.default_encryption_password\n unless res.start_with?('\"') && res.end_with?('\"')\n ph = ph.gsub(/\\A\"|\"\\Z/, '')\n end\n ph\n end",
"def password(password_name)\n pwd = Security::GenericPassword.find(l: password_name)\n pwd = Security::InternetPassword.find(l: password_name) if !pwd\n raise \"A password named '#{password_name}' does not exist in the default keychain\" if !pwd\n pwd.password\n end",
"def secret_key\n \"\"\n end",
"def generate_auth_key\n name = \"fasdfadf\"\n puts self.name\n puts name\n end",
"def service_password( password )\n\t\t\tself.password_digest = Digest::SHA2.hexdigest( password )\n\t\t\tDRbService.log.debug \"Setting encrypted password for %p to \"\n\t\tend",
"def api_key\n\t\t\t@username || 'unknown'\n\t\tend",
"def to_s\n %[#<password safe>]\n end",
"def to_s\n %[#<password safe>]\n end",
"def ios_password(length = 1)\n 8226.chr('UTF-8') * length\n end",
"def generate_api_key!\n\t\t@api_key = Digest::SHA1.hexdigest((Time.now.to_f + rand(100) * rand()).to_s) \n\tend",
"def secret_string\n [\n client_name,\n request_method,\n api_endpoint,\n post_body,\n timestamp\n ].join(':')\n end",
"def password\r\n @password\r\n end",
"def password\n self.class.escape_dn(@cert_chain[0].subject.to_s)\n end",
"def mutate_bcrypt_password(_)\n '400$8$2d$f6ed5a490c441958$67f59aa61bc617849a3280b5e80f78607e53b5aa5807a44ddbc53e804e2e2a99'\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n return @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def initialize(username, apikey, endpoint = 'https://api.passivetotal.org/v2/')\n unless apikey =~ /^[a-fA-F0-9]{64}$/\n raise ArgumentError.new(\"apikey must be a 64 character hex string\")\n end\n @username = username\n @apikey = apikey\n @endpoint = endpoint\n end",
"def password\n @crypted_password\n \n end",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def get_password\n if Rails.env == \"development\"\n return \"password\"\n else\n abort(\"You should only run this on development.\\naborting\")\n end\nend",
"def api_key\n key\n end",
"def generate_password\n pass = \"\"\n 20.times { pass += (rand(74) + 48).chr }\n\n begin\n Puppet.settings.write(:capass) { |f| f.print pass }\n rescue Errno::EACCES => detail\n raise Puppet::Error, \"Could not write CA password: %s\" % detail.to_s\n end\n\n @password = pass\n\n return pass\n end",
"def pin\n password = $pin\n end",
"def secret_key_base; end",
"def secret_key_base; end",
"def secret_key_base; end",
"def secret_key_base; end",
"def get_password(host)\n # Retrieve password from OS X KeyChain.\n osx = (RUBY_PLATFORM =~ /darwin/)\n if(osx)then\n\n require 'osx_keychain'\n keychain = OSXKeychain.new\n user = ENV['USER']\n pass = keychain[host, user ]\n\n if(pass == nil) then\n puts \"Password for '#{host}' not found on OS X KeyChain. \"\n puts \"Enter password to store new password on OS X KeyChain.\"\n require 'highline/import'\n\n pass = ask(\"Password: \") {|q| q.echo = \"*\"} # false => no echo\n keychain[host, user] = pass\n puts \"Password for '#{user}' on '#{host}' stored on OS X KeyChain.\"\n end\n return pass\n\n else\n puts \"Warning: Not running on OS X.\"\n end\n\nend",
"def api_key\n api_key_div.text.gsub(/API Key:/,'').gsub(/\\(create\\)/,'').gsub(/\\(delete\\)/,'').strip\n end",
"def generate_api_key(id)\n response = request(:post, \"/users/#{id}/make_new_api_key.json\")\n response[\"user\"]\n end",
"def password\n\t\t# We expect that the default OpenMRS interface is used to create users\n\t\t#self.password = encrypt(self.plain_password, self.salt) if self.plain_password\n\t\t#raise @password.to_yaml\n\t\tself[:password]\n\tend",
"def password(id)\n profile_element = profile(id)\n if profile_element\n enc_passwd = profile_element['password']\n return decrypt(enc_passwd) if enc_passwd\n end\n end",
"def password\n return self[:password]\n end",
"def signing_key\n [percent_encode(@secret), percent_encode(@token)].join('&')\n end",
"def password\n @password\n end",
"def key_info\n authenticated_post(\"key_info\").body\n end",
"def _my_mkpass()\n mymkpass = ''\n 9.to_i.times{ mymkpass << (65 + rand(25)).chr }\n return mymkpass\nend",
"def generate_api_key(id)\n request(:post, \"/users/#{id}/make_new_api_key.json\")\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end"
] |
[
"0.76322424",
"0.74670136",
"0.7402092",
"0.69810885",
"0.6953416",
"0.6923486",
"0.68666655",
"0.67905957",
"0.67512745",
"0.6733115",
"0.67294115",
"0.6706941",
"0.6698854",
"0.66882193",
"0.6661806",
"0.66404915",
"0.66352046",
"0.6596681",
"0.65833783",
"0.65703666",
"0.65601534",
"0.65587306",
"0.6542874",
"0.6542874",
"0.65423024",
"0.65184885",
"0.65148693",
"0.64957523",
"0.64817965",
"0.6470737",
"0.6470737",
"0.6470737",
"0.6470737",
"0.6470737",
"0.6470737",
"0.64646894",
"0.6460181",
"0.64496404",
"0.64440936",
"0.6411885",
"0.6402852",
"0.63876754",
"0.63857085",
"0.6371635",
"0.63538164",
"0.6342888",
"0.63370353",
"0.6334902",
"0.633184",
"0.6328379",
"0.62914807",
"0.6276498",
"0.6275482",
"0.62708443",
"0.6265402",
"0.6260043",
"0.6260043",
"0.62590766",
"0.6257997",
"0.6254158",
"0.62503344",
"0.6248812",
"0.6248516",
"0.62453425",
"0.62453425",
"0.6236925",
"0.6235685",
"0.6235685",
"0.6221789",
"0.62203723",
"0.6213664",
"0.6213664",
"0.6213664",
"0.6213664",
"0.620381",
"0.6200686",
"0.62005115",
"0.6198472",
"0.61941946",
"0.61941946",
"0.61941946",
"0.61941946",
"0.6180974",
"0.6167151",
"0.6159247",
"0.6156172",
"0.61533606",
"0.614346",
"0.61355793",
"0.61269766",
"0.6122982",
"0.6120374",
"0.6119853",
"0.6118115",
"0.6118115",
"0.6118115",
"0.6118115",
"0.6118115",
"0.6118115",
"0.6118115",
"0.6118115"
] |
0.0
|
-1
|
string Unique nickname for this api key
|
def nickname
@attributes[:nickname]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def api_key\n\t\t\t@username || 'unknown'\n\t\tend",
"def api_name\n return @api_name if @api_name\n sanitized = @username.gsub(/[\\W_]+/, '_')\n @api_name ||= sanitized[0..15]\n end",
"def generate_unique_name\n SecureRandom.uuid\n end",
"def secret_username\n return nil if gml_uniquekey_hash.blank?\n \"anon-\"+gml_uniquekey_hash[-5..-1]\n end",
"def default_key \n Digest::SHA1.hexdigest(\"riaque:#{name}\")\n end",
"def key\n return \"#{user}\"\n end",
"def hubssolib_unique_name\n user = hubssolib_current_user\n user ? \"#{user.user_real_name} (#{user.user_id})\" : 'Anonymous'\n end",
"def key\n \"#{@@PREFIX}#{@name.gsub(\" \",\"-\")}\"\n end",
"def generate_api_key\n SecureRandom.random_number(2 ** 256).to_s(36)\n end",
"def unique_name\n unique_name = @name\n unique_name += \" (#{@disambiguation})\" if @disambiguation\n return unique_name\n end",
"def key(name = nil)\n \"#{@id}:#{name}\"\n end",
"def unique_identifier\n Digest::MD5.hexdigest(@name.to_s)[0..9]\n end",
"def unique_id\n '%8x%s@%s' % [\n Time.now.to_i,\n Digest::SHA1.hexdigest(\n '%.8f%8x' % [ Time.now.to_f, rand(1 << 32) ]\n )[0, 32],\n Socket.gethostname\n ]\n end",
"def unique_name(name)\n \"#{name}_#{Time.now.to_i}\"\n end",
"def unique_name(name)\n \"#{name}_#{Time.now.to_i}\"\n end",
"def generate_unique_key\n # not doing uppercase as url is case insensitive\n charset = ::Shortener.key_chars\n (0...::Shortener.unique_key_length).map{ charset[rand(charset.size)] }.join\n end",
"def salted_name\n [api_name,rand_salt].join('--')\n end",
"def nickname\n user_info['nickname']\n end",
"def random_name\n SecureRandom.hex(20)\n end",
"def name_key\n return base_key + \".name\"\n end",
"def key_file_name\n self.email.tr('^A-Za-z', '')[0..10] + self.id.to_s\n end",
"def jmaki_generate_uuid(name)\n if (@jmaki_uuid == nil)\n @jmaki_uuid = 0\n end\n @jmaki_uuid = @jmaki_uuid + 1\n return name.tr('.', '_') + \"_\" + @jmaki_uuid.to_s;\n end",
"def generate_auth_key\n name = \"fasdfadf\"\n puts self.name\n puts name\n end",
"def key_pair_name\n\n # return the key_pair_name if one is already generated\n return @key_pair_name if @key_pair_name\n\n # generate on from a random string of 10 upper and lowercase letters\n o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten\n @key_pair_name = (0..10).map { o[rand(o.length)] }.join\n return @key_pair_name\n\n end",
"def to_s\n unique_name.to_s\n end",
"def gen_api_key\n u = UUID.new\n self.api_key = u.generate\n end",
"def nickname\n return @nickname\n end",
"def auto_generate_username(t = nil)\n\t t ||= Time.now\n\t return \"gi\" + t.strftime(\"%Y%m%d_%H%M%S\")\n end",
"def unique_name\n \"#{project.name} / #{name}\"\n end",
"def unique_object_name_for(name)\n \"#{name}_#{SecureRandom.hex(5)}\"\n end",
"def generate_api_key!\n\t\t@api_key = Digest::SHA1.hexdigest((Time.now.to_f + rand(100) * rand()).to_s) \n\tend",
"def key\n \"#{@@PREFIX}#{@type}-#{@version.gsub(\".\",\"-\")}\"\n end",
"def generate_api_key\n digest = Digest::SHA2.new(512)\n # generate a unique token\n unique_seed = SecureRandom.hex(20)\n digest.update(\"#{unique_seed} SECRET! #{Time.current.to_f}\").to_s\n end",
"def generate_api_key\n digest = Digest::SHA2.new(512)\n # generate a unique token\n unique_seed = SecureRandom.hex(20)\n digest.update(\"#{unique_seed} SECRET! #{Time.current.to_f}\").to_s\n end",
"def unique_name\n return nil if ignoring_request?\n\n @unique_name ||= begin\n scope_layer = LayerConverters::FindLayerByType.new(self).scope\n if scope_layer\n scope_layer.legacy_metric_name\n else\n :unknown\n end\n end\n end",
"def uniqid\n SecureRandom.hex(32)\n end",
"def uniqid\n SecureRandom.hex(32)\n end",
"def wsu_id\n \"UsernameToken-#{count}\"\n end",
"def generate_unique_key(now = Time.now)\n u1 = ((now.to_i*1000*1000+now.usec) << 12 | rand(0xfff))\n uid = [u1 >> 32, u1 & 0xffffffff, rand(0xffffffff), rand(0xffffffff)].pack('NNNN')\n uid.unpack('C*').map { |x| \"%02x\" % x }.join\n end",
"def generate_api_key\n key = Digest::SHA1.hexdigest(Time.now.to_s + rand(12345678).to_s)[1..10]\n self.api_key = self._id.to_s + key\n end",
"def generate_api_key\n key = Digest::SHA1.hexdigest(Time.now.to_s + rand(12345678).to_s)[1..10]\n self.api_key = self._id.to_s + key\n end",
"def key\n @key ||= name.to_s\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 unique_format_name\n string_with_id(name.observation_name)\n rescue StandardError\n \"\"\n end",
"def unique_identifier\n Digest::SHA1.hexdigest(\"#{login_name}:#{password}\")\n end",
"def unique_name(id)\n id.to_s\n end",
"def default_name\n [\n instance.name.gsub(/\\W/, '')[0..14],\n (Etc.getlogin || 'nologin').gsub(/\\W/, '')[0..14],\n Socket.gethostname.gsub(/\\W/, '')[0..22],\n Array.new(7) { rand(36).to_s(36) }.join\n ].join('-')\n end",
"def nickname\n Blogical::Application.nickname\n end",
"def name\n @name ? @name.to_s : unique_id\n end",
"def nickname\n @nickname\n end",
"def key\n \"#{Goalkeeper.namespace}:#{label}\"\n end",
"def generate_api_key\n self.api_key = SecureRandom.hex(16)\n end",
"def api_key\n api_key_div.text.gsub(/API Key:/,'').gsub(/\\(create\\)/,'').gsub(/\\(delete\\)/,'').strip\n end",
"def generate_api_key\n\t\tloop do\n\t\t\ttoken = SecureRandom.base64.tr('+/=', 'Qrt')\n\t\t\tbreak token unless User.exists?(api_key: token)\n\t\tend\n\tend",
"def generate_id()\n return nil unless @name and @represents\n @id ||= Digest::SHA1.hexdigest(@name + @represents)[0..5].force_encoding('utf-8').to_s\n end",
"def identifier\n SecureRandom.hex(16)\n end",
"def unique_tube_name(name)\n \"name.#{uuid}\"\n end",
"def unique_key\n \"redis:bitops:#{SecureRandom.hex(20)}\"\n end",
"def generate_api_key\n generate_uuid\nend",
"def user_name_with_api\n \"#{user_name} #{apiname_with_brackets}\"\n end",
"def user_name_with_api\n \"#{user_name} #{apiname_with_brackets}\"\n end",
"def nickname\n @nick\n end",
"def name\n @gapi[\"displayName\"]\n end",
"def unique_identifier\n Digest::SHA1.hexdigest(\"#{screen_name}:#{password}\")\n end",
"def unique_identifier\n Digest::SHA1.hexdigest(\"#{screen_name}:#{password}\")\n end",
"def unique_identifier\n Digest::SHA1.hexdigest (\"#{self.screen_name}:#{self.password}\")\n end",
"def generate_username\n\t\tself.username = \"guest_#{Time.now.to_i}#{rand(100)}\" if username.blank?\n\tend",
"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 = \"#{sanitized_title.downcase}_#{salt}\"\n end\n end",
"def key_name\n \"#{prefix}:#{@id}\"\n end",
"def _unique_name\n string = aliases.split(\",\").sort_by{|x| x.downcase}.join(\", \")\n Digest::SHA1.hexdigest string\n end",
"def generate_unique_key\n\n # @TODO:need to update the algo. Right now it's very simple algo\n length = self.url.length\n rand(36**length).to_s(36)\n end",
"def unique_safe_name\n \"#{safe_name}_#{id}\"\n end",
"def unique_id\n \"name-#{@language_id}-#{@name_id}\"\n end",
"def key_name\n data[:key_name]\n end",
"def api_name\n to_s.split('::').last.gsub(/[^\\A]([A-Z])/, '_\\\\1').downcase\n end",
"def unique_identifier\n\t\tDigest::SHA1.hexdigest(\"#{email}:#{password}\")\n\tend",
"def prefix_name\n \"CAGNUT_#{Time.now.strftime('%Y%m%d%H%M%S')}\"\n end",
"def api_key\n token = self.api_token || self.create_api_token(:action => 'api')\n token.value\n end",
"def full_key\n [name, key].join(\"/\")\n end",
"def nickname\n data = get 'name', resource: 'leaderboard'\n data.name\n end",
"def generate_api_key(id)\n response = request(:post, \"/users/#{id}/make_new_api_key.json\")\n response[\"user\"]\n end",
"def id_string\n return \"user_\"+self.username\n end",
"def key\n key = self.name\n key = Economic::Support::String.demodulize(key)\n key = Economic::Support::String.underscore(key)\n key.intern\n end",
"def me_api_key\n api_key = ApiKey.find(me.api_key_id) if auth?\n api_key.api_key || ''\n end",
"def key(name)\n @unique_key = name\n end",
"def nickname\r\n return @user.nickname\r\n end",
"def generate_url_name\n self.url_name ||=\n Base32.encode(SecureRandom.random_bytes(16)).downcase.sub(/=*$/, '')\n end",
"def generate_url_name\n self.url_name ||=\n Base32.encode(SecureRandom.random_bytes(16)).downcase.sub(/=*$/, '')\n end",
"def random_username\n # \"batterypop-#{(rand * 10000).to_i}\"\n \"batterypop-#{Time.now.to_i}\"\n end",
"def generate_user_key\n\t\tself.key = loop do\n random_hex = SecureRandom.urlsafe_base64\n break random_hex unless self.class.exists?(key: random_hex)\n end\n\tend",
"def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'RST')\n break token unless User.exists?(api_key: token)\n end\n end",
"def generate_key; end",
"def generate_name\n @seed ||= 0\n @seed += 1\n \"_anon_#{@seed}\"\n end",
"def name\n @gapi[\"friendlyName\"]\n end",
"def fusion_name\n SecureRandom.uuid\n end",
"def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end",
"def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end",
"def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end",
"def Name(name)\n\tname = SecureRandom.alphanumeric\nend",
"def unique_id\n # Consider using SecureRandom.hex here, and benchmark which one is better\n (Time.now.to_f * 1000).to_i.to_s(36) + rand(1_000_000).to_s(36)\n end"
] |
[
"0.7100706",
"0.70127875",
"0.6987943",
"0.6924053",
"0.68550587",
"0.6836947",
"0.6804843",
"0.6804661",
"0.6743886",
"0.6739026",
"0.6735404",
"0.67320806",
"0.6666806",
"0.66276205",
"0.66276205",
"0.6582242",
"0.6569239",
"0.6568734",
"0.65567404",
"0.6542322",
"0.6528566",
"0.6520141",
"0.6516421",
"0.6503935",
"0.648605",
"0.6474952",
"0.6448081",
"0.6441765",
"0.6412338",
"0.6411073",
"0.6410394",
"0.6402289",
"0.6400378",
"0.6400378",
"0.6395647",
"0.63928354",
"0.63928354",
"0.6392298",
"0.63908356",
"0.6380544",
"0.6380544",
"0.6355502",
"0.6345315",
"0.6344691",
"0.6340221",
"0.6331988",
"0.6325422",
"0.6319527",
"0.63145155",
"0.630482",
"0.629302",
"0.6275977",
"0.6272537",
"0.62664896",
"0.6257967",
"0.6257219",
"0.6250941",
"0.62448806",
"0.6234533",
"0.623139",
"0.623139",
"0.6222419",
"0.62156624",
"0.6208898",
"0.6208898",
"0.6205007",
"0.619813",
"0.6190813",
"0.61858857",
"0.6160502",
"0.61473495",
"0.61443335",
"0.61393714",
"0.61240965",
"0.61159587",
"0.6110277",
"0.6108571",
"0.6101975",
"0.60870224",
"0.6082803",
"0.6081629",
"0.6078584",
"0.6074016",
"0.60692614",
"0.60503304",
"0.6044509",
"0.6043563",
"0.6043563",
"0.6043082",
"0.60429174",
"0.60360134",
"0.6032381",
"0.60308564",
"0.6026957",
"0.6023127",
"0.6022359",
"0.6022359",
"0.6022359",
"0.60218906",
"0.6016653"
] |
0.62490976
|
57
|
This should possibly be in either lib/inspec/cli.rb or Registry
|
def exit_on_load_error
if registry.any_load_failures?
Inspec::Log.error "Errors were encountered while loading plugins..."
registry.plugin_statuses.select(&:load_exception).each do |plugin_status|
Inspec::Log.error "Plugin name: " + plugin_status.name.to_s
Inspec::Log.error "Error: " + plugin_status.load_exception.message
if ARGV.include?("--debug")
Inspec::Log.error "Exception: " + plugin_status.load_exception.class.name
Inspec::Log.error "Trace: " + plugin_status.load_exception.backtrace.join("\n")
end
end
Inspec::Log.error("Run again with --debug for a stacktrace.") unless ARGV.include?("--debug")
exit 2
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def with_cli(cli); end",
"def cli_path; end",
"def parse_cli\n raise \"Undefined interface for the command line of #{cli.task}\"\n end",
"def inspec_runner\n # When running under inspec-cli, we have an 'inspec' method that\n # returns the runner. When running under unit tests, we don't\n # have that, but we still have to call this to pass something\n # (nil is OK) to the backend.\n # TODO: remove with https://github.com/chef/inspec-aws/issues/216\n # TODO: remove after rewrite to include AwsSingularResource\n inspec if respond_to?(:inspec)\n end",
"def inspec_runner\n # When running under inspec-cli, we have an 'inspec' method that\n # returns the runner. When running under unit tests, we don't\n # have that, but we still have to call this to pass something\n # (nil is OK) to the backend.\n # TODO: remove with https://github.com/chef/inspec-aws/issues/216\n # TODO: remove after rewrite to include AwsSingularResource\n inspec if respond_to?(:inspec)\n end",
"def shell_init()\n\t\traise NotImplementedError\n\tend",
"def shell_api; end",
"def cli_prefix; end",
"def registry; end",
"def registry; end",
"def subcommand() __subcommand__ end",
"def framework\n 'inspec'\n end",
"def command\n fail 'Not implemented.'\n end",
"def main(*args)\n #puts self.class # TODO: fix help\n raise NoCommandError\n end",
"def cmd; end",
"def cop_registry; end",
"def shell_api=(_arg0); end",
"def __subcommand__() @__subcommand__&.__ident__ end",
"def registry\n\t\tbrand(Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Registry)\n\tend",
"def configure_command(cmd)\n end",
"def usage; end",
"def usage; end",
"def supercommand!() __supercommand__ end",
"def load_cli_options\n cli_options_file = File.join(spec.full_gem_path, \"lib/#{spec.name}/cli.rb\")\n require cli_options_file if File.exists?(cli_options_file)\n end",
"def init_shell()\n\t\traise NotImplementedError\n\tend",
"def command_found; end",
"def original_run_command; end",
"def run\n unknown 'Not implemented! You should override Sensu::Plugin::CLI#run.'\n end",
"def spec; end",
"def spec; end",
"def provider_cli\n @provider_cli ||= begin\n return nil unless name = settings.exists?(\"provider.name\")\n require \"cyoi/cli/providers/provider_cli_#{settings.provider.name}\"\n klass = self.class.provider_cli(settings.provider.name)\n klass.new(settings.provider, hl)\n end\n end",
"def test_run_with_dashed_command_name\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n client = Heroics::client_from_schema(schema, 'https://example.com')\n output = StringIO.new\n command = Heroics::Command.new(\n 'cli', schema.resource('resource').link('identify_resource'), client,\n output)\n cli = Heroics::CLI.new('cli', {'resource:identify-resource' => command},\n output)\n\n uuid = '1ab1c589-df46-40aa-b786-60e83b1efb10'\n Excon.stub(method: :get) do |request|\n assert_equal(\"/resource/#{uuid}\", request[:path])\n Excon.stubs.pop\n {status: 200}\n end\n\n cli.run('resource:identify-resource', uuid)\n assert_equal('', output.string)\n end",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def initialize_scanned_client!\n ClientRegistry.instance.global_client('basic')\nend",
"def initialize_scanned_client!\n ClientRegistry.instance.global_client('basic')\nend",
"def commands; end",
"def init # entry method to the CLI \n greeting \n menu_list\n menu_selection\nend",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def extract_command; end",
"def cli_path=(_arg0); end",
"def __subcommand__!() @__subcommand__ end",
"def actual_load_commands\n include_in_universe\n end",
"def command_name; end",
"def run\n sut_inspec_results = '/tmp/inspec_results.json'\n\n inspec_version = Gem::Version.new(on(@sut, 'inspec --version').output.lines.first.strip)\n\n # See: https://github.com/inspec/inspec/pull/3935\n if inspec_version <= Gem::Version.new('3.9.0')\n inspec_cmd = \"inspec exec '#{@test_dir}' --reporter json > #{sut_inspec_results}\"\n else\n inspec_cmd = \"inspec exec '#{@test_dir}' --chef-license accept --reporter json > #{sut_inspec_results}\"\n end\n\n result = on(@sut, inspec_cmd, :accept_all_exit_codes => true)\n\n tmpdir = Dir.mktmpdir\n begin\n Dir.chdir(tmpdir) do\n scp_from(@sut, sut_inspec_results, '.')\n\n local_inspec_results = File.basename(sut_inspec_results)\n\n if File.exist?(local_inspec_results)\n begin\n # The output is occasionally broken from past experience. Need to\n # fetch the line that actually looks like JSON\n inspec_json = File.read(local_inspec_results).lines.find do |line|\n line.strip!\n\n line.start_with?('{') && line.end_with?('}')\n end\n\n @results = JSON.load(inspec_json) if inspec_json\n rescue JSON::ParserError, JSON::GeneratorError\n @results = nil\n end\n end\n end\n ensure\n FileUtils.remove_entry_secure tmpdir\n end\n\n if @results.nil? || @results.empty?\n File.open(@result_file + '.err', 'w') do |fh|\n fh.puts(result.stderr.strip)\n end\n\n err_msg = [\"Error running inspec command #{inspec_cmd}\"]\n err_msg << \"Error captured in #{@result_file}\" + '.err'\n\n fail(err_msg.join(\"\\n\"))\n end\n end",
"def subcommands() __subcommands__ end",
"def exec_server; Ricer4::Server.where(:conector => 'shell').first; end",
"def cli=(value); end",
"def registry_path\n fail NotImplementedError\n end",
"def console\n\t\t\tcla = as_class_name(@arguments.first)\tif @arguments.length == 1\n\t\t File.open(\"./tmp/irb-setup.rb\", 'w') do |f|\n\t\t f.puts \"# Initializes the environment for IRb.\"\n\t\t f.puts \"Experiment::Config::init #{@options.env.inspect}\"\n\t\t f.puts \"$: << '#{File.expand_path(\".\")}/'\"\n\t\t if @arguments.length == 1\n\t\t f.puts \"require 'experiments/#{@arguments.first}/#{@arguments.first}'\"\n\t\t f.puts \"def experiment\"\n \t\t f.puts \" @experiment ||= #{cla}.new :normal, #{@arguments.first.inspect}, OpenStruct.new(#{@options.marshal_dump})\"\n \t\t f.puts \"end\"\n \t\t f.puts \"experiment #load up the configs\"\n \t\t else\n \t\t f.puts 'Dir[\"./app/**/*.{rb,o,so,dll,bundle}\"].each{|e| require e.gsub(/\\.(rb|so|o|dll|bundle)$/, \"\") }'\n \t\t f.puts \"Experiment::Config::load '', #{options.opts.inspect}\"\n\t\t end\n\t\t \n\t\t end\n irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'\n libs = \" -r irb/completion\"\n libs << \" -r #{File.dirname(__FILE__) + \"/base\"}\"\n libs << \" -r./experiments/experiment\"\n libs << \" -r ./tmp/irb-setup.rb\"\n puts \"Loading #{@options.env} environment...\"\n exec \"#{irb} #{libs} --simple-prompt\"\n\t end",
"def spawn_registry(opts_={})\n config.spawn_registry(opts_)\n end",
"def gemspec_helper=(_arg0); end",
"def gemspec_helper=(_arg0); end",
"def gemspec_helper=(_arg0); end",
"def gemspec_helper=(_arg0); end",
"def gemspec_helper=(_arg0); end",
"def gemspec_helper=(_arg0); end",
"def gemspec_helper=(_arg0); end",
"def openCuratorInterface \n \"openCuratorInterface\" \n end",
"def standalone; end",
"def standard_specs; end",
"def new_api\n load_config\n require 'extensions/metasploit/extension.rb'\n @api = BeEF::Extension::Metasploit::RpcClient.instance\n @api.unit_test_init()\n end",
"def register_command cmd\n $commandlist << cmd\nend",
"def main\n end",
"def set_commands; end",
"def initialize(info={})\n super(update_info(info,\n 'Name' => 'SCRNSAVE T1180 (User-land Persistence)',\n 'Description' => %q{\n To achieve persistence the attacker can modify 'SCRNSAVE.EXE' value in the registry and change its data to point to any malicious file, next the attacker has to enable the screensaver on the endpoint and change screensaver timeout by modifying the registry data for 'ScreenSaveActive' and 'ScreenSaveTimeOut'. Once this is completed, anytime the user leaves their desktop unattended for the specified amount of time, the screensaver function automatically kicks in and executes the attackers malicious PE/Appl.\n },\n 'License' => UNKNOWN_LICENSE,\n 'Author' =>\n [\n 'Module Author: r00t-3xp10it',\n 'Special Thanks: shanty damayanti',\n ],\n \n 'Version' => '$Revision: 1.4',\n 'DisclosureDate' => '11 02 2019',\n 'Platform' => 'windows',\n 'Arch' => 'x86_x64',\n 'Privileged' => 'false', # Thats no need for privilege escalation.\n 'Targets' =>\n [\n # Affected systems are.\n [ 'Windows 2008', 'Windows xp', 'windows vista', 'windows 7', 'windows 9', 'Windows 10' ]\n ],\n 'DefaultTarget' => '6', # Default its to run againts windows 10\n 'References' =>\n [\n [ 'URL', 'https://attack.mitre.org/techniques/T1180/' ],\n [ 'URL', 'https://github.com/r00t-3xp10it/msf-auxiliarys' ],\n [ 'URL', 'https://ired.team/offensive-security/t1180-screensaver-hijack' ],\n [ 'URL', 'https://www.howtogeek.com/225305/how-to-find-and-set-screen-savers-on-windows-10/' ]\n\n\n ],\n\t\t\t'DefaultOptions' =>\n\t\t\t\t{\n 'LOOT_FOLDER' => '/root/.msf4/loot', # Default logs storage directory\n 'APPL_PATH' => '%windir%\\\\System32\\\\calc.exe', # Default PE/appl (payload) to run (test)\n\t\t\t\t},\n 'SessionTypes' => [ 'meterpreter' ]\n \n ))\n \n register_options(\n [\n OptString.new('SESSION', [ true, 'The session number to run this module on', 1]),\n OptString.new('TIME_OUT', [ true, 'Set inactivity timeout before screensaver runs', 10]),\n OptString.new('APPL_PATH', [ true, 'Set absoluct path of malicious PE/Appl to run'])\n ], self.class)\n\n register_advanced_options(\n [\n OptBool.new('LOG_OFF', [ false, 'Logoff current user to force registry refresh?', false]),\n OptString.new('LOOT_FOLDER', [ true, 'Set the absoluct path where to store revert.rc (local)'])\n ], self.class)\n\n end",
"def init\n require File.expand_path( '../irbtools.rb', File.dirname(__FILE__) )\n end",
"def main; end",
"def startup_hook; end",
"def cmdarg_stack; end",
"def cmdarg_stack; end",
"def cmdarg_stack; end",
"def show_usage\n puts\n puts \"Available Commands & General Usage:\".white.underline\n puts \" config\".light_yellow + \" => \".white + \"Configure Connection Credentials\".light_yellow\n puts \" os_scan\".light_yellow + \" => \".white + \"SMB OS Discovery Scan\".light_yellow\n puts \" cat [FILE]\".light_yellow + \" => \".white + \"Display Content of Local File\".light_yellow\n puts \" local\".light_yellow + \" => \".white + \"Drop to Local OS Shell to Execute Commands\".light_yellow\n puts \" rb [CODE]\".light_yellow + \" => \".white + \"Eval Ruby Code\".light_yellow\n if @working\n puts\n # Credentialed Options\n puts \"Authenticated Options:\".white.underline\n puts \" smbclient\".light_yellow + \" => \".white + \"Drop to Interactive SMBClient Shell Session\".light_yellow\n puts \" list\".light_yellow + \" => \".white + \"List Available Shares\".light_yellow\n puts \" use [SHARE]\".light_yellow + \" => \".white + \"Use Specified Share Name\".light_yellow\n puts \" ls [DIR]\".light_yellow + \" => \".white + \"List Directory Contents\".light_yellow\n puts \" dl [FILE]\".light_yellow + \" => \".white + \"Download Remote File\".light_yellow\n puts \" up [FILE] [DIR]\".light_yellow + \" => \".white + \"Upload File to Remote Directory\".light_yellow\n puts \" rm [FILE] [DIR]\".light_yellow + \" => \".white + \"Delete File in Remote Directory\".light_yellow\n puts \" mkdir [NAME] [DIR]\".light_yellow + \" => \".white + \"Make New Directory in Remote Directory\".light_yellow\n puts \" rmdir [NAME] [DIR]\".light_yellow + \" => \".white + \"Delete Remote Directory\".light_yellow\n puts\n puts \"PSEXEC Options:\".white.underline\n puts \" os_shell\".light_yellow + \" => \".white + \"OS Pseudo Shell - Execute Multiple Commands\".light_yellow\n puts \" os_exec\".light_yellow + \" => \".white + \"Execute Single OS Command on target\".light_yellow\n puts \" os_pshexec\".light_yellow + \" => \".white + \"Execute PowerShell Payload\".light_yellow\n puts \" up_exec\".light_yellow + \" => \".white + \"Upload & Execute EXE Payload\".light_yellow\n puts \" get_hives\".light_yellow + \" => \".white + \"Download Windows Registry Hives\".light_yellow\n puts \" get_ntds\".light_yellow + \" => \".white + \"Download Active Directory NTDS.dit File from DC\".light_yellow\n puts\n puts \"MOF Options:\".white.underline\n puts \" mof_exec\".light_yellow + \" => \".white + \"Execute Single OS Command on target\".light_yellow\n puts \" mof_up\".light_yellow + \" => \".white + \"Upload & Execute EXE Payload\".light_yellow\n puts\n puts \"Fun & Enumeration:\".white.underline\n puts \" swaparoo\".light_yellow + \" => \".white + \"Windows Swaparoo Setup & Repair\".light_yellow\n puts \" uac_check\".light_yellow + \" => \".white + \"Check if UAC is Enabled\".light_yellow\n puts \" disable_uac\".light_yellow + \" => \".white + \"Disable UAC via Registry Edits\".light_yellow\n puts \" enable_uac\".light_yellow + \" => \".white + \"Re-Enable UAC via Registry Edits\".light_yellow\n puts \" domain_admin\".light_yellow + \" => \".white + \"Get List of Domain Admin Users\".light_yellow\n puts \" active_users\".light_yellow + \" => \".white + \"Get List of Logged in Users\".light_yellow\n puts\n end\n puts\n if not @working\n puts \"Use 'config' option to set & validate credentials to make more options available\".light_yellow + \"!\".white\n puts\n end\nend",
"def inspec_command(service, server, profile, input_file)\n cmd = [\n \"CHEF_LICENSE=accept-no-persist\",\n \"inspec exec\",\n \"--sudo #{sudo_options}\",\n \"--key-files #{config.ssh_key_file}\",\n \"--log-level=#{ verbose? ? 'debug' : 'info' }\",\n ]\n\n cmd << \"--input-file #{input_file}\"\n cmd << \"--sudo-password=#{sudo_password(service)}\" if sudo_password(service)\n cmd << \"--sudo-command=#{AutomateCluster.sudo_}\" if sudo_command\n cmd << \"--target ssh://#{config.ssh_user}@#{server}:#{config.ssh_port}\"\n cmd << File.join(profile_path, profile)\n\n cmd.join(' ')\n end",
"def load_current_resource\n @current_resource = Chef::Resource::NexusCapability.new(new_resource.name)\n\n run_context.include_recipe \"nexus::cli\"\n Chef::Nexus.ensure_nexus_available(node)\n\n @current_resource\nend",
"def entry_point\n raise NotImplementedError\n end",
"def main\n\n end",
"def run_ohai\n @ohai.require_plugin(\"os\")\n end",
"def subcommands(cmd); end",
"def subcommands(cmd); end",
"def test_run_with_unknown_name\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n client = Heroics::client_from_schema(schema, 'https://example.com')\n output = StringIO.new\n command = Heroics::Command.new(\n 'cli', schema.resource('resource').link('list'), client, output)\n cli = Heroics::CLI.new('cli', {'resource:list' => command}, output)\n cli.run('unknown:command')\n assert_equal(\"There is no command called 'unknown:command'.\\n\",\n output.string)\n end",
"def toolbox(type)\n end",
"def toolbox(type)\n end",
"def toolbox(type)\n end",
"def initialize\n register_script \"Provide on-protocol help for bot scripts and commands.\"\n\n register_command \"help\", :cmd_help, 0, 0, nil, \"Show help for the given command or a list of all commands. Parameters: [command]\"\n register_command \"script\", :cmd_script, 0, 0, nil, \"Show a description of the given script or a list of all scripts. Parameters: [script]\"\nend",
"def launch\n # To be overriden in subclass,\n # not implemented here.\n raise NotImplementedError\n end",
"def commands\n all = {\n 'clearev' => 'Clear the event log',\n 'drop_token' => 'Relinquishes any active impersonation token.',\n 'execute' => 'Execute a command',\n 'getpid' => 'Get the current process identifier',\n 'getprivs' => 'Attempt to enable all privileges available to the current process',\n 'getuid' => 'Get the user that the server is running as',\n 'getsid' => 'Get the SID of the user that the server is running as',\n 'getenv' => 'Get one or more environment variable values',\n 'kill' => 'Terminate a process',\n 'pkill' => 'Terminate processes by name',\n 'pgrep' => 'Filter processes by name',\n 'ps' => 'List running processes',\n 'reboot' => 'Reboots the remote computer',\n 'reg' => 'Modify and interact with the remote registry',\n 'rev2self' => 'Calls RevertToSelf() on the remote machine',\n 'shell' => 'Drop into a system command shell',\n 'shutdown' => 'Shuts down the remote computer',\n 'steal_token' => 'Attempts to steal an impersonation token from the target process',\n 'suspend' => 'Suspends or resumes a list of processes',\n 'sysinfo' => 'Gets information about the remote system, such as OS',\n 'localtime' => 'Displays the target system local date and time',\n }\n reqs = {\n 'clearev' => [\n COMMAND_ID_STDAPI_SYS_EVENTLOG_OPEN,\n COMMAND_ID_STDAPI_SYS_EVENTLOG_CLEAR\n ],\n 'drop_token' => [COMMAND_ID_STDAPI_SYS_CONFIG_DROP_TOKEN],\n 'execute' => [COMMAND_ID_STDAPI_SYS_PROCESS_EXECUTE],\n 'getpid' => [COMMAND_ID_STDAPI_SYS_PROCESS_GETPID],\n 'getprivs' => [COMMAND_ID_STDAPI_SYS_CONFIG_GETPRIVS],\n 'getuid' => [COMMAND_ID_STDAPI_SYS_CONFIG_GETUID],\n 'getsid' => [COMMAND_ID_STDAPI_SYS_CONFIG_GETSID],\n 'getenv' => [COMMAND_ID_STDAPI_SYS_CONFIG_GETENV],\n 'kill' => [COMMAND_ID_STDAPI_SYS_PROCESS_KILL],\n 'pkill' => [\n COMMAND_ID_STDAPI_SYS_PROCESS_KILL,\n COMMAND_ID_STDAPI_SYS_PROCESS_GET_PROCESSES\n ],\n 'pgrep' => [COMMAND_ID_STDAPI_SYS_PROCESS_GET_PROCESSES],\n 'ps' => [COMMAND_ID_STDAPI_SYS_PROCESS_GET_PROCESSES],\n 'reboot' => [COMMAND_ID_STDAPI_SYS_POWER_EXITWINDOWS],\n 'reg'\t => [\n COMMAND_ID_STDAPI_REGISTRY_LOAD_KEY,\n COMMAND_ID_STDAPI_REGISTRY_UNLOAD_KEY,\n COMMAND_ID_STDAPI_REGISTRY_OPEN_KEY,\n COMMAND_ID_STDAPI_REGISTRY_OPEN_REMOTE_KEY,\n COMMAND_ID_STDAPI_REGISTRY_CREATE_KEY,\n COMMAND_ID_STDAPI_REGISTRY_DELETE_KEY,\n COMMAND_ID_STDAPI_REGISTRY_CLOSE_KEY,\n COMMAND_ID_STDAPI_REGISTRY_ENUM_KEY,\n COMMAND_ID_STDAPI_REGISTRY_SET_VALUE,\n COMMAND_ID_STDAPI_REGISTRY_QUERY_VALUE,\n COMMAND_ID_STDAPI_REGISTRY_DELETE_VALUE,\n COMMAND_ID_STDAPI_REGISTRY_QUERY_CLASS,\n COMMAND_ID_STDAPI_REGISTRY_ENUM_VALUE,\n ],\n 'rev2self' => [COMMAND_ID_STDAPI_SYS_CONFIG_REV2SELF],\n 'shell' => [COMMAND_ID_STDAPI_SYS_PROCESS_EXECUTE],\n 'shutdown' => [COMMAND_ID_STDAPI_SYS_POWER_EXITWINDOWS],\n 'steal_token' => [COMMAND_ID_STDAPI_SYS_CONFIG_STEAL_TOKEN],\n 'suspend' => [COMMAND_ID_STDAPI_SYS_PROCESS_ATTACH],\n 'sysinfo' => [COMMAND_ID_STDAPI_SYS_CONFIG_SYSINFO],\n 'localtime' => [COMMAND_ID_STDAPI_SYS_CONFIG_LOCALTIME],\n }\n filter_commands(all, reqs)\n end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def setup\r\n end"
] |
[
"0.64625376",
"0.61597776",
"0.599794",
"0.5968242",
"0.5968242",
"0.5934769",
"0.5897523",
"0.58849317",
"0.5793868",
"0.5793868",
"0.5761598",
"0.5743322",
"0.57210445",
"0.5632632",
"0.5627167",
"0.5612879",
"0.5547858",
"0.55191875",
"0.549387",
"0.54871917",
"0.5483253",
"0.5483253",
"0.5463384",
"0.54590297",
"0.54568326",
"0.5448622",
"0.54384613",
"0.542427",
"0.5410105",
"0.5410105",
"0.5406728",
"0.5366843",
"0.5364558",
"0.5364558",
"0.5364558",
"0.53553706",
"0.53553706",
"0.53544927",
"0.5352784",
"0.53480923",
"0.53480923",
"0.53480923",
"0.53480923",
"0.53480923",
"0.53480923",
"0.53395265",
"0.5327696",
"0.53179336",
"0.5304625",
"0.5298983",
"0.5298786",
"0.52980036",
"0.52837926",
"0.52836955",
"0.52752733",
"0.5265283",
"0.5247373",
"0.52451247",
"0.52451247",
"0.52451247",
"0.52451247",
"0.52451247",
"0.52451247",
"0.52451247",
"0.5237487",
"0.5235132",
"0.52333546",
"0.52316713",
"0.5218761",
"0.5212488",
"0.5208519",
"0.51992095",
"0.5198794",
"0.51983416",
"0.51952034",
"0.5193318",
"0.5193318",
"0.5193318",
"0.51902974",
"0.51899916",
"0.518849",
"0.5175717",
"0.5172703",
"0.51688063",
"0.516732",
"0.516732",
"0.51664466",
"0.5160362",
"0.5160362",
"0.5160362",
"0.5149909",
"0.5145756",
"0.5140366",
"0.51342684",
"0.51342684",
"0.51342684",
"0.51342684",
"0.51342684",
"0.51342684",
"0.51342684",
"0.51332504"
] |
0.0
|
-1
|
'Activating' a gem adds it to the load path, so 'require "gemname"' will work. Given a gem name, this activates the gem and all of its dependencies, respecting version pinning needs.
|
def activate_managed_gems_for_plugin(plugin_gem_name, version_constraint = "> 0")
# TODO: enforce first-level version pinning
plugin_deps = [Gem::Dependency.new(plugin_gem_name.to_s, version_constraint)]
managed_gem_set = Gem::Resolver::VendorSet.new
list_managed_gems.each { |spec| managed_gem_set.add_vendor_gem(spec.name, spec.gem_dir) }
# TODO: Next two lines merge our managed gems with the other gems available
# in our "local universe" - which may be the system, or it could be in a Bundler microcosm,
# or rbenv, etc. Do we want to merge that, though?
distrib_gem_set = Gem::Resolver::CurrentSet.new
installed_gem_set = Gem::Resolver.compose_sets(managed_gem_set, distrib_gem_set)
# So, given what we need, and what we have available, what activations are needed?
resolver = Gem::Resolver.new(plugin_deps, installed_gem_set)
begin
solution = resolver.resolve
rescue Gem::UnsatisfiableDependencyError => gem_ex
# If you broke your install, or downgraded to a plugin with a bad gemspec, you could get here.
ex = Inspec::Plugin::V2::LoadError.new(gem_ex.message)
raise ex
end
solution.each do |activation_request|
next if activation_request.full_spec.activated?
activation_request.full_spec.activate
# TODO: If we are under Bundler, inform it that we loaded a gem
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def activate_gem(gem_name, library_name = nil)\n if !defined?(::Gem)\n begin\n require 'rubygems'\n rescue LoadError\n end\n end\n if Kernel.respond_to?(:gem, true)\n begin\n gem(gem_name)\n rescue Gem::LoadError\n end\n end\n require(library_name || gem_name)\n end",
"def activate(name, *requirements)\n Gems.synchronize do\n begin\n gem(name, *requirements)\n rescue ::Gem::LoadError => e\n handle_activation_error(e, name, requirements)\n end\n end\n end",
"def gem(name, *requirements)\n self.class.gems.activate(name, *requirements)\n end",
"def activate\n other = Gem.loaded_specs[self.name]\n if other\n check_version_conflict other\n return false\n end\n\n raise_if_conflicts\n\n activate_dependencies\n add_self_to_load_path\n\n Gem.loaded_specs[self.name] = self\n @activated = true\n @loaded = true\n\n return true\n end",
"def require_gem gem, name = nil\n name = gem if name.nil?\n if !BBLib.gem_installed? name\n return false unless Gem.install gem\n end\n require name\n end",
"def setup_gem(name, options)\n version = [options[:version]].compact\n lib_name = options[:lib] || name\n\n log \"activating #{name}\"\n\n Gem.activate(name, *version)\n rescue Gem::LoadError\n log \"activating #{name} failed, try to install\"\n\n install_gem(name, version, options)\n end",
"def setup_gem(name, options)\n version = [options[:version]].compact\n lib_name = options[:lib] || name\n\n log \"activating #{name}\"\n\n Gem.activate(name, *version)\n require(lib_name)\n\n rescue LoadError\n\n install_gem(name, options)\n Gem.activate(name, *version)\n require(lib_name)\n end",
"def load_gem(name, version=nil)\n # needed if your ruby version is less than 1.9\n require 'rubygems'\n\n begin\n gem name, version\n rescue LoadError\n version = \"--version '#{version}'\" unless version.nil?\n system(\"gem install #{name} #{version}\")\n Gem.clear_paths\n retry\n end\n\n require name\nend",
"def load_gem(name, version=nil)\n # needed if your ruby version is less than 1.9\n require 'rubygems'\n\n begin\n gem name, version\n rescue LoadError\n version = \"--version '#{version}'\" unless version.nil?\n system(\"gem install #{name} #{version}\")\n Gem.clear_paths\n retry\n end\n\n require name\nend",
"def load_gem(name, version=nil)\n # needed if your ruby version is less than 1.9\n require 'rubygems'\n\n begin\n gem name, version\n rescue LoadError\n version = \"--version '#{version}'\" unless version.nil?\n system(\"gem install #{name} #{version}\")\n Gem.clear_paths\n retry\n end\n\n require name\nend",
"def activate\n fire :activating, :activated do\n spec = self.specification\n raise Gem::LoadError, \"Couldn't resolve: #{self}\" unless spec\n spec.activate\n end\n end",
"def require( gem_name_or_path ) \n \n did_load = ::Development.require( gem_name_or_path )\n\n if did_load.nil?\n did_load = super\n end\n\n if gem_name_or_path == 'bundler'\n ::Development::Require::BundlerSupport.call\n end\n \n return did_load\n \n end",
"def install\r\n super\r\n automated_install {\r\n @local_gems.flush_gem_cache\r\n gem_name = @override_gem_name.nil? ? installed_as_name_for( self.gem_short_name ) : @override_gem_name\r\n installed_gem = @local_gems.find( gem_name )\r\n fails_to_load gem_name if installed_gem.nil?\r\n installed_gem.activate\r\n }\r\n end",
"def activate!\n # Create the configuration object for the plugin.\n Pry.config.send(\"#{gem_name.gsub('-', '_')}=\", OpenStruct.new)\n\n begin\n require gem_name if !active?\n rescue LoadError => e\n warn \"Found plugin #{gem_name}, but could not require '#{gem_name}'\"\n warn e\n end\n\n self.active = true\n self.enabled = true\n end",
"def install_gem(gem_name)\n if gem_name.match(/getopt/)\n install_name = \"getopt\"\n else\n install_name = gem_name.gsub(/\\//,\"-\")\n end\n puts \"Information:\\tInstalling #{install_name}\"\n %x[gem install #{install_name}]\n Gem.clear_paths\n require \"#{gem_name}\"\nend",
"def activate(library)\n name = library.name\n\n lib = $LEDGER.index[name]\n\n if Library === lib\n raise VersionConflict.new(library, lib) if lib != library\n else\n library.absolute_loadpath.each do |path|\n $LOAD_PATH.unshift(path)\n end\n\n $LEDGER.index[name] = library\n\n# TODO\n #if library.requirements.exist?\n # library.requirements.verify(true)\n # # complete collapse\n #end\n end\n end",
"def opal_gem(gem_name)\n Opal.use_gem(gem_name)\n Opal.paths.uniq!\n # require(gem_name)\n end",
"def install_gem(gemname)\n if !Gem::Specification::find_all_by_name(gemname).any?\n gemfile(true) do\n source 'https://rubygems.org'\n gem gemname\n end\n end\n require gemname\nend",
"def require(path)\n require__ path\n rescue LoadError => load_error\n begin\n @gempath_searcher ||= Gem::GemPathSearcher.new\n if spec = @gempath_searcher.find(path)\n Gem.activate(spec.name, true, \"= #{spec.version}\")\n require__ path\n else\n\traise load_error\n end\n end\n end",
"def require!\n super do\n gem @gem_name, @version if @version\n end\n end",
"def is_gem?(name)\n return @is_gem if @is_gem\n begin\n # First, do we even have gems?\n require 'rubygems'\n # Ported over from porttown\n # Apparently Gem.activate changed from 2 args to 1 at some point, and I\n # can't find rdocs anywhere that tell me why, so this is a workaround\n begin\n Gem.activate(name)\n rescue ArgumentError\n Gem.activate(name, false)\n end\n #If we made it here, then we're a gem.\n @is_gem = true\n rescue LoadError\n @is_gem = false\n end\n return @is_gem\n end",
"def load_gems\n @bundler_loaded ||= Bundler.require :default, Rails.env\n end",
"def activate_dependencies\n unresolved = Gem::Specification.unresolved_deps\n\n self.runtime_dependencies.each do |spec_dep|\n if loaded = Gem.loaded_specs[spec_dep.name]\n next if spec_dep.matches_spec? loaded\n\n msg = \"can't satisfy '#{spec_dep}', already activated '#{loaded.full_name}'\"\n e = Gem::LoadError.new msg\n e.name = spec_dep.name\n\n raise e\n end\n\n begin\n specs = spec_dep.to_specs\n rescue Gem::MissingSpecError => e\n raise Gem::MissingSpecError.new(e.name, e.requirement, \"at: #{self.spec_file}\")\n end\n\n if specs.size == 1\n specs.first.activate\n else\n name = spec_dep.name\n unresolved[name] = unresolved[name].merge spec_dep\n end\n end\n\n unresolved.delete self.name\n end",
"def add_self_to_load_path\n return if default_gem?\n\n paths = full_require_paths\n\n Gem.add_to_load_path(*paths)\n end",
"def require(path) # :nodoc:\n gem_original_require path\n rescue LoadError => load_error\n if File.basename(path).match(Gem::MiniGems::INLINE_REGEXP) && \n Object.const_defined?(:Inline)\n # RubyInline dynamically created .so/.bundle\n return gem_original_require(File.join(Inline.directory, path))\n elsif path == 'Win32API' && !Gem.win_platform?\n raise load_error\n elsif load_error.message =~ /#{Regexp.escape path}\\z/\n if !path.include?('/') && Gem.activate(path)\n return gem_original_require(path)\n elsif $MINIGEMS_SKIPPABLE.include?(path)\n raise load_error\n elsif spec = Gem.searcher.find(path)\n Gem.activate(spec.name, \"= #{spec.version}\")\n return gem_original_require(path)\n end\n end\n raise load_error\n end",
"def install_gem(name, version, options)\n installer = Gem::DependencyInstaller.new(options)\n\n temp_argv(options[:extconf]) do\n log \"installing #{name}\"\n installer.install(name, *version)\n end\n\n Gem.activate(name, *version)\n\n log \"install and final activation successful\"\n rescue Gem::GemNotFoundException => ex\n log \"installation failed: #{ex}, use normal require\"\n\n require(options[:lib] || name)\n\n log \"require successful, cannot verify version though\"\n end",
"def loaded?( gem_name )\n \n gem_require_name = gem_name.to_s.gsub( '/', '-' )\n \n return @loaded_gems.has_key?( gem_require_name.to_sym )\n \n end",
"def unbundled_require(gem)\n loaded = false\n if defined?(::Bundler)\n Gem.path.each do |gems_path|\n gem_path = Dir.glob(\"#{gems_path}/gems/#{gem}*\").last\n unless gem_path.nil?\n $LOAD_PATH << \"#{gem_path}/lib\"\n require gem\n loaded = true\n end\n end\n else\n require gem\n loaded = true\n end\n raise(LoadError, \"couldn't find #{gem}\") unless loaded\n loaded\nend",
"def require_gems; end",
"def require(name)\n Kernel.require name\nend",
"def require_gem(gem)\n dep = fetch(:required_gems)\n dep ||= []\n if gem.respond_to?(:each)\n dep += gem\n else\n dep << gem\n end\n set(:required_gems, dep)\n end",
"def load!\n begin\n require gem_name unless enabled?\n rescue LoadError => error\n raise Vedeu::Error::Fatal,\n \"Unable to load plugin #{gem_name} due to #{error}.\"\n rescue => error\n raise Vedeu::Error::Fatal,\n \"require '#{gem_name}' failed with #{error}.\"\n end\n\n @enabled = true\n end",
"def activated?\n loaded = Gem.loaded_specs[name]\n loaded && loaded.version == version\n end",
"def merge_gem(gem_name, version=nil)\n gem_info = {:name=>gem_name}\n if version.is_a?(Hash)\n gem_info.merge!(version)\n else\n gem_info[:version] = version\n end\n @merged_gems << gem_info\n require gem_info[:require] || gem_name\n end",
"def activated?\n @activated ||=\n begin\n loaded = Gem.loaded_specs[name]\n loaded && loaded.version == version\n end\n end",
"def use!(name)\n @parent.gemset_use(name, :replace_env => true)\n end",
"def gem(name, version = Gem::Requirement.default)\n @gems ||= {}\n @gems[name] = version\n end",
"def carrega_gem(nome, versao = nil)\n begin\n gem nome, versao\n rescue LoadError\n puts \"Instalando gem '#{nome}'...\"\n versao = \"-- version '#{versao}'\" unless versao.nil?\n system \"gem install #{nome} #{versao}\"\n Gem.clear_paths\n retry\n end\n\n require nome\nend",
"def gem(name, *reqs)\n if dep = @dependency_names[name]\n dep.requirement.concat reqs\n else\n dep = Gem::Dependency.new name, *reqs\n @dependency_names[name] = dep\n @dependencies << dep\n end\n end",
"def gem(gem_name, *version_requirements)\n if gem_name =='i18n'\n puts \"skipping loading the i18n gem ...\"\n return\n end\n super(gem_name, *version_requirements)\nend",
"def update_load_path\n require 'bundler'\n Bundler.setup\n end",
"def use(name)\n @parent.gemset_use(name)\n end",
"def appbundle_gem(gem_name)\n # First lock the gemfile down.\n lockdown_gem(gem_name)\n\n shared_gemfile = self.shared_gemfile\n\n # Ensure the main bin dir exists\n bin_dir = File.join(install_dir, \"bin\")\n mkdir(bin_dir)\n\n block \"Lock down the #{gem_name} gem\" do\n installed_path = shellout!(\"#{bundle_bin} show #{gem_name}\", env: env, cwd: install_dir).stdout.chomp\n\n # appbundle the gem\n appbundler_args = [ installed_path, bin_dir, gem_name ]\n appbundler_args = appbundler_args.map { |a| ::Shellwords.escape(a) }\n shellout!(\"#{appbundler_bin} #{appbundler_args.join(\" \")}\", env: env, cwd: installed_path)\n end\n end",
"def gem(name, requirement = nil)\n gems << Gem.new(name, requirement)\n end",
"def load_dependencies\r\n @local_gems.each do |gem_info|\r\n gem_file_name = gem_info.gem_file\r\n gem_name = installed_as_name_for( short_form_of_gem_name( gem_file_name ) )\r\n @required_gem_names.delete gem_file_name\r\n end\r\n @required_gem_paths.each do |gem_path|\r\n gem_short_name = short_form_of_gem_name gem_path\r\n if @required_gem_names.include? gem_short_name\r\n puts \"installing #{gem_path}\"\r\n installer = @force_require ? PreloadingInstaller.new( gem_path, @local_gems ) : Installer.new( gem_path )\r\n installer.install\r\n end\r\n end\r\n end",
"def activate\n @libraries.each {|library| require(library) }\n self.activated = true\n rescue LoadError => e\n mf_log \"#{name} metric not activated, #{e.message}\"\n end",
"def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end",
"def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end",
"def install_gem(gem_built_name)\n execute(:install_gem, \"gem install #{gem_built_name}\")\n end",
"def try_local(gem_name)\n if ENV['USE_LOCAL_GEMS']\n gem gem_name, path: \"../#{gem_name}\"\n else\n gem gem_name, github: \"omniscrapper/#{gem_name}\"\n end\nend",
"def local_gem(*args)\n load_local_gem(args[0]) || gem(*args)\n end",
"def load_minimal_gems\r\n end",
"def register_dependency(dep, version)\n GemDependency.create!(\n laser_gem: self,\n dependency: dep,\n version: version,\n )\n self.reload\n end",
"def inject_gem(name, version = nil)\n gemfile = facts['app_code'] + '/Gemfile'\n if File.exists?(gemfile)\n return if File.read(gemfile)[/^gem ('|\")#{name}('|\")/]\n File.open(gemfile, \"a\") do |f|\n f.puts ''\n if version\n f.puts \"gem '#{name}', '#{version}' # injected by platform\"\n else\n f.puts \"gem '#{name}' # injected by platform\"\n end\n end\n else\n @injected_gems ||= []\n @injected_gems << [name, version]\n end\n end",
"def util_bake_gem(name = \"a\", *extra, &block)\n files = [\"lib/#{name}.rb\"].concat(extra)\n\n spec = new_spec name, \"1\", nil, files, &block\n\n File.join @tempdir, \"gems\", \"#{spec.full_name}.gem\"\n end",
"def gem!(name)\n self.root = Padrino.gem(name, self)\n end",
"def gem(gemname)\n if Gem.loaded_specs[gemname]\n require gemname.gsub(/-/, '/')\n path = \"#{Gem.loaded_specs[gemname].lib_dirs_glob.split(':')[0]}/\" \\\n \"#{gemname.gsub(/-/, '/')}/plugin.rb\"\n if File.exist? path\n pl = pluginr(path)\n raise ProtonBot::PluginError, \"`#{path}` did not return plugin!\" unless\n pl.instance_of? ProtonBot::Plugin\n @parr << pl\n else\n raise IOError, \"No such file or directory: #{path}\"\n end\n else\n raise ArgumentError, \"No such gem: #{gemname}\"\n end\n self\n end",
"def hook_require!\n @hooking_require = true\n\n # There are two independent require methods. Joy!\n ::Kernel.module_eval do\n class << self\n orig_public_require = Kernel.public_method(:require)\n define_method(:require) do |path, *args|\n ::Bumbler::Hooks.handle_require(path) do\n orig_public_require.call(path, *args)\n end\n end\n end\n\n orig_instance_require = self.instance_method(:require)\n define_method(:require) do |path, *args|\n ::Bumbler::Hooks.handle_require(path) do\n orig_instance_require.bind(self).call(path, *args)\n end\n end\n end\n\n @hooking_require = nil\n end",
"def gem(name, args = {})\n add_command(:gem, name, args)\n end",
"def local_require(lib)\n load_local_gem(lib)\n require(lib)\n end",
"def install(gem_name,\n\tversion_requirement = \"> 0.0.0\",\n\tforce=false,\n\tinstall_dir=Gem.dir,\n\tinstall_stub=true)\n unless version_requirement.respond_to?(:satisfied_by?)\n version_requirement = Version::Requirement.new(version_requirement)\n end\n installed_gems = []\n caches = source_index_hash\n spec, source = find_gem_to_install(gem_name, version_requirement, caches)\n dependencies = find_dependencies_not_installed(spec.dependencies)\n installed_gems << install_dependencies(dependencies, force, install_dir)\n cache_dir = File.join(install_dir, \"cache\")\n destination_file = File.join(cache_dir, spec.full_name + \".gem\")\n download_gem(destination_file, source, spec)\n installer = new_installer(destination_file)\n installed_gems.unshift installer.install(force, install_dir, install_stub)\n installed_gems.flatten\n end",
"def initialize(gem_name = :all)\n @gem_name = gem_name\n @impacts = {}\n end",
"def plugin_gem(name, options = {})\n lib, version = options.values_at(:lib, :version)\n begin\n Kernel.send :gem, name, version\n rescue Gem::LoadError\n dir = File.dirname(caller.first.split(':').first)\n $: << File.expand_path(\"#{dir}/../vendor/gems/#{name}-#{version.gsub(/[^\\d\\.]*/, '')}/lib\")\n end\n require(lib || name)\n end",
"def activate_requirements(library, development=false, checklist={})\n reqs = development ? library.requirements : library.runtime_requirements\n\n checklist[library] = true\n\n reqs.each do |req|\n name = req['name']\n vers = req['version']\n\n library = activate(name, vers)\n\n activate_requirements(library, development, checklist) unless checklist[library]\n end\n\n library\n end",
"def gem( name, *requirements, **options )\n\t\tif options[:group] == :development ||\n\t\t\toptions[:groups]&.include?( :development ) ||\n\t\t\tself.current_groups.include?( :development )\n\n\t\t\trequirements.push( :development )\n\t\tend\n\n\t\tdependency = Gem::Dependency.new( name, *requirements )\n\n\t\tself.dependencies.add( dependency )\n\tend",
"def gem(name, main_module)\n _, spec = Gem.loaded_specs.find { |spec_pair| spec_pair[0] == name }\n gems << spec\n modules << main_module\n spec.full_gem_path\n end",
"def hook_require!\n @hooking_require = true\n\n # There are two independent require methods. Joy!\n ::Kernel.prepend RequireLogger\n (class << ::Kernel; self; end).prepend RequireLogger\n\n @hooking_require = nil\n end",
"def activate\n imp = import(\"imp\")\n imp.load_source(\"activate_this\",\n File.join(File.dirname(RubyPython::Python::EXEC.python),\n \"activate_this.py\"))\n end",
"def for_gem\n called_from = caller_locations(1, 1).first.path\n Registry.loader_for_gem(called_from)\n end",
"def depends_on(mod)\n @log.info \"Loading module '#{mod}' as a dependency\"\n loaded = require \"#{File.dirname(__FILE__)}/modules/#{mod.to_s}.rb\"\n @log.info \"Module '#{mod}' already loaded, not re-loading\" if !loaded\nend",
"def handle_require(path, &block)\n # break out early if we're already handling this\n return yield if path == @previous_require\n @previous_require = path\n\n # Shortcut unless we're tracking the gem\n gem_name = Bumbler::Bundler.gem_for_require(path)\n return yield unless gem_name\n\n # Track load starts\n Bumbler::Bundler.require_started(path) unless @previous_gems[gem_name]\n @previous_gems[gem_name] = true\n\n time, result = benchmark(path, &block)\n\n Bumbler::Bundler.require_finished(path, time) if result\n\n result\n end",
"def AddModuleToLoad(name)\n Builtins.y2milestone(\"Adding module to be loaded at boot: %1\", name)\n @kernel_modules_to_load = Builtins.add(\n @kernel_modules_to_load,\n { \"operation\" => \"add\", \"name\" => name }\n )\n\n nil\n end",
"def activate!\n @include_dirs.each do |dir|\n $LOAD_PATH << dir if File.directory?(dir)\n end\n\n # use Bundler if a Gemfile is present\n bundle! unless @bundle.empty?\n\n return true\n end",
"def reload!\n gem_files = $LOADED_FEATURES.select { |f| f =~ /\\/#{@gem_name}/ }\n gem_files.each { |f| load f }\n end",
"def loaded?(gem_name)\n @gems.has_key? gem_name\n end",
"def require_without_bundler(*gems)\n unless defined?(::Bundler)\n gems.each { |g| require g }\n return\n end\n Dir.glob(\"#{Gem.path.first}/gems/*\").map { |gem_path| \n gem_name=File.basename(gem_path).gsub(/-(\\d\\.?)+$/,'')\n if gems.include?(gem_name)\n $LOAD_PATH << \"#{gem_path}/lib\"\n require gem_name\n end\n }\nend",
"def install_gem(name, opts = {})\n defaults = {}\n defaults[:cache] = false unless gem_dir\n defaults[:install_dir] = gem_dir if gem_dir\n Merb.install_gem(name, defaults.merge(opts))\n end",
"def gem_name=(name)\n @gem_name = name\n end",
"def install_gem; end",
"def install_gem(gem_name, options = {})\n if options[:group]\n gem gem_name, group: options[:group]\n else\n gem gem_name\n end\n run_command \"gem install #{gem_name}\"\n run_command 'bundle install --local'\nend",
"def add_hardcoded_gem(path)\n # make sure gem dir has a gemspec\n gemspec = File.join path, File.basename(path) + '.gemspec'\n return unless File.exists? gemspec\n # make sure gem dir has a lib dir\n libpath = File.join path, 'lib'\n return unless File.exists? libpath\n # all is ok, so add to loadpath\n @paths << libpath\n end",
"def gemspec\n @gemspec ||= begin\n raise Error.new(\"Unable to automatically determine gem name from specs in #{base}. Please set the gem name via #{self.class.name}.install_tasks(gem_name: 'name')\") unless gem_name\n g = Bundler.load_gemspec(File.join(base, gem_name+'.gemspec'))\n # This is returning the path it would be in if installed normally,\n # override so we get the local path. Also for reasons that are entirely\n # beyond me, #tap makes Gem::Specification flip out so do it old-school.\n g.full_gem_path = base\n g\n end\n end",
"def reset_gem_specs!\n return unless Gem.loaded_specs.keys.include?('locomotivecms_wagon')\n\n core_gems = %w(did_you_mean).freeze\n\n Gem.loaded_specs.values.each do |spec|\n next if core_gems.include?(spec.name)\n spec.full_require_paths.each do |path|\n $LOAD_PATH.delete(path)\n end\n\n # Without this statement, bundler will raise the infamous \"You have already activated ...\"\n Gem.loaded_specs.delete(spec.name)\n end\nend",
"def load_gem_plugins; end",
"def require_if_available(name)\n require name\nrescue LoadError\n false\nend",
"def load_gems(an_array_of_strings)\n\n print \"Installing gems as necessary ... \" if $debug\n gemfile do\n source 'https://rubygems.org'\n Array(an_array_of_strings).each do |gem_name|\n print gem_name + ' ' if $debug\n gem gem_name\n end\n end\n\n puts 'done' if $debug\n\nend",
"def require_library_or_gem(library_name)\n begin\n require library_name\n rescue LoadError => cannot_require\n # 1. Requiring the module is unsuccessful, maybe it's a gem and nobody required rubygems yet. Try.\n begin\n require 'rubygems'\n rescue LoadError => rubygems_not_installed\n raise cannot_require\n end\n # 2. Rubygems is installed and loaded. Try to load the library again\n begin \n require library_name\n rescue LoadError => gem_not_installed\n raise cannot_require\n end\n end\nend",
"def depend_on( name, version = nil )\n spec = Gem.source_index.find_name(name).last\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend",
"def gem_if_necessary(gem)\n grep = args = nil\n if gem =~ /(.*)-(\\d+\\.\\d+\\.\\d+)$/\n gem, version = $1, $2\n grep = \"^#{gem}.*#{version}\"\n args = \" --version #{version}\"\n else\n grep = \"^#{gem}\"\n end\n if fails?(\"gem list #{gem} | grep '#{grep}'\")\n banner \"#{gem}...\"\n run \"gem install #{gem} #{args} --no-rdoc --no-ri\"\n return true\n end\n false\n end",
"def depend_on( name, version = nil )\n spec = Gem::Specification.find_by_name(name)\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend",
"def dep name, opts = {}, &block\n Base.sources.current_load_source.deps.add name, opts, block\n end",
"def add_gem_with_query(gem_name, gem_options={}, generator_command=nil, &block)\n if yes?(\"Would you like to install #{gem_name}? (y/n)\")\n add_gem(gem_name, gem_options, generator_command, &block)\n end\n end",
"def add_to_load_path\n Gem.source_index.load_gems_in(*Gem::SourceIndex.installed_spec_directories | [ruby_spec_path, arch_spec_path])\n end",
"def check_version_conflict(other) # :nodoc:\n return if self.version == other.version\n\n # This gem is already loaded. If the currently loaded gem is not in the\n # list of candidate gems, then we have a version conflict.\n\n msg = \"can't activate #{full_name}, already activated #{other.full_name}\"\n\n e = Gem::LoadError.new msg\n e.name = self.name\n\n raise e\n end",
"def activate environment = nil\n enable unless enabled?\n fire :activating\n\n env = (environment || Isolate.env).to_s\n\n install env if install?\n\n entries.each do |e|\n e.activate if e.matches? env\n end\n\n cleanup if cleanup?\n fire :activated\n\n self\n end",
"def install_jgem(gem_built_name)\n execute(:install_jgem, \"jgem install #{gem_built_name}\")\n end",
"def activate_plugin_deps\n Hoe.plugins.each do |plugin|\n msg = \"activate_#{plugin}_deps\"\n warn msg if $DEBUG\n send msg if self.respond_to? msg\n end\n end",
"def util_bake_gem(name = \"a\", *extra, &block)\n files = [\"lib/#{name}.rb\"].concat(extra)\n\n spec = if Gem::VERSION >= \"3.0.0\"\n util_spec name, \"1\", nil, files, &block\n else\n new_spec name, \"1\", nil, files, &block\n end\n\n util_build_gem spec\n\n spec.cache_file\n end",
"def require_bootsnap\n inject_into_file 'config/boot.rb', after: \"require 'bundler/setup' # Set up gems listed in the Gemfile.\\n\" do\n \"require 'bootsnap/setup'\\n\"\n end\n end",
"def install(gem)\n version = gem['version'] == '> 0' ? '' : \"#{gem['version']} \"\n Utils.message \"\\n\"\n if preinstalled?(gem)\n Utils.message \"-----> Skipping #{gem['name']} #{version} - this gem is installed by default on Heroku\\n\"\n else\n proxy = Utils.slot =~ /codex/ ? \"--http-proxy http://localhost:3128\" : \"\"\n command = [\n \"export PATH=#{@slug.ruby_path};\",\n \"export GEM_HOME=#{@slug.gems_build_dir};\",\n \"gem install\",\n escape(gem['name']),\n proxy,\n \"--no-ri\",\n \"--no-rdoc\",\n \"--version=#{escape(gem['version'])}\",\n gem['source'].map {|s| \"-s #{escape(s)}\"}.join(\" \"),\n (\"--ignore-dependencies\" if gem[\"ignore-dependencies\"])\n ].compact.join(\" \")\n Utils.message \"-----> Installing gem #{gem['name']} #{version}from #{gem['source'].join(\", \")}#{\" and ignoring dependencies\" if gem['ignore-dependencies']}\\n\"\n exec_gem_install_command(command)\n end\n end"
] |
[
"0.8087241",
"0.7445291",
"0.7396846",
"0.69495565",
"0.69286793",
"0.68840724",
"0.6837962",
"0.6800851",
"0.6800851",
"0.6800851",
"0.67125195",
"0.6707811",
"0.66649485",
"0.65723765",
"0.64063674",
"0.6296348",
"0.62947893",
"0.6237528",
"0.6192786",
"0.61912787",
"0.61551493",
"0.6154228",
"0.6149386",
"0.61055326",
"0.6101967",
"0.6068003",
"0.59292877",
"0.59216994",
"0.5913278",
"0.5891173",
"0.5862834",
"0.5846206",
"0.5818649",
"0.58177185",
"0.5809743",
"0.578004",
"0.5766102",
"0.5762046",
"0.5759596",
"0.572946",
"0.5725817",
"0.57210743",
"0.5720246",
"0.56865174",
"0.5652367",
"0.5581089",
"0.55779076",
"0.55779076",
"0.55761987",
"0.5574626",
"0.55640507",
"0.55521923",
"0.554802",
"0.5544773",
"0.5528066",
"0.5505873",
"0.54924035",
"0.54684836",
"0.54624224",
"0.546214",
"0.5457963",
"0.545397",
"0.5448315",
"0.54244184",
"0.541076",
"0.54082096",
"0.5390377",
"0.53865886",
"0.5373098",
"0.53655404",
"0.53483295",
"0.5344417",
"0.53362465",
"0.53353983",
"0.5334433",
"0.5321126",
"0.53163445",
"0.5296121",
"0.52912915",
"0.52870464",
"0.5283329",
"0.5274555",
"0.5267372",
"0.52335215",
"0.52258754",
"0.5218917",
"0.5217917",
"0.521076",
"0.52051365",
"0.52016544",
"0.5197763",
"0.51867414",
"0.5184438",
"0.5176702",
"0.51704925",
"0.5167398",
"0.51613253",
"0.51607704",
"0.5154308",
"0.51497483"
] |
0.6941849
|
4
|
Constructs and initializes the board of given size
|
def initialize(size, startPlayer, discColor)
# validate arguments
if size < 4 || size > 8 || size % 2 != 0
raise ArgumentError.new('Invalid value for board size.')
end
if startPlayer < 1 || startPlayer > 2
raise ArgumentError.new('Invalid value for player number.')
end
if discColor != WHITE && discColor != BLACK
raise ArgumentError.new('Invalid value for disc.');
end
# set instance variables
@board = []
@size = size
@turn = startPlayer
@disc = discColor
# set two more instance variables @p1Disc and @p2Disc
if @turn == 1
@p1Disc = @disc
@p2Disc = @disc == WHITE ? BLACK : WHITE
else
@p2Disc = @disc
@p1Disc = @disc == WHITE ? BLACK : WHITE;
end
# create the grid (as array of arrays)
@board = Array.new(@size)
for i in (0...@board.length)
@board[i] = Array.new(@size)
@board[i].fill(0)
end
# initialize the grid
initializeBoard()
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(size)\n @board_size = size\n @board = []\n @board_size.times { @board << Array.new(@board_size, EMPTY_SYMBOL) }\n end",
"def fill_board(size)\n board = []\n board_rows = []\n size.times {|i| board_rows << i}\n size.times {board << board_rows}\n @board = board\n end",
"def initialize(size)\n @board = Array.new(size[0])\n @board.each_index do |i|\n @board[i] = Array.new(size[1])\n end\n end",
"def initialize(size)\n @board = Array.new(size) {Array.new(size){ '*' } }\n end",
"def initialize(grid_size)\n @grid_size = grid_size\n @cell_ct = (grid_size * 2) + 1\n @board = Array.new(cell_ct){Array.new(cell_ct)}\n\n populate_board_guide(board)\n end",
"def initialize(row_size=3)\n @row_size = row_size\n @board = Array.new(@row_size) {Array.new(@row_size, 0)}\n end",
"def init_board(size=5, handicap=0)\n @game = GameLogic.new\n @game.new_game(size, handicap)\n @goban = @game.goban\n @grid = Grid.new(size)\n @filler = ZoneFiller.new(@goban, @grid)\n end",
"def initialize_board\n board = Array.new(8) {Array.new(8)}\n populate_board(board)\n end",
"def initializeBoard()\n\t\tfor i in (0...@board.length)\n\t\t\tfor j in (0...@board.length)\n\t\t\t\t@board[i][j] = EMPTY\n\t\t\tend\n\t\tend\n\n\t\t@board[@size/2][@size/2] = BLACK\n\t\t@board[@size/2 - 1][@size/2 - 1] = BLACK\n\t\t@board[@size/2 - 1][@size/2] = WHITE\n\t\t@board[@size/2][@size/2 - 1] = WHITE\n\n end",
"def initialize \n @rows = 8\n @columns = 8\n @grid = create_board\n end",
"def create_board(size)\n return (0...size).map{|b| (0...size).map{|bb| 0}}\n end",
"def initializeBoard()\n #\n # TO DO: complete this method\n #\n for j in 0...@size\n for i in 0...@size\n @board[j][i]=EMPTY\n end\n end\n center = (@size/2)-1\n @board[center][center] = BLACK\n @board[center+1][center+1] = BLACK\n @board[center+1][center] = WHITE\n @board[center][center+1] = WHITE\n\n\n\n\n end",
"def initialize(size=10, max_height=5)\n if !size.positive?\n raise ArgumentError, \"Board size must be greater than zero!\"\n else\n @size = size\n @max_height = max_height\n @min_word_length = 2\n @grid = Hash.new do |h, (row, col)|\n if row < 0 || col < 0 || num_rows <= row || num_columns <= col\n raise IllegalMove, \"#{row}, #{col} is out of bounds!\"\n else\n h[[row, col]] = [] # Initialize with empty array\n end\n end\n end\n end",
"def create_board(size, num_mines)\n\t\tfinal_board = []\n\t\t# Create outer loop\n\t\t1.upto(size) do |row|\n\t\t\trow_buffer = []\n\t\t\t# Create inner loop\n\t\t\t1.upto(size) do |column|\n\t\t\t\trow_buffer << Square.new([column,((size+1)-row)], size)\n\t\t\tend\n\t\t\t# Once each row is composed add it to \n\t\t\t# the final board.\n\t\t\tfinal_board << row_buffer\n\t\tend\n\t\tset_mines(final_board, num_mines) # Now that we have the board, lets add some mines\n\t\tfinal_board\n\tend",
"def initialize(args={})\n @size = args[:size] || 10\n @seed = args[:seed] || 20\n raise ArgumentError, \"seed is larger than board size (size**2)\" if size**2 < seed\n @born = 0\n @died = 0\n @prospered = 0\n\n @board = Table.new(rows: size, cols: size, obj: Cell)\n #seed_board\n end",
"def initializeBoard()\n\n # TO DO: COMPLETE THIS METHOD\n maxMid = @size / 2\n minMid = @size / 2 - 1\n for i in 0..size-1\n for j in 0..size-1\n if i == maxMid && j == maxMid\n @board[i][j] = \"B\"\n elsif i == minMid && j == minMid\n @board[i][j] = \"B\"\n elsif (i == minMid || i == maxMid) && (j == maxMid || j == minMid)\n @board[i][j] = \"W\"\n else\n @board[i][j] = \"-\";\n end\n end\n end\n end",
"def initialize(boardSize)\n\t\t\t@moves = Array.new\n\t\t\t@size = boardSize\n\t\tend",
"def create_board\n cols = Array.new(7) { Array.new(6, 0) }\n cols\n end",
"def initialize(size, startPlayer, discColor)\n\t\t# validate arguments\n\t\tif size < 4 || size > 8 || size % 2 != 0\n\t\t\traise ArgumentError.new('Invalid value for board size.')\n\t\tend\n\t\tif startPlayer < 1 || startPlayer > 2\n\t\t\traise ArgumentError.new('Invalid value for player number.')\n\t\tend\n\t\tif discColor != WHITE && discColor != BLACK\n\t\t\traise ArgumentError.new('Invalid value for disc.');\n\t\tend\n\n\t\t# set instance variables\n @board = []\n\t\t@size = size\n\t\t@turn = startPlayer\n\t\t@disc = discColor\n\n\t\t# set two more instance variables @p1Disc and @p2Disc\n\t\tif @turn == 1\n\t\t\t@p1Disc = @disc\n\t\t\t@p2Disc = @disc == WHITE ? BLACK : WHITE\n\t\telse\n\t\t\t@p2Disc = @disc\n\t\t\t@p1Disc = @disc == WHITE ? BLACK : WHITE;\n\t\tend\n\n\t\t# create the grid (as array of arrays)\n\t\t@board = Array.new(@size)\n\t\tfor i in (0...@board.length)\n\t\t\t@board[i] = Array.new(@size)\n\t\t\t@board[i].fill(0)\n\t\tend\n\n\t\t# initialize the grid\n\t\tinitializeBoard()\n\tend",
"def initialize(size, startPlayer, discColor)\n\t\t# validate arguments\n\t\tif size < 4 || size > 8 || size % 2 != 0\n\t\t\traise ArgumentError.new('Invalid value for board size.')\n\t\tend\n\t\tif startPlayer < 1 || startPlayer > 2\n\t\t\traise ArgumentError.new('Invalid value for player number.')\n\t\tend\n\t\tif discColor != WHITE && discColor != BLACK\n\t\t\traise ArgumentError.new('Invalid value for disc.');\n\t\tend\n\n\t\t# set instance variables\n @board = []\n\t\t@size = size\n\t\t@turn = startPlayer\n\t\t@disc = discColor\n\n\t\t# set two more instance variables @p1Disc and @p2Disc\n\t\tif @turn == 1\n\t\t\t@p1Disc = @disc\n\t\t\t@p2Disc = @disc == WHITE ? BLACK : WHITE\n\t\telse\n\t\t\t@p2Disc = @disc\n\t\t\t@p1Disc = @disc == WHITE ? BLACK : WHITE;\n\t\tend\n\n\t\t# create the grid (as array of arrays)\n\t\t@board = Array.new(@size)\n\t\tfor i in (0...@board.length)\n\t\t\t@board[i] = Array.new(@size)\n\t\t\t@board[i].fill(0)\n\t\tend\n\n\t\t# initialize the grid\n\t\tinitializeBoard()\n\tend",
"def initialize\n @board = (0...8).map { [nil] * 8 }\n populate_board\n\n\tend",
"def create_board\n\t\t8.times{|x| @board.push([nil,nil,nil,nil,nil,nil,nil,nil])}\n\t\tpopulate_board\n\tend",
"def initialize\n\n\t\t# Set up some default values here; things like the size of board,\n\t\t# level of complexity and suchlike.\n\t\t@board_size = :small\n\t\t@board_level = 1\n\t\tsize \n\t\trender_board\n\n\tend",
"def initialize(size)\n @grid = Array.new(size) {Array.new(size, :N)}\n @size = size * size\n end",
"def setup_board!\n\t\t@board = Array.new($dimensions[:y]){ Array.new($dimensions[:x]) {:empty} }\n\tend",
"def initialize(setup = true)\n @board = Array.new(8) {Array.new(8)}\n setup_board if setup\n end",
"def populate_board\n rows_of_pieces = (size - 2) / 2\n make_pieces([0, 1], 'red', rows_of_pieces, 1)\n make_pieces([size - 1, 0], 'black', rows_of_pieces, -1)\n end",
"def create_board\n\n 8.times do |row|\n 8.times do |col|\n new_cell = Cell.new([col + 1, row + 1])\n @@cells.push(new_cell)\n end\n end\n\n end",
"def initialize(size = 3)\n @size = size\n @grid = Array.new(size) { Array.new(size) }\n end",
"def build_grid size\n self.tiles.clear\n size.to_i.times do |row|\n size.to_i.times do |column|\n self.tiles.build({\n x: column,\n y: row\n })\n end\n end\n end",
"def initialize(size)\n @size = size\n @matrix = generate_matrix\n end",
"def initialize\n\t\t\t@empty_cell = '_'\n\t\t\t@board = Array.new(3) {Array.new(3,@empty_cell)}\n\t\tend",
"def build_board(board_length, board_height)\n (board_height).times do\n row = []\n (board_length).times do\n row << \" \"\n end\n @board << row\n end\n end",
"def initialize\n @@BOARD_SIZE = 8\n @board = create_board\n @god_mode = false\n end",
"def initialize(fill_board = true)\n @grid = Array.new(8) { Array.new(8) }\n\n setup_grid if fill_board\n end",
"def initialize(size = 10)\n @size = size\n @ship_squares = []\n @squares = Array.new(size) do |y|\n Array.new(size) { |x| Square.new(self, x, y) }\n end\n end",
"def initialize size\n raise \"Size must be odd\" unless size%2 == 1\n @size = size\n @square = build_square size\n self\n end",
"def initialize(size)\n @board_size = size\n @matched_cards = {}\n @known_cards = {} \n @previous_guess = nil\n end",
"def create\n (0..7).each do |row|\n @board << []\n (0..7).each do |col| \n @board[row] << \"[ ]\"\n end\n end\n end",
"def generate_board\n [0, 1, 2].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :B) if offset.odd?\n end\n end\n\n [5, 6, 7].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :W) if offset.odd?\n end\n end\n end",
"def initialize ()\n\t\t@board = [\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \" ,\" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" X \", \" O \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" O \", \" X \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \"]\n\t\t@board_arr\t\t= Array(0..@board.length-1)\n\t\t@board_height\t= 8\n\t\t@board_width \t= 8\n\tend",
"def initialize(fill_board = true)\n @sentinel = Null_piece.instance\n\n @rows = Array.new(8) { Array.new(8, @sentinel) }\n\n fill_board_tiles if fill_board\n end",
"def initialize()\n @board = {}\n colors = [Square::BLACK, Square::WHITE]\n \n (1..8).each do |row|\n (1..8).each do |col|\n sq = Square.new(colors[0])\n\n # Place starting pieces on board\n if (1..3).include?(row) && sq.color == Square::BLACK\n sq.checker_piece = Piece.new(Piece::BLACK)\n elsif (6..8).include?(row) && sq.color == Square::BLACK\n sq.checker_piece = Piece.new(Piece::RED)\n end\n \n @board[[row,col]] = sq\n \n colors << colors.delete_at(0) unless col == 8\n end\n end\n end",
"def initialize(initial_board=nil)\n\t\t@size = initial_board && initial_board.length || 10\n\t\t@initial_board = initial_board # used when existing patterns are passed\n\t\t@cells = []\n\t\t\n\t\tif @initial_board\n\t\t\t@size.times do |x|\n\t\t\t\t@cells.push([])\n\t\t\t\t@size.times do |y|\n\t\t\t\t\t@cells[x].push(Cell.new(self, x, y, @initial_board[x][y]))\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\t@size.times do |x|\n\t\t\t\t@cells.push([])\n\t\t\t\t@size.times do |y|\n\t\t\t\t\t@cells[x].push(Cell.new(self, x, y))\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\tend",
"def initialize(width: 100, height: 100, size: 5)\n @width = width.clamp(0, 1000) # width of cell grid\n @height = height.clamp(0, 1000) # height of cell grid\n @size = size.clamp(3, 100) # size of each cell on viewport\n\n # calculate game viewport size\n @viewport_width = width * size\n @viewport_height = height * size\n\n # setup game environment\n @environment = Environment.new(\n width: width,\n height: height\n )\n\n # populate environment with random\n # population of live cells\n @environment.seed_random\n\n # setup tick\n @tick = Tick.new(@environment)\n\n # setup gosu window config\n super @viewport_width, @viewport_height\n self.caption = \"Game of Life\"\n end",
"def initialize\n self.make_board\n end",
"def initialize\n @board = Array.new(3) { Array.new(3) }\n end",
"def initialize\n @board = Array.new(3) { Array.new(3) }\n end",
"def newBoard\n\t\t\t[['r', 'n', 'b', 'k', 'q', 'b', 'n', 'r'],\n\t\t\t ['p', 'p', 'p', 'p', 'p', 'p', 'p', 'p'],\n\t\t\t ['', '', '', '', '', '', '', ''],\n\t\t\t ['', '', '', '', '', '', '', ''],\n\t\t\t ['', '', '', '', '', '', '', ''],\n\t\t\t ['', '', '', '', '', '', '', ''],\n\t\t\t ['P', 'P', 'P', 'P', 'P', 'P', 'P', 'P'],\n\t\t\t ['R', 'N', 'B', 'K', 'Q', 'B', 'N', 'R']]\n\tend",
"def initialize(size, ptn = nil)\n @size = size\n @board = generate_board(ptn)\n\n @white_piece_set = Tak::PieceSet.new(board_size: size)\n @black_piece_set = Tak::PieceSet.new(board_size: size)\n\n @piece_sets = {\n white: white_piece_set,\n black: black_piece_set\n }\n end",
"def initialize\n @board=Array.new(9) {Array.new(9, false)}\n self.populate_mines\n self.fill_up_board_with_tiles\n @game_over = false\n end",
"def initialize()\n @board = {}\n colors = [Square::BLACK, Square::WHITE]\n\n (1..8).each do |row|\n (1..8).each do |col|\n\n # Place starting pieces on board\n if (1..3).include?(row) && Square.new(colors[0]).color == Square::BLACK\n Square.new(colors[0]).checker_piece = Piece.new(Piece::BLACK)\n elsif (6..8).include?(row) && Square.new(colors[0]).color == Square::BLACK\n Square.new(colors[0]).checker_piece = Piece.new(Piece::RED)\n end\n\n @board[[row,col]] = Square.new(colors[0])\n\n colors << colors.delete_at(0) unless col == 8\n end\n end\n end",
"def init_board\n @board =\n if board_state.present?\n Board.new(width: rows, height: cols, mines_count: mines).tap do |b|\n b.load_state!(board_state)\n end\n else\n Board.new(width: rows, height: cols, mines_count: mines).tap do |b|\n b.setup!\n end\n end\n end",
"def create_board\n\t\t@board = Hash.new\n\t\t(0..7).each do |x|\n\t\t\t@board[x] = []\n\t\t\t(0..7).each do |y|\n\t\t\t\t@board[x][y] = Square.new([x, y])\n\t\t\tend\n\t\tend\n\tend",
"def initialize(pop = true)\n @board = Array.new(8) { Array.new(8) }\n populate_board if pop\n end",
"def initialize\n @board = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\n end",
"def initialize(empty = false)\n @white_points = []\n @black_points = []\n return if empty\n\n @board = []\n 8.times do\n col = []\n 8.times do\n col << SPOT_OPEN\n end\n @board << col\n end\n\n # Add the starting pieces\n mark(3, 3, SPOT_WHITE)\n mark(4, 3, SPOT_BLACK)\n mark(4, 4, SPOT_WHITE)\n mark(3, 4, SPOT_BLACK)\n end",
"def initialize\n # The board is an array of rows, each containing an array of cells\n @board = Array.new(BOARD_HEIGHT){Array.new(BOARD_WIDTH)}\n @board.each_with_index do |y, yi|\n y.each_with_index do |x, xi|\n @board[yi][xi] = \".\"\n end\n end\n end",
"def make_board\n board = Array.new(8) { Array.new(8) { Array.new(2) } }\n board.each_with_index do |row, row_i|\n row.each_with_index { |column, column_i| column[0], column[1] = row_i, column_i }\n end\n end",
"def initialize\n\t\t@board = []\n\t\t3.times do |i|\n\t\t\t@board[i] = []\n\t\t\t3.times do\n\t\t\t\t@board[i] << 0\n\t\t\tend\n\t\tend\n\tend",
"def initialize\n\t\t@board=Hash.new \n\t\t(0..6).each{ |i|\n\t\t\t(0..6).each{ |j|\n\t\t\t\t@board[[i,j]]=Cell.new(0,0,\"\")\n\t\t\t}\n\t\t}\n\t\t#==== intitial cells\n\t\t@board[[1,1]].value=2\n\t\t@board[[2,3]].value=4\n\t\t@move_result=0\n\tend",
"def generate_board\n board_array = @board_string.split(\"\")\n @board = Array.new(9){board_array.shift(9)}\n for row in 0...@board.length\n for col in 0...@board.length\n @board[row][col] = Square.new(@board[row][col], row, col)\n end\n end\n create_starting_numbers\n @board\n end",
"def initialize()\n grid = BOARD_NUMBERS.map{ |x| BOARD_ALPHABET.map{ |y| y + x}}.flatten\n @board = Hash[grid.collect { |k| [k, EMPTY]} ]\n end",
"def initialize(size)\n @size = size\n @rows = Array.new(size) { Array.new(size) }\n end",
"def initialize\n @@cells = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n display_board\n end",
"def initialize\r\n @board = Array.new(9, \" \") \r\n end",
"def initialize\n\n\t\t@width = 8\n\t\t@height = 8\n\t\t@board = Array.new(@height){Array.new(@width)}\n\n\t\t# inicializamos en board con guiones (vacio\n\t\tfor file in (0..@width-1)\n\t\t\tfor column in (0..@height-1)\n\t\t\t\t@board[file][column] = \"--\"\n\t\t\tend\n\t\tend\n\tend",
"def initBoard\n cellNum = 0\n while cellNum < (@columns * @rows)\n @board.push(rand < @genWeighting ? 1 : 0)\n cellNum += 1\n end\n @board\n end",
"def initialize\n\t\t@width = 5\n\t\t@height = 5\n\t\t@cells = [[0,0,1,0,0],[0,1,1,1,0],[0,1,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]\n\tend",
"def initialize (width=7)\n @grid = Array.new(width) {[]}\n\n end",
"def initialize\n\t\t@rows = 8\n\t\t@cols = 8\n\t\t@grid = Array.new(rows) { Array.new(cols) }\n\tend",
"def initialize(size)\n @cells = []\n for i in 1..size\n new_cell = Cell.new(false)\n @cells << new_cell\n end # end cell initialization loop\n\n end",
"def initialize_board\n b = []\n 9.times { b << ' ' } \n b\nend",
"def initialize\n @grid = empty_board\n end",
"def new_board\n board = []\n 8.times do |row|\n board << case row\n when 0\n add_back_row(\"white\", row)\n when 1\n add_pawn_row(\"white\", row)\n when 6\n add_pawn_row(\"black\", row)\n when 7\n add_back_row(\"black\", row)\n else\n Array.new(8)\n end\n end \n board\n end",
"def create_board\n (1..(@width * @width).to_i).each do |i|\n values = i <= @amount_mines ? @bomb : @empty\n @board.push({\n value: values,\n revealed?: false\n })\n end\n @board.shuffle!\n @board\n end",
"def make_board\n make_blank_board\n populate_board\n end",
"def initialize\n @board_array = [[],[],[],[],[],[],[],[],[],[]]\n # tile_board\n # set_mines\n end",
"def initialize_board\n init_board = \"-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1\"\n if self.update(board: init_board)\n return [[ 0,-1,0,-1,0,-1, 0,-1 ],[-1,0,-1,0,-1,0,-1,0],[0,-1,0,-1,0,-1,0,-1],\n [0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],\n [1,0,1,0,1,0,1,0],[0,1,0,1,0,1,0,1],[1,0,1,0,1,0,1,0]]\n end\n end",
"def initialize\n @board = Array[]\n initializeTop\n initializeMiddle\n initializeBottom\n end",
"def initialize(seeds)\n @grid = Array.new(9) { Array.new(9, nil) }\n @rows = {}\n @columns = {}\n @squares = {}\n 1.upto(9) do |i|\n @rows[i] = Hash.new(false)\n @columns[i] = Hash.new(false)\n @squares[i] = Hash.new(false)\n end\n seed_board(seeds)\n end",
"def init_board(n, def_val)\n\t\tArray.new(n) { Array.new(n) { def_val } }\n\tend",
"def populate_board(board)\n #Fills in the top and bottom rows\n [0, 7].each do |row|\n 4.times do |col|\n board[row][col] = create_piece(row, col)\n board[row][(7-col)] = create_piece(row, (7-col))\n end\n end\n\n #Fills in the pawns\n 8.times do |col|\n board[1][col] = BlackPawn.new(1, col)\n board[6][col] = WhitePawn.new(6, col)\n end\n\n board\n end",
"def initialize(size)\n @cells = Array.new(size) { Array.new(size, Cell.new()) }\n @not_all_dead = true\n end",
"def build_square size\n #starting positions\n x,y = size/2,0\n\n # build square\n (1..size**2).inject(Array.new(size){[]}) do |arr,i|\n\n # store current number in square\n arr[y][x] = i\n\n # move up and left\n x = (x+1)%size\n y = (y-1)%size\n\n # undo move and move down if space is taken\n if arr[y][x]\n y = (y+2)%size\n x = (x-1)%size\n end\n arr\n end\n end",
"def initialize\n @piece_count = 0\n\n @grid = []\n (0..6).each do |col|\n @grid[col] = []\n (0..5).each do |row|\n @grid[col][row] = \"-\"\n end\n end\n end",
"def starting_board\n init_rows([0, 2], :black)\n init_rows([5, 7], :red)\n end",
"def set_board\n @canvas = GameCanvas.new\n @board = Board.new(self)\n @canvas.place(@board.block_size * @board.num_rows,\n @board.block_size * @board.num_columns, 10, 10)\n @board.draw\n end",
"def initialize board\n @board = board\n end",
"def initialize(setup)\n @grid = Array.new(8) { Array.new(8, nil)}\n\n if setup\n setup_pieces\n end\n end",
"def initialize\n @board = Array.new(8) { Array.new(8) }\n @all_pieces = []\n @board_history = []\n @move_record = []\n end",
"def initialize board = nil, turn = \"x\"\n\t\t@dim = 3\n\t\t@size = @dim * @dim \n\t\t@board = board || Array.new(@size, \"-\")\n\t\t@turn = turn\n\t\t@movelist = []\n\tend",
"def initialize\n\t\t# Pour désigner une case : @board[i][j] avec i = ligne, j = colonne\n\t\t@board = Array.new(4, nil)\n\t\t@board.map! {|line| Array.new(4, nil)}\n\t\t\n\t\t# Utilisation des lignes et colonnes 0 pour l'affichage : \n\t\t(1..3).each { |col| @board[0][col] = \"#{col}\" }\n\t\t(1..3).each {|line| @board[line][0] = ([\"A\",\"B\",\"C\"][line-1])}\n\t\t@board[0][0] = \" \"\n\n\t\t# Initialisation des 9 BoardCase\n\t\t(1..3).each {|col|\n\t\t\t\t(1..3).each { |line|\n\t\t\t\t\t@board[line][col] = BoardCase.new\n\t\t\t\t}\n\t\t}\n\tend",
"def setup_board\n gameboard.build_board\n build_white_side\n build_black_side\n end",
"def initialize(board = nil)\n # Creates a new array that's 9 units in length\n # and all filled in with the blank string \" \".\n @board = board || Array.new(9, \" \")\n end",
"def map_board\n\t\t@cell_at = []\n\t\t@height.times do |row|\n\t\t\t@cell_at[row] = []\n\t\t\t@width.times do |col|\n\t\t\t\t@cell_at[row][col] = Cell.new\n\t\t\tend\n\t\tend\n\tend",
"def create_grid_from_size(size_arr)\n rows = size_arr[0]\n columns = size_arr[1]\n Array.new(rows) { Array.new(columns) }\n end",
"def make_board\n @grid = Array.new(9) { | row | Array.new(9) { | col | Tile.new(self, [row, col]) } }\n self.place_bombs\n @grid.map.with_index do | row, rowIndx |\n row.map.with_index { | tile, colIndx | tile.neighbors_bomb_count if !(self.is_a_bomb?([rowIndx, colIndx])) }\n end\n end",
"def initialize(board = nil)\n @board = Array.new(9, \" \")\nend",
"def initialize\n @choices = %w(1 2 3 4 5 6 7 8 9)\n @puzzle = [0] * 81\n @rows = [[], [], [], [], [], [], [], [], []]\n @columns = [[], [], [], [], [], [], [], [], []] \n @boxes = [[], [], [], [], [], [], [], [], []]\n end"
] |
[
"0.8501538",
"0.82990074",
"0.8266954",
"0.82005614",
"0.7659927",
"0.7646631",
"0.76348144",
"0.75880367",
"0.7577868",
"0.75086474",
"0.7475693",
"0.74493164",
"0.74374884",
"0.73475176",
"0.7257581",
"0.7231857",
"0.72154176",
"0.71931386",
"0.7189941",
"0.7189941",
"0.71727866",
"0.7150766",
"0.71333426",
"0.7127948",
"0.7095773",
"0.70463896",
"0.703759",
"0.7030729",
"0.7017407",
"0.7016472",
"0.6968854",
"0.69660616",
"0.69624573",
"0.694528",
"0.6933779",
"0.6924214",
"0.6910143",
"0.6895775",
"0.68695086",
"0.68394965",
"0.68231755",
"0.6781716",
"0.67804277",
"0.67772645",
"0.6741954",
"0.67294836",
"0.6706518",
"0.6706518",
"0.670567",
"0.66941917",
"0.66812396",
"0.6663505",
"0.6657533",
"0.66568947",
"0.66486335",
"0.6647506",
"0.66448724",
"0.66395605",
"0.663921",
"0.6615583",
"0.6614823",
"0.66132104",
"0.6612624",
"0.66088396",
"0.6608697",
"0.65905327",
"0.657514",
"0.6574766",
"0.6573197",
"0.6569826",
"0.6546196",
"0.65454584",
"0.6535865",
"0.65024817",
"0.65015423",
"0.6476442",
"0.6462466",
"0.6458307",
"0.644972",
"0.6449509",
"0.6443119",
"0.64366674",
"0.64295137",
"0.64252394",
"0.6420283",
"0.6403063",
"0.6392202",
"0.6384392",
"0.63755023",
"0.63686824",
"0.63676417",
"0.6352125",
"0.63503146",
"0.63490164",
"0.6348853",
"0.6348461",
"0.6329708",
"0.63264185",
"0.6312968",
"0.6294771"
] |
0.7160554
|
21
|
Initializes the board with start configuration of discs
|
def initializeBoard()
# TO DO: COMPLETE THIS METHOD
maxMid = @size / 2
minMid = @size / 2 - 1
for i in 0..size-1
for j in 0..size-1
if i == maxMid && j == maxMid
@board[i][j] = "B"
elsif i == minMid && j == minMid
@board[i][j] = "B"
elsif (i == minMid || i == maxMid) && (j == maxMid || j == minMid)
@board[i][j] = "W"
else
@board[i][j] = "-";
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize\n\t\treset_board\n\tend",
"def init_board\n @board =\n if board_state.present?\n Board.new(width: rows, height: cols, mines_count: mines).tap do |b|\n b.load_state!(board_state)\n end\n else\n Board.new(width: rows, height: cols, mines_count: mines).tap do |b|\n b.setup!\n end\n end\n end",
"def initialize\n self.make_board\n end",
"def initialize()\n\t\tcards = []\n\t\t@board = cards\n\t\t@deck = Deck.new\n\t\tSTARTINGCARDS.times { @board << @deck.draw }\n\tend",
"def initialize\n @@BOARD_SIZE = 8\n @board = create_board\n @god_mode = false\n end",
"def initialize(setup = true)\n @board = Array.new(8) {Array.new(8)}\n setup_board if setup\n end",
"def initialize\n @board = (0...8).map { [nil] * 8 }\n populate_board\n\n\tend",
"def setup_board\n @startup = true\n @board = @board.map{|col| col.map{|piece| Piece.new if piece.nil?}}\n clear_matches\n @startup = false\n @pieces_removed = 0\n end",
"def initializeBoard()\n\t\tfor i in (0...@board.length)\n\t\t\tfor j in (0...@board.length)\n\t\t\t\t@board[i][j] = EMPTY\n\t\t\tend\n\t\tend\n\n\t\t@board[@size/2][@size/2] = BLACK\n\t\t@board[@size/2 - 1][@size/2 - 1] = BLACK\n\t\t@board[@size/2 - 1][@size/2] = WHITE\n\t\t@board[@size/2][@size/2 - 1] = WHITE\n\n end",
"def init_board\n @board = Board.new\n @board.display_board\n end",
"def initialize\n\t\t@board = Board.new\n\t\t\n\tend",
"def initialize(fill_board = true)\n @grid = Array.new(8) { Array.new(8) }\n\n setup_grid if fill_board\n end",
"def initialize_board\n board = Array.new(8) {Array.new(8)}\n populate_board(board)\n end",
"def initialize\n\n\t\t# Set up some default values here; things like the size of board,\n\t\t# level of complexity and suchlike.\n\t\t@board_size = :small\n\t\t@board_level = 1\n\t\tsize \n\t\trender_board\n\n\tend",
"def starting_board\n init_rows([0, 2], :black)\n init_rows([5, 7], :red)\n end",
"def initialize\n @grid = empty_board\n end",
"def initialize\n @@cells = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n display_board\n end",
"def initialize board\n @board = board\n end",
"def initialize()\n grid = BOARD_NUMBERS.map{ |x| BOARD_ALPHABET.map{ |y| y + x}}.flatten\n @board = Hash[grid.collect { |k| [k, EMPTY]} ]\n end",
"def initialize \n @rows = 8\n @columns = 8\n @grid = create_board\n end",
"def initialize ()\n\t\t@board = [\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \" ,\" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" X \", \" O \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" O \", \" X \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \"]\n\t\t@board_arr\t\t= Array(0..@board.length-1)\n\t\t@board_height\t= 8\n\t\t@board_width \t= 8\n\tend",
"def initialize\n @board=Array.new(9) {Array.new(9, false)}\n self.populate_mines\n self.fill_up_board_with_tiles\n @game_over = false\n end",
"def initialize\n create_board\n end",
"def initialize\n @board = Array[]\n initializeTop\n initializeMiddle\n initializeBottom\n end",
"def setup_board!\n\t\t@board = Array.new($dimensions[:y]){ Array.new($dimensions[:x]) {:empty} }\n\tend",
"def initialize\n\t\t#TO DO :\n\t\t# #Quand la classe s'initialize, elle doit créer 9 instances BoardCases\n\t\t# #Ces instances sont rangées dans une array qui est l'attr_accessor de la classe\n\tend",
"def initialize\n @board = Board.new\n end",
"def initialize()\n @board = {}\n colors = [Square::BLACK, Square::WHITE]\n \n (1..8).each do |row|\n (1..8).each do |col|\n sq = Square.new(colors[0])\n\n # Place starting pieces on board\n if (1..3).include?(row) && sq.color == Square::BLACK\n sq.checker_piece = Piece.new(Piece::BLACK)\n elsif (6..8).include?(row) && sq.color == Square::BLACK\n sq.checker_piece = Piece.new(Piece::RED)\n end\n \n @board[[row,col]] = sq\n \n colors << colors.delete_at(0) unless col == 8\n end\n end\n end",
"def initialize(start_position = nil, color = :black, reference_board)\n super(start_position, color, reference_board)\n assign_icon\n @start_position = start_position\n @all_possible_moves = moves\n end",
"def initialize\n\t\t\t@empty_cell = '_'\n\t\t\t@board = Array.new(3) {Array.new(3,@empty_cell)}\n\t\tend",
"def initialize\n # super(color, board, pos)\n end",
"def initialize\n\n\t\t@width = 8\n\t\t@height = 8\n\t\t@board = Array.new(@height){Array.new(@width)}\n\n\t\t# inicializamos en board con guiones (vacio\n\t\tfor file in (0..@width-1)\n\t\t\tfor column in (0..@height-1)\n\t\t\t\t@board[file][column] = \"--\"\n\t\t\tend\n\t\tend\n\tend",
"def initialize\n @board_array = [[],[],[],[],[],[],[],[],[],[]]\n # tile_board\n # set_mines\n end",
"def initialize\n @board = create_board\n @god_mode = false\n end",
"def initialize\n\t\t@board=Hash.new \n\t\t(0..6).each{ |i|\n\t\t\t(0..6).each{ |j|\n\t\t\t\t@board[[i,j]]=Cell.new(0,0,\"\")\n\t\t\t}\n\t\t}\n\t\t#==== intitial cells\n\t\t@board[[1,1]].value=2\n\t\t@board[[2,3]].value=4\n\t\t@move_result=0\n\tend",
"def initialize()\n @board = {}\n colors = [Square::BLACK, Square::WHITE]\n\n (1..8).each do |row|\n (1..8).each do |col|\n\n # Place starting pieces on board\n if (1..3).include?(row) && Square.new(colors[0]).color == Square::BLACK\n Square.new(colors[0]).checker_piece = Piece.new(Piece::BLACK)\n elsif (6..8).include?(row) && Square.new(colors[0]).color == Square::BLACK\n Square.new(colors[0]).checker_piece = Piece.new(Piece::RED)\n end\n\n @board[[row,col]] = Square.new(colors[0])\n\n colors << colors.delete_at(0) unless col == 8\n end\n end\n end",
"def initialize_game\n setup_boards\n end",
"def initialize(size, startPlayer, discColor)\n # validate arguments\n if size < 4 || size > 8 || size % 2 != 0\n raise ArgumentError.new('Invalid value for board size.')\n end\n if startPlayer < 1 || startPlayer > 2\n raise ArgumentError.new('Invalid value for player number.')\n end\n if discColor != WHITE && discColor != BLACK\n raise ArgumentError.new('Invalid value for disc.');\n end\n\n # set instance variables\n @board = []\n @size = size\n @turn = startPlayer\n @disc = discColor\n\n # set two more instance variables @p1Disc and @p2Disc\n if @turn == 1\n @p1Disc = @disc\n @p2Disc = @disc == WHITE ? BLACK : WHITE\n else\n @p2Disc = @disc\n @p1Disc = @disc == WHITE ? BLACK : WHITE;\n end\n\n # create the grid (as array of arrays)\n @board = Array.new(@size)\n for i in (0...@board.length)\n @board[i] = Array.new(@size)\n @board[i].fill(0)\n end\n\n # initialize the grid\n initializeBoard()\n end",
"def initialize(setup)\n @grid = Array.new(8) { Array.new(8, nil)}\n\n if setup\n setup_pieces\n end\n end",
"def initialize(grid_size)\n @grid_size = grid_size\n @cell_ct = (grid_size * 2) + 1\n @board = Array.new(cell_ct){Array.new(cell_ct)}\n\n populate_board_guide(board)\n end",
"def initialize(size, startPlayer, discColor)\n\t\t# validate arguments\n\t\tif size < 4 || size > 8 || size % 2 != 0\n\t\t\traise ArgumentError.new('Invalid value for board size.')\n\t\tend\n\t\tif startPlayer < 1 || startPlayer > 2\n\t\t\traise ArgumentError.new('Invalid value for player number.')\n\t\tend\n\t\tif discColor != WHITE && discColor != BLACK\n\t\t\traise ArgumentError.new('Invalid value for disc.');\n\t\tend\n\n\t\t# set instance variables\n @board = []\n\t\t@size = size\n\t\t@turn = startPlayer\n\t\t@disc = discColor\n\n\t\t# set two more instance variables @p1Disc and @p2Disc\n\t\tif @turn == 1\n\t\t\t@p1Disc = @disc\n\t\t\t@p2Disc = @disc == WHITE ? BLACK : WHITE\n\t\telse\n\t\t\t@p2Disc = @disc\n\t\t\t@p1Disc = @disc == WHITE ? BLACK : WHITE;\n\t\tend\n\n\t\t# create the grid (as array of arrays)\n\t\t@board = Array.new(@size)\n\t\tfor i in (0...@board.length)\n\t\t\t@board[i] = Array.new(@size)\n\t\t\t@board[i].fill(0)\n\t\tend\n\n\t\t# initialize the grid\n\t\tinitializeBoard()\n\tend",
"def initialize(size, startPlayer, discColor)\n\t\t# validate arguments\n\t\tif size < 4 || size > 8 || size % 2 != 0\n\t\t\traise ArgumentError.new('Invalid value for board size.')\n\t\tend\n\t\tif startPlayer < 1 || startPlayer > 2\n\t\t\traise ArgumentError.new('Invalid value for player number.')\n\t\tend\n\t\tif discColor != WHITE && discColor != BLACK\n\t\t\traise ArgumentError.new('Invalid value for disc.');\n\t\tend\n\n\t\t# set instance variables\n @board = []\n\t\t@size = size\n\t\t@turn = startPlayer\n\t\t@disc = discColor\n\n\t\t# set two more instance variables @p1Disc and @p2Disc\n\t\tif @turn == 1\n\t\t\t@p1Disc = @disc\n\t\t\t@p2Disc = @disc == WHITE ? BLACK : WHITE\n\t\telse\n\t\t\t@p2Disc = @disc\n\t\t\t@p1Disc = @disc == WHITE ? BLACK : WHITE;\n\t\tend\n\n\t\t# create the grid (as array of arrays)\n\t\t@board = Array.new(@size)\n\t\tfor i in (0...@board.length)\n\t\t\t@board[i] = Array.new(@size)\n\t\t\t@board[i].fill(0)\n\t\tend\n\n\t\t# initialize the grid\n\t\tinitializeBoard()\n\tend",
"def init_board(size=5, handicap=0)\n @game = GameLogic.new\n @game.new_game(size, handicap)\n @goban = @game.goban\n @grid = Grid.new(size)\n @filler = ZoneFiller.new(@goban, @grid)\n end",
"def initialize(fill_board = true)\n @sentinel = Null_piece.instance\n\n @rows = Array.new(8) { Array.new(8, @sentinel) }\n\n fill_board_tiles if fill_board\n end",
"def initialize\n\t\t# Pour désigner une case : @board[i][j] avec i = ligne, j = colonne\n\t\t@board = Array.new(4, nil)\n\t\t@board.map! {|line| Array.new(4, nil)}\n\t\t\n\t\t# Utilisation des lignes et colonnes 0 pour l'affichage : \n\t\t(1..3).each { |col| @board[0][col] = \"#{col}\" }\n\t\t(1..3).each {|line| @board[line][0] = ([\"A\",\"B\",\"C\"][line-1])}\n\t\t@board[0][0] = \" \"\n\n\t\t# Initialisation des 9 BoardCase\n\t\t(1..3).each {|col|\n\t\t\t\t(1..3).each { |line|\n\t\t\t\t\t@board[line][col] = BoardCase.new\n\t\t\t\t}\n\t\t}\n\tend",
"def initialize\n @board = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\n end",
"def initialize(board)\n @board = board\n end",
"def initialize(empty = false)\n @white_points = []\n @black_points = []\n return if empty\n\n @board = []\n 8.times do\n col = []\n 8.times do\n col << SPOT_OPEN\n end\n @board << col\n end\n\n # Add the starting pieces\n mark(3, 3, SPOT_WHITE)\n mark(4, 3, SPOT_BLACK)\n mark(4, 4, SPOT_WHITE)\n mark(3, 4, SPOT_BLACK)\n end",
"def initialize\n # The board is an array of rows, each containing an array of cells\n @board = Array.new(BOARD_HEIGHT){Array.new(BOARD_WIDTH)}\n @board.each_with_index do |y, yi|\n y.each_with_index do |x, xi|\n @board[yi][xi] = \".\"\n end\n end\n end",
"def initialize\r\n @boardcase = [\r\n \"0\", \"1\", \"2\",\r\n \"3\", \"4\", \"5\",\r\n \"6\", \"7\", \"8\"\r\n ]\r\n end",
"def initialize\n @board = Array.new(8) { Array.new(8) }\n @all_pieces = []\n @board_history = []\n @move_record = []\n end",
"def initialize\n puts \"==================================================================\"\n puts \" Bienvenue dans le super morpion de la mort qui tue..\"\n puts \" ..the famous TIC-TAC-TOE !!!!! \"\n puts \"\"\n puts @@board_empty\n end",
"def initialize\n @board = @@the_board.clone\n end",
"def initialize\n @board = Board.new\n select\n end",
"def initialize_board\n init_board = \"-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1\"\n if self.update(board: init_board)\n return [[ 0,-1,0,-1,0,-1, 0,-1 ],[-1,0,-1,0,-1,0,-1,0],[0,-1,0,-1,0,-1,0,-1],\n [0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],\n [1,0,1,0,1,0,1,0],[0,1,0,1,0,1,0,1],[1,0,1,0,1,0,1,0]]\n end\n end",
"def initialize(board)\n @board = get_cells_from_board_model(board)\n #duplicates board to a version that will not change\n @initial_board = Marshal.load(Marshal.dump(@board))\n @initial_board.freeze\n @alive_count = 0\n @dead_count = 0\n @stay_alive_count = JSON.parse(board.current_stay_alive_count)\n @revive_count = JSON.parse(board.current_revive_count)\n\n #*Design Choice\n # When a board is first initialized, the rails DB will already have populated the alive and dead\n # count for that board. As a result, to save one iteration, alive_count and dead_count will only\n # be computed when \"next_generation\" is called, since the counts here are what we care about\n\n end",
"def initialize(initial_board=nil)\n\t\t@size = initial_board && initial_board.length || 10\n\t\t@initial_board = initial_board # used when existing patterns are passed\n\t\t@cells = []\n\t\t\n\t\tif @initial_board\n\t\t\t@size.times do |x|\n\t\t\t\t@cells.push([])\n\t\t\t\t@size.times do |y|\n\t\t\t\t\t@cells[x].push(Cell.new(self, x, y, @initial_board[x][y]))\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\t@size.times do |x|\n\t\t\t\t@cells.push([])\n\t\t\t\t@size.times do |y|\n\t\t\t\t\t@cells[x].push(Cell.new(self, x, y))\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\tend",
"def initializeBoard()\n #\n # TO DO: complete this method\n #\n for j in 0...@size\n for i in 0...@size\n @board[j][i]=EMPTY\n end\n end\n center = (@size/2)-1\n @board[center][center] = BLACK\n @board[center+1][center+1] = BLACK\n @board[center+1][center] = WHITE\n @board[center][center+1] = WHITE\n\n\n\n\n end",
"def initialize #if module this method could be set_board\n @row_a = [\"A\"] + [\" \"]* 8\n @row_b = [\"B\"] + [\" \"]* 8\n @row_c = [\"C\"] + [\" \"]* 8\n @row_d = [\"D\"] + [\" \"]* 8\n empty_board\n two_unit_valid_places\n three_unit_valid_places\n end",
"def initialize(x,y,board)\r\n @x, @y, @board = x, y, board\r\n @state = false\r\n @next_state = false\r\n @changed_last_gen = true\r\n end",
"def initialize( start_pos = nil )\n return _initialize_fen( start_pos ) if start_pos\n Chess.initial_pieces.each{ |piece, pos| self[pos] = piece }\n end",
"def setup_board\n gameboard.build_board\n build_white_side\n build_black_side\n end",
"def initialize(board)\n\t\t@board \t\t\t= \tboard\n\t\t@player1\t\t=\t\" X \" \n\t\t@player2\t\t= \t\" O \"\n\t\t$current_player\t=\t@player1\n\t\t@skipped\t\t= false\n\t\t@game_ended\t\t= false\t\n\tend",
"def test_init\n #@board[0][5].piece = Bishop.new(@board[0][5], \"♗\", \"white\")\n @board[0][4].piece = King.new(@board[0][4], \"♔\", 'white')\n\n @board[7][4].piece = Queen.new(@board[7][4], \"♛\", \"black\" )\n @board[7][3].piece = Rook.new(@board[7][3], \"♜\", \"black\")\n @board[7][5].piece = Rook.new(@board[7][5], \"♜\", \"black\")\n end",
"def initialize board = nil, turn = \"x\"\n\t\t@dim = 3\n\t\t@size = @dim * @dim \n\t\t@board = board || Array.new(@size, \"-\")\n\t\t@turn = turn\n\t\t@movelist = []\n\tend",
"def initialize(board)\n @hidden = true\n @flagged = false\n @bomb = false\n @board = board\n end",
"def initialize\n super\n self.board = Array.new(3).map{[nil, nil, nil]}\n end",
"def initialize\n \t@board = Array.new(10) { Array.new(10) }\n \t@hash = {} #for letter conversion\n \tsetup \n \tsetup_keys\n end",
"def initialize(board)\n @board = board\n @cursor = Cursor.new([0,0], @board) # they literally do tell you exactly what to do lol\n end",
"def initialize\n\t\t@board = []\n\t\t3.times do |i|\n\t\t\t@board[i] = []\n\t\t\t3.times do\n\t\t\t\t@board[i] << 0\n\t\t\tend\n\t\tend\n\tend",
"def initialize\n @config = Outpost::Config.setup\n @squares = Outpost::Squares::Create.squares self\n reset_cycled_colors\n @pieces = Outpost::Piece::Create.pieces self\n setup_pieces\n end",
"def board_setup\n\t\tinitial_position = [\"rook\", \"knight\", \"bishop\", \"queen\", \"king\", \"bishop\", \"knight\", \"rook\"]\n\t\tspecial_position = [8,1]\n\t\tpawn_position = [7,2]\n\t\tinitial_color = [\"black\",\"white\"]\n\t\ti = 0\n\t\tx = 0\n\t\t#loops through ranks 8 and 1 setting each class piece in his corresponding position.\n\t\tspecial_position.each do |num|\n\t\t\t(\"a\"..\"h\").each do |letter|\n\t\t\t\t@board[letter+num.to_s].name = initial_position[i]\n\t\t\t\t@board[letter+num.to_s].color = initial_color[x]\n\t\t\t\ti += 1\n\t\t\tend\n\t\t\ti = 0\n\t\t\tx += 1\n\t\tend\n\n\t\ty = 0\n\t\t#loos through ranks 7 and 2 setting the pawn's pieces in his corresponding position.\n\t\tpawn_position.each do |num|\n\t\t\t(\"a\"..\"h\").each do |letter|\n\t\t\t\t@board[letter+num.to_s].name = \"pawn\"\n\t\t\t\t@board[letter+num.to_s].color = initial_color[y]\n\t\t\tend\n\t\t\ty += 1\n\t\tend\n\tend",
"def initialize(fill_board = true)\n place_figures(fill_board)\n end",
"def initialize(board, color, symbol = :queen)\n super\n end",
"def setup(board)\n ('a'..'h').each_with_index do |column, index|\n # Set up the home rows\n [[1, :white], [8, :black]].each do |row, color|\n piece = HOME_ROW[index].new(color)\n board.place( Square.new(column, row), piece )\n end\n \n # Setup the pawns\n [[2, :white], [7,:black]].each do |row, color|\n piece = Pawn.new(color)\n board.place( Square.new(column, row), piece)\n end\n end\n end",
"def setup\n (1..12).each do |num|\n @board[num] = %W[_ _ _ _]\n end\n end",
"def initialize(c,n)\r\n print Clear if c==0\r\n @contents = []\r\n @column = c\r\n @disks = n\r\n 1.upto(n+1) {|p| show_blank(p)} # show the peg, empty\r\n if c==0\r\n @delay = 0\r\n n.downto(1) {|disk| drop(disk)}\r\n end\r\n @delay = 2 ** (2-n) # adjust delays to size of puzzle\r\n end",
"def initialize\n @@board = Array.new([[\"-\",\"-\",\"-\"],[\"-\",\"-\",\"-\"],[\"-\",\"-\",\"-\"]])\n end",
"def initialize\n\t\t@board_status = new_board()\n\t\t@player_x = Player.new(\"X\")\n\t\t@player_o = Player.new(\"O\")\n\t\t@current_player = @player_x\n\t\t@swap_player = false\n\t\t@win_conditions = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [1, 4, 7], [2, 5, 8], [3, 6, 9], [1, 5, 9], [3, 5, 7]]\n\t\t@player_won = false\n\t\tshow_board()\n\tend",
"def setup_board\r\n place_pawns\r\n place_bishops\r\n place_rooks\r\n place_knights\r\n place_queens\r\n place_kings\r\n end",
"def initialize\n\t\t@board = Board.new\n\t\t@turn = rand(2) # randomizes which color starts first even BLACK odd RED\n\tend",
"def initialize\n @board = [1,2,3,4,5,6,7,8,9]\n @counter = 1\n end",
"def initialize(pop = true)\n @board = Array.new(8) { Array.new(8) }\n populate_board if pop\n end",
"def start_game\n Board.new 10, 10\n end",
"def initialize (board)\n @board = board\n @key = ['x','x','x','x','x']\n end",
"def initialize(size)\n @board_size = size\n @board = []\n @board_size.times { @board << Array.new(@board_size, EMPTY_SYMBOL) }\n end",
"def initialize(boardSize)\n\t\t\t@moves = Array.new\n\t\t\t@size = boardSize\n\t\tend",
"def initialize grid_size, initial\n @rows, @cols = grid_size.split(' ').collect {|i| i.to_i}\n split = initial.split(' ')\n @current_col = split[0].to_i\n @current_row = split[1].to_i\n @direction = split[2]\n @direction_switch = ['N', 'E', 'S', 'W']\n @direction_index = @direction_switch.index @direction\n end",
"def initialize(options = {})\n self.board = {}\n self.io_buses = []\n self.nics = []\n self.gui = false\n options.each { |k, v| self.send :\"#{k}=\", v }\n end",
"def initialize(grid = Board.default_grid)\n @grid = grid\n end",
"def initialize\n @board = Board.new\n @players_1_turn = true\n end",
"def initialize\n @board = []\n 8.times {@board.push([\".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\"])}\n @carrier = {length: 5, letter: \"C\", name: \"Carrier\"}\n @battleship = {length: 4, letter: \"B\", name: \"Battleship\"}\n @destroyer = {length: 3, letter: \"D\", name: \"Destroyer\"}\n @submarine = {length: 3, letter: \"S\", name: \"Submarine\"}\n @patrol_boat = {length: 2, letter: \"P\", name: \"Patrol Boat\"}\n @boats = [@carrier, @battleship, @destroyer, @submarine, @patrol_boat]\n end",
"def initialize(empty = false)\n grid.abort(\"LOLxD\") unless Array.new(8) { Array.new(8) }\n set_board(grid) unless empty\n @captured = []\n end",
"def initialize\n @board = Array.new(64, 0)\n @black_king_side_castling = true\n @white_king_side_castling = true\n @black_queen_side_castling = true\n @white_queen_side_castling = true\n @last_move = [64,64]\n\n # place pawns\n for i in (8..15)\n @board[i] = -1\n end\n for i in (48..55)\n @board[i] = 1\n end\n\n # place other pieces\n black = [-4, -2, -3, -5, -6, -3, -2, -4]\n white = [4, 2, 3, 5, 6, 3, 2, 4]\n for i in (0..7)\n @board[i] = black.shift\n end\n for i in (56..63)\n @board[i] = white.shift\n end\n end",
"def start_board\n @start_node.board.dup\n end",
"def initialize\n @board = Board.new\n @round = 0\n end",
"def set_board\n\t\t(1..@disks).each do |disk|\n\t\t\t@pegs[0].unshift disk\n\t\tend\n\tend",
"def initialize(ships)\n @board = Board.new\n @ships = ships\n end",
"def initialize()\n\t\t@gridColorXZ = [1.0, 0.0, 0.0, 0.0] #Red\n\t\t@gridColorXY = [1.0, 1.0, 0.0, 0.0] #Yellow\n\t\t@gridColorYZ = [0.0, 0.0, 1.0, 0.0] #Blue\n\t\t@gridLines = 10 # The number of lines in HALF the grid (just to make counting easier)\n\t\t@gridSpacing = 5.0\n\t\t@gridOn = true\n\tend",
"def test_2_initialize\n #TO DO :\n #Quand la classe s'initialize, elle doit créer 9 instances BoardCases\n #Ces instances sont rangées dans une array qui est l'attr_accessor de la classe\n#####################################################\n# Creation de mon board hash avec chacune des valeurs empty\n @board = [\" \", \" \",\" \",\n \" \", \" \", \" \",\n \" \",\" \", \" \"]\n\n# Rappel de chacune des valeurs via leur index: pour initialiser à chaque tour\n\n end"
] |
[
"0.71676415",
"0.7138115",
"0.7001502",
"0.6974499",
"0.6963097",
"0.6906531",
"0.68870723",
"0.6814357",
"0.67899317",
"0.6783577",
"0.6701555",
"0.6688985",
"0.6668739",
"0.66623276",
"0.6644056",
"0.66363126",
"0.6607749",
"0.65625876",
"0.6547501",
"0.65209615",
"0.65199304",
"0.65017563",
"0.6495444",
"0.6484445",
"0.64459914",
"0.6444967",
"0.6429848",
"0.6401964",
"0.63907087",
"0.6383314",
"0.63707536",
"0.6362051",
"0.63620424",
"0.6349608",
"0.6335508",
"0.6330998",
"0.63281363",
"0.63247466",
"0.63220805",
"0.6306968",
"0.628961",
"0.628961",
"0.6276898",
"0.62608916",
"0.62513906",
"0.6242551",
"0.6242153",
"0.623791",
"0.6224059",
"0.6212875",
"0.6211151",
"0.6206655",
"0.62010926",
"0.619978",
"0.6179136",
"0.6148821",
"0.6147941",
"0.6129431",
"0.6124981",
"0.61080223",
"0.6105025",
"0.6101955",
"0.6101515",
"0.6099224",
"0.60916054",
"0.6069184",
"0.6055526",
"0.60498494",
"0.60486174",
"0.6048581",
"0.60377395",
"0.60196286",
"0.6005543",
"0.60022634",
"0.59983224",
"0.5987181",
"0.598568",
"0.596771",
"0.5966173",
"0.5961266",
"0.59555703",
"0.59404397",
"0.5926237",
"0.59148747",
"0.59138083",
"0.59110093",
"0.59086996",
"0.59056795",
"0.5905238",
"0.5898996",
"0.5897609",
"0.589469",
"0.58871835",
"0.58836657",
"0.5876165",
"0.58749676",
"0.5859928",
"0.5854401",
"0.5852173",
"0.58493984"
] |
0.58712435
|
96
|
Returns true if placing the disc of current player at row,col is valid; else returns false
|
def isValidMove(row, col)
return isValidMoveForDisc(row, col, @disc)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def isValidMove(row, col)\n \treturn isValidMoveForDisc(row, col, @disc)\n end",
"def isValidMove(row, col)\n \treturn isValidMoveForDisc(row, col, @disc)\n end",
"def valid?(position)\n row, col = position\n position.all? {|i| i >= 0 && i< @grid.length}\n \n end",
"def position_is_valid?(position)\r\n position.x < @col &&\r\n position.y < @row &&\r\n position.x >= 0 &&\r\n position.y >= 0\r\n end",
"def valid_position?(row, col)\n row.between?(0, 7) && col.between?(0, 7) ? true : false\n end",
"def valid?(pos) #getter\n #pos shoul be 2 number like [2,n]\n #need to check if [2,n] is in our @grid\n row,col = pos\n pos.all? {|num| num >= 0 && num < @n}\n end",
"def move_valid?(x, y)\n (0...@columns).cover?(x) && (0...@rows).cover?(y) && !@visited[x][y]\n end",
"def legal(coords)\n row_dist = (@row - coords[0]).abs\n col_dist = (@column - coords[1]).abs\n if row_dist > 1 || col_dist > 1\n return false\n elsif check\n puts \"cant move into check\"\n return false\n else\n return occupied?(coords)\n end\n end",
"def validate_position(row,col)\n if row<=@board.size and col <=@board.size\n if @board[row][col]==EMPTY_POS\n return true\n else\n puts \"position is occupied\"\n end\n else\n puts \"invalid position\"\n end\n return false\n end",
"def is_valid_move x,y\n return false unless (0..3) === x\n return false unless (0..3) === y\n return @field[x][y].player == 0\n end",
"def move_valid?(pos)\n return false unless board.in_bounds?(pos)\n return false if board.occupied?(pos) && board.grid[pos[0]][pos[1]].color == self.color\n true\n end",
"def valid_board?\n self.valid_rows? && self.valid_cols? && self.valid_squares?\n end",
"def board_is_correct?()\n _row_checker() && _column_checker() && _square_checker\n end",
"def invalid_move?(col)\n col = col.to_i\n i = 0 \n while i < @height && col < @width\n if @grid[i][col] == nil\n return false \n end \n i += 1 \n end \n return true \n end",
"def valid?(pos)\n @board.valid_pos?(pos) && (@color != @board[pos].color)\n end",
"def isValidMoveForDisc(row, col, disc)\n\n # TO DO: COMPLETE THIS PART OF THE METHOD\n if canMoveTop(row,col,disc)\n return true\n end\n if canMoveTopRight(row,col,disc)\n return true\n end\n if canMoveTopLeft(row,col,disc)\n return true\n end\n if canMoveLeft(row,col,disc)\n return true\n end\n if canMoveRight(row,col,disc)\n return true\n end\n if canMoveBottom(row,col,disc)\n return true\n end\n if canMoveBottomLeft(row,col,disc)\n return true\n end\n if canMoveBottomRight(row,col,disc)\n return true\n end\n\n # DO NOT DELETE - if control reaches this statement, then it is not a valid move\n return false\n end",
"def isValidMoveForDisc(row, col, disc)\n\t\tif @board[row][col] != EMPTY\n\t\t\treturn false\n\t\tend\n\n #\n # TO DO: add your code below\n #\n #puts \"isValidMoveForDisc entering\"\n if (@board[row][col]==EMPTY && (isValidMoveUp(row,col,disc) || isValidMoveDown(row,col,disc) ||isValidMoveLeft(row,col,disc) ||isValidMoveRight(row,col,disc) ||isValidMoveUpRight(row,col,disc) ||isValidMoveUpLeft(row,col,disc) ||isValidMoveDownRight(row,col,disc) ||isValidMoveDownLeft(row,col,disc)))\n return true\n end\n #puts \"isValidMoveForDisc exiting\"\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false\t# if control reaches this point, then it's not a valid move\n end",
"def could_be_valid_move?\n return @board_gfx.is_draggingpiece_valid?\n end",
"def obstructed_move?(row, col)\n current_row = self.row_position\n current_col = self.col_position\n\n # check if piece is blocking the path in positive vertical direction\n if current_col == col && row > current_row\n for i in (current_row+1...row)\n self.game.occupied?(i, col)\n end\n end\n\n # check if piece is blocking the path in negative vertical direction\n if current_col == col && row < current_row\n for i in (row+1...current_row)\n self.game.occupied?(i, col)\n end\n end\n\n # check if piece is blocking the path in positive horizontal direction\n if current_row == row && col > current_col\n for i in (current_col+1...col)\n self.game.occupied?(row, i)\n end\n end\n\n # check if piece is blocking the path in negative horizontal direction\n if current_row == row && col < current_col\n for i in (col+1...current_col)\n self.game.occupied?(row, i)\n end\n end\n\n return false\n end",
"def cell_occupied_by?(player, x, y)\n player.x == x && player.y == y\n end",
"def has_winner?\n (@last_insert_x > 0) ? (check_column || check_row) : false\n \n end",
"def move_valid?\n @board.first_disk = 0\n\n #determine disk piece to be moved\n @board.board.each do |row, arr|\n if arr[@player.from] != 0\n @board.first_disk = arr[@player.from]\n break\n end\n end\n\n #determine the highest disk available in that column\n @board.board.each do |row, arr|\n if arr[@player.to] != 0\n @board.second_disk = arr[@player.to]\n break\n else\n @board.second_disk = arr[@player.to]\n end\n end\n\n #conditional test to see if move is valid\n if @board.first_disk == 0\n puts \"No disks in this column, try again\"\n get_input\n elsif @board.second_disk == 0 || @board.first_disk < @board.second_disk\n move_disk\n else\n puts \"Move is invalid\"\n puts \"Please check the rules and input a new move\"\n get_input\n end\n end",
"def check_row\n \n\tcount = 1\n\t\n\t# Checking to the left.\n\tif @last_insert_x > 1\n\t\n\t i = @last_insert_x - 1\n\t player_symbol = assignment[@last_insert_x - 1][@last_insert_y - 1]\n\t next_symbol = assignment[i - 1][@last_insert_y - 1]\n\t \n\t while (i >= 1) && (count < 4) && (next_symbol == player_symbol)\n\t count += 1\n\t\ti -= 1\n\t\tnext_symbol = assignment[i - 1][@last_insert_y - 1]\n\t end\n\t\n\tend \n\t\n\t# Checking to the right.\n\tif @last_insert_x < width\n\t\n\t i = @last_insert_x + 1\n\t player_symbol = assignment[@last_insert_x - 1][@last_insert_y - 1]\n\t next_symbol = assignment[i - 1][@last_insert_y - 1]\n\t \n\t while (i <= width) && (count < 4) && (next_symbol == player_symbol)\n\t count += 1\n\t\ti += 1\n\t\tnext_symbol = (i < width + 1) ? assignment[i - 1][@last_insert_y - 1] : !player_symbol\n\t end\n\t \n\tend\n\t\n count >= 4\n end",
"def inside_board?(r, c)\n (r >= 0) && (c >= 0) && (r <= @row_limit) && (c <= @column_limit)\n end",
"def validate_computer_position(position)\n if $grid_hash[position] == ' '\n \t$confirmed_piece = position\n return true\n else\n comp_turn\n end\nend",
"def valid_placement?\n\t\t@table.placed_on_table?(@x, @y) && @robot.vectors.include?(@robot_direction)\n\tend",
"def move_valid?(x, y)\n (0...@width).cover?(x) && (0...@height).cover?(y) && !@visited[x][y]\n end",
"def valid_board_coordinates?(x, y)\n x >= 0 && y >= 0 && x < 3 && y < 3\n end",
"def is_legal?(pos)\n # checks if there is a piece in the spot and whether it is the same\n # color. Also checks if it is off of the board.\n return false unless pos[0].between?(0, 7) && pos[1].between?(0, 7)\n return true if board[pos.first][pos.last].nil?\n return false if self.color == board[pos.first][pos.last].color\n\n true\n end",
"def self_valid?(x, y)\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # checks if coordinates are valid\n return (x >= 0 && x < width * pix - pix + 1 && y >= 0 && y < height * pix - pix + 1)\n end",
"def is_valid_move?(proposed_row, proposed_col, solution)\n return true\nend",
"def valid?(x, y)\n return (x >= 0 and x < $game_map.width and y >= 0 and y < $game_map.height)\n end",
"def valid?(x, y)\n return (x >= 0 and x < $game_map.width and y >= 0 and y < $game_map.height)\n end",
"def valid(row, col)\n if check_row(row) and check_col(col) and check_diag(row, col)\n return true\n else\n return false\n end\n end",
"def valid_pos?(pos) # [0, -1]\n row, col = pos \n return false if row < 0 || row > 7\n return false if col < 0 || col > 7\n true \n end",
"def space_open?(column, row)\n @board[column][row] == @empty_square ? true : false\n end",
"def move_out_valid?(board)\r\n offsets = [[1,0],[0,1],[-1,0],[0,-1],[1,1],[-1,1],[-1,-1],[1,-1]]\r\n \toffsets.each do |offset|\r\n to_row, to_col = @row + offset[0], @col + offset[1]\r\n\r\n if valid_move?(to_row, to_col, board, @color)\r\n puts \"King can move out at: [#{to_row},#{to_col}]\"\r\n return true\r\n end\r\n \tend\r\n \treturn false\r\n end",
"def solid?(game_map, x, y)\r\n # puts \"X: \" + x.to_s + \" Y: \" + y.to_s # for debuging\r\n if(x < 0 || x > 240) # dosen't allow player to go out of side walls\r\n return true\r\n end\r\n\r\n if(y<0 ||game_map.tiles[y / 20][x / 20]==0)\r\n return false\r\n else \r\n return true\r\n end\r\n\r\nend",
"def valid_piece_movement?(coordinates)\n row = coordinates[:row]\n column = coordinates[:column]\n @active_piece.moves.any?([row, column]) || @active_piece.captures.any?([row, column])\n end",
"def isLegalCoord(row, col)\n legal = false\n if row == '1' || row == '7'\n if col == 'A' || col == 'D' || col == 'G'\n legal = true\n end\n elsif row == '2' || row == '6'\n if col == 'B' || col == 'D' || col == 'F'\n legal = true\n end\n elsif row == '3' || row == '5'\n if col == 'C' || col == 'D' || col == 'E'\n legal = true\n end\n elsif row == '4'\n if col == 'A' || col == 'B' || col == 'C' || col == 'E' || col == 'F' || col == 'G'\n legal = true\n end\n end\n\n return legal\n end",
"def position_taken?(board, index_to_validate)\n if (board[index_to_validate] == \"X\" || board[index_to_validate] == \"O\")\n return true\n end\n return false # NOTE: if we arrive here, the position is definitely not taken\nend",
"def can_occupy_cell?(pos=false)\n # p pos\n # # byebug\n return false if pos[0] < 0 || pos[0] >= @grid.length\n return false if pos[1] < 0 || pos[1] >= @grid[0].length\n empty?(pos)\n # return false if (pos[0] >= @grid.length || pos[1] >= @grid.length)\n # return true if pos && @grid[pos[0]][pos[1]] != nil\n # false\n end",
"def validate_user_position(position)\n if $grid_hash[position] == ' '\n \t$confirmed_piece = position\n return true\n elsif $grid_hash[position] == nil\n \tputs \"That is not a valid entry.\"\n \tplay\n else\n puts \"That spot is already taken.\"\n play\n end\nend",
"def invalid_cell?(pos)\n pos[0] < 0 || pos[1] < 0 || pos[0] > MAXX || pos[1] > MAXY\n end",
"def obstacles_in_row?(destination)\n row = @position[1]\n start = @position[0].ord - 97\n finish = destination[0].ord - 97\n start, finish = adjust(start, finish)\n (start..finish).each do |index|\n column = (index + 97).chr\n return false unless @board[column + row].nil?\n end\n true\n end",
"def on_board?(coords)\n\t\tcoords.any? {|coord| coord < 1 || coord > @size } ? false : true\n\tend",
"def valid_move?(row, col, queens)\n # Go through each of the current valid moves\n queens.each do |q_pos|\n # Grab the coords\n q_row, q_col = q_pos\n\n # If the coords to be checked land on either the same col or row as an existing\n # valid move, the coords are invalid\n return false if q_row == row || q_col == col\n # Check to see if the slope between the coords and any valid moves is equal to 1.\n # Having a slope of 1 on board means the two points are on the same diagonal line.\n return false if ((row - q_row) / (col - q_col).to_f).abs == 1\n end\n\n true\nend",
"def valid?\n 0.upto(8) { |row| return false if @rows[row].uniq! }\n 0.upto(8) { |column| return false if @columns[column].uniq! } \n 0.upto(8) { |box| return false if @boxes[box].uniq! }\n\n return true\n end",
"def check_valid_position(xcoord, ycoord)\n\tif xcoord >= GRID_SIZE || xcoord < 0\n\t\treturn false\n\telsif ycoord >= GRID_SIZE || ycoord < 0\n\t\treturn false\n\telse\n\t\treturn true\n\tend\nend",
"def validate_position(board, row, col, number)\n position_row = row\n position_col = col\n # Checks the row to ensure there's no duplicate while also checking the column to ensure there's no duplicate.\n for val in 0...9 do\n if board[val][position_col] == number || board[position_row][val] == number\n return false\n end\n end\n\n # Defining the boundaries of the block that the given position falls into...\n block_row_min = position_row / 3 * 3 # Abusing integer division to get the lower bound for the rows.\n block_row_max = block_row_min + 3 # Max is just 3 higher than that.\n block_col_min = position_col / 3 * 3 # Abusing integer division to get the lower bound for the columns.\n block_col_max = block_col_min + 3 # Max is just 3 higher than that.\n\n # Checks that the given position is valid, given the dimensions calculated above...\n for row in block_row_min...block_row_max do\n for col in block_col_min...block_col_max do # Simple double for-loop with an if statement.\n if board[row][col] == number\n return false\n end\n end\n end\n return true\n end",
"def is_winner(x, y, player)\n return true if check_row(x, player)\n return true if check_col(y, player)\n return true if check_diagonals(player)\n return false\n end",
"def full?\n for x in 0..2\n for y in 0..2\n return false if @field[x][y].player == 0\n end\n end\n return true\n end",
"def valid_place?(x, y)\n @table.validate_pos(x, y)\n end",
"def validate_position(row, column)\n\n # Assume the move is invalid\n result = false\n\n # Is this cell within the range of the board?\n if row <= @board.size and column <= @board.size\n\n # Yes, was this cell previously empty?\n if @board[row][column] == EMPTY_POSITION\n\n # Yes, the move is valid\n result = true\n\n else\n\n # No, this cell wasn't empty\n puts \"That position is occupied.\"\n\n end\n\n else\n\n # No, this cell is off the board\n puts \"Invalid position.\"\n\n end\n\n return result\n\n end",
"def viable_entry(color, x, y)\n\t\treturn false if (0..7).include?(x) == false\n\t\treturn false if (0..7).include?(y) == false\n\t\treturn false if @board[x][y].piece == nil\n\t\treturn false if @board[x][y].piece.color != color\n\t\treturn true\n\tend",
"def valid_move?\n\t\t@table.stays_on_table?(@robot_direction, @x, @y)\n\tend",
"def valid_pos?(pos)\n indices = []\n @board.each do |row|\n row.each do |col|\n indices << [row, col]\n end\n end\n indices.include?(pos)\n end",
"def check_space (potential_x_pos, potential_y_pos, battlefield)\r\n whitespace = [[0,1], [1,0], [0,-1], [-1,0], [1,1], [-1,1], [1,-1], [-1, -1]]\r\n if potential_x_pos > 0 && potential_x_pos < 11 && potential_y_pos > 0 && potential_y_pos < 11 && battlefield[potential_x_pos][potential_y_pos] == 0\r\n for i in 0..7\r\n check_x_position = potential_x_pos + whitespace[i][0];\r\n check_y_position = potential_y_pos + whitespace[i][1];\r\n if check_x_position > 0 && check_x_position < 11 && check_y_position > 0 && check_y_position < 11 && battlefield[check_x_position][check_y_position] == 1\r\n return false\r\n end\r\n end\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def blocked(player)\n # check every piece on the board\n (0..23).each do |i|\n # if it's the player's piece check if it can move\n if @myPositions[i].player == player\n\n # if it can move up, down, left, or right then the player isn't blocked\n\t \t\tif @myPositions[i].up != nil && @myPositions[i].up.player == Controller::Player::NEUTRAL\n\t\t\t \treturn false\n end\n\n\t\t \tif @myPositions[i].down != nil && @myPositions[i].down.player == Controller::Player::NEUTRAL\n\t\t\t\t return false\n end\n\n\t\t\t if @myPositions[i].left != nil && @myPositions[i].left.player == Controller::Player::NEUTRAL\n\t\t\t\t return false\n end\n\n\t\t\t if @myPositions[i].right != nil && @myPositions[i].right.player == Controller::Player::NEUTRAL\n\t\t\t\t return false\n end\n end\n end\n\n\t # we must be blocked\n \treturn true\n end",
"def isValidMoveAvailableForDisc(disc)\n #\n # TO DO: add your code below\n\t\t#\n\t\tfor i in (0...@board.size)\n\t\t\tfor j in (0...@board.size)\n\t\t\t\tif isValidMoveForDisc(i, j, disc)\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false;\n\tend",
"def valid_pos?(pos)\n range = (0...@board.grid.length).to_a\n pos.length == 2 && range.include?(pos[0]) && range.include?(pos[1])\n end",
"def on_table?(x,y)\n (0 <= x && x < GRID_X) && (0 <= y && y < GRID_Y)\n end",
"def check_rows()\n # Returns true if row is filled by player\n 3.times do |x|\n if $game_board[x*3] == $game_board[x*3+1] && $game_board[x*3] == $game_board[x*3+2] && $game_board[x*3]\n return true\n end\n end\n false\nend",
"def check_column\n count = 0\n \n # Get the players symbol.\n player_symbol = assignment[@last_insert_x - 1][@last_insert_y - 1]\n next_symbol = player_symbol\n \n i = @last_insert_y\n \n # Go to the bottom of the column.\n while (i <= height) && (next_symbol == player_symbol)\n i += 1\n count += 1\n next_symbol = assignment[@last_insert_x - 1][i - 1] \n end\n \n count >= 4\n end",
"def contains_mine?(row, col)\n grid[row][col].fill == 1\n end",
"def occupied?(x,y) # board position !nil\n !self.board.grid[x][y].nil?\n end",
"def is_valid_index?(row, column)\r\n # Check if the specified row is out of bounds\r\n if ( row < 0 ) || ( row >= @image_array.length )\r\n return false\r\n end\r\n\r\n # Check if the specified column is out of bounds\r\n if ( column < 0 ) || ( column >= @image_array[row].length )\r\n return false\r\n end\r\n\r\n return true\r\n end",
"def valid_move?(to_row, to_col, board, color)\r\n return false if super == false\r\n return legal_move?(to_row, to_col, board) && move_not_in_check?(@row, @col, to_row, to_col, board)\r\n\tend",
"def valid_rows?\n valid = true\n row = 0\n while (row < @board.length && valid)\n valid = false if !unique_arr?(@board[row])\n row += 1\n end\n valid\n end",
"def is_safe(x, y, sol)\n return true if x >= 0 && x < 8 && y >= 0 && y < 8 && sol[x][y] == -1\n return false\nend",
"def win_condition_met?(player)\n # Horizontal\n for row in (0..5) do\n counter = 0\n \n @board[row].each do |disc|\n if(disc == player)\n counter += 1\n return true if(counter >= 4)\n else\n counter = 0\n end\n end\n end\n \n # Vertical\n for col in (0..6) do\n counter = 0\n \n for row in (0..5) do\n if(@board[row][col] == player)\n counter += 1\n return true if(counter >= 4)\n else\n counter = 0\n end\n end\n end\n \n # Right diagonal\n starting_points = [[0, 0], [1, 0], [2, 0], [0, 1], [0, 2], [0, 3]]\n starting_points.each do |start|\n counter = 0\n \n row = start[0]\n col = start[1]\n \n while(row < 6 && col < 7)\n if(@board[row][col] == player)\n counter += 1\n return true if(counter >= 4)\n else\n counter = 0\n end\n \n row += 1\n col += 1\n end\n end\n \n # Left diagonal\n starting_points = [[0, 6], [1, 6], [2, 6], [0, 5], [0, 4], [0, 3]]\n starting_points.each do |start|\n counter = 0\n \n row = start[0]\n col = start[1]\n \n while(row < 6 && col >= 0)\n if(@board[row][col] == player)\n counter += 1\n return true if(counter >= 4)\n else\n counter = 0\n end\n \n row += 1\n col -= 1\n end\n end\n \n return false\n end",
"def valid_move?(row, position)\n # need to shortcirtuit for position\n cells[row] && cells[row][position] == \" \"\n end",
"def isValidMoveForDisc(row, col, disc)\n\t\tif @board[row][col] != EMPTY\n\t\t\treturn false\n\t\tend\n\n\t\t#Flips them down\n\t\tr = row + 1\n\t\tc = col\n\t\twhile r < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\tr += 1\n\t\tend\n\n\t\tif(r < @size && @board[r][c] == disc)\n\t\t\ti = row + 1\n\t\t\twhile i < r \n\t\t\t\tif(@board[i+1][col] == disc)\n\t\t\t\t\treturn true;\n\t\t\t\tend\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\n\t\t# Flips pieces up \n\t\tr = row - 1\n\t\tc = col\n\n\t\twhile r >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\tr -= 1\n\t\tend\n\n\t\tif r >= 0 && @board[r][c] == disc \n\t\t\ti = row - 1\n\t\t\twhile i > r\n\t\t\t\tif(@board[i-1][col] == disc)\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\tend\n\t\tend\n\n\t\t# flips any opponent discs right\n\t\tr = row\n\t\tc = col + 1\n\t\twhile c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do\n\t\t\t\tc += 1\n\t\tend\n\n\t\tif c < @size && @board[r][c] == disc\n\t\t\tj = col + 1\n\t\t\twhile j < c\n\t\t\t\tif(@board[row][j+1] == disc) \n\t\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\tj += 1\n\t\t\tend\n\t\tend\n\n\n\t\t# flips any opponent discs left\n\t\tr = row\n\t\tc = col - 1\n\n\t\twhile c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\tc -= 1\n\t\tend\n\n\t\tif (c >= 0 && @board[r][c] == disc) \n\t\t\tj = col - 1\n\t\t\twhile j > c\n\t\t\t\tif(@board[row][j-1] == disc) \n\t\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\tj -= 1\n\t\t\tend\n\t\tend\n\n\n\t\t# flips any opponent discs diagonal up right\n\t\tr = row - 1\n\t\tc = col + 1\n\n\t\twhile r >= 0 && c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\tr -= 1\n\t\t\t\tc += 1\n\t\tend\n \n\t\tif r >= 0 && c < @size && @board[r][c] == disc \n\t\t\ti = row - 1\n\t\t\tj = col + 1\n\t\t\twhile i > r && j < c\n\t\t\t\tif(@board[i-1][j+1] == disc) \n\t\t\t\t\t\treturn true; \n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\t\tj += 1\n\t\t\tend\n\t\tend \n\n\t\t# flips any opponent discs diagonal up left\n\t\tr = row - 1\n\t\tc = col - 1\n\t\twhile r >= 0 && c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do\n\t\t\t\tr -= 1\n\t\t\t\tc -= 1\n\t\tend \n\n\t\tif r >= 0 && c >= 0 && @board[r][c] == disc\n\t\t\ti = row - 1\n\t\t\tj = col - 1\n\t\t\twhile i > r && j > c\n\t\t\t\tif @board[i-1][j-1] == disc \n\t\t\t\t\treturn true \n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\t\tj -= 1\n\t\t\tend \n\t\tend \n\n\t\t\t# flips any opponent discs diagonal down left (southwest)\n\t\t\tr = row + 1\n\t\t\tc = col - 1\n\t\t\twhile r < @size && c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\t\tr += 1\n\t\t\t\t\tc -= 1\n\t\t\tend\n\n\t\t\tif r < @size && c >= 0 && @board[r][c] == disc\n\t\t\t\ti = row + 1\n\t\t\t\tj = col - 1\n\t\t\t\twhile i < r && j > c \n\t\t\t\t\tif @board[i+1][j-1] == disc\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\tend \n\t\t\t\t\ti += 1\n\t\t\t\t\tj -= 1\n\t\t\t\tend \n\t\t\tend \n\n\t\t\t# flips any opponent discs diagonal down right\n\t\t\tr = row + 1\n\t\t\tc = col + 1\n\t\t\twhile r < @size && c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\t\tr += 1\n\t\t\t\t\tc += 1\n\t\t\tend \n\n\t\t\tif r < @size && c < @size && @board[r][c] == disc\n\t\t\t\ti = row + 1\n\t\t\t\tj = col + 1\n\t\t\t\twhile i < r && j < c\n\t\t\t\t\tif @board[i+1][j+1] == disc\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend \n\t\t\t\t\ti += 1\n\t\t\t\t\tj += 1\n\t\t\t\tend \n\t\t\tend \n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false\t# if control reaches this point, then it's not a valid move\n\tend",
"def position_taken?(board,pos)\n if board[pos.to_i]==\"X\" || board[pos.to_i] ==\"O\"\n return true\n else\n return false\n end\nend",
"def validating_position?(board, position, marker)\n \tboard[position] == position + 1\nend",
"def valid_selection?(pos)\n piece = @display.board[pos]\n piece.color == @color\n end",
"def solid?(map, row, col)\n trow = map.tile_grid[row]\n return false if trow.nil?\n tile = trow[col]\n return false if tile.nil?\n\n case tile.gfx_index\n when 3..13, 100..101\n true\n end\n end",
"def legal(coords)\n # How far piece moved from start position to end position\n distance_row = @row - coords[0]\n # if @first = true call first_move method\n if @first\n # steps for pawns first move\n first_move(coords, distance_row)\n else\n if @color == \"black\" && distance_row == 1\n legal_column(coords)\n elsif @color == \"white\" && distance_row == -1\n legal_column(coords)\n else\n puts \"greater than1.abs\"\n return false\n end\n end\n end",
"def victory_check?\n\t\toutcome = []\n\t\toutcome << three_in_a_row? << three_in_a_column? << three_in_a_diagonal?\n\t\toutcome.each do |element|\n\t\t\tif element[0] == true\n\t\t\t\t@playing = false\n\t\t\t\tputs \"GAME OVER\"\n\t\t\t\tif element[1] == @player.letter\n\t\t\t\t\tputs \"YOU WIN!\"\n\t\t\t\telse\n\t\t\t\t\tputs \"COMPUTER WINS!\"\n\t\t\t\tend\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\n\t\tif @board.available_spaces.size == 0\n\t\t\t@playing = false\n\t\t\tputs \"GAME OVER\"\n\t\t\tputs \"TIE!\"\n\t\tend\n\tend",
"def valid_move?(board, indx)\n if position_taken?(board, indx)\n false \n elsif (indx < 0 || indx > 8)\n false\n else \n true \n end \nend",
"def position_taken?(int)\n if (@board[int]==\" \") || (@board[int]==\"\")\n return false\n elsif (@board[int]==\"X\") || (@board[int]==\"O\")\n return true\n elsif (@board[int]==nil)\n return false\n end\nend",
"def position_taken?(board, index)\n space = board[index]\n if space == 'X' || space == \"O\"\n return true\n else\n return false\n end\nend",
"def check?(king_pos, player)\n danger_zone = []\n\n player.pieces.each do |piece|\n if path = piece.valid_dest?(king_pos, @board)\n danger_zone << path\n end\n end\n\n danger_zone.empty? ? false : danger_zone\n end",
"def valid_move? (board, index)\n if index.between?(0, 8) && !position_taken?(board, index)\n true \n end \nend",
"def valid_coord?(cell, ship)\n if cell && cell.empty?\n find_cells = build_ship_with_index_cell(ship.size, cell)\n if find_cells&.all? do |look_cell|\n !look_cell.nil?\n end && find_cells.select(&:empty?).count == find_cells.count\n set_ship_cells(ship, find_cells)\n true\n else\n puts \"Ship cannot be placed at this coordinate, try again\".yellow\n false\n end\n else\n puts \"Cell not available, try again\".yellow\n false\n end\n end",
"def valid_move?(cur_pos, next_pos)\n return false if @all_positions[next_pos] # no need to add already seen pos \n cur_col, cur_row = cur_pos\n next_col, next_row = next_pos\n bool_1 = (next_col - cur_col).abs == 2 && (next_row - cur_row).abs == 1\n bool_2 = (next_row - cur_row).abs == 2 && (next_col - cur_col).abs == 1\n bool_1 || bool_2\n end",
"def valid?(length, row, column, direction)\n begin\n for i in 1..length\n if @board[row][column] != \".\"\n return false\n else\n direction == \"Horizontal\" ? column += 1 : row += 1\n end\n end\n rescue\n return false\n end\n return true\n end",
"def solved?\n cols = @grid.transpose\n return false unless (0..8).all? {|i| check_cols(i) && check_row(i)}\n (0..2).each do |horiz| \n (0..2).each {|vert| return false unless check_square(horiz,vert)}\n end\n true\n end",
"def valid_move? move\n@board[move] == PIECE[:blank]\nend",
"def pos_rect?(x, y, rect)\r\r\n main_left = @x + collision_rect.x / 32.0\r\r\n main_top = @y + collision_rect.y / 32.0\r\r\n main_right = main_left + collision_rect.width / 32.0\r\r\n main_bottom = main_top + collision_rect.height / 32.0\r\r\n other_left = x + rect.x / 32.0\r\r\n other_top = y + rect.y / 32.0\r\r\n other_right = other_left + rect.width / 32.0\r\r\n other_bottom = other_top + rect.height / 32.0\r\r\n coltest = true\r\r\n coltest = false if main_right < other_left\r\r\n coltest = false if main_left > other_right\r\r\n coltest = false if main_bottom < other_top\r\r\n coltest = false if main_top > other_bottom\r\r\n if coltest == false && ($game_map.loop_horizontal? || $game_map.loop_vertical?) && x <= $game_map.width && y <= $game_map.height\r\r\n return true if $game_map.loop_horizontal? && pos_rect?(x + $game_map.width, y, rect)\r\r\n return true if $game_map.loop_vertical? && pos_rect?(x, y + $game_map.height, rect)\r\r\n end\r\r\n return coltest\r\r\n end",
"def position_taken?(pos)\r\n #true if space is empty and false if filled\r\n if @board[pos] == \" \"\r\n return false\r\n else\r\n return true\r\n end\r\n end",
"def valid_position?(x, y)\n !!(x && y && x > 0 && y > 0 && x <= 8 && y <= 8)\n end",
"def valid_play(x, y)\n temp = @board.length - 1\n x.between?(0,temp) && y.between?(0,temp) ? true : false\n end",
"def on_board?(pos)\n pos.all? {|coord| coord.between?(0, SIZE - 1)}\n end",
"def valid_move?(i, j)\n return false if i < 1 or i > @gsize or j < 1 or j > @gsize\n return @ban[j][i].empty?\n end",
"def in_check(player, board)\r\n king_loc = find_my_king(player, board)\r\n dangerous_player = offending_player(king_loc, player, board)\r\n if dangerous_player.nil?\r\n return false \r\n end\r\n return true\r\n end",
"def valid_move?(board, index)\r\n index.between?(0, 8) && !position_taken(board, index) ? true : false \r\nend",
"def position_taken?(board, idx)\n\tif board[idx] == nil || board[idx] == \"\" || board[idx] == \" \" \n\t\tfalse\n\telsif board[idx] == \"X\" || board[idx] == \"O\"\n\t\ttrue\n\telse\n\t\tfalse\n\tend\nend",
"def position_taken?(board, player_index)\n if board[player_index]== \" \" || board[player_index] == \"\" || board[player_index] == nil\n false\n else\n true\n end\nend",
"def is_under_attack?(row = @row, col = @col)\n hypothetical_board = @board.get_copy\n hypothetical_board.move(@row, @col, row, col)\n enemy_color = ChessGame.get_enemy_color(@color)\n hypothetical_board.each_piece.any? do |piece|\n not piece.is_blank_space? and piece.color == enemy_color and\n ((piece.get_type != :king and piece.get_moves.include?({ row: row, col: col })) or\n (piece.get_type == :king and piece.get_adjacent_spaces.include?({ row: row, col: col })))\n end\n end"
] |
[
"0.761069",
"0.761069",
"0.75943315",
"0.7530692",
"0.7323183",
"0.73206013",
"0.73101395",
"0.73069",
"0.72853434",
"0.7222364",
"0.7211012",
"0.72028327",
"0.7196116",
"0.71937877",
"0.71914446",
"0.71454304",
"0.71157956",
"0.70852625",
"0.70471156",
"0.7043656",
"0.69856054",
"0.6984021",
"0.6983082",
"0.69696474",
"0.6963239",
"0.6959575",
"0.69364196",
"0.6932082",
"0.692433",
"0.6917883",
"0.69116175",
"0.6901694",
"0.6901694",
"0.6899432",
"0.6860718",
"0.68599594",
"0.68541664",
"0.68463093",
"0.6840539",
"0.68371975",
"0.6835798",
"0.68317515",
"0.683036",
"0.6827998",
"0.681706",
"0.681681",
"0.68129474",
"0.6807081",
"0.6805157",
"0.68035907",
"0.68020093",
"0.6801315",
"0.6801284",
"0.67936206",
"0.67915815",
"0.6787255",
"0.6779656",
"0.67790157",
"0.67774594",
"0.67731994",
"0.67646444",
"0.67612964",
"0.67538774",
"0.6752095",
"0.67478037",
"0.6742144",
"0.67387897",
"0.67323726",
"0.6730964",
"0.67297983",
"0.67249024",
"0.67238665",
"0.67195475",
"0.6717365",
"0.67139655",
"0.67111766",
"0.67090875",
"0.6704161",
"0.67030674",
"0.66967136",
"0.66959834",
"0.66922003",
"0.6691774",
"0.66907334",
"0.66870886",
"0.66865516",
"0.66859454",
"0.6683943",
"0.6680859",
"0.6676404",
"0.66746825",
"0.6671482",
"0.6671106",
"0.6670041",
"0.66690046",
"0.66631866",
"0.6657241",
"0.665397",
"0.6653401",
"0.664854"
] |
0.7534997
|
3
|
functions for seeing if moves are valid Top
|
def canMoveTop(row,col,disc)
max = @size -1
min = 0
notDisc = ""
c = 1
if disc == "B"
notDisc = "W"
end
if disc == "W"
notDisc = "B"
end
if row-c >= min && @board[row-c][col] == notDisc
while row-c >= min && @board[row-c][col] != "-"
if @board[row-c][col] == disc
return true
end
c = c + 1
end
end
return false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def valid_move?(board, position)\n position.between?(0, 8) && !position_taken?(board, position)\nend",
"def valid_moves\n\n end",
"def valid_move?(board, position)\n !position_taken?(board, position) && position.between?(0,8)\nend",
"def valid_moves\n moves.reject { |end_pos| move_into_check?(end_pos) }\n end",
"def valid_move? (board, position)\n position = position.to_i - 1\n (position.between?(0,8)) && (position_taken?(board, position) == false)\nend",
"def valid_move?(board, position)\n position_taken?(board, position) == false && position.between?(0, 8) ? true : false\nend",
"def valid_move?(board, i)\n # check if position taken or 'out-of-bounds'\n if (position_taken?(board, i) == true) || (i > 8) || (i < 0)\n return false\n else \n return true\n end \nend",
"def valid_move?(board,position)\n position=position.to_i-1\n if position.between?(0,8) && !position_taken?(board, position)\n true\n else\n false\n end\nend",
"def valid_move?(board, index)\n index.between?(0, 8) && position_taken?(board, index) == false\n\nend",
"def valid_move?(move)\n # Array of all posiible moves , check the board and map out the possible moves from there.\n end",
"def valid_move?(board, index)\n # Is the position taken?\n pos_taken = position_taken?(board, index)\n # Is the position on the board?\n on_board = index.between?(0, board.length - 1)\n # If position is open and on the board, return true,\n if !pos_taken && on_board\n return true\n else\n return false\n end\nend",
"def valid_move?(board, position)\n if !(position_taken?(board, position)) && position.between?(0, 8)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, position)\n position = position.to_i - 1\n position_taken?(board, position) == false && position.between?(0,8) == true\nend",
"def valid_move?(board, position)\n indexed_position = position.to_i - 1\n indexed_position.between?(0,8) && !position_taken?(board, indexed_position)\nend",
"def valid_move?\n\t\t# Now let's make sure all of the moves are valid.\n\t\t# I'll do this by seeing if the sorted version of each\n\t\t# column equals the @board version.\n\t\ttemp_board = Marshal.load(Marshal.dump(@board))\n\t\ttemp = temp_board[@move_from].shift\n\t\ttemp_board[@move_to].unshift(temp)\n\n\t\ttemp_board.each do |column|\n\t\t\tif column.sort != column\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\t# If they all pass, we're good!\n\t\treturn true\n\tend",
"def valid_move?(from, to, pieces)\n # check if move is forward for plain piece (not king)\n row = Game.index_to_row(from)\n if Game.is_king?(pieces[from-1]) # kings can go in both direction\n return false if (row + 1 != Game.index_to_row(to)) and (row - 1 != Game.index_to_row(to)) \n elsif Game.is_red?(pieces[from-1])\n return false if row + 1 != Game.index_to_row(to)\n elsif Game.is_white?(pieces[from-1]) and !Game.is_king?(pieces[from-1]) # kings can go in both direction\n return false if row - 1 != Game.index_to_row(to)\n end\n map = get_possible_moves_map\n map[from].include? to\n end",
"def valid_move?(board, position)\n # position = position.to_i \n position.to_i. between?(1, 9) && !position_taken?(board, position.to_i-1)\nend",
"def valid_move?(board,position)\n valid = nil\n if position >= 0 && position <=8\n case position_taken?(board,position)\n when true\n valid = false\n when false\n valid = true\n end\n end\n\n return valid\nend",
"def valid_move?(board, position)\n position = position.to_i - 1\n if position.between?(0, 8) && !position_taken?(board, position)\n true\n end\nend",
"def valid_move?(arr)\n arr[0] >= 0 && arr[0] <= 7 && arr[1] >= 0 && arr[1] <= 7 && @board[arr[0]][arr[1]][:piece].nil?\n end",
"def valid_move?(board,pos)\n if !position_taken?(board,pos.to_i-1) && pos.to_i.between?(1,9)\n return true\n elsif position_taken?(board,pos.to_i-1) && pos.to_i.between?(1,9)\n return false\n end\nend",
"def valid_move?(board, index)\n if index.between?(0, 8) && (position_taken?(board, index) == false)\n true\n elsif (index.between?(0,8) == false) || (position_taken?(board, index) == true)\n false\n end\nend",
"def valid_moves(temp_board)\n moves.select do |end_pos|\n temp_board.valid_pos?(end_pos) && temp_board.empty?(end_pos)\n end\n end",
"def valid_move?(board, position)\n position.to_i.between?(1,9) && !position_taken?(board,position.to_i-1)\n\nend",
"def valid_move?(board, position)\n position = (position.to_i - 1)\n\n if position.between?(0, 8) && !position_taken?(board, position)\n true\n else false\n end\nend",
"def valid_moves\n valid = []\n all_moves = self.moves\n\n all_moves.each do |end_pos|\n valid << end_pos unless move_into_check(end_pos)\n end\n \n valid\n end",
"def valid_move?(position)\n position.between?(0,8) && !position_taken?(position)\n end",
"def valid_move?(board, position)\n position.to_i.between?(1,9) && !position_taken?(board, position.to_i-1)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index) #if the position isn't taken and is on the board, the move must be valid\nend",
"def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n true\n else\n false\n end\nend",
"def valid?(move,visited)\n return true if (move[0]>-1 && move[0]<8) && (move[1]>-1 && move[0]<8) && (!visited[move[0]][move[1]])\n end",
"def valid_move?(board, i)\n if i.between?(0,8) && !position_taken?(board, i)\n true\n end\n end",
"def valid_move?(board,index)\n if index.between?(0, 8) && !(position_taken?(board, index))\n true\n else \n false\n end\nend",
"def valid_move? (board, index)\n if index.between?(0, 8) && !position_taken?(board, index)\n true \n end \nend",
"def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n true\n else position_taken?(board, index) == true\n nil\n end\nend",
"def valid_move?(board, position)\n position = position.to_i - 1\n if position_taken?(board, position)\n return false\n else\n if position.between?(0,8) && (board[position] != \"X\" || board[position] != \"O\")\n return true\n else\n return false \n end\n end\nend",
"def valid_move?(board,index)\n index.between?(0,8) && !position_taken?(board,index)\nend",
"def valid_move?(board, index)\n if position_taken?(board, index)\n false\n elsif index > 8 || index < 0\n false\n else\n true\n end\nend",
"def valid_move?(board,index)\n if index < 0\n false\n else\n if index > 8\n false\n else\n !position_taken?(board,index)\n end\n end\nend",
"def valid_move?(board,index)\n if index.between?(0,8) && position_taken?(board,index)\n true\n end\nend",
"def valid_move?(board, position)\n position = position.to_i - 1\n if position_taken?(board, position) == false && position.to_i.between?(0, 8)\n return true\nelsif position_taken?(board, position) == true\n return false\nelse \n return false\nend\nend",
"def valid_move?(board, index)\n if position_taken?(board, index) == true\n false\n elsif index > 8 || index < 0\n false\n else\n true\n end\nend",
"def valid_move?(board, index)\n def position_taken?(array, indx)\n if array[indx] == \" \" || array[indx] == \"\" || array[indx] == nil\n return false\n else\n return true\n end\n end\ndef on_board?(place)\n if place.between?(0,8) == true\n return true\n else\n return false\n end\nend\nif position_taken?(board,index) == false && on_board?(index) == true\n return true\nelse\n return false\nend\nend",
"def valid_moves(from)\r\n\tpossible_moves(from).select { |move| valid_position?(move) }\r\nend",
"def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0, 8)\n true #is valid move\n else\n false\n end\nend",
"def check_valid_move to_move\r\n\t\t\r\n\t\tif to_move == 0\r\n\t\t\tif driver.location.west_road == nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\t\tend\r\n\t\t\r\n\t\telsif to_move == 1\r\n\t\t\tif driver.location.north_road == nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\t\tend\r\n\t\t\r\n\t\telsif to_move == 2\r\n\t\t\tif driver.location.east_road == nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\t\tend\r\n\t\t\r\n\t\telsif to_move == 3\r\n\t\t\tif driver.location.south_road == nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\t\tend\r\n\t\telse\r\n\t\t\traise \"The location does not exist. Error\"\r\n\t\t\r\n\t\tend\r\n\t\treturn false\r\n\tend",
"def game_over?\n possible_moves(:white).empty? && possible_moves(:black).empty? \n end",
"def valid_move?(board, position)\n if position_taken?(board, position) == false && position.to_i.between?(0,8)\n true\n else\n false\n end\n end",
"def valid_move? (board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board,index)\n if !position_taken?(board,index) && index >= 0 && index <=8\n return true\n else \n return false\n end\nend",
"def valid_move? (board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n true\n end\nend",
"def valid_move?(board, i)\n i.integer? &&\n i <= 8 && i >= 0 &&\n !position_taken?(board, i)\nend",
"def valid_move? (board, index)\n if position_taken?(board,index) != false || !(index.between?(0,8))\n return false\n elsif position_taken?(board,index) == false && index.between?(0,8)\n return true\n end\nend",
"def valid_moves(from)\n\tpossible_moves(from).select { |move| valid_position?(move) }\nend",
"def valid_move?(board,index)\n def position_taken?(array,ind)\n if array[ind] == \" \" || array[ind] == \" \" || array[ind] == nil\n return false\n else\n return true\n end\nend\n\ndef on_board?(num)\n if num.between?(0,8) == true\n return true\n else\n return false\n end\nend\n\nif (position_taken?(board, index)) == false && (on_board?(index) == true)\n return true\n else\n return false\n end\n\n\nend",
"def valid_move?(board,index)\n if (index >= 0 && index <=8)\n if (position_taken?(board,index))\n return false\n else\n return true\n end\n else\n return false\n end\nend",
"def valid_move?(board,user_input)\n taken = position_taken?(board,user_input)\n valid_input = user_input.between?(0,8)\n valid_move = nil\n if(taken)\n valid_move = false\n else\n valid_move = true\n end\n if(valid_move && valid_input)\n true\n else\n false\n end\nend",
"def valid_move?( board, index )\n if index >= 0 && index <= 8\n if position_taken?( board, index ) # this is the one\n return false\n else\n return true\n end\n else\n return false\n end\nend",
"def valid_move?(board,index)\n if index.between?(0,8) && !position_taken?(board,index)\n true\n else\n false\n end\n\nend",
"def valid_move?(board, index)\r\n index.between?(0,8) && !position_taken?(board, index)\r\nend",
"def has_top_cell?\n result = @connected_cells.select { |cell| cell.x == @x && cell.y == @y - 1 }\n !result.empty?\n end",
"def valid_move?(cur_pos, next_pos)\n return false if @all_positions[next_pos] # no need to add already seen pos \n cur_col, cur_row = cur_pos\n next_col, next_row = next_pos\n bool_1 = (next_col - cur_col).abs == 2 && (next_row - cur_row).abs == 1\n bool_2 = (next_row - cur_row).abs == 2 && (next_col - cur_col).abs == 1\n bool_1 || bool_2\n end",
"def valid_move? (board, index)\n def position_taken? (board, index)\n if board[index] == \"\" || board[index] == \" \" ||board[index] == nil\n return false\n else board[index] == \"O\" || board[index] == \"X\"\n return true\n end\n end\n\n def on_board? (index)\n if index.between?(0,8) == true\n return true\n else\n return false\n end\n end\n\n if (position_taken?(board, index) == false && on_board?(index) == true)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, index)\nif index.between?(0,8) && !position_taken?(board, index)\n true\nelse\n false\nend\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board,index)\nend",
"def valid_move?(board,position)\n if position.to_i.between?(1,9) && !position_taken?(board,position.to_i-1)\n true\n else\n end\nend",
"def valid_move?(number_entered, board)\n number_entered.between?(0, 8) && !(position_taken?(board, number_entered))\nend",
"def valid_move?(board, index)\n if !(index.between?(0,8))\n return false\n end\n if (position_taken?(board,index))\n return false\n end\n true\nend",
"def valid_move?(board, index)\nif index.between?(0,8) && !position_taken?(board, index)\n true\n else\n false\n end\nend",
"def valid_move?(fir, sec)\n if (sec < 0) || (sec > 8)\n return false\n elsif position_taken?(fir,sec)\n return false\n else\n return true\n end\nend",
"def valid_move?(board, position)\n if position.to_i>=1 && position.to_i<=9 && !position_taken?(board, position.to_i-1)\n return true\n else\n return false\n end\nend",
"def valid_move?(board,index)\n if index >= 0 && index <= 8\n if !position_taken?(board, index)\n return true\n else \n return false\n end\n else \n return false\n end\nend",
"def valid_move?(board, index)\n #this first if statement is checking if the index is on the board and if the position has been taken\n if index.between?(0,8) && position_taken?(board, index) == false\n p true\n elsif index > 9 || index < 0\n p false\n elsif position_taken?(board, index) == true\n p false\n end\nend",
"def valid_move?(board,index)\n if position_taken?(board,index) == true\n return false\n elsif index > 8 or index < 0\n return false\n else\n return true\n end\n end",
"def valid_move?(board, index)\n def position_taken?(array, ind)\n if array[ind] == \" \" || array[ind] == \"\" || array[ind] == nil\n return false\n else\n return true\n end\n end\n\n def on_board?(num)\n if num.between?(0, 8) == true\n return true\n else\n return false\n end\n end\n\n if (position_taken?(board, index)) == false && (on_board?(index) == true)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n puts \"this is a valid move\"\n return true\n else\n return false\n end\nend",
"def valid_move?(board,index = input_to_index(tato))\n if index.between?(0,8) && !position_taken?(board,index)\n true\n else\n false\n end\nend",
"def valid_move? (board, index)\n if (index).between?(0,8) == true && position_taken?(board, index) == false\n return true\n else\n return false\n end\nend",
"def valid_move?(board,position)\n if !position.is_a?(Integer)\n position = position.to_i\n end\n if(position>=1 && position<=board.length && !position_taken?(board,position))\n return true\n end\n return false\nend",
"def valid_move?(board, index)\nif position_taken?(board, index) == false\n if between?(index) == true\n true\n else\n false\n end\nelse\n false\nend\nend",
"def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n true\n end\nend",
"def valid_move? (board, index)\n if index.between?(0,8) && position_taken?(board, index) == true\n #position is between 0-8 (1-9) AND the position is available (#position_taken)\n true\n else\n false\n end\nend",
"def valid_move?(board, index)\n !(position_taken?(board,index)) && index.between?(0, 8)\nend",
"def valid_move?(board,index)\n if position_taken?(board,index)\n false\n elsif index.between?(0, 8)\n true\n end\nend"
] |
[
"0.670112",
"0.66919005",
"0.6688539",
"0.6680369",
"0.6636218",
"0.6625445",
"0.6602211",
"0.66011834",
"0.65814084",
"0.6576568",
"0.65746796",
"0.6574358",
"0.6570878",
"0.6560727",
"0.65515715",
"0.6547356",
"0.6546352",
"0.6546008",
"0.65457726",
"0.6535237",
"0.6533379",
"0.65311134",
"0.6526398",
"0.6523356",
"0.6522064",
"0.65157914",
"0.650876",
"0.6508355",
"0.65064836",
"0.6486158",
"0.64856297",
"0.64821446",
"0.6475426",
"0.64735",
"0.6469497",
"0.6466258",
"0.6465193",
"0.64632726",
"0.6459187",
"0.64544266",
"0.64528036",
"0.6452064",
"0.6448617",
"0.6447486",
"0.64468575",
"0.64463603",
"0.64455503",
"0.64450383",
"0.644325",
"0.6442101",
"0.64411074",
"0.6440923",
"0.64393616",
"0.64373624",
"0.6436782",
"0.64363974",
"0.6432656",
"0.6432482",
"0.64315337",
"0.6427958",
"0.6425103",
"0.6422744",
"0.6422119",
"0.64221084",
"0.6413449",
"0.6413077",
"0.641135",
"0.64089864",
"0.6407232",
"0.640478",
"0.64040476",
"0.6403871",
"0.64034766",
"0.64018804",
"0.6401711",
"0.6394199",
"0.6394199",
"0.6394199",
"0.63933265",
"0.63933265",
"0.63933265",
"0.63933265",
"0.63933265",
"0.63933265",
"0.63933265",
"0.63933265",
"0.63933265",
"0.63933265",
"0.63933265",
"0.63933265",
"0.63933265",
"0.6392726",
"0.6389688",
"0.6389415",
"0.6386579",
"0.6386101",
"0.6386087",
"0.6385875",
"0.6385155",
"0.63847256"
] |
0.7201266
|
0
|
Returns true if placing the specified disc at row,col is valid; else returns false
|
def isValidMoveForDisc(row, col, disc)
# TO DO: COMPLETE THIS PART OF THE METHOD
if canMoveTop(row,col,disc)
return true
end
if canMoveTopRight(row,col,disc)
return true
end
if canMoveTopLeft(row,col,disc)
return true
end
if canMoveLeft(row,col,disc)
return true
end
if canMoveRight(row,col,disc)
return true
end
if canMoveBottom(row,col,disc)
return true
end
if canMoveBottomLeft(row,col,disc)
return true
end
if canMoveBottomRight(row,col,disc)
return true
end
# DO NOT DELETE - if control reaches this statement, then it is not a valid move
return false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def valid(row, col)\n if check_row(row) and check_col(col) and check_diag(row, col)\n return true\n else\n return false\n end\n end",
"def isValidMove(row, col)\n \treturn isValidMoveForDisc(row, col, @disc)\n end",
"def isValidMove(row, col)\n \treturn isValidMoveForDisc(row, col, @disc)\n end",
"def isValidMove(row, col)\n return isValidMoveForDisc(row, col, @disc)\n end",
"def valid_position?(row, col)\n row.between?(0, 7) && col.between?(0, 7) ? true : false\n end",
"def valid?(position)\n row, col = position\n position.all? {|i| i >= 0 && i< @grid.length}\n \n end",
"def isValidMoveForDisc(row, col, disc)\n\t\tif @board[row][col] != EMPTY\n\t\t\treturn false\n\t\tend\n\n #\n # TO DO: add your code below\n #\n #puts \"isValidMoveForDisc entering\"\n if (@board[row][col]==EMPTY && (isValidMoveUp(row,col,disc) || isValidMoveDown(row,col,disc) ||isValidMoveLeft(row,col,disc) ||isValidMoveRight(row,col,disc) ||isValidMoveUpRight(row,col,disc) ||isValidMoveUpLeft(row,col,disc) ||isValidMoveDownRight(row,col,disc) ||isValidMoveDownLeft(row,col,disc)))\n return true\n end\n #puts \"isValidMoveForDisc exiting\"\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false\t# if control reaches this point, then it's not a valid move\n end",
"def valid?(pos) #getter\n #pos shoul be 2 number like [2,n]\n #need to check if [2,n] is in our @grid\n row,col = pos\n pos.all? {|num| num >= 0 && num < @n}\n end",
"def isLegalCoord(row, col)\n legal = false\n if row == '1' || row == '7'\n if col == 'A' || col == 'D' || col == 'G'\n legal = true\n end\n elsif row == '2' || row == '6'\n if col == 'B' || col == 'D' || col == 'F'\n legal = true\n end\n elsif row == '3' || row == '5'\n if col == 'C' || col == 'D' || col == 'E'\n legal = true\n end\n elsif row == '4'\n if col == 'A' || col == 'B' || col == 'C' || col == 'E' || col == 'F' || col == 'G'\n legal = true\n end\n end\n\n return legal\n end",
"def position_is_valid?(position)\r\n position.x < @col &&\r\n position.y < @row &&\r\n position.x >= 0 &&\r\n position.y >= 0\r\n end",
"def legal(coords)\n row_dist = (@row - coords[0]).abs\n col_dist = (@column - coords[1]).abs\n if row_dist > 1 || col_dist > 1\n return false\n elsif check\n puts \"cant move into check\"\n return false\n else\n return occupied?(coords)\n end\n end",
"def is_valid_index?(row, column)\r\n # Check if the specified row is out of bounds\r\n if ( row < 0 ) || ( row >= @image_array.length )\r\n return false\r\n end\r\n\r\n # Check if the specified column is out of bounds\r\n if ( column < 0 ) || ( column >= @image_array[row].length )\r\n return false\r\n end\r\n\r\n return true\r\n end",
"def check_valid(columns, row, col)\n for pre_r in 0..row-1\n pre_c = columns[pre_r]\n\n # check to see if queue in the same column\n return false if pre_c == col\n\n # check diagonals\n col_dis = (col - pre_c).abs\n row_dis = (row - pre_r).abs\n\n return false if col_dis == row_dis\n end\n true\nend",
"def invalid_move?(col)\n col = col.to_i\n i = 0 \n while i < @height && col < @width\n if @grid[i][col] == nil\n return false \n end \n i += 1 \n end \n return true \n end",
"def move_valid?(x, y)\n (0...@columns).cover?(x) && (0...@rows).cover?(y) && !@visited[x][y]\n end",
"def isValidMoveAvailableForDisc(disc)\n #\n # TO DO: add your code below\n\t\t#\n\t\tfor i in (0...@board.size)\n\t\t\tfor j in (0...@board.size)\n\t\t\t\tif isValidMoveForDisc(i, j, disc)\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false;\n\tend",
"def valid?(coordinates) ##this will need to check if the placement of coorindates is valid, sequential in row/number\n\t\thorizontal_valid?(coordinates) || vertical_valid?(coordinates)\n\tend",
"def valid_pos?(pos) # [0, -1]\n row, col = pos \n return false if row < 0 || row > 7\n return false if col < 0 || col > 7\n true \n end",
"def internal_check?(row, col)\n\n values = [@rows[row], @cols[col], @blks[find_block(row,col)]] #Values related to the section\n \n #Check for a missing value\n #------------------------------- \n values = values.flatten.uniq.join.gsub(\"0\",\"\")\n values = \"123456789\".tr(values,\"\")\n if values.length == 1\n @rows[row][col] = values.to_s\n adjust_values\n return true\n else\n return false\n end\n end",
"def valid?\n 0.upto(8) { |row| return false if @rows[row].uniq! }\n 0.upto(8) { |column| return false if @columns[column].uniq! } \n 0.upto(8) { |box| return false if @boxes[box].uniq! }\n\n return true\n end",
"def valid_sudoku(table)\n\n return true if in_row?(table) && in_column?(table) && in_box?(table)\n\n return false\n\nend",
"def solid?(map, row, col)\n trow = map.tile_grid[row]\n return false if trow.nil?\n tile = trow[col]\n return false if tile.nil?\n\n case tile.gfx_index\n when 3..13, 100..101\n true\n end\n end",
"def isValidMoveAvailableForDisc(disc)\n\n # TO DO: COMPLETE THIS PART OF THE METHOD\n for i in 0..@size-1\n for j in 0..@size-1\n if isValidMoveForDisc(i,j,disc) && @board[i][j] == \"-\"\n return true\n end\n end\n end\n\n # DO NOT DELETE - if control reaches this statement, then a valid move is not available\n return false\n end",
"def validate_position(row,col)\n if row<=@board.size and col <=@board.size\n if @board[row][col]==EMPTY_POS\n return true\n else\n puts \"position is occupied\"\n end\n else\n puts \"invalid position\"\n end\n return false\n end",
"def valid?\n (0..@dimension - 1).each do |i|\n return false unless valid_enum(row_elems(i))\n return false unless valid_enum(col_elems(i))\n return false unless valid_enum(block(i))\n end\n true\n end",
"def invalid_cell?(pos)\n pos[0] < 0 || pos[1] < 0 || pos[0] > MAXX || pos[1] > MAXY\n end",
"def valid_coord_by_diagonal?(coordinates)\n if row_ord?(coordinates) || column_ord?(coordinates)\n true\n else\n false\n end\n end",
"def validate_position(board, row, col, number)\n position_row = row\n position_col = col\n # Checks the row to ensure there's no duplicate while also checking the column to ensure there's no duplicate.\n for val in 0...9 do\n if board[val][position_col] == number || board[position_row][val] == number\n return false\n end\n end\n\n # Defining the boundaries of the block that the given position falls into...\n block_row_min = position_row / 3 * 3 # Abusing integer division to get the lower bound for the rows.\n block_row_max = block_row_min + 3 # Max is just 3 higher than that.\n block_col_min = position_col / 3 * 3 # Abusing integer division to get the lower bound for the columns.\n block_col_max = block_col_min + 3 # Max is just 3 higher than that.\n\n # Checks that the given position is valid, given the dimensions calculated above...\n for row in block_row_min...block_row_max do\n for col in block_col_min...block_col_max do # Simple double for-loop with an if statement.\n if board[row][col] == number\n return false\n end\n end\n end\n return true\n end",
"def isValidMoveForDisc(row, col, disc)\n\t\tif @board[row][col] != EMPTY\n\t\t\treturn false\n\t\tend\n\n\t\t#Flips them down\n\t\tr = row + 1\n\t\tc = col\n\t\twhile r < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\tr += 1\n\t\tend\n\n\t\tif(r < @size && @board[r][c] == disc)\n\t\t\ti = row + 1\n\t\t\twhile i < r \n\t\t\t\tif(@board[i+1][col] == disc)\n\t\t\t\t\treturn true;\n\t\t\t\tend\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\n\t\t# Flips pieces up \n\t\tr = row - 1\n\t\tc = col\n\n\t\twhile r >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\tr -= 1\n\t\tend\n\n\t\tif r >= 0 && @board[r][c] == disc \n\t\t\ti = row - 1\n\t\t\twhile i > r\n\t\t\t\tif(@board[i-1][col] == disc)\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\tend\n\t\tend\n\n\t\t# flips any opponent discs right\n\t\tr = row\n\t\tc = col + 1\n\t\twhile c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do\n\t\t\t\tc += 1\n\t\tend\n\n\t\tif c < @size && @board[r][c] == disc\n\t\t\tj = col + 1\n\t\t\twhile j < c\n\t\t\t\tif(@board[row][j+1] == disc) \n\t\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\tj += 1\n\t\t\tend\n\t\tend\n\n\n\t\t# flips any opponent discs left\n\t\tr = row\n\t\tc = col - 1\n\n\t\twhile c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\tc -= 1\n\t\tend\n\n\t\tif (c >= 0 && @board[r][c] == disc) \n\t\t\tj = col - 1\n\t\t\twhile j > c\n\t\t\t\tif(@board[row][j-1] == disc) \n\t\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\tj -= 1\n\t\t\tend\n\t\tend\n\n\n\t\t# flips any opponent discs diagonal up right\n\t\tr = row - 1\n\t\tc = col + 1\n\n\t\twhile r >= 0 && c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\tr -= 1\n\t\t\t\tc += 1\n\t\tend\n \n\t\tif r >= 0 && c < @size && @board[r][c] == disc \n\t\t\ti = row - 1\n\t\t\tj = col + 1\n\t\t\twhile i > r && j < c\n\t\t\t\tif(@board[i-1][j+1] == disc) \n\t\t\t\t\t\treturn true; \n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\t\tj += 1\n\t\t\tend\n\t\tend \n\n\t\t# flips any opponent discs diagonal up left\n\t\tr = row - 1\n\t\tc = col - 1\n\t\twhile r >= 0 && c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do\n\t\t\t\tr -= 1\n\t\t\t\tc -= 1\n\t\tend \n\n\t\tif r >= 0 && c >= 0 && @board[r][c] == disc\n\t\t\ti = row - 1\n\t\t\tj = col - 1\n\t\t\twhile i > r && j > c\n\t\t\t\tif @board[i-1][j-1] == disc \n\t\t\t\t\treturn true \n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\t\tj -= 1\n\t\t\tend \n\t\tend \n\n\t\t\t# flips any opponent discs diagonal down left (southwest)\n\t\t\tr = row + 1\n\t\t\tc = col - 1\n\t\t\twhile r < @size && c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\t\tr += 1\n\t\t\t\t\tc -= 1\n\t\t\tend\n\n\t\t\tif r < @size && c >= 0 && @board[r][c] == disc\n\t\t\t\ti = row + 1\n\t\t\t\tj = col - 1\n\t\t\t\twhile i < r && j > c \n\t\t\t\t\tif @board[i+1][j-1] == disc\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\tend \n\t\t\t\t\ti += 1\n\t\t\t\t\tj -= 1\n\t\t\t\tend \n\t\t\tend \n\n\t\t\t# flips any opponent discs diagonal down right\n\t\t\tr = row + 1\n\t\t\tc = col + 1\n\t\t\twhile r < @size && c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\t\tr += 1\n\t\t\t\t\tc += 1\n\t\t\tend \n\n\t\t\tif r < @size && c < @size && @board[r][c] == disc\n\t\t\t\ti = row + 1\n\t\t\t\tj = col + 1\n\t\t\t\twhile i < r && j < c\n\t\t\t\t\tif @board[i+1][j+1] == disc\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend \n\t\t\t\t\ti += 1\n\t\t\t\t\tj += 1\n\t\t\t\tend \n\t\t\tend \n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false\t# if control reaches this point, then it's not a valid move\n\tend",
"def solid?(map, row, col)\n return false if row < 0 || col < 0\n\n trow = map.tile_grid[row]\n return false unless trow\n trow[col]\n end",
"def valid_place?(x, y)\n @table.validate_pos(x, y)\n end",
"def check?(ptr)\n ptr_x, ptr_y = x_y(ptr)\n\n # Keep track of what we've seen\n row = {}\n col = {}\n sec = {}\n\n @board.each_with_index do |value, i|\n next if value == 0\n\n x, y = x_y(i)\n\n if y == ptr_y\n return false if row[value]\n\n row[value] = true\n end\n\n if x == ptr_x\n return false if col[value]\n\n col[value] = true\n end\n\n # Check the cells in the sector\n if x / 3 == ptr_x / 3 && y / 3 == ptr_y / 3\n return false if sec[value]\n\n sec[value] = true\n end\n end\n\n # These checks aren't *theoretically* necessary, given the algorithm,\n # but nice to have as a sanity check.\n if row.length == 9\n return false unless row.keys.inject(:+) == 45\n end\n\n if col.length == 9\n return false unless col.keys.inject(:+) == 45\n end\n\n true\n end",
"def is_valid_sudoku(board)\n transposed_board = board.transpose\n board.each_with_index do |row, r_index|\n row.each_with_index do |cell, c_index|\n # check row\n # check column\n if !check_row(row, cell, c_index) || !check_row(transposed_board[c_index], cell, r_index)\n p \"False at: #{cell}, #{r_index}, #{c_index}\"\n return false\n end\n end\n end\n return true\nend",
"def valid?(pos)\n @board.valid_pos?(pos) && (@color != @board[pos].color)\n end",
"def board_is_correct?()\n _row_checker() && _column_checker() && _square_checker\n end",
"def in_grid?(col, row)\n col.between?(0, COLUMNS - 1) && row.between?(0, ROWS - 1)\n end",
"def is_safe(x, y, sol)\n return true if x >= 0 && x < 8 && y >= 0 && y < 8 && sol[x][y] == -1\n return false\nend",
"def isValidMoveAvailableForDisc(disc)\n #\n # TO DO: add your code below\n #\n for i in 0...@size\n for j in 0...@size\n if (isValidMoveForDisc(i,j,disc))\n return true\n end\n\n end\n end\n \n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false;\n\tend",
"def valid_board_coordinates?(x, y)\n x >= 0 && y >= 0 && x < 3 && y < 3\n end",
"def contains_mine?(row, col)\n grid[row][col].fill == 1\n end",
"def viable_entry(color, x, y)\n\t\treturn false if (0..7).include?(x) == false\n\t\treturn false if (0..7).include?(y) == false\n\t\treturn false if @board[x][y].piece == nil\n\t\treturn false if @board[x][y].piece.color != color\n\t\treturn true\n\tend",
"def solved?\n cols = @grid.transpose\n return false unless (0..8).all? {|i| check_cols(i) && check_row(i)}\n (0..2).each do |horiz| \n (0..2).each {|vert| return false unless check_square(horiz,vert)}\n end\n true\n end",
"def is_valid_cell?(cell)\n if cell.nil?\n return false\n end\n\n if cell.col < 0 || cell.row < 0\n return false\n end\n\n if cell.row < @maze.size && cell.col < @maze[0].size\n return true\n end\n\n false\n end",
"def check(row, col, num)\n\t\treturn checkCol(col,num) && checkRow(row,num) && checkSubgrid(row,col,num)\n\t\n\tend",
"def valid_coord?(cell, ship)\n if cell && cell.empty?\n find_cells = build_ship_with_index_cell(ship.size, cell)\n if find_cells&.all? do |look_cell|\n !look_cell.nil?\n end && find_cells.select(&:empty?).count == find_cells.count\n set_ship_cells(ship, find_cells)\n true\n else\n puts \"Ship cannot be placed at this coordinate, try again\".yellow\n false\n end\n else\n puts \"Cell not available, try again\".yellow\n false\n end\n end",
"def within_field?(row, col)\n (row >= 0 && row < @row_count) &&\n (col >= 0 && col < @column_count)\n end",
"def valid?\n !!free_cell_index\n end",
"def valid_board?\n self.valid_rows? && self.valid_cols? && self.valid_squares?\n end",
"def sudoku_valid? grid\n \n # grid has first index for row, 2nd index for column\n \n # Check every row\n grid.each do |row|\n seen = Set.new\n (0..9).each do |row_value|\n if !seen.add?(row_value)\n return false\n end\n end\n end\n \n # Check every column\n grid.each do |row|\n seen = Set.new\n row.each do |col_value|\n if !seen.add?(col_value)\n return false\n end\n end\n end\n \n # Check every 3x3\n [0,3,6].each do |offset|\n [0,3,6].each do |offset2|\n to_check = get3by3 grid, offset, offset2\n seen = Set.new\n to_check.each do |value|\n if !seen.add?(value)\n return false\n end\n end\n end\n end\n \n \n return true\nend",
"def move_valid?(pos)\n return false unless board.in_bounds?(pos)\n return false if board.occupied?(pos) && board.grid[pos[0]][pos[1]].color == self.color\n true\n end",
"def move_valid?(x, y)\n (0...@width).cover?(x) && (0...@height).cover?(y) && !@visited[x][y]\n end",
"def coordinate_valid?(x, y)\n (x >= 0) && (y >= 0) && (x < @width) && (y < @height)\n end",
"def coordinate_valid?(x, y)\n (x >= 0) && (y >= 0) && (x < @width) && (y < @height)\n end",
"def valid_coords(i, j)\n (0...height) === i && (0...width) === j\n end",
"def inside_board?(r, c)\n (r >= 0) && (c >= 0) && (r <= @row_limit) && (c <= @column_limit)\n end",
"def is_solved?\n return false unless is_rows_valid?\n return false unless is_columns_valid?\n return false unless is_subgrids_valid?\n true\n end",
"def can_occupy_cell?(pos=false)\n # p pos\n # # byebug\n return false if pos[0] < 0 || pos[0] >= @grid.length\n return false if pos[1] < 0 || pos[1] >= @grid[0].length\n empty?(pos)\n # return false if (pos[0] >= @grid.length || pos[1] >= @grid.length)\n # return true if pos && @grid[pos[0]][pos[1]] != nil\n # false\n end",
"def is_valid_move?(proposed_row, proposed_col, solution)\n return true\nend",
"def is_safe(grid, row, column, number)\n $count += 1\n return !exist_in_row(grid, row, number) && !exist_in_column(grid, column, number) && !exists_in_box(grid, row - (row % 3), column - (column % 3), number)\nend",
"def valid_coordinate?(coordinate)\n @board_hash.include?(coordinate)\n end",
"def valid_move?(row, col, queens)\n # Go through each of the current valid moves\n queens.each do |q_pos|\n # Grab the coords\n q_row, q_col = q_pos\n\n # If the coords to be checked land on either the same col or row as an existing\n # valid move, the coords are invalid\n return false if q_row == row || q_col == col\n # Check to see if the slope between the coords and any valid moves is equal to 1.\n # Having a slope of 1 on board means the two points are on the same diagonal line.\n return false if ((row - q_row) / (col - q_col).to_f).abs == 1\n end\n\n true\nend",
"def valid_value?(row, column)\n return false unless %w[A B C].include?(row)\n return false unless [1,2,3].include?(column)\n true\n end",
"def space_open?(column, row)\n @board[column][row] == @empty_square ? true : false\n end",
"def valid?\n return false if @first_row_index.nil?\n return false if @first_cell_index.nil?\n return false if @last_row_index.nil?\n return false if @last_cell_index.nil?\n return false if @allow_splitting.nil?\n true\n end",
"def can_be_placed?(x, y)\n return false unless (0..(rows - 1)).include?(x)\n return false unless (0..(columns - 1)).include?(y)\n\n true\n end",
"def valid_coordinate?(coord)\n if coord.size == 2 && coord[0].between?(0, 7) && coord[1].between?(0, 7)\n true\n else\n false\n end\n end",
"def valid_move?(to_row, to_col, board, color)\r\n return false if super == false\r\n return legal_move?(to_row, to_col, board) && move_not_in_check?(@row, @col, to_row, to_col, board)\r\n\tend",
"def is_legal?(pos)\n # checks if there is a piece in the spot and whether it is the same\n # color. Also checks if it is off of the board.\n return false unless pos[0].between?(0, 7) && pos[1].between?(0, 7)\n return true if board[pos.first][pos.last].nil?\n return false if self.color == board[pos.first][pos.last].color\n\n true\n end",
"def validation(board, xblks, yblks)\n # row in valid\n\n \tfor x in 0..board.length-1\n \t\tcol = Array.new\n \t\trow = Array.new(board[x]) #need new array not modify board via reference\n\t\tblock = Array.new(board.length) {Array.new}\n \t\tfor y in 0..board.length-1\n if (board[y][x] != 0)\n\n \t\t\t\tcol.concat([board[y][x]])\n\t\t\tend\n\n\t\t\tputs [y, x]\n \t\t\tputs \"\"\n\t\t\tif (board[x][y] != 0)\n \t\t\t\tblk = (x/xblks).floor + yblks * (y/yblks).floor\n\t\t\t\tblock[blk-1].concat([board[x][y]])\n\t\t\tend\n \t \tend\n\t\trow.delete(0)\n\n \t\tif (col.uniq! != nil or row.uniq! != nil)\n\n\n\t\t\treturn false\n\t\tend\n\n\n \tend\n\n for each in block\n\t\tif each.uniq! != nil\n\t\t\treturn false\n\t\tend\n\tend\n\treturn true\n end",
"def count_valid_cell(row, col)\n if row == -1 || row == grid.row_count\n 0\n elsif col == -1 || col == grid.column_count\n 0\n elsif !grid[row, col]\n 0\n else\n 1\n end\n end",
"def square? \n (@rows == @cols) && @rows > 0 ? true : false\n end",
"def in_image(row, column)\n\t\treturn (0<=row and row<@height and 0<=column and column<@width)\n\tend",
"def valid_cell?(coordinates)\n @board.cells[coordinates[0]][coordinates[1]].state == \" \"\n end",
"def isSolid(x, y)\n (y < -500|| @tiles[x / 50][y / 50]) &&\n ((not @tiles[x / 50][y / 50] == 2) && (not @tiles[x / 50][y / 50] == 3) && (not @tiles[x / 50][y / 50] == 4) && (not @tiles[x / 50][y / 50] == 5) &&\n (not @tiles[x / 50][y / 50] == 6) && (not @tiles[x / 50][y / 50] == 7) && (not @tiles[x / 50][y / 50] == 8) && (not @tiles[x / 50][y / 50] == 9) &&\n (not @tiles[x / 50][y / 50] == 10) && (not @tiles[x / 50][y / 50] == 11) && (not @tiles[x / 50][y / 50] == 12) && (not @tiles[x / 50][y / 50] == 13))\n\n # @tiles[x][y] == nul return false\n # Champi = 2\n # Pic = 3\n # Poison = 4\n # Rateau = 5\n # Piege = 6\n # EpvtG = 7\n # EpvtM = 8\n # GravityMoins = 9\n # GravityPlus = 10\n # ResetEffect = 11\n # PicsInv = 12\n # ChampiInv = 13\n end",
"def check_grid_coordinates(x, y)\n (x >= 0) && (x < @height) && (y >= 0) && (y < @width)\n end",
"def consistent?\n ret = true\n # Check every row first\n @board.each_row do |row|\n row_numbers = Set.new\n row.each do |cell|\n n = cell.number\n if n and row_numbers.include? n\n ret = false\n end\n row_numbers << n\n end\n end\n # Check every column\n @board.each_column do |col|\n col_numbers = Set.new\n col.each do |cell|\n n = cell.number\n if n and col_numbers.include? n\n ret = false\n end\n col_numbers << n\n end\n end\n # Check every region\n @board.each_region do |reg|\n reg_numbers = Set.new\n reg.each do |cell|\n n = cell.number\n if n and reg_numbers.include? n\n ret = false\n end\n reg_numbers << n\n end\n end\n return ret\n end",
"def valid_square?(pos)\n y, x = pos\n y.between?(0, @Y_DIM-1) && x.between?(0, @X_DIM-1)\n end",
"def is_valid?(x, y)\n return false if x < 0 || x >= @matrix.first.length\n return false if y < 0 || y >= @matrix.length\n return false unless @matrix[y][x] == 1\n return false if @visited[y][x]\n true\n end",
"def input_grid_valid?(mars_top_right_x, mars_top_right_y)\n # rubocop:disable RescueModifier\n result = Integer(mars_top_right_x) && Integer(mars_top_right_y) rescue false\n result\n end",
"def check_valid_position(xcoord, ycoord)\n\tif xcoord >= GRID_SIZE || xcoord < 0\n\t\treturn false\n\telsif ycoord >= GRID_SIZE || ycoord < 0\n\t\treturn false\n\telse\n\t\treturn true\n\tend\nend",
"def inside_boundary?()\n @col_idx >= 0 and @col_idx < @@col_count and @row_idx >= 0 and @row_idx < @@row_count\n end",
"def valid_coordinates?(x, y)\n (1..board_width).include?(x.to_i + 1) &&\n (1..board_height).include?(y.to_i + 1)\n end",
"def valid_pos?(pos)\n indices = []\n @board.each do |row|\n row.each do |col|\n indices << [row, col]\n end\n end\n indices.include?(pos)\n end",
"def valid_place?(x_position, y_position)\n x_position.between?(0, @dimension) &&\n y_position.between?(0, @dimension)\n end",
"def obstructed_move?(row, col)\n current_row = self.row_position\n current_col = self.col_position\n\n # check if piece is blocking the path in positive vertical direction\n if current_col == col && row > current_row\n for i in (current_row+1...row)\n self.game.occupied?(i, col)\n end\n end\n\n # check if piece is blocking the path in negative vertical direction\n if current_col == col && row < current_row\n for i in (row+1...current_row)\n self.game.occupied?(i, col)\n end\n end\n\n # check if piece is blocking the path in positive horizontal direction\n if current_row == row && col > current_col\n for i in (current_col+1...col)\n self.game.occupied?(row, i)\n end\n end\n\n # check if piece is blocking the path in negative horizontal direction\n if current_row == row && col < current_col\n for i in (col+1...current_col)\n self.game.occupied?(row, i)\n end\n end\n\n return false\n end",
"def valid_pos?(pos)\n range = (0...@board.grid.length).to_a\n pos.length == 2 && range.include?(pos[0]) && range.include?(pos[1])\n end",
"def valid_placement?\n\t\t@table.placed_on_table?(@x, @y) && @robot.vectors.include?(@robot_direction)\n\tend",
"def can_place?(piece_variant, x, y)\n if(x+1 < piece_variant.width || y > @height - piece_variant.height)\n false\n else\n piece_variant.width.times do |wIdx|\n col = x - piece_variant.width + wIdx + 1\n piece_variant.height.times do |hIdx|\n return false if(@grid[col][y + hIdx] != 0 && piece_variant.configuration[wIdx][hIdx] != 0)\n end\n end\n true\n end\n end",
"def valid_position?(x, y)\n !!(x && y && x > 0 && y > 0 && x <= 8 && y <= 8)\n end",
"def valid_column(column)\n bits = 0\n\n @size.times { |i|\n if @state[(@size *i) + column]\n bits += 1\n if bits > 1\n return false\n end\n end\n }\n\n return true\n end",
"def on_table?(x,y)\n (0 <= x && x < GRID_X) && (0 <= y && y < GRID_Y)\n end",
"def validate_position(row, column)\n\n # Assume the move is invalid\n result = false\n\n # Is this cell within the range of the board?\n if row <= @board.size and column <= @board.size\n\n # Yes, was this cell previously empty?\n if @board[row][column] == EMPTY_POSITION\n\n # Yes, the move is valid\n result = true\n\n else\n\n # No, this cell wasn't empty\n puts \"That position is occupied.\"\n\n end\n\n else\n\n # No, this cell is off the board\n puts \"Invalid position.\"\n\n end\n\n return result\n\n end",
"def valid_rows?\n valid = true\n row = 0\n while (row < @board.length && valid)\n valid = false if !unique_arr?(@board[row])\n row += 1\n end\n valid\n end",
"def valid?\n 1.upto(puzzle.size) { |index| return false unless valid_row?(index - 1) && valid_column?(index - 1) }\n sections.all? { |section| valid_section?(section) }\n end",
"def draw?\n @grid.each { |columns| columns.each { |cell| return false if cell.color == ' '}}\n return true\n end",
"def valid_selection?(pos)\n piece = @display.board[pos]\n piece.color == @color\n end",
"def valid?\n # Valid puzzle has 9 rows.\n unless @puzzle.size == 9\n raise RuntimeError, \"Sudoku puzzle must have 9 rows.\"\n end\n\n # Valid puzzle has 9 columns of 9 cells.\n each_row do |row|\n unless row.size == 9\n raise RuntimeError, \"Each row in the Sudoku puzzle must have 9 cells.\"\n end\n end\n\n # Valid puzzle has valid cells.\n each do |cell|\n cell.valid?\n end\n\n #TODO: Find out if there are conflicts in row, column or nonet.\n\n # If we get this far without error, the puzzle is valid.\n return true\n end",
"def valid_move?(row, position)\n # need to shortcirtuit for position\n cells[row] && cells[row][position] == \" \"\n end",
"def check_diag(row, col)\n\n # North-East diagonal\n row_i = row-1\n col_i = col+1\n while row_i > -1 and col_i < 8\n if @board[row_i][col_i] == '*'\n return false\n end\n row_i -= 1\n col_i += 1\n end\n\n # North-West diagonal\n row_i = row-1\n col_i = col-1\n while row_i > -1 and col_i > -1\n if @board[row_i][col_i] == '*'\n return false\n end\n row_i -= 1\n col_i -= 1\n end\n\n # South-East diagonal\n row_i = row+1\n col_i = col+1\n while row_i < 8 and col_i < 8\n if @board[row_i][col_i] == '*'\n return false\n end\n row_i += 1\n col_i += 1\n end\n\n # South-West diagonal\n row_i = row+1\n col_i = col-1\n while row_i < 8 and col_i > -1\n if @board[row_i][col_i] == '*'\n return false\n end\n row_i += 1\n col_i -= 1\n end\n\n return true\n end",
"def board_solved?\r\n # Check that all the cells are filled with values\r\n #\r\n (0 .. 8).each do |row|\r\n (0 .. 8).each do |col|\r\n return false unless board[row][col] > 0\r\n end\r\n end\r\n \r\n # Check column constraints\r\n #\r\n @board.each do |column|\r\n return false unless column.uniq.size == 9\r\n end\r\n \r\n # Check row constraints\r\n #\r\n @board.transpose.each do |column|\r\n return false unless column.uniq.size == 9\r\n end\r\n \r\n # Check box constraints\r\n #\r\n (0 .. 2).each do |box_x|\r\n (0 .. 2).each do |box_y|\r\n box_vals = []\r\n \r\n (0 .. 2).each do |i|\r\n (0 .. 2).each do |j|\r\n box_vals << @board[3 * box_x + i][3 * box_y + j]\r\n end\r\n end\r\n \r\n return false unless box_vals.uniq.size == 9\r\n end\r\n end\r\n \r\n true\r\n end"
] |
[
"0.76600814",
"0.7609696",
"0.7609696",
"0.75011873",
"0.74154174",
"0.72540426",
"0.72275454",
"0.71698076",
"0.7149026",
"0.70524174",
"0.6981378",
"0.6978048",
"0.688359",
"0.6878643",
"0.6874307",
"0.6853557",
"0.6846965",
"0.6845033",
"0.68435013",
"0.68350655",
"0.6828611",
"0.68120265",
"0.67974365",
"0.67652553",
"0.6754388",
"0.67309594",
"0.6725965",
"0.6725492",
"0.67198664",
"0.67100036",
"0.6704756",
"0.6700327",
"0.6690962",
"0.6654135",
"0.66504586",
"0.6648338",
"0.66224843",
"0.66202927",
"0.6616284",
"0.66115713",
"0.6611455",
"0.6592396",
"0.65760803",
"0.65716976",
"0.6559861",
"0.654388",
"0.6532875",
"0.65324116",
"0.65285665",
"0.65263325",
"0.6513454",
"0.65089875",
"0.65089875",
"0.6506429",
"0.6505573",
"0.6498531",
"0.64963",
"0.64925647",
"0.6482749",
"0.64570415",
"0.64482456",
"0.6446824",
"0.64398015",
"0.6433103",
"0.64290476",
"0.6427546",
"0.64203703",
"0.6398285",
"0.63927156",
"0.6391381",
"0.63792837",
"0.6361666",
"0.635894",
"0.6357416",
"0.6344654",
"0.6344194",
"0.6339565",
"0.63363713",
"0.63348484",
"0.63338155",
"0.63317853",
"0.63145727",
"0.6311648",
"0.6311601",
"0.6300593",
"0.62862134",
"0.62705696",
"0.626647",
"0.626568",
"0.6260907",
"0.6250377",
"0.62314034",
"0.62312925",
"0.62271166",
"0.622456",
"0.621871",
"0.6218331",
"0.6210991",
"0.6210773",
"0.6209923"
] |
0.7539409
|
3
|
Places the disc of current player at row,col and flips the opponent discs as needed
|
def placeDiscAt(row, col)
if (!isValidMove(row, col))
return
end
# place the current player's disc at row,col
@board[row][col] = @disc
# TO DO: COMPLETE THIS PART OF THE METHOD
c = 1
notDisc = ""
if @disc == "B"
notDisc = "W"
end
if @disc == "W"
notDisc = "B"
end
#Top
if canMoveTop(row,col,@disc)
while @board[row-c][col] == notDisc
@board[row-c][col] = @disc
c = c + 1
end
c = 1 #reset c
end
#Top Right
if canMoveTopRight(row,col,@disc)
while @board[row-c][col+c] == notDisc
@board[row-c][col+c] = @disc
c = c + 1
end
c = 1 #reset c
end
#Top Left
if canMoveTopLeft(row,col,@disc)
while @board[row-c][col-c] == notDisc
@board[row-c][col-c] = @disc
c = c + 1
end
c = 1 #reset c
end
#Left
if canMoveLeft(row,col,@disc)
while @board[row][col-c] == notDisc
@board[row][col-c] = @disc
c = c + 1
end
c = 1 #reset c
end
#Right
if canMoveRight(row,col,@disc)
while @board[row][col+c] == notDisc
@board[row][col+c] = @disc
c = c + 1
end
c = 1 #reset c
end
#Bottom Left
if canMoveBottomLeft(row,col,@disc)
while @board[row+c][col-c] == notDisc
@board[row+c][col-c] = @disc
c = c + 1
end
c = 1 #reset c
end
#Bottom
if canMoveBottom(row,col,@disc)
while @board[row+c][col] == notDisc
@board[row+c][col] = @disc;
c = c + 1
end
c = 1 #reset c
end
#Bottom Right
if canMoveBottomRight(row,col,@disc)
while @board[row+c][col+c] == notDisc
@board[row+c][col+c] = @disc;
c = c + 1
end
c = 1 #reset c
end
# DO NOT DELETE - prepares for next turn if game is not over
if (!isGameOver())
prepareNextTurn();
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def placeDiscAt(row, col)\n\t\tif (!isValidMove(row, col))\n\t\t\treturn\n\t\tend\n\n #\n # TO DO: add your code below\n\t\t#\n\t\t@board[row][col] = @disc;\n\t\t# flips any opponent discs down\n\t\tr = row + 1\n\t\tc = col\n\t\twhile r < @size && @board[r][c] != EMPTY && @board[r][c] != @disc do\n\t\t\t\tr += 1\n\t\tend\n\n\t\tif (r < @size && @board[r][c] == @disc) \n\t\t\ti = row + 1\n\t\t\twhile i < r \n\t\t\t\t@board[i][col] = @disc\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\n\t\t# flips any opponent discs up\n\t\tr = row - 1\n\t\tc = col\n\n\t\twhile r >= 0 && @board[r][c] != EMPTY && @board[r][c] != @disc do\n\t\t\t\tr -= 1\n\t\tend\n\n\t\tif r >= 0 && @board[r][c] == @disc \n\t\t\ti = row - 1\n\t\t\twhile i > r \n\t\t\t\t@board[i][col] = @disc\n\t\t\t\ti -= 1\n\t\t\tend\n\t\tend\n\n\t\t# flips any opponent discs right\n\t\tr = row\n\t\tc = col + 1\n\t\twhile c < @size && @board[r][c] != EMPTY && @board[r][c] != @disc do\n\t\t\t\tc += 1\n\t\tend\n\n\t\tif c < @size && @board[r][c] == @disc\n\t\t\tj = col + 1\n\t\t\twhile j < c\n\t\t\t\t\t@board[row][j] = @disc\n\t\t\t\t\tj += 1\n\t\t\tend\n\t\tend \n\n\t\t# flips any opponent discs left\n\t\tr = row\n\t\tc = col - 1\n\t\twhile c >= 0 && @board[r][c] != EMPTY && @board[r][c] != @disc do\n\t\t\t\tc -= 1\n\t\tend\n\n\t\tif c >= 0 && @board[r][c] == @disc \n\t\t\tj = col - 1\n\t\t\twhile j > c\n\t\t\t\t@board[row][j] = @disc\n\t\t\t\tj -= 1\n\t\t\tend\n\t\tend \n\n\t\t# flips any opponent discs diagonal up right\n\t\tr = row - 1\n\t\tc = col + 1\n\t\twhile r >= 0 && c < @size && @board[r][c] != EMPTY && @board[r][c] != @disc do\n\t\t\t\tr -= 1\n\t\t\t\tc += 1\t\t\n\t\tend \n\n\t\tif r >= 0 && c < @size && @board[r][c] == @disc\n\t\t\t\ti = row - 1\n\t\t\t\tj = col + 1\n\t\t\t\twhile i > r && j < c \n\t\t\t\t\t@board[i][j] = @disc\n\t\t\t\t\ti -= 1\n\t\t\t\t\tj += 1\n\t\t\t\tend \n\t\tend\n\n\t\t# flips any opponent discs diagonal up left\n\t\tr = row - 1\n\t\tc = col - 1\n\t\twhile r >= 0 && c >= 0 && @board[r][c] != EMPTY && @board[r][c] != @disc do \n\t\t\t\tr -= 1\n\t\t\t\tc -= 1\n\t\tend \n\n\t\tif r >= 0 && c >= 0 && @board[r][c] == @disc\n\t\t\ti = row - 1\n\t\t\tj = col - 1\n\t\t\twhile i > r && j > c\n\t\t\t\t\t\t@board[i][j] = @disc\n\t\t\t\t\t\ti -= 1\n\t\t\t\t\t\tj -= 1\n\t\t\tend \n\t\tend \n\n\t\t# flips any opponent discs diagonal down left (southwest)\n\t\tr = row + 1\n\t\tc = col - 1\n\t\twhile r < @size && c >= 0 && @board[r][c] != EMPTY && @board[r][c] != @disc do \n\t\t\t\tr += 1\n\t\t\t\tc -= 1\n\t\tend \n\n\t\tif r < @size && c >= 0 && @board[r][c] == @disc\n\t\t\ti = row + 1\n\t\t\tj = col - 1\n\t\t\twhile i < r && j > c \n\t\t\t\t\t@board[i][j] = @disc\n\t\t\t\t\ti += 1\n\t\t\t\t\tj -= 1\n\t\t\tend\n\t\tend\n\n\t\t # flips any opponent discs diagonal down right\n\t\t r = row + 1\n\t\t c = col + 1\n\t\t while r < @size && c < @size && @board[r][c] != EMPTY && @board[r][c] != @disc do \n\t\t\t\t r += 1\n\t\t\t\t c += 1\n\t\t end \n\n\t\t if r < @size && c < @size && @board[r][c] == @disc\n\t\t\ti = row + 1\n\t\t\tj = col + 1\n\t\t\twhile i < r && j < c\n\t\t\t\t@board[i][j] = @disc\n\t\t\t\ti += 1\n\t\t\t\tj += 1\n\t\t\tend \n\t\tend \n\n # DO NOT DELETE THE CODE BELOW\n\t\tif (!isGameOver())\n\t\t\tprepareNextTurn(); # prepare for next turn\n\t\tend\n\tend",
"def switch_sides(player)\n\t\tputs \"---------------\"\n\t\tshow_board\n\t\tputs \"Switching sides... #{player}'s turn.\"\n\t\trotate_board\n\t\tputs \"---------------\"\n\tend",
"def placeDiscAt(row, col)\n\t\tif (!isValidMove(row, col))\n\t\t\treturn\n\t\tend\n\n #\n # TO DO: add your code below\n #\n begin\n @board[row][col] = @disc\n puts \"entering the meat of the checkers\"\n if (isValidMoveUp(row,col,@disc))\n puts \"up\"\n j = col-1\n while (@board[row][j]==oppColor(@disc))\n \n @board[row][j]=@disc\n j -= 1\n end\n end\n if (isValidMoveDown(row,col,@disc))\n puts \"down\"\n j = col+1\n while (@board[row][j]==oppColor(@disc))\n puts j\n @board[row][j]=@disc\n j += 1\n puts \"finished iteration\"\n end\n puts \"ending down\"\n end\n if (isValidMoveLeft(row,col,@disc))\n puts \"left\"\n i = row-1\n puts \"entering loop\"\n while (@board[i][col]==oppColor(@disc))\n puts i\n @board[i][col]=@disc\n i -= 1\n end\n end\n if (isValidMoveRight(row,col,disc))\n puts \"right\"\n i = row+1\n \n while (@board[i][col]==oppColor(@disc))\n \n @board[i][col]=@disc\n i += 1\n end\n end\n if (isValidMoveDownRight(row,col,@disc))\n puts \"downright\"\n i = row+1\n j = col-1\n while (@board[i][j]==oppColor(@disc))\n \n @board[i][j]=@disc\n i += 1\n j -= 1\n end\n end\n if (isValidMoveUpLeft(row,col,@disc))\n puts \"upleft\"\n i = row-1\n j = col+1\n while (@board[i][j]==oppColor(@disc))\n \n @board[i][j]=@disc\n i -= 1\n j += 1\n end\n end\n if (isValidMoveUpRight(row,col,@disc))\n puts \"upright\"\n i = row+1\n j = col+1\n while (@board[i][j]==oppColor(@disc))\n \n @board[i][j]=@disc\n i += 1\n j += 1\n end\n end\n if (isValidMoveDownLeft(row,col,@disc))\n puts \"downleft\"\n i = row-1\n j = col-1\n while (@board[i][j]==oppColor(@disc))\n \n @board[i][j]=@disc\n i -= 1\n j -= 1\n end\n end\n rescue TypeError, NoMethodError\n puts \"Type error executed (out of bounds?)\"\n end\n # DO NOT DELETE THE CODE BELOW\n\t\tif (!isGameOver())\n\t\t\tprepareNextTurn() # prepare for next turn\n end\n puts \"all done\"\n\tend",
"def isValidMoveForDisc(row, col, disc)\n\t\tif @board[row][col] != EMPTY\n\t\t\treturn false\n\t\tend\n\n\t\t#Flips them down\n\t\tr = row + 1\n\t\tc = col\n\t\twhile r < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\tr += 1\n\t\tend\n\n\t\tif(r < @size && @board[r][c] == disc)\n\t\t\ti = row + 1\n\t\t\twhile i < r \n\t\t\t\tif(@board[i+1][col] == disc)\n\t\t\t\t\treturn true;\n\t\t\t\tend\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\n\t\t# Flips pieces up \n\t\tr = row - 1\n\t\tc = col\n\n\t\twhile r >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\tr -= 1\n\t\tend\n\n\t\tif r >= 0 && @board[r][c] == disc \n\t\t\ti = row - 1\n\t\t\twhile i > r\n\t\t\t\tif(@board[i-1][col] == disc)\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\tend\n\t\tend\n\n\t\t# flips any opponent discs right\n\t\tr = row\n\t\tc = col + 1\n\t\twhile c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do\n\t\t\t\tc += 1\n\t\tend\n\n\t\tif c < @size && @board[r][c] == disc\n\t\t\tj = col + 1\n\t\t\twhile j < c\n\t\t\t\tif(@board[row][j+1] == disc) \n\t\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\tj += 1\n\t\t\tend\n\t\tend\n\n\n\t\t# flips any opponent discs left\n\t\tr = row\n\t\tc = col - 1\n\n\t\twhile c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\tc -= 1\n\t\tend\n\n\t\tif (c >= 0 && @board[r][c] == disc) \n\t\t\tj = col - 1\n\t\t\twhile j > c\n\t\t\t\tif(@board[row][j-1] == disc) \n\t\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\tj -= 1\n\t\t\tend\n\t\tend\n\n\n\t\t# flips any opponent discs diagonal up right\n\t\tr = row - 1\n\t\tc = col + 1\n\n\t\twhile r >= 0 && c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\tr -= 1\n\t\t\t\tc += 1\n\t\tend\n \n\t\tif r >= 0 && c < @size && @board[r][c] == disc \n\t\t\ti = row - 1\n\t\t\tj = col + 1\n\t\t\twhile i > r && j < c\n\t\t\t\tif(@board[i-1][j+1] == disc) \n\t\t\t\t\t\treturn true; \n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\t\tj += 1\n\t\t\tend\n\t\tend \n\n\t\t# flips any opponent discs diagonal up left\n\t\tr = row - 1\n\t\tc = col - 1\n\t\twhile r >= 0 && c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do\n\t\t\t\tr -= 1\n\t\t\t\tc -= 1\n\t\tend \n\n\t\tif r >= 0 && c >= 0 && @board[r][c] == disc\n\t\t\ti = row - 1\n\t\t\tj = col - 1\n\t\t\twhile i > r && j > c\n\t\t\t\tif @board[i-1][j-1] == disc \n\t\t\t\t\treturn true \n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\t\tj -= 1\n\t\t\tend \n\t\tend \n\n\t\t\t# flips any opponent discs diagonal down left (southwest)\n\t\t\tr = row + 1\n\t\t\tc = col - 1\n\t\t\twhile r < @size && c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\t\tr += 1\n\t\t\t\t\tc -= 1\n\t\t\tend\n\n\t\t\tif r < @size && c >= 0 && @board[r][c] == disc\n\t\t\t\ti = row + 1\n\t\t\t\tj = col - 1\n\t\t\t\twhile i < r && j > c \n\t\t\t\t\tif @board[i+1][j-1] == disc\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\tend \n\t\t\t\t\ti += 1\n\t\t\t\t\tj -= 1\n\t\t\t\tend \n\t\t\tend \n\n\t\t\t# flips any opponent discs diagonal down right\n\t\t\tr = row + 1\n\t\t\tc = col + 1\n\t\t\twhile r < @size && c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\t\tr += 1\n\t\t\t\t\tc += 1\n\t\t\tend \n\n\t\t\tif r < @size && c < @size && @board[r][c] == disc\n\t\t\t\ti = row + 1\n\t\t\t\tj = col + 1\n\t\t\t\twhile i < r && j < c\n\t\t\t\t\tif @board[i+1][j+1] == disc\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend \n\t\t\t\t\ti += 1\n\t\t\t\t\tj += 1\n\t\t\t\tend \n\t\t\tend \n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false\t# if control reaches this point, then it's not a valid move\n\tend",
"def resetBoard (player)\n\t\tif(player.side == 1)\n\t\t\t@p1Board.each do |c|\n\t\t\t\tc.played = false\n\t\t\tend\n\t\telsif(player.side == 2)\n\t\t\t@p2Board.each do |c|\n\t\t\t\tc.played = false\n\t\t\tend\n\t\tend\n\tend",
"def get_disc(row, col)\n @board[row * @size + col]\n end",
"def turn_to_player\n diffx = @x - $game.player.x\n diffy = @y - $game.player.y\n down = diffy < 0\n left = diffx > 0\n right = diffx < 0\n up = diffy > 0\n if down\n @direction = 2\n elsif up\n @direction = 8\n elsif left\n @direction = 4\n elsif right\n @direction = 6\n end\n end",
"def turn\n marker = @turn_count.even? ? marker = \"X\" : marker = \"O\"\n move\n print \"Current board: \"\n show_board\n @player +=1\n end",
"def turn\n victory = false\n while victory == false do\n player_place\n @board.show_board\n end\n end",
"def flip_board\n\t\t\t@player1.tokens.each do |pieces|\n\t\t\t\tpieces.each do |piece|\n\t\t\t\t\tpiece.flip #should mirror the piece on board\n\t\t\t\tend\n\t\t\tend\n\t\t\t@player2.tokens.each do |pieces|\n\t\t\t\tpieces.each do |piece|\n\t\t\t\t\tpiece.flip #should mirror the piece on board\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def opponent(player)\n @sides[0]\n end",
"def move_piece_back\n @chess_board.board[@row][@col] = @chess_board.board[@row_new][@col_new]\n end",
"def populate_board\n #the six rows get updated\n players.each do |player|\n rows = player == players[0] ? [ 0,1,2 ] : [ 5,6,7 ]\n piece_count = 0\n col = 0\n\n player.pieces.each do |piece|\n\n rows.shift if piece_count % 4 == 0 and piece_count != 0\n\n col_start = rows[0] % 2 == 1 ? 0 : 1\n col = 0 if (col_start == 0 || col_start == 1) && piece_count % 4 == 0\n\n piece.position = [col + col_start, rows[0]]\n squares[[col + col_start, rows[0]]] = piece\n\n col += 2\n piece_count += 1\n\n end\n\n end\n\n end",
"def current_player_effect\n # Retire 1 au nombre de cartes a piocher du joueur en cours\n if @current_player.draw_card_count >= 1\n @current_player.draw_card_count -= 1\n end\n # Enleve une carte mixed de la main du joueur en cours\n @current_player.cards.delete_at(@current_player.cards.index(\"lock_down\"))\n end",
"def play_round\n system(\"clear\")\n @board.render\n puts\n full_move = self.get_full_move\n pos = self.get_position(full_move)\n action = self.get_action(full_move)\n while action.downcase == \"e\" && !(self.valid_flip?(pos))\n self.display_unflag_message\n full_move = self.get_full_move\n pos = self.get_position(full_move)\n action = self.get_action(full_move)\n end\n action.downcase == \"e\" ? @board[pos].reveal : @board[pos].toggle_flag\n @board.reveal_bombs if @board.is_a_bomb?(pos) && @board[pos].revealed\n end",
"def set_disc(row, col, value)\n @board[row * @size + col] = value\n end",
"def play_piece(index,player,grid)\n row = 7\n col = index\n\n while grid[row][col] != \".\"\n row -= 1\n end\n\n # creates \"dropping\" animation for the piece played\n drop_row = 0\n until drop_row == row\n grid[drop_row][col] = player\n print_board(grid)\n sleep(0.05)\n grid[drop_row][col] = \".\"\n drop_row += 1\n end\n\n grid[row][col] = player\n\n coordinates = [row,col]\n return coordinates\nend",
"def advance_player(player)\n if @player_positions[player] > 79\n return player\n end\n @board.slice!(@player_positions[player])\n @board.insert(@player_positions[player], \"~\")\n @player_positions[player] += Die.new.roll\n\n @board.slice!(@player_positions[player])\n @board.insert(@player_positions[player], player)\n # puts @board\n @board = @board\n # p \"Player a: #{@player_positions[\"a\"]}\"\n # p \"Player b: #{@player_positions[\"b\"]}\"\n \n end",
"def turn(row, column)\n place_piece(row, column)\n puts display_board\n check_for_win() \n end",
"def repos_enemy\n @enemies.each do |i|\n i.x -= @delta_x\n i.y -= @delta_y\n end\n @ground.x -= @delta_x\n @ground.y -= @delta_y\n end",
"def moves\n # All pieces can stay in place\n [[0,0]]\n end",
"def switch_Up(row,column)\n tempr = row-1\n while row>-1\n if @player_turn== \"white\"\n if @game_board[row][column] == 0 && row<tempr\n break\n elsif @game_board[row][column] == 1\n @game_board[row][column] = 0\n @white_count+=1\n @black_count-=1\n end\n if @game_board[row][column]!=0\n @game_board[row][column]= 0\n @white_count+=1\n end\n elsif @player_turn == \"black\"\n if @game_board[row][column] == 1 && row<tempr\n break\n elsif @game_board[row][column] == 0\n @game_board[row][column] = 1\n @white_count-=1\n @black_count+=1\n end\n if @game_board[row][column]!= 1\n @game_board[row][column]= 1\n @black_count+=1\n end\n end\n row-=1\n end\n end",
"def iterate\r\n\t\tif @gameover\r\n\t\t\treturn\r\n\t\tend\r\n\r\n\t\tk = @args.inputs.keyboard\r\n\r\n\t\tif k.key_down.up\r\n\t\t\trotate\r\n\t\tend\r\n\r\n\t\t#nie wychodzenie poza ramki\r\n\t\tif k.key_down.left && @current_piece_x>0\r\n\t\t\t@current_piece_x -= 1\r\n\t\tend\r\n\t\tif k.key_down.right && ((@current_piece_x+@current_piece.length) < @grid_w)\r\n\t\t\t@current_piece_x += 1\r\n\t\tend\r\n\t\tif (k.key_down.down || k.key_held.down) && !colliding\r\n\t\t\t@next_move -= 3 #ile razy szybciej\r\n\t\tend\r\n\r\n\t\t@next_move -= 1\r\n\t\tif @next_move <= 0\r\n\t\t\t#jeżeli koliduje to umieszczamy na stałe klocek w tym miejscu (zapisując na planszy jego kratki jako 1)\r\n\t\t\tif colliding\r\n\t\t\t\tplant_current_piece\r\n\t\t\telse\r\n\t\t\t\t@next_move =10\r\n\t\t\t\t@current_piece_y += 1\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def handle_flip(pos)\n tile = get_tile(pos)\n return tile.reveal_tile if tile.val == \"b\" || tile.val.to_i > 0\n\n #recursive call to handle 0s\n possibles = [pos]\n until possibles.empty?\n curr_pos = possibles.shift\n adjs = adjacents(curr_pos)\n adjs.each do |adj|\n handle_flip(adj)\n adj_tile = get_tile(adj)\n end\n end\n\n end",
"def game_over\n @room[@cur_x][@cur_y] = DungeonOfDoom::CHAR_PLAYER[4]\n draw_map(@cur_x,@cur_y)\n ask_question(MSG_DIED,MSG_KEY)\n end",
"def turn\n @delta.x = -@delta.x\n @delta.y = -@delta.y\n end",
"def cursor_down\n $game_system.se_play($data_system.cursor_se)\n @index += 1\n @index %= $game_party.actors.size\n end",
"def perfect_move(marker, index)\r\n\t\tif board[index] == perfect_move\r\n\t\t\tboard[index] = marker\r\n\tend\r\n\r\n\t#final moves in order to win\r\n\tdef win(board, marker)\r\n\t\t#horizontal top\r\n\t\tif board[0] && board[1] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\telsif board[0] && board[2] == marker\r\n\t\t\tboard[1] == perfect_move\r\n\t\telsif board[1] && board[2] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\t#horiz middle\r\n\t\telsif board[3] && board[4] == marker\r\n\t\t\tboard[5] == perfect_move\r\n\t\telsif board[3] && board[5] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[5] == marker\r\n\t\t\tboard[3] == perfect_move\r\n\t\t#horiz bottom\r\n\t\telsif board[6] && board[7] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[6] && board[8] == marker\r\n\t\t\tboard[7] == perfect_move\r\n\t\telsif board[7] && board[8] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\t#vertical left\r\n\t\telsif board[0] && board[3] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\telsif board[3] && board[6] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\telsif board[0] && board[6] == marker\r\n\t\t\tboard[3] == perfect_move\r\n\t\t#vert middle\r\n\t\telsif board[1] && board[4] == marker\r\n\t\t\tboard[7] == perfect_move\r\n\t\telsif board[1] && board[7] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[7] == marker\r\n\t\t\tboard[1] == perfect_move\r\n\t\t#vert right\r\n\t\telsif board[2] && board[5] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[2] && board[8] == marker\r\n\t\t\tboard[5] == perfect_move\r\n\t\telsif board[5] && board[8] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\t#diagonal top left \r\n\t\telsif board[0] && board[4] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[0] && board[8] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[8] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\t#diag bottom left\r\n\t\telsif board[2] && board[4] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\telsif board[2] && board[6] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[6] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\telse\r\n\r\n\t\tend\r\n\tend\r\n\r\n\t#blocks an opponent from making the winning move\r\n\tdef block(human, marker, index)\r\n\t\tif human[marker] == win\r\n\t\t\tboard[index] = perfect_move\r\n\t\t\ttrue\r\n\t\telse\r\n\t\t\tfalse\r\n\t\tend\r\n\tend\r\n\r\n\tdef fork()\r\n\tend\r\n\r\n\tdef fork_block()\r\n\tend\r\n\r\n\tdef opposite_corner()\r\n\tend\r\n\r\n\tdef empty_corner()\r\n\tend\r\n\r\n\tdef empty_side()\r\n\tend\r\n\r\nend",
"def reveal_adjacent_cells(coords)\n self[coords].flip\n return if self[coords].value.is_a?(Integer)\n left = [coords[0], coords[1]-1]\n reveal_adjacent_cells(left) if within_boundaries?(left[0], left[1]) && self[left].flippable?\n right = [coords[0], coords[1]+1]\n reveal_adjacent_cells(right) if within_boundaries?(right[0], right[1]) && self[right].flippable?\n up = [coords[0]+1, coords[1]]\n reveal_adjacent_cells(up) if within_boundaries?(up[0], up[1]) && self[up].flippable?\n down = [coords[0]-1, coords[1]]\n reveal_adjacent_cells(down) if within_boundaries?(down[0], down[1]) && self[down].flippable?\n end",
"def play_turn\n @players.each do |p|\n dice = @dice.roll\n move_player p, dice\n @board.landed_by p\n end\n end",
"def set_position\n if @player_correct[-1] == true\n @player_pos << (@player_pos[-1]) - 5\n else\n @player_pos << @player_pos[-1]\n end\n if @computer_correct[-1] == true\n @computer_pos << (@computer_pos[-1]) - 5\n else\n @computer_pos << @computer_pos[-1]\n end\n end",
"def board_visualization\n @players.each do |player|\n before = 0\n after = @length\n puts \" | \"*(before += @position[player]) + \"#{player}\" + \" | \"*(after -= @position[player])\n end\n nil\n end",
"def current_player #removed (board) argument\n turn_count % 2 == 0 ? \"X\" : \"O\" \nend",
"def perfect_move(marker, index)\n\t\tif board[index] == perfect_move\n\t\t\tboard[index] = marker\n\tend\n\n\t#final moves in order to win\n\tdef win(board, marker)\n\t\t#horizontal top\n\t\tif board[0] && board[1] == marker\n\t\t\tboard[2] == perfect_move\n\t\telsif board[0] && board[2] == marker\n\t\t\tboard[1] == perfect_move\n\t\telsif board[1] && board[2] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#horiz middle\n\t\telsif board[3] && board[4] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[3] && board[5] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[5] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#horiz bottom\n\t\telsif board[6] && board[7] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[6] && board[8] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[7] && board[8] == marker\n\t\t\tboard[6] == perfect_move\n\t\t#vertical left\n\t\telsif board[0] && board[3] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[3] && board[6] == marker\n\t\t\tboard[0] == perfect_move\n\t\telsif board[0] && board[6] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#vert middle\n\t\telsif board[1] && board[4] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[1] && board[7] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[7] == marker\n\t\t\tboard[1] == perfect_move\n\t\t#vert right\n\t\telsif board[2] && board[5] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[2] && board[8] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[5] && board[8] == marker\n\t\t\tboard[2] == perfect_move\n\t\t#diaginal top left \n\t\telsif board[0] && board[4] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[0] && board[8] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[8] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#diag bottom left\n\t\telsif board[2] && board[4] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[2] && board[6] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[6] == marker\n\t\t\tboard[2] == perfect_move\n\t\telse\n\n\t\tend\n\tend\n\n\t#blocks an opponent from making the winning move\n\tdef block(human, marker, index)\n\t\tif human[marker] == win\n\t\t\tboard[index] = perfect_move\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend\n\n\tdef fork()\n\tend\n\n\tdef fork_block()\n\tend\n\n\tdef opposite_corner()\n\tend\n\n\tdef empty_corner()\n\tend\n\n\tdef empty_side()\n\tend\n\nend",
"def initialize (row,col)\n @row = row\n @col = col\n @player = 0\n @choiced = false\n end",
"def put_disk(x, y, my_color = true)\n @board.push_stack\n color = my_color ? @my_color : @opponent_color\n @board.flip_disks(x, y, color)\n end",
"def opponent_turn\n #set variables\n game = Game.find(self.game_id)\n player = Player.find(game.players.last)\n draw_card = Card.where(player_id: -2).first\n opponent_cards = Card.where(player_id: self.id)\n possible_plays = []\n colors = [\"blue\", \"green\", \"red\", \"yellow\"]\n\n #determine eligible cards in hand.\n opponent_cards.each do |card|\n if card.color == draw_card.color || card.number == draw_card.number || (card.card_action != nil && card.card_action == draw_card.card_action)\n possible_plays.push(card)\n end\n end\n #starts decision logic for card to play, otherwise draws a card and looks for possible plays\n if possible_plays.any?\n #discard current draw pile card\n draw_card.player_id = -1\n draw_card.save\n\n #determines card to be played, sets card to be the new draw pile card\n selected_card = possible_plays.sample\n selected_card.player_id = -2\n selected_card.save\n\n #determines if card has special action, and executes action if it does.\n if selected_card.card_action != nil\n\n if selected_card.card_action === \"skip\" || selected_card.card_action === \"reverse\"\n self.opponent_turn\n elsif selected_card.card_action === \"draw\"\n draw_two = Card.where(player_id: 0).sample(2)\n draw_two.each do |card|\n card.player_id = game.players.first.id\n card.save\n end\n self.opponent_turn\n elsif selected_card.card_action === \"draw_four\"\n draw_four = Card.where(player_id: 0).sample(4)\n draw_four.each do |card|\n card.player_id = player.id\n card.save\n end\n self.opponent_turn\n elsif selected_card.card_action === \"wild_color\"\n selected_card.color = colors.sample\n selected_card.save\n end\n\n else\n #switches current turn once card has been selected and played\n if game.current_turn = self.id\n game.current_turn = player.id\n game.save\n else\n game.current_turn = self.id\n game.save\n end\n\n end\n\n else\n #draws a card from the draw pile and repeats opponent_turn process.\n drawn_card = Card.where(player_id: 0).sample\n drawn_card.player_id = self.id\n drawn_card.save\n self.opponent_turn\n end\n end",
"def addDiscs(firstPlayer, columns)\n if firstPlayer == :R\n players = [:R, :O].cycle\n else \n players = [:O, :R].cycle\n end\n columns.each {|c| addDisc(players.next, c)}\n end",
"def draw_card\n @dwanted.each_with_index{|w,i|\n if w && (@dpile[i][-1] > (@land[i][-1]||0))\n @dpile[i].pop\n return [S.index(i)].pack(\"C\")\n end\n }\n @deckcount-=1\n \"n\"\n end",
"def play\n welcome\n loop do\n #lines 17-19 are my favorite\n until @game_board.drop_token(@current_player.get_move_column,@current_player.game_token) do \n puts \"Column full! Please choose another column!\"\n binding.pry\n print \">\"\n end\n @game_board.board_render\n swap_players\n end\n end",
"def vflip\n g = Grid.new\n self.each do |point,v|\n g[Point.new( point.x, @height - point.y - 1 )] = v \n end\n g\n end",
"def adjust_unmoved_status(pos)\n board.square(pos).piece.unmoved = false\n end",
"def cursor_down\n $game_system.se_play($data_system.cursor_se)\n $game_troop.enemies.size.times do\n @index += 1\n @index %= $game_troop.enemies.size\n break if self.enemy.exist?\n end\n end",
"def win(board, marker)\n\t\t#horizontal top\n\t\tif board[0] && board[1] == marker\n\t\t\tboard[2] == perfect_move\n\t\telsif board[0] && board[2] == marker\n\t\t\tboard[1] == perfect_move\n\t\telsif board[1] && board[2] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#horiz middle\n\t\telsif board[3] && board[4] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[3] && board[5] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[5] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#horiz bottom\n\t\telsif board[6] && board[7] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[6] && board[8] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[7] && board[8] == marker\n\t\t\tboard[6] == perfect_move\n\t\t#vertical left\n\t\telsif board[0] && board[3] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[3] && board[6] == marker\n\t\t\tboard[0] == perfect_move\n\t\telsif board[0] && board[6] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#vert middle\n\t\telsif board[1] && board[4] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[1] && board[7] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[7] == marker\n\t\t\tboard[1] == perfect_move\n\t\t#vert right\n\t\telsif board[2] && board[5] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[2] && board[8] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[5] && board[8] == marker\n\t\t\tboard[2] == perfect_move\n\t\t#diaginal top left \n\t\telsif board[0] && board[4] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[0] && board[8] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[8] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#diag bottom left\n\t\telsif board[2] && board[4] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[2] && board[6] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[6] == marker\n\t\t\tboard[2] == perfect_move\n\t\telse\n\n\t\tend\n\tend",
"def new_piece\n next_tetromino\n\n col = @columns / 2 - 1\n row = 0\n\n @falling_piece.x = col * @block_size + self.screen_x\n @falling_piece.y = row * @block_size + self.screen_y\n\n @falling_piece.grid_position.x = col + 1\n @falling_piece.grid_position.y = row\n\n if collides?\n game_over\n end\n end",
"def card10(player)\n player.position -= 3\n end",
"def drop_piece b, c, player\n bool = true\n row = 6;\n while bool\n if b[row][c] == \"-\"\n b[row][c] = player\n bool = false\n else\n if row > 0\n row = row-1\n else\n puts \"Uh oh, that Row is FULL! Try again.\"\n bool = false\n end\n end\n end\n print_board b\n if check_win b, player\n puts \"Congratulations, player #{player} WINS!\"\n exit\n end\n return b\nend",
"def turn_away_from_player\n # Get difference in player coordinates\n sx = @x - $player.x\n sy = @y - $player.y\n # If coordinates are equal\n if sx == 0 and sy == 0\n return\n end\n # If horizontal distance is longer\n if sx.abs > sy.abs\n # Turn to the right or left away from player\n sx > 0 ? turn_right : turn_left\n # If vertical distance is longer\n else\n # Turn up or down away from player\n sy > 0 ? turn_down : turn_up\n end\n end",
"def card7(player)\n player.position = 15 if player.position == 7\n player.position = 25 if player.position == 22\n player.position = 5 if player.position == 36\n end",
"def move_player_down(grid, player)\n return if player.grid_y == grid.length - 1\n return if player.bottom_wall\n\n return grid[player.grid_y + 1][player.grid_x]\nend",
"def draw_for(player)\n @cards.shuffle!\n player.cards << @cards.pop\n end",
"def win(board, marker)\r\n\t\t#horizontal top\r\n\t\tif board[0] && board[1] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\telsif board[0] && board[2] == marker\r\n\t\t\tboard[1] == perfect_move\r\n\t\telsif board[1] && board[2] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\t#horiz middle\r\n\t\telsif board[3] && board[4] == marker\r\n\t\t\tboard[5] == perfect_move\r\n\t\telsif board[3] && board[5] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[5] == marker\r\n\t\t\tboard[3] == perfect_move\r\n\t\t#horiz bottom\r\n\t\telsif board[6] && board[7] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[6] && board[8] == marker\r\n\t\t\tboard[7] == perfect_move\r\n\t\telsif board[7] && board[8] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\t#vertical left\r\n\t\telsif board[0] && board[3] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\telsif board[3] && board[6] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\telsif board[0] && board[6] == marker\r\n\t\t\tboard[3] == perfect_move\r\n\t\t#vert middle\r\n\t\telsif board[1] && board[4] == marker\r\n\t\t\tboard[7] == perfect_move\r\n\t\telsif board[1] && board[7] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[7] == marker\r\n\t\t\tboard[1] == perfect_move\r\n\t\t#vert right\r\n\t\telsif board[2] && board[5] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[2] && board[8] == marker\r\n\t\t\tboard[5] == perfect_move\r\n\t\telsif board[5] && board[8] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\t#diagonal top left \r\n\t\telsif board[0] && board[4] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[0] && board[8] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[8] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\t#diag bottom left\r\n\t\telsif board[2] && board[4] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\telsif board[2] && board[6] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[6] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\telse\r\n\r\n\t\tend\r\n\tend",
"def choose_sides\n if ask(\"Choose a side\", \"x\", \"o\") == \"o\"\n $piece[:player] = O\n $piece[:computer] = X\n end\nend",
"def play\n while true\n current_player.en_passant = false\n board.formatted_grid\n if check_for_check\n if check_for_checkmate\n puts \"Checkmate!\"\n else\n puts \"Check!\"\n end\n end\n x, y = prompt_selection\n puts \"\"\n puts ask_move\n x_end, y_end = get_move\n if x_end == \"back\"\n board.clear_board\n play\n end\n while board.valid_place?(x_end, y_end) == false\n puts \"Invalid option! Try again:\"\n x_end, y_end = get_move\n board.valid_place?(x_end, y_end)\n end\n #check for en passant\n if board.get_cell_piece(x, y).type == \"pawn\" && y_end - y == 2\n current_player.en_passant = true\n elsif board.get_cell_piece(x, y).type == \"pawn\" && y - y_end == 2\n current_player.en_passant = true\n end\n\n #check for promotion\n if board.get_cell_piece(x, y).type == \"pawn\" && board.get_cell_piece(x, y).color == \"white\" && y_end == 0\n promote(x, y)\n elsif board.get_cell_piece(x, y).type == \"pawn\" && board.get_cell_piece(x, y).color == \"black\" && y_end == 7\n promote(x, y)\n end\n\n #check for castling\n if board.get_cell_piece(x, y).type == \"king\" && x_end - x == 2\n board.piece_move(x + 3, y, x + 1, y)\n board.set_cell_color(x + 2, y, \"red\")\n elsif board.get_cell_piece(x, y).type == \"king\" && x - x_end == 2\n board.piece_move(x - 4, y, x - 1, y)\n board.set_cell_color(x - 2, y, \"red\")\n end\n #check if taking an opponent's piece\n if is_taking_piece?(x_end, y_end) \n hash_value = other_player.pieces_left.key([x_end, y_end])\n current_player.pieces_left[hash_value] = [x_end, y_end]\n other_player.pieces_left.delete(hash_value)\n\n board.piece_move(x, y, x_end, y_end)\n else\n hash_value = current_player.pieces_left.key([x, y])\n current_player.pieces_left[hash_value] = [x_end, y_end]\n board.piece_move(x, y, x_end, y_end)\n end\n #if board.game_over\n #puts game_over_message\n #board.formatted_grid\n #return\n #else\n switch_players\n #end\n end\n end",
"def round_player\n puts \"Enter position of card to flip in format of x,y:\"\n guess1 = @board.reveal(validate_player_input)\n @board.render\n puts \"Enter second card to flip:\"\n guess2 = @board.reveal(validate_player_input)\n @board.render\n is_match?(guess1, guess2)\n end",
"def current_player(board) # Current_player method takes in an argument of the game board\n turn_count(board).even? ? board = \"X\" : board = \"O\"\nend",
"def switch_players\n temp = @current_player\n @current_player = @opposing_player\n @opposing_player = temp\n end",
"def drop_piece\n @current_player = retrieve_current_player\n\n @board = Board.new(retrieve_current_board)\n\n \t@board.drop_piece(retrieve_move, @current_player)\n \n\n @game_over = game_over\n\n switch_player\n save_player\n save_current_board\n\n\t\trender :game_board\n\tend",
"def sel_rand(player, opponent)\n all = @corners + @edges + @center # all board positions\n taken = player + opponent # all occupied board positions\n position = (all - taken).sample # take a random open position\n end",
"def reverse_hypo_move(original_coords, test_coords)\n @board[original_coords[0]][original_coords[1]] = @board[test_coords[0]][test_coords[1]]\n @board[test_coords[0]][test_coords[1]] = @piece_purgatory\n @piece_purgatory = nil\n end",
"def play\r\n self.display_board\r\n while !self.over? do\r\n self.turn\r\n end\r\n if self.draw? \r\n puts \"Cat's Game!\"\r\n else\r\n puts \"Congratulations #{self.winner}!\"\r\n end\r\n end",
"def isFlipped\n true\n end",
"def update()\n # Loops through each corrdinate of the board and asks it what\n # piece colour it has on it. print the piece colour to the screen.\n\n # A line connecting two spaces. This gets printed after a '|' in rows\n # that contain only these connecting lines (rows that cannot contain pieces)\n connection = \"\\\\\"\n\n # Board size is 9x5\n for i in (8).downto(0) do\n # If i is even, print number, and the pieces on the board.\n # Else: print a row of connecting lines\n if (i%2 == 0)\n # Print the number\n print (\"#{i/2} \")\n\n # Print the pieces on the board\n for j in 0..8 do\n piece = @current_board.get_board_hash(\"#{j},#{(i/2)}\") \n if (piece == :Black)\n print \"x\"\n elsif (piece == :White)\n print \"o\"\n else\n print \"+\"\n end\n\n if (j != 8)\n print \"-\"\n end\n end\n print \"\\n\"\n\n # print the connecting lines\n else\n print \" \"\n for j in 0..8 do\n # print a pair of connecting lines.\n # Rows do not end with a diagnol\n # connecting line. Print only\n # a \"|\" when that occurs\n if (j != 8)\n print \"|#{connection}\"\n else\n print \"|\"\n end\n\n # Toggle the diagonal connecting lines.\n # these lines do no toggle the final\n # time that they are printed in a row.\n if (j < 7)\n if (connection == \"\\\\\")\n connection = \"/\"\n else\n connection = \"\\\\\"\n end\n end\n end\n print \"\\n\"\n end\n end\n\n # Print the numbers column numbers at\n # the bottom of the board.\n print \" \"\n for i in 0..8\n print \" #{i}\"\n end\n print \"\\n\"\n end",
"def input_move(column, player)\n placed = false\n return false unless (1..width).include?(column)\n\n grid.reverse_each do |row|\n if row[column - 1] == empty_cell && placed == false\n row[column - 1] = player\n placed = true\n end\n end\n placed\n end",
"def successor_function(board, player)\n states = []\n actions = []\n 6.times do |row|\n 6.times do |col|\n if board[row][col] == 0\n #copy the board and set the indeces to the player's glyph\n copiedBoard = copy_board(board)\n copiedBoard[row][col] = player\n states.push(copiedBoard)\n actions.push([row, col])\n end\n end\n end\n return actions, states\n end",
"def player_choice(row,col)\n row = row.to_i\n col = col.to_i\n row = row - 1 \n col = col - 1\n if @known_empty.include? ((row.to_s)+(col.to_s))\n puts 'That spot is already known.'\n elsif @flag_pair.include? ((row.to_s)+(col.to_s))\n puts \"You can't guess where you have a flag.\"\n \n elsif @grid[row][col] == 0\n open_up(row,col)\n elsif @grid[row][col] == :B\n puts 'YOU LOSE, SORRY'\n @game_over = false\n else\n @known_empty << (row.to_s + col.to_s)\n end\n end",
"def draw_pieces\n CHECKERS_HEIGHT.times do |x|\n CHECKERS_WIDTH.times do |y|\n @pieces[x][y].remove unless @pieces[x][y].nil?\n @pieces[x][y] = draw_piece(x,y,@board.state[x][y]) unless @board.state[x][y].nil?\n end\n end\nend",
"def play\n # To start, the method takes two arguments, the players and board array. \n while @board.winner == false\n # Then I set up a while loop that will keep going until there is no winner.\n @board.display_board\n # I started by calling the display_board method (from the Board Class) to show \n # the array in the traditional Tic-Tac-Toe formatting. \n cell_prompt\n # I Prompt the Player to make their selection. \n get_move\n # Here is where the Player imputs their selection. \n @board.update_cell\n # Update_cell (from the Board Class) will take the Player's input and update the value of the object at the \n # corresponding Board[index]. \n if @board.winner == true \n puts @board.winner\n break\n # This ends the loop if there has been a winner.\n elsif @board.draw == true\n break\n # This ends the loop if the match is a draw. \n end\n end\n # Otherwise, the loop keeps going. \n end",
"def place(col, player)\n col = col.to_i\n i = 0 \n while i < @height \n if !invalid_move?(col) && @grid[i][col].nil? && i == @height - 1\n @grid[i][col] = player \n if win?(i, col, player)\n puts \"#{player} wins! Game over!\"\n @game = false \n end\n elsif !invalid_move?(col) && @grid[i][col].nil? && @grid[i + 1][col]\n @grid[i][col] = player\n if win?(i, col, player)\n puts \"#{player} wins! Game over!\"\n @game = false \n end\n end \n i += 1 \n end \n pp @grid\n end",
"def mark(row, col, player)\n new_board = Board.new(@m.map(&:dup), @human_player, @computer_player)\n new_board.mark!(row, col, player.to_s)\n new_board\n end",
"def turnover\n puts \"---> Turnover\"\n change_of_possession\n end",
"def applyOpposite\n #puts(\"Opposite creer pont \" + @x1.to_s + @y1.to_s + \" \" + @x2.to_s + @y2.to_s)\n return @grid.removeBridge(@x1, @y1, @x2, @y2)\n end",
"def draw\n o = 0\n # repeats the proces n times so as to print every row in the array\n @board.size.times do\n print @board[o, 1]\n puts\n o += 1\n end\n puts \"\\nPress 'q' to exit or the WASD keys to move\"\n end",
"def check_win(player,grid,coordinates)\n win = false\n win_array = []\n play_row = coordinates[0]\n play_col = coordinates[1]\n\n # horizontal checking\n grid[play_row].each_index do | col |\n if win_array.length != 4\n if grid[play_row][col] == player\n win_array.push([play_row,col])\n else\n win_array = []\n end\n end\n end\n\n if win_array.length == 4\n win = true\n end\n\n # vertical checking\n if win == false\n\n win_array = []\n\n grid.each_index do | row |\n if win_array.length != 4\n if grid[row][play_col] == player\n win_array.push([row,play_col])\n else\n win_array = []\n end\n end\n end\n\n if win_array.length == 4\n win = true\n end\n end\n\n # diagonal checking SW to NE\n if win == false\n\n win_array = []\n row = play_row\n col = play_col\n\n # finds SW-most position in same diagonal line as most recently played piece\n # this is the starting point we check from\n until col == 0 || row == 7\n row += 1\n col -= 1\n end\n\n until col > 7 || row < 0\n if win_array.length != 4\n if grid[row][col] == player\n win_array.push([row,col])\n else\n win_array = []\n end\n end\n row -= 1\n col += 1\n end\n\n if win_array.length == 4\n win = true\n end\n end\n\n # diagonal checking NW to SE\n if win == false\n\n win_array = []\n row = play_row\n col = play_col\n\n # finds NW-most position in same diagonal line as most recently played piece\n # this is the starting point we check from\n until col == 0 || row == 0\n row -= 1\n col -= 1\n end\n\n until col > 7 || row > 7\n if win_array.length != 4\n if grid[row][col] == player\n win_array.push([row,col])\n else\n win_array = []\n end\n end\n row += 1\n col += 1\n end\n\n if win_array.length == 4\n win = true\n end\n end\n\n # winning four-in-a-row briefly \"flashes\" to show where it is\n if win == true\n flash_count = 0\n while flash_count < 4\n #flashing animation\n win_array.each do | element |\n grid[element[0]][element[1]] = \"@\"\n end\n print_board(grid)\n sleep(0.2)\n win_array.each do | element |\n grid[element[0]][element[1]] = player\n end\n print_board(grid)\n sleep(0.2)\n flash_count += 1\n end\n end\n\n return win\nend",
"def draw \n 0.upto(3) do |i| \n if @playing[i]\n if @winner == i\n @labels[i].draw_rel(\" Winner\", 540, 80+i*40, 1, 0.5, 0.5, 1, 1, 0xff0000ff, :default) \n else\n @labels[i].draw_rel(@score[i].to_s()+\" 000 $\", 540, 80+i*40, 1, 0.5, 0.5, 1, 1, 0xffffffff, :default)\n end\n else\n @labels[i].draw_rel(\" out\", 540, 80+i*40, 1, 0.5, 0.5, 1, 1, 0xdddddddd, :default)\n end\n \n @@players_icons[i].draw(450, 70+i*40, 1, 1, 1)\n end \n end",
"def no_forward_obstruction?(x_des, y_des)\n pieces_in_row = game.pieces.where(x_position: x_des)\n pieces_in_column = game.pieces.where(y_position: y_des) \n move_type(x_des, y_des) == 'vertical' &&\n pieces_in_column.where('y_position > ? AND y_position < ?',\n [self.y_position, y_des.to_i].min,\n [self.y_position, y_des.to_i].max).empty?\n end",
"def valid_flip?(pos)\n !(@board[pos].flagged)\n end",
"def draw\n @headers[@game_state_model::players[@game_state_model.player_turn_state]::player_color].draw(@x, @y, 35)\n\n if @game_state_model.player_turn_state == 0\n @ico_one.draw(@x + 143, @y + 20, 35)\n elsif @game_state_model::players[@game_state_model.player_turn_state]::ai == nil\n @ico_two.draw(@x + 143, @y + 20, 35)\n else \n @ico_ai.draw(@x + 143, @y + 20, 35)\n end\n\n @tiles[@game_state_model::players[0]::player_color].draw(@x + 10, @y + 8, 35)\n @tiles[@game_state_model::players[1]::player_color].draw(@x + 10, @y + 48, 35)\n # @block_purple.draw(@x + 10, @y + 5, 1)\n # @block_green.draw(@x + 10, @y + 45, 1)\n @question.draw\n @cancel.draw\n @font.draw(\"#{@game_state_model::players[0]::name}\", 50, @y + 7, 35, 1.0, 1.0, 0xff_ffffff)\n @font.draw(\"Wins: #{@game_state_model::players[0]::score}\", 50, @y + 22, 35, 1.0, 1.0, 0xff_ffffff)\n @font.draw(\"#{@game_state_model::players[1]::name}\", 50, @y + 47, 35, 1.0, 1.0, 0xff_ffffff)\n @font.draw(\"Wins: #{@game_state_model::players[1]::score}\", 50, @y + 62, 35, 1.0, 1.0, 0xff_ffffff)\n end",
"def vert_move(new_x, new_y)\n if pawn_white?\n (self.moved >= 1 && new_y == (self.y + 1)) || \\\n (self.moved == 0 && new_y <= (self.y + 2))\n else # Black pawn\n (self.moved >= 1 && (self.y - 1) == new_y) || \\\n (self.moved == 0 && (self.y - 2) <= new_y)\n end\n end",
"def normal_moves\n direction = NORMAL_MOVES[self.color]\n \n [check_validity(direction)]\n \n if pos_valid \n item_at_pos = @board.get_piece(current_row,current_col)\n \n if item_at_pos.nil? || item_at_pos.color != self.color\n [current_row, current_col]\n end\n end\n \nend",
"def play_turn\n board.render\n pos = get_pos\n decision = get_decision\n if decision == \"r\"\n board.reveal(pos)\n elsif decision == \"f\"\n board.flag(pos)\n else\n @saved_board = board.to_yaml\n end\n end",
"def play!(column, opponent_board)\n # Is the column full?\n # Let's grab both boards, bitwise or them and transpose so we can\n # easily sum the column.\n full_board = opponent_board.bitboard | self.bitboard\n full_board = self.class.to_a(full_board)\n full_board = full_board.transpose\n\n count = full_board[column].inject { |sum, val| sum + val }\n return false if count == ROWS\n\n # Okay, not full, drop it into the uppermost empty space\n # Again, use the full board, grab the row (which would be the col)\n # and get the index of the leftmost zero of the reversed row.\n row = full_board[column].reverse.index(0)\n\n new_bitboard = self.class.binary_string(self.bitboard)\n new_bitboard[(column * COLS) + row] = \"1\"\n self.update_attributes! bitboard: new_bitboard.to_i(2), turn: false\n opponent_board.update_attribute :turn, true\n\n Pusher['moves'].trigger('drop', {\n row: (ROWS - row - 1),\n col: column,\n user_id: self.user_id,\n turn: opponent_board.user_id\n })\n\n return [ROWS - row - 1, column]\n end",
"def switch_player\nif @player == PIECE[:x]\n@player = PIECE[:o]\nelse\n@player = PIECE[:x]\nend\nend",
"def insertVertical(player, check, r)\n #puts(\"find row #{r} w/player #{player}\")\n c = 0\n begin \n if @board[r][c] == check\n addDisc(player, c) \n puts \"Vertical #{player} disc added at #{r} , #{c}\"\n end\n #puts(\"#{r} : #{c}\")\n c += 1\n end until c > 3\n end",
"def draw_board\n clear_screen\n print_logo\n put_column_headers\n @rows.each do |row|\n row_string = \"\"\n slots_filled_in_row = 0\n row.each do |slot|\n if slot\n color_code = slot\n if @players.size == 2\n slot = \"X\" if slot == 1\n slot = \"O\" if slot == 2\n end\n color_code = COLOR_CODES[color_code]\n slot = slot.to_s.colorize(color_code)\n slots_filled_in_row += 1\n else\n slot = '.'\n end\n row_string << (slot + \" \")\n end\n center_puts((' ' * 11 * slots_filled_in_row) + row_string)\n end\n put_column_headers\n end",
"def change_turns\n (@current_player == @p1) ? @current_player = @p2 : @current_player = @p1\n end",
"def switch_player\n @current_player = if @current_player == @player_o\n @player_x\n else\n @player_o\n end\n\n @number_of_turns += 1\n end",
"def display_board\n # Reverse it to display the board correctly\n reverse = @board.reverse\n \n puts \"------------------------------\"\n reverse.each do |row|\n print \"|\"\n row.each do |col|\n print \" #{col} |\" if(col != -1)\n print \" |\" if(col == -1)\n end\n puts \"\\n------------------------------\"\n end\n end",
"def play_turn\n @board.place_mark(@current_player.get_move, @current_player.mark)\n switch_players!\n end",
"def replaceCard (row, column)\n @current_cards[row][column] = @deck.removeAny\n end",
"def play\n @players.each { |player| player.score = 0 }\n\t \n\tloop do\n\t @board.clear\n @cur_player = @players[0]\n\t @rounds += 1\n\t\t\n\t print \"\\n******************* Connect Four ********************\"\n\t puts \"\\n#{@players[0].name} will play with #{@players[0].color}; #{@players[1].name} will play with #{@players[1].color}\\n\\n\"\n\t @board.print_board \n\t \n\t loop do\n position = prompt_movement\n\t @board.set_disk(position, @cur_player.color)\n\t\t@board.print_board \n\t\t \n\t\tresult = \n\t\t if @board.is_winner?(@cur_player.color)\n\t\t @cur_player.score += 1\n\t\t puts \"\\n#{@cur_player.name} wins!!\"\n\t\t\ttrue\n\t\t elsif @board.is_full?\n\t\t puts \"\\nThe game ended in a tie!\"\n\t\t\ttrue\n\t end\n\t\t \n\t\tbreak if result\n\t\tswap_players\n end\n\t\t\n\t break if prompt_quit\n\tend\n\t \n\tprint_final_score\n end",
"def get_cen(player, opponent)\n taken = player + opponent # all occupied board positions\n if (taken & @center).size == 0 # if center is open\n position = 4 # then take it\n else\n get_op_cor(player, opponent) # otherwise check for opposite corner\n end\n end",
"def set_turns\n if @game_count % 2 == 1\n @player_turn = 1\n @player_1.symbol = :X\n @player_2.symbol = :O\n else\n @player_turn = 2\n @player_1.symbol = :O\n @player_2.symbol = :X\n end\n end",
"def attack (row, col, grid)\n\t\t$error = 0\n\t\t$hit = 0\n\t\tif grid == 1\n\t\t\tgrid = $comp\n\t\t\tgridshow = $shots\n\t\telse\n\t\t\tgrid = $shot_at\n\t\t\tgridshow = $shot_at\n\n\t\tend\n\n\t\tgridshow\n\n\t\trow -=1\n\t\tcol -=1\n\n\t\tcase grid[row][col]\n\t\twhen 0\n\t\t\tgrid[row][col] = \"X\"\n\t\t\tgridshow[row][col] = \"X\"\n\n\t\t\tif grid == $comp\n\t\t\t\tputs \"You missed.\"\n\t\t\telse\n\t\t\t\tputs \"They missed!\"\n\t\t\tend\n\n\t\twhen 1\n\t\t\tif grid == $comp\n\t\t\t\tputs \"YOU HIT THEIR SHIP!\"\n\t\t\telse\n\t\t\t\tputs \" YOU HAVE BEEN HIT!\"\n\t\t\tend\n\t\t\tgrid[row][col] = \"*\"\n\t\t\tgridshow[row][col] = \"*\"\n\t\t\t$hit = 1\n\t\telse\n\t\t\twrong\n\t\t\t$error = 1\n\t\tend\n\tend",
"def current_player(board)\n if turn_count(board).odd?\n \"O\"\n else\n \"X\"\n end\nend",
"def check_board\t\n # Winner checker\n @winner = false\n \n # Board's status\n @empty_board = false\n\n # Checking the rows\n 3.times do |x|\n if !@winner\n if vector_value(x,0) == vector_value(x,1) and vector_value(x,1) == vector_value(x,2) and vector_value(x,2) != C_V\n if vector_value(x,2) == C_X\n JOptionPane.showMessageDialog nil,\"Player X is the winner!\"\n @points_player1 += 1\n elsif vector_value(x,2) == C_O\n JOptionPane.showMessageDialog nil,\"Player O is the winner!\"\n @points_player2 += 1\n end\n reset_board\n @moves = 0\n @winner = true\n end\n end\n end\n\n #Checking the columns\n if !@winner\n 3.times do |y|\n if !@winner\n if vector_value(0,y) == vector_value(1,y) and vector_value(1,y) == vector_value(2,y) and vector_value(2,y) != C_V \n if vector_value(2,y) == C_X\n JOptionPane.showMessageDialog nil,\"Player X is the winner!\"\n @points_player1 += 1\n elsif vector_value(2,y) == C_O\n JOptionPane.showMessageDialog nil,\"Player O is the winner!\"\n @points_player2 += 1\n end \n reset_board\n @moves = 0\n @winner = true\n end\n end\n end\n end\n\n #Checking the diagonals\n if !@winner\n if vector_value(0,0) == vector_value(1,1) and vector_value(1,1) == vector_value(2,2) and vector_value(2,2) != C_V\n if vector_value(2,2) == C_X\n JOptionPane.showMessageDialog nil,\"Player X is the winner!\"\n @points_player1 += 1\n elsif vector_value(2,2) == C_O\n JOptionPane.showMessageDialog nil,\"Player O is the winner!\"\n @points_player2 += 1\n end\n reset_board\n @moves = 0\n @winner = true\n elsif vector_value(0,2) == vector_value(1,1) and vector_value(1,1) == vector_value(2,0) and vector_value(2,0) != C_V\n if vector_value(2,0) == C_X\n JOptionPane.showMessageDialog nil,\"Player X is the winner!\"\n @points_player1 += 1\n elsif vector_value(2,0) == C_O\n JOptionPane.showMessageDialog nil,\"Player O is the winner!\"\n @points_player2 += 1\n end\n reset_board\n @moves = 0\n @winner = true\n else #Checking no winner\n @board.each do |i|\n if i == C_V\n @empty_board = true\n break\n end\n end\n if !@empty_board\n JOptionPane.showMessageDialog nil, \"No winner, the game will restart\"\n reset_board\n @moves = 0\n end\n end\n end\n end",
"def side_moving\n return @piece_moving.side if @piece_moving\n end",
"def diagonal_slide(row, col) # oh cool try the .downto here instead of the reverse always nice to try new things even though it doesn't make for the most sensical code as per https://stackoverflow.com/questions/2070574/is-there-a-reason-that-we-cannot-iterate-on-reverse-range-in-ruby love it the last time you did reverse just because you didn't think about it until later now knowing this you can do it this way love it ah nevermind no need but would have been great to write smaller.downto(0).map oh well lol remember that for some other time love Ruby what a great language\n (row <= col) ? (smaller, larger = row, col) : (smaller, larger = col, row) # establish which number is the smaller of the two and the larger love it you have some crazy short code lol. For the nw and se diagonals\n nw = check_blocking_pieces((1..smaller).map { |offset| [row-offset, col-offset] }) # go by smaller because that's which one will hit 0 first\n ne = check_blocking_pieces((1..(7-row)).map { |offset| [row+offset, col-offset] if ((col-offset) >= 0) }.compact) # Need to use .compact to remove all the nil elements that were returned by .map since can't quite use select or reject since you *do* want to return the evaluation of the array but ah well code smells http://ruby-doc.org/core-1.9.3/Array.html#method-i-compact if you don't get rid of these nils then in the check_blocking_pieces() you'll run into an error since it'll be trying to get an index of a nil value in moves lol amaizng that even the most misleading errors you can debug with debugger and a good eye fuck byebug is so powerful # go by larger but check that the thing doesn't go out of bounds, the only bounds that it could go out if you have the row correct is col-offset being less than 0 # ahh these return nil for everything it doesn't return for so that's the error love it great catch # don't know what you would do without byebug it's literally god mode\n sw = check_blocking_pieces((1..(7-col)).map { |offset| [row-offset, col+offset] if ((row-offset) >= 0) }.compact) # go up until col == 7 as long as row is above or equal to 0, could do it the other way too, as long as col <= 7 go until row hits 0, but same thing\n se = check_blocking_pieces((1..(7-larger)).map { |offset| [row+offset, col+offset] }) # increase up until the largest one equals 7 basically there might be some nil issues with this but this should work can't wait to check it if you add them all up and there are some nils they might not add let's see, ah nope thankfully map returns an empty array fucking love it Ruby is the best\n (nw + ne + sw + se)\nend",
"def print_board(player=nil) \n\t\t(0..(@board.length)-1).each do |i| \t#we are assigning each row from 0 - 3 (board.length = 4, so 4 - 1 = 3)\n\t\t\t#to the variable i. board.length returns the number of elements in the \"primary\" array (i.e. the # of rows)\n\t\t\t(0..@board[i].length-1).each do |j| #we are assigning each column from 0 - 3 (board[i].length = 4, so \n\t\t\t\t#4 - 1 = 3) to the variable j. board[i].length returns the number of elements in the \"secondary\"\n\t\t\t\t#arrays (i.e. the # of columns in each row)\n\t\t\t\t\tif(@board[i][j]==0)\n\t\t\t\t\t\tmarker=\"-\" #we are telling Ruby that if a cell equals 0, then define marker as equal to \"-\"\n\t\t\t\t\telse\n\t\t\t\t\t\tmarker=player.ply_num_to_str(@board[i][j]) #if a cell does not equal 0, \n\t\t\t\t\t\t#which would happen after a player has put their piece in that cell, then define marker as equal to the \n\t\t\t\t\t\t#the output of player.ply_num_to_str which will either be X or O. ply_num_to_str is a function under \n\t\t\t\t\t\t#the Player class; it takes the value a the location board[i][j] (either 1 or 2) and returns a string \n\t\t\t\t\t\t#either \"X\" or \"O\" for that cell. \n\t\t\t\t\tend\n\t\t\t\tprint \"#{marker}\" #print each element in the \"secondary\" arrays (the rows) which because of the if \n\t\t\t #statement above will either print \"-\" if the cell is still equal to 0 or will print X or O if the player \n\t\t\t #has played in that cell.\n \t\tprint \"|\" unless j==@board.length-1 #prints \"|\" after each element in the \"secondary\" arrays (i.e. rows) \n\t\t\t\t#except after the last element in each \"secondary\" array (i.e. each row). \n\t\t\tend\n\t\t\tputs \"\" #at the end of each row (technically, it's after each element in the \"primary\" array), Ruby displays \n\t\t#\"\" and then adds a line. \n\t\tend\n\tend",
"def move\n @coordinates[1] += 1 if @rover_facing == 'N'\n @coordinates[0] += 1 if @rover_facing == 'E'\n @coordinates[1] -= 1 if @rover_facing == 'S'\n @coordinates[0] -= 1 if @rover_facing == 'W'\nend"
] |
[
"0.76008284",
"0.6716554",
"0.6695476",
"0.65508103",
"0.63319093",
"0.6143951",
"0.61018014",
"0.607248",
"0.60643834",
"0.59181416",
"0.591742",
"0.5902453",
"0.5868368",
"0.5852522",
"0.58520985",
"0.58352107",
"0.5818336",
"0.58010536",
"0.57892674",
"0.5773215",
"0.57570595",
"0.5749689",
"0.57412386",
"0.57015175",
"0.5695324",
"0.5692668",
"0.56862366",
"0.56848013",
"0.56733483",
"0.5672949",
"0.5661781",
"0.5655527",
"0.56547105",
"0.56517905",
"0.5649117",
"0.5648524",
"0.56375605",
"0.56346285",
"0.56263345",
"0.5605496",
"0.5599105",
"0.55987996",
"0.55917776",
"0.55911046",
"0.5586085",
"0.55829906",
"0.5582969",
"0.55768406",
"0.5564721",
"0.55580986",
"0.5556002",
"0.55497074",
"0.55485594",
"0.5542593",
"0.5537829",
"0.5534258",
"0.55322146",
"0.5531129",
"0.55280954",
"0.55108243",
"0.5509858",
"0.55030376",
"0.54996765",
"0.54933995",
"0.5492215",
"0.5491232",
"0.549014",
"0.5489688",
"0.5484804",
"0.5480861",
"0.54794323",
"0.54756963",
"0.54711604",
"0.54676366",
"0.5466278",
"0.54651606",
"0.5464094",
"0.54602736",
"0.5453177",
"0.5451714",
"0.54516226",
"0.54505897",
"0.54454947",
"0.54448473",
"0.54392636",
"0.5436638",
"0.5435337",
"0.5434495",
"0.5426735",
"0.5422336",
"0.54223114",
"0.5412398",
"0.54094625",
"0.5404811",
"0.5402011",
"0.54019475",
"0.5401496",
"0.53992236",
"0.5399135",
"0.5399044"
] |
0.6882374
|
1
|
Returns true if a valid move for current player is available; else returns false
|
def isValidMoveAvailable()
isValidMoveAvailableForDisc(@disc)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def moves_available?(player)\n !@board.moves(player).empty?\n end",
"def move_valid_for?(player_id)\n return false if last_player_id == player_id\n\n true\n end",
"def move_available?\n total_available_moves > 0\n end",
"def valid_move?(move)\n new_position = @current_player.position_after_move(move)\n\n if(@players.available_moves(@current_player).include? move)\n if(@mine.mineable?(new_position) && @current_player.tunneler != move)\n @current_player.damage(5, \"bumping into the wall\")\n return false\n elsif(@rubies.ruby_at_position(new_position))\n puts \"Found a ruby! Take it home!\"\n @current_player.load_up(@rubies.ruby_at_position(new_position))\n elsif(@current_player.home?(new_position))\n @current_player.unload_ruby\n end\n return true\n end\n\n false\n end",
"def valid_move?(from, to, player)\n if piece = player_piece?(from, player)\n unless player_piece?(to, player)\n return piece.valid_dest?(to, @board)\n end\n end\n false\n end",
"def valid_move?(destination)\n possible_moves.select do |move|\n on_board?(move) && open?(move)\n end\n\n possible_moves.include?(destination)\n end",
"def validMove(piece, newLocation)\n # piece can move to any empty adjacent space.\n # might need to account for placing pieces. can be counted as a fly move i guess \n\n if newLocation == nil || piece == nil\n return false\n end\n\n # check if its a fly move. \n if @player1.isActive\n if @player1.numPlayedPieces <= 3\n fly = true \n else\n fly = false\n end\n else\n if @player2.numPlayedPieces <= 3\n fly = true \n else\n fly = false\n end\n end\n\n\n #checks if space is empty:\n if newLocation.isEmpty()\n # check if its a fly move\n if fly\n # if its a fly and the target location is empty its allowed. \n return true\n elsif piece.location == nil\n return true\n else\n # should return true if the move is valid.\n return @board.isAdjacent(piece,newLocation)\n end\n else\n # should the space is not empty, the move is invalid\n return false\n end\n\n end",
"def no_player_can_move?\n !valid_move?(:black) && !valid_move?(:red)\n end",
"def is_move_available?\n self.robot.world.is_move_available?(self.x, self.y)\n end",
"def is_move_valid(move)\n @moves.include? move\n end",
"def valid_move?( player_input )\n player_input.to_i >= 1 && player_input.to_i <= 9 && !taken?( player_input )\n end",
"def is_valid_move x,y\n return false unless (0..3) === x\n return false unless (0..3) === y\n return @field[x][y].player == 0\n end",
"def movable?\n\t\tking = @board.board.select { |square, piece| piece.class == Pieces::King && piece.white == @player.white }.keys[0]\n\t\t[-1,-7,-8,-9,1,7,8,9].each do |spot| \n\t\t\tif square(calc_move(king, spot)) == \" \" || square(king).white != square(calc_move(king, spot)).white \n\t\t\t\treturn true unless getting_into_check?(king, calc_move(king, spot))\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend",
"def valid_move?(start_x, start_y, player)\n return false if get(start_x, start_y) != SPOT_OPEN\n\n # Counts the total flips that would result from this move\n flips = 0\n\n opponent = OthelloBoard::opponent_of(player)\n enumerator = Proc.new do |points, direction|\n # Counts the total flips that would result from this direction\n temp_flips = 0\n points.each do |point|\n x, y = point\n\n case get(x, y)\n when opponent\n temp_flips += 1\n when SPOT_OPEN\n temp_flips = 0\n break\n when player\n flips += temp_flips\n break\n end\n end\n end\n enumerate_around(start_x, start_y, enumerator)\n\n if flips == 0\n return false\n else\n return flips\n end\n end",
"def valid_move?\n\t\t# Now let's make sure all of the moves are valid.\n\t\t# I'll do this by seeing if the sorted version of each\n\t\t# column equals the @board version.\n\t\ttemp_board = Marshal.load(Marshal.dump(@board))\n\t\ttemp = temp_board[@move_from].shift\n\t\ttemp_board[@move_to].unshift(temp)\n\n\t\ttemp_board.each do |column|\n\t\t\tif column.sort != column\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\t# If they all pass, we're good!\n\t\treturn true\n\tend",
"def isValidMoveAvailable()\n\t\tisValidMoveAvailableForDisc(@disc)\n end",
"def isValidMoveAvailable()\n\t\tisValidMoveAvailableForDisc(@disc)\n end",
"def validate_player_move(move)\r\n \r\n #Return a value of false is the square has already been\r\n #selected\r\n return false if move == \"A1\" && $A1 != \" \"\r\n return false if move == \"B1\" && $B1 != \" \"\r\n return false if move == \"C1\" && $C1 != \" \"\r\n return false if move == \"A2\" && $A2 != \" \"\r\n return false if move == \"B2\" && $B2 != \" \"\r\n return false if move == \"C2\" && $C2 != \" \"\r\n return false if move == \"A3\" && $A3 != \" \"\r\n return false if move == \"B3\" && $B3 != \" \"\r\n return false if move == \"C3\" && $C3 != \" \" \r\n \r\n #Return a value of true if the square is available\r\n return true\r\n \r\n end",
"def check_if_moveisvalid(move)\n @all_available_moves.each do |avail_move|\n return true if move.is_equal_to?(avail_move)\n end\n return false\n end",
"def could_be_valid_move?\n return @board_gfx.is_draggingpiece_valid?\n end",
"def valid?(move)\n @board.valid_move?(move)\n end",
"def check?\n king_coords = current_player_king_coordinates\n return true unless build_DANGER_moves_array.empty?\n end",
"def valid_move?(move)\n move.to_i.between?(1,9) && !taken?(move)\n end",
"def valid_move?\n\t\tvalid_1 = (0..2).include? (@take_from)\n\t\tvalid_2 = (0..2).include? (@move_to)\n\t\tif valid_1 == false || valid_2 == false\n\t\t\tputs \"I'm sorry, please input your move in a 'x,y' format, ensuring that you are selecting numbers between 1 and 3!\"\n\t\t\tmove_input\n\t\telsif @pegs[@take_from][0] == nil\n\t\t\tputs \"I'm sorry, I'm not in the mood for a philosophical debate so let's just agree that you cannot move nothing and you can try again.\"\n\t\t\tmove_input\n\t\tend\n\tend",
"def valid_move?(board, position)\n position_taken?(board, position) == false && position.between?(0, 8) ? true : false\nend",
"def valid_move?(position)\n position.between?(0,8) && !position_taken?(position)\n end",
"def update_transferplayer?\r\n # Abort loop if player isn't place moving\r\n unless $game_temp.player_transferring\r\n return true\r\n end\r\n # Run place move\r\n transfer_player\r\n return false\r\n end",
"def valid_move?\n\t\t@table.stays_on_table?(@robot_direction, @x, @y)\n\tend",
"def new_game?\n moves.empty?\n end",
"def has_possible_moves\n \t\t@mowers.each do |mower|\n \t\t\treturn true if mower.can_move?(lawn_mowers_positions)\n\t \tend\n \t\treturn false\n \tend",
"def get_good_move\n loop do\n\t\t @player_move = self.get_player_move\n break if @current_state[@player_move].nil?\n puts \"That position is taken. Try another.\"\n end\n @player_move\n end",
"def valid_move?(board, position)\n if !(position_taken?(board, position)) && position.between?(0, 8)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, position)\n position = position.to_i\n return false if !valid_position?(position)\n return false if position_taken?(board, position)\n return true\nend",
"def valid_move?(destination)\n occupant = @board[destination]\n result = false\n if occupant.nil? || (enemy? occupant)\n result = movement_rule(destination)\n end\n\n result\n end",
"def valid_move?(position)\n if !position_taken?(position) && position.between?(0,8)\n true\n else\n false\n end\n end",
"def valid_move?(board, position)\n position.between?(0, 8) && !position_taken?(board, position)\nend",
"def valid_move?(input)\n #checks that the attempted move is within the bounds of the game board\n input.between?(0, 8) && !position_taken?(input)\n end",
"def validate_move(input)\n if [1,2,3,4,5,6,7,8,9].include?(input) && !player1.include?(input) && !player2.include?(input) \n true\n else\n false\n end\n end",
"def has_possible_moves\n \t\t@mowers.each do |mower|\n \t\t\treturn true if mower.can_move? && !mower.is_going_outside?(lawn_x, lawn_y)\n\t \tend\n \t\treturn false\n \tend",
"def valid_move? (board, position)\n position = position.to_i - 1\n (position.between?(0,8)) && (position_taken?(board, position) == false)\nend",
"def move_valid?\n @board.first_disk = 0\n\n #determine disk piece to be moved\n @board.board.each do |row, arr|\n if arr[@player.from] != 0\n @board.first_disk = arr[@player.from]\n break\n end\n end\n\n #determine the highest disk available in that column\n @board.board.each do |row, arr|\n if arr[@player.to] != 0\n @board.second_disk = arr[@player.to]\n break\n else\n @board.second_disk = arr[@player.to]\n end\n end\n\n #conditional test to see if move is valid\n if @board.first_disk == 0\n puts \"No disks in this column, try again\"\n get_input\n elsif @board.second_disk == 0 || @board.first_disk < @board.second_disk\n move_disk\n else\n puts \"Move is invalid\"\n puts \"Please check the rules and input a new move\"\n get_input\n end\n end",
"def isValidMove(pos)\n\tif pos < 0 || pos > 8\n\t\tprint \"Invalid move. Try again human. \\n\"\n\t\treturn false\n\telsif @bo[pos] == '-' then\n\t\treturn true\n\telse \n\t\treturn false\n\tend\n end",
"def valid_move?(board,user_input)\n taken = position_taken?(board,user_input)\n valid_input = user_input.between?(0,8)\n valid_move = nil\n if(taken)\n valid_move = false\n else\n valid_move = true\n end\n if(valid_move && valid_input)\n true\n else\n false\n end\nend",
"def valid_move?(index)\n puts \"Turn #{turn_count}\"\n index.between?(0,8) && !position_taken?(index)\n end",
"def valid_move?(board,pos)\n if !position_taken?(board,pos.to_i-1) && pos.to_i.between?(1,9)\n return true\n elsif position_taken?(board,pos.to_i-1) && pos.to_i.between?(1,9)\n return false\n end\nend",
"def valid_move?(move_index)\r\n #valid if position is NOT taken\r\n valid = !self.position_taken?(move_index)\r\n if valid == true\r\n if move_index.between?(0,8)\r\n valid = true\r\n else\r\n valid = false\r\n end\r\n end\r\n valid\r\n end",
"def check_valid_move to_move\r\n\t\t\r\n\t\tif to_move == 0\r\n\t\t\tif driver.location.west_road == nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\t\tend\r\n\t\t\r\n\t\telsif to_move == 1\r\n\t\t\tif driver.location.north_road == nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\t\tend\r\n\t\t\r\n\t\telsif to_move == 2\r\n\t\t\tif driver.location.east_road == nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\t\tend\r\n\t\t\r\n\t\telsif to_move == 3\r\n\t\t\tif driver.location.south_road == nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\t\tend\r\n\t\telse\r\n\t\t\traise \"The location does not exist. Error\"\r\n\t\t\r\n\t\tend\r\n\t\treturn false\r\n\tend",
"def validate_move?(move)\n return true if open_spots.include?(move)\n false\n end",
"def is_acceptable(move)\n\t\t@@ACCEPTABLE_MOVES.include?(move)\n\tend",
"def valid_move? move\n@board[move] == PIECE[:blank]\nend",
"def valid_move?(from_row, from_column, to_row, to_column)\n piece = @state[from_row][from_column]\n return false if piece == nil\n\n new_location = [to_row, to_column]\n return false unless piece.moves.include? new_location\n\n return pawn_valid_move?(piece, new_location, to_column, from_column) if\n piece.class == Pawn\n\n return false unless empty_location?([to_row, to_column]) || \n enemy_piece_at_location?(piece.color, new_location)\n\n unless piece.class == Knight || piece.class == King\n return no_pieces_in_between?(from_row, from_column, to_row, to_column)\n end\n\n true\n end",
"def valid_move?(input)\n (0..8).include?(input) && !position_taken?(input)\n end",
"def valid_move?(move)\n move = move.to_i if move.is_a? String\n return false unless move.is_a? Integer\n move.between?(1, 9) && !position_taken?(move-1) \n end",
"def check_if_valid(player_move)\n [\"rock\", \"paper\", \"scissors\", \"spock\", \"lizard\"].include?(player_move.downcase)\n end",
"def valid_move?(board, position)\n !position_taken?(board, position) && position.between?(0,8)\nend",
"def valid_move?(board,position)\n valid = nil\n if position >= 0 && position <=8\n case position_taken?(board,position)\n when true\n valid = false\n when false\n valid = true\n end\n end\n\n return valid\nend",
"def legal_move?(input)\n return false if @board.pieces[input[0]].nil?\n return false if @board.pieces[input[0]].color == other_player.color\n\n # return false if @board.pieces.include?(input[1])\n # return false if @board.pieces[input[1]].color == player.color\n true\n end",
"def valid_move?(board, position)\n position = position.to_i\n \n if (position_taken?(board, position) ==false) && position.between?(1,9)\n return true\n else\n return false\n end\nend",
"def valid_move?(move)\n # Array of all posiible moves , check the board and map out the possible moves from there.\n end",
"def can_use_move?\n moves = @moveset\n # TODO : Implement all the move conditions\n return moves.any? { |move| move.pp > 0 }\n end",
"def valid_move?(board, position)\n position = (position.to_i - 1)\n\n if position.between?(0, 8) && !position_taken?(board, position)\n true\n else false\n end\nend",
"def valid_move?(position)\n !taken?(position) && position.to_i >0 && position.to_i <=9\n end",
"def valid_move?(board, position)\n position.to_i.between?(1,9) && !position_taken?(board, position.to_i-1)\nend",
"def check_valid(move)\n\n\t\tif @board[move[0]][move[1]] != \"-\"\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\n\tend",
"def valid_move?(board, position)\n position = position.to_i - 1\n if position.between?(0, 8) && !position_taken?(board, position)\n true\n end\nend",
"def movable?\n return false if (@type == 2 and @altitude < MAX_ALTITUDE)\n return (not moving?)\n end",
"def move_is_valid?(position)\n\t\tif @played_positions.index(position)\n\t\t\tresult = false\n\t\telse \n\t\t\t@played_positions << position \n\t\t\tresult = true\n\t\tend\n\t\tresult\n\tend",
"def valid_move?(player, input)\n\t\t\treturn @board.place_mark(player.mark, input)\t\n\t\tend",
"def valid_moves\n\n end",
"def valid_move?(board, position)\n if position_taken?(board, position) == false && position.to_i.between?(0,8)\n true\n else\n false\n end\n end",
"def valid_move?(location)\n location.to_i.between?(1,9) && !position_taken?(location.to_i-1)\n end",
"def can_move?\n counts = ticket_counts\n\n # Performs an optimisation to prevent unnecessary SQL queries\n # Since all nodes support taxi and black tickets, the player may naturally move if they have any\n return true if counts.values_at(:taxi, :black).reduce(&:+) > 0\n\n check_player_can_use_tickets(counts)\n\n publish(:fail, @errors) if @errors.any?\n\n @errors.empty?\n end",
"def stalemate?\n\t\tpieces = @board.board.select { |square, piece| piece.class != String && piece.white == @player.white }\n\t\tperi = [-17,-15,-10,-9,-8,-7,-6,-1,1,6,7,8,9,10,15,17]\n\t\tpieces.each do |from, piece|\n\t\t\tperi.each do |to|\n\t\t\t\tif piece.legal_move?(from, calc_move(from, to)) && (square(calc_move(from, to)) == \" \" || square(calc_move(from, to)).white != @player.white)\n\t\t\t\t\tunless getting_into_check?(from, calc_move(from, to))\n\t\t\t\t\t\tif (piece.class == Pieces::Pawn && square(calc_move(from, to)) == \" \") || piece.class == Pieces::King\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\telsif piece.class == Pieces::Knight && from[1] != to[1]\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\telsif piece.class != Pieces::Pawn && piece.legal_list(from, calc_move(from, to)).all? { |t| square(t) == \" \" }\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\telsif piece.class == Pieces::Pawn && [7,9].any? { |t| calc_move(from, t) == to } && piece.white\n\t\t\t\t\treturn false\n\t\t\t\telsif piece.class == Pieces::Pawn && [-7,-9].any? { |t| calc_move(from, t) == to } && !piece.white\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tunless check?(@board.board)\n\t\t\t@stalemate = true\n\t\t\treturn true\n\t\tend\n\tend",
"def valid_move?(board, index)\n # Is the position taken?\n pos_taken = position_taken?(board, index)\n # Is the position on the board?\n on_board = index.between?(0, board.length - 1)\n # If position is open and on the board, return true,\n if !pos_taken && on_board\n return true\n else\n return false\n end\nend",
"def valid_move?(fir, sec)\n if (sec < 0) || (sec > 8)\n return false\n elsif position_taken?(fir,sec)\n return false\n else\n return true\n end\nend",
"def valid_move?(board, index)\r\n index.between?(0, 8) && !position_taken(board, index) ? true : false \r\nend",
"def valid_move?(board, index)\n if board[index].nil? || position_taken?(board, index) || board[index] == \"X\" || board[index] == \"O\"\n false\n else\n true\n end\nend",
"def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n puts \"this is a valid move\"\n return true\n else\n return false\n end\nend",
"def valid_move?(board, position)\n position = position.to_i - 1\n if position_taken?(board, position)\n return false\n else\n if position.between?(0,8) && (board[position] != \"X\" || board[position] != \"O\")\n return true\n else\n return false \n end\n end\nend",
"def legal_move?(move)\n captured_piece = @board.data[move[0]][move[1]]\n move_current_piece(move)\n king = @king_location || move\n result = safe_king?(king)\n @board.data[move[0]][move[1]] = captured_piece\n result\n end",
"def legal_move?(move)\n captured_piece = @board.data[move[0]][move[1]]\n move_current_piece(move)\n king = @king_location || move\n result = safe_king?(king)\n @board.data[move[0]][move[1]] = captured_piece\n result\n end",
"def valid_move?(board, position)\n if position.to_i>=1 && position.to_i<=9 && !position_taken?(board, position.to_i-1)\n return true\n else\n return false\n end\nend",
"def set_player_move?(player, move)\n if possible_plays.include?(move)\n player.move = move\n true\n else\n false\n end\n end",
"def valid_move?(board, position)\n position = position.to_i\n \n if !(position_taken?(board, position-1)) && position.between?(1,9)\n return true\n else\n return false\n end\nend",
"def valid_move? (board, index)\n if index.between?(0,8) && position_taken?(board, index) == true\n #position is between 0-8 (1-9) AND the position is available (#position_taken)\n true\n else\n false\n end\nend",
"def ask_player_for_move(current_player)\n played=false\n while not played\n puts \"player\" +current_player +\"where would you like to play your move:=\"\n move=gets.to_i-1\n col= move % @board.size\n row=(move-col) / @board.size\n\n if validate_position(row,col)\n @board[row][col]=current_player\n played=true\n end\n end\n end",
"def valid_move?(x_des, y_des)\n ( no_x_move?(x_des) && standard_move?(x_des, y_des) ) ||\n ( promotion_move?(x_des, y_des) || pawn_capture_move?(x_des, y_des) )\n end",
"def valid_move?(cur_pos, next_pos)\n return false if @all_positions[next_pos] # no need to add already seen pos \n cur_col, cur_row = cur_pos\n next_col, next_row = next_pos\n bool_1 = (next_col - cur_col).abs == 2 && (next_row - cur_row).abs == 1\n bool_2 = (next_row - cur_row).abs == 2 && (next_col - cur_col).abs == 1\n bool_1 || bool_2\n end",
"def valid_move?(board,position)\n if position.to_i.between?(1,9) && !position_taken?(board,position.to_i-1)\n true\n else\n end\nend",
"def valid_move?(board, index)\n if index.between?(0, 8) && (position_taken?(board, index) == false)\n true\n elsif (index.between?(0,8) == false) || (position_taken?(board, index) == true)\n false\n end\nend",
"def valid_move?(position)\r\n @index = position.to_i-1\r\n if @index.between?(0,8) && !position_taken?(@index)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def valid_move?(board,position)\n\tif position.to_i.between?(1, 10) && empty_position?(board, position.to_i)\n\t\t\treturn true \n\telse\n\t\treturn false \n\tend\nend",
"def valid_move?(from, to, pieces)\n # check if move is forward for plain piece (not king)\n row = Game.index_to_row(from)\n if Game.is_king?(pieces[from-1]) # kings can go in both direction\n return false if (row + 1 != Game.index_to_row(to)) and (row - 1 != Game.index_to_row(to)) \n elsif Game.is_red?(pieces[from-1])\n return false if row + 1 != Game.index_to_row(to)\n elsif Game.is_white?(pieces[from-1]) and !Game.is_king?(pieces[from-1]) # kings can go in both direction\n return false if row - 1 != Game.index_to_row(to)\n end\n map = get_possible_moves_map\n map[from].include? to\n end",
"def valid_move?(board, ix)\n if position_taken?(board, ix) == false && move_val?(ix) == true\n return true\n else\n false\n end\nend",
"def is_valid?(_destination)\n raise NotImplementedError, \"Must be able to detect if a move is valid!\"\n end",
"def position_taken?(board, position)\n return false if valid_move?(board, position)\n return true unless valid_move?(board, position)\nend",
"def get_move(player_number, current_move)\n if check_if_valid(current_move) == true\n if player_number == 1\n then\n @player1.move = current_move\n else\n @player2.move = current_move\n end\n else\n return false\n end\n return true\n end",
"def valid_move?(board,position)\n position=position.to_i-1\n if position.between?(0,8) && !position_taken?(board, position)\n true\n else\n false\n end\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index) #if the position isn't taken and is on the board, the move must be valid\nend",
"def valid_move?(board, posn_str, team = \"X\")\n posn = posn_str.to_i\n posn -= 1\n if ((posn.between?(0,8)) && !(position_taken?(board,posn)))\n return true\n else\n return false\n end\nend"
] |
[
"0.8317002",
"0.78873295",
"0.7811226",
"0.77638197",
"0.77509844",
"0.77024466",
"0.7641454",
"0.763153",
"0.7595033",
"0.7590222",
"0.75645244",
"0.755246",
"0.7516679",
"0.7514879",
"0.746704",
"0.74664044",
"0.74664044",
"0.74557984",
"0.74546593",
"0.74406874",
"0.74352324",
"0.74173516",
"0.7408267",
"0.7391269",
"0.7388577",
"0.73441285",
"0.73331934",
"0.73249626",
"0.7321515",
"0.7311914",
"0.73098266",
"0.73068154",
"0.7303576",
"0.7299801",
"0.72927326",
"0.72924536",
"0.7279912",
"0.7269454",
"0.7266613",
"0.7254257",
"0.7247005",
"0.7242785",
"0.7233104",
"0.7229922",
"0.7223423",
"0.72228485",
"0.72210836",
"0.72192544",
"0.7214581",
"0.7212472",
"0.7212134",
"0.7209562",
"0.7200121",
"0.7198397",
"0.7188936",
"0.71838295",
"0.7167324",
"0.7164999",
"0.71642506",
"0.7154169",
"0.71497214",
"0.7144693",
"0.7143635",
"0.71395224",
"0.71298265",
"0.7125919",
"0.71202934",
"0.71196854",
"0.7115229",
"0.7114358",
"0.71116644",
"0.7103363",
"0.70991117",
"0.70938176",
"0.709205",
"0.7090492",
"0.709022",
"0.70854306",
"0.7082485",
"0.70766777",
"0.70766777",
"0.7075041",
"0.70703036",
"0.70697457",
"0.7062149",
"0.7061051",
"0.7057546",
"0.7056064",
"0.70523036",
"0.70505387",
"0.70487314",
"0.70428926",
"0.7040017",
"0.7039076",
"0.70387787",
"0.7038753",
"0.703857",
"0.70309466",
"0.7028843",
"0.7026422"
] |
0.7459572
|
17
|
Returns true if a valid move for the specified disc is available; else returns false
|
def isValidMoveAvailableForDisc(disc)
# TO DO: COMPLETE THIS PART OF THE METHOD
for i in 0..@size-1
for j in 0..@size-1
if isValidMoveForDisc(i,j,disc) && @board[i][j] == "-"
return true
end
end
end
# DO NOT DELETE - if control reaches this statement, then a valid move is not available
return false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def isValidMoveAvailable()\n\t\tisValidMoveAvailableForDisc(@disc)\n end",
"def isValidMoveAvailable()\n\t\tisValidMoveAvailableForDisc(@disc)\n end",
"def isValidMoveAvailable()\n isValidMoveAvailableForDisc(@disc)\n end",
"def isValidMoveAvailableForDisc(disc)\n #\n # TO DO: add your code below\n\t\t#\n\t\tfor i in (0...@board.size)\n\t\t\tfor j in (0...@board.size)\n\t\t\t\tif isValidMoveForDisc(i, j, disc)\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false;\n\tend",
"def isValidMoveAvailableForDisc(disc)\n #\n # TO DO: add your code below\n #\n for i in 0...@size\n for j in 0...@size\n if (isValidMoveForDisc(i,j,disc))\n return true\n end\n\n end\n end\n \n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false;\n\tend",
"def isValidMoveForDisc(row, col, disc)\n\n # TO DO: COMPLETE THIS PART OF THE METHOD\n if canMoveTop(row,col,disc)\n return true\n end\n if canMoveTopRight(row,col,disc)\n return true\n end\n if canMoveTopLeft(row,col,disc)\n return true\n end\n if canMoveLeft(row,col,disc)\n return true\n end\n if canMoveRight(row,col,disc)\n return true\n end\n if canMoveBottom(row,col,disc)\n return true\n end\n if canMoveBottomLeft(row,col,disc)\n return true\n end\n if canMoveBottomRight(row,col,disc)\n return true\n end\n\n # DO NOT DELETE - if control reaches this statement, then it is not a valid move\n return false\n end",
"def isValidMoveForDisc(row, col, disc)\n\t\tif @board[row][col] != EMPTY\n\t\t\treturn false\n\t\tend\n\n #\n # TO DO: add your code below\n #\n #puts \"isValidMoveForDisc entering\"\n if (@board[row][col]==EMPTY && (isValidMoveUp(row,col,disc) || isValidMoveDown(row,col,disc) ||isValidMoveLeft(row,col,disc) ||isValidMoveRight(row,col,disc) ||isValidMoveUpRight(row,col,disc) ||isValidMoveUpLeft(row,col,disc) ||isValidMoveDownRight(row,col,disc) ||isValidMoveDownLeft(row,col,disc)))\n return true\n end\n #puts \"isValidMoveForDisc exiting\"\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false\t# if control reaches this point, then it's not a valid move\n end",
"def isValidMove(row, col)\n \treturn isValidMoveForDisc(row, col, @disc)\n end",
"def isValidMove(row, col)\n \treturn isValidMoveForDisc(row, col, @disc)\n end",
"def isValidMove(row, col)\n return isValidMoveForDisc(row, col, @disc)\n end",
"def move_valid?\n @board.first_disk = 0\n\n #determine disk piece to be moved\n @board.board.each do |row, arr|\n if arr[@player.from] != 0\n @board.first_disk = arr[@player.from]\n break\n end\n end\n\n #determine the highest disk available in that column\n @board.board.each do |row, arr|\n if arr[@player.to] != 0\n @board.second_disk = arr[@player.to]\n break\n else\n @board.second_disk = arr[@player.to]\n end\n end\n\n #conditional test to see if move is valid\n if @board.first_disk == 0\n puts \"No disks in this column, try again\"\n get_input\n elsif @board.second_disk == 0 || @board.first_disk < @board.second_disk\n move_disk\n else\n puts \"Move is invalid\"\n puts \"Please check the rules and input a new move\"\n get_input\n end\n end",
"def could_be_valid_move?\n return @board_gfx.is_draggingpiece_valid?\n end",
"def isValidMoveForDisc(row, col, disc)\n\t\tif @board[row][col] != EMPTY\n\t\t\treturn false\n\t\tend\n\n\t\t#Flips them down\n\t\tr = row + 1\n\t\tc = col\n\t\twhile r < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\tr += 1\n\t\tend\n\n\t\tif(r < @size && @board[r][c] == disc)\n\t\t\ti = row + 1\n\t\t\twhile i < r \n\t\t\t\tif(@board[i+1][col] == disc)\n\t\t\t\t\treturn true;\n\t\t\t\tend\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\n\t\t# Flips pieces up \n\t\tr = row - 1\n\t\tc = col\n\n\t\twhile r >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\tr -= 1\n\t\tend\n\n\t\tif r >= 0 && @board[r][c] == disc \n\t\t\ti = row - 1\n\t\t\twhile i > r\n\t\t\t\tif(@board[i-1][col] == disc)\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\tend\n\t\tend\n\n\t\t# flips any opponent discs right\n\t\tr = row\n\t\tc = col + 1\n\t\twhile c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do\n\t\t\t\tc += 1\n\t\tend\n\n\t\tif c < @size && @board[r][c] == disc\n\t\t\tj = col + 1\n\t\t\twhile j < c\n\t\t\t\tif(@board[row][j+1] == disc) \n\t\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\tj += 1\n\t\t\tend\n\t\tend\n\n\n\t\t# flips any opponent discs left\n\t\tr = row\n\t\tc = col - 1\n\n\t\twhile c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\tc -= 1\n\t\tend\n\n\t\tif (c >= 0 && @board[r][c] == disc) \n\t\t\tj = col - 1\n\t\t\twhile j > c\n\t\t\t\tif(@board[row][j-1] == disc) \n\t\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\tj -= 1\n\t\t\tend\n\t\tend\n\n\n\t\t# flips any opponent discs diagonal up right\n\t\tr = row - 1\n\t\tc = col + 1\n\n\t\twhile r >= 0 && c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\tr -= 1\n\t\t\t\tc += 1\n\t\tend\n \n\t\tif r >= 0 && c < @size && @board[r][c] == disc \n\t\t\ti = row - 1\n\t\t\tj = col + 1\n\t\t\twhile i > r && j < c\n\t\t\t\tif(@board[i-1][j+1] == disc) \n\t\t\t\t\t\treturn true; \n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\t\tj += 1\n\t\t\tend\n\t\tend \n\n\t\t# flips any opponent discs diagonal up left\n\t\tr = row - 1\n\t\tc = col - 1\n\t\twhile r >= 0 && c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do\n\t\t\t\tr -= 1\n\t\t\t\tc -= 1\n\t\tend \n\n\t\tif r >= 0 && c >= 0 && @board[r][c] == disc\n\t\t\ti = row - 1\n\t\t\tj = col - 1\n\t\t\twhile i > r && j > c\n\t\t\t\tif @board[i-1][j-1] == disc \n\t\t\t\t\treturn true \n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\t\tj -= 1\n\t\t\tend \n\t\tend \n\n\t\t\t# flips any opponent discs diagonal down left (southwest)\n\t\t\tr = row + 1\n\t\t\tc = col - 1\n\t\t\twhile r < @size && c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\t\tr += 1\n\t\t\t\t\tc -= 1\n\t\t\tend\n\n\t\t\tif r < @size && c >= 0 && @board[r][c] == disc\n\t\t\t\ti = row + 1\n\t\t\t\tj = col - 1\n\t\t\t\twhile i < r && j > c \n\t\t\t\t\tif @board[i+1][j-1] == disc\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\tend \n\t\t\t\t\ti += 1\n\t\t\t\t\tj -= 1\n\t\t\t\tend \n\t\t\tend \n\n\t\t\t# flips any opponent discs diagonal down right\n\t\t\tr = row + 1\n\t\t\tc = col + 1\n\t\t\twhile r < @size && c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\t\tr += 1\n\t\t\t\t\tc += 1\n\t\t\tend \n\n\t\t\tif r < @size && c < @size && @board[r][c] == disc\n\t\t\t\ti = row + 1\n\t\t\t\tj = col + 1\n\t\t\t\twhile i < r && j < c\n\t\t\t\t\tif @board[i+1][j+1] == disc\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend \n\t\t\t\t\ti += 1\n\t\t\t\t\tj += 1\n\t\t\t\tend \n\t\t\tend \n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false\t# if control reaches this point, then it's not a valid move\n\tend",
"def move_available?\n total_available_moves > 0\n end",
"def validate_move?(move)\n return true if open_spots.include?(move)\n false\n end",
"def validMove(piece, newLocation)\n # piece can move to any empty adjacent space.\n # might need to account for placing pieces. can be counted as a fly move i guess \n\n if newLocation == nil || piece == nil\n return false\n end\n\n # check if its a fly move. \n if @player1.isActive\n if @player1.numPlayedPieces <= 3\n fly = true \n else\n fly = false\n end\n else\n if @player2.numPlayedPieces <= 3\n fly = true \n else\n fly = false\n end\n end\n\n\n #checks if space is empty:\n if newLocation.isEmpty()\n # check if its a fly move\n if fly\n # if its a fly and the target location is empty its allowed. \n return true\n elsif piece.location == nil\n return true\n else\n # should return true if the move is valid.\n return @board.isAdjacent(piece,newLocation)\n end\n else\n # should the space is not empty, the move is invalid\n return false\n end\n\n end",
"def valid_move?(destination)\n possible_moves.select do |move|\n on_board?(move) && open?(move)\n end\n\n possible_moves.include?(destination)\n end",
"def check_if_moveisvalid(move)\n @all_available_moves.each do |avail_move|\n return true if move.is_equal_to?(avail_move)\n end\n return false\n end",
"def valid_move?(move)\n move.to_i.between?(1,9) && !taken?(move)\n end",
"def valid_move?(x_des, y_des)\n ( no_x_move?(x_des) && standard_move?(x_des, y_des) ) ||\n ( promotion_move?(x_des, y_des) || pawn_capture_move?(x_des, y_des) )\n end",
"def valid_move?(fir, sec)\n if (sec < 0) || (sec > 8)\n return false\n elsif position_taken?(fir,sec)\n return false\n else\n return true\n end\nend",
"def valid_move?(start_pos)\n raise \"Invalid starting cup\" if (start_pos == 6 || start_pos >= 13)\n raise \"Starting cup is empty\" if @cups[start_pos].empty?\n return true\n end",
"def is_move_valid(move)\n @moves.include? move\n end",
"def valid_move?(start_x, start_y, player)\n return false if get(start_x, start_y) != SPOT_OPEN\n\n # Counts the total flips that would result from this move\n flips = 0\n\n opponent = OthelloBoard::opponent_of(player)\n enumerator = Proc.new do |points, direction|\n # Counts the total flips that would result from this direction\n temp_flips = 0\n points.each do |point|\n x, y = point\n\n case get(x, y)\n when opponent\n temp_flips += 1\n when SPOT_OPEN\n temp_flips = 0\n break\n when player\n flips += temp_flips\n break\n end\n end\n end\n enumerate_around(start_x, start_y, enumerator)\n\n if flips == 0\n return false\n else\n return flips\n end\n end",
"def valid_move?(input)\n (0..8).include?(input) && !position_taken?(input)\n end",
"def valid_move?(position)\n position.between?(0,8) && !position_taken?(position)\n end",
"def valid?(move)\n @board.valid_move?(move)\n end",
"def valid_move(start, stop, board)\r\n if start[0] == stop[0] && start[1] != stop[1]\r\n path = calculate_path(start, stop)\r\n path.each_with_index do |pair, i|\r\n return false if !board[pair[0]][pair[1]].nil? && i != path.size - 1\r\n end\r\n return true\r\n end\r\n if start[1] == stop[1] && start[0] != stop[0]\r\n path = calculate_path(start, stop)\r\n path.each_with_index do |pair, i|\r\n return false if !board[pair[0]][pair[1]].nil? && i != path.size - 1\r\n end\r\n return true\r\n end\r\n return false\r\n end",
"def isValidMove(pos)\n\tif pos < 0 || pos > 8\n\t\tprint \"Invalid move. Try again human. \\n\"\n\t\treturn false\n\telsif @bo[pos] == '-' then\n\t\treturn true\n\telse \n\t\treturn false\n\tend\n end",
"def movable?\n\t\tking = @board.board.select { |square, piece| piece.class == Pieces::King && piece.white == @player.white }.keys[0]\n\t\t[-1,-7,-8,-9,1,7,8,9].each do |spot| \n\t\t\tif square(calc_move(king, spot)) == \" \" || square(king).white != square(calc_move(king, spot)).white \n\t\t\t\treturn true unless getting_into_check?(king, calc_move(king, spot))\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend",
"def valid_move?(position)\n if !position_taken?(position) && position.between?(0,8)\n true\n else\n false\n end\n end",
"def check_valid(move)\n\n\t\tif @board[move[0]][move[1]] != \"-\"\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\n\tend",
"def moves_available?(player)\n !@board.moves(player).empty?\n end",
"def done?\n # legal_moves(state).empty?\n # Try to speed up by disregarding possibility of draw\n false\n end",
"def legal_move?(move)\n captured_piece = @board.data[move[0]][move[1]]\n move_current_piece(move)\n king = @king_location || move\n result = safe_king?(king)\n @board.data[move[0]][move[1]] = captured_piece\n result\n end",
"def legal_move?(move)\n captured_piece = @board.data[move[0]][move[1]]\n move_current_piece(move)\n king = @king_location || move\n result = safe_king?(king)\n @board.data[move[0]][move[1]] = captured_piece\n result\n end",
"def causes_death?(move)\n available_moves(move).empty?\n end",
"def valid_move?(move)\n move = move.to_i if move.is_a? String\n return false unless move.is_a? Integer\n move.between?(1, 9) && !position_taken?(move-1) \n end",
"def valid_move?\n\t\t# Now let's make sure all of the moves are valid.\n\t\t# I'll do this by seeing if the sorted version of each\n\t\t# column equals the @board version.\n\t\ttemp_board = Marshal.load(Marshal.dump(@board))\n\t\ttemp = temp_board[@move_from].shift\n\t\ttemp_board[@move_to].unshift(temp)\n\n\t\ttemp_board.each do |column|\n\t\t\tif column.sort != column\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\t# If they all pass, we're good!\n\t\treturn true\n\tend",
"def moved?(castling_pieces)\n castling_pieces.each do |piece|\n move_count = player_pieces[piece]['moves']\n\n return true if !move_count.zero?\n end\n\n false\n end",
"def valid_move?(from_row, from_column, to_row, to_column)\n piece = @state[from_row][from_column]\n return false if piece == nil\n\n new_location = [to_row, to_column]\n return false unless piece.moves.include? new_location\n\n return pawn_valid_move?(piece, new_location, to_column, from_column) if\n piece.class == Pawn\n\n return false unless empty_location?([to_row, to_column]) || \n enemy_piece_at_location?(piece.color, new_location)\n\n unless piece.class == Knight || piece.class == King\n return no_pieces_in_between?(from_row, from_column, to_row, to_column)\n end\n\n true\n end",
"def valid_move?(input)\n\t\tinput.to_i.between?(1,9) && !taken?(input)\n\tend",
"def valid_move?(move)\n new_position = @current_player.position_after_move(move)\n\n if(@players.available_moves(@current_player).include? move)\n if(@mine.mineable?(new_position) && @current_player.tunneler != move)\n @current_player.damage(5, \"bumping into the wall\")\n return false\n elsif(@rubies.ruby_at_position(new_position))\n puts \"Found a ruby! Take it home!\"\n @current_player.load_up(@rubies.ruby_at_position(new_position))\n elsif(@current_player.home?(new_position))\n @current_player.unload_ruby\n end\n return true\n end\n\n false\n end",
"def valid_move?(input)\n (1..9).include?(input.to_i) && !taken?(input)\n end",
"def valid_move?(board, position)\n position_taken?(board, position) == false && position.between?(0, 8) ? true : false\nend",
"def can_move?(cordx, cordy , x_dest, y_dest)\n\t\t\n\t\tif @pieces == nil \n\t\t\tputs \"No piece at.\"\n\t\telsif x_dest == cordx && y_dest == cordy\n\t\t\tputs \"no change\"\n\t\telsif x_dest > 8 || y_dest > 8\n\t\t\t puts \"Offboard.\"\n\t\telse \n\t\t\t@pieces[cordx][cordy].can_move?(x_dest, y_dest)\n\t\tend\n\tend",
"def valid_move?(position)\n !taken?(position) && position.ord.between?(48, 57)\n end",
"def valid_move?(input)\n (input.to_i.between?(1,9) && !taken?(input))\n end",
"def valid_move?(position)\n !taken?(position) && position.to_i >0 && position.to_i <=9\n end",
"def move_piece(start, dest)\n\n determine_moves(start)\n\n #puts \"dest movem valid?: #{@spaces[start].moveset.include?(dest)}\"\n\n #puts \"dest atack valid?: #{@spaces[start].attackset.include?(dest)}\"\n return false if @spaces[start].color != @player || \n @spaces[start].moveset.include?(dest).! and @spaces[start].attackset.include?(dest).!\n\n #TODO #return false if in_check\n\n @spaces[dest] = @spaces[start]\n\n @spaces[dest].location = dest\n\n @spaces[start] = nil\n\n return true\n\n end",
"def valid_move?(move_index)\r\n #valid if position is NOT taken\r\n valid = !self.position_taken?(move_index)\r\n if valid == true\r\n if move_index.between?(0,8)\r\n valid = true\r\n else\r\n valid = false\r\n end\r\n end\r\n valid\r\n end",
"def valid_move?(input)\n input.to_i.between?(1,9) && !taken?(input)\n end",
"def valid_move?(input)\n input.to_i.between?(1,9) && !taken?(input)\n end",
"def valid_move?(input)\n input.to_i.between?(1,9) && !taken?(input)\n end",
"def valid_move?\n\t\t@table.stays_on_table?(@robot_direction, @x, @y)\n\tend",
"def valid_move?(position)\r\n @index = position.to_i-1\r\n if @index.between?(0,8) && !position_taken?(@index)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def check?\n king_coords = current_player_king_coordinates\n return true unless build_DANGER_moves_array.empty?\n end",
"def valid_move?(board, position)\n if !(position_taken?(board, position)) && position.between?(0, 8)\n return true\n else\n return false\n end\nend",
"def check_valid_move to_move\r\n\t\t\r\n\t\tif to_move == 0\r\n\t\t\tif driver.location.west_road == nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\t\tend\r\n\t\t\r\n\t\telsif to_move == 1\r\n\t\t\tif driver.location.north_road == nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\t\tend\r\n\t\t\r\n\t\telsif to_move == 2\r\n\t\t\tif driver.location.east_road == nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\t\tend\r\n\t\t\r\n\t\telsif to_move == 3\r\n\t\t\tif driver.location.south_road == nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\t\tend\r\n\t\telse\r\n\t\t\traise \"The location does not exist. Error\"\r\n\t\t\r\n\t\tend\r\n\t\treturn false\r\n\tend",
"def legal_move?(input)\n return false if @board.pieces[input[0]].nil?\n return false if @board.pieces[input[0]].color == other_player.color\n\n # return false if @board.pieces.include?(input[1])\n # return false if @board.pieces[input[1]].color == player.color\n true\n end",
"def check?(king_pos, player)\n danger_zone = []\n\n player.pieces.each do |piece|\n if path = piece.valid_dest?(king_pos, @board)\n danger_zone << path\n end\n end\n\n danger_zone.empty? ? false : danger_zone\n end",
"def valid_move?(board,position)\n valid = nil\n if position >= 0 && position <=8\n case position_taken?(board,position)\n when true\n valid = false\n when false\n valid = true\n end\n end\n\n return valid\nend",
"def is_valid_space?(state, move, turn)\n board = JSON.parse(state)\n src, dst = move \n \n # Get the piece that is going to be\n # moved \n srcpiece = board[src[0]][src[1]]\n dstpiece = board[dst[0]][dst[1]]\n \n # Make sure the src piece is the\n # same as the turn and the destination\n # is an empty space\n if srcpiece.downcase != turn or dstpiece != ' '\n return false \n end\n\n return true \n end",
"def validate_move(move) \n move_from_file = @data[\"moves\"][move]\n move_from_file ? valid = true : valid = false\n end",
"def valid_move?(position)\n index=position.to_i - 1\n index.between?(0, 8) && !(position_taken?(index))\n end",
"def check_move? piece, origin, dest\n real_nodes = stub_nodes\n\n apply_move(piece, origin, dest)\n dest_node = node_at(dest)\n check = king_in_check?(piece.color)\n @nodes = real_nodes\n return check\n end",
"def valid_move_seq?(move_seq)\n test_board = @board.dup_board\n # debugger\n if test_board[@position].perform_moves!(move_seq)\n return true\n else\n raise InvalidMoveError\n end\n end",
"def valid_move?(input)\n input.to_i.between?(1, 9) && !taken?(input)\n end",
"def valid_move?(board, index)\n # Is the position taken?\n pos_taken = position_taken?(board, index)\n # Is the position on the board?\n on_board = index.between?(0, board.length - 1)\n # If position is open and on the board, return true,\n if !pos_taken && on_board\n return true\n else\n return false\n end\nend",
"def valid_move?(move)\n valid_numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n if valid_numbers.include?(move)\n return true\n end\n return false\n end",
"def check_move?(new_position)\n if new_position[0].between?(0,7) &&\n new_position[1].between?(0,7) &&\n !space_full?(new_position)\n return true\n end\n false\n end",
"def valid_move?(from, to, player)\n if piece = player_piece?(from, player)\n unless player_piece?(to, player)\n return piece.valid_dest?(to, @board)\n end\n end\n false\n end",
"def valid_move?(input)\n puts \"#{input}\"\n input.to_i.between?(1,9) && !taken?(input)\n end",
"def valid_move?(board,pos)\n if !position_taken?(board,pos.to_i-1) && pos.to_i.between?(1,9)\n return true\n elsif position_taken?(board,pos.to_i-1) && pos.to_i.between?(1,9)\n return false\n end\nend",
"def valid_move?(board, position)\n position = position.to_i\n return false if !valid_position?(position)\n return false if position_taken?(board, position)\n return true\nend",
"def can_move?\n counts = ticket_counts\n\n # Performs an optimisation to prevent unnecessary SQL queries\n # Since all nodes support taxi and black tickets, the player may naturally move if they have any\n return true if counts.values_at(:taxi, :black).reduce(&:+) > 0\n\n check_player_can_use_tickets(counts)\n\n publish(:fail, @errors) if @errors.any?\n\n @errors.empty?\n end",
"def valid_move?(move)\n\t\tif in_bounds?(move) && empty_space?(move) && any_converted_pieces?(move)\n\t\t\treturn true\n\t\telse \n\t\t\treturn false\n\t\tend \n\tend",
"def valid_move?(board, ix)\n if position_taken?(board, ix) == false && move_val?(ix) == true\n return true\n else\n false\n end\nend",
"def valid_move(start, stop, board)\r\n x_diff = (stop[0] - start[0]).abs\r\n y_diff = (stop[1] - start[1]).abs\r\n return true if (x_diff == 0 || x_diff == 1) && (y_diff == 0 || y_diff ==1)\r\n return false\r\n end",
"def valid_move?(board, position)\n position.between?(0, 8) && !position_taken?(board, position)\nend",
"def legal_move? piece, square\n if square.piece.nil? || square.piece.color != piece.color\n case piece.symbol\n\n when \"♟︎\", \"♙\"\n # Return true if square is adjacent and in the correct direction for pawn of that color\n pawn_move?(piece, square)\n when \"♞\", \"♘\"\n # Return true if move is an 'L' shape\n knight_move?(piece.square, square)\n when \"♝\", \"♗\"\n # Return true if move is diagonal and the path is not blocked by a piece\n if bishop_move?(piece.square, square) && clear_path?(piece.square, square)\n true\n else \n false\n end\n when \"♜\", \"♖\"\n # Return true if move is vertical/horizontal and path not blocked by a piece\n if rook_move?(piece.square, square) && clear_path?(piece.square, square)\n true\n else \n false\n end\n when \"♛\", \"♕\"\n # Return true if move is a straight line and path is not blocked by a piece\n if queen_move?(piece.square, square) && clear_path?(piece.square, square)\n true\n else \n false\n end\n when \"♚\", \"♔\"\n # Return true if move is in any direction but only to an adjacent square, and the square is not under attack from a piece\n king_move?(piece, square)\n else\n false\n end\n else\n false\n end\n end",
"def check? (brd=@board)\n \n brd.change_turn\n\n brd.pieces[brd.turn].each do |piece_coords|\n if is_valid_move_helper(piece_coords, brd.king[!brd.turn], false, brd)\n\n brd.change_turn\n return true\n end\n end\n \n\n brd.change_turn\n return false\n end",
"def valid_move?(input_position)\n num = self.convert_to_i(input_position)\n num.between?(1, 9) && !self.taken?(num)\n end",
"def valid_move? (board, position)\n position = position.to_i - 1\n (position.between?(0,8)) && (position_taken?(board, position) == false)\nend",
"def valid_move?(move)\n # Array of all posiible moves , check the board and map out the possible moves from there.\n end",
"def valid_move?(board,position)\n\tif position.to_i.between?(1, 10) && empty_position?(board, position.to_i)\n\t\t\treturn true \n\telse\n\t\treturn false \n\tend\nend",
"def valid_move?(from, to, pieces)\n # check if move is forward for plain piece (not king)\n row = Game.index_to_row(from)\n if Game.is_king?(pieces[from-1]) # kings can go in both direction\n return false if (row + 1 != Game.index_to_row(to)) and (row - 1 != Game.index_to_row(to)) \n elsif Game.is_red?(pieces[from-1])\n return false if row + 1 != Game.index_to_row(to)\n elsif Game.is_white?(pieces[from-1]) and !Game.is_king?(pieces[from-1]) # kings can go in both direction\n return false if row - 1 != Game.index_to_row(to)\n end\n map = get_possible_moves_map\n map[from].include? to\n end",
"def valid_piece_movement?(coordinates)\n row = coordinates[:row]\n column = coordinates[:column]\n @active_piece.moves.any?([row, column]) || @active_piece.captures.any?([row, column])\n end",
"def valid_move?(board, position)\n position = position.to_i\n \n if (position_taken?(board, position) ==false) && position.between?(1,9)\n return true\n else\n return false\n end\nend",
"def valid_move?(location)\n location.to_i.between?(1,9) && !position_taken?(location.to_i-1)\n end",
"def valid_move?(input)\n !taken?(input) && input.to_i.between?(1, 9)\n end",
"def valid_move?(board, position)\n position = position.to_i - 1\n if position_taken?(board, position)\n return false\n else\n if position.between?(0,8) && (board[position] != \"X\" || board[position] != \"O\")\n return true\n else\n return false \n end\n end\nend",
"def valid_move? move\n@board[move] == PIECE[:blank]\nend",
"def space_available?(board, move)\n board[move.to_i] == \"\"\n end",
"def valid_move?(board, position)\n !position_taken?(board, position) && position.between?(0,8)\nend",
"def is_valid_walk(path)\n return false if path.size != 10\n\n hor_moves = 0\n ver_moves = 0\n path.each do |move|\n if move == 'n'\n ver_moves += 1\n elsif move == 's'\n ver_moves -= 1\n elsif move == 'w'\n hor_moves += 1\n else \n hor_moves -= 1\n end\n end\n return (hor_moves == 0 && ver_moves == 0) ? true : false\nend",
"def valid_move?(input)\n #checks that the attempted move is within the bounds of the game board\n input.between?(0, 8) && !position_taken?(input)\n end",
"def valid_move?(board,user_input)\n taken = position_taken?(board,user_input)\n valid_input = user_input.between?(0,8)\n valid_move = nil\n if(taken)\n valid_move = false\n else\n valid_move = true\n end\n if(valid_move && valid_input)\n true\n else\n false\n end\nend",
"def valid_move?(board, indx)\n if indx>=0 && indx<board.length && !position_taken?(board,indx)\n true\n else\n false\n end\nend",
"def can_use_move?\n moves = @moveset\n # TODO : Implement all the move conditions\n return moves.any? { |move| move.pp > 0 }\n end"
] |
[
"0.86856645",
"0.86856645",
"0.8631769",
"0.83926356",
"0.8166335",
"0.79253185",
"0.7809717",
"0.7609814",
"0.7609814",
"0.7605387",
"0.726411",
"0.7055995",
"0.69903004",
"0.6904715",
"0.68830246",
"0.6870403",
"0.6860742",
"0.68529695",
"0.6848695",
"0.68158495",
"0.68084955",
"0.6775882",
"0.6759162",
"0.6690086",
"0.6680481",
"0.6651259",
"0.6642778",
"0.6629378",
"0.6606273",
"0.6596797",
"0.6596359",
"0.65724176",
"0.656358",
"0.6560485",
"0.65494734",
"0.65494734",
"0.65478027",
"0.6547309",
"0.6516289",
"0.6501316",
"0.6485815",
"0.6483722",
"0.64805657",
"0.64763516",
"0.646743",
"0.64632595",
"0.6458322",
"0.6454603",
"0.6452444",
"0.64497304",
"0.6447274",
"0.64459765",
"0.64459765",
"0.64459765",
"0.64457947",
"0.64414",
"0.64391744",
"0.64346564",
"0.64310443",
"0.64246815",
"0.6422117",
"0.64218384",
"0.64198613",
"0.6418402",
"0.641357",
"0.64036816",
"0.64026594",
"0.640166",
"0.6397833",
"0.63945216",
"0.6382953",
"0.6377605",
"0.63725114",
"0.63710576",
"0.63667786",
"0.63662744",
"0.6359047",
"0.6356449",
"0.635615",
"0.635338",
"0.63528174",
"0.6349851",
"0.63388366",
"0.6337311",
"0.63352096",
"0.63339674",
"0.63335204",
"0.63316184",
"0.633033",
"0.632767",
"0.63267595",
"0.6321474",
"0.6314726",
"0.6313855",
"0.63136864",
"0.63127005",
"0.630993",
"0.63013566",
"0.63006544",
"0.6299123"
] |
0.8367985
|
4
|
Returns true if the board is fully occupied with discs; else returns false
|
def isBoardFull()
# TO DO: COMPLETE THIS PART OF THE METHOD
counter = 0
totalSpaces = @size * @size
for i in 0..@size-1
for j in 0..@size-1
if @board[i][j] != "-"
counter = counter + 1
end
end
end
if counter == totalSpaces
return true
end
return false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def full?\n @board.all?{|occupied| occupied != \" \"}\n end",
"def board_full?(brd)\n empty_squares(brd).empty?\n end",
"def board_full?(brd)\n empty_squares(brd).empty?\nend",
"def board_full?(brd)\n empty_squares(brd).empty?\nend",
"def isBoardFull()\n #\n # TO DO: add your code below\n #\n for i in 0...@size\n for j in 0...@size\n if (@board[i][j]==EMPTY)\n return false\n end\n end\n end\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn true;\n\tend",
"def isBoardFull()\n #\n # TO DO: add your code below\n\t\t#\n\t\tfor i in (0...@board.size)\n\t\t\tfor j in (0...@board.size)\n\t\t\t\tif @board[i][j] == EMPTY\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn true;\n\tend",
"def board_full?\n @board.each do |row|\n row.each do |col|\n if col == @empty_square\n #stop at first empty space found\n return nil\n end\n end\n end\n return true\n end",
"def full?\n return @board.all?{|pos| pos == \"X\" or pos == \"O\"}\n end",
"def full_board?\n @board.cells.each do |row|\n row.each do |cell|\n return false if cell.state == \" \"\n end\n end\n true\n end",
"def full?\n @board.all?{|occupied| occupied != \" \"}\nend",
"def full?\n @board.all?{|occupied| occupied != \" \"}\nend",
"def board_full?\n @board.flatten.all?\n @turn == 9 \n end",
"def full? #if theres no winning combos and the board is full? check to see\n @board.all?{|square| square!= \" \" }\n end",
"def board_full?\r\n @game_board.count(\"\") == 0\r\n end",
"def board_full\n\n # Assume the board is full\n result = true\n\n # Outer loop through each row\n for row in 0..BOARD_MAXIMUM_INDEX\n\n # Inner loop through each column\n for column in 0..BOARD_MAXIMUM_INDEX\n\n # Is this cell occupied?\n if @board[row][column] == EMPTY_POSITION\n\n # No, the board is not full and the game must continue\n result = false\n\n end\n\n end\n\n end\n\n # Since we found no open positions, the board is full\n return result\n\n end",
"def full?\n is_full = @board.all? do |space|\n space ==\"X\" || space == \"O\"\n end\n if is_full\n true\n end\n end",
"def board_full?(board)\n false\n true unless board.include?(INITIAL_MARKER)\nend",
"def full?\n\t\t@board.all? { |e|\n\t\t\te == \"X\" || e == \"O\"\n\t\t}\n\tend",
"def full?\n @board.all? {|space| space == \"X\" || space == \"O\"}\n end",
"def full?\n @board.all? {|position| position == \"X\" or position == \"O\"}\n end",
"def full?\n @board.all? {|i| i == \"X\" || i == \"O\"}\n end",
"def board_full?(board)\n !board.include?(\"\")\n end",
"def full?(board)\n filled_tiles = 0\n board.each { |tile| tile == \"X\" || tile == \"O\" ? (filled_tiles += 1) : ()}\n filled_tiles == 9 ? (return true) : (return false)\nend",
"def full?\n @board.all? do |position|\n position != \" \"\n end\n end",
"def full?\n @board.all? do |position|\n position != \" \"\n end\n end",
"def full?\n @board.all? {|value| value == \"X\" || value ==\"O\"}\n end",
"def full?\n @board.all? do |location| \n location == \"X\" || location == \"O\"\n end\n end",
"def full?\n answer= @board.each {|box| return false if taken?(box) == false }\n unless answer ==false \n true\n end\n end",
"def full?\n @board.all? { |location| location != \" \"}\n end",
"def is_full?\n\t\t@game_board.each do |x|\n\t\t\tx.each do |y|\n\t\t\t\tif y == \"\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\ttrue\n\tend",
"def full?(board)\n board.all? do |marker|\n marker == \"X\" || marker == \"O\"\n end\n end",
"def full?\r\n @board.each do |space|\r\n if space == \" \"\r\n return false\r\n end\r\n end\r\n true\r\n end",
"def full?\n @board.cells.include?(\"\") || @board.cells.include?(\" \") ? false : true\n end",
"def full?(board) #check if the board is full\n board.each_with_index do |position, index|\n if position_taken?(board, index) == false \n return false\n end\n end\n return true\nend",
"def occupied?(x,y) # board position !nil\n !self.board.grid[x][y].nil?\n end",
"def full?\n #if there is a blank space, returns false, otherwise true\n !(@board.detect {|posit| posit == \" \"})\n end",
"def full?(board)\n if won?(board) == false && board.all? {|element| element != \" \"}\n return true\n else\n false\n end\nend",
"def is_board_full(board)\n for i in 1..10\n if is_space_free(board, i)\n return false\n end\n end \n\n return true\nend",
"def full?(board)\n\tboard.all? do |cell|\n\t\tcell == \"X\" || cell == \"O\"\n\tend\nend",
"def full\n @moves.length >= 12\n end",
"def full?\n @board.all?{|token| token == \"X\" || token == \"O\"}\n end",
"def occupied(pos)\n\t\t!( @board[pos] == \"*\" ) ? true : false\n\tend",
"def full?\n @board.all? { |token| token == \"X\" || token == \"O\" }\n end",
"def full?(board_array)\n board_check = board_array.all? do |space|\n space != \" \"\n end\n \n if board_check\n return true #situation for a draw\n else\n return false #situation for an in-progress game\n end\nend",
"def full?\r\n @board.none? do | position |\r\n position == \" \"\r\n end\r\n end",
"def full?(board_array)\r\n board_check = board_array.all? do |space|\r\n space != \" \"\r\n end\r\n \r\n if board_check\r\n return true #situation for a draw\r\n else\r\n return false #situation for an in-progress game\r\n end\r\nend",
"def check_full(board)\n return true if board.all? { |i| i == \"x\" || i == \"o\" }\n return false\n end",
"def full?(board)\n\t\tboard.all?{|cell| cell == \"X\" || cell == \"O\"}\n\tend",
"def on_board?(coords)\n\t\tcoords.any? {|coord| coord < 1 || coord > @size } ? false : true\n\tend",
"def full?(board)\n board_is_full = board.all? do |space|\n space == \"X\" || space == \"O\"\n end\n return board_is_full\nend",
"def full?(board)\n board.each do |space|\n if space == \"X\" || space == \"O\"\n else\n return false\n end\n end\n true\nend",
"def over?\n @board.pieces_coords(@current_color).all? do |coords|\n safe_moves(coords).empty?\n end\n end",
"def full?\n # If no 'board_position'/s are empty, returns 'true'. If 'board_position'/s remain empty, returns 'false'.\n if @board.none? {|board_position| board_position == \" \"}\n true\n end\n end",
"def won?\n board.all_non_mines_cells_revealed?\n end",
"def isValidMoveAvailableForDisc(disc)\n #\n # TO DO: add your code below\n\t\t#\n\t\tfor i in (0...@board.size)\n\t\t\tfor j in (0...@board.size)\n\t\t\t\tif isValidMoveForDisc(i, j, disc)\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false;\n\tend",
"def full?(board)\n board_full = board.all? {|position| position == 'X' || position == 'O'}\n\n if (board_full)\n return true\n end\nend",
"def full?(board)\n if !(won?(board))\n board.each do |e|\n if (e != \"X\" && e != \"O\")\n return false\n end\n end\n end\n return true\nend",
"def full?\n result = @board.none? {|mark| mark==\" \"}\n return result\n end",
"def full?\n if @board.detect{|i| i == \"\" || i == \" \"}\n return false\n else\n return true\n end\n end",
"def draw?\n board.full_board?\n end",
"def full?(board)\n board.all?{|filled| filled == \"X\" || filled == \"O\"}\nend",
"def draw?\n !won? && board.full?\n end",
"def full?(board)\n is_full = board.all? do |position|\n (position == \"X\" || position == \"O\")\n end\n return is_full\nend",
"def full?\n @board.all? { |x| x == \"X\" || x == \"O\" } \nend",
"def full?(board)\n return board.all?{|pos| pos == \"X\" or pos == \"O\"}\nend",
"def covering_moves?(board)\n (board.word_positions).any? do |word_posns|\n positions >= word_posns\n end\n end",
"def full?\n !@board.detect{|i| i == \" \"}\n end",
"def full?\n any_spaces = @board.any?{|element| element == \" \"}\n if any_spaces == true\n return false\n else\n return true\n end\n end",
"def full? \n\t@board.any? {|a| a.include?(\" \")} ? false : true\n\tend",
"def full?(board)\n board.all? { |i| i == \"X\" || i == \"O\" }\n end",
"def fullBoard(position)\n for x in 0..2\n for y in 0..2\n if position[x][y] == 0\n return false\n end\n end\n end\n return true\n end",
"def full?(board)\n all_full = false\n board.all? do |space|\n if space == \"X\" || space == \"O\"\n all_full = true\n end\n end\nend",
"def full?(board)\n if @board.any? {|index| index == nil || index == \" \"}\n return false\n else\n return true\n end\n end",
"def full?(board)\n board.each do |index|\n if index != \"X\" && index != \"O\"\n return false\n end\n end\n return true\nend",
"def check_full? \n \t\treturn true if @size==16 #size increase by 1 with every turn so when it reaches 16 we know that all cells are full\n\tend",
"def full?()\n @board.each do |values|\n if values == \" \" || values == \"\"\n return false\n end\n end\n return true\n end",
"def all_cells_cleared?\n @board.each do |row|\n row.each do |cell|\n if !cell.has_bomb && !cell.is_open\n return false\n end\n end\n end\n true\n end",
"def isValidMoveAvailableForDisc(disc)\n\n # TO DO: COMPLETE THIS PART OF THE METHOD\n for i in 0..@size-1\n for j in 0..@size-1\n if isValidMoveForDisc(i,j,disc) && @board[i][j] == \"-\"\n return true\n end\n end\n end\n\n # DO NOT DELETE - if control reaches this statement, then a valid move is not available\n return false\n end",
"def full?\n @cells.all? { |space| space == \"X\" || space == \"O\" }\n end",
"def full?(board)\n board.all?{|a| (a==\"X\" || a== \"O\")}\nend",
"def full?(board)\n board.all? { |space| space == \"X\" || space == \"O\"}\nend",
"def full?(board)\n board.all? { |space| space == \"X\" || space == \"O\"}\nend",
"def draw?\n @board.full? && !won?\n end",
"def draw?\n @board.full? && !won?\n end",
"def full_board (board)\n board.each_index do |row_index|\n return false if board[row_index].include?(\"-\")\n end\n return true\n end",
"def draw?\n @board.full? && !won?\n end",
"def full?(board)\n board.all?{|symbol| symbol == \"X\" || symbol == \"O\"} ? true : false\nend",
"def full?(board)\n board.all?{|position| position == \"X\" || position == \"O\"}\nend",
"def isValidMoveForDisc(row, col, disc)\n\t\tif @board[row][col] != EMPTY\n\t\t\treturn false\n\t\tend\n\n\t\t#Flips them down\n\t\tr = row + 1\n\t\tc = col\n\t\twhile r < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\tr += 1\n\t\tend\n\n\t\tif(r < @size && @board[r][c] == disc)\n\t\t\ti = row + 1\n\t\t\twhile i < r \n\t\t\t\tif(@board[i+1][col] == disc)\n\t\t\t\t\treturn true;\n\t\t\t\tend\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\n\t\t# Flips pieces up \n\t\tr = row - 1\n\t\tc = col\n\n\t\twhile r >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\tr -= 1\n\t\tend\n\n\t\tif r >= 0 && @board[r][c] == disc \n\t\t\ti = row - 1\n\t\t\twhile i > r\n\t\t\t\tif(@board[i-1][col] == disc)\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\tend\n\t\tend\n\n\t\t# flips any opponent discs right\n\t\tr = row\n\t\tc = col + 1\n\t\twhile c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do\n\t\t\t\tc += 1\n\t\tend\n\n\t\tif c < @size && @board[r][c] == disc\n\t\t\tj = col + 1\n\t\t\twhile j < c\n\t\t\t\tif(@board[row][j+1] == disc) \n\t\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\tj += 1\n\t\t\tend\n\t\tend\n\n\n\t\t# flips any opponent discs left\n\t\tr = row\n\t\tc = col - 1\n\n\t\twhile c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\tc -= 1\n\t\tend\n\n\t\tif (c >= 0 && @board[r][c] == disc) \n\t\t\tj = col - 1\n\t\t\twhile j > c\n\t\t\t\tif(@board[row][j-1] == disc) \n\t\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\tj -= 1\n\t\t\tend\n\t\tend\n\n\n\t\t# flips any opponent discs diagonal up right\n\t\tr = row - 1\n\t\tc = col + 1\n\n\t\twhile r >= 0 && c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\tr -= 1\n\t\t\t\tc += 1\n\t\tend\n \n\t\tif r >= 0 && c < @size && @board[r][c] == disc \n\t\t\ti = row - 1\n\t\t\tj = col + 1\n\t\t\twhile i > r && j < c\n\t\t\t\tif(@board[i-1][j+1] == disc) \n\t\t\t\t\t\treturn true; \n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\t\tj += 1\n\t\t\tend\n\t\tend \n\n\t\t# flips any opponent discs diagonal up left\n\t\tr = row - 1\n\t\tc = col - 1\n\t\twhile r >= 0 && c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do\n\t\t\t\tr -= 1\n\t\t\t\tc -= 1\n\t\tend \n\n\t\tif r >= 0 && c >= 0 && @board[r][c] == disc\n\t\t\ti = row - 1\n\t\t\tj = col - 1\n\t\t\twhile i > r && j > c\n\t\t\t\tif @board[i-1][j-1] == disc \n\t\t\t\t\treturn true \n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\t\tj -= 1\n\t\t\tend \n\t\tend \n\n\t\t\t# flips any opponent discs diagonal down left (southwest)\n\t\t\tr = row + 1\n\t\t\tc = col - 1\n\t\t\twhile r < @size && c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\t\tr += 1\n\t\t\t\t\tc -= 1\n\t\t\tend\n\n\t\t\tif r < @size && c >= 0 && @board[r][c] == disc\n\t\t\t\ti = row + 1\n\t\t\t\tj = col - 1\n\t\t\t\twhile i < r && j > c \n\t\t\t\t\tif @board[i+1][j-1] == disc\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\tend \n\t\t\t\t\ti += 1\n\t\t\t\t\tj -= 1\n\t\t\t\tend \n\t\t\tend \n\n\t\t\t# flips any opponent discs diagonal down right\n\t\t\tr = row + 1\n\t\t\tc = col + 1\n\t\t\twhile r < @size && c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\t\tr += 1\n\t\t\t\t\tc += 1\n\t\t\tend \n\n\t\t\tif r < @size && c < @size && @board[r][c] == disc\n\t\t\t\ti = row + 1\n\t\t\t\tj = col + 1\n\t\t\t\twhile i < r && j < c\n\t\t\t\t\tif @board[i+1][j+1] == disc\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend \n\t\t\t\t\ti += 1\n\t\t\t\t\tj += 1\n\t\t\t\tend \n\t\t\tend \n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false\t# if control reaches this point, then it's not a valid move\n\tend",
"def gaps_covered_by?(board)\n row_range.all? do |row|\n col_range.all? do |col|\n @positions.include?([row, col]) || board.nonempty_space?(row, col)\n end\n end\n end",
"def full?\n if @board.include?(\" \")\n false\n else\n true\n end\nend",
"def draw?\n board.full? && self.won? == false\n end",
"def no_pieces_in_between_diagonal?(from_row, from_column, to_row, to_column)\n row = from_row\n column = from_column\n if to_row > from_row && to_column > from_column\n row += 1\n column += 1\n until row == to_row\n return false unless @state[row][column] == nil\n row += 1\n column += 1\n end\n elsif to_row > from_row && to_column <= from_column\n row += 1\n column -= 1\n until row == to_row\n return false unless @state[row][column] == nil\n row += 1\n column -= 1\n end\n elsif to_row <= from_row && to_column <= from_column\n row -= 1\n column -= 1\n until row == to_row\n return false unless @state[row][column] == nil\n row -= 1\n column -= 1\n end\n elsif to_row <= from_row && to_column > from_column\n row -= 1\n column += 1\n until row == to_row\n return false unless @state[row][column] == nil\n row -= 1\n column += 1\n end\n end\n true\n end",
"def full?\n true if cells.all?{|pos| pos == \"X\" || pos == \"O\"}\n end",
"def touching?(board)\n @positions.any? do |row, col|\n [[0, 0], [1, 0], [-1, 0], [0, 1], [0, -1]].any? do |dr, dc|\n board.nonempty_space?(row + dr, col + dc)\n end\n end\n end",
"def full?(board)\n board.all? do |space|\n space == \"X\" || space == \"O\"\n end\nend",
"def draw?\n if !won?\n board.cells.each do |i|\n if i == \" \"\n return false\n end\n true\n end\n end\n \n end",
"def full?(board)\n # indices = [0, 1, 2, 3, 4, 5, 6, 7, 8]\n # if indices.all? {|position| position_taken?(board, position, \"X\") || position_taken?(board, position, \"O\")}\n # return true\n # elsif board.include?(\" \")\n # return false\n if board.include?(\" \" || \"\" || nil)\n return false\n else\n return true\n end\nend",
"def no_pieces_in_between?(from_row, from_column, to_row, to_column)\n if from_row == to_row\n column = from_column < to_column ? from_column : to_column\n ending_column = column == from_column ? to_column : from_column\n column += 1\n until column == ending_column\n return false unless @state[from_row][column] == nil\n column += 1\n end\n true\n elsif from_column == to_column\n row = from_row < to_row ? from_row : to_row\n ending_row = row == from_row ? to_row : from_row\n row += 1\n until row == ending_row\n return false unless @state[row][from_column] == nil\n row += 1\n end\n true\n else\n no_pieces_in_between_diagonal?(from_row, from_column, to_row, to_column)\n end\n end",
"def over?(board)\n\n\n # is board full\n board.all? {|i| i == \"O\" || i == \"X\"}\n\n\nend"
] |
[
"0.82167774",
"0.8075867",
"0.7902185",
"0.7902185",
"0.78788847",
"0.7866243",
"0.7854012",
"0.7836874",
"0.78315777",
"0.7821679",
"0.7821679",
"0.7790783",
"0.7768844",
"0.7711425",
"0.77066225",
"0.77058244",
"0.7667365",
"0.7651848",
"0.76508766",
"0.7647774",
"0.7611108",
"0.75600135",
"0.7534813",
"0.7532787",
"0.7532787",
"0.7519022",
"0.74939775",
"0.7464833",
"0.74554276",
"0.74280673",
"0.7421338",
"0.7420633",
"0.74141556",
"0.7412431",
"0.7399562",
"0.73983824",
"0.7394351",
"0.73775",
"0.7372225",
"0.7371076",
"0.7366706",
"0.73574716",
"0.7350728",
"0.7350504",
"0.7348301",
"0.73372275",
"0.7317861",
"0.73159784",
"0.73147345",
"0.73123205",
"0.73085016",
"0.7306689",
"0.7299898",
"0.72901803",
"0.7274241",
"0.72590166",
"0.7254307",
"0.7249949",
"0.7239503",
"0.72304726",
"0.7224838",
"0.7221909",
"0.7218347",
"0.7216519",
"0.72106147",
"0.7207301",
"0.7199591",
"0.71987194",
"0.7197681",
"0.7195978",
"0.7191651",
"0.71908236",
"0.71827275",
"0.7180831",
"0.71765465",
"0.7167657",
"0.71584976",
"0.7154108",
"0.7151786",
"0.7146565",
"0.7131127",
"0.7131127",
"0.7127939",
"0.7127939",
"0.7122171",
"0.7112064",
"0.71055007",
"0.70978826",
"0.70971364",
"0.70962834",
"0.7083744",
"0.70829344",
"0.7076009",
"0.70673144",
"0.70643103",
"0.7053682",
"0.7046786",
"0.7046494",
"0.70454943",
"0.70447195"
] |
0.78141826
|
11
|
Returns true if either the board is full or a valid move is not available for either disc
|
def isGameOver()
return isBoardFull() ||
(!isValidMoveAvailableForDisc(WHITE) &&
!isValidMoveAvailableForDisc(BLACK))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def isValidMoveAvailableForDisc(disc)\n #\n # TO DO: add your code below\n\t\t#\n\t\tfor i in (0...@board.size)\n\t\t\tfor j in (0...@board.size)\n\t\t\t\tif isValidMoveForDisc(i, j, disc)\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false;\n\tend",
"def isValidMoveAvailableForDisc(disc)\n\n # TO DO: COMPLETE THIS PART OF THE METHOD\n for i in 0..@size-1\n for j in 0..@size-1\n if isValidMoveForDisc(i,j,disc) && @board[i][j] == \"-\"\n return true\n end\n end\n end\n\n # DO NOT DELETE - if control reaches this statement, then a valid move is not available\n return false\n end",
"def isValidMoveAvailable()\n\t\tisValidMoveAvailableForDisc(@disc)\n end",
"def isValidMoveAvailable()\n\t\tisValidMoveAvailableForDisc(@disc)\n end",
"def isValidMoveAvailable()\n isValidMoveAvailableForDisc(@disc)\n end",
"def move_valid?\n @board.first_disk = 0\n\n #determine disk piece to be moved\n @board.board.each do |row, arr|\n if arr[@player.from] != 0\n @board.first_disk = arr[@player.from]\n break\n end\n end\n\n #determine the highest disk available in that column\n @board.board.each do |row, arr|\n if arr[@player.to] != 0\n @board.second_disk = arr[@player.to]\n break\n else\n @board.second_disk = arr[@player.to]\n end\n end\n\n #conditional test to see if move is valid\n if @board.first_disk == 0\n puts \"No disks in this column, try again\"\n get_input\n elsif @board.second_disk == 0 || @board.first_disk < @board.second_disk\n move_disk\n else\n puts \"Move is invalid\"\n puts \"Please check the rules and input a new move\"\n get_input\n end\n end",
"def isValidMove(row, col)\n \treturn isValidMoveForDisc(row, col, @disc)\n end",
"def isValidMove(row, col)\n \treturn isValidMoveForDisc(row, col, @disc)\n end",
"def isValidMove(row, col)\n return isValidMoveForDisc(row, col, @disc)\n end",
"def moves_available?(player)\n !@board.moves(player).empty?\n end",
"def could_be_valid_move?\n return @board_gfx.is_draggingpiece_valid?\n end",
"def isValidMoveForDisc(row, col, disc)\n\t\tif @board[row][col] != EMPTY\n\t\t\treturn false\n\t\tend\n\n #\n # TO DO: add your code below\n #\n #puts \"isValidMoveForDisc entering\"\n if (@board[row][col]==EMPTY && (isValidMoveUp(row,col,disc) || isValidMoveDown(row,col,disc) ||isValidMoveLeft(row,col,disc) ||isValidMoveRight(row,col,disc) ||isValidMoveUpRight(row,col,disc) ||isValidMoveUpLeft(row,col,disc) ||isValidMoveDownRight(row,col,disc) ||isValidMoveDownLeft(row,col,disc)))\n return true\n end\n #puts \"isValidMoveForDisc exiting\"\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false\t# if control reaches this point, then it's not a valid move\n end",
"def valid_move?\n\t\t# Now let's make sure all of the moves are valid.\n\t\t# I'll do this by seeing if the sorted version of each\n\t\t# column equals the @board version.\n\t\ttemp_board = Marshal.load(Marshal.dump(@board))\n\t\ttemp = temp_board[@move_from].shift\n\t\ttemp_board[@move_to].unshift(temp)\n\n\t\ttemp_board.each do |column|\n\t\t\tif column.sort != column\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\t# If they all pass, we're good!\n\t\treturn true\n\tend",
"def valid_move? move\n@board[move] == PIECE[:blank]\nend",
"def valid_move?(arr)\n arr[0] >= 0 && arr[0] <= 7 && arr[1] >= 0 && arr[1] <= 7 && @board[arr[0]][arr[1]][:piece].nil?\n end",
"def space_available?(board, move)\n board[move.to_i] == \"\"\n end",
"def can_move?(cordx, cordy , x_dest, y_dest)\n\t\t\n\t\tif @pieces == nil \n\t\t\tputs \"No piece at.\"\n\t\telsif x_dest == cordx && y_dest == cordy\n\t\t\tputs \"no change\"\n\t\telsif x_dest > 8 || y_dest > 8\n\t\t\t puts \"Offboard.\"\n\t\telse \n\t\t\t@pieces[cordx][cordy].can_move?(x_dest, y_dest)\n\t\tend\n\tend",
"def valid_move?(board, position)\n position.between?(0, 8) && !position_taken?(board, position)\nend",
"def valid_move?(destination)\n possible_moves.select do |move|\n on_board?(move) && open?(move)\n end\n\n possible_moves.include?(destination)\n end",
"def full?\n return @board.all?{|pos| pos == \"X\" or pos == \"O\"}\n end",
"def valid_move?(move)\n # Array of all posiible moves , check the board and map out the possible moves from there.\n end",
"def isValidMoveForDisc(row, col, disc)\n\n # TO DO: COMPLETE THIS PART OF THE METHOD\n if canMoveTop(row,col,disc)\n return true\n end\n if canMoveTopRight(row,col,disc)\n return true\n end\n if canMoveTopLeft(row,col,disc)\n return true\n end\n if canMoveLeft(row,col,disc)\n return true\n end\n if canMoveRight(row,col,disc)\n return true\n end\n if canMoveBottom(row,col,disc)\n return true\n end\n if canMoveBottomLeft(row,col,disc)\n return true\n end\n if canMoveBottomRight(row,col,disc)\n return true\n end\n\n # DO NOT DELETE - if control reaches this statement, then it is not a valid move\n return false\n end",
"def valid_move?(board, position)\n !position_taken?(board, position) && position.between?(0,8)\nend",
"def valid_move?(from_row, from_column, to_row, to_column)\n piece = @state[from_row][from_column]\n return false if piece == nil\n\n new_location = [to_row, to_column]\n return false unless piece.moves.include? new_location\n\n return pawn_valid_move?(piece, new_location, to_column, from_column) if\n piece.class == Pawn\n\n return false unless empty_location?([to_row, to_column]) || \n enemy_piece_at_location?(piece.color, new_location)\n\n unless piece.class == Knight || piece.class == King\n return no_pieces_in_between?(from_row, from_column, to_row, to_column)\n end\n\n true\n end",
"def game_over?\n possible_moves(:white).empty? && possible_moves(:black).empty? \n end",
"def full?\n is_full = @board.all? do |space|\n space ==\"X\" || space == \"O\"\n end\n if is_full\n true\n end\n end",
"def valid_move?(board, index)\n # Is the position taken?\n pos_taken = position_taken?(board, index)\n # Is the position on the board?\n on_board = index.between?(0, board.length - 1)\n # If position is open and on the board, return true,\n if !pos_taken && on_board\n return true\n else\n return false\n end\nend",
"def full?\n @board.all? {|space| space == \"X\" || space == \"O\"}\n end",
"def full?\n @board.all? {|position| position == \"X\" or position == \"O\"}\n end",
"def valid_moves(temp_board)\n moves.select do |end_pos|\n temp_board.valid_pos?(end_pos) && temp_board.empty?(end_pos)\n end\n end",
"def isGameOver()\n\t\treturn isBoardFull() ||\n\t\t\t\t\t(!isValidMoveAvailableForDisc(WHITE) &&\n\t\t\t\t\t\t\t\t!isValidMoveAvailableForDisc(BLACK))\n\tend",
"def isGameOver()\n\t\treturn isBoardFull() ||\n\t\t\t\t\t(!isValidMoveAvailableForDisc(WHITE) &&\n\t\t\t\t\t\t\t\t!isValidMoveAvailableForDisc(BLACK))\n\tend",
"def full? #if theres no winning combos and the board is full? check to see\n @board.all?{|square| square!= \" \" }\n end",
"def board_full?(brd)\n empty_squares(brd).empty?\n end",
"def valid_move?(board, position)\n if !(position_taken?(board, position)) && position.between?(0, 8)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, position)\n position_taken?(board, position) == false && position.between?(0, 8) ? true : false\nend",
"def legal_move?(board,from,to)\n\t\treturn false unless super(board,to)\n\t\tfrom_y = from[1]\n\t\tfrom_x = from[0]\n\t\tto_y = to[1]\n\t\tto_x = to[0]\n\t\t#when trying to move diagonally\n\t\tif from_x != to_x\n\t\t\t#checks colour of pawn\n\t\t\tif colour == \"white\"\n\t\t\t\t#checks only 1 vertical move away\n\t\t\t\tif (from_y-to_y) == 1\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"No enemy pawn there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif (to_y-from_y) == 1\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"No enemy pawn there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#when trying to move straight\n\t\tif colour == \"white\"\n\t\t\tif from_y == 6\n\t\t\t\tif (from_y-to_y) <= 2 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 or 2 spaces from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\t\t\t\t\t\n\t\t\telse\n\t\t\t\tif (from_y-to_y) == 1 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 space from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tif from_y == 1\n\t\t\t\tif (to_y-from_y) <= 2 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 or 2 spaces from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif (to_y-from_y) == 1 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 space from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def has_valid_piece?\n piece_to_move && right_piece_type? && right_piece_color?\n end",
"def validMove(piece, newLocation)\n # piece can move to any empty adjacent space.\n # might need to account for placing pieces. can be counted as a fly move i guess \n\n if newLocation == nil || piece == nil\n return false\n end\n\n # check if its a fly move. \n if @player1.isActive\n if @player1.numPlayedPieces <= 3\n fly = true \n else\n fly = false\n end\n else\n if @player2.numPlayedPieces <= 3\n fly = true \n else\n fly = false\n end\n end\n\n\n #checks if space is empty:\n if newLocation.isEmpty()\n # check if its a fly move\n if fly\n # if its a fly and the target location is empty its allowed. \n return true\n elsif piece.location == nil\n return true\n else\n # should return true if the move is valid.\n return @board.isAdjacent(piece,newLocation)\n end\n else\n # should the space is not empty, the move is invalid\n return false\n end\n\n end",
"def full?(board) #check if the board is full\n board.each_with_index do |position, index|\n if position_taken?(board, index) == false \n return false\n end\n end\n return true\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\n end",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\n end",
"def stalemate?\n\t\tpieces = @board.board.select { |square, piece| piece.class != String && piece.white == @player.white }\n\t\tperi = [-17,-15,-10,-9,-8,-7,-6,-1,1,6,7,8,9,10,15,17]\n\t\tpieces.each do |from, piece|\n\t\t\tperi.each do |to|\n\t\t\t\tif piece.legal_move?(from, calc_move(from, to)) && (square(calc_move(from, to)) == \" \" || square(calc_move(from, to)).white != @player.white)\n\t\t\t\t\tunless getting_into_check?(from, calc_move(from, to))\n\t\t\t\t\t\tif (piece.class == Pieces::Pawn && square(calc_move(from, to)) == \" \") || piece.class == Pieces::King\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\telsif piece.class == Pieces::Knight && from[1] != to[1]\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\telsif piece.class != Pieces::Pawn && piece.legal_list(from, calc_move(from, to)).all? { |t| square(t) == \" \" }\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\telsif piece.class == Pieces::Pawn && [7,9].any? { |t| calc_move(from, t) == to } && piece.white\n\t\t\t\t\treturn false\n\t\t\t\telsif piece.class == Pieces::Pawn && [-7,-9].any? { |t| calc_move(from, t) == to } && !piece.white\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tunless check?(@board.board)\n\t\t\t@stalemate = true\n\t\t\treturn true\n\t\tend\n\tend",
"def move_out_valid?(board)\r\n offsets = [[1,0],[0,1],[-1,0],[0,-1],[1,1],[-1,1],[-1,-1],[1,-1]]\r\n \toffsets.each do |offset|\r\n to_row, to_col = @row + offset[0], @col + offset[1]\r\n\r\n if valid_move?(to_row, to_col, board, @color)\r\n puts \"King can move out at: [#{to_row},#{to_col}]\"\r\n return true\r\n end\r\n \tend\r\n \treturn false\r\n end",
"def over?\n @board.pieces_coords(@current_color).all? do |coords|\n safe_moves(coords).empty?\n end\n end",
"def check? (brd=@board)\n \n brd.change_turn\n\n brd.pieces[brd.turn].each do |piece_coords|\n if is_valid_move_helper(piece_coords, brd.king[!brd.turn], false, brd)\n\n brd.change_turn\n return true\n end\n end\n \n\n brd.change_turn\n return false\n end",
"def isValidMoveForDisc(row, col, disc)\n\t\tif @board[row][col] != EMPTY\n\t\t\treturn false\n\t\tend\n\n\t\t#Flips them down\n\t\tr = row + 1\n\t\tc = col\n\t\twhile r < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\tr += 1\n\t\tend\n\n\t\tif(r < @size && @board[r][c] == disc)\n\t\t\ti = row + 1\n\t\t\twhile i < r \n\t\t\t\tif(@board[i+1][col] == disc)\n\t\t\t\t\treturn true;\n\t\t\t\tend\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\n\t\t# Flips pieces up \n\t\tr = row - 1\n\t\tc = col\n\n\t\twhile r >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\tr -= 1\n\t\tend\n\n\t\tif r >= 0 && @board[r][c] == disc \n\t\t\ti = row - 1\n\t\t\twhile i > r\n\t\t\t\tif(@board[i-1][col] == disc)\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\tend\n\t\tend\n\n\t\t# flips any opponent discs right\n\t\tr = row\n\t\tc = col + 1\n\t\twhile c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do\n\t\t\t\tc += 1\n\t\tend\n\n\t\tif c < @size && @board[r][c] == disc\n\t\t\tj = col + 1\n\t\t\twhile j < c\n\t\t\t\tif(@board[row][j+1] == disc) \n\t\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\tj += 1\n\t\t\tend\n\t\tend\n\n\n\t\t# flips any opponent discs left\n\t\tr = row\n\t\tc = col - 1\n\n\t\twhile c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\tc -= 1\n\t\tend\n\n\t\tif (c >= 0 && @board[r][c] == disc) \n\t\t\tj = col - 1\n\t\t\twhile j > c\n\t\t\t\tif(@board[row][j-1] == disc) \n\t\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\tj -= 1\n\t\t\tend\n\t\tend\n\n\n\t\t# flips any opponent discs diagonal up right\n\t\tr = row - 1\n\t\tc = col + 1\n\n\t\twhile r >= 0 && c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\tr -= 1\n\t\t\t\tc += 1\n\t\tend\n \n\t\tif r >= 0 && c < @size && @board[r][c] == disc \n\t\t\ti = row - 1\n\t\t\tj = col + 1\n\t\t\twhile i > r && j < c\n\t\t\t\tif(@board[i-1][j+1] == disc) \n\t\t\t\t\t\treturn true; \n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\t\tj += 1\n\t\t\tend\n\t\tend \n\n\t\t# flips any opponent discs diagonal up left\n\t\tr = row - 1\n\t\tc = col - 1\n\t\twhile r >= 0 && c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do\n\t\t\t\tr -= 1\n\t\t\t\tc -= 1\n\t\tend \n\n\t\tif r >= 0 && c >= 0 && @board[r][c] == disc\n\t\t\ti = row - 1\n\t\t\tj = col - 1\n\t\t\twhile i > r && j > c\n\t\t\t\tif @board[i-1][j-1] == disc \n\t\t\t\t\treturn true \n\t\t\t\tend\n\t\t\t\ti -= 1\n\t\t\t\tj -= 1\n\t\t\tend \n\t\tend \n\n\t\t\t# flips any opponent discs diagonal down left (southwest)\n\t\t\tr = row + 1\n\t\t\tc = col - 1\n\t\t\twhile r < @size && c >= 0 && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\t\tr += 1\n\t\t\t\t\tc -= 1\n\t\t\tend\n\n\t\t\tif r < @size && c >= 0 && @board[r][c] == disc\n\t\t\t\ti = row + 1\n\t\t\t\tj = col - 1\n\t\t\t\twhile i < r && j > c \n\t\t\t\t\tif @board[i+1][j-1] == disc\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\tend \n\t\t\t\t\ti += 1\n\t\t\t\t\tj -= 1\n\t\t\t\tend \n\t\t\tend \n\n\t\t\t# flips any opponent discs diagonal down right\n\t\t\tr = row + 1\n\t\t\tc = col + 1\n\t\t\twhile r < @size && c < @size && @board[r][c] != EMPTY && @board[r][c] != disc do \n\t\t\t\t\tr += 1\n\t\t\t\t\tc += 1\n\t\t\tend \n\n\t\t\tif r < @size && c < @size && @board[r][c] == disc\n\t\t\t\ti = row + 1\n\t\t\t\tj = col + 1\n\t\t\t\twhile i < r && j < c\n\t\t\t\t\tif @board[i+1][j+1] == disc\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend \n\t\t\t\t\ti += 1\n\t\t\t\t\tj += 1\n\t\t\t\tend \n\t\t\tend \n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false\t# if control reaches this point, then it's not a valid move\n\tend",
"def full?\n\t\t@board.all? { |e|\n\t\t\te == \"X\" || e == \"O\"\n\t\t}\n\tend",
"def valid_move?(board, index)\r\n index.between?(0,8) && !position_taken?(board, index)\r\nend",
"def valid_move? (board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\r\n index.between?(0, 8) && !position_taken(board, index) ? true : false \r\nend",
"def full?\n @board.all? {|value| value == \"X\" || value ==\"O\"}\n end",
"def valid?(move)\n @board.valid_move?(move)\n end",
"def full?\n @board.all?{|occupied| occupied != \" \"}\n end",
"def has_possible_moves\n \t\t@mowers.each do |mower|\n \t\t\treturn true if mower.can_move? && !mower.is_going_outside?(lawn_x, lawn_y)\n\t \tend\n \t\treturn false\n \tend",
"def move_available?\n total_available_moves > 0\n end",
"def valid_moves\n @pad.cells.select { |c| self.can_move?(*c.pos) }\n end",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index) #if the position isn't taken and is on the board, the move must be valid\nend",
"def board_full?(brd)\n empty_squares(brd).empty?\nend",
"def board_full?(brd)\n empty_squares(brd).empty?\nend",
"def board_full?\n @board.flatten.all?\n @turn == 9 \n end",
"def valid_move(start, stop, board)\r\n if start[0] == stop[0] && start[1] != stop[1]\r\n path = calculate_path(start, stop)\r\n path.each_with_index do |pair, i|\r\n return false if !board[pair[0]][pair[1]].nil? && i != path.size - 1\r\n end\r\n return true\r\n end\r\n if start[1] == stop[1] && start[0] != stop[0]\r\n path = calculate_path(start, stop)\r\n path.each_with_index do |pair, i|\r\n return false if !board[pair[0]][pair[1]].nil? && i != path.size - 1\r\n end\r\n return true\r\n end\r\n return false\r\n end",
"def game_over?\n @board.pieces['black'].empty? || @board.pieces['white'].empty? || (@board.moves(HUMAN_PLAYER).empty? && @board.moves(CPU_PLAYER).empty?)\n end",
"def full?(board)\n # indices = [0, 1, 2, 3, 4, 5, 6, 7, 8]\n # if indices.all? {|position| position_taken?(board, position, \"X\") || position_taken?(board, position, \"O\")}\n # return true\n # elsif board.include?(\" \")\n # return false\n if board.include?(\" \" || \"\" || nil)\n return false\n else\n return true\n end\nend",
"def valid_move? (board, index)\n if position_taken?(board,index) != false || !(index.between?(0,8))\n return false\n elsif position_taken?(board,index) == false && index.between?(0,8)\n return true\n end\nend",
"def valid_move? (board, index)\n if index.between?(0, 8) && !position_taken?(board, index)\n true \n end \nend",
"def full?(board)\n board.each do |space|\n if space == \"X\" || space == \"O\"\n else\n return false\n end\n end\n true\nend",
"def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(number_entered, board)\n number_entered.between?(0, 8) && !(position_taken?(board, number_entered))\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def isValidMoveAvailableForDisc(disc)\n #\n # TO DO: add your code below\n #\n for i in 0...@size\n for j in 0...@size\n if (isValidMoveForDisc(i,j,disc))\n return true\n end\n\n end\n end\n \n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn false;\n\tend",
"def valid_move?(board, i)\n if i.between?(0,8) && !position_taken?(board, i)\n true\n end\n end",
"def valid_move? (board, position)\n position = position.to_i - 1\n (position.between?(0,8)) && (position_taken?(board, position) == false)\nend",
"def invalid_move?(pos, board)\n if pos.nil?\n false\n elsif pos.any? {|x| x < 0 || x > 7}\n true \n elsif !board[pos].is_a?(NullPiece)\n true \n else\n false \n end\n end",
"def valid_move?(board, index)\n if index.between?(0, 8) && (position_taken?(board, index) == false)\n true\n elsif (index.between?(0,8) == false) || (position_taken?(board, index) == true)\n false\n end\nend",
"def full?\n @board.all? do |location| \n location == \"X\" || location == \"O\"\n end\n end",
"def valid_move? (board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n true\n end\nend",
"def full?(board)\n if !(won?(board))\n board.each do |e|\n if (e != \"X\" && e != \"O\")\n return false\n end\n end\n end\n return true\nend",
"def full\n @moves.length >= 12\n end",
"def full?\n @board.all? {|i| i == \"X\" || i == \"O\"}\n end",
"def valid_move?(board, index)\n return index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n !(position_taken?(board,index)) && index.between?(0, 8)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board,index)\nend",
"def can_move?(end_pos)\n return false if end_pos == self.pos\n return false unless on_board?(end_pos)\n return false unless self.pos.vertical_to?(end_pos) || self.pos.horizontal_to?(end_pos)\n return false if own_piece?(@board[end_pos])\n all_moves = self.pos.to(end_pos)\n return false if all_moves.empty?\n return false unless not_blocked?(all_moves)\n return false unless (self.pos - end_pos) != nil && (self.pos - end_pos).two_norm_square == 2\n return false if is_square_in_check?(end_pos, @@opponent_color[self.color])\n return true\n end",
"def valid_move?(board, position)\n position = position.to_i - 1\n if position.between?(0, 8) && !position_taken?(board, position)\n true\n end\nend",
"def valid_move?(board, index)\n !position_taken?(board, index) && index.between?(0, 8)\nend"
] |
[
"0.8122413",
"0.8038092",
"0.79418665",
"0.79418665",
"0.7899868",
"0.7865162",
"0.77940035",
"0.77940035",
"0.7751973",
"0.7735239",
"0.7733963",
"0.7708545",
"0.7695681",
"0.7616508",
"0.7592034",
"0.757207",
"0.7547722",
"0.7543782",
"0.7538912",
"0.7522495",
"0.7521987",
"0.7494118",
"0.7493183",
"0.7486188",
"0.7478667",
"0.7477548",
"0.7467893",
"0.7454467",
"0.7448716",
"0.7440804",
"0.7439535",
"0.7439535",
"0.7437395",
"0.7417665",
"0.7415881",
"0.7415466",
"0.74146616",
"0.74114573",
"0.7405628",
"0.7404147",
"0.74012536",
"0.74012536",
"0.7395433",
"0.73948514",
"0.73925924",
"0.73913807",
"0.7380935",
"0.7377499",
"0.7367228",
"0.7359738",
"0.7359501",
"0.73581165",
"0.735037",
"0.7344993",
"0.7339843",
"0.7338668",
"0.73346925",
"0.73340887",
"0.7333486",
"0.7333486",
"0.73333144",
"0.7330446",
"0.73252565",
"0.7323356",
"0.73226416",
"0.73166615",
"0.731589",
"0.7313161",
"0.7313161",
"0.7313161",
"0.7312304",
"0.73079956",
"0.73079956",
"0.73079956",
"0.73079956",
"0.73079956",
"0.73079956",
"0.73079956",
"0.73079956",
"0.73079956",
"0.73079956",
"0.73079956",
"0.73079956",
"0.73079956",
"0.730758",
"0.73066205",
"0.73053175",
"0.730482",
"0.7304553",
"0.7303684",
"0.7302714",
"0.7301456",
"0.7297087",
"0.7295802",
"0.72949773",
"0.7293968",
"0.72832125",
"0.7279363",
"0.72788286",
"0.72742885"
] |
0.7407721
|
38
|
If there is a winner, it returns Othello::WHITE or Othello::BLACK. In case of a tie, it returns Othello::TIE
|
def checkWinner()
# TO DO: COMPLETE THIS METHOD
bCounter = 0
wCounter = 0
for i in 0..@size-1
for j in 0..@size-1
if @board[i][j] == "B"
bCounter = bCounter + 1
end
if @board[i][j] == "W"
wCounter = wCounter + 1
end
end
end
if wCounter > bCounter
return WHITE;
end
if bCounter > wCounter
return BLACK
end
if bCounter == wCounter
return TIE
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def winner\n if type == :basic\n basic_winner\n elsif type == :war\n war_winner\n elsif type == :mutally_assured_destruction\n \"No Winner\"\n end\n end",
"def loser\n return winner == :player_a ? :player_b : :player_a\n end",
"def winner\n won = won?()\n if won != false\n if @board[won[0]] == \"X\"\n return \"X\"\n elsif @board[won[0]] == \"O\"\n return \"O\"\n end\n else\n return nil\n end\n end",
"def winner\n store_person = winner_function\n store_combo = won?\n if store_combo == false\n return nil\n elsif store_person == \"X\"\n return \"X\"\n elsif store_person == \"O\"\n return \"O\"\n else\n return false\n end\n end",
"def winner\n triplet = won?\n if !!triplet\n return @board[triplet[0]]\n end\n return nil\n end",
"def winner_color\n [[:w, :b], [:b, :w]].each do |color, o_color|\n return color if pieces_by_color(o_color).empty?\n end\n nil\n end",
"def winner\n (rows + cols + diagonals).each do |triple|\n return :x if triple == [:x, :x, :x]\n return :o if triple == [:o, :o, :o]\n end\n \n nil\n end",
"def winner\n horizontal_winner || vertical_winner || diagonal_winner\n end",
"def winner()\n if won?()\n win = won?()\n if @board[win[0]] == \"X\"\n return \"X\"\n elsif @board[win[0]] == \"O\"\n return \"O\"\n else @board[win[0]] != \"X\" && @board[win[0]] != \"O\" #srsly..this is like ducttape over a huge hole\n return nil\n end\n end\nend",
"def winner\n win_hash = { basic: basic_winner,\n war: war_winner,\n mutually_assured_destruction: \"No Winner\"\n }\n win_hash[type]\n end",
"def winner\n winner=winner_row()\n if winner\n return winner\n end\n\n winner=winner_col()\n if winner\n return winner\n end\n \n winner=winner_daigonal()\n if winner \n return winner\n end\n\n # if no winner \n return \n end",
"def winner\n WIN_COMBINATIONS.detect do |win_combo|\n if (@board[win_combo[0]]) == \"X\" && (@board[win_combo[1]]) == \"X\" && (@board[win_combo[2]]) == \"X\"\n return \"X\"\n elsif (@board[win_combo[0]]) == \"O\" && (@board[win_combo[1]]) == \"O\" && (@board[win_combo[2]]) == \"O\"\n return \"O\"\n else\n nil\n end\n end\n end",
"def determine_winner\n result = @data[\"game_tags\"][\"Result\"]\n whites_result = result.split(\"-\")\n if whites_result == \"1\"\n \"White Wins!\"\n elsif whites_result == \"1/2\"\n \"It's a draw!\"\n else\n \"Black Wins!\"\n end\n end",
"def winner\n return WHITEMAN unless board.has?(BLACKMAN)\n return BLACKMAN unless board.has?(WHITEMAN)\n return nil\n end",
"def winner(board)\n if won?(board) && board[won?(board)[0]] == \"X\"\n return \"X\"\n elsif won?(board) && board[won?(board)[0]] == \"O\"\n return \"O\"\n end\nend",
"def winner\n index = won?\n if index && @board.cells[index[0]] == \"X\"\n return \"X\"\n elsif index && @board.cells[index[0]] == \"O\"\n return \"O\"\n else\n return nil\n end\n end",
"def winner(board)\n wincombo = won?(board)\n if wincombo === nil\n return nil\n elsif board[wincombo[0]] == \"X\"\n return \"X\"\n elsif board[wincombo[0]] == \"O\"\n return \"O\"\n end\nend",
"def winner\n WIN_COMBINATIONS.detect do |win_combo|\n if (@board[win_combo[0]]) == \"X\" && (@board[win_combo[1]]) == \"X\" && (@board[win_combo[2]]) == \"X\"\n return \"X\"\n elsif (@board[win_combo[0]]) == \"O\" && (@board[win_combo[1]]) == \"O\" && (@board[win_combo[2]]) == \"O\"\n return \"O\"\n else\n nil\n end\n end\n end",
"def winner\n if won?\n winner = won?\n return @board[winner[0]]\n else\n return nil\n end\n end",
"def get_symbole_winner \n return CASE_SYMBOL_1 if @victory1\n return CASE_SYMBOL_2 if @victory2\n return CASE_DEFAULT \n end",
"def winner(board)\n if !(won?(board))\n return nil\n elsif won?(board).all?{|element| board[element] == \"X\"}\n return \"X\"\n elsif won?(board).all?{|element| board[element] == \"O\"}\n return \"O\"\n end\nend",
"def p_winner(tictactoe)\n return \"Player 1\" if tictactoe.winner?(p1_moves(tictactoe))\n return \"Player 2\" if tictactoe.winner?(p2_moves(tictactoe))\n return \"Draw\" if tictactoe.draw?(p1_moves(tictactoe),p2_moves(tictactoe))\n end",
"def winner(board)\n win = won?(board)\n if (!win)\n return nil\n elsif (board[win[0]] == \"O\")\n return \"O\"\n else\n return \"X\"\n end\nend",
"def winner\n case\n when in_checkmate?(1)\n 2\n when in_checkmate?(2)\n 1\n else\n nil\n end\n end",
"def winner\n if (self.homeScore > self.awayScore)\n return self.home_team\n elsif (self.awayScore > self.homeScore)\n return self.away_team\n else\n return nil\n end\n end",
"def winner \n if won? \n turn_count.even? ? \"O\" : \"X\"\n end \n end",
"def winner\n win_combination = won?\n if win_combination == false\n nil\n elsif @board.cells[win_combination[0]] == \"X\"\n return \"X\"\n elsif @board.cells[win_combination[0]] == \"O\"\n return \"O\"\n end\n end",
"def winning_team\n blue_team.winner? ? blue_team : red_team\n end",
"def winner(board)\n if (over?(board))\n if (board[won?(board)[0]] == \"X\")\n return \"X\"\n else\n return \"O\"\n end\n else\n end\n end",
"def winner\n return @board[won?[0]] if won?\n end",
"def winner\n if type == :basic\n if get_rank(@player1, 0) > get_rank(@player2, 0)\n @player1\n else\n @player2\n end\n elsif type == :war\n if get_rank(@player1, 2) > get_rank(@player2, 2)\n @player1\n else\n @player2\n end\n elsif type == :mutually_assured_destruction\n 'No Winner'\n end\n end",
"def winner\n\n if type == :basic\n if @player_1.deck.cards[0].rank > @player_2.deck.cards[0].rank\n return @player_1\n else\n return @player_2\n end\n elsif type == :mutually_assured_destruction\n return \"No winner.\"\n elsif type == :war\n if @player_1.deck.cards[2].rank > @player_2.deck.cards[2].rank\n return @player_1\n else\n return @player_2\n end\n end\n end",
"def winner\n if won?\n return @board[ won?[0] ]\n else\n return nil\n end\n end",
"def winner\n won = \"\"\n if winner = won?\n won = @board[winner.first]\n end\n end",
"def player_or_computer(board, winner)\n return nil if board[winner] == BLANK_SQUARE\n if board[winner] == PLAYER_PIECE\n return 'You win!'\n else\n return 'Computer wins!'\n end\nend",
"def winner\n return nil if player_one_move == player_two_move\n winning_combinations = { 'rock' => 'scissors', 'scissors' => 'paper', 'paper' => 'rock' }\n {\n true => player_one,\n false => player_two,\n }[winning_combinations[player_one_move] == player_two_move]\n end",
"def winner(player, comp)\n return 'tie' if player == comp\n if player == 'rock'\n comp == 'scissors' ? 'player' : 'comp'\n elsif player == 'paper'\n comp == 'rock' ? 'player' : 'comp'\n else # player = scissors\n comp == 'rock' ? 'comp' : 'player'\n end\nend",
"def winner\n if won? == false\n return nil\n end\n\n a = won?\n\n if @board[a[0]] == \"X\"\n return \"X\"\n else \n return \"O\"\n end\nend",
"def winner\n win_combo = won?\n if win_combo\n @board[win_combo[0]] # == 'X' || 'O'\n else\n nil\n end\n end",
"def winner(board)\n triplet = won?(board)\n if !!triplet\n return board[triplet[0]]\n end\n return nil\nend",
"def winner(board)\n triplet = won?(board)\n if !!triplet\n return board[triplet[0]]\n end\n return nil\nend",
"def calculate_winner\n self.winner = case human.move <=> computer.move\n when 1\n human\n when -1\n computer\n when 0\n 'tie'\n end\n end",
"def winner(board)\n winner = won?(board)\n return won?(board) == false ? nil : board[winner[0]]\nend",
"def player_or_computer(board, winner)\n return nil if board[winner] == BLANK_SQUARE\n if board[winner] == PLAYER_PIECE\n inc_score(board, 'player')\n return 'You win!'\n else\n inc_score(board, 'computer')\n return 'Computer wins!'\n end\nend",
"def compare_winner (player_choice, computer_choice)\n case \n when player_choice == \"P\" && computer_choice == \"R\"\n return \"Player\"\n when player_choice == \"R\" && computer_choice == \"S\"\n return \"Player\"\n when player_choice == \"S\" && computer_choice == \"P\"\n return \"Player\"\n when player_choice == computer_choice\n puts \"You selected the same thing as the computer. It's a tie\"\n else\n return \"Computer\"\n end\n end",
"def winner\n (@rows + cols + diagonals).each do |row|\n return :x if row.all? { |mark| mark == :x }\n return :o if row.all? { |mark| mark == :o }\n end\n \n nil\n end",
"def winner(board)\n win_combo = won?(board)\n if win_combo\n return board[win_combo[0]]\n end\nend",
"def winner()\n if won?()\n return @board[won?()[0]]\n end\n return nil\n end",
"def winner(board)\n if !won?(board)\n return nil\n else board[won?(board)[0]]\n end\nend",
"def winner(board)\n WIN_COMBINATIONS.each do |combo|\n if board[combo[0]] == \"X\" && board[combo[1]] == \"X\" && board[combo[2]] == \"X\"\n return \"X\"\n elsif board[combo[0]] == \"O\" && board[combo[1]] == \"O\" && board[combo[2]] == \"O\"\n return \"O\"\n else\n end\n end\n return nil\nend",
"def winner(board)\n WIN_COMBINATIONS.each do |win|\n if [board[win[0]], board[win[1]], board[win[2]]] == [\"X\", \"X\", \"X\"]\n return \"X\"\n elsif [board[win[0]], board[win[1]], board[win[2]]] == [\"O\", \"O\", \"O\"]\n return \"O\"\n end\n end\n return nil\nend",
"def winner(board)\n # returns X when X won, O when O won and nill when there is no winner\n if (draw?(board) || !full?(board)) && !won?(board)\n return nil\n elsif (board[won?(board)[0]] == \"X\")\n return \"X\"\n elsif (board[won?(board)[0]] == \"O\")\n return \"O\"\n end\nend",
"def winner(board)\n won = won?(board)\n if won != false\n if board[won[0]] == \"X\"\n return \"X\"\n elsif board[won[0]] == \"O\"\n return \"O\"\n end\n else\n return nil\n end\nend",
"def winner(board)\n save = won?(board)\n if save == false\n return nil\n end\n if board[save[0]] == \"X\"\n return \"X\"\n elsif board[save[0]] == \"O\"\n return \"O\"\n end\n end",
"def winner(board)\n return board[won?(board)[0]] if won?(board)\nend",
"def winner(board)\n if won?(board)\n winner = won?(board)\n return board[winner[0]]\n else\n return nil\n end\nend",
"def winner(board)\n winning_combo = won?(board)\n if winning_combo\n return board[winning_combo[0]]\n end\nend",
"def winner(board)\n if won?(board) != nil\n board[won?(board)[0]]\n else\n end\nend",
"def winner(board)\n if won?(board) != nil\n board[won?(board)[0]]\n else\n end\nend",
"def winner\n if !won?\n nil\n else winner = @board[won?[0]]\n\n end\n\n end",
"def winner(board)\n if win_combo = won?(board)\n board[win_combo.first]\n else\n nil\n end\nend",
"def winner \n @board[won?[0]] if won?\n end",
"def winner\n if won?\n @board[won?[0]]\n end\n end",
"def winner\n if won? != false && won? != nil\n win = won?\n return @board[win[0]]\n else\n return nil\n end\n end",
"def winner\n (score1 > score2 ? 1 : 2) if won?\n end",
"def winner\r\n if self.won? != false\r\n if self.current_player == \"X\"\r\n return \"O\"\r\n else\r\n return \"X\"\r\n end\r\n end\r\n end",
"def winner(board)\n if won?(board)\n return board[won?(board)[0]]\n end\nend",
"def winner(board)\n if won?(board) then return board[won?(board)[0]]\n end\nend",
"def winner\n if winning_combo = won?\n @board[winning_combo.first]\n end\n end",
"def winner\n big_p = 1\n \n marks = self.unrolled\n @@All_Runs.each do |run|\n #p = product of all the slots\n p = run.map {|i| marks[i]}.inject(:*)\n return :x if p == 8\n return :o if p == 1\n big_p *= p\n end\n \n return (big_p == 0) ? nil : :cat\n end",
"def winner(board)\n won?(board) ? board[won?(board)[0]] : nil\nend",
"def winner(board)\n if winning_combo = won?(board)\n board[winning_combo.first]\n end\nend",
"def winner\n\n # Check every row\n winner = winner_rows()\n\n # Winner?\n if winner\n\n # Yes, the game is over\n return winner\n\n end\n\n # No row winner, so check every column\n winner = winner_columns()\n\n # Winner?\n if winner\n\n # Yes, the game is over\n return winner\n\n end\n\n # No row or column winner, so check every diagonal\n winner = winner_diagonals()\n\n # Winner?\n if winner\n\n # Yes, the game is over\n return winner\n\n end\n\n # Otherwise, no winner\n return\n\n end",
"def winner\n count1, count2 = @cups[6].count, @cups[13].count\n if count1 > count2\n @name1\n elsif count2 > count1\n @name2\n else\n :draw\n end\n end",
"def determine_winner\n \tif self.won?(@player_symbol) then\n \t\t@over = true\n \treturn \"Player\" \n \tend\n \tif self.won?(@computer_symbol) then\n \t\t@over = true\n \t return \"Computer\" \n \tend\n \tif self.open_spots.count == 0 then\n \t\t@over = true\n \t\treturn \"Draw\"\n \tend\n return \"\" \n end",
"def winner\n match = horizontal_match || vertical_match || diagonal_match\n match ? @last_drop[:piece] : nil\n end",
"def winner_of_game(p1, p2)\n if @rules[p1.move] == p2.move\n @winner = p1.name\n p1.score += 1\n elsif @rules[p2.move] == p1.move\n @winner = p2.name\n p2.score += 1\n else\n @winner = \"Tie\"\n end\n @winner\n end",
"def winner\n if won?\n @board[won?[0]]\n end\n end",
"def winner(board)\n if won?(board)\n board[won?(board)[0]]\n end\nend",
"def winner(board)\n \n if (won?(board) == FALSE)\n return NIL\n end\n \n winning_combination = won?(board)\n win_player = board[winning_combination[0]]\n \n if (win_player == \"X\")\n return \"X\"\n else \n return \"O\"\n end\nend",
"def winner(board)\n\n if won?(board) != nil\n winner_arr_firstindex = won?(board)[0]\n if board[winner_arr_firstindex] == \"X\"\n return \"X\"\n elsif board[winner_arr_firstindex] == \"O\"\n return \"O\"\n end\n end\n\nend",
"def winner(board)\n the_winner = won?(board)\n if the_winner\n board[the_winner[0]]\n else\n return nil\n end\nend",
"def determine_winner_one_game\n if @weapon_p1 == \"r\" && @weapon_p2 == \"s\"\n return 1 \n elsif @weapon_p1 == \"s\" && @weapon_p2 == \"p\"\n return 1 \n elsif @weapon_p1 == \"p\" && @weapon_p2 == \"r\" \n return 1 \n \n elsif @weapon_p1 == \"p\" && @weapon_p2 == \"s\"\n return 2\n elsif @weapon_p1 == \"r\" && @weapon_p2 == \"p\"\n return 2\n elsif @weapon_p1 == \"s\" && @weapon_p2 == \"r\"\n return 2 \n\n else\n return nil\n end \n end",
"def winner(board)\n if !won?(board) == false\n board[won?(board).first]\n end\nend",
"def winner\n [\n [[0,0],[0,1],[0,2]], # column 0\n [[1,0],[1,1],[1,2]], # column 1\n [[2,0],[2,1],[2,2]], # column 2\n [[0,0],[1,0],[2,0]], # row 0\n [[0,1],[1,1],[2,1]], # row 1\n [[0,2],[1,2],[2,2]], # row 2\n [[0,0],[1,1],[2,2]], # descending diagonal\n [[0,2],[1,1],[2,0]], # ascending diagonal\n ].each do |cells|\n vals = cells.map {|x, y| board[y][x] }\n return :x if vals == %w( X X X )\n return :o if vals == %w( O O O )\n end \n return nil\n end",
"def winner(board)\n if winner_array = won?(board)\n return board[winner_array[0]]\n else\n return nil\n end\nend",
"def winner(board)\n if combination = won?(board)\n board[combination.first]\n end\nend",
"def winner\n\t\tbest_for_1 = best_hand(@hand1)\n\t\tbest_for_2 = best_hand(@hand2)\n\t\tcase best_for_1[:rank] <=> best_for_2[:rank]\n\t\t\twhen -1 then 2\n\t\t\twhen 1 then 1\n\t\t\twhen 0 then check_kicker(best_for_1, best_for_2)\n\t\tend\n\tend",
"def winner(board)\n if won?(board) != false\n return board[won?(board)[0]]\n end\nend",
"def check_for_winner\n winning_spaces_filled = WINNING_SPACES.map {|space| @active_spaces[space[0]] + @active_spaces[space[1]] + @active_spaces[space[2]]}\n if winning_spaces_filled.include?(\"OOO\")\n \"Computer\"\n elsif winning_spaces_filled.include?(\"XXX\")\n \"Player\"\n end\n end",
"def winner(board)\n if win_combo = won?(board)\n board[win_combo.first]\n end\nend",
"def winner(board)\r\n won?(board)\r\n if won?(board)\r\n board[won?(board)[0]]\r\n end\r\nend",
"def determineWinner\n if @botChoice == @playerChoice\n puts \"It's a tie! Redo round:\"\n elsif (@playerChoice == \"paper\" and @botChoice == \"rock\") or \\\n (@playerChoice == \"scissors\" and @botChoice == \"paper\") or \\\n (@playerChoice == \"rock\" and @botChoice == \"scissors\")\n @roundsWon += 1\n @roundsLeft -= 1\n puts \"You won this round! Rounds Won: #{@roundsWon}. Rounds Lost: #{@roundsLost}\"\n else\n @roundsLost += 1\n @roundsLeft -= 1\n puts \"You lost this round... Rounds Won: #{@roundsWon}. Rounds Lost: #{@roundsLost}\"\n end\n end",
"def winner\n if won = won?\n board.cells[won.first]\n end\n #won? == false ? nil : @board.cells[winner[0]];\n end",
"def print_winner\n if @winner == :c\n return \"Sorry, cat game.\"\n else\n if @player1.mark == @winner\n return \"Congratulations! \" + @player1.name + \" wins!\"\n elsif @player2.mark == @winner and @player2.type == 'human'\n return \"Congratulations! \" + @player2.name + \" wins!\"\n elsif @player2.mark == @winner and @player2.type == 'computer'\n #1 player, 'O' won. Do not congratulate player on computer victory.\n return \"Sorry, \" + player2.name + \" wins.\"\n end\n end\n end",
"def winner\n return self.player_a_pyre_end_health <= 0 ? :player_b : :player_a\n end",
"def winner(board)\n if won?(board).class == Array\n won?(board).each do |winner|\n if board[winner[0]] == \"X\" || board[winner[0]] == \"O\"\n return board[winner[0]]\n end\n end\n end\nend",
"def winner(board)\n # index = won?(board).pop\n if won?(board) == nil\n nil\n elsif board[won?(board)[0]] == \"X\"\n \"X\"\n elsif board[won?(board)[0]] == \"O\"\n \"O\"\n end\nend",
"def winner(board)\n #setting the index of the win into a variable, win\n win = won?(board)\n #now returning nil if there is no winner\n if won?(board) == false\n return nil\n #all indexes should have the same token for a win, so we're only checking the first\n elsif board[win[0]] == \"X\" && won?(board) != false\n return \"X\"\n elsif board[win[0]] == \"O\" && won?(board) != false\n return \"O\"\n end\nend",
"def winner\n tie_string = \"\"\n @players.each do |player|\n if @position[player] == @length\n tie_string << \"#{player}\"\n end\n end\n\n if tie_string.length > 1\n return \"no one\"\n else\n return tie_string[0]\n end\n\n end",
"def toto1x2\n ## note: will return string e.g. 1-X-2 (winner will return int e.g. 1-0-2)\n \n ## fix: use switch/when expr/stmt instead of ifs\n value = winner90 # 1 0 2 1 => team 1 0 => draw 2 => team\n if value == 0\n 'X'\n elsif value == 1\n '1'\n elsif value == 2\n '2'\n elsif value == -1\n nil # ??? - unknown -- include --??? why? why not??\n else\n nil\n end\n end"
] |
[
"0.7752766",
"0.7526196",
"0.74279565",
"0.7403889",
"0.74030495",
"0.7380257",
"0.73765326",
"0.7353286",
"0.73485935",
"0.73174196",
"0.7286403",
"0.7229853",
"0.7227314",
"0.72198904",
"0.72132814",
"0.7209583",
"0.72057503",
"0.7202321",
"0.7193683",
"0.71885407",
"0.7186616",
"0.71817946",
"0.71770805",
"0.7149836",
"0.71484196",
"0.71436316",
"0.71392757",
"0.71391666",
"0.7125535",
"0.71116287",
"0.71052635",
"0.70940363",
"0.7090628",
"0.70859253",
"0.7083561",
"0.70767164",
"0.7072835",
"0.70720047",
"0.70708925",
"0.7067164",
"0.7067164",
"0.706519",
"0.70532644",
"0.70529646",
"0.7052685",
"0.7051391",
"0.7047821",
"0.704772",
"0.7046005",
"0.7041027",
"0.7039055",
"0.70359826",
"0.7029995",
"0.7025795",
"0.70196337",
"0.7015238",
"0.7013863",
"0.6998948",
"0.6998948",
"0.6996171",
"0.6996111",
"0.69871366",
"0.6983347",
"0.6975538",
"0.69746464",
"0.6956889",
"0.69555545",
"0.6951155",
"0.69492024",
"0.6934135",
"0.6925967",
"0.691085",
"0.6910117",
"0.6905819",
"0.6902592",
"0.6899423",
"0.6892762",
"0.6883",
"0.68750006",
"0.6873087",
"0.6861039",
"0.6860946",
"0.68579876",
"0.68568015",
"0.6856773",
"0.6855116",
"0.68474853",
"0.68464226",
"0.6844521",
"0.68408334",
"0.68407255",
"0.6831755",
"0.6823392",
"0.6822818",
"0.6822666",
"0.6821468",
"0.6818142",
"0.6817838",
"0.68155",
"0.6813416",
"0.6809114"
] |
0.0
|
-1
|
Returns a string representation of the board
|
def to_s()
str = "\n "
for i in (0...@size)
str << (i+1).to_s + ' '
end
str << "\n";
for i in (0...@size)
str << (i+1).to_s + ' ';
str << @board[i].join(' ') + "\n";
end
return str;
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_s\n @board.map { |row| row.join (' ') }.join(\"\\n\")\n end",
"def to_s\n @board_array.flatten.join(\"\")\n end",
"def to_s()\n\t\t@board.to_s\n\tend",
"def to_s\n string_board = \"\"\n @board.each do |row|\n row.each do |square|\n string_board << \" #{square.number} \"\n end\n string_board << \"\\n\"\n end\n string_board\n end",
"def to_s\n \" | | \\n\" + \n \" #{self.board[0]} | #{self.board[1]} | #{self.board[2]} \\n\" +\n \" _ _ _|_ _ _|_ _ _\\n\" +\n \" | | \\n\" + \n \" #{self.board[3]} | #{self.board[4]} | #{self.board[5]} \\n\" +\n \" _ _ _|_ _ _|_ _ _\\n\" +\n \" | | \\n\" +\n \" #{self.board[6]} | #{self.board[7]} | #{self.board[8]} \\n\" +\n \" | | \\n\" \n end",
"def to_s\n board_as_string = \"\"\n board.each do |row|\n board_as_string += row.join(\"\")\n end\n return board_as_string\n end",
"def board_string\n\t\toutput_string = ''\n\t\t@game_board.each do |x|\n\t\t\tx.each do |y|\n\t\t\t\tif y == ''\n\t\t\t\t\ty = '-'\n\t\t\t\tend\n\t\t\t\toutput_string += y\n\t\t\tend\n\t\t\toutput_string += \"\\n\"\n\t\tend\n\t\toutput_string\n\tend",
"def to_s\n @board.each do |row|\n puts row.join(\" \")\n end \n end",
"def to_s\n board_2d.map do |row|\n row.map { |letter| '%-3s' % letter }.join(' ')\n end.join(\"\\n\")\n end",
"def to_s_canonical\r\n board.join('')\r\n end",
"def to_s\n puts \"board goes here\"\n @board.each do |row|\n puts \"#{row}\"\n end\n # see_me = \" \"\n # @board.each {|r| see_me += r + \"\\n\" }\n end",
"def to_s\n print_chess_board\n end",
"def to_s\n @board.map.with_index do |row, ridx|\n row = row.map.with_index do |num, eidx|\n element = [idx_to_num(ridx, eidx), PLAYER_1_MARKER, PLAYER_2_MARKER][num]\n element.to_s.rjust(char_length)\n end\n \" #{row.join(' | ')} \"\n end.join(print_delimiter)\n end",
"def to_s()\n\t\tstr = \"\\n \"\n\t\tfor i in (0...@size)\n\t\t\tstr << (i+1).to_s + ' '\n\t\tend\n\t\tstr << \"\\n\";\n\t\tfor i in (0...@size)\n\t\t\tstr << (i+1).to_s + ' ';\n\t\t\tstr << @board[i].join(' ') + \"\\n\";\n\t\tend\n\t\treturn str;\n\tend",
"def to_s()\n\t\tstr = \"\\n \"\n\t\tfor i in (0...@size)\n\t\t\tstr << (i+1).to_s + ' '\n\t\tend\n\t\tstr << \"\\n\";\n\t\tfor i in (0...@size)\n\t\t\tstr << (i+1).to_s + ' ';\n\t\t\tstr << @board[i].join(' ') + \"\\n\";\n\t\tend\n\t\treturn str;\n\tend",
"def to_s\n @board.reduce(\"\") do |string, row|\n string_row = row.join(\" \").sub(/Q /, \"Qu\")\n string + string_row + \"\\n\"\n end\n end",
"def to_s\n board_string = []\n row = 0\n for i in 0..8 do\n board_string << @board[row..row + 8] + \"\\n\"\n row += 9\n end\n board_string.join\n end",
"def board\n @board_horizontal.flatten.join(\"\")\n end",
"def board_to_string(board)\n board\nend",
"def to_s\n board = \"\\n\"\n background = [248,250,210]\n @state.reverse.each_with_index do |row, i|\n board += \"#{(8 - i)} \"\n row.each do |square|\n if square == nil\n board += Paint[\" \", nil, background]\n else\n board += Paint[\" #{square.symbol} \", nil, background]\n end\n background = switch_background(background)\n end\n board += \"\\n\"\n background = switch_background(background)\n end\n board += \" a b c d e f g h \"\n end",
"def to_s\n print_board = ''\n sudoku_board = @board.each { |row| print_board += row.join('') + \"\\n\" }\n print_board\n end",
"def outboard\n out = \"\"\n (0...@board.length).each do |i|\n out += @board[i].map {|b| b == 1 ? \" X \" : \" \"}.join(\"\") + \"\\n\"\n end\n out\n end",
"def board\n result_string = ''\n @board.each_slice(9) do |row_to_print|\n result_string << \"\\n\"\n row_to_print.each do |cell_value|\n result_string << \" #{cell_value.value} \"\n end\n end\n result_string\n end",
"def to_s\n # @board.each_char.with_index do |char|\n # p \"#{char} \"\n # p \"\\n\" if\n string = \"\"\n (0..8).each do |row|\n @board.slice(row*9,9).each_char {|char| string << \"#{char} \"}\n string << \"\\n\"\n end\n\n return string\n\n end",
"def to_s\n for i in 0..@max_row - 1\n for j in 0..@max_column - 1\n print \"| \" + @board[i][j] + \" \"\n end\n\n puts \"|\"\n end\n end",
"def to_s\n ret_str = \"\"\n @gameboard.each do |row| \n row.each do |unit|\n ret_str.concat(\"[\" + unit.join(',') + \"]\") \n end \n ret_str.concat(\"\\n\")\n end \n return ret_str\n end",
"def to_s\n # create a checkboard which is a hash\n # {[0, 0]=>\"O\", [0, 1]=>\"O\", [0, 2]=>\"O\", ... [7, 6]=>\"O\", [7, 7]=>\"O\"}\n board = Hash[(0..7).to_a.product((0..7).to_a).map {|key| [key, 'O']}]\n \n board[@white] = 'W'\n board[@black] = 'B'\n line = \"\"\n\n # [7, 7] => \"O\" \n # key is an array, value is \"0\"\n board.each do |key, val|\n if key == [7, 7]\n line += val \n elsif key[1] == 7\n line += val + \"\\n\" \n else\n line += val + \" \"\n end \n end \n line\n end",
"def board\n string = \"\"\n @array.each do |element|\n if (1..9).include?(element)\n string << element.to_s\n else\n string << \"-\"\n end\n end\n string\n end",
"def display_board\n display = \" a b c d e f g h \\n\"\n @board.each_with_index do |arr, i|\n line = \"#{i + 1} \"\n arr.each do |hash|\n hash[:piece].nil? ? line += \"#{hash[:base]} \" : line += \"#{hash[:piece].name} \"\n end\n line += \"\\n\"\n display += line\n end\n display\n end",
"def to_s\n pretty = @board.each_slice(9).to_a.each do |array|\n puts array\n end\n end",
"def draw\n @board.to_s\n end",
"def get_board_s\n @board.get_board_s\n end",
"def display\n puts \"#{@board.join(\" \")}\"\n end",
"def show_board\n\t\ti = 1\n\t\tgame_board_string = \"\\r\\n\"\n\t\twhile i < 10\n\t\t\tgame_board_string += @board_status[i]\n\t\t\tif i % 3 == 0\n\t\t\t\tgame_board_string += \"\\r\\n\"\n\t\t\tend\n\t\t\ti += 1\n\t\tend\n\t\tgame_board_string += \"\\r\\n\"\n\t\treturn game_board_string\n\tend",
"def board\n # Returns a printed copy of the board\n end",
"def to_s_pretty\r\n str = \"\"\r\n \r\n border = '+-------+-------+-------+'\r\n separator = '|'\r\n \r\n (0 .. 8).each do |row|\r\n str += (border + \"\\n\") if row % 3 == 0\r\n \r\n (0 .. 8).each do |col|\r\n str += (separator + ' ') if col % 3 == 0\r\n str += (@board[row][col].to_s + ' ')\r\n end\r\n \r\n str += (separator + \"\\n\")\r\n end\r\n \r\n str += (border + \"\\n\")\r\n str.gsub!('0', '_')\r\n return str\r\n end",
"def to_ascii\n lines = []\n cols = col_count\n min_row.upto(max_row) do |row|\n line = \"%03d:\" % row # left-padded row number\n (cols - row).times {line << ' '}\n\n min_col.upto(max_col) do |col|\n line << ' '\n line << (@board[[row,col,0]] || '.').to_s\n end\n\n lines << line\n end\n\n lines.join \"\\n\"\n end",
"def game_board_string(id)\n gs = game_state(id)\n result = ''\n (gs.rows - 1).downto(0) { |i|\n row_matrix = gs.row i\n for j in 0..gs.columns - 1\n if row_matrix[j].nil?\n result += '-'\n else\n result += row_matrix[j].value\n end\n end\n }\n return result\n end",
"def format\n display_string = \"\"\n (0..7).each do |row|\n display_string += \"#{row}\"\n (0..7).each do |col| \n if @board[row][col].instance_of? ChessPiece\n display_string += \"[#{@board[row][col].unicode} ]\"\n elsif @board[row][col].is_a? String\n display_string += @board[row][col]\n end\n end\n display_string += \"\\n\"\n end\n\n return display_string\n end",
"def visual_board\n board.transpose\n .map { |row| row.join(\" | \") }\n .map { |row| \"#{row}\\n---+----+----+----+----+----+----\\n\" }\n .join\n end",
"def print_board\n\t\tputs \"**********************************\"\n\t\tputs \"| ♔ ♚ ♕ ♛ ♖ ♜ ♗ ♝ ♘ ♞ ♙ ♟ |\"\n\t\tputs \"| Actual board |\"\n\t\tputs \"| ♔ ♚ ♕ ♛ ♖ ♜ ♗ ♝ ♘ ♞ ♙ ♟ |\"\n\t\tputs \"**********************************\"\n\t\t@board.each_index do |i|\n\t\t\t@board[i].each_index do |y|\n\t\t\t\tif y == 0\n\t\t\t\t\tprint 8 - i\n\t\t\t\tend\n\n\t\t\t\tif @board[i][y] == nil\n\t\t\t\t\tprint \"#{@board[i][y]} --\"\n\t\t\t\telse\n\t\t\t\t\tprint \" #{@board[i][y].piecename}\"\n\t\t\t\tend\n\n\t\t\tend\n\t\t\tputs \"\\n\"\n\t\tend\n\t\tputs \" a b c d e f g h\"\n\t\tputs \"\\n\\n\\n\\n\"\n\tend",
"def to_s\n\t\t\ts = edge_row + \"\\n\"\n\t\t\t@n_rows.times do |r|\n\t\t\t\ts << \"|\"\n\t\t\t\t@n_cols.times do |c|\n\t\t\t\t\tcorrect_row_index = @n_rows - r -1 \n\t\t\t\t\t#flip board updside down for representation\n\t\t\t\t\ts << \"#{represent_entry(correct_row_index,c)} |\"\n\t\t\t\tend\n\t\t\t\ts << \"\\n\"\n\t\t\tend\n\t\t\ts << edge_row + \"\\n\"\n\t\t\ts << \" \" + (0..@n_cols -1).to_a.join(' ') + \"\\n\"\n\t\t\treturn s\n\t\tend",
"def board\n output = \"\"\n [*0..80].each do |i|\n output << @board[i].ljust(4)\n output << \"\\n\" if (i+1) % 9 == 0\n end\n output\n end",
"def view_board\n\t\t(1..8).to_a.reverse.each do |row|\n\t\t\tstr = \"\"\n\t\t\t('a'..'h').each do |col|\n\t\t\t\tif board[[row,col]] == 2\n\t\t\t\t\tstr << \" . \"\n\t\t\t\telse\n\t\t\t\t\tstr << \" #{board[[row, col]].to_s} \"\t\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tputs str\n\t\tend\n\tend",
"def get_board_state\n board_repr = []\n\n for row in @board\n board_repr.push(row.reject(&:empty?).join(''))\n end\n\n board_repr.reject(&:empty?).join(\"\\n\")\n end",
"def display_board\n str = \"\"\n 5.downto(0) do |i|\n @board.each {|row| str += row[i].to_s + \" \"}\n str += \"\\n\"\n end\n puts str\n end",
"def to_s\n result = \"--puzzle--\\n\"\n 9.times do |row|\n result << horiz_line if (row % 3).zero?\n line = @lines[row]\n 9.times do |col|\n result << '|' if column_before col\n square = line[col]\n if square.empty?\n result << '_'\n elsif square.metadata[:found]\n result << square.value.to_s.green\n else\n result << square.value.to_s\n end\n result << ' ' unless column_before(col + 1)\n result << '|' if col == 8\n end\n result << \"\\n\"\n result << horiz_line if row == 8\n end\n result\n end",
"def board\n board = create_board_array()\n board_display = []\n\n board.each { |x|\n board_display << x.join(\" \") \n }\n # puts \"\"\n # puts board_display\n return board_display\n end",
"def to_s( )\n\t\t\tboard = \" +#{'---+' * 8}\\n\"\n\t\t\twhite = false\n\t\t\t(1..8).to_a.reverse.each do |rank|\n\t\t\t\tboard << \"#{rank} | \"\n\t\t\t\tboard << (\"a\"..\"h\").map do |file|\n\t\t\t\t\twhite = !white\n\t\t\t\t\t@squares[\"#{file}#{rank}\"] || (white ? \" \" : \".\")\n\t\t\t\tend.join(\" | \")\n\t\t\t\twhite = !white\n\t\t\t\tboard << \" |\\n\"\n\t\t\t\tboard << \" +#{'---+' * 8}\\n\"\n\t\t\tend\n\t\t\tboard << \" #{('a'..'h').to_a.join(' ')}\\n\"\n\t\t\tboard\n\t\tend",
"def display_board\n\t board =\" | | \\n-----------\\n | | \\n-----------\\n | | \"\n\t puts board\n\tend",
"def format_board\n\n\t\t# formateamos la primera fila de negras\n\t\t@board[0][0] = \"bR\"\n\t\t@board[0][1] = \"bN\"\n\t\t@board[0][2] = \"bB\"\n\t\t@board[0][3] = \"bQ\"\n\t\t@board[0][4] = \"bK\"\n\t\t@board[0][5] = \"bB\"\n\t\t@board[0][6] = \"bN\"\n\t\t@board[0][7] = \"bR\"\n\n\t\t# formateamos los peones de negras\n\t\tfor column in (0..@height-1)\n\t\t\t\t@board[1][column] = \"bP\"\n\t\tend\n\n\t\t# formateamos los peones de blancas\n\t\tfor column in (0..@height-1)\n\t\t\t\t@board[6][column] = \"wP\"\n\t\tend\n\n\t\t# formateamos la primera fila de negras\n\t\t@board[7][0] = \"wR\"\n\t\t@board[7][1] = \"wN\"\n\t\t@board[7][2] = \"wB\"\n\t\t@board[7][3] = \"wQ\"\n\t\t@board[7][4] = \"wK\"\n\t\t@board[7][5] = \"wB\"\n\t\t@board[7][6] = \"wN\"\n\t\t@board[7][7] = \"wR\"\n\n\tend",
"def to_s\n board_str = \"\"\n square_index = 0\n new_line_counter = 1\n @array.each_with_index do |v, i|\n board_str << v.to_s #if (0..2).include?(i)\n if new_line_counter % 9 == 0\n board_str << \"\\n\"\n elsif new_line_counter % 3 == 0\n board_str << \" \"\n else\n board_str << \" \"\n end\n new_line_counter += 1\n end\n if @array.include?(0) == true\n board_str\n else\n self.fancy_display\n end\n end",
"def print_board\n col_numbers = [' ']\n (1..8).each do |row|\n row_items = []\n\n col_numbers << ' ' + row.to_s + ' '\n row_items << row\n \n (1..8).each do |col|\n row_items << @board[[row,col]].console_rep\n end\n\n puts row_items.join(' ')\n end\n puts col_numbers.join(' ')\n end",
"def render\n print \"\\n\"\n @board.each do |row|\n row.each do |col|\n print \"#{col.nil? ? '.' : col} \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end",
"def to_text\n text = \"\"\n @board_of_stone.each{|row|\n row.each{|stone|\n text << stone.to_s\n }\n text << \"\\n\"\n }\n return text\n end",
"def to_s\n str = \"\"\n outer_counter = 0\n\n @puzzle.each do |row|\n inner_counter = 0\n row.each do |element|\n inner_counter += 1\n element = \"_\" if element == nil\n str << element.to_s\n str << \"#\" if inner_counter % 3 == 0\n end\n outer_counter += 1\n str << \"\\n\"\n str << \"############\\n\" if outer_counter % 3 == 0\n end\n str.gsub(//,\" \")[0...-39]\n end",
"def to_s\n str = StringIO.new\n @screen.each do |row|\n line = row.map do |tile_id|\n case tile_id\n when EMPTY\n ' '\n when WALL\n '█'\n when BLOCK\n '░'\n when PADDLE\n '▓'\n when BALL\n '◯'\n else\n '.'\n end\n end\n str.write(line.join + \"\\n\")\n end\n str.string + \"#{@score}\\n\"\n end",
"def print_board\n print to_s\n # @board.each do |row|\n # row.each do |square|\n # print \" #{square.number} \"\n # end\n # puts \"\"\n # end\n end",
"def to_s\n s = \"\"\n @grid.each do |row|\n row.each do |square|\n if square.value\n s += square.value.to_s\n else\n s += '-'\n end\n end\n end\n s\n end",
"def printBoard\n\t\tprint(\"#{@field[0].value} | #{@field[1].value} | #{@field[2].value}\\n---------\\n#{@field[3].value} | #{@field[4].value} | #{@field[5].value}\\n---------\\n#{@field[6].value} | #{@field[7].value} | #{@field[8].value}\")\n\tend",
"def pretty_board(board)\n pretty_board = board.map { |rows| rows.join('').gsub(/(.{1})/, '\\1 ') }\n pretty_board.join(\"\\n\")\nend",
"def print_board\n\t\tputs \"GAME BOARD AT TIME: #{@current_turn}\"\n\t\tprint full_game_board.map{|c| c.join(\"\")}.join(\"\\n\")\n\tend",
"def to_s\n DisplayAnsiBoard.call(self)\n end",
"def display_board\n\t\tsystem \"clear\" or system \"cls\"\n\t\tprint \" 1 2 3 4 5 6 7 8 \\n\\n\"\n\t\t(0..7).each do |row|\n\t\t\tprint \"#{(row+97).chr} \"\n\t\t\t(0..7).each do |collumn|\n\t\t\t\tprint \"#{@board[row][collumn]} \" if @board[row][collumn] == \"X\"\n\t\t\t\tprint @board[row][collumn].to_s + \" \" if @board[row][collumn].is_a?(Piece)\n\t\t\tend\n\t\t\tprint \" #{(row+97).chr} \"\n\t\t\tputs\n\n\t\tend\n\t\tprint \"\\n 1 2 3 4 5 6 7 8 \\n\"\n\tend",
"def to_s\n (0..8).collect { |r|\n @grid[r*9,9].pack('c9') # TODO\n } .join(\"\\n\").tr(BIN,ASCII)\n end",
"def display_board\n\t\tputs \"\\n\\n\"\n\t\tprint \"|\\u2460 |\\u2461 |\\u2462 |\\u2463 |\\u2464 |\\u2465 |\\u2466 |\"\n\t\t@board.plastic.reverse.each do |row|\n\t\t\tprint \"\\n|\"\n\t\t\trow.each {|x| print \"#{x.to_c} |\"} \t\t\t\n\t\tend\n\t\tputs \"\"\n\tend",
"def to_s\r\n board = @board.dup.upcase\r\n (1..17).each do |idx|\r\n print board[idx-1]\r\n print \" \" unless idx == 17\r\n puts if idx % 4 == 0\r\n end\r\nend",
"def print_board\r\n\t\t@board_array.each do |char|\r\n\t\t\tprint \"#{char} \"\r\n\t\tend\r\n\t\tputs \"\"\r\n\t\t@board_array\r\n\tend",
"def display\n @board.each { |x| \n puts x.join(\" \")\n }\n end",
"def print\n pp @board.map{|r| r.map { |c| c.class.to_s }}\n end",
"def to_s\n max_size = board.flatten(1).max.join(' ').size + 1\n\n counts = flat_counts.map { |c, i|\n set = @piece_sets[c]\n \"#{c}: #{i} flats, #{set.flats} remaining pieces, #{set.capstones} remaining capstones\"\n }.join(\"\\n\")\n\n board_state = board.reverse.map.with_index { |row, i|\n row_head = \" #{size - i} \"\n\n row_head + row.map { |cell|\n \"[%#{max_size}s]\" % cell.join(' ')\n }.join(' ')\n }.join(\"\\n\")\n\n footer = ('a'..'h').take(size).map { |c| \"%#{max_size + 2}s\" % c }.join(' ')\n\n \"#{counts}\\n\\n#{board_state}\\n #{footer}\"\n end",
"def display_board\n board =\n \" _______ _______ _______\n | | | |\n A| #{@state[:A1]} | #{@state[:A2]} | #{@state[:A3]} |\n |_______|_______|_______|\n | | | |\n B| #{@state[:B1]} | #{@state[:B2]} | #{@state[:B3]} |\n |_______|_______|_______|\n | | | |\n C| #{@state[:C1]} | #{@state[:C2]} | #{@state[:C3]} |\n |_______|_______|_______|\n 1 2 3\n \"\n puts board\n end",
"def to_str\n puts (@board[:h1] + ' ' + @board[:a1] + ' ' + @board[:b1] + ' ' + @board[:c1])\n puts (@board[:h2] + ' ' + @board[:a2] + ' ' + @board[:b2] + ' ' + @board[:c2])\n puts (@board[:h3] + ' ' + @board[:a3] + ' ' + @board[:b3] + ' ' + @board[:c3])\n puts (@board[:h0] + ' ' + @board[:ha] + ' ' + @board[:hb] + ' ' + @board[:hc])\n sleep 1\n end",
"def to_s\n string = \"\"\n colors = [[:default, :light_white].cycle, [:light_white, :default].cycle].cycle\n\n 7.downto(0) do |row|\n string += \"#{row + 1} \"\n colors_cycle = colors.next\n\n 0.upto(7) do |column|\n piece = self[column, row]\n string += piece.nil? ? \" \" : piece.symbol\n string += \" \"\n string[-2..-1] = string[-2..-1].colorize(background: colors_cycle.next)\n end\n string += \"\\n\"\n end\n\n string += \" a b c d e f g h\"\n string\n end",
"def print_board\n puts \"\\n[#{@spaces[1]}][#{@spaces[2]}][#{@spaces[3]}]\\n[#{@spaces[4]}][#{@spaces[5]}][#{@spaces[6]}]\\n[#{@spaces[7]}][#{@spaces[8]}][#{@spaces[9]}]\\n\\n\"\n end",
"def board\n @board.each do |row|\n print row\n puts \"\"\n end\n end",
"def show_board(board)\n\n puts \"\n #{board[0]} | #{board[1]} | #{board[2]}\n #{board[3]} | #{board[4]} | #{board[5]}\n #{board[6]} | #{board[7]} | #{board[8]}\n \"\nend",
"def view\n @board.each { |row| puts row.join('') }\n end",
"def display_board\n puts \"#{@board[0].value} | #{@board[1].value} | #{@board[2].value}\"\n puts \"-\"*10\n puts \"#{@board[3].value} | #{@board[4].value} | #{@board[5].value}\"\n puts \"-\"*10\n puts \"#{@board[6].value} | #{@board[7].value} | #{@board[8].value}\"\n end",
"def board_display\n puts @board\n end",
"def draw_board game\n\t\t\t\tstring = ''\n\t\t\t\tprint \" \"\n\t\t\t\t0.upto(14) do |x|\n\t\t\t\t\tprint \"%5s\" % [x.to_s]\n\t\t\t\tend\n\t\t\t\tgame.board.each_with_index do |square, row, column|\n\t\t\t\t\tanti_string = square.tile\n\t\t\t\t\tanti_string ||= ' '\n\t\t\t\t\tif column == 0\n\t\t\t\t\t\tputs string\n\t\t\t\t\t\tstring = \"%-3s\" % [row.to_s]\n\t\t\t\t\tend\n\t\t\t\t\tcase square.multiplier\n\t\t\t\t\twhen 3\n\t\t\t\t\t\tif square.type == :word\n\t\t\t\t\t\t\tstring +=\"[ \".green + anti_string + \" ]\".green\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tstring +=\"[ \".blue + anti_string + \" ]\".blue\n\t\t\t\t\t\tend\n\t\t\t\t\twhen 2\n\t\t\t\t\t\tif square.type == :word\n\t\t\t\t\t\t\tstring +=\"[ \".light_red + anti_string + \" ]\".light_red\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tstring +=\"[ \".light_cyan + anti_string + \" ]\".light_cyan\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tstring += \"[ \" + anti_string + \" ]\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tputs string\n\t\t\tend",
"def to_s\n returned_str = \"\"\n @puzzle.each_with_index do |entry, i|\n returned_str += \"\\n\" if (i%9)==0\n returned_str += entry.to_s + \" \"\n end\n returned_str \n end",
"def display_board\n board = \" | | \n-----------\n | | \n-----------\n | | \"\n puts board\nend",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def to_s\n @squares.map do |row|\n row.map(&:to_s).join(\" \")\n end.join(\"\\n\")\n end",
"def display_board\n\n puts \" #{@board[0].mark} | #{@board[1].mark} | #{@board[2].mark} \"\n puts \"-----------\"\n puts \" #{@board[3].mark} | #{@board[4].mark} | #{@board[5].mark} \"\n puts \"-----------\"\n puts \" #{@board[6].mark} | #{@board[7].mark} | #{@board[8].mark} \"\n end",
"def display_board\n puts \" \" + (\"_\" * 47)\n 8.downto(1) do |l|\n puts \" \" +(\"| \" * 8 ) + \"|\"\n puts \" #{l} | \" + @board[l-1].join(\" | \") + \" |\"\n puts \" \" +(\"|_____\" * 8 ) + \"|\"\n end\n puts (\" \" * 8) + ('a'..'h').to_a.join(\" \")\n end",
"def board(empty_square_char = '.')\n board_str = \" ABCDEFGH\\n\"\n (@board.size-1).downto(0).each do |rank_index|\n line = \"#{rank_index+1} \"\n @board[rank_index].each do |cell|\n line << (cell.nil? ? empty_square_char : cell)\n end\n board_str << line+\"\\n\"\n end\n board_str\n end",
"def print_board\n puts\n @board.each_with_index do |row, index|\n print \" \"\n row.each_with_index do |element, index|\n print \" \" + element.to_s.center(3, \" \") + \" \"\n if(index < row.length - 1)\n print \"|\"\n else\n print \"\\n\"\n end\n end\n\n if(index < @board.length - 1)\n print \" \"\n row.each_with_index do |element, index|\n print \"-----\"\n if(index < row.length - 1)\n print \"+\"\n else\n print \"\\n\"\n end\n end\n end\n end\n puts\n end",
"def print_board\n\t\tputs \"\"\n\t\tputs \" 1 2 3 4 5 6 7 8\"\n\t\tputs \" |-------------------------|\"\n\t\tprint \" A ||\"\n\t\tprint_row 0\n\t\tputs \"|\"\n\t\tputs \" |-------------------------|\"\n\t\tprint \" B ||\"\n\t\tprint_row 1\n\t\tputs \"|\"\n\t\tputs \" |-------------------------|\"\n\t\tprint \" C ||\"\n\t\tprint_row 2\n\t\tputs \"|\"\n\t\tputs \" |-------------------------|\"\n\t\tprint \" D ||\"\n\t\tprint_row 3\n\t\tputs \"|\"\n\t\tputs \" |-------------------------|\"\n\t\tprint \" E ||\"\n\t\tprint_row 4\n\t\tputs \"|\"\n\t\tputs \" |-------------------------|\"\n\t\tprint \" F ||\"\n\t\tprint_row 5\n\t\tputs \"|\"\n\t\tputs \" |-------------------------|\"\n\t\tprint \" G ||\"\n\t\tprint_row 6\n\t\tputs \"|\"\n\t\tputs \" |-------------------------|\"\n\t\tprint \" H ||\"\n\t\tprint_row 7\n\t\tputs \"|\"\n\t\tputs \" |-------------------------|\\n\\n \"\n\tend",
"def pretty_board(board)\n #board.each do |num|\n # num.each { |chars| chars}.join(\" \")\n #end\n display_board = board.join(\"|\")\n puts display_board[0..17]\n puts display_board[18..35]\n puts display_board[36..53]\n puts display_board[54..71]\n puts display_board[72..89]\n puts display_board[90..107]\n puts display_board[108..125]\n puts display_board[126..143]\n puts display_board[144..161] + \"|\"\nend",
"def print\n @cell_board.each do |row|\n string_row_separator = '-'\n string_row = '|'\n row.each do |element|\n string_row += \" #{element.to_s} |\"\n string_row_separator += '----'\n end\n puts string_row\n puts string_row_separator\n end\n end",
"def to_s\n formatted = \"\"\n\n @grid.each do |x|\n formatted << x.join(\" \") + \"\\n\\n\"\n formatted.gsub!(\"u\\s\\s\\s\", \"u\\s\\s\")\n end\n\n formatted\n end",
"def display_board(board = @board)\n render_string = \"\"\n board.each_with_index do |arr, idx|\n if idx.even?\n arr.each_with_index do |elmt, index|\n if elmt.nil? == false\n render_string << \"#{elmt}\"\n elsif elmt.nil? && index.even?\n render_string << \" \"\n elsif elmt.nil? && index.odd?\n render_string << \"|\"\n end\n end\n render_string << \"\\n\"\n else\n arr.each_with_index do |elmt, index|\n if index < 2 || (index.odd? && elmt.nil? == false)\n render_string << \"#{elmt}\" \n elsif index.odd? && elmt.nil?\n render_string << \"-\"\n elsif elmt.nil? \n render_string << \"---\" \n else\n render_string << \"-#{elmt}-\"\n end\n end\n render_string << \"\\n\"\n end\n end\n puts render_string\n end",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \" ----------- \"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \" ----------- \"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def show_board\n\t\ttop_left = \"\\u250c\"\n\t\thorizontal = \"\\u2500\"\n\t\ttop_right = \"\\u2510\"\n\t\tbot_left = \"\\u2514\"\n\t\tbot_right = \"\\u2518\"\n\t\tvertical = \"\\u2502\"\n\t\tcross = \"\\u253c\"\n\t\ttop_cross = \"\\u252c\"\n\t\tbot_cross = \"\\u2534\"\n\t\tleft_vertical = \"\\u251c\"\n\t\tright_vertical = \"\\u2524\"\n\n\t\ttop_board = \" \" + top_left + (horizontal*3 + top_cross)*7 + horizontal*3 + top_right\n\t\tmid_board = vertical + (\" \" + vertical)*7 + \" \" + vertical\n\t\tseparator_board = \" \" + left_vertical + (horizontal*3 + cross)*7 + horizontal*3 + right_vertical\n\t\tbot_board = \" \" + bot_left + (horizontal*3 + bot_cross)*7 + horizontal*3 + bot_right\n\n\t\tputs \"\\n\" + top_board\n\n\t\t(2..8).reverse_each do |num|\n\t\t\tmid_test = num.to_s + vertical\n\t\t\t(\"a\"..\"h\").each do |letter|\n\t\t\t\tpair = letter + num.to_s \n\t\t\t\tmid_test += \" #{@board[pair].view} \" + vertical\n\t\t\tend\n\t\t\tputs mid_test\n\t\t\tputs separator_board\n\t\tend\n\n\t\tmid_test = 1.to_s + vertical\n\t\t(\"a\"..\"h\").each do |letter|\n\t\t\tpair = \"#{letter}1\"\n\t\t\tmid_test += \" #{@board[pair].view} \" + vertical\n\t\tend\n\n\t\tputs mid_test\n\t\tputs bot_board\n\t\tputs \" a b c d e f g h\\n\"\t\t\n\tend",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"---------------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"---------------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board()\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board()\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def render\n @board.each.with_index do |row, y|\n row.each.with_index do |item, x|\n chr = item.nil? ? \" \" : item\n print \" #{chr} \"\n print \"|\" unless x == row.size - 1\n end\n print \"\\n-----------\\n\" unless y == @board.size - 1\n end\n print \"\\n\"\n end"
] |
[
"0.87569886",
"0.8606402",
"0.85789233",
"0.8512254",
"0.8458669",
"0.8455167",
"0.84469885",
"0.8446652",
"0.8440508",
"0.8375333",
"0.8341328",
"0.83300054",
"0.8306895",
"0.8301309",
"0.8301309",
"0.82764673",
"0.82700515",
"0.8255491",
"0.8235811",
"0.8235756",
"0.81965524",
"0.8108197",
"0.8048571",
"0.8002701",
"0.79720885",
"0.79477715",
"0.7902733",
"0.7885177",
"0.7798853",
"0.77951276",
"0.77905726",
"0.7743549",
"0.768723",
"0.7663132",
"0.76456845",
"0.7644948",
"0.76381177",
"0.76338583",
"0.763359",
"0.7596182",
"0.7587854",
"0.75869554",
"0.7568252",
"0.75532305",
"0.7549161",
"0.7540479",
"0.75035214",
"0.74982184",
"0.7490884",
"0.74877644",
"0.7432242",
"0.74166733",
"0.7388436",
"0.73654646",
"0.7362879",
"0.7343191",
"0.73305863",
"0.7318196",
"0.72929305",
"0.72916275",
"0.7280714",
"0.7279126",
"0.72730947",
"0.7269209",
"0.7254978",
"0.7251702",
"0.72459817",
"0.7236191",
"0.72247165",
"0.7222379",
"0.7216999",
"0.72102463",
"0.7209483",
"0.717486",
"0.7160024",
"0.7145352",
"0.7143654",
"0.7138597",
"0.7135911",
"0.7126591",
"0.7109906",
"0.7100344",
"0.7099236",
"0.70929694",
"0.70885044",
"0.70724213",
"0.7064679",
"0.70556474",
"0.7048325",
"0.70446104",
"0.7041886",
"0.70406854",
"0.70253694",
"0.7022449",
"0.7019248",
"0.7019018",
"0.7018463",
"0.7017065",
"0.7017065",
"0.7009596"
] |
0.82416296
|
18
|
Returns command to replace or append configuration
|
def set_command
[grep_cmd, '&&', replace_cmd, '||', append_cmd].join(' ')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def configure_command(cmd)\n end",
"def config(command)\n ensure_mode(:configuration)\n run(command)\n end",
"def replace_command(command)\n return @apps[command] if @apps.has_key?(command)\n return command\n end",
"def command_config(str_opts)\n command :config do |c|\n c.syntax = 'budik config [options]'\n c.summary = @str_config.summary\n c.description = @str_config.description\n c.option '-r', '--reset', str_opts.reset\n c.action { |_args, opts| Command.new(:config, opts) }\n end\n end",
"def configure\n send_command \"--configure\"\n end",
"def command\n return \"#{@command} #{options}\"\n end",
"def command(config_file)\n return \"#{adjust_python_path} python #{kernel} -m #{config_file} #{args.join(' ')}\"\n end",
"def command\n return @command if !@opt_set && @command\n @opt_set = false\n @command = [@binary, options]\n end",
"def setconfig(str)\n add_cmd str\n end",
"def add_original_commands; end",
"def submode_config(config_line)\n command = config_line.strip\n @configuration[command]\n end",
"def add_original_commands\n end",
"def command\n ([executable] + options_composition + @redirections).join(\" \")\n end",
"def gsub_command(system_command)\n command = system_command\n if system_command =~ /^gem/\n command << \" --config-file=features/resources/gem-cucumber.yml\"\n end\n command\nend",
"def command\n if new_resource.command.is_a?(Array)\n [new_resource.python] + new_resource.command\n else\n \"#{new_resource.python} #{new_resource.command}\"\n end\n end",
"def redefine_command(obj, command)\n cmd_block = redefine_command_block(obj, command)\n @no_option_commands << command if command.options.nil?\n [command.name, command.alias].compact.each {|e|\n obj.instance_eval(\"class<<self;self;end\").send(:define_method, e, cmd_block)\n }\n end",
"def command\n case first\n when '\\?' then Command::HelpCommand\n when '\\config' then Command::PrintConfigCommand\n else\n puts \"Unknown command: #{buffer}\"\n end\n end",
"def execute\n Tools.public_send(command, options.configuration_path)\n end",
"def append_cmd\n sprintf 'echo \"%s%s\" >> %s', key_set_string, @config[:value], @file\n end",
"def getConfigCmd(prop, value)\n\n case prop\n when 'type'\n # 'value' defines type of operation\n type = case\n when value == 'a' : 1\n when value == 'b' : 2\n when value == 'g' : 3\n else\n raise \"Unknown type. Should be 'a', 'b', or 'g'.\"\n end\n return \"iwpriv #{@deviceName} set_mode #{type}\"\n\n when \"mode\"\n # 'value' defines mode of operation\n mode = case\n when value == 'Managed' : 'managed'\n when value == 'managed' : 'managed'\n when value == 'Master' : 'master'\n when value == 'master' : 'master'\n when value == 'ad-hoc' : 'ad-hoc'\n when value == 'adhoc' : 'ad-hoc'\n when value == 'monitor' : 'monitor'\n else\n raise \"Unknown mode '#{value}'. Should be 'managed', or 'ad-hoc'.\"\n end\n return \"iwconfig #{@deviceName} mode #{mode} essid dummy channel 1\"\n\n when \"essid\"\n @essid = value\n return \"iwconfig #{@deviceName} essid #{value}\"\n\n when \"frequency\"\n return \"iwconfig #{@deviceName} freq #{value}\"\n\n when \"tx_power\"\n return \"iwconfig #{@deviceName} txpower #{value}\"\n\n when \"rate\"\n return \"iwconfig #{@deviceName} rate #{value}\"\n\n when \"rts\"\n return \"iwconfig #{@deviceName} rts #{value}\"\n\n when \"channel\"\n return \"iwconfig #{@deviceName} channel #{value}\"\n\n end\n super\n end",
"def run_cmd\n cmds = []\n cmds << @resource[:section] if @resource[:section]\n cmds << @property_flush[:command]\n node.config(cmds)\n end",
"def default_command(command)\n @@default_command = command.to_sym\n end",
"def default_command\n commands.find { |c| c.default }\n end",
"def customize(command)\n @customizations << command\n end",
"def command\n if args.skip?\n ''\n else\n commands.join('; ')\n end\n end",
"def option_command(cmd=@command)\n @option_commands[cmd] ||= OptionCommand.new(cmd)\n end",
"def formulate_command\n @command\n end",
"def default_commands_config\n [\n {\n :name => \"Google Quicksearch\", \n :command_id=> 1,\n :tags=>'google'\n },\n {\n :name => \"Gmail Search\", \n :command_id=> 2,\n :tags=>'google mail'\n },\n {\n :name => \"Google \\\"I'm Feeling Lucky\\\" Wikipedia (en) search\",\n :command_id=> 3,\n :tags=>'google wikipedia'\n },\n {\n :name => \"Dictionary Lookup at Reference.com\",\n :command_id=> 4,\n :tags=>\"dictionary reference language english\"\n },\n {\n :name => \"My Queriac Page\",\n :command_id=> 5,\n :tags=>\"queriac bootstrap\"\n },\n {\n :name => \"Show a Queriac user command\",\n :command_id=> 6,\n :tags=>\"queriac bootstrap\"\n },\n {\n :name => \"Edit a Queriac user command\",\n :command_id=> 7,\n :tags=>\"queriac bootstrap\"\n },\n {\n :name => \"Create a new Queriac user command\",\n :command_id=> 8,\n :tags=>\"queriac bootstrap\"\n },\n {\n :name=> \"Search my Queriac user commands\",\n :command_id=> 645,\n :tags=>\"queriac bootstrap\"\n }\n ]\n end",
"def add_commands\n end",
"def command(key)\n keys = configuration.instance.keys\n cmd = eval \"#{keys}.#{key}\"\n cmd.capitalize! << \"Command\"\n case cmd\n when /QuitCommand/\n QuitCommand.new(@terminal)\n else\n NoOpCommand.new\n end\n end",
"def replace_cmd\n sprintf 'sed -i \"s/%s.*/%s%s/\" %s', key_set_string, key_set_string, @config[:value], @file\n end",
"def set_commands; end",
"def prepend(key, command, options = {})\n case key\n when 'env'\n if options['name'] && options['value']\n \"#{options['name']}=#{options['value']} #{command}\"\n else\n command\n end\n when 'sudo'\n \"sudo #{options['args']} #{command}\"\n when 'generic'\n if options['modifier_str']\n \"#{options['modifier_str']} #{command}\"\n else\n command\n end\n end\n end",
"def redefine_command(obj, command)\n cmd_block = redefine_command_block(obj, command)\n @no_option_commands << command if command.options.nil?\n [command.name, command.alias].compact.each {|e|\n obj.singleton_class.send(:define_method, e, cmd_block)\n }\n rescue Error\n warn \"Error: #{$!.message}\"\n end",
"def cmd!(command)\n self << command\n end",
"def configure_backdat\n @commands = parse_options\n\n begin\n ::File.open(config[:config_file]) { |f| apply_config(f.path) }\n rescue Errno::ENOENT => error\n msg = \"Did not find the config file: #{config[:config_file]}\"\n msg << \", Using command line options.\"\n Backdat::Log.warn \"*****************************************\"\n Backdat::Log.warn msg\n Backdat::Log.warn \"*****************************************\"\n end\n end",
"def with_command(*cmd)\n @commands.concat cmd.compact\n self\n end",
"def register_command cmd\n $commandlist << cmd\nend",
"def include_command?(command)\n commands = mode_configuration\n commands.include?(command)\n end",
"def command\n return \"#{adjust_python_path} python #{kernel} #{args.join(' ')}\"\n end",
"def command\n attributes.fetch(:command)\n end",
"def command\n attributes.fetch(:command)\n end",
"def add_command(meth)\n @@commands.delete(:help)\n \n if @@attribute\n argument_list = \"value\"\n meth = meth.to_s.delete(\"=\").to_sym if @@attribute == :attr_writer\n else\n argument_list = parse_arguments(@@command_options[:parameters])\n end\n @@command_options.merge!(:argument_list=>argument_list,:class => self.name)\n \n @@commands.merge!(meth => @@command_options)\n @@default_method = {meth => @@command_options} if @@command_options[:default]\n\n @@commands.sort.each {|com| @@commands.merge!(com[0]=>@@commands.delete(com[0]))}\n \n @@commands.merge!(HELP_COMMAND.dup) # makes sure the help command is always last\n @@command_options = nil\n @@attribute = nil\n end",
"def << command\n log.info(cli_option(:name)) { \"<< #{command}\" }\n self.write(command + \"\\n\")\n @cli_last_command = command\n self\n end",
"def command(name)\n commands[name]\n end",
"def command(name)\n commands[name]\n end",
"def command(name)\n commands[name]\n end",
"def command\n if new_resource.parent_bundle\n bundle_exec_command(new_resource.command, path: environment['PATH'])\n else\n if new_resource.command.is_a?(Array)\n [new_resource.ruby] + new_resource.command\n else\n \"#{new_resource.ruby} #{new_resource.command}\"\n end\n end\n end",
"def with_command(cmd)\n old = ENV['BOSONRC']\n ENV['BOSONRC'] = File.dirname(__FILE__) + '/.bosonrc.temp'\n File.open(ENV['BOSONRC'], 'w') {|f|\n f.puts <<-STR\nrequire 'boson/runner'\nclass SomeRunner < Boson::Runner\ndef #{cmd}\nend\nend\nBoson::Manager.load SomeRunner\nSTR\n }\n\n yield\n\n FileUtils.rm_f ENV['BOSONRC']\n ENV['BOSONRC'] = old\n end",
"def goiardi_options\n new_resource.options ? new_resource.options : \"-c #{merged_conf[:'conf-root']}/#{new_resource.instance_name}.conf\"\n end",
"def commandalias(command, a)\r\n\t\t\t@commands[a] = @commands[command]\r\n\t\tend",
"def command\n return nil unless commands\n\n # Map commands to template & chain\n commands.map(&method(:template_command_with_output_cleaned)).join(' && ')\n end",
"def getConfigCmd(prop, value)\n debug \"looking for property '#{prop}' in ethernet\"\n case prop\n when 'ip'\n return \"ifconfig #{@deviceName} #{value} netmask 255.255.0.0\"\n when 'up'\n return \"ifconfig #{@deviceName} up\"\n when 'down'\n return \"ifconfig #{@deviceName} down\"\n when 'netmask'\n return \"ifconfig #{@deviceName} netmask #{value}\"\n when 'mtu'\n return \"ifconfig #{@deviceName} mtu #{value}\"\n when 'mac'\n return \"ifconfig #{@deviceName} hw ether #{value}\"\n when 'arp'\n dash = (value == 'true') ? '' : '-'\n return \"ifconfig #{@deviceName} #{dash}arp\"\n when 'forwarding'\n flag = (value == 'true') ? '1' : '0'\n return \"echo #{flag} > /proc/sys/net/ipv4/conf/#{@deviceName}/forwarding\"\n when 'route'\n return getCmdForRoute(value)\n when 'filter'\n return getCmdForFilter(value)\n when 'gateway'\n return \"route del default dev eth1; route add default gw #{value}; route add 224.10.10.6 dev eth1\"\n end\n super\n end",
"def command\n @command ||= Mixlib::ShellOut.new from_instructions\n end",
"def command\n @command ||= Class.new.send(:include, Command)\n end",
"def command\n return \"#{adjust_python_path} python -E -m #{kernel} #{args.join(' ')}\"\n end",
"def override_defaults_based_on_config(config)\n config ||= {}\n config['commands'] ||= {}\n\n override_default(flags,config)\n override_default(switches,config)\n\n commands.each do |command_name,command|\n command_config = config['commands'][command_name] || {}\n\n override_default(command.flags,command_config)\n override_default(command.switches,command_config)\n end\n end",
"def install_command\n command = ['helm', 'upgrade', name, chart] +\n install_flag +\n reset_values_flag +\n optional_tls_flags +\n optional_version_flag +\n rbac_create_flag +\n namespace_flag +\n value_flag\n\n command.shelljoin\n end",
"def raw\n orig_command = \"fsctl #{@command}\"\n end",
"def add_command(key, value)\n return unless key && value\n\n @commands ||= {}\n @commands[key] = value\n end",
"def command_list\n options[:commands] || SimpleFormEpicEditor::EpicEditorInput.configuration.commands\n end",
"def command\n return @raw_command\n end",
"def newcommand(options, &block)\n raise \"No name given in command\" unless options.include?(:name)\n\n command = options[:name]\n\n SLAF::Commands.module_eval {\n define_method(\"#{command}_command\", &block)\n }\n\n SLAF::command_options || SLAF.command_options = {}\n\n if options.include?(:allow_arguments)\n SLAF::command_options[command] = options[:allow_arguments]\n else\n SLAF::command_options[command] = false\n end\nend",
"def command_builder; end",
"def before_update(params_to_update=[])\n transport.command(\"enable\")\n transport.command(\"conf\", :prompt => /\\(conf\\)#\\s?\\z/n)\n end",
"def set_command(index, new_command, force = false)\n return if @commands[index] == new_command and !force\n @commands[index] = new_command\n rect = command_rect(index)\n self.contents.clear_rect(rect)\n new_command.keys.each_with_index { |key, i|\n draw_key_icon(key, rect.x + ICON_WIDTH * i, rect.y, new_command.enabled?)\n }\n rect.x += ICON_WIDTH * new_command.keys.size\n rect.width -= (ICON_WIDTH * new_command.keys.size)\n change_color(normal_color, new_command.enabled?)\n draw_text(rect, new_command.text)\n end",
"def command\n @attributes['command']\n end",
"def command_string\n\t\treturn datastore['CMD'] || ''\n\tend",
"def cmd(string)\n @commands << string\n end",
"def command_name; end",
"def execute(output: $stdout)\n options.each do |key, val|\n if val == key.to_s\n output.puts RubyEdit.config.send(key)\n else\n RubyEdit.config.send(\"#{key}=\", val)\n output.puts \"#{key.to_s.titleize} changed to #{val}\"\n end\n end\n end",
"def setconfig(str)\n command = \"#{command(:cfg)} -z #{@resource[:name]} -f -\"\n debug \"Executing '#{command}' in zone #{@resource[:name]} with '#{str}'\"\n IO.popen(command, \"w\") do |pipe|\n pipe.puts str\n end\n\n unless $CHILD_STATUS == 0\n raise ArgumentError, \"Failed to apply configuration\"\n end\n end",
"def getCommand(experiment, type)\n binName = File.join('.', 'bin', \"#{type}#{experiment['emethod']}\")\n outputDir = getOutputDir(experiment)\n\n args = [\n \"--datadir '#{experiment['data']}'\",\n \"--outdir '#{outputDir}'\",\n \"--seed #{SEED}\"\n ]\n\n experiment['args'].each_pair{|key, value|\n args << \"--#{key} '#{value}'\"\n }\n\n return \"#{binName} #{args.join(' ')}\"\nend",
"def add_command(command, prefix=\"purugin\")\n old_command = command_map.get_command(command.name)\n if old_command\n command.infect(old_command)\n else\n command_map.register prefix, command\n end\n end",
"def generate_command\n say_path = @config[:say_path]\n file = @config[:file]\n\n raise CommandNotFound, \"Command `say` couldn't be found by '#{@config[:say_path]}' path\" unless valid_command_path? say_path\n\n if file && !valid_file_path?(file)\n raise FileNotFound, \"File '#{file}' wasn't found or it's not readable by the current user\"\n end\n\n file = file ? \" -f #{@config[:file]}\" : ''\n \"#{@config[:say_path]}#{file} -v '#{@config[:voice]}' -r #{@config[:rate].to_i}\"\n end",
"def command_for(args)\n [config.to_env].tap do |cmd|\n args = args.clone\n cmd.append('node', '--inspect-brk') if args.delete('--inspect')\n cmd.append('node', '--trace-deprecation') if args.delete('--trace_deprecation')\n cmd.append(vite_executable)\n cmd.append(*args)\n cmd.append('--mode', config.mode) unless args.include?('--mode') || args.include?('-m')\n end\n end",
"def command\n if self.valid\n command = [\"command=\\\"#{Rails.root}/#{Settings.application.aq_shell} #{self.login}\\\"\",\n \"no-port-forwarding\", \"no-X11-forwarding\", \"no-agent-forwarding\"]\n command.join(\",\")\n end\n end",
"def command\n @property[:command]\n end",
"def command_config var, val\n config = @data_connection.options.merge({var.intern => val})\n @data_connection.set_options config\n end",
"def rsync_command\n utility(:rsync).dup <<\n archive_option <<\n mirror_option <<\n exclude_option <<\n \" #{Array(additional_rsync_options).join(\" \")}\".rstrip\n end",
"def commands\n\t\t\t{\n\t\t\t\t\"edit\" => \"A handy editor commmand\"\n\t\t\t}\n\t\tend",
"def config_value\n @config_value ||= `#{CONFIG_CMD}`\n end",
"def append_commands(_command = '', user_ac = '', _opts = {})\n user_ac\n end",
"def config(for_plugin: nil, for_command: nil)\n if for_plugin && for_command\n fail ArgumentError, \"Cannot get config for plug-in and command together\"\n elsif for_plugin\n @config.dig(:plugins, for_plugin.to_sym) || OpenStruct.new\n elsif for_command\n @config.dig(:commands, for_command.to_sym) || OpenStruct.new\n else\n @config\n end\n end",
"def execute_command_provider\n attributes.fetch(:executeCommandProvider)\n end",
"def command\n\n cmd = \"\"\n\n xval = @options['xrange']\n cmd << \" #{xval}\" if( xval )\n \n yval = @options['yrange']\n cmd << \" #{yval}\" if( yval and xval )\n\n cmd << \" #{@basecommand}\"\n\n cmd << \" using #{@options['using']}\" if( @options['using'] )\n\n tstr = @options[\"title\"]\n cmd += if( !tstr ) then ''\n\t elsif( tstr == 'notitle' ) then 'notitle'\n\t else \" title '#{tstr}'\"\n\t end\n\n cmd << \" with #{@options['with']}\" if( @options[\"with\"] )\n\n cmd\n end",
"def generate_sudo_block\n # This would be better if sudoers allowed regex and repetition rather than simple shell globs like \"*\"\n command = self.command.gsub(/([\\\\\\:*?,\\(\\)\\[\\]!=])/m, '\\\\\\\\\\1') # escape sudo's special chars\n # {{date}} becomes a UTC iso-8601 datetime, like 2012-07-18 15:00\n command = command.gsub(/{{date}}/, '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]') # yyyy-mmm-dd HH-mm-ss\n command = command.gsub(/{{.*?}}/, '[A-z]*') # sadly this is equivalent to /[A-z].*/ in sudoers\n command = command.gsub(/[\"']/, '')\n config_line = \"# -- #{self.name} --\\nCmnd_Alias TCOMMAND_#{self.id} = #{command}\"\n config_line\n end",
"def raw_command\n @raw_command ||= @raw.split[0] || \"\"\n end",
"def build_command(cmd)\n cmd\n end",
"def build_command\n \n # Initialise the excludes array\n excludes = Array.new\n \n # Fill the excludes array from the excludes listed in the config file\n if @ignore\n @ignore.each do |ignore|\n # Ability here to check for ! to see if we should use --include\n if(ignore[0,1] == \"!\")\n ignore.slice!(0)\n excludes << \" --include \\'#{ignore}\\'\"\n else\n excludes << \" --exclude \\'#{ignore}\\'\"\n end\n end\n end\n \n # Build the CLI excludes arguments for rsync\n exclude_cli = excludes.empty? ? '' : excludes.join\n \n # If we're in a dry run, set the rsync option\n dry_run = @dry_run ? ' --dry-run' : ''\n \n # Check for port and identity file\n ssh_options = Array.new\n\n if @remote.has_key?('port')\n if (port=@remote['port']).to_i > 0\n ssh_options << \"-p #{port}\"\n end\n end\n \n if @remote.has_key?('identity_file')\n ssh_options << \"-i #{File.expand_path @remote['identity_file']}\"\n end\n \n # Build additions if there are ssh_options in the array\n ssh_additions = ssh_options.empty? ? '' : \" -e '\" + (ssh_options.unshift('ssh')).join(' ') + \"'\"\n \n # Define the command\n @command = \"#{@rsync} -aiz --no-t --no-p --checksum --delete#{ssh_additions}#{dry_run} --exclude '.git' --exclude '.svn' --exclude '.gitignore' --exclude 'deploy-to.yml'#{exclude_cli} #{@base_dir}/ #{@remote_uri}\"\n \n end",
"def command(name)\n commands.find { |command| command.name == name.to_s }\n end",
"def cmdline(command, options = {})\n command = [command].flatten\n cmdline = [where]\n cmdline += @options.merge(options).map { |k, v| !v ? nil : \"#{option(k)} #{v == true ? '' : v.to_s}\".rstrip }.compact\n cmdline << option(command.shift)\n cmdline += command\n cmdline.flatten.join(' ').strip\n end",
"def cmd_default\n cmd_info\n cmd_tree\n end",
"def command(cmd); \"#{cmd}#{options.tail ? ' -f' : ''}\" end",
"def command\n return \"python -E #{kernel} #{args.join(' ')}\"\n end",
"def add_command(id, &command)\n\t\tif @config['Commands'].nil? || @config['Commands'][id].nil?\n\t\t\tputs \"Plugin Manager: No command '#{id}' defined for #{@config['General']['Title']}\"\n\t\t\treturn nil\n\t\tend\n\t\tcmd = @config['Commands'][id]\n\t\t@procs[id] = UI::Command.new(cmd['Label'], &command)\n\t\t# Tooltips\n\t\t@procs[id].tooltip = cmd['Label']\n\t\t@procs[id].status_bar_text = cmd['Description'] if cmd.key?('Description')\n\t\t# Add Icons\n\t\ticon_path = @config['General']['ConfigPath'] + @config['General']['IconPath']\n\t\t@procs[id].small_icon = icon_path + cmd['SmallIcon'] if cmd.key?('SmallIcon')\n\t\t@procs[id].large_icon = icon_path + cmd['LargeIcon'] if cmd.key?('LargeIcon')\n\t\t#puts \"> Command '#{id}' registered!\"\n\t\treturn @procs[id]\n\tend",
"def command(cmd)\n if VNMNetwork::COMMANDS.keys.include?(cmd.to_sym)\n cmd_str = \"#{VNMNetwork::COMMANDS[cmd.to_sym]}\"\n else\n cmd_str = \"#{cmd}\"\n end\n\n return cmd_str\n end",
"def custom_install_commands #:nodoc:\n dress @options[:custom_install], nil, :install\n end",
"def command_for(directive)\n directives[directive] || abort(\"Couldn't find the `#{directive}` directive in your config.\\r\\n\".red)\n end",
"def push_config\n command = ['VBoxManage', 'modifyvm', uid]\n command.concat board.to_params\n nics.each_with_index do |nic, index|\n if nic.nil?\n command.push \"--nic#{index + 1}\", 'none'\n else\n command.concat nic.to_params(index + 1)\n end\n end\n VirtualBox.run_command! command\n \n io_buses.each { |bus| bus.add_to self }\n \n self\n end"
] |
[
"0.70006484",
"0.6455611",
"0.64460176",
"0.61871654",
"0.6170531",
"0.61379653",
"0.6052118",
"0.6047923",
"0.59832275",
"0.5964551",
"0.58868384",
"0.58862174",
"0.5873381",
"0.5865697",
"0.585982",
"0.5750056",
"0.57091177",
"0.56871325",
"0.5682299",
"0.56749403",
"0.56643486",
"0.56537807",
"0.56298035",
"0.56053466",
"0.56049395",
"0.5600902",
"0.5594982",
"0.55949813",
"0.55875355",
"0.5577436",
"0.55654687",
"0.5547516",
"0.55366147",
"0.5532869",
"0.55067307",
"0.55026454",
"0.5491817",
"0.5489316",
"0.5475232",
"0.5467601",
"0.54651237",
"0.54651237",
"0.54497325",
"0.5446822",
"0.5441716",
"0.5441716",
"0.5441716",
"0.53960836",
"0.5393353",
"0.537113",
"0.5370315",
"0.536989",
"0.53400385",
"0.5333136",
"0.5332666",
"0.5287693",
"0.52868366",
"0.52809536",
"0.52806914",
"0.5274344",
"0.5269951",
"0.52679855",
"0.5260398",
"0.5259884",
"0.52570105",
"0.52562433",
"0.5244432",
"0.52369255",
"0.5228005",
"0.5222026",
"0.5219651",
"0.5213487",
"0.5212638",
"0.5204723",
"0.52015465",
"0.5199684",
"0.51970214",
"0.51952434",
"0.5192457",
"0.5192253",
"0.51818436",
"0.5180518",
"0.51795685",
"0.51785284",
"0.5146535",
"0.51433927",
"0.5137917",
"0.513233",
"0.51294035",
"0.51290774",
"0.51229775",
"0.51207095",
"0.5114935",
"0.5107",
"0.5105901",
"0.5101826",
"0.51015913",
"0.50938576",
"0.50889826",
"0.5087486"
] |
0.61103785
|
6
|
Returns command to remove line from configuration
|
def unset_command
[grep_cmd, '&&', unset_cmd].join(' ')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove_command(name)\n @commands ||= {}\n @commands.delete name\n end",
"def unset_cmd\n sprintf 'sed -i /%s/d %s', key_set_string, @file\n end",
"def remove_config(name)\n\t\tend",
"def remove_command(command, resize=true)\n @commands.delete(command)\n @item_max = @commands.size\n refresh_command(resize)\n end",
"def remove_line_from_file(path, line)\n run \"#{sudo} sed -i '/#{escape_sed(line)}/d' #{path}\", options\n end",
"def remove\n system(\"qconf -duser #{name}\")\n end",
"def remove_line(line)\n\t\t@lines.delete(line)\n\tend",
"def command\n if args.skip?\n ''\n else\n commands.join('; ')\n end\n end",
"def clean_command\n build_command(\"clean\")\n end",
"def del(opts)\n \"\"\n end",
"def rm(path)\n cmd 'rm', path\nend",
"def remove_command\n return if !has_manage_messages_permission?\n command.event.message.delete\n end",
"def removeCommandAliases(repo)\n config = repo.config(true, '--list').lines.each do |line|\n next unless line.start_with? 'alias.' and line.match /\\!_git\\-bpf/\n a = /alias\\.([a-zA-Z0-9\\-_]+)\\=(.)*/.match(line)[1]\n repo.config(true, '--unset', \"alias.#{a}\")\n end\n end",
"def snmp_notification_receiver_remove(opts = {})\n cmd = 'no ' << snmp_notification_receiver_cmd(opts)\n configure cmd\n end",
"def remove_line(options)\n line = Google::OptionsHelper.to_line(options)\n\n self.remove_overlay line\n line.removed_from_map self \n end",
"def delete(key)\n @config.delete(key.to_s)\n end",
"def remove_data_line(which = 1)\n remove_line(\"data_line_#{which}\")\n end",
"def remove_server(opts = {})\n cmd = \"no tacacs-server host #{opts[:hostname]}\"\n cmd << \" port #{opts[:port]}\" if opts[:port]\n configure cmd\n end",
"def hash_delete(field)\n choose do |menu|\n menu.prompt = \"Please select to remove: \"\n menu.index = :number\n menu.index_suffix = ') '\n menu.choice(:quit, 'Quit') {result = false}\n values = []\n AppConfig.config[field].each do |key, value|\n values << \"#{key} => #{value}\"\n end\n menu.choices(*values) do |value, details|\n if value =~ /(.*\\S)\\s+=>/\n AppConfig.config[field].delete($1)\n end\n end\n end\n end",
"def delete_command_help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Command Usage:\"\n puts \" [delete | d] <name=> deletes a animal by name\"\n puts \"\"\n puts \"Examples:\"\n puts \" bin/run [delete | d] name=my_animal_name\"\n end",
"def delete(symbol)\n configuration.delete(symbol)\n end",
"def options_remove opts, colors\n\t\t\t\topts.separator \"\"\n\t\t\t\topts.separator \" *\".colorize(colors[:cyan]) + \" remove, rm\".colorize(colors[:yellow]) + \n\t\t\t\t\" removes the list completely.\".colorize(colors[:magenta])\n\t\t\t\topts.separator \" usage: \".colorize(colors[:cyan]) + USAGE[:remove].colorize(colors[:red])\n\t\t\tend",
"def delete_setting!(header, name)\n write do \n contents.gsub(find_setting(header, name), '')\n end\n end",
"def action_remove\n notifying_block do\n delete_config\n end\n end",
"def ti_delete_line\n\ttictl(\"dl\")\n end",
"def remove\n return unless confirm_command\n\n args.each do |name|\n messages = nil\n if name.start_with? \"HEROKU_POSTGRESQL_\"\n name = name.chomp(\"_URL\").freeze\n end\n action(\"Removing #{name} on #{app}\") do\n messages = addon_run { heroku.uninstall_addon(app, name, :confirm => app) }\n end\n display(messages[:attachment]) if messages[:attachment]\n display(messages[:message]) if messages[:message]\n end\n end",
"def remove(key)\n\t\t\tvalue = @config.shift(key)\n\t\t\treturn value\n\t\tend",
"def delete(key)\n self.config.delete(key)\n end",
"def remove_custom_command(command_name, owner_user_id)\n commands = USER_CUSTOM_COMMANDS.where{Sequel.&({command_name: command_name}, {owner_user_id: owner_user_id})}\n return false if commands.count() <= 0\n\n commands.delete\n return true\n end",
"def strip_out_command_key(value)\n return value.split(' ').last\nend",
"def uninstall\n command = resource_or_provider_command\n self.class.validate_command(command)\n\n command_options = [\"uninstall\", \"-y\", \"-q\", @resource[:name]]\n\n execute([command, command_options])\n end",
"def remove(remove_slot = params[\"remove\"])\n\t\tsession[Constants::SESS_MY_CONFIG].remove(remove_slot)\n\t\tgo_to_config\n\tend",
"def rm_str(options, src)\n\t\targ = \"rm \" + options + \" \" + src\n\t\tputs arg\n\t\tsystem arg\n\tend",
"def submode_config(config_line)\n command = config_line.strip\n @configuration[command]\n end",
"def cfgremove(fabrickey, cfgname, *zonenames)\n result = @zones.altercfg(fabrickey, 'REMOVE', cfgname, *zonenames)\n result[1]\n end",
"def rm_r(path)\n cmd 'rm', '-r', path\nend",
"def clear(option)\n @client.call('config.unset', option)\n end",
"def remove!\n windows_package 'Chef Development Kit' do\n action :remove\n end\n end",
"def delete(key)\n configuration.delete(key)\n end",
"def remove_pid_file\n @commands_and_opts.push OPTIONAL_OPTS[:remove_pid_file]\n self\n end",
"def cfg_remove(cfg,member)\n obj_remove(cfg,ZoneConfiguration,member)\n end",
"def remove!(entry)\n rel_path = Wide::PathUtils.relative_to_base(base_path, entry.path)\n\n cmd = cmd_prefix.push('rm', '-f', \"path:#{rel_path}\")\n shellout(Escape.shell_command(cmd))\n\n raise CommandFailed.new(\"Failed to remove file #{src_path} in the Mercurial repository in #{base_path}\") if $? && $?.exitstatus != 0\n end",
"def noteboard_delete(line_number)\n \n\n end",
"def strip\n with_command \"-strip\"\n end",
"def remove_battle_command(command)\n battle_commands.delete_if { |cmd| cmd.name.casecmp?(command.to_s) }\n end",
"def unset(key)\n run { conf.unset(key, config_params) }\n end",
"def remove_custom_command_by_item_entry_id(item_entry_id)\n commands = USER_CUSTOM_COMMANDS.where(item_entry_id: item_entry_id)\n return false if commands == nil || commands.count <= 0\n\n commands.delete\n return true\n end",
"def erase_line\n # highline does not expose the output stream\n HighLine.default_instance.instance_variable_get('@output').print \"\\r\\e[K\"\n end",
"def sub_remove _value=0\n send_cmd(\"sub_remove #{_value}\")\n end",
"def array_delete(field)\n choose do |menu|\n menu.prompt = \"Please select to remove: \"\n menu.index = :number\n menu.index_suffix = ') '\n menu.choice(:quit, 'Quit') {result = false}\n menu.choices(*AppConfig.config[field]) do |extension, details|\n AppConfig.config[field].delete(extension)\n end\n end\n end",
"def remove_target\n options[:remove_target]\n end",
"def delete_configuration\n super\n end",
"def delete_configuration\n super\n end",
"def remove_battle_command(command)\n index = has_battle_command(command)\n battle_commands.delete_at(index) if index\n end",
"def deleteConfigFile(appName)\n @put.normal \"Removing Thin configuration for #{appName}\"\n configFile = \"/etc/thin/#{appName}.yml\"\n if File.exists?(configFile)\n removeCommand = @system.delete(configFile)\n if removeCommand.success?\n @put.confirm\n return 0\n else\n @put.error \"Could not delete Thin configuration\"\n return 1\n end\n else\n @put.error \"Config file non-existent\"\n return 1\n end\n end",
"def remove(conf, package_name, version = nil)\n raise NoMethodError.new \"Not implemented\"\n end",
"def delete(key)\n load_config unless @config\n @config.delete(key)\n save_config\n end",
"def remove_match_clone(options)\n UI.command \"removing #{options[:dir]}\"\n FileUtils.remove_entry_secure options[:dir]\nend",
"def delete(name)\n configure [\"interface #{name}\", 'no switchport']\n end",
"def unset_config(key)\n store :delete, \"configs/#{key}\"\n end",
"def remove_command(command_label, rest_args)\n worker = workers[command_label]\n return false unless worker\n signal_to_use = rest_args ? Array(rest_args).first : 'INT'\n\n Invoker::Logger.puts(\"Removing #{command_label} with signal #{signal_to_use}\".color(:red))\n kill_or_remove_process(worker.pid, signal_to_use, command_label)\n end",
"def unlink_runfile\n File.unlink(CONFIG[:run_path]) if File.exists?(CONFIG[:run_path]) and File.read(CONFIG[:run_path]).to_i == Process.pid.to_i\n end",
"def commands\n @commands.reject { |_, v| v.is_a? CommandLion::Option }\n end",
"def remove_config(name)\n variables[name] = nil\n end",
"def delete_character(index = nil)\n Vedeu::Editor::Line.coerce(Vedeu::Editor::Delete\n .from(line, index, size))\n end",
"def delete_character(index = nil)\n Vedeu::Editor::Line.coerce(Vedeu::Editor::Delete\n .from(line, index, size))\n end",
"def remove_line(instance_name)\n raise StandardError, \"Line object does not exist. (#{instance_name})\" unless self.instance_variables.include?(\"@#{instance_name}\".to_sym)\n remove_instance_variable(\"@#{instance_name}\".to_sym)\n unmake_attr(instance_name.to_sym)\n end",
"def unconfigure_xb_pxe_client(client_name)\n client_mac=get_client_mac(client_name)\n if !client_mac\n puts \"Warning:\\tNo MAC Address entry found for \"+client_name\n exit\n end\n tftp_pxe_file = client_mac.gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxeboot\"\n tftp_pxe_file = $tftp_dir+\"/\"+tftp_pxe_file\n if File.exist?(tftp_pxe_file)\n message = \"Removing:\\tPXE boot file \"+tftp_pxe_file+\" for \"+client_name\n command = \"rm #{tftp_pxe_file}\"\n output = execute_command(message,command)\n end\n unconfigure_xb_dhcp_client(client_name)\n return\nend",
"def remove_gdom_disk(options)\n vds_disk = options['name']+\"_vdisk0\"\n message = \"Information:\\tRemoving disk \"+vds_disk+\" from Virtual Disk Server\"\n command = \"ldm remove-vdisk #{vds_disk} #{options['name']}\"\n execute_command(options,message,command)\n return\nend",
"def delete(key)\n @configuration.delete(key)\n end",
"def delete(key)\n @configuration.delete(key)\n end",
"def delete(key)\n @configuration.delete(key)\n end",
"def remove( *args )\n args.each { |name|\n name = name.to_s.delete('=')\n code = <<-__\n undef_method :#{name} rescue nil\n undef_method :#{name}= rescue nil\n __\n Loquacious::Configuration.module_eval code\n Loquacious::Configuration::DSL.module_eval code\n }\n end",
"def remove_configuration(value)\n @children['configuration'][:value].delete(value)\n end",
"def delete_legacy_args args\n args.delete '--inline-source'\n args.delete '--promiscuous'\n args.delete '-p'\n args.delete '--one-file'\n end",
"def delete_legacy_args args\n args.delete '--inline-source'\n args.delete '--promiscuous'\n args.delete '-p'\n args.delete '--one-file'\n end",
"def config_delete(name)\n Bundler.settings.set_local(name, nil)\n Bundler.settings.set_global(name, nil)\n end",
"def undefine_config(tool)\n @setup[tool.to_s] = false\n end",
"def hide_command!\n Rails::Command.hidden_commands << self\n end",
"def generate_remove tab_name, argv\n\t\tcondition = \"\"\n\t\tcondition << \"( \"\n\t\ti = 0\n\t\tbegin\n\t\t\tif \"condition\" != argv.keys[i] \n\t\t\t\tcondition << argv.keys[i] \n\t\t\t\tcondition << \"=\"\n\t\t\t\tcondition << \"\\\"#{argv[argv.keys[i]]}\\\"\" \n\t\t\t\tcondition << \" \"\n\t\t\t\ti = i.to_i + 1\n\t\t\telse\n\t\t\t\tcondition << \"\\\"#{argv[argv.keys[i]]}\\\"\" \n\t\t\t\tcondition << \" \"\n\t\t\t\ti = i.to_i + 1\n\t\t\tend\t\n\t\tend while i < argv.length\n\t\tcondition << \")\"\n\t\tquery = \" DELETE FROM #{tab_name} WHERE#{condition} \"\n\t\t#puts query\n\t\treturn query\n\tend",
"def delete(name)\n configure([\"interface #{name}\", 'no ip address', 'switchport'])\n end",
"def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end",
"def remove_config_comment_lines\n # NOTE: (2016-02-09) jonk => don't want this\n end",
"def unregister_server(id)\n puts \"Removing entry to #{id} from HA configurations\"\n name = 'webserver'\n tempfile = '/tmp/haproxy.cfg'\n server_config = \"server #{name}\"\n \n contents = File.read(File.expand_path(@haproxy_config_file))\n\n open(tempfile, 'w+') do |f|\n contents.each_line do |line|\n f.puts line unless line.match(id)\n end\n end\n FileUtils.mv(tempfile, @haproxy_config_file)\n end",
"def delete( )\n File.delete(@configFileDNE)\n self.clear\n self\n end",
"def remove(entry_point)\n entry_point = entry_point.name if entry_point.kind_of? Borges::Application\n val = @entry_points.delete(entry_point)\n end",
"def remove_battle_command(command)\n index = has_battle_command_by_object(command)\n if (index >= 0)\n @battle_commands.delete_at(index)\n end\n end",
"def remove_bootsnap\n fs.comment_lines_matching_in_file(\n 'config/boot.rb',\n %r{\\Arequire (['\"])bootsnap/setup\\1},\n )\n end",
"def remove\n heroku.remove_key(args.first)\n display \"Key #{args.first} removed.\"\n end",
"def remove\n heroku.remove_key(args.first)\n display \"Key #{args.first} removed.\"\n end",
"def clear\n @commands.clear\n nil\n end",
"def clean_up_conf_file(conf_file_path)\n conf_items_patterns = { /^tools\\.remindInstall.*\\n/ => \"tools.remindInstall = \\\"FALSE\\\"\",\n /^uuid\\.action.*\\n/ => \"uuid.action = \\\"create\\\"\",\n /^ethernet\\.+generatedAddress.*\\n/ => '' }\n\n content = File.read conf_file_path\n content << \"\\n\"\n\n conf_items_patterns.each_pair do |pattern, new_item|\n unless content.include? new_item\n content.gsub(pattern, '').strip\n content << \"#{new_item}\\n\"\n end\n end\n\n File.open(conf_file_path, 'w') { |f| f.print content }\n end",
"def erase\n runcmd 'erase'\n end",
"def clean!\n for duplicate in duplicates.map{|duplicate| duplicate[0]}\n @commands.delete_if{ |i| i[0] == duplicate}\n @commands << [duplicate, ENV[duplicate]]\n end\n end",
"def destroy\n @command.destroy\n end",
"def hana_cli_uninstaller(client_path)\n uninstaller = ::File.join(client_path, 'hdbclient', 'install', 'hdbuninst')\n add_ext(uninstaller)\nend",
"def strip_diff_syntax(line)\n line[2..-1]\n end",
"def removeHeadgear _args\n \"removeHeadgear _args;\" \n end",
"def get_docker_node_destroy_command_for(node)\n \"docker kill #{node.id}; docker rm #{node.id}\"\nend",
"def unregister_commands\n Bot::Commands.delete_for self\n end"
] |
[
"0.648653",
"0.62402755",
"0.61489886",
"0.60996914",
"0.60476494",
"0.5989397",
"0.594207",
"0.59270114",
"0.59146637",
"0.5878863",
"0.58686227",
"0.5851612",
"0.5824469",
"0.58132344",
"0.58082014",
"0.57268524",
"0.5697975",
"0.56960917",
"0.56915903",
"0.56839556",
"0.5681167",
"0.5679996",
"0.5671449",
"0.56521857",
"0.56364876",
"0.55727124",
"0.55632657",
"0.5550971",
"0.55465335",
"0.5542629",
"0.55366075",
"0.55057",
"0.5488342",
"0.54869026",
"0.54868567",
"0.5472173",
"0.54561514",
"0.5453456",
"0.54484713",
"0.5438556",
"0.5420484",
"0.5412411",
"0.5394375",
"0.5372396",
"0.5368132",
"0.53670603",
"0.5357569",
"0.5350096",
"0.5348888",
"0.534588",
"0.53405756",
"0.53209555",
"0.53209555",
"0.531753",
"0.53167576",
"0.5314425",
"0.5313141",
"0.5310129",
"0.5309975",
"0.5307753",
"0.5294092",
"0.5291984",
"0.5290648",
"0.5289278",
"0.52863234",
"0.52863234",
"0.528496",
"0.5283355",
"0.5282529",
"0.5281443",
"0.5281443",
"0.5281443",
"0.52795744",
"0.5278145",
"0.5271305",
"0.5271305",
"0.52677256",
"0.52652746",
"0.5247347",
"0.52413416",
"0.5241289",
"0.52340174",
"0.5222447",
"0.52203655",
"0.52115095",
"0.5200674",
"0.5187014",
"0.5186132",
"0.5184344",
"0.5184344",
"0.5176722",
"0.5175375",
"0.517349",
"0.51622933",
"0.5154993",
"0.5152913",
"0.5151683",
"0.5139274",
"0.51328635",
"0.513049"
] |
0.6232845
|
2
|
Returns command to grep config file for assignment
|
def grep_cmd
sprintf 'grep -Fq "%s" %s', key_set_string, @file
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_config(file); end",
"def getconf(target)\n\t\t@log.info \"--util.rb : util.getconf(\" + target + \") \"\n\t\tFile.foreach(@config_file) do |line|\n\t\t#File.foreach(\"../../config.txt\") do |line|\n\t\t\tconf = line.chomp\n\t\t\tif(conf.index(target)) then\n\t\t\t\t@log.debug \"return \" + conf.split[1]\n\t\t\t\treturn conf.split[1]\n\t\t\tend\n\t\tend\n\tend",
"def check_puppet_postrun_command\n val = Facter::Core::Execution.exec('puppet config print | grep postrun_command')\n check_value_string(val, 'none')\nend",
"def run_grep\n args = ['grep', '-HoRI']\n [:include, :exclude].each do |opt|\n next unless (val = grep_config[opt]).present?\n args += Array(val).map { |v| \"--#{opt}=#{v}\" }\n end\n args += [%q{\\\\bt(\\\\?\\\\s*['\"]\\\\([^'\"]*\\\\)['\"]}, *grep_config[:paths]]\n args.compact!\n run_command *args\n end",
"def read_cfg\n config = Config.new\n File.open(\"#{$work_dir}/#{filename}\") do |file|\n while line = file.gets\n #next if /^#/\n if /^(PMASTER):\\w+:(\\S+)/ =~ line then\n config.host_list[$2] = $1\n puts \"Puppet Master: #{$2}\"\n end\n if /^(AGENT):\\w+:(\\S+)/ =~ line then\n config.host_list[$2] = $1\n puts \"Puppet Agent: #{$2}\"\n end\n end\n end\n return config\n end",
"def set_command\n [grep_cmd, '&&', replace_cmd, '||', append_cmd].join(' ')\n end",
"def getConfigCmd(prop, value)\n debug \"looking for property '#{prop}' in ethernet\"\n case prop\n when 'ip'\n return \"ifconfig #{@deviceName} #{value} netmask 255.255.0.0\"\n when 'up'\n return \"ifconfig #{@deviceName} up\"\n when 'down'\n return \"ifconfig #{@deviceName} down\"\n when 'netmask'\n return \"ifconfig #{@deviceName} netmask #{value}\"\n when 'mtu'\n return \"ifconfig #{@deviceName} mtu #{value}\"\n when 'mac'\n return \"ifconfig #{@deviceName} hw ether #{value}\"\n when 'arp'\n dash = (value == 'true') ? '' : '-'\n return \"ifconfig #{@deviceName} #{dash}arp\"\n when 'forwarding'\n flag = (value == 'true') ? '1' : '0'\n return \"echo #{flag} > /proc/sys/net/ipv4/conf/#{@deviceName}/forwarding\"\n when 'route'\n return getCmdForRoute(value)\n when 'filter'\n return getCmdForFilter(value)\n when 'gateway'\n return \"route del default dev eth1; route add default gw #{value}; route add 224.10.10.6 dev eth1\"\n end\n super\n end",
"def submode_config(config_line)\n command = config_line.strip\n @configuration[command]\n end",
"def config(key)\n %x[git config #{key}].chomp\nend",
"def configuration_exists(conf_line,find_str)\n\n #Check that the configuration attribute exists\n conf_exists = conf_line.include?(find_str)\n conf_value = false\n\n #Ensure there is a value for the configuration line\n if conf_exists && conf_line.split('=')[1].chomp.strip.length > 0\n conf_value = true\n end\n\n return conf_value\n\nend",
"def notifycmdline\r\n\t\t\t`#{BITS::BITSADMIN} /getnotifycmdline {#{@id}}`\r\n\t\tend",
"def command(config_file)\n return \"#{adjust_python_path} python #{kernel} -m #{config_file} #{args.join(' ')}\"\n end",
"def config_file\n send_command(:getinfo, 'config-file')\n reply = read_reply.split('=').last\n read_reply # skip \"250 OK\"\n Pathname(reply)\n end",
"def get_puppet_config(agent)\n cl = \"#{pp(agent)} puppet agent --configprint config\"\n (on agent, cl, pty: true).stdout.chomp\nend",
"def configure_command(cmd)\n end",
"def puppet_config(host, config)\n on(host, puppet(\"config print #{config}\")).stdout.chomp\n end",
"def get_puppet_config\n system_config = %x{puppet config print}\n\n config_hash = Hash.new\n\n system_config.each_line do |line|\n k,v = line.split('=')\n config_hash[k.strip] = v.strip\n end\n\n return config_hash\nend",
"def config_value_for(key)\n cmd = executable_command config_value_str(key)\n value = `#{cmd}`.strip\n value = nil if value == ''\n value\n end",
"def find_haproxy_setting(config_file, regex_group, regex_setting)\n raise 'file missing' unless ::File.exist?(config_file)\n hapcfg = IO.readlines(config_file)\n # puts hapcfg.length\n hapcfg.reject! { |line| line =~ /^#/ || line =~ /^\\s*#/ || line =~ /^\\s*$/ }\n\n begin_non_white_space = /^\\S/\n in_group = false\n\n hapcfg.each do |line|\n if in_group == false && line =~ begin_non_white_space && line =~ /#{regex_group}/\n in_group = true\n next\n elsif in_group == true && line =~ begin_non_white_space\n in_group = false\n elsif in_group == true && line =~ /#{regex_setting}/\n return true\n end\n end\n\n false\nend",
"def runPMD config\n\tcmd = \"pmd -dir #{config[\"workingDir\"]}/#{config[\"git\"][\"branch\"]}/#{config[\"git\"][\"sourceDir\"]} -f csv -R #{formatRules config} > #{config[\"workingDir\"]}/pmd.csv\"\n\t\n\t# run os command\n\tvalue = %x[ #{cmd} ]\nend",
"def config_list(regex)\n\t\tcmd = \"git config -f #{@config_file} \" +\n\t\t \"--get-regexp 'environment.#{@env}.#{regex}'\"\n\n\t\tbegin\n\t\t\t@command.\n\t\t\t run_command_stdout(cmd).\n\t\t\t split(\"\\n\").\n\t\t\t map { |l| l.split(/\\s+/, 2) }.\n\t\t\t map { |item|\t[item[0].gsub(\"environment.#{@env}.\", ''), item[1]] }\n\t\trescue Giddyup::CommandWrapper::CommandFailed => e\n\t\t\tif e.status.exitstatus == 1\n\t\t\t\t# \"Nothing found\", OK then\n\t\t\t\treturn []\n\t\t\telse\n\t\t\t\traise RuntimeError,\n\t\t\t\t \"Failed to get config list environment.#{@env}.#{regex}\"\n\t\t\tend\n\t\tend\n\tend",
"def command_config(str_opts)\n command :config do |c|\n c.syntax = 'budik config [options]'\n c.summary = @str_config.summary\n c.description = @str_config.description\n c.option '-r', '--reset', str_opts.reset\n c.action { |_args, opts| Command.new(:config, opts) }\n end\n end",
"def _resolve_command opts, cmd\n return cmd if opts.include? cmd\n matches = opts.grep Regexp.new(\"^#{cmd}\")\n end",
"def select_file\n \"#{SLES_SCRIPT_DIRECTORY}/ifcfg-#{name}\"\n end",
"def config(command)\n ensure_mode(:configuration)\n run(command)\n end",
"def which(cmd); end",
"def which(cmd); end",
"def which(cmd); end",
"def __read_configuration(key)\n conf = config_file\n\n # make the required substitution in the configuration file\n text = File.read conf\n match = text.match(/'#{key}' => (.*),/)\n match ? match[1] : nil\n end",
"def command_for(directive)\n directives[directive] || abort(\"Couldn't find the `#{directive}` directive in your config.\\r\\n\".red)\n end",
"def get_config_file\n\t\tconfig_paths =\n\t\t\t[\n\t\t\t\t\"C:\\\\ProgramData\\\\Dyn\\\\Updater\\\\\", #Vista\n\t\t\t\t\"C:\\\\Documents and Settings\\\\All Users\\\\Application Data\\\\Dyn\\\\Updater\\\\\" #XP and else\n\t\t\t]\n\n\t\t# Give me the first match\n\t\tconfig_file = nil\n\t\tconfig_paths.each do |p|\n\t\t\ttmp_path = p + \"config.dyndns\"\n\t\t\tbegin\n\t\t\t\tf = session.fs.file.stat(tmp_path)\n\t\t\t\tconfig_file = tmp_path\n\t\t\t\tbreak #We've found a valid one, break!\n\t\t\trescue\n\t\t\tend\n\t\tend\n\n\t\treturn config_file\n\tend",
"def enum_configs\n host = session.session_host\n port = session.session_port\n exec_commands = [\n {\n 'cmd' => '/export verbose',\n 'fn' => 'get_config',\n 'desc' => 'Get Device Config on Mikrotik Device'\n },\n ]\n exec_commands.each do |ec|\n command = ec['cmd']\n cmd_out = session.shell_command(command).gsub(/#{command}/, '')\n print_status(\"Gathering info from #{command}\")\n # detect if we're in pagination and get as much data as possible\n if ec['fn'] == 'get_config'\n mikrotik_routeros_config_eater(host, port, cmd_out.strip)\n else\n cmd_loc = store_loot(\"mikrotik.#{ec['fn']}\",\n 'text/plain',\n session,\n cmd_out.strip,\n \"#{ec['fn']}.txt\",\n ec['desc'])\n vprint_good(\"Saving to #{cmd_loc}\")\n end\n end\n end",
"def command_for(file, line)\n line = line.to_s\n words = Shellwords.shellwords(command)\n words.map! do |word|\n word.gsub!(/%f/, file)\n word.gsub!(/%l/, line)\n word.gsub!(/%%/, '%')\n word\n end\n end",
"def config_is_set(pid, key)\n require 'json'\n\n raw_json = `/opt/scripts/CQ-Unix-Toolkit/cqcfg \\\n -u admin \\\n -p admin \\\n -i http://localhost:4502 \\\n -j #{pid}`\n\n JSON.parse(raw_json)['properties'][key]['is_set']\n end",
"def sub_config\n puts config_script\n shell(config_script, source_dir(true))\n end",
"def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end",
"def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end",
"def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end",
"def extract_command; end",
"def extension_conf_files\n manifest.grep( /extconf.rb\\Z/ )\n end",
"def config_value\n @config_value ||= `#{CONFIG_CMD}`\n end",
"def find_config_path\n path = Pathname(Pathname.pwd).ascend{|d| h=d+config_filename; break h if h.file?}\n end",
"def test_config_string\n client.config(\"int et1/1\\ndescr panda\\n\")\n run = client.show('show run int et1/1')\n desc = run.match(/description (.*)/)[1]\n assert_equal(desc, 'panda')\n end",
"def test_config_string\n client.config(\"int et1/1\\ndescr panda\\n\")\n run = client.show('show run int et1/1')\n desc = run.match(/description (.*)/)[1]\n assert_equal(desc, 'panda')\n end",
"def template_config\n File.read(options['puppet_config_template'])\nend",
"def lookup_config(name)\n\t\tend",
"def compare_with(config)\n return nil if config.nil?\n existing = ''\n @ordered_keys.each do |config_line|\n command = config_line.strip\n submode = @configuration[command]\n fail StopIteration, 'Could not find submode.' if submode.nil?\n\n if special_command?(command)\n # match special exit/end command\n existing << config_line\n break\n elsif config.include_command?(command)\n # match whole command\n existing << config_line\n config_submode = config.submode_config(command)\n existing << submode.compare_with(config_submode)\n next\n end # if\n end\n existing\n end",
"def grep(what, options = {})\n options = GREP_OPTIONS.merge(options)\n git.grep(git_opts.merge(options), what).\n split(\"\\n\").\n map{|line|\n file, line, *others = line.split(':')\n {:file => file, :line => line, :text => others.join(':')}\n }\n end",
"def lookup_executable(args)\n executable = args[:executable]\n matches = packages_providing(\"*#{executable}\").join(\"\\n\")\n puts \"packages which provide executable:\\n#{matches}\".bold.blue\nend",
"def get_assign_command_for_device(device)\n if device.match(@assignable_disk_regex)\n \"assign letter=#{device[0,1]}\"\n elsif device.match(@assignable_path_regex)\n \"assign mount=\\\"#{device}\\\"\"\n end\n end",
"def command\n @property[:command]\n end",
"def find_command(commandline)\n aruba.command_monitor.find(commandline)\n end",
"def puppet_command\n puppet_command_obj.puppet_command\n end",
"def getConfigCmd(prop, value)\n\n case prop\n when 'type'\n # 'value' defines type of operation\n type = case\n when value == 'a' : 1\n when value == 'b' : 2\n when value == 'g' : 3\n else\n raise \"Unknown type. Should be 'a', 'b', or 'g'.\"\n end\n return \"iwpriv #{@deviceName} set_mode #{type}\"\n\n when \"mode\"\n # 'value' defines mode of operation\n mode = case\n when value == 'Managed' : 'managed'\n when value == 'managed' : 'managed'\n when value == 'Master' : 'master'\n when value == 'master' : 'master'\n when value == 'ad-hoc' : 'ad-hoc'\n when value == 'adhoc' : 'ad-hoc'\n when value == 'monitor' : 'monitor'\n else\n raise \"Unknown mode '#{value}'. Should be 'managed', or 'ad-hoc'.\"\n end\n return \"iwconfig #{@deviceName} mode #{mode} essid dummy channel 1\"\n\n when \"essid\"\n @essid = value\n return \"iwconfig #{@deviceName} essid #{value}\"\n\n when \"frequency\"\n return \"iwconfig #{@deviceName} freq #{value}\"\n\n when \"tx_power\"\n return \"iwconfig #{@deviceName} txpower #{value}\"\n\n when \"rate\"\n return \"iwconfig #{@deviceName} rate #{value}\"\n\n when \"rts\"\n return \"iwconfig #{@deviceName} rts #{value}\"\n\n when \"channel\"\n return \"iwconfig #{@deviceName} channel #{value}\"\n\n end\n super\n end",
"def config_source(key)\n return :cli if @original_config.include? key\n return :config if config_file_settings.key? key\n return :cli_default if default_config.include? key\n return :config_default if config_file_defaults.key? key # must come after :config check\n\n nil\n end",
"def config\n mode == \"autoinst_config\"\n end",
"def configName _args\n \"configName _args;\" \n end",
"def command log\n test_command=\"\"\n\n log.scan(/^.*#([^\\n]*)\\n.*\\#\\ \\.([^\\n]*)\\:/m).each do |data|\n test_command+=\"spec \" if test_command.empty? \n test_command+=\".#{data[1]},\"\n end\n\n log.scan(/^.*#(\\w+)\\s?\\[(.*)\\]/).each do |data|\n test_command+=\"ruby -Itest #{data[0]} -n #{data[1]};\"\n end\n\n test_command\n end",
"def command\n @attributes['command']\n end",
"def gitconfig\n return unless File.exist?('.git/config')\n lines = File.read('.git/config').split(\"\\n\")\n lines = lines.map do |line|\n md = /^\\s*url\\s*=\\s*ssh:\\/\\/git@git.nordstrom.net\\/its\\/(?<reponame>[\\w_]+).git/.match(line)\n line = \" url = git@gitlab.nordstrom.com:chef/cookbooks/#{md[:reponame]}.git\" if md\n line\n end\n File.write('.git/config', lines.join(\"\\n\"))\nend",
"def find_with_grep(text, where, double_quote, perl_regex = false)\n value = \"\"\n # Specifically double quote for finding 'test_help'\n command = if double_quote\n \"grep -rH \\\"#{text}\\\" #{where} | grep -v \\.svn\"\n else\n \"grep -rH '#{text}' #{where} | grep -v \\.svn\"\n end\n\n Open3.popen3(command) do |stdin, stdout, stderr|\n value = stdout.read\n end\n value\n end",
"def get_config_line(call_history)\n call_history.first.split(':in').first\n end",
"def locate_config_value(key)\n key = key.to_sym\n config[key] || Chef::Config[:knife][key]\n end",
"def command\n attributes.fetch(:command)\n end",
"def command\n attributes.fetch(:command)\n end",
"def read_conf(conf)\n File.open(conf).readlines.map {|line|\n line.chomp!\n if /@include (.*)/ =~ line\n line = read_conf($1)\n end\n line\n }.flatten\nend",
"def puppet_configprint(command = 'agent')\n PuppetConfigReader.new(self, command)\n end",
"def grepper(fileName,expression)\n IO.foreach(fileName){|line| puts line if line =~ /#{expression}(.*)/}\nend",
"def load_file\n # commands array\n cmd = Array.new\n @config.each do |key, value| \n if(key == LOAD_AVG) \n cmd[0] = @config.fetch(key)['readfile']\n cmd[1] = @config.fetch(key)['interval']\n elsif(key == DISC_SPACE) \n cmd[2] = @config.fetch(key)['shellexec']\n cmd[3] = @config.fetch(key)['interval']\n elsif(key == RESPONSE_TIME) \n cmd[4] = @config.fetch(key)['responsetime']\n cmd[5] = @config.fetch(key)['interval']\n elsif(@config.fetch(LOAD_AVG).keys[0] != 'readfile' and @config.fetch(DISC_SPACE).keys[0] != 'shellexec')\n begin\n raise\n rescue\n puts \"command not found. Quite!\"\n end\n end #if ends\n end #loop ends\n return cmd\nend",
"def puppet_resource_cmd\n UtilityLib::PUPPET_BINPATH + 'resource cisco_X__RESOURCE_NAME__X'\nend",
"def grep *args\n if exists?\n matches = read.split(\"\\n\").grep(*args)\n matches unless matches.empty?\n end\n end",
"def config_file\n CONFIG_FILE\n end",
"def get_location(dep)\n\n cmd_str = \"conan info #{dep} \" +\n \"--paths --only package_folder \" +\n \"\"\n\n resp_str = `#{cmd_str}`\n\n resp_str.lines.each do |line|\n return line.split(\": \")[1].strip if line.include?(\"package_folder\")\n end\n\nend",
"def find_command command_name,command_list\n variable = command_name.gsub(' ','').upcase\n command=<<-END\n # Looks for #{command_name} executable\n unset #{variable}\n for cmd in #{command_list}\n do\n which ${cmd} &>/dev/null\n if [ $? = 0 ]\n then\n #{variable}=${cmd}\n break\n fi\n done\n if [ -z \\\"${#{variable}}\\\" ]\n then\n echo ERROR: unable to find any #{command_name} executable\n exit 1\n fi\n echo #{command_name} executable set to ${#{variable}}.\n END\n return command\n end",
"def command_found; end",
"def custom_config_path\n argv.each_with_index do |arg, index|\n if arg == \"--config-path\" || arg == \"-c\"\n next_arg = argv[index + 1]\n raise ConfigPathNotProvided.new if next_arg.nil?\n raise ConfigPathInvalid.new(next_arg) unless File.file?(next_arg) && File.readable?(next_arg)\n\n return next_arg\n end\n end\n nil\n end",
"def command\n case first\n when '\\?' then Command::HelpCommand\n when '\\config' then Command::PrintConfigCommand\n else\n puts \"Unknown command: #{buffer}\"\n end\n end",
"def filter_command(envs, cmd)\n new_env = {}\n merged_path = ENV[\"PATH\"].split(/:/)\n new_cmd = cmd\n envs.each do |env|\n case env\n when /=/\n k,v = env.split(/\\s*=\\s*/, 2)\n expand_parm(k,v,cmd) {|c, ae, p| new_env.update(ae); new_cmd = c; merged_path << p; }\n else\n expand(env,cmd) {|c, ae, p| new_env.update(ae); new_cmd = c; merged_path << p; }\n end\n end\n ENV[\"PATH\"] = merged_path.uniq.compact.join(\":\")\n [new_cmd.flatten.compact, new_env]\nend",
"def get_key_from_command(argv)\n case argv[0].to_s.downcase\n when \"info\",\"multi\",\"exec\",\"slaveof\",\"config\",\"shutdown\",\"select\"\n nil\n else\n # Unknown commands, and all the commands having the key\n # as first argument are handled here:\n # set, get, ...\n argv[1]\n end\n end",
"def read_from_cmdline\n require \"shellwords.rb\"\n words = Shellwords.shellwords(\n if not ARGV.empty?\n ARGV.join(' ')\n else\n STDERR.print \"(offline mode: enter name=value pairs on standard input)\\n\" if STDIN.tty?\n readlines.join(' ').gsub(/\\n/, '')\n end.gsub(/\\\\=/, '%3D').gsub(/\\\\&/, '%26'))\n\n if words.find{|x| x =~ /=/} then words.join('&') else words.join('+') end\n end",
"def aliases(cmd)\n COMMAND_ALIASES.each { |k,v| return k if v.include?(cmd) }\n nil\n end",
"def command_name\n return FIND if filter[:$query]\n filter.keys.first\n end",
"def read(filename = Config_File_Name)\n sec = nil\n begin\n File.open(filename, 'r') do |f|\n while line = f.gets\n line.chop!\n if Regexp.new(CommentLine).match(line)\n elsif (SEC_ALL_SYM + [DEF_S, OUTPUT_S]).include?(line.chop.to_sym)\n sec = line.chop.to_sym\n elsif match = Regexp.new(Assignment).match(line)\n if sec == nil\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' assignment before a section is selected')\n end\n name = match[NameIndex].to_sym\n value = match[ValIndex]\n if e = set(sec, name, value)\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' ' + e)\n #break\n end\n else\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' invalid line, ignored')\n #break\n end\n end\n end\n rescue => e\n Log.err e.message\n end\n end",
"def grep_search search_dir\n args = ['-r']\n end",
"def find_command_for expression\n # if there's an exact match return that first\n return commands[expression] if commands[expression]\n\n commands.each do |key, val|\n if key.kind_of? Regexp\n return val if key =~ expression\n end\n end\n\n return false\n end",
"def get_config_file_project_name\n @metadata[\"short_dest_repo_name\"]\n end",
"def search_for_command(command)\n @command_map[ command ]\n end",
"def config(key)\n env_key = ENV[key.upcase.gsub(/[\\.-]/, '_')]\n return env_key if env_key and not env_key.strip.empty?\n\n str_to_bool `git config --global --get-all #{key}`.strip\n end",
"def configFile \n \"configFile\" \n end",
"def cron_command\n cron_content = master.run_shell('crontab -l').stdout\n collector_line = cron_content.split(\"\\n\").select do |line|\n line =~ %r{splunk_hec_collect_api_events.rb}\n end\n collector_line.join.split[-3..-1].join(' ')\nend",
"def command\n ([executable] + options_composition + @redirections).join(\" \")\n end",
"def get_param_index\n @grep = %x[pgrep -lf geth]\n @arr = @grep.split('--')\n @arr.each do |data|\n #puts data.rtrim\n end\n end",
"def command(name)\n commands.find { |command| command.name == name.to_s }\n end",
"def get_command_line_argument\n if ARGV.empty?\n puts \"Usage: ruby lookup.rb <domain>\" \n exit\n end ARGV.first # get frst argument in commnad line\nend",
"def find_config_file\n if ENV[\"SMITH_CONFIG\"]\n to_pathname(ENV[\"SMITH_CONFIG\"]).tap do |path|\n raise ConfigNotFoundError, \"Cannot find a config file name: #{path}\" unless path.exist?\n end\n else\n user = [\"./.#{CONFIG_FILENAME}\", \"#{ENV['HOME']}/.#{CONFIG_FILENAME}\"].map { |p| to_pathname(p) }\n system = [\"/etc/#{CONFIG_FILENAME}\", \"/etc/smith/#{CONFIG_FILENAME}\"].map { |p| to_pathname(p) }\n default = [default_config_file]\n\n (user + system + default).detect { |path| path.exist? }\n end\n end",
"def filename( )\n @configFileDNE\n end",
"def read_config_file; end",
"def unset_command\n [grep_cmd, '&&', unset_cmd].join(' ')\n end",
"def grep(expr, filename='')\n\tif filename == ''\n\t\tlines = STDIN.readlines\n\telse\n\t\tbegin\n\t\t\tFile.open(filename, \"r\") do |f|\n\t\t\t\tlines = f.readlines\n\t\t\tend\n\t\trescue SystemCallError => e\n\t\t\tSTDERR.puts \"#{filename}: Error: could not read from file (#{e}).\"\n\t\t\treturn\n\t\tend\n\tend\n\tfor line in lines\n\t\tif line =~ Regexp.new(expr)\n\t\t\tputs \"#{filename}: #{line}\"\n\t\tend\n\tend\n\nend",
"def command_name; end"
] |
[
"0.5852091",
"0.5773518",
"0.57331246",
"0.5667553",
"0.5643085",
"0.5566762",
"0.55313295",
"0.5511817",
"0.5504865",
"0.5457773",
"0.5404175",
"0.53757",
"0.53671145",
"0.5356291",
"0.53178984",
"0.5289387",
"0.5241179",
"0.5232754",
"0.5229069",
"0.52215624",
"0.5180762",
"0.5156016",
"0.5149664",
"0.51023865",
"0.5084452",
"0.5071984",
"0.5071984",
"0.5071984",
"0.5070373",
"0.50682944",
"0.5060811",
"0.5056472",
"0.505382",
"0.50252664",
"0.5020985",
"0.5012191",
"0.5012191",
"0.5012191",
"0.4991166",
"0.49798813",
"0.49790853",
"0.4978025",
"0.49657542",
"0.49657542",
"0.49575606",
"0.49540246",
"0.4952395",
"0.4937595",
"0.49330348",
"0.49291468",
"0.49217868",
"0.49183327",
"0.49130294",
"0.49117166",
"0.491044",
"0.4901968",
"0.49014914",
"0.48949787",
"0.48890764",
"0.48885572",
"0.48739558",
"0.4867028",
"0.48462668",
"0.4837233",
"0.4837233",
"0.48208648",
"0.48195848",
"0.48164585",
"0.481302",
"0.48088905",
"0.48062003",
"0.48049068",
"0.48043197",
"0.48025385",
"0.47984618",
"0.47958744",
"0.47921827",
"0.47850132",
"0.47793755",
"0.47652793",
"0.4765199",
"0.4756265",
"0.4755691",
"0.4752843",
"0.47525853",
"0.47472474",
"0.4740066",
"0.4739291",
"0.47389698",
"0.47326252",
"0.47255793",
"0.47235787",
"0.4721853",
"0.47218174",
"0.47210467",
"0.47198167",
"0.47159088",
"0.47153223",
"0.47141504",
"0.471178"
] |
0.6838154
|
0
|
Returns command to replace assignment
|
def replace_cmd
sprintf 'sed -i "s/%s.*/%s%s/" %s', key_set_string, key_set_string, @config[:value], @file
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def commandalias(command, a)\r\n\t\t\t@commands[a] = @commands[command]\r\n\t\tend",
"def assignment\n @name = get_name\n match '='\n expression\n emit_ln \"LEA #{@name} (PC),A0\"\n emit_ln 'MOVE D0,(A0)'\nend",
"def set_command\n [grep_cmd, '&&', replace_cmd, '||', append_cmd].join(' ')\n end",
"def replace_command(command)\n return @apps[command] if @apps.has_key?(command)\n return command\n end",
"def substitute_command_variables(cmd)\n substitutions = {\n /@APPLICATION@/ => @application.name,\n /@APP@/ => @application.name,\n /@ENVIRONMENT@/ => @environment.name,\n /@ENV@/ => @environment.name,\n /@RUBY@/ => @instance_paths.ruby_path,\n /@GEM@/ => @instance_paths.gem_path,\n /@CHEF@/ => @instance_paths.chef_path,\n /@KNIFE@/ => @instance_paths.knife_path\n }\n substitutions.keys.each {|key| cmd.gsub!(key, substitutions[key]) }\n cmd\n end",
"def get_assign_command_for_device(device)\n if device.match(@assignable_disk_regex)\n \"assign letter=#{device[0,1]}\"\n elsif device.match(@assignable_path_regex)\n \"assign mount=\\\"#{device}\\\"\"\n end\n end",
"def replace_pattern\n id = Readline.readline(\"ID of task to perform replace: \").to_i\n old_pattern = Readline.readline('replace : ').chomp\n new_pattern = Readline.readline('with : ').chomp\n ok = ReplacePattern.new(id, old_pattern, new_pattern).execute\n puts \"No such task\" if !ok\n end",
"def updateCmd(cmd)\n @cmd = cmd\n end",
"def `(cmd)\n @backtick_capture = cmd\n nil\n end",
"def commandalias(command, a)\r\n\t$gamemode.commandalias(command, a)\r\nend",
"def cmd_after_replace(file, lineno, content, cmd)\n change_line(file, lineno, content)\n cmd\n end",
"def translate_shortcut(cmd)\n command_lookup_table[cmd] || cmd\n end",
"def formulate_command\n @command\n end",
"def test_assignment_binds_are_substituted\n table = Table.new(:users)\n um = Arel::UpdateManager.new Table.engine\n bp = Nodes::BindParam.new '?'\n um.set [[table[:name], bp]]\n visitor = Class.new(Arel::Visitors::ToSql) {\n include Arel::Visitors::BindVisitor\n }.new Table.engine.connection\n\n assignment = um.ast.values[0]\n actual = visitor.accept(assignment, collector) {\n \"replace\"\n }\n assert actual\n value = actual.value\n assert_like \"\\\"name\\\" = replace\", value\n end",
"def command=(com)\n\n com = com.is_a?(Array) ? com : com.split(' ')\n com = [ com.first, com.last ]\n com[1] = com[1].to_i if com[1] and com[0] != 'jump'\n\n h.fields['__command__'] = com\n end",
"def command_string\n\t\treturn datastore['CMD'] || ''\n\tend",
"def pyper_mm symbol, command_string, **opts\n code = PostfixMachine.new( command_string ).compile( symbol, opts )\n code.gsub! /^alpha = alpha\\n/, \"alpha\\n\" # workaround\n code.gsub! /^alpha\\nalpha\\n/, \"alpha\\n\" # workaround\n code.gsub! /^alpha\\nalpha =/, \"alpha =\" # workaround\n code.gsub! /^alpha = alpha =/, 'alpha =' # workaround\n puts code if Pyper::DEBUG > 0\n self.class.module_eval( code )\n end",
"def default_command(command)\n @@default_command = command.to_sym\n end",
"def command(cmd)\n \"do_#{cmd}\".intern\n end",
"def backtick\n @out = `#{@command}`\n self\n end",
"def getCommand(state)\n\treturn 'e ' << state.to_s\nend",
"def operators= new_ops\n @operators = new_ops.gsub(/[^+*-]/, '').split(//)\n reset\n end",
"def redefine_command(obj, command)\n cmd_block = redefine_command_block(obj, command)\n @no_option_commands << command if command.options.nil?\n [command.name, command.alias].compact.each {|e|\n obj.instance_eval(\"class<<self;self;end\").send(:define_method, e, cmd_block)\n }\n end",
"def replace_placeholder_string(expression, variable_old, variable_new)\n if expression.is_a? Yarpler::Models::Expression\n expression.left = replace_placeholder_string(expression.left, variable_old, variable_new)\n expression.right = replace_placeholder_string(expression.right, variable_old, variable_new)\n elsif expression.is_a? Yarpler::Models::Field\n expression.variable = variable_new if expression.variable == variable_old\n end\n expression\n end",
"def corrector=(_); end",
"def command(cmd)\n if VNMNetwork::COMMANDS.keys.include?(cmd.to_sym)\n cmd_str = \"#{VNMNetwork::COMMANDS[cmd.to_sym]}\"\n else\n cmd_str = \"#{cmd}\"\n end\n\n return cmd_str\n end",
"def debug_set(cmd)\n $stderr.puts '--- DEBUG ---'\n $stderr.puts \"SET #{cmd[0].downcase} = #{cmd[1].to_s.upcase}\"\n $stderr.puts ''\n end",
"def raw=(_); end",
"def command_name=(_arg0); end",
"def update!(**args)\n @operator_name = args[:operator_name] if args.key?(:operator_name)\n end",
"def update!(**args)\n @operator_name = args[:operator_name] if args.key?(:operator_name)\n end",
"def update!(**args)\n @operator_name = args[:operator_name] if args.key?(:operator_name)\n end",
"def update!(**args)\n @operator_name = args[:operator_name] if args.key?(:operator_name)\n end",
"def update!(**args)\n @operator_name = args[:operator_name] if args.key?(:operator_name)\n end",
"def update!(**args)\n @operator_name = args[:operator_name] if args.key?(:operator_name)\n end",
"def update!(**args)\n @operator_name = args[:operator_name] if args.key?(:operator_name)\n end",
"def update!(**args)\n @operator_name = args[:operator_name] if args.key?(:operator_name)\n end",
"def command\n return @command.underscore if @command.is_a?(String)\n @command\n end",
"def replace\n end",
"def add_original_commands; end",
"def set_commands; end",
"def store expression, variable_name\r\n command 'store', expression, variable_name\r\n end",
"def replace(line)\n return line if line !~ /\\{\\{Gc/\n return line if line =~ /link=none/ || line =~ /dis=false/ || line =~ /dis=true/\n return line.gsub!(/\\{\\{[Gg]c|mod=(\\S+)\\|/, '{{Gc|mod=\\1|dis=false|')\nend",
"def command\n attributes.fetch(:command)\n end",
"def command\n attributes.fetch(:command)\n end",
"def command=(cmd)\n set(\"drmaa_remote_command\", cmd) \n end",
"def original_run_command=(_arg0); end",
"def command_pp\n to_s.gsub(/^_/, \"\").downcase\n end",
"def replace(p0) end",
"def replace(p0) end",
"def replace(p0) end",
"def execute\n\t\t\tres = instance_exec(@node, &Glyph::MACROS[@name]).to_s\n\t\t\tres.gsub(/\\\\*([\\[\\]\\|])/){\"\\\\#$1\"}# : res\n\t\tend",
"def command_name; end",
"def cmd!(command)\n self << command\n end",
"def replace(*args)\n execute_dui(replace_sql(*args)){|c| return c.last_id}\n end",
"def unset_cmd\n sprintf 'sed -i /%s/d %s', key_set_string, @file\n end",
"def replace(key)\n instance_variable_get(\"@#{key}\").to_s\n end",
"def process_assignment(galactic_word,roman_symbol)\n Translation::galactic_words_roman_symbol_assignments[galactic_word] = roman_symbol #e.g {\"glob\"=>\"I\"}\n end",
"def simple_assign(symbol, rexp)\n @engine.assign(symbol.to_s, rexp, nil)\n end",
"def compile_assignment(identifier)\n shift :equal\n\n if identifier.type == :identifier\n variable = set(identifier)\n value = compile_vexpression\n variable.value = value\n else\n value = compile_vexpression\n variable = identifier\n end\n\n code :set, variable, value\n end",
"def subst_symb!(nonterm, string)\n each_nonterm(nonterm) { |node| node.value = string }\n end",
"def issue_reassignments\n Pkg::Params::REASSIGNMENTS.each do |v|\n oldval = self.instance_variable_get(\"@#{v[:oldvar]}\")\n newval = self.instance_variable_get(\"@#{v[:newvar]}\")\n if newval.nil? && oldval\n self.instance_variable_set(\"@#{v[:newvar]}\", oldval)\n end\n end\n end",
"def store_editable locator, variable_name\r\n command 'storeEditable', locator, variable_name\r\n end",
"def raw_command\n @raw_command ||= @raw.split[0] || \"\"\n end",
"def redefine_command_block(obj, command)\n object_methods(obj)[command.name] ||= begin\n obj.method(command.name)\n rescue NameError\n raise Error, \"No method exists to redefine command '#{command.name}'.\"\n end\n lambda {|*args|\n Scientist.analyze(obj, command, args) {|args|\n Scientist.object_methods(obj)[command.name].call(*args)\n }\n }\n end",
"def dest\n if (@currentCommand.include?'=')\n result = \"\"\n if (@currentCommand.slice(0) == \"0\")\n result = \"null\"\n else\n endmarks = Array['=', ';']\n i = 0\n\n while (endmarks.include?(@currentCommand.slice(i)) != true)\n result += @currentCommand.slice(i)\n i += 1\n end\n end\n else\n result = 'null'\n end\n return result\n end",
"def resolveSTR(command)\r\n splitString = command.split(' ')\r\n currSymbol = splitString[1]\r\n currIndex = findIndex(currSymbol)\r\n puts currIndex.to_s\r\n if(currIndex == -1)\r\n puts \"Symbol has not been declared or did not receive a symbol at all. Exiting.\"\r\n exit\r\n end\r\n @DecValues[currIndex] = @RegA\r\n temp = @DecValues[currIndex].to_s\r\n puts temp + \" has been loaded into \" + @Declarations[currIndex].to_s + \".\"\r\n end",
"def setq(sym, expr)\n\t\tif expr.is_a?(String)\n\t\t\tif expr.match(/\\(list/)\t\n\t\t\t\tstr = \"(setq #{sym.to_s} #{expr.to_s})\" \n\t\t\telse\t\n\t\t\t\tstr = \"(setq #{sym.to_s} \\\"#{expr.to_s}\\\")\" \n\t\t\tend\t\n\t\t\tputs str\n\t\telse\n\t\t\tstr = \"(setq #{sym.to_s} #{expr.to_s})\" \n\t\t\tputs str\n\n\t\tend\t\n\t\tlisp_eval str\n\tend",
"def command(command_text)\n @command_text = command_text\n end",
"def unset_command\n [grep_cmd, '&&', unset_cmd].join(' ')\n end",
"def normalize_command_name(meth) #:nodoc:\n return default_command.to_s.tr(\"-\", \"_\") unless meth\n\n possibilities = find_command_possibilities(meth)\n raise AmbiguousTaskError, \"Ambiguous command #{meth} matches [#{possibilities.join(', ')}]\" if possibilities.size > 1\n\n if possibilities.empty?\n meth ||= default_command\n elsif map[meth]\n meth = map[meth]\n else\n meth = possibilities.first\n end\n\n meth.to_s.tr(\"-\", \"_\") # treat foo-bar as foo_bar\n end",
"def cmd; end",
"def variable!(string)\n string.replace(variable(string))\n end",
"def substitute_parts\n if @id\n assign_id_from_uuid\n @command_string.gsub!(':id', @id.to_s)\n return self\n end\n raise TaskwarriorWeb::CommandBuilder::MissingTaskIDError\n end",
"def operator=(_arg0); end",
"def edit(command, value=nil)\n command = command.gsub(/_./) { |i| i[1].upcase }\n \n focus\n\n if value\n `#{document}.native.execCommand(#{command}, false, #{value})`\n else\n `#{document}.native.execCommand(#{command}, false)`\n end\n end",
"def args_replace command, name, args, expression\n initial_offset = offset = (command =~ /\\b#{Regexp.escape name}\\(/) + name.length + 1\n bracket_count = 1\n\n # find the last bracket\n while offset < command.length\n if command[offset] == ?(\n bracket_count += 1\n elsif command[offset] == ?)\n bracket_count -= 1\n break if bracket_count == 0\n end\n\n offset += 1\n end\n\n args_expr = command[initial_offset..(offset - 1)].split(\",\").map(&:strip)\n\n # passed the wrong number of arguments to this function\n if args_expr.length != args.length\n raise Exception.new(\"Error: wrong number of arguments for call to #{name} in command '#{command}'\")\n end\n\n # do the substitutions\n command[0..(initial_offset - name.length - 2)] + \"(\" + args.zip(args_expr).inject(expression) do |result, (find, repl)|\n result.gsub(/\\b#{Regexp.escape find}\\b/, \"(\" + repl + \")\")\n end + \")\" + command[(offset + 1)..-1]\nend",
"def command\n return @raw_command\n end",
"def to_s\n return command\n end",
"def change_make_var! flag, new_value\n new_value = \"#{flag}=#{new_value}\"\n sub = gsub! Regexp.new(\"^#{flag}[ \\\\t]*=[ \\\\t]*(.*)$\"), new_value, false\n opoo \"inreplace: changing '#{flag}' to '#{new_value}' failed\" if sub.nil?\n end",
"def alias_cmd(key, value)\n @aliases[key] = value\n end",
"def resolveJMP(command)\r\n splitString = command.split(' ')\r\n currSymbol = splitString[1]\r\n intVal = Integer(currSymbol)\r\n @PC = intVal\r\n puts \"Changing control to instruction at \" + @PC.to_s\r\n end",
"def command_name(cmd)\n cmd\n end",
"def command_name(name = T.unsafe(nil)); end",
"def command; datastore['COMMAND']; end",
"def statement=(_arg0); end",
"def command(name)\n commands[name]\n end",
"def command(name)\n commands[name]\n end",
"def command(name)\n commands[name]\n end",
"def store_expression expression, variable_name\r\n command 'storeExpression', expression, variable_name\r\n end",
"def process_assignment(galactic_word,roman_symbol)\n\t\tTranslation::galactic_words_roman_symbol_assignments[galactic_word] = roman_symbol #e.g {\"glob\"=>\"I\"}\n\tend",
"def redefine_command(obj, command)\n cmd_block = redefine_command_block(obj, command)\n @no_option_commands << command if command.options.nil?\n [command.name, command.alias].compact.each {|e|\n obj.singleton_class.send(:define_method, e, cmd_block)\n }\n rescue Error\n warn \"Error: #{$!.message}\"\n end",
"def cmd(command)\n\t\tbegin\n\t\t\t`#{command}`\n\t\trescue Exception => e\n\t\t\te.to_s\n\t\tend\n\tend",
"def replace_this_with_appropriate_code(x) end",
"def add_original_commands\n end",
"def cmd(string)\n @commands << string\n end",
"def replaceProgramme()\n @media_operation = :replace\n end",
"def update!(**args)\n @command_id = args[:command_id] if args.key?(:command_id)\n end",
"def update!(**args)\n @command_id = args[:command_id] if args.key?(:command_id)\n end",
"def replace_symbol(sym, new_sym)\n\t\t\tsyo = get_symbol(sym)\n\t\t\tsyn = get_symbol(new_sym)\n\n\t\t\t@rules.each do |r|\n\t\t\t\tr.equation.replace_ident(sym, new_sym)\n\t\t\tend\n\n\t\t\tif @parameters[sym]\n\t\t\t\t@parameters.delete(sym)\n\t\t\telse\n\t\t\t\t@species.delete(sym)\n\t\t\tend\n\n\t\t\tself.validate\n\n\t\t\tsyo\n\t\tend"
] |
[
"0.57952",
"0.57925004",
"0.57658553",
"0.5744737",
"0.5702929",
"0.5698701",
"0.5654884",
"0.5598732",
"0.55923104",
"0.551631",
"0.550902",
"0.54576415",
"0.54512185",
"0.5422192",
"0.5418369",
"0.54174066",
"0.5400889",
"0.5389654",
"0.53807616",
"0.53190607",
"0.5291826",
"0.52710676",
"0.5256732",
"0.5241153",
"0.52118033",
"0.52116066",
"0.52097344",
"0.51902616",
"0.5188857",
"0.518326",
"0.518326",
"0.518326",
"0.518326",
"0.518326",
"0.518326",
"0.518326",
"0.518326",
"0.5175754",
"0.5173111",
"0.5166178",
"0.5160841",
"0.516061",
"0.5148469",
"0.514192",
"0.514192",
"0.5134852",
"0.51219034",
"0.51084024",
"0.51035494",
"0.51035494",
"0.510114",
"0.50983465",
"0.5083078",
"0.50763756",
"0.5072071",
"0.5068104",
"0.5060728",
"0.506064",
"0.50587666",
"0.50467724",
"0.504208",
"0.50376654",
"0.5033886",
"0.5033239",
"0.50308084",
"0.5024688",
"0.50075245",
"0.5000416",
"0.49966297",
"0.4993412",
"0.49870127",
"0.49860558",
"0.4982816",
"0.49809352",
"0.49794495",
"0.49762988",
"0.49761215",
"0.4975353",
"0.4964483",
"0.49547684",
"0.49538788",
"0.4948294",
"0.49410433",
"0.49376586",
"0.4934968",
"0.49308968",
"0.4930354",
"0.4930354",
"0.4930354",
"0.4930269",
"0.49299932",
"0.4923395",
"0.49204126",
"0.4916878",
"0.49059406",
"0.49049523",
"0.49019247",
"0.4889096",
"0.4889096",
"0.48875898"
] |
0.57441646
|
4
|
Returns command to append assignment to config file
|
def append_cmd
sprintf 'echo "%s%s" >> %s', key_set_string, @config[:value], @file
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def setconfig(str)\n add_cmd str\n end",
"def configure_command(cmd)\n end",
"def add_new_config\n name = @options.new_config[0]\n path = @options.new_config.length == 2 ? @options.new_config[1] : nil\n # makes a call to generate a default configuration file\n new_file = OutputOperator.new_default_configuration(name, path)\n LoggerOperator::info(\"A template configuration file was created at #{new_file}.\")\n exit\n end",
"def append filename, config\n @config << ({\n file: filename,\n config: config\n })\n end",
"def << command\n log.info(cli_option(:name)) { \"<< #{command}\" }\n self.write(command + \"\\n\")\n @cli_last_command = command\n self\n end",
"def cmd!(command)\n self << command\n end",
"def write_config()\nafile = File.open(\"cp3nodes.conf\", \"w\")\nafile.puts \"1 127.0.0.1 25500 25501 25502\\n\"\nafile.puts \"2 127.0.0.1 25503 25504 25505\\n\"\nafile.puts \"3 127.0.0.1 25506 25507 25508\\n\"\nafile.close\nend",
"def append(key, value)\n send_command([:append, key, value])\n end",
"def append_commands(_command = '', user_ac = '', _opts = {})\n user_ac\n end",
"def set_command\n [grep_cmd, '&&', replace_cmd, '||', append_cmd].join(' ')\n end",
"def run_cmd\n cmds = []\n cmds << @resource[:section] if @resource[:section]\n cmds << @property_flush[:command]\n node.config(cmds)\n end",
"def register_command cmd\n $commandlist << cmd\nend",
"def install_command\n command = ['helm', 'upgrade', name, chart] +\n install_flag +\n reset_values_flag +\n optional_tls_flags +\n optional_version_flag +\n rbac_create_flag +\n namespace_flag +\n value_flag\n\n command.shelljoin\n end",
"def cmd(string)\n @commands << string\n end",
"def write_config\n File.open(CONFIG_OUT, 'w') do |f|\n f.write(ssh_config + \"\\n\")\n end\nend",
"def add_config(key, value)\n system(\"git config --global --add #{key} '#{value}'\")\n end",
"def write_conf\n template(new_resource.config_path) do\n source 'rsyncd.conf.erb'\n cookbook 'rsync'\n owner 'root'\n group 'root'\n mode '0640'\n variables(\n globals: global_modules,\n modules: rsync_modules\n )\n notifies :restart, \"service[#{node['rsyncd']['service']}]\", :delayed\n end\n\n service node['rsyncd']['service'] do\n action :nothing\n end\nend",
"def command\n ([executable] + options_composition + @redirections).join(\" \")\n end",
"def command\n if new_resource.command.is_a?(Array)\n [new_resource.python] + new_resource.command\n else\n \"#{new_resource.python} #{new_resource.command}\"\n end\n end",
"def add_command(name, symbol, enabled = true, ext = nil)\r\n @list.push({:name=>name, :symbol=>symbol, :enabled=>enabled, :ext=>ext})\r\n end",
"def command_config(str_opts)\n command :config do |c|\n c.syntax = 'budik config [options]'\n c.summary = @str_config.summary\n c.description = @str_config.description\n c.option '-r', '--reset', str_opts.reset\n c.action { |_args, opts| Command.new(:config, opts) }\n end\n end",
"def append!\n self.operation = :append\n end",
"def add_commands\n end",
"def append_to_file(path, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n config[:before] = /\\z/\n insert_into_file(path, *(args << config), &block)\n end",
"def manifest_write_cmd(id, manifest_src)\n ['write', manifest_filename(id), manifest_src]\n end",
"def command(config_file)\n return \"#{adjust_python_path} python #{kernel} -m #{config_file} #{args.join(' ')}\"\n end",
"def config(command)\n ensure_mode(:configuration)\n run(command)\n end",
"def command(name, key, value, type) \n return unless %w(Add Set).include?(name)\n type = name == 'Add' ? \" #{type}\" : '' \n system \"/usr/libexec/PlistBuddy -c '#{name} :#{key}#{type} #{value}' #{@plist_file}\"\n end",
"def append_mode(line)\n File.open(\"#{file}\",\"a\") {|file| file.puts line}\n end",
"def write_configure(config = nil)\n config ||= $configure\n File.open($configure_file, \"w\"){|f| YAML.dump(config, f)}\nend",
"def add_command(key, value)\n return unless key && value\n\n @commands ||= {}\n @commands[key] = value\n end",
"def write_config_entry(key, value)\n if $has_config.call then\n curr_config = YAML.load(File.read($config_filename))\n else\n curr_config = {}\n end\n\n curr_config[key] = value\n\n File.open($config_filename, 'w') { |f| f.write(curr_config.to_yaml) }\nend",
"def createArqConfig (config, arq)\n\t\tFile.open(arq, 'a+') do |f2|\n \t\t\tf2.puts config\n \t\tend\n\tend",
"def commands=(cmd)\n @queue << \"com #{cmd}\"\n end",
"def add_command(*args)\n case args.size\n when 1 # Hash initializer\n args = args[0]\n cat = args[:category] ? args[:category] : :main\n content = {\n :name => args[:name],\n :symbol => args[:symbol],\n :enabled => args[:enabled].nil? ? true : args[:enabled],\n :ext => args[:ext],\n :help => args[:help],\n :child => args[:child],\n }\n else\n name = args[0]; symbol = args[1]; \n enabled = args[2].nil? ? true : args[2];\n ext = args[3]\n help = args[4]\n cat = args[5].nil? ? :main : args[5];\n child = args[6]\n content = {:name=>name, :symbol=>symbol, :enabled => enabled,\n :ext=>ext, :help => help, :child => child}\n end\n (@list[cat] ||= []) << content\n end",
"def command_config var, val\n config = @data_connection.options.merge({var.intern => val})\n @data_connection.set_options config\n end",
"def put_config config = { 'room' => [ { 'name' => 'default-room', 'device' => [ 'light' => { 'name' => 'default-device' } ] } ] }\n File.open( self.get_config_file, 'w' ) do | handle |\n handle.write YAML.dump( config )\n end\n self.get_config_file\n end",
"def saveMuConfig(cfg)\n home = Etc.getpwuid(Process.uid).dir\n username = Etc.getpwuid(Process.uid).name\n cfg_file = \"/opt/mu/etc/mu.yaml\"\n if Process.uid == 0\n cfg_file = ENV['MU_INSTALLDIR']+\"/etc/mu.yaml\" if ENV.include?('MU_INSTALLDIR')\n else\n cfg_file = \"#{home}/.mu.yaml\"\n end\n puts \"**** Saving master config to #{cfg_file} *****\"\n File.open(cfg_file, File::CREAT|File::TRUNC|File::RDWR, 0644){ |f|\n f.puts cfg.to_yaml\n }\nend",
"def prepend(key, command, options = {})\n case key\n when 'env'\n if options['name'] && options['value']\n \"#{options['name']}=#{options['value']} #{command}\"\n else\n command\n end\n when 'sudo'\n \"sudo #{options['args']} #{command}\"\n when 'generic'\n if options['modifier_str']\n \"#{options['modifier_str']} #{command}\"\n else\n command\n end\n end\n end",
"def add_command(meth)\n @@commands.delete(:help)\n \n if @@attribute\n argument_list = \"value\"\n meth = meth.to_s.delete(\"=\").to_sym if @@attribute == :attr_writer\n else\n argument_list = parse_arguments(@@command_options[:parameters])\n end\n @@command_options.merge!(:argument_list=>argument_list,:class => self.name)\n \n @@commands.merge!(meth => @@command_options)\n @@default_method = {meth => @@command_options} if @@command_options[:default]\n\n @@commands.sort.each {|com| @@commands.merge!(com[0]=>@@commands.delete(com[0]))}\n \n @@commands.merge!(HELP_COMMAND.dup) # makes sure the help command is always last\n @@command_options = nil\n @@attribute = nil\n end",
"def add_line_to_file file_path,line\n return \"echo #{line} >> #{file_path}\"\n end",
"def buildgdbcommandfile\n return if @cmdfilepath\n @cmdfilepath = '/tmp/symsymcmd.txt'\n cmdfile = File.new(@cmdfilepath, 'w+')\n self.addresses.each do |l|\n cmdfile << \"info line *#{l}\\n\"\n end\n cmdfile.close\n end",
"def setconfig(str)\n command = \"#{command(:cfg)} -z #{@resource[:name]} -f -\"\n debug \"Executing '#{command}' in zone #{@resource[:name]} with '#{str}'\"\n IO.popen(command, \"w\") do |pipe|\n pipe.puts str\n end\n\n unless $CHILD_STATUS == 0\n raise ArgumentError, \"Failed to apply configuration\"\n end\n end",
"def command=(cmd)\n set(\"drmaa_remote_command\", cmd) \n end",
"def append_cfg(cfg)\n return unless cfg.respond_to? \"[]\"\n keys=@cfg.keys.map{|e| e.to_s}.sort\n cfg.each_key do |k|\n #like R, partial match of the parameter names\n if k2=keys.find{|e| e=~/^#{k}/}\n @cfg[k2.to_sym]=cfg[k]\n end\n end\n ## puts \"append_cfg\";p @cfg\n end",
"def append2file(file, name, string)\n\t_block_start = \"# #{name} added by chef {\"\n\t_block_end = \"# }\\n\"\n\t_block = \"#{_block_start}\\n#{string}\\n#{_block_end}\\n\"\n\n\tbash \"Remove #{name} from #{file}\" do\n\t\tcode <<-EOC\n\t\t\tperl -0777 -pi -e 's/\\n*#{_block_start}.*?#{_block_end}//gs' #{file}\n\t\tEOC\n\t\tonly_if \"cat #{file} | grep -q '#{_block_start}'\"\n\tend\n\tbash \"Add #{name} to #{file}\" do\n\t\tcode <<-EOC\n\t\t\techo '' >> #{file}\n\t\t\techo '#{_block_start}' >> #{file}\n\t\t\techo '#{string}' >> #{file}\n\t\t\techo '#{_block_end}' >> #{file}\n\t\tEOC\n\t\tnot_if \"cat #{file} | grep -q '#{_block_start}'\"\n\tend\nend",
"def caddmod(m, nick)\n if is_supadmin?(m.user)\n $moderators << nick\n $config['moderator'] = $moderators\n File.open($conffile, 'wb') { |f| f.write $config.to_yaml }\n m.reply \"#{nick} has been added as a moderator.\", true\n else\n m.reply NOTADMIN, true\n end\n end",
"def action_add\n notifying_block do\n create_config\n end\n end",
"def command\n return \"#{@command} #{options}\"\n end",
"def create_config_file\n f = File.open(\"#{repo_dir}/.ram_config\", \"w+\")\n f.write \"url: #{@url}\"\n f.close\n end",
"def add_command(klass, *args)\n @command.deep_copy.add_command(klass, *args)\n end",
"def append_line_to_file(path, line)\n run \"echo '#{line}' | #{sudo} tee -a #{path}\", options\n end",
"def write\n return if @options == @original_options\n f = IO.popen('php', 'r+')\n f.write \"<?php var_export(json_decode('#{options_php_json}', true));\\n\"\n f.close_write\n data = f.read\n f.close\n File.open(@file, 'w') { |of| of.write \"<?php\\n$CONFIG = #{data};\\n\" }\n Chef::Log.info('OwnCloud config writen')\n rescue StandardError => e\n raise \"Error writing ownCloud configuration: #{e.message}\"\n end",
"def command(rule, vars)\n raise \"Invalid rule name '#{rule}'.\" unless valid_id(rule)\n @file.write(\"rule #{rule}\\n description = #{rule}\\n\")\n var_set(vars)\n end",
"def config_creates_file(_new_resource)\n return 'Makefile'\n end",
"def config_creates_file(_new_resource)\n return 'Makefile'\n end",
"def rsync_command\n utility(:rsync).dup <<\n archive_option <<\n mirror_option <<\n exclude_option <<\n \" #{Array(additional_rsync_options).join(\" \")}\".rstrip\n end",
"def configure\n send_command \"--configure\"\n end",
"def config_file(val)\n @config_files << val\n end",
"def <<(cmd_instance)\n raise ArgumentError, \"must be a CommandInstance object\" unless cmd_instance.is_a?(CommandInstance)\n @commands[cmd_instance.command_value] = cmd_instance\n end",
"def caddadmin(m, nick, channel)\n channel = m.channel if channel.nil?\n if is_chanadmin?(channel, m.user) || is_supadmin?(m.user)\n $adminhash[channel] << nick\n $config['admin']['channel'] = $adminhash\n File.open($conffile, 'wb') { |f| f.write $config.to_yaml }\n m.reply \"#{nick} has been added as an admin for #{channel}.\", true\n else\n m.reply NOTADMIN, true\n end\n end",
"def + cmd\n self.class.new dup.concat(cmd)\n end",
"def commandalias(command, a)\r\n\t\t\t@commands[a] = @commands[command]\r\n\t\tend",
"def cmd(command, val)\n @emq.push( raw_cmd command, val )\n end",
"def push_config\n command = ['VBoxManage', 'modifyvm', uid]\n command.concat board.to_params\n nics.each_with_index do |nic, index|\n if nic.nil?\n command.push \"--nic#{index + 1}\", 'none'\n else\n command.concat nic.to_params(index + 1)\n end\n end\n VirtualBox.run_command! command\n \n io_buses.each { |bus| bus.add_to self }\n \n self\n end",
"def start_config_cmd(config)\n log_append = File.exist?(config['db_config_logpath']) ? '--logappend' : ''\n\n [\"cd #{DB_BIN_PATH}\",\n \"./mongod --configsvr --bind_ip #{config['host'] || LOCAL_IP} --port #{config['db_config_port']} \" +\n \"--dbpath #{config['db_config_dbpath']} --logpath #{config['db_config_logpath']} \" +\n \"--fork #{log_append}\"\n ].join(';')\nend",
"def add(m)\n rx = /^!op (?<command>\\w+ )?(?<nick>\\w+)/i\n if (md = rx.match(m.message)) && m.channel.opped?(m.user)\n if command = md[:command]\n case command\n when /add/i\n Twiller::Config['channels'][m.channel]['operators'] << md[:nick]\n Twiller::Config.save\n m.channel.op(md[:nick])\n m.reply \"[AUTO-OP] #{md[:nick]} added to the ops list for #{m.channel}.\"\n when /remove/i\n Twiller::Config['channels'][m.channel]['operators'].delete(md[:nick])\n Twiller::Config.save\n end\n else\n m.channel.op(md[:nick])\n end\n end\n end",
"def add_original_commands; end",
"def before_update(params_to_update=[])\n transport.command(\"enable\")\n transport.command(\"conf\", :prompt => /\\(conf\\)#\\s?\\z/n)\n end",
"def add_cmd_args(str)\n @cmd_args << \" #{str} \"\n end",
"def add_cmd_args(str)\n @cmd_args << \" #{str} \"\n end",
"def manifest_file_create_command(id, manifest_src)\n saver.file_create_command(manifest_filename(id), manifest_src)\n end",
"def configureS3Cmd(creds)\n path = \"#{HADOOP}/.s3cfg\"\n if (! File.exists?(path)) \n File::open(path, \"w\") do |f|\n f << <<-S3_CONFIG\n[default]\naccess_key = #{creds.key}\nacl_public = False\nbucket_location = US\nencrypt = False\nsecret_key = #{creds.secret}\nS3_CONFIG\n end\n end\nend",
"def get_assign_command_for_device(device)\n if device.match(@assignable_disk_regex)\n \"assign letter=#{device[0,1]}\"\n elsif device.match(@assignable_path_regex)\n \"assign mount=\\\"#{device}\\\"\"\n end\n end",
"def command(cmd); \"#{cmd}#{options.tail ? ' -f' : ''}\" end",
"def submode_config(config_line)\n command = config_line.strip\n @configuration[command]\n end",
"def make_command(action, args = [])\n command = @commands[action.to_sym]\n command += \" '\" + args.join(' ') + \"'\" unless args.empty?\n\n command\n end",
"def add_original_commands\n end",
"def exec(command)\n @commands << %{write text \"#{command}\"}\n end",
"def command_to_merge_files(tool, input)\n p \"#{ tool } #{ input }\"\nend",
"def << (command)\n @list ||= []\n @list << command\n end",
"def append(action); end",
"def append(action); end",
"def append(action); end",
"def build_command(cmd)\n cmd\n end",
"def add key, &block\n @config_items << ConfigItem.new(:posix, key, &block)\n end",
"def add_raw cmd\n @cmds << cmd\n end",
"def generate_solo_config\n @ssh.write \"/tmp/solo.rb\", sudo: true do |file|\n file << \"require '#{APPD_COOKBOOK_PATH}/libraries/appd-chef-formatter.rb'\"\n file << \"cookbook_path #{@cookbook_path}\"\n end\n end",
"def configure_backdat\n @commands = parse_options\n\n begin\n ::File.open(config[:config_file]) { |f| apply_config(f.path) }\n rescue Errno::ENOENT => error\n msg = \"Did not find the config file: #{config[:config_file]}\"\n msg << \", Using command line options.\"\n Backdat::Log.warn \"*****************************************\"\n Backdat::Log.warn msg\n Backdat::Log.warn \"*****************************************\"\n end\n end",
"def append fi,c\n\tFile.open( fi, \"a\" ) {| f | f.puts c } \nend",
"def ip_cmd_from_file\n\n ip_cmd = ''\n ip_cmd += 'to ' + self.to + ' ' if ! self.to.nil? && ! self.to.empty?\n ip_cmd += 'via ' + self.via + ' ' if ! self.via.nil? && ! self.via.empty?\n ip_cmd += 'dev ' + self.device + ' ' if ! self.device.nil? && ! self.device.empty?\n ip_cmd += 'table ' + self.table + ' ' if ! self.table.nil? && ! self.table.empty?\n return ip_cmd\n\n end",
"def arg_append(path, val, parse)\n parts = val.split('=')\n if 1 < parts.length\n val = {}\n parse.each_index { |i| val[parse[i].to_sym] = parts[i] }\n end\n a = get(path)\n if a.nil?\n a = []\n set(path, a)\n end\n a.push(val)\n end",
"def with_command(*cmd)\n @commands.concat cmd.compact\n self\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 cloud_metadata_generation_command\n ruby_path = File.normalize_path(AgentConfig.ruby_cmd)\n rs_cloud_path = File.normalize_path(Gem.bin_path('right_link', 'cloud'))\n return \"#{ruby_path} #{rs_cloud_path} --action write_cloud_metadata\"\nend",
"def gen_app_config_file\n filename = 'config/init/app_config.rb'\n bakname = 'config/init/app_config.rb~'\n File.delete(bakname) if File.exist?(bakname)\n File.rename(filename, bakname) if File.exist?(filename)\n File.open(filename, \"w\") do |file|\n file.puts(app_config_content)\n end\n end",
"def <<(str)\n str.each_line do |line|\n next if line.chomp.empty?\n i = line.index /\\A\\s*([a-zA-Z_]+)\\s*(\\+?=)(.*)/\n if i.nil?\n puts \"Warning: Cannot parse config definition '#{line}'\"\n next\n end\n var = $1\n op = $2\n val = $3.strip\n if op == '='\n self[var] = val\n elsif op == '+='\n if @config.has_key? var\n self[var] = [self[var], val]\n else\n self[var] = [val]\n end\n end\n end\n return\n end",
"def append(args={})\n\t\t\t\tarray_to_file(args.merge(:append => true))\n\t\t\tend",
"def push(cmd); end",
"def updateCmd(cmd)\n @cmd = cmd\n end"
] |
[
"0.6018097",
"0.60125196",
"0.59455025",
"0.5894086",
"0.5713274",
"0.55858445",
"0.5501646",
"0.54982245",
"0.5494143",
"0.548474",
"0.5477435",
"0.5427472",
"0.53431004",
"0.5334085",
"0.5334061",
"0.52811843",
"0.5267606",
"0.5255126",
"0.52521455",
"0.5226453",
"0.5225942",
"0.52165586",
"0.5204397",
"0.5180469",
"0.5179445",
"0.51606065",
"0.51598793",
"0.5158364",
"0.51389813",
"0.51154804",
"0.5110325",
"0.50975865",
"0.5095511",
"0.5082637",
"0.5078965",
"0.5074383",
"0.50628597",
"0.50595486",
"0.50506395",
"0.50476533",
"0.5028972",
"0.5025489",
"0.50172013",
"0.50140685",
"0.5000975",
"0.4997262",
"0.4994346",
"0.49868962",
"0.49841508",
"0.49698934",
"0.496867",
"0.4967526",
"0.49668646",
"0.49467787",
"0.49441227",
"0.49441227",
"0.4942981",
"0.4938888",
"0.4938716",
"0.49206486",
"0.49200535",
"0.49038592",
"0.49013242",
"0.48993897",
"0.4897486",
"0.48970473",
"0.48941857",
"0.4890545",
"0.48815358",
"0.48814353",
"0.48814353",
"0.48790136",
"0.48774827",
"0.48773938",
"0.48577303",
"0.48507357",
"0.48468092",
"0.48467436",
"0.48374024",
"0.48346025",
"0.4834109",
"0.48333544",
"0.48333544",
"0.48333544",
"0.4830085",
"0.48231784",
"0.4822708",
"0.48126864",
"0.48090053",
"0.48081216",
"0.48066196",
"0.4804688",
"0.48030835",
"0.48024642",
"0.48008025",
"0.48007873",
"0.47990686",
"0.47989622",
"0.47951764",
"0.47923914"
] |
0.72833645
|
0
|
Returns command to remove assignment from config file
|
def unset_cmd
sprintf 'sed -i /%s/d %s', key_set_string, @file
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove_command(name)\n @commands ||= {}\n @commands.delete name\n end",
"def remove_config(name)\n\t\tend",
"def removeCommandAliases(repo)\n config = repo.config(true, '--list').lines.each do |line|\n next unless line.start_with? 'alias.' and line.match /\\!_git\\-bpf/\n a = /alias\\.([a-zA-Z0-9\\-_]+)\\=(.)*/.match(line)[1]\n repo.config(true, '--unset', \"alias.#{a}\")\n end\n end",
"def unset_command\n [grep_cmd, '&&', unset_cmd].join(' ')\n end",
"def unset_config(key)\n store :delete, \"configs/#{key}\"\n end",
"def remove_config(name)\n variables[name] = nil\n end",
"def undefine_config(tool)\n @setup[tool.to_s] = false\n end",
"def remove\n system(\"qconf -duser #{name}\")\n end",
"def action_remove\n notifying_block do\n delete_config\n end\n end",
"def delete(symbol)\n configuration.delete(symbol)\n end",
"def snmp_notification_receiver_remove(opts = {})\n cmd = 'no ' << snmp_notification_receiver_cmd(opts)\n configure cmd\n end",
"def delete(key)\n @config.delete(key.to_s)\n end",
"def del(opts)\n \"\"\n end",
"def config_delete(name)\n Bundler.settings.set_local(name, nil)\n Bundler.settings.set_global(name, nil)\n end",
"def rm(path)\n cmd 'rm', path\nend",
"def remove( *args )\n args.each { |name|\n name = name.to_s.delete('=')\n code = <<-__\n undef_method :#{name} rescue nil\n undef_method :#{name}= rescue nil\n __\n Loquacious::Configuration.module_eval code\n Loquacious::Configuration::DSL.module_eval code\n }\n end",
"def unset(key)\n run { conf.unset(key, config_params) }\n end",
"def delete( )\n File.delete(@configFileDNE)\n self.clear\n self\n end",
"def delete_setting!(header, name)\n write do \n contents.gsub(find_setting(header, name), '')\n end\n end",
"def remove(remove_slot = params[\"remove\"])\n\t\tsession[Constants::SESS_MY_CONFIG].remove(remove_slot)\n\t\tgo_to_config\n\tend",
"def delete_file\n\n #delete the file\n Chef::Log.debug \"DEBUG: Removing file #{ node[\"php_fpm\"][\"pools_path\"] }/#{ @new_resource.pool_name }.conf!\"\n ::File.delete(\"#{ node[\"php_fpm\"][\"pools_path\"] }/#{ @new_resource.pool_name }.conf\")\n\nend",
"def delete(key)\n self.config.delete(key)\n end",
"def cfg_remove(cfg,member)\n obj_remove(cfg,ZoneConfiguration,member)\n end",
"def remove_server(opts = {})\n cmd = \"no tacacs-server host #{opts[:hostname]}\"\n cmd << \" port #{opts[:port]}\" if opts[:port]\n configure cmd\n end",
"def hash_delete(field)\n choose do |menu|\n menu.prompt = \"Please select to remove: \"\n menu.index = :number\n menu.index_suffix = ') '\n menu.choice(:quit, 'Quit') {result = false}\n values = []\n AppConfig.config[field].each do |key, value|\n values << \"#{key} => #{value}\"\n end\n menu.choices(*values) do |value, details|\n if value =~ /(.*\\S)\\s+=>/\n AppConfig.config[field].delete($1)\n end\n end\n end\n end",
"def unset\n requires_preauth\n if args.empty?\n error(\"Usage: heroku config:unset KEY1 [KEY2 ...]\\nMust specify KEY to unset.\")\n end\n\n args.each do |key|\n action(\"Unsetting #{key} and restarting #{app}\") do\n api.delete_config_var(app, key)\n\n @status = begin\n if release = api.get_release(app, 'current').body\n release['name']\n end\n rescue Heroku::API::Errors::RequestFailed\n end\n end\n end\n end",
"def rm(dataset)\n \"remove dataset name=#{dataset}\"\n end",
"def cfgremove(fabrickey, cfgname, *zonenames)\n result = @zones.altercfg(fabrickey, 'REMOVE', cfgname, *zonenames)\n result[1]\n end",
"def rm_str(options, src)\n\t\targ = \"rm \" + options + \" \" + src\n\t\tputs arg\n\t\tsystem arg\n\tend",
"def destroy\n conf.delete 'dashboard'\n end",
"def remove_pid_file\n @commands_and_opts.push OPTIONAL_OPTS[:remove_pid_file]\n self\n end",
"def deleteConfigFile(appName)\n @put.normal \"Removing Thin configuration for #{appName}\"\n configFile = \"/etc/thin/#{appName}.yml\"\n if File.exists?(configFile)\n removeCommand = @system.delete(configFile)\n if removeCommand.success?\n @put.confirm\n return 0\n else\n @put.error \"Could not delete Thin configuration\"\n return 1\n end\n else\n @put.error \"Config file non-existent\"\n return 1\n end\n end",
"def delete(key)\n load_config unless @config\n @config.delete(key)\n save_config\n end",
"def clear(option)\n @client.call('config.unset', option)\n end",
"def uninstall\n command = resource_or_provider_command\n self.class.validate_command(command)\n\n command_options = [\"uninstall\", \"-y\", \"-q\", @resource[:name]]\n\n execute([command, command_options])\n end",
"def delete_property(name)\n Config::Collection.delete(name)\n end",
"def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end",
"def remove_prompt(name)\n prompt = self[name.to_s]\n PROMPT_MAP.delete name.to_s if prompt\n end",
"def remove_command\n return if !has_manage_messages_permission?\n command.event.message.delete\n end",
"def remove!(entry)\n rel_path = Wide::PathUtils.relative_to_base(base_path, entry.path)\n\n cmd = cmd_prefix.push('rm', '-f', \"path:#{rel_path}\")\n shellout(Escape.shell_command(cmd))\n\n raise CommandFailed.new(\"Failed to remove file #{src_path} in the Mercurial repository in #{base_path}\") if $? && $?.exitstatus != 0\n end",
"def clean_command\n build_command(\"clean\")\n end",
"def unset!(name)\n (s = setting(name)) && s.unset!\n end",
"def delete(name)\n configure [\"interface #{name}\", 'no switchport']\n end",
"def remove(endpoint_alias)\n puts \"Removing credential #{endpoint_alias}\"\n\n load_manifest\n @manifest.delete(endpoint_alias) if @manifest.has_key? endpoint_alias\n save_manifest\n\n end",
"def remove_assignment(experiment, subject)\n subject_identifier = experiment.retrieve_subject_identifier(subject)\n remove(experiment.handle.to_s, \"assignment_#{subject_identifier}\")\n end",
"def delete(key)\n configuration.delete(key)\n end",
"def unset(str)\n\t\t@pipe.puts \"unset #{str}\"\n\tend",
"def unlink_runfile\n File.unlink(CONFIG[:run_path]) if File.exists?(CONFIG[:run_path]) and File.read(CONFIG[:run_path]).to_i == Process.pid.to_i\n end",
"def remove(key)\n\t\t\tvalue = @config.shift(key)\n\t\t\treturn value\n\t\tend",
"def remove\n return unless confirm_command\n\n args.each do |name|\n messages = nil\n if name.start_with? \"HEROKU_POSTGRESQL_\"\n name = name.chomp(\"_URL\").freeze\n end\n action(\"Removing #{name} on #{app}\") do\n messages = addon_run { heroku.uninstall_addon(app, name, :confirm => app) }\n end\n display(messages[:attachment]) if messages[:attachment]\n display(messages[:message]) if messages[:message]\n end\n end",
"def remove(conf, package_name, version = nil)\n raise NoMethodError.new \"Not implemented\"\n end",
"def unset(*args)\n run \"unset #{OptArg.parse(*args)}\"\n nil\n end",
"def delete(name)\n configure([\"interface #{name}\", 'no ip address', 'switchport'])\n end",
"def remove\n `cd #{self.project_root} && rm -r puppet/roles/#{self.name}`\n end",
"def sub_remove _value=0\n send_cmd(\"sub_remove #{_value}\")\n end",
"def rm_r(path)\n cmd 'rm', '-r', path\nend",
"def uninstall\n pacman \"--noconfirm\", \"--noprogressbar\", \"-R\", @resource[:name]\n end",
"def edged(cmd)\n $lock.synchronize{ \n $network.remove_edge($hostname,cmd[0])\n\n if $rt.has_key? cmd[0]\n $rt.delete cmd[0] \n end\n\n }\nend",
"def deleteConfigFile(appName)\n @put.normal \"Deleting Nginx configuration for #{appName}\"\n configFile = \"#{@nginxAvailableFolder}#{appName}.conf\"\n if File.exists?(configFile)\n removeCommand = @system.delete(configFile)\n if removeCommand.success?\n @put.confirm\n return 0\n else\n @put.error \"Could not delete Nginx for #{appName}\"\n return 1\n end\n else\n @put.error \"Config file non-existent\"\n return 1\n end\n end",
"def destroy\n @command.destroy\n end",
"def remove_command(command, resize=true)\n @commands.delete(command)\n @item_max = @commands.size\n refresh_command(resize)\n end",
"def array_delete(field)\n choose do |menu|\n menu.prompt = \"Please select to remove: \"\n menu.index = :number\n menu.index_suffix = ') '\n menu.choice(:quit, 'Quit') {result = false}\n menu.choices(*AppConfig.config[field]) do |extension, details|\n AppConfig.config[field].delete(extension)\n end\n end\n end",
"def unfollow(nick)\n config['following'].delete(nick)\n config.save\nend",
"def rm path\n end",
"def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end",
"def remove_config\n FileUtils.cd(self.project_root) { FileUtils.rm_rf \"config/environments/#{self.name}\" }\n end",
"def - (name) remove_attribute name end",
"def unconfigure_xb_pxe_client(client_name)\n client_mac=get_client_mac(client_name)\n if !client_mac\n puts \"Warning:\\tNo MAC Address entry found for \"+client_name\n exit\n end\n tftp_pxe_file = client_mac.gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxeboot\"\n tftp_pxe_file = $tftp_dir+\"/\"+tftp_pxe_file\n if File.exist?(tftp_pxe_file)\n message = \"Removing:\\tPXE boot file \"+tftp_pxe_file+\" for \"+client_name\n command = \"rm #{tftp_pxe_file}\"\n output = execute_command(message,command)\n end\n unconfigure_xb_dhcp_client(client_name)\n return\nend",
"def remove(alias_name, options)\n file = File.open(FILE_PATH, 'r')\n servers = all_hosts_in(file)\n if servers.include?alias_name\n new_file = File.open(FILE_PATH + 'temp', 'w')\n remove_alias_name(alias_name, file, new_file)\n\n File.delete(FILE_PATH)\n File.rename(FILE_PATH + 'temp', FILE_PATH)\n # Causes a bug in fedore if permission was not updated to 0600\n File.chmod(0600, FILE_PATH)\n PRINTER.print \"`#{alias_name}` was successfully removed from your hosts\"\n else\n PRINTER.print \"Could not find host `#{alias_name}`\"\n end\n finish_exec\n end",
"def destroy\n debug('Removing clone')\n cmd = [command(:crm), '-w', 'resource', 'stop', @resource[:name]]\n self.class.run_command_in_cib(cmd, @resource[:cib], false)\n cmd = [command(:crm), 'configure', 'delete', @resource[:name]]\n self.class.run_command_in_cib(cmd, @resource[:cib])\n @property_hash.clear\n end",
"def uninstall\n yaourt('--noconfirm', '-R', @resource[:name])\n end",
"def uninstall cmd=nil, &block\n @uninstall = cmd || block\n end",
"def delete(key)\n @configuration.delete(key)\n end",
"def delete(key)\n @configuration.delete(key)\n end",
"def delete(key)\n @configuration.delete(key)\n end",
"def unconfigure_vs_pxe_client(options)\n options['mac'] = get_install_nac(options)\n if not options['mac']\n handle_output(options,\"Warning:\\tNo MAC Address entry found for #{options['name']}\")\n quit(options)\n end\n tftp_pxe_file = options['mac'].gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxelinux\"\n tftp_pxe_file = options['tftpdir']+\"/\"+tftp_pxe_file\n if File.exist?(tftp_pxe_file)\n message = \"Information:\\tRemoving PXE boot file \"+tftp_pxe_file+\" for \"+options['name']\n command = \"rm #{tftp_pxe_file}\"\n execute_command(options,message,command)\n end\n pxe_cfg_dir = options['tftpdir']+\"/pxelinux.cfg\"\n pxe_cfg_file1 = options['mac'].gsub(/:/,\"-\")\n pxe_cfg_file1 = \"01-\"+pxe_cfg_file1\n pxe_cfg_file1 = pxe_cfg_file1.downcase\n pxe_cfg_file1 = pxe_cfg_dir+\"/\"+pxe_cfg_file1\n pxe_cfg_file2 = options['mac'].split(\":\")[0..3].join+\"-\"+options['mac'].split(\":\")[4..5].join+\"-0000-0000-\"+options['mac'].gsub(/\\:/,\"\")\n pxe_cfg_file2 = pxe_cfg_file2.downcase\n pxe_cfg_file2 = pxe_cfg_dir+\"/\"+pxe_cfg_file2\n if File.exist?(pxe_cfg_file1)\n message = \"Information:\\tRemoving PXE boot config file \"+pxe_cfg_file1+\" for \"+options['name']\n command = \"rm #{pxe_cfg_file1}\"\n execute_command(options,message,command)\n end\n if File.exist?(pxe_cfg_file2)\n message = \"Information:\\tRemoving PXE boot config file \"+pxe_cfg_file2+\" for \"+options['name']\n command = \"rm #{pxe_cfg_file2}\"\n execute_command(options,message,command)\n end\n client_info = get_vs_clients()\n options['service'] = client_info.grep(/#{options['name']}/)[0].split(/ = /)[1].chomp\n ks_dir = options['tftpdir']+\"/\"+options['service']\n ks_cfg_file = ks_dir+\"/\"+options['name']+\".cfg\"\n if File.exist?(ks_cfg_file)\n message = \"Information:\\tRemoving Kickstart boot config file \"+ks_cfg_file+\" for \"+options['name']\n command = \"rm #{ks_cfg_file}\"\n execute_command(options,message,command)\n end\n unconfigure_vs_dhcp_client(options)\n return\nend",
"def remove_target\n options[:remove_target]\n end",
"def remove!\n windows_package 'Chef Development Kit' do\n action :remove\n end\n end",
"def remove_attribute(name); end",
"def remove_attribute(name); end",
"def remove_attribute(name); end",
"def remove_attribute(name); end",
"def cfg_delete(cfg)\n obj_delete cfg, ZoneConfiguration\n end",
"def remove_alias(ip)\n cmd(\"addr del #{ip}/#{prefix} dev #{name}\")\n unless name == 'eth0' || !cmd(\"rule list\").match(/([0-9]+):\\s+from #{ip} lookup #{route_table}/)\n cmd(\"rule delete pref #{$1}\")\n end\n end",
"def rm(file)\n cmd_exec(\"rm -rf #{file}\")\n end",
"def bring_down(typename, cmd)\n execute_with_fail(typename, cmd, 'to remove')\n end",
"def drop\n Aptly::runcmd \"aptly mirror drop #{@name.quote}\"\n end",
"def delete_command_help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Command Usage:\"\n puts \" [delete | d] <name=> deletes a animal by name\"\n puts \"\"\n puts \"Examples:\"\n puts \" bin/run [delete | d] name=my_animal_name\"\n end",
"def off\n attachment = hpg_resolve(shift_argument)\n return unless confirm_command(attachment.config_var, 'Deactiving will destroy all backups')\n action(\"Dectivating #{attachment.config_var} (#{attachment.resource_name})\") do\n RestClient.delete( authed_pgsnapshot_url(\"/client/resource/#{attachment.resource_name}\"))\n end\n end",
"def command_config(str_opts)\n command :config do |c|\n c.syntax = 'budik config [options]'\n c.summary = @str_config.summary\n c.description = @str_config.description\n c.option '-r', '--reset', str_opts.reset\n c.action { |_args, opts| Command.new(:config, opts) }\n end\n end",
"def delete_attribute(key); end",
"def task_remove(task_name)\n return unless task_present? task_name\n tasks.delete prepare_key(task_name)\n reset\n end",
"def clear(config)\n Array(config).each do |setting|\n delete_setting setting\n end\n end",
"def remove(alias_name, options)\n output = \"\"\n started_removing = false\n file = File.open(FILE_PATH, \"r\")\n new_file = File.open(FILE_PATH+\"temp\", \"w\")\n file.each do |line|\n if line.include?(\"Host #{alias_name}\") || started_removing\n # I will never stop till I find another host that is not the one I'm removing\n if started_removing && line.include?(\"Host \") && !line.include?(alias_name)\n started_removing = false\n else\n PRINTER.verbose_print line\n started_removing = true\n end\n else\n # Everything else should be transfered safely to the other file\n new_file.write(line)\n end\n end\n file.close\n new_file.close\n File.delete(FILE_PATH)\n File.rename(FILE_PATH + \"temp\", FILE_PATH)\n\n # causes a bug in fedore if permission was not updated to 0600\n File.chmod(0600, FILE_PATH) \n # system \"chmod 600 #{FILE_PATH}\"\n\n unless PRINTER.output?\n PRINTER.print \"could not find host (#{alias_name})\"\n end\n finish_exec\n end",
"def delete_configuration\n super\n end",
"def delete_configuration\n super\n end",
"def delete_option(name)\n @options.delete(name)\n end",
"def remove(file); @actions << Action::RemoveAction.new(file); end",
"def erase\n runcmd 'erase'\n end",
"def delete(*names)\n names.each { |name| commands.delete name }\n end"
] |
[
"0.65352476",
"0.6505543",
"0.61993665",
"0.615171",
"0.61218435",
"0.612007",
"0.6094497",
"0.6053946",
"0.6038202",
"0.59354615",
"0.5923372",
"0.5921481",
"0.5908367",
"0.5841326",
"0.58399504",
"0.5825802",
"0.57967013",
"0.5787193",
"0.57484883",
"0.5747127",
"0.5722159",
"0.5716798",
"0.57057506",
"0.57040304",
"0.57032543",
"0.5649816",
"0.56401855",
"0.5637091",
"0.56335676",
"0.56254125",
"0.5617511",
"0.5616951",
"0.55993485",
"0.5562723",
"0.5527709",
"0.5504953",
"0.54980093",
"0.5495006",
"0.5488931",
"0.54865474",
"0.5481209",
"0.54673904",
"0.54590714",
"0.545565",
"0.5454503",
"0.5437264",
"0.5434407",
"0.5430016",
"0.54212344",
"0.54207206",
"0.54171383",
"0.5413679",
"0.539463",
"0.53941905",
"0.5388226",
"0.53867066",
"0.5382675",
"0.53805923",
"0.5380344",
"0.53787994",
"0.53752",
"0.53715634",
"0.53421175",
"0.53157973",
"0.5312885",
"0.5307061",
"0.53026086",
"0.5300114",
"0.5295125",
"0.5290336",
"0.5281231",
"0.52792764",
"0.52703035",
"0.52703035",
"0.52703035",
"0.5268483",
"0.5265865",
"0.5255558",
"0.5253343",
"0.5253343",
"0.5253343",
"0.5253343",
"0.52499825",
"0.5239112",
"0.52353346",
"0.5229698",
"0.5222989",
"0.5222774",
"0.52224296",
"0.5202489",
"0.5200927",
"0.5198304",
"0.51894444",
"0.51872015",
"0.51838744",
"0.51838744",
"0.5172749",
"0.51643294",
"0.5154376",
"0.515168"
] |
0.664374
|
0
|
This action is update exam details at the time of exam group create bacause it have a dependancies;
|
def update_exam(exam_group, p)
return unless p.present?
p.each do |s|
exam = Exam.where(subject_id: s, exam_group_id: exam_group.id).take
exam.destroy unless exam.nil?
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @exam_group = ExamGroup.shod(params[:id])\n @exam_group.update(params_exam_group)\n @batch = @exam_group.batch\n @subjects = @batch.subjects.exam\n @exam_group.exams.build\n end",
"def update\n @exam = Exam.shod(params[:id])\n if @exam.update(params_exam)\n flash[:notice] = t('update_exam')\n redirect_to exams_exam_group_path(@exam.exam_group)\n else\n render 'edit'\n end\n end",
"def update\n unless @edit_or_delete_right\n redirect_to exams_url,notice:\"您无权修改别人编写的考试\"\n end\n parsed_param=exam_params\n @exam.questions.delete_all\n @exam.add_questions_to_exam(@validated_question)\n respond_to do |format|\n if @exam.update(parsed_param)\n format.html { redirect_to @exam, notice: \"已成功更新考试“#{@exam.name}.”\" }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exam_create\n if @exam.save\n flash[:notice] = t('create_exam')\n redirect_to exams_exam_group_path(@exam.exam_group)\n else\n render 'new'\n end\n end",
"def create\n @exam_group = ExamGroup.shod(params[:exam_group_id])\n @batch = @exam_group.batch\n @subjects = @batch.subjects.where(no_exams: false)\n @exam = @exam_group.exams.new(params_exam)\n exam_create\n end",
"def set_exam\n\t\t\t@exam = Exam.includes(:questions).find(params[:id])\n\t\tend",
"def create\n\n @exam = Exam.new(exam_params)\n result=@exam.save\n @exam.add_questions_to_exam(@validated_question)\n respond_to do |format|\n if result\n format.html { redirect_to @exam, notice: \"已成功建立考试“#{@exam.name}.”\" }\n format.json { render :show, status: :created, location: @exam }\n else\n format.html { render :new }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n unless Publication.find_by(group_id: params[:group_id], quiz_id: params[:id])\n @quiz.groups << Group.find(params[:group_id])\n format.json { render json: @quiz.show_full_details }\n else\n format.json { render json: { errors: \"Either published before or not found\"}, status: :unprocessable_entity }\n end\n end\n end",
"def set_exam\r\n @exam = Exam.find(params[:id])\r\n end",
"def create\n @exmedico = @paciente.exams.exmedico.new(params[:exmedico])\n # @exmedico.exam_id = @exam.id\n \n\n \n if @exmedico.save\n redirect_to [@paciente, @exam, @exmedico]\n else\n render action: \"new\"\n end\n \n end",
"def edit\n @exam = Exam.shod(params[:id])\n @exam_group = @exam.exam_group\n @batch = @exam.exam_group.batch\n @subjects = @batch.subjects.where(no_exams: false)\n authorize! :update, @exam\n end",
"def update_exam_score\n @exam = Exam.shod(params[:id])\n @exam_group = @exam.exam_group\n @batch = @exam_group.batch\n @exam.update_exam_scr(@exam, @exam_group, @batch, params[:exams][:exam])\n redirect_to previous_exam_scores_exam_groups_path(@exam.id)\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def publish_exam\n @date = Date.today\n @exam_group = ExamGroup.shod(params[:format])\n @exam_group.update(is_published: true)\n @exam_group.exams.each(&:create_exam_event)\n @batch = @exam_group.batch\n @exam_groups ||= @batch.exam_groups.all\n end",
"def update_exam_score\n @exam = Exam.shod(params[:id])\n @exam_group = @exam.exam_group\n @batch = @exam_group.batch\n grades = @exam.exam_group.batch.grading_levels.order(min_score: :asc)\n @temps = params[:exams][:exam]\n @exam.score_exam(@temps, @batch, @exam, @exam_group, grades)\n exam\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def update_assignment_form(exist_assignment)\n questionnaire_array = assignment_form_params[:assignment_questionnaire]\n questionnaire_array.each { |cur_questionnaire| cur_questionnaire[:assignment_id] = exist_assignment.id.to_s }\n assignment_form_params[:assignment_questionnaire]\n due_array = assignment_form_params[:due_date]\n due_array.each { |cur_due| cur_due[:parent_id] = exist_assignment.id.to_s }\n assignment_form_params[:due_date]\n @assignment_form.update(assignment_form_params, current_user)\n end",
"def set_exam\n\t\t@exam = Exam.find(params[:id])\n\tend",
"def update\r\n if @exam.update(exam_params)\r\n redirect_to @exam, notice: \"Exam was successfully updated.\"\r\n else\r\n render :edit, status: :unprocessable_entity\r\n end\r\n end",
"def set_exam_question\n @exam_question = ExamQuestion.find(params[:id])\n end",
"def set_exam\n @exam_answer = ExamAnswer.find(params[:id])\n end",
"def set_exam\n @exam = @student.exams.find(params[:id])\n end",
"def edit\n @exam_group = ExamGroup.shod(params[:id])\n @batch = @exam_group.batch\n end",
"def update\n\t@groupanswer = Groupanswer.find(params[:id])\n\tif @groupanswer.update_attributes(groupanswer_params)\n\t\tflash[:success] = \"answer updated\"\n\t\tredirect_to @groupanswer.group_question.group\n\telse\n\t\tflash[:danger] = \"some error occured\"\n\t\trender action: \"edit\"\n\tend\n\n end",
"def update_question\n @questions=Admin::Questionbank.find(:all,:select=>\"id,question_code,subject_name,question_number,internal_ref_number\",:order=>'created_at DESC',:limit=>3)\n @questionbank=Admin::Questionbank.find(params[:id])\n @examtypes=Admin::Examtype.find(:all,:select=>\"id,examtype\",:order=>'examtype')\n @sectiontopics=Admin::Sectiontopic.find(:all,:select => 'DISTINCT Topic,id')\n @sectiontags=Admin::Sectiontemplate.find(:all,:select=>'SectionTags')\n totalexamtypes = \"\"\n i=1\n @examtypes.size.times{\n examtypes = params['etype'+i.to_s]['checked']\n if totalexamtypes == ''\n totalexamtypes = examtypes\n else\n totalexamtypes = totalexamtypes+','+examtypes\n end\n i=i+1\n }\n @questionbank.examtype_tags=totalexamtypes\n if @questionbank.question_media_type==0 # if question type is textual\n @questionbank.update_attributes(params[:questionbank])\n redirect_to :action => 'edit_success', :id => @questionbank\n elsif @questionbank.question_media_type==1 #if question type is graphical \n @questionbank.topic=params[:questionbank][:topic]\n @questionbank.sub_topic=params[:questionbank][:sub_topic]\n @questionbank.sub_sub_topic=params[:questionbank][:sub_sub_topic]\n @questionbank.tags=params[:questionbank][:tags]\n @questionbank.correct_answer=params[:questionbank][:correct_answer]\n @questionbank.source=params[:questionbank][:source]\n @questionbank.author=params[:questionbank][:author]\n @questionbank.comments=params[:questionbank][:comments]\n @questionbank.internal_ref_number=params[:questionbank][:internal_ref_number]\n @questionbank.topic=params[:questionbank][:topic].strip\n @questionbank.tags=params[:questionbank][:tags].strip\n Admin::Questionbank.save_imagepaths_in_db(params[:questionbank],@questionbank,@questionbank.subject_code,@questionbank.question_code)## to save the image paths in db\n @questionbank.save\n Admin::Questionbank.delete_previous_files(params[:questionbank]) ## to delete the previous files in application if they exist \n Admin::Questionbank.save_images(params[:questionbank],@questionbank.subject_code,@questionbank.question_code)## and save the files(images) again\n redirect_to :action => 'edit_success', :id => @questionbank\n else\n render :action => 'edit_question'\n end\n end",
"def exam_params\n params.require(:exam).permit(:name, :level, :description, :experience,\n questions_attributes: [:id, :exam_id, :content, '_destroy',\n answers_attributes: [:id, :question_id, :content, :correct, '_destroy' ] ])\n end",
"def update!(**args)\n @new_group_details = args[:new_group_details] if args.key?(:new_group_details)\n @prev_group_details = args[:prev_group_details] if args.key?(:prev_group_details)\n end",
"def update\n respond_to do |format|\n if @rand_exam.update(rand_exam_params)\n @rand_exam.cache_paper_reset\n format.html { redirect_to xmt_test_exams_path, notice: '编辑成功.' }\n format.json { render :show, status: :ok, location: @rand_exam }\n else\n format.html { render :edit }\n format.json { render json: @rand_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @study = Study.find(params[:id])\n @project = Project.find(@study.project_id)\n #@project = Project.find(session[:project_id])\n #@study = Study.set_study_type(params, @study)\n if @saved = @study.update_attributes(params[:study])\n questions_flag = false\n questions = get_questions_params(params)\n # if we're updating from the key question form,\n # remove previously saved questions for this study\n kq_error = false\n unless params[:updating_kq].nil?\n # if there are question parameters, save the new entries\n unless questions.empty?\n @study.assign_questions(questions, params[:extraction_form_id])\n else\n flash[:error] = \"This operation is not allowed. Studies must be associated with at least one key question.\"\n kq_error = true\n end\n end\n end\n @study_extforms = StudyExtractionForm.where(:study_id => @study.id)\n @study_extforms.uniq!\n @extraction_forms = @study.get_extraction_forms\n @included_sections = Hash.new\n @borrowed_section_names, @section_donor_ids = [Hash.new,Hash.new]\n # an array of hashes to keep track of key questions addressed by\n # each individual section\n @kqs_per_section = Hash.new\n unless @study_extforms.empty?\n @study_extforms.each do |ef|\n tmpForm = ExtractionForm.find(ef.extraction_form_id)\n @extraction_forms << tmpForm\n included = ExtractionFormSection.get_included_sections(ef.extraction_form_id)\n borrowed = ExtractionFormSection.get_borrowed_sections(ef.extraction_form_id)\n @included_sections[ef.extraction_form_id] = included\n @borrowed_section_names[ef.extraction_form_id] = borrowed.collect{|x| x[0]}\n @section_donor_ids[ef.extraction_form_id] = borrowed.collect{|x| x[1]}\n @kqs_per_section[ef.extraction_form_id] = ExtractionFormSection.get_questions_per_section(ef.extraction_form_id,@study)\n end\n end\t\n redirect_to \"/projects/#{@project.id}/studies/#{@study.id}/edit\"\n end",
"def create_exam\n @exam = PlacementExam.new\n @company = Company.all\n @placement_exam = PlacementExam.new\n end",
"def set_exam_management\n @exam_management = ExamManagement.find(params[:id])\n end",
"def update\n\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n if @faq.update(faq_params)\n format.html { \n flash[:notice] = \"FAQ was successfully updated.\"\n redirect_to(:action => 'show', :id => @faq.id, :faq_group_id => @group.id)\n }\n format.json { head :no_content }\n else\n format.html { \n @groups = FaqGroup.order('position ASC')\n @faq_count = Faq.count + 1\n render action: 'edit' \n }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @due_action.update(due_action_params)\n @due_action = DueAction.new\n @due_employee_detail = DueEmployeeDetail.find(params[:due_employee_detail_id])\n @due_actions = DueAction.where(due_employee_detail_id: @due_employee_detail.id)\n flash[:notice] = 'Due Action updated Successfully.' \n end",
"def set_examquestion\n @examquestion = Examquestion.includes(:question, qpaper: :university_course ).find(params[:id])\n end",
"def set_exam_set\n @exam_set = ExamSet.find(params[:id])\n end",
"def set_past_exam\n @past_exam = PastExam.find(params[:id])\n end",
"def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_first_exam\n @first_exam = FirstExam.find(params[:id])\n end",
"def admin_update\n @question = Question.find(params[:id])\n authorize @question\n\n guidance = @question.get_guidance_annotation(current_user.org_id)\n current_tab = params[:r] || 'all-templates'\n if params[\"question-guidance-#{params[:id]}\"].present?\n unless guidance.present?\n guidance = Annotation.new(type: :guidance, org_id: current_user.org_id, question_id: @question.id)\n end\n guidance.text = params[\"question-guidance-#{params[:id]}\"]\n guidance.save\n else\n # The user cleared out the guidance value so delete the record\n guidance.destroy! if guidance.present?\n end\n example_answer = @question.get_example_answer(current_user.org_id)\n if params[\"question\"][\"annotations_attributes\"].present? && params[\"question\"][\"annotations_attributes\"][\"0\"][\"id\"].present?\n unless example_answer.present?\n example_answer = Annotation.new(type: :example_answer, org_id: current_user.org_id, question_id: @question.id)\n end\n example_answer.text = params[\"question\"][\"annotations_attributes\"][\"0\"][\"text\"]\n example_answer.save\n else\n # The user cleared out the example answer value so delete the record\n example_answer.destroy if example_answer.present?\n end \n \n if @question.question_format.textfield?\n @question.default_value = params[\"question-default-value-textfield\"]\n elsif @question.question_format.textarea?\n @question.default_value = params[\"question-default-value-textarea\"]\n end\n @section = @question.section\n @phase = @section.phase\n template = @phase.template\n \n attrs = params[:question]\n attrs[:theme_ids] = [] unless attrs[:theme_ids]\n \n if @question.update_attributes(attrs)\n @phase.template.dirty = true\n @phase.template.save!\n\n redirect_to admin_show_phase_path(id: @phase.id, section_id: @section.id, question_id: @question.id, r: current_tab), notice: success_message(_('question'), _('saved'))\n else\n @edit = (@phase.template.org == current_user.org)\n @open = true\n @sections = @phase.sections\n @section_id = @section.id\n @question_id = @question.id\n\n flash[:alert] = failed_update_error(@question, _('question'))\n if @phase.template.customization_of.present?\n @original_org = Template.where(dmptemplate_id: @phase.template.customization_of).first.org\n else\n @original_org = @phase.template.org\n end\n redirect_to admin_show_phase_path(id: @phase.id, section_id: @section.id, question_id: @question.id, r: current_tab)\n end\n end",
"def set_introexam\n @introexam = Introexam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n redirect_to root_url, :alert => '项目已关闭' if @exam.closed? && !current_user.is_s_admin?\n rescue\n \tredirect_to root_url, :alert => '项目不存在'\n end",
"def update\n respond_to do |format|\n if @assignment.update(params[:assignment].permit(:title, :description, :draft_deadline, :final_deadline, :comment_deadline, :description2,\n :is2group, positions_attributes:[:id, :title, :_destroy],\n comment_forms_attributes:[:id, :name, :group_number, :question1, :question2, :question3, :question4, :hint1, :hint2, :hint3, :hint4]))\n format.html { redirect_to assignments_path, notice: 'Assignment was successfully updated.' }\n format.json { render :show, status: :ok, location: @assignment }\n else\n format.html { render :edit }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to exams_path, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam_set.update(exam_set_params)\n format.html { redirect_to @exam_set, notice: 'Exam set was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_set }\n else\n format.html { render :edit }\n format.json { render json: @exam_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @question.status == 'published' || @question.version_independent_id != question_params[:version_independent_id]\n render json: @question.errors, status: :unprocessable_entity\n else\n update_response_sets(params)\n @question.update_concepts('Question')\n @question.updated_by = current_user\n if @question.update(question_params)\n @question.groups.each do |group|\n @question.add_to_group(group.id)\n end\n render :show, status: :ok, location: @question\n else\n @categories = Category.all\n render json: @question.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n @detail = Detail.find(params[:id])\n @guests = Guest.all_by_name\n @groups = Group.all_by_name\n respond_to do |format|\n if @detail.update_attributes(params[:detail])\n @guests.each do |guest|\n if params.has_key?(:guest_assign) and params[:guest_assign][guest.id.to_s] == \"true\"\n @detail.guests << guest unless @detail.guests.include?(guest)\n else\n @detail.guests.delete (guest) if @detail.guests.include?(guest)\n end\n end\n @groups.each do |group|\n if params.has_key?(:group_assign) and params[:group_assign][group.id.to_s] == \"true\"\n @detail.groups << group unless @detail.groups.include?(group)\n else\n @detail.groups.delete (group) if @detail.groups.include?(group)\n end \n end \n format.html { redirect_to admin_details_path, notice: 'Detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exam_params\n\t\t\tparams.require(:exam).permit(:title, :date, :unit_id, \n\t\t\t\tquestions_attributes:[ :id, :question, :exam_id,\t:_destroy,\n\t\t\t\tresponse_attributes:[:id, :answer, :question_id, :video,:_destroy]]\n\t\t\t\t)\n\t\tend",
"def update\n @questionnaire_group = QuestionnaireGroup.find(params[:id])\n\n respond_to do |format|\n if @questionnaire_group.update_attributes(params[:questionnaire_group])\n format.html { redirect_to @questionnaire_group, notice: 'Questionnaire group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questionnaire_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # puts params\n questions = JSON.parse(params[:questions])\n q_hash = questions[\"questions\"]\n @assignment = Assignment.new\n @assignment.course_id = params[:course_id]\n @assignment.type = \"Homework\"\n @assignment.start_date = params[:start_date]\n @assignment.end_date = params[:end_date]\n @assignment.name = params[:name]\n # Following is the question hash\n q_hash.each do |key, value|\n a_hash = key[\"answers\"]\n question = key[\"question\"]\n puts question\n new_question = Question.new\n new_question.description = question\n new_question.type = \"MultipleChoice\"\n # Answer hash\n a_hash.each do |k,v|\n puts k[\"is_correct\"]\n puts k[\"description\"]\n new_answer = Answer.new\n new_answer.description = k[\"description\"]\n new_answer.is_correct = k[\"is_correct\"]\n new_question.association(:answers).add_to_target(new_answer)\n end\n @assignment.association(:questions).add_to_target(new_question)\n end\n \n if @assignment.save\n render :show, status: :created, location: @assignment\n else\n render json: @assignment.errors, status: :unprocessable_entity\n end\n end",
"def update\n self.params[:user_submit][:user_answers_attributes].each do |key,value|\n params[:user_submit][:user_answers_attributes][key] = params[:user_submit][:user_answers_attributes][key].merge(:user_id => current_user.id)\n end\n @user_submit = UserSubmit.find(params[:id])\n @user_submit.update_attributes(params[:user_submit])\n @user_submit.user = current_user\n #@user_submit.exam_id = @examid\n respond_to do |format|\n @user_submit.locked = 1\n @user_submit.grade = @user_submit.exam.calc_grade(@user_submit)\n if @user_submit.save\n @user_submit.exam.locked = 1\n @user_submit.exam.save\n @user_submit.exam.questions.each do |useq|\n useq.locked = 1\n useq.answers.each do |uqa|\n uqa.locked = 1\n uqa.save\n end\n end\n \n format.html { redirect_to exams_url, notice: 'User submit was successfully created.' }\n format.json { render json: @user_submit, status: :created, location: @user_submit }\n else\n #format.html { render action: \"new\" }\n format.json { render json: @user_submit.errors, status: :unprocessable_entity }\n format.html { redirect_to exams_url, notice: 'NOTICE! You may only submit answers for this exam once. See your instructor for permission to re-take the exam.' }\n end\n end\n end",
"def set_exam_result\n @exam_result = ExamResult.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exam_params\n params.require(:exam).permit(:note, :student_id, :evaluation_id)\n end",
"def assign_all\n @batch = Batch.shod(params[:id])\n @exam_groups = @batch.exam_groups.all\n end",
"def written_exam_params\n params[:written_exam].permit(:title, :description, :subject_id, :date, :sgroup_id, :sclass_id, :additional_info_url, :passed)\n end",
"def update\n if @placement_exam.update(placement_exam_params)\n redirect_to @placement_exam\n flash[:notice] = 'Placement exam was successfully updated.'\n else\n render 'edit'\n end\n end",
"def set_user_cantake_own\n exam_name = params[:exam_name]\n thisMasterExam = MasterExam.where(name: exam_name).where(user_id: session[:user_id]).last\n\n unless Cantake.exists?(master_exam: thisMasterExam, user_id: session[:user_id])\n cantake = Cantake.new\n cantake.master_exam_id = thisMasterExam.id\n cantake.user_id = session[:user_id]\n cantake.save!\n end\n\n respond_to do |format|\n format.json { render json: usersFromGroups.to_json }\n end\n end",
"def set_exam_student\n @exam_student = ExamStudent.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to course_exams_url(@exam.course_id), notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_past_exam\n @past_exam = PastExam.includes(:course, :uploader).find(params[:id])\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @my_exam = MyExam.find(params[:id])\n\n respond_to do |format|\n if @my_exam.update_attributes(params[:my_exam])\n format.html { redirect_to @my_exam, notice: 'My exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_faculty_details\n\t# add semester id to query\n\tfaculty_courses_arr = FacultyCourse.includes(:course1,:course2,:course3).where(\"semester_id = ? and faculty_id = ?\",session[:semester_id],params[:faculty_id])\n\tif faculty_courses_arr.length == 0\n\t\t@course_assignments = []\t\n\telse\n\t\tfaculty_courses = faculty_courses_arr[0]\n\t\t@courses = build_courses_object([faculty_courses.course1,faculty_courses.course2,faculty_courses.course3])\n\t\t@course_assignments = CourseAssignment.includes(:room).where(\"semester_id = ? and faculty_id = ?\",session[:semester_id],params[:faculty_id])\n\t\t@buildings = Building.all\n\t\t@assigned_building_ids = {}\n\t\t@courses.each_key {|key|\n\t\t\tsetup_course_assignment(params[:faculty_id],key)\n\t\t}\n\tend\n\trespond_to do |format|\n\t\tformat.js\n\tend\n end",
"def exam_params\r\n params.require(:exam).permit(\r\n :title, :time, :category_id,\r\n questions_attributes: [\r\n :id, :title, :score, :_destroy,\r\n options_attributes: [:id, :content, :is_correct, :_destroy]\r\n ])\r\n #params.require(:exam).permit(:title, :time, :category_id)\r\n end",
"def create\n @test = Test.new(test_params)\n @test.update_question_details(test_params) if @test.valid?\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_written_exam\n @written_exam = WrittenExam.find(params[:id])\n end",
"def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n flash[:notice] = 'Exam was successfully updated.'\n format.html { redirect_to(@exam) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @exam.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit_question\n @questions=Admin::Questionbank.find(:all,:select=>\"id,question_code,subject_name,question_number,internal_ref_number\",:order=>'created_at DESC',:limit=>3)\n @questionbank=Admin::Questionbank.find(params[:id])\n @examtypes=Admin::Examtype.find(:all,:select=>\"id,examtype\",:order=>'examtype')\n @sectiontopics=Admin::Sectiontopic.find(:all,:select => 'DISTINCT Topic,id')\n @sectiontags=Admin::Sectiontemplate.find(:all,:select=>'SectionTags')\n end",
"def update\n @questions = Question.all\n @categories = [\"Learning from Labs\", \"Lab Instructor\", \"Lab Space and Equipment\", \"Time Required to Complete Labs\", \"Lecture Section Instructor\"]\n respond_to do |format|\n if @survey.update(survey_params)\n format.html { redirect_to @survey, notice: 'Survey was successfully submitted.' }\n format.json { render :show, status: :ok, location: @survey }\n\n # Update 'completed' attribute to true\n submission = Survey.find_by(survey_ID: @survey.survey_ID)\n submission.update(status: true)\n\n # Increment 'completed' attribute for section\n @section = Section.find_by(class_num: @survey.class_num)\n @section.update(completed: @section.completed + 1)\n\n\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n if !params[:project_id] && !params[:study_id] && !params[:id]\n flash[\"error\"] = \"To add a new study, please choose a systematic review first.\"\n redirect_to projects_paths\n else \n @study = Study.find(params[:id])\n #puts \"---------------------\\n THE STUDY ID IS #{@study.id}\\n\\n\"\n @study_extforms = StudyExtractionForm.find(:all, :conditions=>[\"study_id=?\",@study.id],:select=>[\"id\",\"study_id\",\"extraction_form_id\"],:order=>\"extraction_form_id ASC\")\n @extraction_forms = Array.new\n\n # an array of hashes to keep track of key questions addressed by\n # each individual section\n @ef_kqs = Hash.new()\n unless @study_extforms.empty?\n @study_extforms.each do |ef|\n @ef_kqs[ef.extraction_form_id] = ExtractionForm.get_assigned_question_numbers(ef.extraction_form_id)\t\n end\n end\t \n session[:project_id] = @study.project_id \n @project = Project.find(@study.project_id)\n\n unless @study_extforms.empty?\t\t\t\n # get the study title, which is the same as the primary publication for the study\n @study_title = PrimaryPublication.where(:study_id => @study.id).first\n @study_title = @study_title.nil? ? \"\" : @study_title.title.to_s\t\n #@extraction_form_list_array = Study.get_extraction_form_list_array(session[:project_id])\n @extraction_forms = ExtractionForm.find(:all, :conditions=>[\"id in (?)\",@study_extforms.collect{|x| x.extraction_form_id}])\n @current_form_id = params[:extraction_form_id].nil? ? @extraction_forms.first.id : params[:extraction_form_id].to_i\n @included_sections = ExtractionForm.get_included_sections(@current_form_id)\n end\t\t\t\n # Set up the session variables\n makeStudyActive(@study)\n session[:extraction_form_id] = @current_form_id\n session[:completed_sections] = Study.get_completed_sections(@study.id, @current_form_id)\n end\n end",
"def update\n @sectionstatus = [:Active,'active'],[:InActive,'inactive']\n # @QuestionChoosenby = [:LastModified,'LastModified'],[:EarlierModified,'EarliestModified'],[:Random,'Random']\n @examtemplates = Admin::Examtemplate.find(:all,:select=>\"ExamTemplate_Id,TemplateName\")\n @subjects = Admin::Subject.find(:all,:select=>\"id,subject_name\")\n @sectiontemplates = Admin::Sectiontemplate.find(:all,:select=>\"SectionTemplate_Id,SectionTitle\")\n @sectiontemplate = Admin::Sectiontemplate.find(params[:id])\n if params[:include]=='on'\n @sectiontemplate.Included = 1\n else\n @sectiontemplate.Included = 0\n end\n @sectiontemplate.SectionStatus = params[:SectionStatus]\n @sectiontemplate.SuitableQuestionChosenBy = params[:SuitableQuestionChosenBy]\n @sectiontemplate.SectionMinimumTagMatch = 0\n @sectiontemplate.SectionTags = params[:sectiontemplate][:SectionTags]\n respond_to do |format|\n if @sectiontemplate.update_attributes(params[:sectiontemplate])\n @sectiontemplate.save\n flash[:notice] = 'Admin::Sectiontemplate was successfully updated.'\n format.html { redirect_to :action=>\"show\", :id => @sectiontemplate.id }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sectiontemplate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @group = Group.find(params[:group_id])\n @assignment = @group.assignments.build\n @assignment.due_date = Date.today\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment }\n end\n end",
"def create\n\t\n\t@exam_answer = ExamAnswer.new(exam_answer_params)\n\tif @exam_answer.exam_id == 999\n\t\t@exam_answer.exam_level = params[:exam_lv]\n\t\t@questions = Question.all.where(level: params[:exam_lv])\n\t\t@exams_questions = @questions.all.where(id: [params[:q1_id], params[:q2_id], params[:q3_id], params[:q4_id], params[:q5_id], params[:q6_id], params[:q7_id], params[:q8_id], params[:q9_id], params[:q10_id]])\n\telse\n\t\t@exam = Exam.find(@exam_answer.exam_id)\n\t\t@exam_answer.exam_level = @exam.level\n\t\t@questions = Question.all.where(level: @exam_answer.exam_level)\n\t\t@exams_questions = @questions.all.where(id: [@exam.question1, @exam.question2, @exam.question3, @exam.question4, @exam.question5, @exam.question6, @exam.question7, @exam.question8, @exam.question9, @exam.question10])\n\tend\n\t\n\t@exam_answer.user_id = current_user.id\n\t@exam_answer.ans1 = params[:q1]\n\t@exam_answer.q1 = (@exam_answer.ans1 == @exams_questions[0].answerR ? true : false)\n\t@exam_answer.ans2 = params[:q2]\n\t@exam_answer.q2 = (@exam_answer.ans2 == @exams_questions[1].answerR ? true : false)\n\t@exam_answer.ans3 = params[:q3]\n\t@exam_answer.q3 = (@exam_answer.ans3 == @exams_questions[2].answerR ? true : false)\n\t@exam_answer.ans4 = params[:q4]\n\t@exam_answer.q4 = (@exam_answer.ans4 == @exams_questions[3].answerR ? true : false)\n\t@exam_answer.ans5 = params[:q5]\n\t@exam_answer.q5 = (@exam_answer.ans5 == @exams_questions[4].answerR ? true : false)\n\t@exam_answer.ans6 = params[:q6]\n\t@exam_answer.q6 = (@exam_answer.ans6 == @exams_questions[5].answerR ? true : false)\n\t@exam_answer.ans7 = params[:q7]\n\t@exam_answer.q7 = (@exam_answer.ans7 == @exams_questions[6].answerR ? true : false)\n\t@exam_answer.ans8 = params[:q8]\n\t@exam_answer.q8 = (@exam_answer.ans8 == @exams_questions[7].answerR ? true : false)\n\t@exam_answer.ans9 = params[:q9]\n\t@exam_answer.q9 = (@exam_answer.ans9 == @exams_questions[8].answerR ? true : false)\n\t@exam_answer.ans10 = params[:q10]\n\t@exam_answer.q10 = (@exam_answer.ans10 == @exams_questions[9].answerR ? true : false)\n\t\n\trec_point = (@exam_answer.q1 ? 1:0) + (@exam_answer.q2 ? 1:0) + (@exam_answer.q3 ? 1:0) + (@exam_answer.q4 ? 1:0) + (@exam_answer.q5 ? 1:0) + (@exam_answer.q6 ? 1:0) + (@exam_answer.q7 ? 1:0) + (@exam_answer.q8 ? 1:0) + (@exam_answer.q9 ? 1:0) + (@exam_answer.q10 ? 1:0)\n\tpoints = rec_point/10.to_f\n\tif @exam_answer.exam_id == 999\n\t\tif params[:exam_lv] == \"Początkujący\"\n\t\t\tpoints2 = points*10.to_i\n\t\telse\n\t\t\tpoints2 = points*20.to_i\n\t\tend\n\telse\n\t\tpoints2 = points*@exam.points.to_i\n\tend\n\t@exam_answer.rec_points = points2\n\n\tif @exam_answer.exam_id == 999\n\t\ttemp = 7/10.to_f\n\t\tif params[:exam_lv] == \"Początkujący\"\n\t\t\t@min = temp*10.to_i\n\t\telse\n\t\t\t@min = temp*20.to_i\n\t\tend\n\telse\n\t\ttemp = 7/10.to_f\n\t\t@min = temp*@exam.points.to_i\n\tend\n\n\tif @exam_answer.rec_points >= @min\n\t\t@user_progress = UserProgress.find_by user_id: current_user.id\n\t\tif @exam_answer.exam_id == 999\n\t\t\tif params[:exam_lv] == \"Początkujący\" && @user_progress.p10?\n\t\t\t\t@user_progress.update(poczatkujacy: true)\n\t\t\telsif params[:exam_lv] == \"Zaawansowany\" && @user_progress.z10?\n\t\t\t\t@user_progress.update(complete_all: true)\n\t\t\t\t@user_progress.update(zaawansowany: true)\n\t\t\tend\n\n\n\t\telse\n\n\t\t\tif @exam.level == \"Początkujący\" && @user_progress.p10?\n\t\t\t\t@user_progress.update(poczatkujacy: true)\n\t\t\telsif @exam.level == \"Zaawansowany\" && @user_progress.z10?\n\t\t\t\t@user_progress.update(complete_all: true)\n\t\t\t\t@user_progress.update(zaawansowany: true)\n\t\t\tend\n\t\tend\n\t\tcurrent_user.increment!(:points, points2)\n\t\trespond_to do |format|\n\t\t if @exam_answer.save\n\t\t format.html { redirect_to @exam_answer, :notice => \"Zdales egzamin!.\" }\n\t\t format.json { render :show, status: :created, location: @exam_answer }\n\t\t else\n\t\t format.html { render :new }\n\t\t format.json { render json: @exam_answer.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\t\t\n\telse\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to exam_list_path , :notice => \"Nie zdales egzaminu, zdobyles za malo punktow, liczba otrzymanych punktow - #{@exam_answer.rec_points} , minimum do zdania - #{@min}\" }\n\t\t format.json { render exam_list_path, status: :unprocessable_entity , location: exam_list }\n\t\tend\n\tend\nend",
"def set_group_emp\n @group_emp = GroupEmp.find(params[:id])\n end",
"def exam_params\n params.require(:exam).permit(:exam_category_id, :name, :start_date)\n end",
"def set_exam\n @exam=Exam.find(params[:exam_id]) \n redirect_to root_url, :alert => '项目已关闭' if @exam.closed? && !current_user.is_s_admin? \n rescue\n redirect_to root_url, :alert => '项目不存在'\n end",
"def update\n update_init(@written_exam)\n respond_to do |format|\n if @written_exam.update(written_exam_params)\n format.html { redirect_to @written_exam, notice: 'Written exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @written_exam }\n else\n format.html { render :edit }\n end\n end\n end",
"def update_quiz\n @questionnaire = Questionnaire.find(params[:id])\n redirect_to :controller => 'submitted_content', :action => 'edit', :id => params[:pid] if @questionnaire == nil\n if params['save']\n @questionnaire.update_attributes(params[:questionnaire])\n\n for qid in params[:question].keys\n question_advices = QuestionAdvice.find_all_by_question_id(qid)\n i=1\n for question_advice in question_advices\n if params[:question][qid][\"weight\"] == i.to_s\n score = 1\n else\n score = 0\n end\n i+=1\n question_advice.update_attributes(:score => score, :advice => params[:question_advice][question_advice.id.to_s][\"advice\"])\n end\n end\n save_questionnaire\n #save_choices @questionnaire.id\n end\n redirect_to :controller => 'submitted_content', :action => 'edit', :id => params[:pid]\n end",
"def update\n if @question.update(question_params)\n redirect_to overview_exam_path(@question.exam), notice: _('Question was successfully updated.')\n else\n render :edit\n end\n end",
"def create\n @detail = Detail.new(params[:detail])\n @guests = Guest.all_by_name\n @groups = Group.all_by_name\n respond_to do |format|\n if @detail.save\n @guests.each do |guest|\n if params.has_key?(:guest_assign) and params[:guest_assign][guest.id.to_s] == \"true\"\n @detail.guests << guest unless @detail.guests.include?(guest)\n else\n @detail.guests.delete (guest) if @detail.guests.include?(guest)\n end\n end\n @groups.each do |group|\n if params.has_key?(:group_assign) and params[:group_assign][group.id.to_s] == \"true\"\n @detail.groups << group unless @detail.groups.include?(group)\n else\n @detail.groups.delete (group) if @detail.groups.include?(group)\n end \n end \n format.html { redirect_to admin_details_path, notice: 'Detail was successfully created.' }\n format.json { render json: @detail, status: :created, location: @detail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:group_id])\n @survey = Survey.find(params[:id])\n if @survey.update_attributes(params[:survey])\n redirect_to group_survey_url(@group, @survey)\n else\n render :action => \"edit\"\n end\n end",
"def update\n respond_to do |format|\n if @exam_management.update(exam_management_params)\n format.html { redirect_to @exam_management, notice: 'Exam management was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_management }\n else\n format.html { render :edit }\n format.json { render json: @exam_management.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_questionnaire\n @user = current_employee\n success = false\n @vendor_questionnaire = VendorQuestionnaire.new(params[:vendor_questionnaire])\n @vendor_questionnaire.employee_id = @user.id\n if @vendor_questionnaire.save\n params[:approver_id].each do |f|\n @vendor_questionnaire.vendor_questionnaire_groups.new({questionnaire_group_id: f[0],approver_id: f[1]}).save #f[0] questionnaire_group_id f[1] employee_id \n end\n success = true\n else\n success = false\n end \n respond_to do |format|\n if success\n format.html { redirect_to show_question_path(@vendor_questionnaire), notice: 'Sent questionnaire successfully.' }\n format.json { render json: @vendor_questionnaire, status: :created, location: show_question_path(@vendor_questionnaire) } \n else\n format.html { render :action => \"init_questionnaire_workflow\" }\n format.json { render json: @vendor_questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @exam = Exam.new(exam_params)\r\n\r\n if @exam.save\r\n redirect_to @exam, notice: \"Exam was successfully created.\"\r\n else\r\n render :new, status: :unprocessable_entity\r\n end\r\n end",
"def update\n if @group_question_alternative.update(group_question_alternative_params)\n render status: :ok, json: @group_question_alternative\n else\n self.send(:edit)\n end\n end",
"def set_exam_subject\n @exam_subject = ExamSubject.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n (params[:show_level].to_i == 0) ?\n @employee.update_attributes(:group_ids => nil, :level_id => nil) :\n @employee.update_attributes(:group_ids => params[:group][:group_ids])\n Tools.write2log(current_user.id, 'Обновление', 'Сотрудники', 0, employee_params.to_s)\n format.html { redirect_to @employee, notice: 'Сотудник успешно обновлен.' }\n format.json { head :no_content }\n else\n Tools.write2log(current_user.id, 'Обновление', 'Сотрудники', 1, employee_params.to_s)\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @questionnaire.update_attributes(\n status: :completed,\n answer: questionnaire_params.to_xml\n )\n render_to_msg('Успешно пройден')\n rescue => e\n logger.info(\"ОШИБКА: #{e}\")\n @questionnaire.update_attributes(status: :error)\n render_to_msg('Возникла непредвиденная ошибка, попробуйте еще раз')\n end"
] |
[
"0.7148046",
"0.6666313",
"0.65075696",
"0.64741886",
"0.643703",
"0.62673664",
"0.62630004",
"0.6207287",
"0.6192626",
"0.6178154",
"0.61411303",
"0.6140417",
"0.6131471",
"0.6131471",
"0.6131471",
"0.6131471",
"0.6131471",
"0.6131471",
"0.6131471",
"0.6131471",
"0.6131471",
"0.61311376",
"0.61296177",
"0.6115577",
"0.60982865",
"0.6059952",
"0.6045212",
"0.60392094",
"0.60340863",
"0.5995852",
"0.5993958",
"0.5986609",
"0.59766513",
"0.59534967",
"0.5926178",
"0.5896419",
"0.5888085",
"0.5882867",
"0.5879578",
"0.58695966",
"0.5860558",
"0.58370316",
"0.5830501",
"0.57965183",
"0.5792445",
"0.57758904",
"0.5768817",
"0.5767171",
"0.57601",
"0.57552475",
"0.5751328",
"0.57507044",
"0.5747761",
"0.57463133",
"0.574264",
"0.5740448",
"0.5736958",
"0.5736845",
"0.5722969",
"0.5718763",
"0.5715698",
"0.5715698",
"0.5715698",
"0.5715698",
"0.5699892",
"0.5698074",
"0.5697062",
"0.5695054",
"0.5693759",
"0.5691092",
"0.568153",
"0.5680686",
"0.5678547",
"0.56721723",
"0.56606185",
"0.56534255",
"0.5649081",
"0.5637982",
"0.5633968",
"0.5628792",
"0.5625078",
"0.5624064",
"0.5614995",
"0.5611726",
"0.5605891",
"0.5605649",
"0.5596355",
"0.55959743",
"0.5595797",
"0.55945337",
"0.5593999",
"0.55920553",
"0.55889684",
"0.5588069",
"0.55873793",
"0.5585887",
"0.5580964",
"0.55757236",
"0.5565592",
"0.5562926"
] |
0.6345654
|
5
|
This action perform the operation on previous exam details. exam array is created for storing the previous exam details.
|
def exam_details(ex)
exams_data = ex.exams.all
flag = false
exams_data.each do |exam|
exam.exam_scores.each do |es|
flag = true if es.is_failed?
end
exams << exam if flag == true
end
exams
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def previous_exam_scores\n @exam = Exam.shod(params[:format])\n @exam_scores = @exam.is_failed\n # authroize! :update, @exam\n end",
"def prev\n\t\t\t\t@index -= 1\n\t\t\t\tself._update\n\t\t\t\tself\n\t\t\tend",
"def store_previous\n end",
"def previous_history()\r\n @history_offset!=0 ? @the_history[@history_offset-=1] : nil\r\n end",
"def undo\n if current_ident == @undo.last\n # reset\n self.current_db_value = current_question[\"question\"].value\n @undo.pop\n update_toolbar\n else\n old = @all_failed_questions.assoc(@undo.last)\n return unless old\n self.current_question = old[1]\n end\n end",
"def previous(n)\n previous_answers = Answer.where(user_id: self.user_id, team_id: self.team_id, question_id: self.question_id).desc(:created_at).lte(created_at: self.created_at)[0..n]\n\n x = previous_answers.count\n if x > 0\n i = 0\n while i < x - 1\n previous_answers[i]['previous'] = previous_answers[i+1].response.clone\n puts i\n puts previous_answers[i]['previous']\n i = i + 1\n end\n previous_answers[i]['previous'] = \"\"\n end\n\n previous_answers\n end",
"def previous_question\n if @question.question_type == \"quiz\"\n @previous_question = @question.id - 10\n if @previous_question < 0\n @previous_question = @previous_question + 69\n end\n elsif @question.question_type == \"self-guided\"\n if @question.id > 71\n @previous_question = @question.id - 1\n end\n end\n end",
"def previous\n validates_possibility_of :previous\n self.index -= 1\n self.current\n end",
"def previous_track()\n @ole.PreviousTrack()\n end",
"def previous_history\n history_size = @history.size\n\n @history_index = if @history_index && @history_index < history_size\n [@history_index + 1, history_size - 1].min\n else\n 0\n end\n\n self.value = @history[@history_index]\n end",
"def set_previous\n @activity_sequence = ActivitySequence.find(params[:id])\n @activity_sequence.set_previous\n redirect_to myp_path(@activity_sequence.current_activity)\n end",
"def previous\n self.new_record? ? nil : Slide.where(:lesson_id => self.lesson_id, :position => (self.position - 1)).first\n end",
"def previous\n\t\t@result = nil\n\t\t@skip = (@skip || 0) - get_resultcount\n\t\t@skip = [0, @skip].max\n\t\treturn self\n\tend",
"def select_prev_question\n prev = find_prev_next_question[0]\n self.current_question = prev if prev\n end",
"def previous\n self.offset(-1)\n end",
"def previous_action_plan\n index_for_me = enrollment.action_plans.index(self)\n return nil if index_for_me == 0 # first, no other action item\n enrollment.action_plans[index_for_me-1]\n end",
"def previous\r\n\r\n Access.first(:order => 'accesses.id DESC', :conditions => [\"accesses.id < ?\", self.id])\r\n end",
"def previous\n @faq = @faq.previous_version\n show\n end",
"def previous_page!\n previous_page.tap { |page| update_self(page) }\n end",
"def answer_exam\n if params[:year_exam] \n questions ||= Question.where(year: params[:year_exam])\n assert(questions.kind_of?(Question))\n else\n questions ||= Question.all\n assert(questions.kind_of?(Question))\n end\n\n if !questions.empty?\n auxiliar_exam ||= push_questions_auxiliar(questions)\n @exam = push_questions(auxiliar_exam)\n else\n redirect_to_back(select_exam_path)\n if params[:year_exam]\n flash[:danger] = t(:year_exam_not_found)\n else\n flash[:danger] = t(:exam_not_found)\n end\n end\n end",
"def prev\n\t\t@prev\n\tend",
"def prev\n\t\tprev_study_subject = StudySubject\n\t\t\t.where(StudySubject.arel_table[:id].lt(@study_subject.id))\n\t\t\t.order('id desc').limit(1).first\n\t\tif prev_study_subject.nil?\n\t\t\tflash[:warn] = \"Rolled over\"\n\t\t\tprev_study_subject = StudySubject.order('id desc').first\n\t\tend\n\t\tredirect_to url_for_subject(prev_study_subject)\n\tend",
"def previous\n @pointer -= 1\n end",
"def assessment_before\n sorted_asmts = course.assessments.ordered\n self_index = sorted_asmts.index self\n self_index > 0 ? sorted_asmts[self_index - 1] : nil\n end",
"def prev\n @history_idx += 1 if @history_idx < @history.length - 1\n current\n end",
"def prevQuestion()\n return if $intQuestionOnScreen == 0 || $intQuestionOnScreen == 1\n $btnNext.state = 'enabled'\n $intQuestionOnScreen -= 1\n if $intQuestionOnScreen == 1\n $btnPrev.state = 'disabled'\n end\n destroyChoicesOnScreen()\n resetAnswerLabelColors()\n printQuestionOnScreen()\n printAnswersOnScreen()\n printChoicesOnScreen()\n printUsersChoiceOnScreen()\nend",
"def compare_feedback(feedbackArr)\n prev_fb = \n end\nend",
"def previous\n end",
"def previous\n end",
"def previous_track\n reload\n (@current_track_index > 0 ? @tracks[@current_track_index - 1] : nil)\n end",
"def take\n @exam = current_exam(params)\n end",
"def previous_element; end",
"def prev\n puts(\"works\")\n @todos = Todo.all\n end",
"def previous\n first? ? nil : @collection[index - 1]\n end",
"def previous\n \tWork.first(:conditions => ['id < ?', id], :order => \"id desc\")\n\tend",
"def previous_week\n first_day = params[:beginning_of_current_week].to_date\n prev_week = first_day.prev_week\n\n @week_dates = (\n prev_week.at_beginning_of_week..prev_week.at_end_of_week\n ).to_a\n\n @availabilities_slots = AvailabilitiesConstant::AVAILABILITIES_SLOTS\n @expert = Expert.find(params[:expert_id])\n @month = Date::MONTHNAMES[prev_week.at_beginning_of_week.month]\n @year = params[:year] || prev_week.at_beginning_of_week.year\n # TODO: Pass the date selected to the next previous of the calendar\n # @dates_selected = params[:date_selected] || []\n # @package_option = params[:package_option] || 5\n @appointment_pack = AppointmentPack.new\n\n # Preserve dates_selected in sessions\n session[:dates_selected] = params[:dates_selected]\n end",
"def prev_item\n storage.rotate!(-1)\n\n update\n end",
"def last_exercise_done_before(index)\n if self.user_sequence[index][2] \n return self.user_sequence[index][0]\n else\n index -= 1\n while index >= 0 && !self.user_sequence[index][2] do\n index -= 1\n end\n if index >= 0\n return self.user_sequence[index][0]\n else\n return nil\n end\n end \n end",
"def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend",
"def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend",
"def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend",
"def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend",
"def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend",
"def previous\n raise NameError, \"Already at the start of the series\" if start?\n @count -= 1\n self\n end",
"def last_exercise_correctly_done_before(index)\n index -= 1\n while index >= 0 && !self.user_sequence[index][3] do\n index -= 1\n end\n if index >= 0\n return self.user_sequence[index][0]\n else\n return nil\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 previous!\n counter_rotate!.first\n end",
"def exam_result\n if params[:exam_id]\n @exam = Exam.find(params[:exam_id])\n assert(exam.kind_of?(Exam))\n @exam = fill_user_answers(@exam)\n\n current_user.exams_total_questions += @exam.questions.count\n current_user.update_attribute(:exam_performance, current_user.exam_performance + [@exam.accepted_answers])\n\n @exam.save\n return @exam.user_answers\n else\n return redirect_to_back\n flash[:danger] = t(:exam_message)\n end\n end",
"def previous\n layout.rows[number-1] unless first?\n end",
"def previous\r\n\r\n SmartQuery.first(:order => 'smart_queries.id DESC', :conditions => [\"smart_queries.id < ?\", self.id])\r\n end",
"def fixPrevArr\r\n temp1 = @@previousClasses[1];\r\n temp2 = @@previousClasses[2];\r\n @@previousClasses[0] = temp1;\r\n @@previousClasses[1] = temp2;\r\n @@previousClasses[2] = @@previousClasses[3]\r\n @@previousClasses.pop\r\n end",
"def previous_page!\n return unless previous_page?\n @page -= 1\n clear!\n end",
"def previous_workshop\n course = self.chapter.course\n course.workshops.previous_than(self.place).where(:hidden => false).order(\"place desc\").first\n end",
"def undo\n if(@history != nil)\n @history.undo\n end\n end",
"def previous\r\n\r\n SavedReport.first(:order => 'saved_reports.id DESC', :conditions => [\"saved_reports.id < ?\", self.id])\r\n end",
"def previous\n connection.write(\"prev\")\n end",
"def previous\n at(position - 1)\n end",
"def get_prev()\n\t\t\treturn @prev\n\t\tend",
"def set_past_exam\n @past_exam = PastExam.includes(:course, :uploader).find(params[:id])\n end",
"def previous\t \n @music.off\n @song.kill\n @count -= 2\n end",
"def previous_queries\n self.form_field_value.queries.id_lt(self.id)\n end",
"def set_previous_action\n session[:typus_previous] = nil\n if params[:bta] && params[:btm]\n previous = Hash.new\n previous[:btm], previous[:bta], previous[:bti] = params[:btm], params[:bta], params[:bti]\n session[:typus_previous] = previous\n end\n end",
"def previous_judgement_made\n query_doc_pair.book.judgements.where(judgements: { user_id: user.id }).where(\n 'judgements.updated_at < ?', updated_at.nil? ? DateTime.current : updated_at\n ).reorder('judgements.updated_at DESC').first\n end",
"def previous_step\n self.step_flow.previous_step if can_decrement_step\n end",
"def previous\n return nil unless fund_item && previous_perspective\n fund_item.fund_editions.previous_to( self )\n end",
"def prev\n prev_id == 0 ? nil : story.cards.find(prev_id)\n end",
"def previous\n\t first? ? nil : locate - 1\n\tend",
"def previous(query)\n unless query.nil?\n index = query.find_index(self.id)\n if index\n prev_id = query[index-1] unless index.zero?\n self.class.find_by_id(prev_id)\n end\n end\n end",
"def recall\n history_item_array = File.open(HISTORY_FILE).to_a\n last_controller.instance_variable_set(:@history, history_item_array) # should be current controller FIXME\n\n # if i want to evaluate, i'd do it here.\n \n history_item_array.join \"\\n\"\n end",
"def previous_row num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier)\n @oldrow = @current_index\n # NOTE that putting a multiplier inside, prevents an event from being triggered for each row's\n # on leave and on enter\n num.times { \n @current_index -= 1 if @current_index > 0\n }\n bounds_check\n $multiplier = 0\n end",
"def rewind\n @history_idx = -1\n end",
"def previous_list\n @_previous ? @resource.list(abs_url: @_previous) : nil\n end",
"def previous_version!(steps_back = 0)\n prev_version = previous_version(steps_back)\n\n prev_version.save if prev_version.present?\n end",
"def previous_events(event)\n # Initialise the hash to use an empty array as default value\n @dups ||= Hash.new { |h, k| h[k] = [] }\n one_hour_earlier = event.start.advance(:hours => -1)\n @dups[one_hour_earlier]\n end",
"def previous_autolist; end",
"def prev\n perform_request(prev_page_uri) if prev_page_uri\n end",
"def set_history\n @quiz = Quiz.find(params[:id])\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 intend_previous\n intend_with :last, :previous\n end",
"def intend_previous\n intend_with :last, :previous\n end",
"def previous\n \t# CashbookIndex.where(\"id < ?\", id).order(\"id DESC\").first || CashbookIndex.last\n \tCashbookIndex.where(\"id < ?\", id).order(\"id DESC\").first || CashbookIndex.last\n\n \tend",
"def prev\n Issue.find(:first, :conditions => ['date < ?', date], :order => 'date DESC')\n end",
"def prev(current)\n l = current\n l = l[0,1] if (l.length > 0 and l[0,1] == '\\n')\n l = l[-1,1] if (l.length > 0 and l[-1,1] == '\\n')\n if (@position > 0)\n if (@position == (@history.length - 1))\n @history[@history.length - 1] = l\n end\n @position = @position - 1\n return @history[@position]\n end\n return current\n end",
"def prev\n\t\tTask.order(:position).where(\"position < ?\", position).last\n\tend",
"def prev_item\n @current -= 1 if @current > 0\n\n items\n end",
"def previous\n @agenda_item = @agenda_item.previous_version\n show\n end",
"def prev\n params[:topic] ||= ''\n @flash_cards = FlashCard.find(\n :all,\n :conditions => [\"lower(topic) = ?\", params[:topic].downcase],\n :order => :id\n )\n @flash_card = nil\n @flash_cards.detect do |item|\n if item.id.to_s == params[:id]\n next true\n end\n @flash_card = item\n false\n end\n @flash_card ||= @flash_cards.last\n \n respond_to do |format|\n format.json { render :json => @flash_card }\n end\n end",
"def final_estimate\n return [] unless @previous\n cepstra = [@previous.last] * 3\n self.<< cepstra\n end",
"def previous__clicked(*argv)\t\t\t\t\n\t\tif @@page == 0 \n\t\telse\n\t\t\t@@page = @@page - 8\n\t\t\trefresh_links()\n\t\t\tif @@load_favs != 0\t\n\t\t\t\tshow_favs()\n\t\t\tend\n\t\tend \n\tend",
"def previous\n account.statements.except(:order).chronologically.entered_before( first.entered_at ).last\n end",
"def prev_page\n self.survey_version.pages.where(:page_number => (self.page_number - 1)).first\n end",
"def redoPrevious\n if !@undoRedo.redoStack.empty?\n n2 = @undoRedo.redoStack.pop()\n n1 = @undoRedo.redoStack.pop()\n\n @undoRedo.undoStack << n2\n @undoRedo.undoStack << n1\n \n \n ajoutPont(n2,n1)\n end\n\n return self\n end",
"def previous_perspective\n i = perspective_index\n return nil unless i && i > 0\n PERSPECTIVES[i - 1]\n end",
"def previous(offset = 0)\n self.class.joins(\"LEFT OUTER JOIN comments ON comments.interview_id = interviews.id\").where(\"(interviews.status is null or interviews.status != 'Cancelled') && interviews.id < ? && interviews.candidate_id = ? && scheduled_at < ?\", self.id, self.candidate_id, self.scheduled_at).limit(1).offset(offset).order(\"scheduled_at DESC\")\n end",
"def prev\n prev_qtr_code = quarter_code_id == 1 ? 4 : quarter_code_id - 1\n prev_year = quarter_code_id == 1 ? year - 1 : year\n Quarter.find_easily(prev_qtr_code, prev_year)\n end",
"def previous_form\n json_form.previous_form(parsed_json['id'])\n end",
"def do_back\n update_screen(get_step_content(@step - 1, @editor.value, @output.value))\n end",
"def generate_prev\n session[:solution] == nil && generate\n \n session[:marker] -= NPREVIEWS\n\n if session[:marker] < 0\n if session[:solution].length.remainder(NPREVIEWS) == 0\n session[:marker] = session[:solution].length - NPREVIEWS\n else\n session[:marker] = session[:solution].length - session[:solution].length.remainder(NPREVIEWS)\n end\n end\n\n session[:solution] && load_sections\n end",
"def prev\n\t\tself - 1\n\tend"
] |
[
"0.7099587",
"0.6062366",
"0.5898293",
"0.58408016",
"0.5803944",
"0.580328",
"0.579849",
"0.56985885",
"0.5676732",
"0.5665027",
"0.56191283",
"0.55863595",
"0.5566228",
"0.5560191",
"0.5552402",
"0.5546334",
"0.5533822",
"0.5528557",
"0.5526977",
"0.55164504",
"0.551188",
"0.5500107",
"0.5481794",
"0.54814094",
"0.547888",
"0.5457587",
"0.5433796",
"0.543124",
"0.543124",
"0.54241854",
"0.5383862",
"0.535738",
"0.5349567",
"0.5331474",
"0.53291476",
"0.5315161",
"0.5309987",
"0.52891177",
"0.5284065",
"0.5284065",
"0.5284065",
"0.5284065",
"0.5284065",
"0.526141",
"0.52329975",
"0.522288",
"0.522288",
"0.52171445",
"0.5191588",
"0.5183631",
"0.51461226",
"0.51437",
"0.51310295",
"0.5104336",
"0.50987124",
"0.508943",
"0.50836307",
"0.5081061",
"0.50790864",
"0.5076544",
"0.50703865",
"0.5066225",
"0.5062886",
"0.5060428",
"0.5048654",
"0.5048123",
"0.5046097",
"0.504124",
"0.50384194",
"0.50379264",
"0.50292164",
"0.50279266",
"0.5016214",
"0.5015061",
"0.5013447",
"0.5004743",
"0.50015044",
"0.49994752",
"0.49945635",
"0.49888587",
"0.49888587",
"0.4987003",
"0.49832073",
"0.496986",
"0.49665788",
"0.4963124",
"0.49531063",
"0.4945318",
"0.4939577",
"0.49380398",
"0.49366173",
"0.4932281",
"0.49312544",
"0.49230963",
"0.49181327",
"0.49061266",
"0.48988658",
"0.48970345",
"0.48909783",
"0.48895538"
] |
0.5326191
|
35
|
This action called when user publish the result of student. In this action date is also checking i.e. result is published only if exam end date is less than today's date.
|
def publish(ex)
flag = false
unless ex.exams.nil?
ex.exams.each do |exam|
next if exam.end_time.nil?
flag = true if exam.end_time >= Date.today
end
end
flag
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def publish_result\n @exam_group = ExamGroup.shod(params[:format])\n if @exam_group.is_published?\n flag = @exam_group.publish(@exam_group)\n publish_res(flag)\n else\n flash[:alert] = 'Exam scheduled not published'\n end\n redirect_to exams_exam_group_path(@exam_group)\n end",
"def publish_exam\n @date = Date.today\n @exam_group = ExamGroup.shod(params[:format])\n @exam_group.update(is_published: true)\n @exam_group.exams.each(&:create_exam_event)\n @batch = @exam_group.batch\n @exam_groups ||= @batch.exam_groups.all\n end",
"def publish_res(flag)\n if flag == true\n flash[:alert] = 'Exam results cannot be published'\n else\n @exam_group.update(result_published: true)\n flash[:notice] = 'Result published successfully'\n end\n end",
"def can_publish_results\n if !@contestproblem.in_correction?\n flash[:danger] = \"Une erreur est survenue.\"\n redirect_to @contestproblem and return\n end\n if @contestproblem.contestsolutions.where(:corrected => false).count > 0\n flash[:danger] = \"Les solutions ne sont pas toutes corrigées.\"\n redirect_to @contestproblem and return\n end\n if @contestproblem.contestsolutions.where(:star => true).count == 0\n flash[:danger] = \"Il faut au minimum une solution étoilée pour publier les résultats.\"\n redirect_to @contestproblem and return\n end\n end",
"def publish_my\n\t\tschedule = params[:schedule] && Schedule.find_by_id(params[:schedule])\n\t\tgrades = schedule && schedule.grades.where(grader: current_user) || Grade.where(grader: current_user)\n\t\tgrades.each &:published!\n\t\tredirect_back fallback_location: '/'\n\tend",
"def create\n @quiz_result = QuizResult.new(params[:quiz_result])\n @quiz_result.student = current_student\n\n #If submitting.\n if @quiz_result.published\n @quiz_result.date = Time.now\n respond_to do |format|\n if @quiz_result.save\n @quiz_result.ocurrence = getOcurence @quiz_result\n @quiz_result.setGrade\n if @quiz_result.save\n format.html {redirect_to @quiz_result, notice: 'Quiz successfully answered.'}\n else\n format.html {redirect_to @quiz_result, notice: 'Error grading.'}\n end\n else\n format.html { render action: \"new\" }\n end\n end\n \n #If just saving, not submitting.\n else\n respond_to do |format|\n if @quiz_result.save\n format.html { redirect_to @quiz_result, notice: 'Quiz successfully saved.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end\n \n end",
"def publish_result\n @placement_exam = PlacementExam.all\n end",
"def publish_my\n\t\t@schedule.grades.where(grader: current_user).each &:published!\n\t\tredirect_back fallback_location: '/'\n\tend",
"def publish_finished\n\t\t@schedule.grades.finished.each &:published!\n\t\tredirect_back fallback_location: '/'\n\tend",
"def publish_results\n @contestproblem.corrected!\n \n compute_new_contest_rankings(@contest)\n \n automatic_results_published_post(@contestproblem)\n \n redirect_to @contestproblem\n end",
"def publish\n\t\t\tif(current_instructor.quizzes.exists?(:id => params[:id]))\n\t\t\t\tif(current_instructor.groups.exists?(:id => params[:group_id]))\n\t\t\t\t\tif((params[:expiry_date]).to_datetime > DateTime.current) \n\t\t\t\t\t\tquiz = Quiz.find(params[:id])\n\t\t\t\t\t\tgroup = Group.find(params[:group_id])\n\n\t\t\t\t\t\tif( group.quizzes.exists?(:id => params[:id]) )\n\t\t\t\t\t\t\tif( quiz.expiry_date < DateTime.current )\n\t\t\t\t\t\t\t\tif (quiz.update(expiry_date: (params[:expiry_date]).to_datetime))\n\t\t\t\t\t\t\t\t\tquiz.publish_quiz(params[:group_id])\n\t\t\t\t\t\t\t\t\trender json: { info: \"published\" }, status: 202\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\trender json: { error: quiz.errors }, status: 422\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\trender json: { error: \"Quiz is already published to this group\" }, status: 422\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif (quiz.update(expiry_date: (params[:expiry_date]).to_datetime))\n\t\t\t\t\t\t\t\tquiz.publish_quiz(params[:group_id])\n\t\t\t\t\t\t\t\trender json: { info: \"published\" }, status: 202\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\trender json: { error: quiz.errors }, status: 422\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\trender json: { error: \"Expiry Date must be in the future\" }, status: 422\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\trender json: { error: \"Group is not found\" }, status: 404\n\t\t\t\tend\t\n\t\t\telse\n\t\t\t\trender json: { error: \"Quiz is not found\" }, status: 404\n\t\t\tend\n\t\tend",
"def publish_finished\n\t\tschedule = params[:schedule] && Schedule.find_by_id(params[:schedule])\n\n\t\tif current_user.head?\n\t\t\trender status: :forbidden and return if not current_user.schedules.include?(schedule)\n\t\tend\n\n\t\tgrades = schedule && schedule.grades.finished || Grade.finished\n\t\tgrades.each &:published!\n\t\tredirect_back fallback_location: '/'\n\tend",
"def publish_results\n # @contest is fetched by CanCan\n\n # Define params for PDF output\n prawnto filename: \"ergebnisliste#{random_number}\", prawn: { page_size: 'A4', skip_page_creation: true }\n @contest_category = ContestCategory.find(params[:contest_category_id]) if params[:contest_category_id]\n @age_group = params[:age_group] if params[:age_group]\n @performances = @contest.performances\n .where(contest_category_id: @contest_category, age_group: @age_group)\n .accessible_by(current_ability)\n .order(:stage_time)\n end",
"def publish(_ = nil)\n publish_answers\n\n self.publisher = User.stamper || User.system\n self.published_at = Time.zone.now\n self.awarder = User.stamper || User.system\n self.awarded_at = Time.zone.now\n if persisted? && !assessment.autograded? && submission_graded_email_enabled?\n execute_after_commit { Course::Mailer.submission_graded_email(self).deliver_later }\n end\n end",
"def assess\n @latest_assessment = @task.assessments.find_or_initialize_by_assessed_on(Time.now.to_date)\n @latest_assessment.attributes = params[:latest_assessment]\n if @latest_assessment.save\n respond_to do |format|\n format.html do\n flash[:notice] = 'Task progress was recorded.'\n flash[:highlight_dom_id] = dom_id(@latest_assessment)\n redirect_to task_path(@task)\n end\n end\n else\n respond_to do |format|\n format.html { render :action => 'show' }\n end\n end\n end",
"def show\n redirect_to assignment_path(@assignment), alert: 'You cannot view essays until the due date has passed!' unless current_user.teacher? || @assignment.past_due? || @essay.user_assignment.user == current_user\n end",
"def exam_result\n if params[:exam_id]\n @exam = Exam.find(params[:exam_id])\n assert(exam.kind_of?(Exam))\n @exam = fill_user_answers(@exam)\n\n current_user.exams_total_questions += @exam.questions.count\n current_user.update_attribute(:exam_performance, current_user.exam_performance + [@exam.accepted_answers])\n\n @exam.save\n return @exam.user_answers\n else\n return redirect_to_back\n flash[:danger] = t(:exam_message)\n end\n end",
"def publish\n\t\tpset = Pset.find(params[:pset_id])\n\t\t@schedule.grades.joins(submit: :user).where(submits: { pset_id: pset.id }).find_each do |grade|\n\t\t\tgrade.update(status: Grade.statuses[:published])\n\t\tend\n\t\tredirect_back fallback_location: '/'\n\tend",
"def result\n @exam = current_exam(params)\n\n @exam_reporter = @exam.evaluate(params[:answers])\n end",
"def create\n @result = Result.new(params[:result])\n date1 = params[:result][:result_date].to_datetime.change(:hour => 1)\n @result.result_date = date1\n @result.student = @student\n @result.jpm = current_user\n respond_to do |format|\n if @result.save\n format.html { redirect_to student_results_path(@student), notice: 'Result was successfully created.' }\n format.json { render json: student_results_path(@student), status: :created, location: @result }\n else\n format.html { render action: \"new\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish_result_data\n end",
"def publish(_ = nil)\n answers.each do |answer|\n answer.publish! if answer.submitted?\n end\n self.publisher = User.stamper || User.system\n self.published_at = Time.zone.now\n end",
"def answer_exam\n if params[:year_exam] \n questions ||= Question.where(year: params[:year_exam])\n assert(questions.kind_of?(Question))\n else\n questions ||= Question.all\n assert(questions.kind_of?(Question))\n end\n\n if !questions.empty?\n auxiliar_exam ||= push_questions_auxiliar(questions)\n @exam = push_questions(auxiliar_exam)\n else\n redirect_to_back(select_exam_path)\n if params[:year_exam]\n flash[:danger] = t(:year_exam_not_found)\n else\n flash[:danger] = t(:exam_not_found)\n end\n end\n end",
"def update\n @quiz_result = QuizResult.find(params[:id])\n\n respond_to do |format|\n if @quiz_result.update_attributes(params[:quiz_result])\n if @quiz_result.published == true\n @quiz_result.date = Time.now\n @quiz_result.ocurrence = getOcurence @quiz_result\n @quiz_result.setGrade\n if @quiz_result.save\n format.html { redirect_to @quiz_result, notice: 'Quiz result was successfully answered.' }\n else\n format.html { redirect_to @quiz_result, notice: 'Error grading.' }\n end\n else\n format.html { redirect_to @quiz_result, notice: 'Quiz result was successfully saved.' }\n end\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def lecture_period\n @event = Event.first\n if (@event.activity_begin_day < DateTime.now && DateTime.now < @event.activity_end_day) || !current_user.adm?\n redirect_to lectures_path\n flash[:info] = \"Palestra nao disponivel!\"\n end\n end",
"def check_date\n\t\tif self.hasError\n\t\t\terrors.add(\"\", \"You entered Invalid date: \\n - \"+self.interviewer.name)\n\t\t\t# puts \"===================CHECKDATE===================\"\n\t\telsif Time.at(self.sched_end.to_i) <= Time.at(self.sched_start.to_i)\n\t\t\terrors.add(\"\", \"Start time cannot be greater than end time \\n - \"+self.interviewer.name)\n\t\tend\n\tend",
"def show\n @check_login =user_role_root_path\n @forum_topics = ForumTopic.where(discussable_id: @scheduled_assignment.assignment.scheduled_assignments.pluck(:id), discussable_type: 'ScheduledAssignment')\n @forum_topic = @forum_topics.first\n @assing_id = @scheduled_assignment.assignment_id\n @lession_id = params[:id]\n unless @forum_topic.blank?\n @forum_post = build_forum_post\n end\n @submissions = @scheduled_assignment.submissions.by_student(current_user)\n if @scheduled_assignment && @scheduled_assignment.scheduled_lesson.enrolment.end_date >= Date.today\n @other_submissions = AssignmentSubmission.where(scheduled_assignment_id: @scheduled_assignment.assignment.scheduled_assignments.pluck(:id)).not_by_student(current_user).current_enrolments\n else\n @other_submissions = AssignmentSubmission.where(scheduled_assignment_id: @scheduled_assignment.assignment.scheduled_assignments.pluck(:id)).by_student(current_user)\n end\n respond_to do |format|\n format.html\n format.pdf do\n render :pdf => \"show\"\n end\n end\n end",
"def show\n practice = Practice.find(params[:id])\n @assignment = Assignment.find(practice.assignment)\n @assignment_group = practice.assignment_group\n if (current_user.role? \"admin\") || (@assignment_group.students.pluck(:student_id).include? current_student.id)\n @flag = Favourite.find_by(user_id: current_user.id,assignment_id: @assignment.id)\n @rb = @assignment.answers.where(language: \"ruby\")\n @js = @assignment.answers.where(language: \"javascript\")\n @py = @assignment.answers.where(language: \"python\")\n # create time of viewing the assignment only once when the user clicks on the practice link\n #binding.pry\n SubmissionTimer.create(user_id: current_user.id, practice_id: params[:id], assignment_id: @assignment.id, assignment_group_id: practice.assignment_group_id) if SubmissionTimer.find_by(user_id: current_user.id, practice_id: params[:id], assignment_id: @assignment.id, assignment_group_id: practice.assignment_group_id).nil?\n #binding.pry\n @start_time = SubmissionTimer.find_by(user_id: current_user.id, practice_id: params[:id], assignment_id: @assignment.id, assignment_group_id: practice.assignment_group_id)\n #binding.pry\n else \n redirect_to root_path, notice: \"The page you are looking for does not exist\"\n end\n end",
"def show\n @lesson = Lesson.find(params[:id])\n time = @lesson.start_at.in_time_zone('Europe/Berlin')\n #@date = time.day.to_s + \" \" + Date::MONTHNAMES[time.month] + \" \" + time.year.to_s\n @date = time.day.to_s + \" \" + I18n.t(\"date.month_names\")[time.month] + \" \" + time.year.to_s\n @time = time.to_s(:time)\n @student = Student.find_by_id(session[:student_id])\n @admin = Admin.find_by_id(session[:user_id])\n @month = time.month\n @year = time.year\n\n if @student.blank? && @admin.blank?\n redirect_to(:controller => :teaching, :action => :studentzone)\n else\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lesson }\n end\n end\n end",
"def exam_in_the_future\n if self.date < Date.today\n errors.add(:date, 'is in the past')\n end\n end",
"def set_search_date\n latest_done_workout_date = current_user.latest_done_workout.try(:occurred_on)\n this_workout_date = @workout.scheduled_on\n @search_date = if latest_done_workout_date.nil?\n this_workout_date\n else\n (Date.current - latest_done_workout_date) >= 10 ? this_workout_date : latest_done_workout_date\n end\n end",
"def show\n @group = Group.find(params[:group_id])\n @survey = @group.surveys.find(params[:id])\n @survey_candidates = @survey.survey_candidates\n @survey_properties = @survey.survey_properties.all(:order => \"view_order\")\n @sheets = @survey.sheets\n sheet_ids = @survey.sheet_ids\n datetime = DateTime.now\n @today = datetime.strftime(\"%Y/%m/%d\")\n datetime = datetime - 1\n date_begin = datetime.strftime(\"%Y/%m/%d %H:%M:%S\")\n @answer_sheets = AnswerSheet.find_all_by_sheet_id(sheet_ids,\n :conditions => ['date >= ?', date_begin],\n :order => 'date desc')\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @survey }\n end\n end",
"def publish_date_and_explanation(errata)\n bold = errata.publish_date_explanation == 'custom'\n # This is very ugly, sorry! (fixme)\n html = ''\n html << '<div class=\"compact\">'\n html << '<b>' if bold\n html << [h(errata.publish_date_for_display),\"<small style='color:#888'>(#{errata.publish_date_explanation})</small>\"].compact.join('<br/>')\n html << '</b>' if bold\n html << '<br/>'\n html << \"<small>#{time_ago_future_or_past(errata.publish_or_ship_date_if_available)}</small>\" if errata.publish_or_ship_date_if_available\n html << '</div>'\n html.html_safe\n end",
"def index\n #@medicines = Medicine.all\n @medicines = current_user.medicines\n if params[:search]\n @medicines = @medicines.search(params[:search]).order(\"created_at DESC\")\n else\n @medicines = current_user.medicines\n end\n @exp_medicine = Medicine.where(\"expiry_date > ? And expiry_date < ? && user_id = ?\",Date.today - 2.days,Date.today + 2,current_user.id)\n UserMailer.send_report(@exp_medicine).deliver if @exp_medicine.present?\n\n #@medicines.each do |med|\n # expiry_date_diff = (med.expiry_date.to_date - Date.today).to_i\n # if expiry_date_diff <= 2 \n #end\n #end \n end",
"def update\n @result = Result.find(params[:id])\n @result.student = @student\n @result.jpm = current_user\n date1 = params[:result][:result_date].to_datetime.change(:hour => 1)\n params[:result][:result_date] = date1\n respond_to do |format|\n if @result.update_attributes(params[:result])\n format.html { redirect_to student_results_path(@student), notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def student_show\n\t\t\tif (current_student.quizzes.exists?(:id => params[:id]))\n\t\t\t\tquiz = current_student.quizzes.find(params[:id])\n\t\t\t\tstudent_quiz_obj = StudentResultQuiz.where(student_id:current_student.id).where(quiz_id:quiz.id).first\n\t\t\t\tif( quiz.expiry_date < DateTime.current ) \t\n\t\t\t\t\tanswers = student_quiz_obj.student_ans\n\t\t\t\t\tstudent_result = student_quiz_obj.result\n\t\t\t\t\tif (student_result == nil)\n\t\t\t\t\t\tstudent_result = 0\n\t\t\t\t\t\tanswers = []\n\t\t\t\t\tend\n\t\t\t\t\tquestions = quiz.questions\n\t\t\t\t\trender json: {:quiz => quiz, :questions => questions, :student_answers => answers, :result => student_result}, status: 200\n\t\t\t\telsif (student_quiz_obj.result == nil)\n\t\t\t\t\tquestions = quiz.questions\n\t\t\t\t\trender json: questions, status: 200\n\t\t\t\telse\n\t\t\t\t\trender json: { error:\"You have already taken the quiz\" }, status: 422\n\t\t\t\tend\n\t\t\telse\n\t\t\t\trender json: { error:\"Quiz is not found\" }, status: 404\n\t\t\tend\n\t\tend",
"def edit_result\n begin\n @cycling = Facade::SportSession::Cycling.find_by id: params[:id]\n\n if not @cycling.is_participant(current_user)\n redirect_to cyclings_url, alert: 'Permission denied'\n end\n\n if @cycling.date > Date.today\n redirect_to cyclings_url, alert: 'Storing results only possible if event is passed'\n end\n\n @result = @cycling.result(current_user)\n rescue\n redirect_to cyclings_url, alert: 'Permission denied'\n end\n end",
"def show\n @begin_date = Date.today - 5\n @end_date = Date.today + 5\n end",
"def check_dates\n date_now = DateTime.now.in_time_zone\n start_date = nil\n end_date = nil\n if !@contestproblem.nil? && @contestproblem.at_least(:in_progress)\n start_date = @contestproblem.start_time\n elsif !params[:contestproblem][:start_time].nil?\n start_date = Time.zone.parse(params[:contestproblem][:start_time])\n end\n if !@contestproblem.nil? && @contestproblem.at_least(:in_correction)\n end_date = @contestproblem.end_time\n elsif !params[:contestproblem][:end_time].nil?\n end_date = Time.zone.parse(params[:contestproblem][:end_time])\n end\n @date_problem = false\n \n if (@contestproblem.nil? || @contestproblem.at_most(:in_progress)) && !end_date.nil? && date_now >= end_date\n flash.now[:danger] = \"La deuxième date ne peut pas être dans le passé.\"\n @date_problem = true\n elsif (@contestproblem.nil? || @contestproblem.at_most(:not_started_yet)) && !start_date.nil? && date_now >= start_date\n flash.now[:danger] = \"La première date ne peut pas être dans le passé.\"\n @date_problem = true\n elsif !start_date.nil? && !end_date.nil? && start_date >= end_date\n flash.now[:danger] = \"La deuxième date doit être strictement après la première date.\"\n @date_problem = true\n elsif start_date.min != 0\n flash.now[:danger] = \"La première date doit être à une heure pile#{ '(en production)' if Rails.env.development?}.\"\n @date_problem = true if !Rails.env.development?\n end\n end",
"def index\n @year, @month = params[:year].to_i, params[:month].to_i\n if params[:day]\n @first = @last = Date.civil(@year, @month, params[:day].to_i)\n else\n @first = Date.civil(@year, @month, 1) #- 6 I'll need a full day to get calendar helper to display links to events from next/previous months\n @last = Date.civil(@year, @month, -1) #+ 6\n end\n @events = @user.all_events(@first, @last, true, @student)\n @ev, @assignments_and_grades = @events.partition{|e|e.is_a?(Event)}\n @academic_events, @nonacademic_events = @ev.partition{|e|e.invitable_type == 'Section'}\n @nonacademic_events.reject!{|e|e.id.nil?}\n render :action => \"day\" and return if params[:day]\n end",
"def other_subject_detail\n @user = User.find(params[:user_id])\n @other_subject_assess = OtherSubjectAssess.find(params[:data])\n @approved_user = User.find(@other_subject_assess.approved_user_id).full_name if @other_subject_assess.approved_user_id\n # @description = @other_subject_assess.slot.description.gsub(\". \", \".\\n\")\n # @guideline = @other_subject_assess.slot.guideline.gsub(\". \", \".\\n\")\n\n type = params[:type] || \"\"\n case type\n when \"\"\n @evidences = @other_subject_assess.evidences.limit(3).order(\"created_at desc\")\n when \"last_month\"\n @evidences = @other_subject_assess.evidences.where(\"created_at > ?\", (Time.now - 1.month)).order(\"created_at desc\")\n when \"last_6_months\"\n @evidences = @other_subject_assess.evidences.where(\"created_at > ?\", (Time.now - 6.month)).order(\"created_at desc\")\n when \"last_year\"\n @evidences = @other_subject_assess.evidences.where(\"created_at > ?\", (Time.now - 1.year)).order(\"created_at desc\") \n when \"show_all\"\n @evidences =@other_subject_assess.evidences.order(\"created_at desc\") \n end\n # @recently_added_slots = @user.other_subject_assesses.where(OtherSubjectAssess.arel_table[:status].not_eq(\"Not Added Yet\")).order(\"updated_at desc\")\n\n render :layout => false\n end",
"def create\n @test_result = TestResult.new(test_result_params)\n @test_result.user_id = current_user.id\n #@test_result.date = Time.now.strftime(\"%d%m%Y\")\n respond_to do |format|\n if @test_result.save\n format.html { redirect_to @test_result, notice: 'Test result was successfully created.' }\n format.json { render :show, status: :created, location: @test_result }\n else\n format.html { render :new }\n format.json { render json: @test_result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish_all\n\t\t@schedule.grades.where.not(status: [Grade.statuses[:published], Grade.statuses[:exported]]).each &:published!\n\t\tredirect_back fallback_location: '/'\n\tend",
"def index\n current_user = User.find(params[:user_id])\n role = current_user.role\n if role == \"doc\"\n @quizzes = []\n Quiz.all.each do |q|\n # Quiz.where({published: true}).each do |q|\n r = Result.where(quiz_id: q.id)\n if r.size != 0\n @quizzes << q.add_result_status(r.first.published)\n else \n @quizzes << q.add_result_status(false)\n end\n end\n else\n if params[\"status\"]\n quizzes = []\n u = User.find(params[:user_id])\n Quiz.where({published: true}).each do |q|\n if has_student(q.gropus, u)\n r = Result.where({user_id: current_user.id, quiz_id: q.id})\n if r.size != 0\n quizzes << q.add_result_status(r.first.published)\n end\n end\n end\n @quizzes = quizzes\n else\n @quizzes = Quiz.where({published: true})\n end\n end\n\n render json: @quizzes\n end",
"def exam\n if @errors.nil?\n redirect_to exam_score_exam_path(@exam)\n else\n @students = []\n students ||= @exam.exam_group.batch.students.all\n @students = @exam.select_subject(@students, students, @exam)\n @exam_grade ||= @exam.exam_group.batch.grading_levels.all\n render 'exam_score'\n end\n end",
"def set_results\n @exam = Exam.find(params[:exam_id])\n end",
"def show\n @exam = Exam.find(params[:id])\n @service = ExamService.new(@exam)\n \n if (@exam.exam_state_id == ExamState.finished_id)\n render :partial => \"results\", :layout => \"application\"\n return\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @exam }\n end\n end",
"def validate_dated_around_now\n self.errors.add(:exam_date, \"ist kein korrektes Datum, bitte versuche es erneut.\") unless ((Date.today)..(5.years.from_now)).include?(self.exam_date)\n end",
"def validate_dated_around_now\n self.errors.add(:exam_date, \"ist kein korrektes Datum, bitte versuche es erneut.\") unless ((Date.today)..(5.years.from_now)).include?(self.exam_date)\n end",
"def index\n @written_exams = WrittenExam.order(\"date DESC\").limit(30)\n end",
"def reminders\n @events = @user.events.where('finish_date >= ?', Time.now).paginate(:page => params[:page])\n #@events = @even.find(:all, :conditions=> ['finish_date >= ?', Time.now])\n #@events = @user.events.paginate(:page =>params[:page])\n end",
"def index\n #@summits = Summit.where(:published => true).order(:date_start)\n @summits = Summit.order(:date_start)\n end",
"def show\n @interviewer = Interviewer.find(params[:id])\n\n now = DateTime.now\n\n @next_sched = @interviewer.schedules.where([\"sched_start > ?\", now]) #.find(:conditions=>[\"sched_start < ?\", now])\n @prev_sched = @interviewer.schedules.where([\"sched_start < ?\", now]) #.find(:conditions=>[\"sched_start < ?\", now])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @interviewer }\n end\n end",
"def publish!\n self.published = true\n if self.respond_to?(:publish_on)\n self.publish_on ||= Date.today\n end\n self.save\n end",
"def check_date()\n event = Event.find_by(id: self.event_id) \n if Time.now > event.start_date then\n halt msg: 'check_date() fail' \n false\n else\n true\n end\n end",
"def show\n @participation = Participation.find(params[:id])\n comp=Competition.find(@participation.Competition_id)\n if (@participation.submissionspublic and comp.endtime<Time.now) or current_user.id==@participation.User_id or current_user.id==comp.User_id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participation }\n end\n else\n if !@participation.submissionspublic\n redirect_to participations_path, status: 'The participant chose not to publish his submissions.' \n elsif comp.endtime<Time.now\n redirect_to participations_path, status: 'You cant view submissions while the competion is stil active.'\n else\n redirect_to participations_path, status: 'You are not authorised to view these submissions.'\n end\n end\n end",
"def publish_evaluation\n create_metric(\n @cookbook_version,\n QualityMetric.publish_metric,\n params[:publish_failure],\n params[:publish_feedback]\n )\n\n head 200\n end",
"def index\n @exam_results = ExamResult.order(:week_s => :desc).first(200)\n @exam_results_all = ExamResult.all\n\n @exam_results_weeks = ExamResult.count(:week_s)\n @exams_results_exams = ExamResult.sum(:taken)\n end",
"def publication_date\n end",
"def show\n @submission = Submission.find(params[:id])\n @questions = @submission.assignment.questions.sort_by {|obj| obj.created_at }\n evaluation = @evaluations.where(:user_id => current_user.id).first\n @responses = ((e = @evaluations[0]) ? e.responses.sort_by {|obj| obj.created_at } : [])\n @user = params[:instructor_review_of] ? User.find(params[:instructor_review_of]) : current_user\n @submitter = @submission.user_id == @user.submitting_id(@submission)\n\n if params[:instructor_approved_toggle]\n @submission.instructor_approved = !@submission.instructor_approved\n @submission.save!\n if @submission.instructor_approved\n redirect_to (course_assignment_path({id: params[:assignment_id]} )) + '/submissions'\n return\n else\n respond_to do |format|\n format.html { render :layout => 'no_sidebar' }\n format.json { render json: @submission }\n end\n return\n end\n elsif params[:finish]\n if evaluation.finished # The reviewer is withdrawing the review\n evaluation.finished = false\n evaluation.save!\n redirect_to :back\n return\n else\n if evaluation.mark_incomplete_questions\n evaluation.finished = true\n evaluation.save!\n redirect_to course_assignment_path ({id: params[:assignment_id]} )\n return\n else\n flash[:error] = \"You can't publish unless all ratings and required comments are finished.\"\n redirect_to course_assignment_submission_path ({id: params[:id]} )\n # render 'show', :layout => 'no_sidebar'\n return\n end\n end\n else # it's a student who submitted it or is completing or seeing a review of someone else\n @kibitzing = params[:instructor]\n respond_to do |format|\n format.html { render (params[:instructor_review_of] ? 'show_review' : 'show'), :layout => 'no_sidebar' }\n format.json { render json: @submission }\n end\n return\n end\n end",
"def index\n # Evaluation.archive_old_eva\n @evaluation = Evaluation.new\n @evaluation.type = 'Course'\n\n if params[:type].eql? 'test'\n @inscriptions = Inscription.test.pendents.joins(:user).order('last_name ASC')\n @schedules = Schedule.prueba\n @title = \"Pruebas\"\n @evaluation.type = 'Test'\n @evaluation.start = Test.next_saturday_test\n @evaluation.cost = GeneralParameter.costo_prueba.value if GeneralParameter.costo_prueba\n @evaluation.schedule_id = GeneralParameter.horario_prueba.value if GeneralParameter.horario_prueba\n @evaluation.location = GeneralParameter.ubicacion_prueba.value if GeneralParameter.ubicacion_prueba\n begin\n flash[:success] = \"Creada Prueba automática\" if Test.check_actives_tests\n \n rescue Exception => e\n flash[:danger] = 'No se pudo revisar la creación de Pruebas automáticas'\n end\n\n @schedules = Schedule.where(evatype: 'test')\n @actives = Test.activa\n\n elsif params[:type].eql? 'course'\n @evaluation.type = 'Course'\n @title = \"Cursos\"\n @inscriptions = Inscription.course.pendents.joins(:user).order('last_name ASC')\n @actives = Course.activa\n @schedules = Schedule.curso\n else\n @title = \"Evaluaciones\"\n @actives = Evaluation.activa\n @inscriptions = Inscription.pendents.limit(50)\n @schedules = Schedule.all\n end\n\n end",
"def show\n @user = User.find(session[:user_id])\n @quiz=Quiz.find(params[:id])\n @article=Article.find(params[:id])\n\n if(Score.where([\"user_id = ? and article_id = ? and score > ?\", @user.id, @quiz.id, 49]).blank?)\n if(Score.find_by(user_id: @user.id, article_id: @quiz.id, score: -1).blank?)\n @score = Score.new({user_id: @user.id, article_id: @quiz.id, score: -1})\n @score.save\n else\n @score=Score.find_by(user_id: @user.id, article_id: @quiz.id, score: -1)\n end\n else\n flash[:danger] = \"Quiz already passed\"\n redirect_to(@article)\n end\n\n end",
"def show\n @past_event = @event.day.to_i < Date.strptime(Time.now.strftime(\"%B %d, %Y\"), \"%B %d, %Y\").yday\n if @past_event\n redirect_to schedule_path, alert: \"El evento ya ocurrió\"\n end\n @is_connected = current_user\n if @is_connected\n @is_admin = (current_user.has_role? :admin)\n @is_subscriptor = Eventsubsription.exists?(event_id: @event.id, user_id: current_user.id)\n @is_author = current_user.id.to_i == @event.user_id.to_i\n else\n @is_admin = false\n @is_subscriptor = false\n @is_author = false\n end\n @event_full = Eventsubsription.where(event_id: @event.id).count >= @event.max_users.to_i\n @event_count = Eventsubsription.where(event_id: @event.id).count\n date = Date.strptime(\"December 31, 2018\", \"%B %d, %Y\")\n @date_text = date + @event.day.to_i\n @modules = [\"[8:30-09:50]\",\"[10:00-11:20]\",\"[11:30-12:50]\",\"[13:00-13:50]\",\"[14:00-15:20]\",\"[15:30-16:50]\",\"[17:00-18:20]\",\"[18:30-19:50]\"]\n if @event.user.realname == nil\n @author_name = @event.user.username\n else\n @author_name = @event.user.realname\n end\n if @event.event_type != \"Evento Externo\"\n @course = Course.find(@event.course_id)\n @course_name = Course.find(@event.course_id).name\n @course_sub = Suscription.exists?(course_id: @course.id, user_id: current_user.id, sbtype: \"alumno\")\n end\n\n if @event.event_type == \"Buscar Profesor Particular\" || @event.event_type == \"Clases Particulares\" ||\n @teacher = nil\n @teacher_name = \"No asignado\"\n if @is_connected\n @is_teacher = Suscription.exists?(course_id: @course.id, user_id: current_user.id, sbtype: \"teacher\")\n end\n Suscription.where(course_id: @course.id, sbtype: \"teacher\").each do |sub|\n if Eventsubsription.exists?(event_id: @event.id, user_id: sub.user_id)\n @teacher = User.find(sub.user_id)\n if @teacher.realname == nil\n @teacher_name = @teacher.username\n else\n @teacher_name = @teacher.realname\n end\n end\n end\n\n\n\n end\n\n\n end",
"def index\n if session[:user_id].nil?\n redirect_to root_path and return\n end\n\n # 検索フォーム\n require \"date\"\n #今日\n d = Date.today\n #月初\n start_date = Date::new(d.year,d.month, 1)\n default_date_from = start_date.year.to_s + sprintf(\"%02d\", start_date.month).to_s + sprintf(\"%02d\", start_date.day).to_s \n\n #月末\n end_date = start_date >> 1\n end_date = end_date - 1\n default_date_to = end_date.year.to_s + sprintf(\"%02d\", end_date.month).to_s + sprintf(\"%02d\", end_date.day).to_s \n\n if params[:result_date_from].nil? \n #販売活動登録・変更から遷移した時は、セッションに保持した検索条件をセット\n if params[:param_back] == 'back'\n result_date_from = session[:cond_result_date_from]\n @result_date_from = session[:cond_result_date_from]\n else\n result_date_from = default_date_from\n @result_date_from = default_date_from\n end\n elsif params[:result_date_from].empty?\n result_date_from = ''\n @result_date_from = ''\n else\n result_date_from = params[:result_date_from]\n @result_date_from = params[:result_date_from]\n end\n\n if params[:result_date_to].nil? \n #販売活動登録・変更から遷移した時は、セッションに保持した検索条件をセット\n if params[:param_back] == 'back'\n result_date_to = session[:cond_result_date_to]\n @result_date_to = session[:cond_result_date_to]\n else\n result_date_to = default_date_to\n @result_date_to = default_date_to\n end\n elsif params[:result_date_to].blank? \n result_date_to = ''\n @result_date_to = ''\n else\n result_date_to = params[:result_date_to]\n @result_date_to = params[:result_date_to]\n end\n\n if params[:result].blank? \n #販売活動登録・変更から遷移した時は、セッションに保持した検索条件をセット\n if params[:param_back] == 'back'\n params[:result] = session[:cond_result_user_id]\n user_id = params[:result]\n #条件設定がなかった時\n if user_id.blank?\n @user_id = ''\n else\n @user_id = params[:result][:user_id]\n end\n params[:result] = ''\n else\n user_id = ''\n @user_id = ''\n end\n else\n user_id = params[:result]\n @user_id = params[:result][:user_id]\n end\n\n# @results = Result.search(result_date_from, result_date_to, user_id)\n @results = Result.joins(:user).order('users.display_order').search(result_date_from, result_date_to, user_id)\n\n #検索条件をセッションに格納して保持\n session[:cond_result_date_from] = result_date_from\n session[:cond_result_date_to] = result_date_to\n session[:cond_result_user_id] = user_id\n\n end",
"def show\n if user_signed_in?\n @trigger = TriggerAction.pending_action(\"review_required\", current_user, @assignment)\n @my_answers = Answer.where(user: current_user, assignment: @assignment, active: true)\n @my_reviews = Review.where(answer_id: @my_answers, active: true, assignment_id: @assignment.id)\n\n if current_user.get_and_store_experimental_condition!(@assignment.course) == \"batched_email\"\n @my_reviews = Review.where(answer_id: @my_answers, active: true, assignment_id: @assignment.id).where('created_at < ?', 1.day.ago)\n end\n @reviews_by_me = Review.where(active: true, assignment_id: @assignment.id).where(\"user_id = ? or copilot_email = ?\", current_user.id,current_user.email)\n @out_of_box_answers_with_count = Review.where(assignment_id: @assignment.id, out_of_box_answer: true).group(:answer_id).count\n\n unless @out_of_box_answers_with_count.blank?\n @out_of_box_answers = @out_of_box_answers_with_count.reject {|k,v| v < 2 }\n end\n if @out_of_box_answers.blank?\n @out_of_box_answers = {}\n end\n end\n @all_answers = @assignment.answers.reviewable.limit(10)\n @starred_answers = @assignment.answers.reviewable.where(starred: true)\n render layout: \"one_column\"\n end",
"def take\n @exam = current_exam(params)\n end",
"def published?; end",
"def published?; end",
"def index\n\n @attendances = @training_class.attendances\n\n if(params[:student_id])\n @student= Student.find(params[:student_id])\n @stu_attendances =@training_class.student_attendance(@student)\n @week_dates = WeekDate.group_days(@stu_attendances,@training_class)\n\n # @student_attendances =@attendances.student_attendances.where(student_id: @student)\n\n render \"index_for_special_student\"\n else\n render \"index\"\n end\n end",
"def show\n @exam_result = Xmt::Test::ExamResult.find(params[:id])\n @total_marks = @exam_result.question_scores.sum(:marks)\n end",
"def show\n @assignment = Assignment.find(params[:id])\n @course = @assignment.course\n @user = current_user\n if @user.instructor?(@course)\n if params[:fix]\n fix\n end\n if reviewer_id = params[:reviewer]\n @reviewer = User.find(reviewer_id)\n @reviewing_tasks = @assignment.evaluations.forUser(@reviewer)\n render 'assignments/show_instructor'\n return\n else\n redirect_to(edit_course_assignment_url(@course, @assignment))\n return\n end\n end\n\n # User is a student. Create 'To Do' List\n @to_do = @course.to_do(current_user)\n\n @reviewing_tasks = @assignment.evaluations.forUser(current_user).sort_by{|t| t.created_at}\n if Time.zone.now > @assignment.review_due # allow late reviewing until instructor ends\n @reviewing_tasks = @reviewing_tasks.select{|r| r.finished or !r.submission.instructor_approved }\n end\n @submissions = @assignment.get_submissions(current_user)\n @submission = @submissions.sort_by{|s| s.created_at }.last\n unless @submission\n @submission = Submission.new(assignment_id: @assignment.id)\n end\n @questions = @assignment.questions.sort_by{|q| q.created_at }\n @teams = @user.memberships.select{|m| m.assignment.course_id == @course.id and m.assignment_id == @assignment.id }.\n map{|m| User.find(m.pseudo_user_id)}\n\n @s3_direct_post = S3_BUCKET.presigned_post(\n key: vanilla(@course.name) + '/' + @user.id.to_s + '/' + vanilla(@assignment.name) + '.pdf',\n success_action_status: 201,\n acl: :public_read,\n content_type: 'application/pdf') # For uploads. It will be filed under the human (not team) user id.\n\n respond_to do |format|\n format.html\n format.json {render json: @assignment }\n end\n end",
"def index\n redirect_to assignment_path(@assignment) unless current_user.teacher? || @assignment.past_due?\n if current_user.student?\n @group = @assignment.user_assignments.find_by(user_id: current_user).group\n end\n @essays = @assignment.essays\n end",
"def show\n published_check\n end",
"def copytermweeksdo(mystartcopyfromdate,\n myendcopyfromdate,\n mycopynumweeks,\n mystartcopytodate,\n myendcopytodate,\n myfirstweekdate)\n flagstream = true\n mydisplay = render_to_string(\"admins/populatetermstream_head.html\",\n :formats => [:html])\n response.stream.write mydisplay if flagstream\n\n @results = Array.new # store detailed feedback to be displayed on user browser.\n if myfirstweekdate < myendcopytodate # next term must be after this term\n #flash[:notice] = \"The next term must begin after this term - cannot copy!!!\"\n if flagstream\n response.stream.write \"<p>The next term must begin after this term - cannot copy!!!</p>\" \n response.stream.close\n end\n return\n end\n\n @options = Hash.new\n @options[:startdate] = mystartcopytodate\n @options[:enddate] = myendcopytodate\n @cal = calendar_read_display1f(@options)\n unless @cal.empty?\n # destination is not empty - show error and return\n #flash[:notice] = \"Destination days are not empty - will not copy!!!\"\n if flagstream\n response.stream.write \"<p>Destination days are not empty - will not copy!!!</p>\"\n response.stream.close\n end\n #redirect_to copytermweeksedit_path(copytermweeks_params)\n return\n end\n @options[:startdate] = mystartcopyfromdate\n @options[:enddate] = myendcopyfromdate\n @cal = calendar_read_display1f(@options)\n if @cal.empty?\n # source is empty - show error and return\n #flash[:notice] = \"Source days are empty - nothing to copy!!!\"\n response.stream.write \"<p>Source days are empty - nothing to copy!!!</p>\"\n response.stream.close\n #redirect_to copytermweeksedit_path(copytermweeks_params)\n return\n end\n if flagstream\n response.stream.write \"<p>Copy from week beginning: \" +\n mystartcopyfromdate.strftime(\" %A %e/%-m/%y \") + \"</p>\"\n response.stream.write \"<p>Building a term containing : \" +\n (mycopynumweeks + 1).to_s + \" weeks</p>\"\n response.stream.write \"<p>And staring first week of next term on : \" +\n myfirstweekdate.strftime(\" %A %e/%-m/%y \") + \" weeks</p>\"\n end\n #--------------------------------------------------------------------\n #---- check that all slots contains a global and allocate lesson ----\n response.stream.write \"<p>Checking all slots contain global and allocate lessons</p>\" if flagstream\n flagAddedLesson = false # track if one has been added.\n @cal.each do |site, sitevalue| \n # Now work through the slots for this site and day\n #---- for each row of slots (all days - each row being a lesson timeslot ----\n sitevalue.each_with_index do |bankslots, bankslotindex|\n if bankslotindex == 0 # column title \n else\n #---- for each slot in the row - ( one days with one lesson timeslot) ----\n bankslots.each_with_index do |slot, slotindex|\n if slotindex == 0 # row title\n next # simply holds the slot time - will get from found slot\n end\n thisslotid = slot['slotid']\n # if not a valid slot, go to next iteration.\n if thisslotid == nil\n next\n end\n #---- processing a valid slot (not just a cell in the table) ----\n #---- check this slot ----\n #---- check existing lessons ----\n # Now to look at each lesson in each slot\n # Also check that each slot has lesson types of 'global' and 'allocate'\n if slot['values'].respond_to?(:each) then\n flagMissingGlobal = flagMissingAllocate = true\n slot['values'].each do |lesson|\n flagMissingGlobal = false if lesson.status == 'global'\n flagMissingAllocate = false if lesson.status == 'allocate'\n end\n end\n # Add lesson if missing global lesson or allocate lesson.\n #result = /^(([A-Z]+\\d+l(\\d+)))/.match(thisslotid)\n #if result \n # slot_dbId = result[3]\n #end\n if flagMissingGlobal\n @lesson_new = Lesson.new(slot_id: thisslotid, status: \"global\")\n @lesson_new.save\n flagAddedLesson = true\n end\n if flagMissingAllocate\n @lesson_new = Lesson.new(slot_id: thisslotid, status: \"allocate\")\n @lesson_new.save\n flagAddedLesson = true\n end\n end\n end \n end\n end\n # if lessons added, then refetch! - should be a rare occurence!\n if flagAddedLesson\n response.stream.write \"<p>Lessons added - refresh source data from database.</p>\" if flagstream\n @cal = calendar_read_display1f(@options) \n end\n #--------------------------------------------------------------------\n #---- copy this week into following weeks ----\n response.stream.write \"<p>copy this week into following weeks.</p>\" if flagstream\n # get to here, we are set up to do a copy\n # @cal contains the info to be copied.\n # First get the number of dayes to advance by ( + or - is valid)\n adddays = mystartcopytodate - mystartcopyfromdate\n adddaysforweekplusone = myfirstweekdate - mystartcopyfromdate\n logger.debug \"adddays: \" + adddays.inspect\n #keep track of all copied entities - slots, lessons, roles, tutroles.\n # Used later - to break block links.\n @allCopiedSlotsIds = Array.new\n @allCopiedLessonsIds = Array.new\n @allCopiedRolesIds = Array.new\n @allCopiedTutrolesIds = Array.new\n #---- for each site ----\n @cal.each do |site, sitevalue| \n response.stream.write \"<p>Copying site #{site}.</p>\" if flagstream\n # Now work through the slots for this site and day\n siteName = siteDate = \"\" # control scope\n #---- for each row of slots (all days - each row being a lesson timeslot ----\n sitevalue.each_with_index do |bankslots, bankslotindex|\n response.stream.write \"<p>Progressing through bank #{bankslotindex}.</p>\" if flagstream\n if bankslotindex == 0 # column title \n siteName = bankslots[0]['value']\n siteDate = siteDateBankFrom = bankslots[1]['value']\n logger.debug \"siteName: \" + siteName + \" siteDate: \" + siteDate.inspect\n n = siteDate.match(/(\\d+.*)/)\n siteDate = n[1]\n if bankslots[2] == nil\n @results.push \"processing #{siteName} #{siteDateBankFrom}\"\n else\n siteDateBankTo = bankslots[2]['value']\n @results.push \"processing #{siteName} #{siteDateBankFrom} to #{siteDateBankTo}\"\n end\n else\n #---- for each slots in the row - ( one days with one lesson timeslot) ----\n bankslots.each_with_index do |slot, slotindex|\n if slotindex == 0 # row title\n next # simply holds the slot time - will get from found slot\n end\n thisslotid = slot['slotid']\n # if not a valid slot, go to next iteration.\n if thisslotid == nil\n next\n end\n #---- processing a valid slot (not just a cell in the table) ----\n @allCopiedSlotsIds.push thisslotid # track all copied slots \n @results.push \"Slotid: #{thisslotid}\"\n #---- copy run this slot ----\n @blockSlots = Array.new\n @blockSlots[0] = Slot.find(thisslotid)\n @blockSlots[0].first = thisslotid\n # Now need to copy this to the following mycopynumweeks weeks.\n # we are forming a chain with first = first id in chain &\n # next = the following id in the chain.\n slotLocation = @blockSlots[0].location \n nextTimeslotTo = @blockSlots[0].timeslot + (adddays.to_i - 7) * 86400\n ### adddaysforweekplusone\n (1..mycopynumweeks+1).each do |i|\n nextTimeslotTo += 7 * 86400\n # cater for the week plus one entries\n nextTimeslotTo = @blockSlots[0].timeslot + adddaysforweekplusone * 86400 if i == mycopynumweeks + 1 \n @blockSlots[i] = Slot.new(timeslot: nextTimeslotTo, \n location: slotLocation,\n first: thisslotid )\n end\n (0..mycopynumweeks+1).reverse_each do |i|\n # the last entity in chain will have next = nil by default, do not populate.\n @blockSlots[i].next = @blockSlots[i+1].id unless i == mycopynumweeks+1 \n if @blockSlots[i].save\n # weekPlusOne (wpo) will have the wpo field set to self\n if i == mycopynumweeks+1 \n @blockSlots[i].wpo = @blockSlots[i].id\n @blockSlots[i].save\n end\n @results.push \"created slot \" + @blockSlots[i].inspect\n else\n @results.push \"FAILED creating slot \" + @blockSlots[i].inspect + \n \"ERROR: \" + @blockSlots[i].errors.messages.inspect\n end\n end\n #---- copy any existing lesson that have the desired status ----\n # Now to look at each lession in each slot\n # Also check that each slot has lesson types of 'global' and 'allocate'\n flagbreak = false\n if slot['values'].respond_to?(:each) then\n slot['values'].each do |lesson|\n #response.stream.write \"<p>Progressing through lessons.</p>\" if flagstream\n if !flagbreak\n response.stream.write \"<p>Progressing through lessons.\" if flagstream\n flagbreak = true\n else\n response.stream.write \".\"\n end\n #logger.debug \"lesson: \" + lesson.inspect\n # is this a valid lesson to copy\n ###next if ['global', 'allocate', 'park'].include?(lesson.status)\n next if ['park'].include?(lesson.status)\n thislessonid = lesson.id\n #---- copy run this lesson ----\n @allCopiedLessonsIds.push thislessonid # track all copied slots \n @blockLessons = Array.new\n @blockLessons[0] = lesson\n @blockLessons[0].first = thislessonid\n # Now need to copy this to the following mycopynumweeks weeks.\n # we are forming a chain with first = first id in chain &\n # next = the following id in the chain.\n ### adddaysforweekplusone\n (1..mycopynumweeks+1).each do |i|\n parentSlotId = @blockSlots[i].id\n # cater for the week plus one entries\n @blockLessons[i] = Lesson.new(slot_id: parentSlotId, \n status: lesson.status,\n first: thislessonid )\n end\n (0..mycopynumweeks+1).reverse_each do |i|\n # the last entity in chain will have next = nil by default, do not populate.\n @blockLessons[i].next = @blockLessons[i+1].id unless i == mycopynumweeks+1 \n if @blockLessons[i].save\n @results.push \"created lesson \" + @blockLessons[i].inspect\n else\n @results.push \"FAILED creating lesson \" + @blockLessons[i].inspect + \n \"ERROR: \" + @blockLessons[i].errors.messages.inspect\n end\n end\n #---- some lessons are copied but not their tutor/student content ----\n # for free lesson, do not copy any tutors or students\n next if lesson.status == 'free'\n # At this point, decision to copy tutors or students depends\n # on their kind and status.\n # Now find all the tutors in this lesson\n #---- copy any existing tutors that have the desired status & kind ----\n if lesson.tutors.respond_to?(:each) then\n lesson.tutors.sort_by {|obj| obj.pname }.each do |tutor|\n logger.debug \"tutor: \" + tutor.inspect\n #thistutrole = tutor.tutroles.where(lesson_id: lesson.id).first\n @blockTutroles = Array.new\n @blockTutroles[0] = tutor.tutroles.where(lesson_id: lesson.id).first\n # Check if this tutor-lesson should be copied\n flagtutorcopy = false\n flagtutorcopy = true if ['scheduled', 'confirmed', 'notified',\n 'attended', 'away', 'absent'].include?(@blockTutroles[0].status)\n # do not copy certain kinds!\n flagtutorcopy = false if ['called', 'training', 'relief'].include?(@blockTutroles[0].kind)\n #flagtutorcopy = false if @blockTutroles[0].kind == 'called'\n next unless flagtutorcopy\n thistutroleid = @blockTutroles[0].id\n @allCopiedTutrolesIds.push thistutroleid # track all copied slots \n @blockTutroles[0].block = @blockTutroles[0].first = thistutroleid\n # Now need to copy this to the following mycopynumweeks weeks.\n # we are forming a chain with first = first id in chain &\n # next = the following id in the chain.\n (1..mycopynumweeks+1).each do |i|\n parentLessonId = @blockLessons[i].id\n # cater for the week plus one entries\n @blockTutroles[i] = Tutrole.new(lesson_id: parentLessonId,\n tutor_id: tutor.id, \n status: 'scheduled',\n kind: @blockTutroles[0].kind,\n first: thistutroleid,\n block: thistutroleid)\n end\n (0..mycopynumweeks+1).reverse_each do |i|\n # the last entity in chain will have next = nil by default, do not populate.\n @blockTutroles[i].next = @blockTutroles[i+1].id unless i == mycopynumweeks+1 \n if @blockTutroles[i].save\n @results.push \"created tutrole \" + @blockTutroles[i].inspect\n else\n @results.push \"FAILED creating tutrole \" + @blockTutroles[i].inspect + \n \"ERROR: \" + @blockTutroles[i].errors.messages.inspect\n end\n # the last entity in chain is the week + 1 entry. \n # block will be set to self. \n ### This strategy is now changed.\n ### Week Plus One (WPO) is now identified in the slots\n ### Block now picks up all the items in the chain as first\n ### will change often as moves are done. Block is the only way\n ### to pick up all historical entries in the chain.\n ###if i == mycopynumweeks+1\n ### @blockTutroles[i].block = @blockTutroles[i].id \n ### if @blockTutroles[i].save\n ### @results.push \"updated tutrole :block \" + @blockTutroles[i].inspect\n ### else\n ### @results.push \"FAILED updating tutrole block \" + @blockTutroles[i].inspect + \n ### \"ERROR: \" + @blockTutroles[i].errors.messages.inspect\n ### end\n ###end\n end\n end\n end\n #---- copy any existing students that have the desired status & kind ----\n # Now find all the students in this lesson\n if lesson.students.respond_to?(:each) then\n lesson.students.sort_by {|obj| obj.pname }.each do |student|\n logger.debug \"student: \" + student.inspect\n @blockRoles = Array.new\n @blockRoles[0] = student.roles.where(lesson_id: lesson.id).first\n # check if this student should be copied.\n # for some lesson types, students are never copied\n next if ['flexible', 'on_BFL', 'onSetup', 'onCall',\n 'free'].include?(lesson.status)\n # others depend on their student-lesson status/\n flagstudentcopy = false\n # do not copy certain kinds!\n flagstudentcopy = true if ['scheduled', 'attended', 'away',\n 'absent', 'bye'].include?(@blockRoles[0].status)\n flagstudentcopy = false if ['catchup', 'catchupcourtesy', 'bonus', 'free'].include?(@blockRoles[0].kind)\n next unless flagstudentcopy\n # if so, copy this student-lesson\n thisroleid = @blockRoles[0].id\n @allCopiedRolesIds.push thisroleid # track all copied slots \n @blockRoles[0].block = @blockRoles[0].first = thisroleid\n # Now need to copy this to the following mycopynumweeks weeks.\n # we are forming a chain with first = first id in chain &\n # next = the following id in the chain.\n (1..mycopynumweeks+1).each do |i|\n parentLessonId = @blockLessons[i].id\n # cater for the week plus one entries\n @blockRoles[i] = Role.new(lesson_id: parentLessonId,\n student_id: student.id, \n status: 'scheduled',\n kind: @blockRoles[0].kind,\n first: thisroleid,\n block: thisroleid)\n \n #byebug\n if @blockRoles[0].student.status == 'fortnightly'\n if @blockRoles[0].status == 'bye'\n @blockRoles[i].status = i.even? ? 'bye' : 'scheduled' \n else\n @blockRoles[i].status = i.odd? ? 'bye' : 'scheduled' \n end\n end\n logger.debug \"@blockRoles ( \" + i.to_s + \"): \" + @blockRoles[i].inspect\n end\n (0..mycopynumweeks+1).reverse_each do |i|\n # the last entity in chain will have next = nil by default, do not populate.\n @blockRoles[i].next = @blockRoles[i+1].id unless i == mycopynumweeks+1 \n if @blockRoles[i].save\n @results.push \"created role \" + @blockRoles[i].inspect\n else\n @results.push \"FAILED creating role \" + @blockRoles[i].inspect + \n \"ERROR: \" + @blockRoles[i].errors.messages.inspect\n end\n # the last entity in chain is the week + 1 entry. \n # block will be set to self.\n ### This strategy is now changed.\n ### Week Plus One (WPO) is now identified in the slots\n ### Block now picks up all the items in the chain as first\n ### will change often as moves are done. Block is the only way\n ### to pick up all historical entries in the chain.\n ###if i == mycopynumweeks+1\n ### @blockRoles[i].block = @blockRoles[i].id if i == mycopynumweeks+1 \n ### if @blockRoles[i].save\n ### @results.push \"updated role :block \" + @blockTutroles[i].inspect\n ### else\n ### @results.push \"FAILED updating role block \" + @blockTutroles[i].inspect + \n ### \"ERROR: \" + @blockRoles[i].errors.messages.inspect\n ### end\n ###end\n end\n end\n end\n end\n end\n if flagbreak\n response.stream.write \"</p>\" if flagstream\n flagbreak = false\n end\n end\n end \n end\n end\n\n # Now need to break the chains \n # Remember that week + 1 is in the old chain.\n # Need to find previous link in the chain and set entity.next to nil.\n #@allCopiedSlotsIds = Array.new\n #@allCopiedLessonsIds = Array.new\n #@allCopiedRolesIds = Array.new\n #@allCopiedTutrolesIds = Array.new\n response.stream.write \"<p>Breaking chains to disconnect wpo from previous term.</p>\" if flagstream\n Slot.where(next: @allCopiedSlotsIds).update_all(next: nil)\n Lesson.where(next: @allCopiedLessonsIds).update_all(next: nil)\n Role.where(next: @allCopiedRolesIds).update_all(next: nil)\n Tutrole.where(next: @allCopiedTutrolesIds).update_all(next: nil)\n \n # Now remove the wpo flag for this initial wpo\n response.stream.write \"<p>Remove wpo flag from old week plus one.</p>\" if flagstream\n Slot.where(id: @allCopiedSlotsIds).update_all(wpo: nil)\n response.stream.write \"<p>Populate Term COMPLETED.</p>\"\n response.stream.close\n #rescue ActionController::Live::ClientDisconnected\n # logger.info(\"Client disconnected!!!\")\n # flagStream = false\n #ensure\n # response.stream.close\n end",
"def response_dates_after_submission\n unless actl_submission.blank?\n xpcd_response_computed = ( xpcd_response || Date.today ) + xpcd_response_delta.to_i\n errors.add( :xpcd_response, I18n.t( 'dsr_submissions.msg.bad_resp_date')) \\\n unless xpcd_response_computed >= actl_submission\n end\n end",
"def index\n @resource = \"Question\"\n @resource_new_path = new_question_path\n if @user.role.name == \"professor\"\n @questions = @user.questions.paginate(page: params[:page], per_page: 6)\n if @questions.count == 0\n @noResource = \"Ahh boo ;(! <br /> You have no questions created.\".html_safe\n end\n end\n end",
"def show\n @student = current_user.id\n @checkins = Checkin.get_last_five_checkins(@student)\n @respect_scores = Checkin.gather_last_five(@student, 1, @checkins)\n @integrity_scores = Checkin.gather_last_five(@student, 2, @checkins)\n @perseverance_scores = Checkin.gather_last_five(@student, 3, @checkins)\n @passion_scores = Checkin.gather_last_five(@student, 4, @checkins)\n @empowerment_scores = Checkin.gather_last_five(@student, 5, @checkins)\n @team_scores = Checkin.gather_last_five(@student, 6, @checkins)\n @dates = Checkin.gather_last_five_dates(@student, @checkins)\n @total_scores = Checkin.gather_last_five_total_scores(@student, @checkins)\n @comments = Checkin.get_last_five_comments(@student, @checkins)\n @respect_questions = CoreValue.find(1).questions\n @integrity_questions = CoreValue.find(2).questions\n @perseverance_questions = CoreValue.find(3).questions\n @passion_questions = CoreValue.find(4).questions\n @empowerment_questions = CoreValue.find(5).questions\n @team_questions = CoreValue.find(6).questions\n \n end",
"def pre_submission_date_status\n 'New Announcement'\n end",
"def publish_all\n\t\tschedule = params[:schedule] && Schedule.find_by_id(params[:schedule])\n\t\tgrades = schedule && schedule.grades.where.not(status: [Grade.statuses[:published], Grade.statuses[:published], Grade.statuses[:exported]])\n\t\tgrades.each &:published!\n\t\tredirect_back fallback_location: '/'\n\tend",
"def index (defdate = Date.today )\n date = params[:date] || defdate\n @patient = Patient.find(current_user.patient_id)\n if @patient.visits.any?\n\t @visits = @patient.visits.paginate(page: params[:page])\n\t render 'index'\n else\n\t flash.now[:warning] = \"No visits found for date: #{date.inspect}\" \n\t render inline: '', layout: true\n end\n end",
"def show\n if logged_as_student?\n student = Student.find(session[:user_id])\n group = Group.find(student.group_id)\n if !Sqanswer.where(:teacher_id => group.teacher_id, :student_id => student.id, :sidequest_id => @sidequest.id, :reward => @sidequest.reward, :read => false).exists?\n @sqanswer = Sqanswer.new(:teacher_id => group.teacher_id, :student_id => student.id, :sidequest_id => @sidequest.id, :reward => @sidequest.reward, :read => false)\n @sqanswer.save\n else\n @sqanswer = Sqanswer.find_by(:student_id => student, :sidequest_id => @sidequest.id)\n end\n end\n \n if logged_as_teacher?\n @sidequest = Sidequest.find(params[:id])\n @sqanswers = Sqanswer.where(sidequest_id: @sidequest.id, read: false).sort_by{|e| e[:time]}.reverse \n end\n end",
"def show\n @vaccines = Vaccine.where(:emp_id => @employee.employee_id)\n @diseases = Disease.where(:emp_id => @employee.employee_id)\n if(@employee.have_exam == \"true\" && @employee.department == \"Warehouse\" && (@employee.emp_date-2.day).month == Date.today.month && (@employee.emp_date-2.day).day == Date.today.day)\n @medical_exams = \"Enzyme, Respiratory, PFT\"\n end\n if(@employee.have_exam == \"true\" && @employee.department == \"Fabric Care\" && (@employee.emp_date-2.day).month == Date.today.month && (@employee.emp_date-2.day).day == Date.today.day)\n @medical_exams = \"Hearing, Enzyme, Respiratory, PFT, Chest Xray\"\n end\n if(@employee.have_exam == \"true\" && @employee.department == \"FemCare\" && (@employee.emp_date-2.day).month == Date.today.month && (@employee.emp_date-2.day).day == Date.today.day && ((@employee.emp_date-2.day).year == Date.today.year-1 || (@employee.emp_date-2.day).year == Date.today.year-2 || (@employee.emp_date-2.day).year == Date.today.year-3)) \n @medical_exams = \"PFT\"\n end\n if(@employee.have_exam == \"true\" && @employee.department == \"FemCare\" && (@employee.emp_date-2.day).month == Date.today.month && (@employee.emp_date-2.day).day == Date.today.day && ((@employee.emp_date-2.day).year%2 == Date.today.year%2))\n @medical_exams = \"Respiratory\"\n end\n if(@employee.have_exam == \"true\" && @employee.department == \"FemCare\" && (@employee.emp_date-2.day).month == Date.today.month && (@employee.emp_date-2.day).day == Date.today.day && ((@employee.emp_date).year+10 == Date.today.year || ((Date.today.year-(@employee.emp_date-2.day).year)%5==0 && Date.today.year > (@employee.emp_date-2.day).year+10)))\n @medical_exams = \"Chest Xray\"\n end\n if(@employee.have_exam == \"true\" && (@employee.deptType == \"Bar Soap\" || @employee.department == \"Home Care\") && (@employee.emp_date-2.day).month == Date.today.month && (@employee.emp_date-2.day).day == Date.today.day)\n @medical_exams = \"Hearing\"\n end\n if(@employee.have_exam == \"true\" && @employee.special == \"FirstAid\" && (@employee.emp_date-2.day).month == Date.today.month && (@employee.emp_date-2.day).day == Date.today.day)\n @medical_exams = \"Hearing, Enzyme, Respiratory, PFT, General Examination & Fitness\"\n end\n if(@employee.have_exam == \"true\" && @employee.special == \"FirstAid\" && (@employee.emp_date-2.day).month == Date.today.month && (@employee.emp_date-2.day).day == Date.today.day && (( (Date.today.year - (@employee.emp_date-2.day).year == 20) || Date.today.year - (@employee.emp_date-2.day).year == 25 || Date.today.year - (@employee.emp_date-2.day).year == 30 || Date.today.year - (@employee.emp_date-2.day).year == 33 || Date.today.year - (@employee.emp_date-2.day).year == 36 || Date.today.year - (@employee.emp_date-2.day).year == 39 || Date.today.year - (@employee.emp_date-2.day).year >= 40)))\n @medical_exams = \"ECG\"\n end\n\n\n end",
"def index\n start_date = params[:index][:start_date].to_date.beginning_of_day\n end_date = params[:index][:end_date].to_date.end_of_day\n \n if start_date > end_date\n flash[:date_discover] = \"La fecha inicial debe ser menor a la final\"\n redirect_to report_index_url\n else \n @discovers = Discover.where(:created_at => start_date..end_date)\n \n respond_to do |format|\n format.html\n format.xlsx\n format.json\n end\n end\n end",
"def add_paper_risk\n @service_learning_course = ServiceLearningCourse.find(params[:id])\n @student = Student.find(params[:student_id])\n unless @student.nil?\n @student.update_attribute(:service_learning_risk_paper_date, params[:date])\n flash[:notice] = \"Successfully added paper AOR to #{@student.fullname}.\"\n else\n flash[:error] = \"Error adding paper AOR date. Is that a valid Student ID?\"\n end\n \n respond_to do |format|\n format.html { redirect_to students_service_learning_course_path(@unit, @quarter, @service_learning_course) }\n format.js\n end\n \n end",
"def edit_result\n begin\n @running = Facade::SportSession::Running.find_by id: params[:id]\n\n if not @running.is_participant(current_user)\n redirect_to runnings_url, alert: 'Permission denied'\n end\n\n if @running.date > Date.today\n redirect_to runnings_url, alert: 'Storing results only possible if event is passed'\n end\n\n @result = @running.result(current_user)\n rescue\n redirect_to runnings_url, alert: 'Permission denied'\n end\n end",
"def fecha_publicacion\n run_at = self.publication_date\n end",
"def timeis_up\n current_user.submit_answers\n render text: true\n end",
"def index\n @action_name = \"all\"\n @attendances = current_employee.attendances\n filter_params = params[:date]\n if filter_params\n @d = Date.civil(filter_params[:year].to_i || DateTime.now.year, filter_params[:month].to_i || DateTime.now.month, filter_params[:day].to_i || DateTime.now.day)\n if filter_params[:scope] == \"month\"\n @status = \"monthly\"\n @old_day = @d.beginning_of_month\n @new_day = @d.end_of_month\n else\n @status = \"weekly\"\n @old_day = @d.beginning_of_week\n @new_day = @d.end_of_week\n end\n else\n @status = \"weekly\"\n @old_day = DateTime.now.beginning_of_week\n @new_day = DateTime.now\n end\n @d ||= Date.today\n end",
"def publish_all\n authorize!(:publish_grades, @assessment)\n graded_submissions = @assessment.submissions.with_graded_state\n if !graded_submissions.empty?\n job = Course::Assessment::Submission::PublishingJob.\n perform_later(@assessment, current_user).job\n redirect_to(job_path(job))\n else\n redirect_to course_assessment_submissions_path(current_course, @assessment),\n notice: t('.notice')\n end\n end",
"def view_applicants\n start_date = Date.today.beginning_of_year\n start_date -= 365 if Date.today - start_date < 90\n @submissions = Submission.includes([:applicant]).where('submissions.created_at > :start', { :start => start_date }).all\n\n @activity = \"all applicants from #{start_date.to_s} to today for all competitions\"\n if has_read_all?(@sponsor)\n respond_to do |format|\n format.html { render :view_applicants }\n format.xml { render :xml => @applicants }\n end\n else\n redirect_to projects_path\n end\n end",
"def index\n @test_subject_evaluations = @test_subject.test_subject_evaluations.find(:all, :order => 'evaluated_on DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @test_subject_evaluations }\n end\n end",
"def publish\n respond_to do |format|\n if @submission.publish!\n format.html { redirect_to @submission, notice: 'Published!' }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_profile_submission_path(@profile, @submission), notice: 'There were missing parts.' }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def finished\n self.date.present? && (self.date < Date.today)\n end",
"def process_self_audit_update(result_update, design_check, user)\n\n if design_check.designer_result == \"None\"\n\n self.update_self_check_count\n \n if self.designer_complete?\n AuditMailer.self_audit_complete(self).deliver\n AuditMailer.final_review_warning(self.design).deliver\n end\n \n self.reload\n \n end\n\n design_check.update_designer_result(result_update, user)\n \n end",
"def view\n @subject = Subject.find(params[:id])\n @assignments = @subject.assignments.limit(10).reverse_order\n @new_assign = @subject.assignments.build\n @subject_id = @subject.id\n @adate = @subject.get_next_assignment_date\n\n respond_with(@assignments, @new_assign, @subject_id, @adate)\n end",
"def create\n @test = Test.new(test_params)\n if @test.is_online \n @test.status = \"Not Started\" \n else\n @test.status = \"Ended\" \n end\n respond_to do |format|\n if @test.save \n\n @students = @test.subject_class.students #create student test result and set to zero to be edited by instructor\n \n @students.each do |student|\n result = TestResult.new(test_id: @test.id, student_id: student.id, score: 0, status: TestResult::STATUS_LIST[0], last_time_online: Date.today, time_finished: Date.today, reason: TestResult::REASON_LIST[3])\n if result.save\n puts \"==============================================\"\n puts \"test result created\"\n puts \"==============================================\"\n else\n puts \"==============================================\"\n puts result.errors.full_messages\n puts \"==============================================\"\n \n end\n \n \n end \n\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initial_exam_end_date(contact)\n initial_campaign_exam = CampaignExam.where(\"campaign_id = ? AND stage = ?\", self.id, EXAM_STAGE_INITIAL).first\n \n initial_exam_present = false\n initial_exam_ended_date = false\n \n if initial_campaign_exam.present? \n initial_exam_present = true\n \n initial_user_exam = UserExam.where(\"user_id = ? AND exam_id = ?\",contact.id, initial_campaign_exam.exam_id).first\n initial_exam_ended_date = (initial_exam_present) ? initial_user_exam.date_end : false\n end\n \n return initial_exam_present, initial_exam_ended_date \n end",
"def index\n @page_title = \"Arrivals scheduled #{currentDate + 1}\"\n @reservations = Reservation.all( :conditions => [\"confirm = ? AND startdate <= ? AND archived = ? AND cancelled = ? AND checked_in = ?\",\n\t\t\t\t\t\t true, currentDate + 1, false, false, false],\n\t\t\t\t :include => ['camper', 'space', 'rigtype'],\n\t\t\t\t :order => \"campers.last_name asc\" )\n render 'report/today_checkins/index.html.erb'\n end",
"def publication_status(obj, options={})\n return raw toggle_field(obj, \"publish\", 'toggle', options) if obj.date_end_at.nil?\n return raw toggle_field(obj, \"publish\", 'toggle', options) if publish_date?(obj)\n return t(\"expired\") \n end",
"def archive_notice\n if d(@issue.date) < d(PubDate.latest.date) #MHO sb < & use real dates\n content_tag('p', 'You are in the archives.', :class => 'red cntr')\n end\n end"
] |
[
"0.7487951",
"0.66681635",
"0.66058266",
"0.64313954",
"0.63741964",
"0.63505787",
"0.63464093",
"0.6343912",
"0.6281331",
"0.61958647",
"0.6177673",
"0.61198205",
"0.60273725",
"0.6012654",
"0.6001256",
"0.5989017",
"0.5879786",
"0.58782697",
"0.57414556",
"0.5736971",
"0.5691157",
"0.5645739",
"0.5624691",
"0.5615331",
"0.555969",
"0.5558911",
"0.5540186",
"0.55320704",
"0.55171824",
"0.55170625",
"0.55054814",
"0.54956824",
"0.5486924",
"0.5485625",
"0.5480499",
"0.5451909",
"0.5450739",
"0.5444668",
"0.544355",
"0.54372865",
"0.5427994",
"0.5425791",
"0.54095286",
"0.5396813",
"0.53937376",
"0.5386595",
"0.5386011",
"0.53853303",
"0.53853303",
"0.53750527",
"0.53724134",
"0.537036",
"0.5362482",
"0.5350692",
"0.53467655",
"0.53467137",
"0.5342694",
"0.5339688",
"0.53272873",
"0.53208876",
"0.5319302",
"0.5317384",
"0.53173834",
"0.5310369",
"0.52955407",
"0.5291645",
"0.5287568",
"0.5287568",
"0.5287145",
"0.527784",
"0.52750987",
"0.5271532",
"0.5269213",
"0.5269103",
"0.52628",
"0.52598023",
"0.5256823",
"0.52539444",
"0.5253939",
"0.5248725",
"0.5246152",
"0.5245949",
"0.52396154",
"0.5238152",
"0.5237894",
"0.5237724",
"0.5230731",
"0.5226775",
"0.5222939",
"0.5221584",
"0.5218116",
"0.5216594",
"0.5214702",
"0.5202046",
"0.520177",
"0.5199265",
"0.5197351",
"0.5196559",
"0.5188454",
"0.518537"
] |
0.64466536
|
3
|
find out the weightage for first record of the exam
|
def weightage
return unless exams.first.nil?
exams.first.weightage
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def measure() @measure ||= (nb_weight == 0.0 ? 0.0 : sum_weight / nb_weight) end",
"def weight\n return @weight\n end",
"def weight; end",
"def weight\n 0\n end",
"def weight\n return data.weight\n end",
"def weight\n if @weight\n @weight\n else\n @confines.length\n end\n end",
"def weight\n if @weight\n @weight\n else\n @confines.length\n end\n end",
"def w_vs_m\n\t\tweightlifting = reviews.where(weightlifting_focus: true).count\n metcon = reviews.where(metcon_focus: true).count\n \n if weightlifting == 0 && metcon == 0\n @focus = \"\"\n elsif weightlifting > metcon\n @focus = \"This gym focuses on weightlifting\"\n elsif metcon > weightlifting\n @focus = \"This gym focuses on metcon training\"\n else \n @focus = \"This gym offers a balance of weightlifting and metcon training\"\n end \n return @focus\n end",
"def calc_total_weight\n 0\n end",
"def weighted_score\n return nil if self.points.nil?\n self.points * self.weighting / self.maximum_points\n end",
"def currentWeight() weighins.last.weight end",
"def compute_score\n\n total_score=0\n total_weights=0\n self.class.field_mappings.each do |field_name,field_config|\n if !field_config[:weight].blank?\n total_score += field_config[:weight].to_f * (self.class.blank_value?(self.send(field_name)) ? 0 : 1) # if the field is blank, it is a 0 regardless of weight, otherwise it is a 1 times its weight\n total_weights += field_config[:weight].to_f\n end\n end\n\n return ((total_score/total_weights)*100).ceil\n\n end",
"def weight\n questions.reduce(0) { |memo, question| question.weight > 0 ? memo + question.weight : memo }\n end",
"def prom_weight\n if pet_histories.length > 0\n promw= pet_histories.sum(:weight)\n promw/pet_histories.length\n else\n \"0\"\n end\n end",
"def recitation_score(recitation)\n metrics.sum { |m| recitation.average_metric_score(m) * m.weight }\n end",
"def weighted_score\n score * metric.weight\n end",
"def weight\n return nil if mass.nil?\n mass / 1000.0\n end",
"def molecular_weight\n @mw ||= begin\n mass = WATER_MASS\n each_aa do |aa|\n mass += AVERAGE_MASS[aa.to_sym]\n end\n (mass * 10).floor().to_f / 10\n end\n end",
"def get_score(formation)\n lowest_score = Float::MAX\n formation.each do |proj_id, teamArr|\n #TODO multiply each score by the weight from the professor\n score = @professor_preferences[:scheduleWeight]*get_schedule_score(teamArr) + \n @professor_preferences[:codingWeight]*get_coding_score(teamArr) + \n @professor_preferences[:partnerWeight]*get_partner_score(teamArr) + \n @professor_preferences[:projectWeight]*get_project_score(teamArr,proj_id)\n # puts \"each score is\",score\n if (score < lowest_score) then\n lowest_score = score\n end\n end\n return lowest_score\n end",
"def weight\n @weight || @confines.length\n end",
"def weight(index)\n index.nil? ? 0 : (FIRST_INTEGER_WEIGHT - index)\n end",
"def score\n s = Settings.instance\n s.faculty_weight.to_f * (s.rank_weight.to_f/self.rank.to_f + s.mandatory_weight.to_f*(self.mandatory ? 1.0 : 0.0))\n end",
"def exams_info\n averege_scores = 0\n exams_accounted_scores = 0\n total_views = 0\n self.exams.each do |exam|\n total_views = total_views + exam.views\n\n if exam.feedback_avarage >= 0\n averege_scores = averege_scores + exam.feedback_avarage\n exams_accounted_scores = exams_accounted_scores + 1\n end\n end\n\n if exams_accounted_scores > 0\n averege_scores = averege_scores / exams_accounted_scores\n end\n\n return {averege_scores: averege_scores, total_views: total_views}\n end",
"def score\n w = 0.3\n time = diff_time()\n sum_goods = goods()\n sum_bads = bads()\n total = sum_goods + sum_bads\n (w * sum_goods * (sum_goods/total.to_f)**3 * (total/time)).floor\n end",
"def weight\n order_lines.inject(0) { |sum, l| sum + l.weight }\n end",
"def caloric_requirement_st1(age, bmr)\n case age\n when 0..14\n bmr * 1.45\n when 15..17\n bmr * 1.55\n when 18..69\n bmr * 1.50\n else\n bmr * 1.45\n end\n end",
"def weight_until_goal\n if weigh_ins.count > 0 && goal_weight > 0\n weigh_ins.first.current_weight - goal_weight\n elsif goal_weight > 0\n start_weight - goal_weight\n end\n end",
"def caloric_requirement\n age = current_age\n bmr = basal_metabolic_rate(age)\n if strength == 1\n caloric_requirement_st1(age, bmr).to_i\n elsif strength == 2\n caloric_requirement_st2(age, bmr).to_i\n else\n caloric_requirement_st3(age, bmr).to_i\n end\n end",
"def weight\n 2 # ounces\n end",
"def query_all_weight\n d = 0 \n eqs = query_all_wearings\n p \"=>wearing=#{eqs.inspect}\"\n eqs.each {|k,v|\n d+= v.weight if v\n }\n return d\n end",
"def bmi\n ( weight.to_f / ( (height.to_f)**2 ) ) * 703.0\n end",
"def check_weights\n until ((@personal_credit_weight + @industry_weight + @biz_age_weight) == 1.0)\n puts \"Your weights do not add up to 100%. please correct this.\"\n new_weights\n end\n end",
"def set_wine\n @wine = Wine.find(params[:id])\n \n @theRating=0.0\n @theTotPerson=0\n @wine.ratings.each {|i| if(i.rating!=-1 and !i.rating.nil? ); @theRating+=i.rating; @theTotPerson+=1; end;}\n @theRating/=@theTotPerson if @theTotPerson!=0\n \n \n end",
"def what_you_would_get_if_not_full\n if (qualifying_years + years_to_pension) < years_needed\n ((qualifying_years + years_to_pension).to_f / years_needed.to_f) * current_weekly_rate\n else\n current_weekly_rate\n end\n end",
"def ca_plus_mse\n total_formative * (100 - examweight)/100\n end",
"def max_score\n problem.weight\n end",
"def sort_weight\n if !ec? && (excellent_schools_grade == 'N/A' || excellent_schools_grade == 'New') && recommended?\n # Put Recommended schools that don't have a grade, between C+ and C schools\n 49.5\n else\n school_type_weight\n end\n end",
"def weight\n (kyc_level == 'any' ? 0 : 10) + (group == 'any' ? 0 : 1)\n end",
"def bmi_calc height, weight\n return (weight / height**2).to_i\nend",
"def min_rating\n 0\n end",
"def final_decision_weight_ratio\n r = read_attribute(:final_decision_weight_ratio)\n (r.nil? || r.zero?) ? 0.5 : r\n end",
"def weight\n num_motions.zero? ? 0.5 : total_score.fdiv(max_score)\n end",
"def calculated_strain\n strain_th = willpower\n strain_th += race.strain_threshold if race && race.strain_threshold\n # Then increase based on selected talents.\n talent_alterations.each do |_talent_id, stat|\n stat.each do |type, value|\n strain_th += value['count'] if type == :strain\n end\n end\n strain_th\n end",
"def weight w=nil\n if w.nil?\n @weight\n else\n @weight = w\n end\n end",
"def boost\n 1.0 #self.rating / 2.0\n end",
"def print_weight\n\t\t\treturn @weights\n\t\tend",
"def print_weight\n\t\treturn @weights\n\tend",
"def min_record\n min = record(infimum.next)\n min if min != supremum\n end",
"def strain_threshold\n strain_th = self.willpower\n if self.race && self.race.strain_threshold\n strain_th += self.race.strain_threshold\n end\n # Then increase based on selected talents.\n self.talent_alterations.each do |talent_id, stat|\n stat.each do |type, value|\n if type == :strain\n strain_th += value['count']\n end\n end\n end\n strain_th\n end",
"def proficiency_bonus\n\t\t(level()+3)/4 + 1\n\tend",
"def rate\n first_at, first_value = @samples.first\n last_at, last_value = @samples.last\n if first_at == last_at\n 0\n else\n (last_value - first_value) / (last_at - first_at)\n end\n end",
"def rate; end",
"def rate; end",
"def compute_average_grade\n total = 0.0\n self.fcqs.compact.each {|x| next if x.avg_grd == nil; total += x.avg_grd}\n count = courses_taught\n if count == 0\n return 1.0 \n else\n return (total.to_f / count.to_f)\n end\n end",
"def test_total_weight\n assert_equal(0 , @wp00.total_weight)\n assert_equal(384, @wp01.total_weight)\n assert_equal(576, @wp02.total_weight)\n end",
"def patient_score\n @@thresholds.keys.inject(0) do |accu, attribute|\n accu + self.send(\"#{attribute}_score\")\n end\n end",
"def current_bmi_alert(patient_weight, patient_height)\n weight = patient_weight\n height = patient_height\n alert = nil\n unless weight == 0 || height == 0\n current_bmi = (weight/(height*height)*10000).round(1);\n if current_bmi <= 18.5 && current_bmi > 17.0\n alert = 'Low BMI: Eligible for counseling'\n elsif current_bmi <= 17.0\n alert = 'Low BMI: Eligible for therapeutic feeding'\n end\n end\n\n alert\n end",
"def total_weight_loss(db, member_id) \n total_pounds= []\n today = Time.now.strftime(\"%m-%d\") \n weight = db.execute(\"SELECT * FROM members WHERE id='#{member_id}'\") \n updated_weight = db.execute(\"SELECT * FROM weight WHERE member_id='#{member_id}'\")\n updated_weight.each do |pounds|\n total_pounds << pounds['current_weight']\n end \n weight_loss = weight[0]['starting_weight'] - total_pounds.min \nend",
"def weight\n puts 'used custom getter'\n 2\n end",
"def reward_rate\n return nil if self.reward_count == 0 || self.reward_count.nil? || self.reward.nil?\n return self.reward / self.reward_count.to_f\n end",
"def weight_in_stones\n\t\t((@weight * 2.20462) / 14).to_i\n\tend",
"def weight\n\t\tweight = 0\n\t\tself.order_line_items.each do |item|\n\t\t\tweight += item.quantity * item.product.weight\n\t\tend\n\t\treturn weight\n\tend",
"def masterwork_prob_bonus; 0; end",
"def corrected_rating\n [(weighted_rating + 2) * 1.6666666666666667, 5.0].min\n end",
"def getAverageAwesomeness\n sum = 0\n @persons.each do |person|\n sum += person.awesomeness.to_i\n end\n return sum/@persons.length\n end",
"def rating\n 0\n end",
"def weighted_score(score, avg_score)\n #add if statement if score is 0\n if(score==0)\n return\n end\n return (avg_score + 215)/score\n end",
"def current_bmi_alert\n weight = self.current_weight\n height = self.current_height\n alert = nil\n unless weight == 0 || height == 0\n current_bmi = (weight/(height*height)*10000).round(1);\n if current_bmi <= 18.5 && current_bmi > 17.0\n alert = 'Low BMI: Eligible for counseling'\n elsif current_bmi <= 17.0\n alert = 'Low BMI: Eligible for therapeutic feeding'\n end\n end\n\n alert\n end",
"def overall_rating\n\t\ttotal_score = 0\n\t\ttotal_score += self.setting \n\t\ttotal_score += self.hotness\n\t\ttotal_score += self.originality\n\t\ttotal_score += self.style\n\t\ttotal_score += self.attitude\n\t\treturn total_score / 5\n\tend",
"def calc_weight(mod, acc)\n fuel = calc_fuel(mod)\n fuel <= 0 ? acc : calc_weight(fuel, acc + fuel)\nend",
"def effective_rate; end",
"def document_progress(new_weight, old_weight)\n if self.goal == \"Lose Weight\"\n self.weight_histories.create(weight_recording: (old_weight - new_weight))\n elsif self.goal == \"Gain Weight\"\n self.weight_histories.create(weight_recording: (new_weight - old_weight))\n end\n end",
"def relevancy_score\n header_score\n end",
"def all_ratings_calculated_ratio\n\t\tif number_of_ratings > 0\n\t\t\tratio = mean_calculated_ratio\n\t\telse\n\t\t\tratio = chapter.mean_calculated_ratio\n\t\tend\n\t\treturn ratio\n\tend",
"def percent_passes; end",
"def percent_passes; end",
"def best_score\n submissions.min(:score)\n end",
"def school_type_weight\n case school_type\n when 'k8'\n esd_k8_2017s ? esd_k8_2017s.total_pts.to_f * 100 : 0\n when 'hs'\n esd_hs_2016s ? esd_hs_2016s.total_pts.to_f * 100 : 0\n when 'ecs'\n if early_childhood_rating == 'Below Bronze'\n # Give Pre-K schools without a medal a score penalty\n ec_state_ratings.total_points.to_f / 15 * 100 / 2\n else\n ec_state_ratings.total_points.to_f / 15 * 100\n end\n else\n 0\n end\n end",
"def one_rep_max(weight, reps)\n\t\tif reps > 10 # reps need to be below 11 for accurate result.\n\t\t\treturn nil \n\t\telse\n\t\t\treturn (weight/ (1.0279 - (0.0278 * reps)))\n\t\tend\n\tend",
"def calculate_calories(bodyweight)\n\ttotal_calories = bodyweight * 13\n\treturn total_calories\nend",
"def compute_weighted_overall_score\n (Player::Feedback::FIT_WEIGHT * avg_fit_score +\n Player::Feedback::PUNC_WEIGHT * avg_punctuality_score +\n Player::Feedback::SKILL_WEIGHT * avg_skill_score +\n Player::Feedback::PERS_WEIGHT * avg_personality_score)\n end",
"def low_note\n return @notes.min_by { |note| note.pitch } \n end",
"def grade_average\n results = Assignment.find_by_sql([\"\n SELECT (sum(grades.grade * assignments.weight)/sum(assignments.weight)) AS total\n FROM assignments\n LEFT JOIN grades ON (assignments.id = grades.assignment_id)\n WHERE assignments.school_id=? and grades.user_id=? and grades.grade >= 0\n GROUP BY grades.user_id\",self.school,self.id])\n return results[0]['total'].to_i unless results.count == 0\n end",
"def humanWeights\n\n # Get the weights into an array and then find the width in digits of the\n # largest weight.\n\n weights = to_weights\n widths = Array.new\n weights.each { |w| widths.push(Utility.numWidth(w)) }\n theWidth = widths.max\n\n # Make a TextRect column of the weights.\n\n theFormat = \" %#{theWidth}d, # \"\n theStrs = Array.new\n weights.each { |w| theStrs.push(theFormat % w) }\n theNums = TextRect.new(theStrs)\n\n # Now make a TextRect column of the text of the rules themselves.\n\n theRules = Array.new\n @ruleTable.each_index { |i| theRules.push(@ruleTable[i][:rule].to_s) }\n\n # Now put the parts together and return the result.\n\n theNums.join!(theRules)\n theTop = TextRect.new('[')\n theTop.below!(theNums)\n theTop.below!(TextRect.new(']'))\n \n theTop\n \n end",
"def withdrawal_rate\n (youngest_person_retirement_age - 15.0) / 1000.0\n end",
"def rating\n r = 0\n if self[:power_rating]\n r = self[:power_rating].to_f\n else\n r = PHASES.inject(0) {|sum, ph| sum += (self[\"power#{ph}_rating\".to_sym] || 0).to_f}\n end\n raise \"Can't find a rating for #{self[:name]}\" if r == 0\n r\n end",
"def rate\n return @rate\n end",
"def num_weights(); 0;end",
"def expected_grades\n metrics.count * course.students.count\n end",
"def weight\n @mass * @hopper.size\n end",
"def weightPolls()\n\n end",
"def score; end",
"def calculateWeight word\n letters = word.split\n weight = 0\n hash_alphabet = generateHashWithLetterAndWeight()\n letters.each do |letter|\n (/[[:upper:]]/.match(letter)) ? weight += hash_alphabet[letter.downcase].to_i * 2 : weight += hash_alphabet[letter.downcase].to_i\n end\n weight\n end",
"def first_weight\n if current_user\n return Weight.first_weight(current_user)\n return string.html_safe\n end\n end",
"def calculate_bmi(height,weight)\n ( weight / ( (height/100) * (height/100) ) )\n end",
"def molecular_weight\n Bio::AminoAcid.weight(self)\n end",
"def results(values, weight)\n gpa = weight.reduce(:+).to_f / values.reduce(:+)\n\n puts $divide\n puts \"\\n#{$first.capitalize} #{$last.capitalize}, your GPA is #{gpa.to_s} \\n\\n\"\nend",
"def study_length\n read_attribute(:study_length) || 3\n end",
"def estimated_child_age(age)\n\tage / 2\nend",
"def reliability\n (100.0 * self.surveyed / self.enrolled).round_to(0).to_i\n end"
] |
[
"0.6543537",
"0.63375103",
"0.62807703",
"0.6257638",
"0.611474",
"0.60140914",
"0.60140914",
"0.59837097",
"0.59794754",
"0.59682655",
"0.5942232",
"0.5917063",
"0.5903843",
"0.58963495",
"0.58960855",
"0.5851221",
"0.58236784",
"0.5816772",
"0.57607096",
"0.57357216",
"0.5694304",
"0.5673295",
"0.566319",
"0.5661637",
"0.5648935",
"0.5628669",
"0.5627718",
"0.5625962",
"0.5613304",
"0.5600614",
"0.55904746",
"0.5575714",
"0.5571787",
"0.55581695",
"0.55560297",
"0.5536748",
"0.5536519",
"0.5534948",
"0.5531549",
"0.551885",
"0.5513557",
"0.5495635",
"0.54933685",
"0.5486084",
"0.54824185",
"0.5477037",
"0.5472422",
"0.5469603",
"0.5462434",
"0.54587066",
"0.54342014",
"0.542804",
"0.542804",
"0.5419776",
"0.54033726",
"0.53951037",
"0.5394507",
"0.5394502",
"0.5393556",
"0.5391427",
"0.53890824",
"0.5388952",
"0.53878343",
"0.53810537",
"0.53802544",
"0.5371981",
"0.5365243",
"0.5364087",
"0.53637636",
"0.5363393",
"0.5354363",
"0.5352309",
"0.5343556",
"0.53318226",
"0.5326303",
"0.5326303",
"0.5317308",
"0.53126454",
"0.53111064",
"0.5309272",
"0.53033614",
"0.53011096",
"0.52981395",
"0.52978027",
"0.5296094",
"0.5290227",
"0.5288084",
"0.5285722",
"0.5284421",
"0.5271424",
"0.5270088",
"0.5263534",
"0.5262036",
"0.5261223",
"0.5253534",
"0.5252803",
"0.5248019",
"0.5247056",
"0.52450556",
"0.5244756"
] |
0.7843295
|
0
|
Generate the result by subject id and exam group id.
|
def exam_data(subject)
Exam.result(subject.id, id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @exam_group = ExamGroup.shod(params[:exam_group_id])\n @batch = @exam_group.batch\n @subjects = @batch.subjects.where(no_exams: false)\n @exam = @exam_group.exams.new(params_exam)\n exam_create\n end",
"def get_group\n if params[:stu].present? && params[:sub].present?\n student_id = params[:stu].to_i\n subject_id = params[:sub].to_i\n student_subject = StudentHasSubject.joins(:school_cycle_has_subject).where(\"student_id = ? AND subject_id = ?\", student_id, subject_id).first\n if student_subject.present?\n msg = { \"success\": \"true\", \"student_subject\": student_subject.id }\n else\n msg = { \"success\": false, \"student_subject\": nil }\n end\n else\n msg = { \"success\": false, \"student_subject\": nil }\n end\n\n render json: msg\n end",
"def build_exam_set\n @scores = new_collection\n @total_max = 0\n @total_score = 0\n @overrided_subjects = assessment_group.override_assessment_marks.find_all_by_course_id(batch.course_id).collect(&:subject_code)\n process_scores\n \n Models::ExamSet.new(\n :obj_id => assessment_group.id,\n :name => assessment_group.display_name,\n :scores => @scores,\n :aggregates => process_aggregates,\n :term_name => term_name(assessment_group),\n :term_exam => assessment_group.is_final_term,\n :group_exam => is_assessment_group?,\n :planner_exam => (assessment_group.is_final_term and (assessment_group.parent_type == 'AssessmentPlan')),\n :attendance_report => process_attendance,\n :planner_name => assessment_plan.name,\n :scoring_type => AssessmentGroup::SCORE[assessment_group.scoring_type],\n :show_percentage => (assessment_group.is_final_term && assessment_group.show_percentage?),\n :maximum_mark => assessment_group.maximum_marks,\n :hide_marks => assessment_group.hide_marks,\n :consider_skills => assessment_group.consider_skills\n )\n end",
"def exam\n if @errors.nil?\n redirect_to exam_score_exam_path(@exam)\n else\n @students = []\n students ||= @exam.exam_group.batch.students.all\n @students = @exam.select_subject(@students, students, @exam)\n @exam_grade ||= @exam.exam_group.batch.grading_levels.all\n render 'exam_score'\n end\n end",
"def show\n\t\n\t@misses=Array.new\n\t@student.group.subjects.each do |subj|\n\t\ttmp=Array.new\n\t\t@student.misses.each do |miss|\n\t\t\tif Pair.find(miss.pair_id).subject==subj\n\t\t\t\ttmp << miss\n\t\t\tend\n\t\tend\n\t\t@misses << tmp\n\tend\n end",
"def show\n @students = Student.joins(:subjects)\n .select('students.name, students.email, students.age, students.gender, students.opinion, subjects.id as subject_id')\n .select('exam_results.name as exam_result_name, subjects.name as subject_name, exam_results.score')\n .select('CAST((exam_results.score / subjects.max_score) * 100 as int) as ratio')\n .where(id: params[:id])\n .order(id: :asc)\n\n avg_result = Student.joins(:subjects)\n .select('subjects.id as subject_id')\n .select('CAST(AVG(exam_results.score) as int) as avg_score') \n .select('MAX(exam_results.score) as max_score')\n .select('MIN(exam_results.score) as min_score')\n .group('subjects.id')\n .order('subjects.id')\n @score_hash = {}\n avg_result.each do |avg_res|\n h = Hash.new\n h[:avg_score] = avg_res.avg_score\n h[:max_score] = avg_res.max_score\n h[:min_score] = avg_res.min_score \n @score_hash[avg_res.subject_id] = h\n end\n end",
"def subject_specialization\n mg_school_id=session[:current_user_school_id]\n # @examination_hod_logins=MdgExaminationHodLogin.find_by(:mg_user_id=>session[:user_id])\n examination_hod_logins=MgExaminationHodLogin.find_by(:mg_user_id=>session[:user_id])\n employee=MgEmployee.find_by(:id=>examination_hod_logins.mg_employee_id)\n subject=MgSubject.where(:is_deleted=>0, :mg_school_id=>mg_school_id, :mg_employee_specialization_id=>employee.hod_specialization_id)\n @subject_specialization=MgExamSubjectSpecializedEmployees.where(:is_deleted => 0, :mg_school_id=>session[:current_user_school_id], :mg_subject_id=>subject.pluck(:id)).paginate(page: params[:page], per_page: 10)\n \n end",
"def index\n @group = Group.find params[:group_id]\n if current_instructor\n @evaluations = Evaluation.where group_id: @group.id\n elsif current_student\n @evaluations = Evaluation.where group_id: @group.id, student_id: current_student.id\n end\n end",
"def assessments\n self.all_assessments.joins(:test_configurations).where('test_configurations.group_id IN(?)',get_groups).group('contents.id')\n end",
"def subject_result(subject)\n mutation_results = @aggregate[subject].sort_by(&:index)\n\n Result::Subject.new(\n subject: subject,\n runtime: mutation_results.map(&:runtime).inject(0.0, :+),\n mutation_results: mutation_results\n )\n end",
"def process_scores\n applicable_subjects = []\n subjects.group_by(&:batch_subject_group).each_pair do |batch_group, batch_subjects|\n (batch_subjects << batch_group).compact.each do |sub|\n applicable_subjects << sub\n end\n end\n applicable_subjects.sort_by{|as| as.priority.to_i}.each do|sub|\n mark = student.converted_assessment_marks.detect{|cam| cam.markable_id == sub.id and \n cam.markable_type == sub.class.name and cam.assessment_group_batch_id == agb.id}\n next unless mark\n build_score(sub, mark)\n process_skills(sub,mark) if consider_skills_of_subjects(sub)\n process_attributes(sub, mark, agb.subject_attribute_assessments) if agb.subject_attribute_assessments.present? and sub.is_a?(Subject)\n end\n\n add_to_exam_totals_hash(@total_score)\n end",
"def execute\n questions = QuestionMapper.find_all\n answers = AnswerMapper.find_all\n answer_hash = Hash.new(0)\n\n answers.each do |ans| \n answer_hash[ans.id] = ans\n end \n \n questions.each do |question| \n answer_arr = [] \n answer_arr << question\n answer_arr << (answers.sample(3) - [answer_hash[question.id]] + [answer_hash[question.id]])\n print_segment(answer_arr)\n end \n\n :ok\n end",
"def display_result\n @company = Company.find(params[:id])\n @placement_exam = PlacementExam.find(params[:p_id])\n @student_score = StudentScore.where(placement_exams_id: @placement_exam)\n end",
"def getAssessmentResults(sheet, year_row, start_row)\n stats = Hash.new { |h,k| h[k] = Hash.new { |h,k| h[k] = {} } }\n (0..100).step(3) do |sg_offset| # go down the rows\n subgroup = sheet.row(start_row + sg_offset)[TEST_GROUP_COL]\n break if subgroup.nil? or subgroup.empty? or subgroup.include? 'English: Reading' or subgroup.include? 'Mathematics'\n (START_SCORE_COL..START_SCORE_COL+8).step(4) do |offset| # and across\n year = sheet.row(year_row)[offset]\n stats[subgroup][year][:adv] = sheet.row(start_row + sg_offset)[offset]\n stats[subgroup][year][:pro] = sheet.row(start_row + sg_offset)[offset+1]\n stats[subgroup][year][:fai] = sheet.row(start_row + sg_offset)[offset+3]\n end\n end\n stats\nend",
"def getResultPhpMmrs(ask,type,number,questionChild)\r\n name=\"#{type}_#{number}\"\r\n erbTemplate = getTemplate(\"../encuestas/templates/result_php_mmrs.template\",binding)\r\n return erbTemplate.to_s\r\n end",
"def by_subject\n @exam = Exam.new\n session[:exam] = @exam\n @subjects = PlanSubject.find_unfinished_for(@user, :subjects => true)\n end",
"def show\n @batch = Batch.shod(params[:id])\n @exam_groups ||= @batch.exam_groups.all\n @course = @batch.course\n end",
"def subject_results\n env.subjects.map(&method(:subject_result))\n end",
"def generate_name\n next_student = Student.group(:group_id).count[params[:group_id].to_i]\n \"Student#{next_student + 1}\"\n end",
"def get_subject\n out = ''\n if aggregate_count > 1 #multiple records of any type\n if type_count > 1 #multiple types of records\n if distinct_aggregate_count > 1 #multiple profiles\n others = (distinct_aggregate_count-1)\n out << \"and #{pluralize(others, 'other')} \"\n out << subject_aggregate.sub('was ','were ')\n out << \" #{type_count} times\"\n else\n out << subject_aggregate\n out << \" #{type_count} times\"\n end\n else\n if distinct_aggregate_count > 1 #multiple profiles\n others = (distinct_aggregate_count-1)\n out << \"and #{pluralize(others, 'other')} \"\n out << subject.sub('was ','were ')\n else\n out << subject\n end\n end\n else\n out << subject\n end\n return out.html_safe\n end",
"def assign_all\n @batch = Batch.shod(params[:id])\n @exam_groups = @batch.exam_groups.all\n end",
"def qs_about()\n total_arr = cat_count\n randnums = rand_numbers(total_arr)\n $nums = valid_nums(randnums)\n subjects = get_subjects($nums)\nend",
"def result\n @exam = current_exam(params)\n\n @exam_reporter = @exam.evaluate(params[:answers])\n end",
"def set_results\n @exam = Exam.find(params[:exam_id])\n end",
"def update\n @exam_group = ExamGroup.shod(params[:id])\n @exam_group.update(params_exam_group)\n @batch = @exam_group.batch\n @subjects = @batch.subjects.exam\n @exam_group.exams.build\n end",
"def exercise2\n @content = ActiveRecord::Base.connection.execute(\"\n SELECT\n gr.name as group_name,\n u.name as user_name,\n sum(m.mapviews) as groups_count\n FROM (((users as u\n INNER JOIN groups_users as gu ON u.id=gu.user_id)\n INNER JOIN groups as gr ON gr.id = gu.group_id)\n INNER JOIN maps as m ON m.user_id = u.id)\n GROUP BY (gr.name, u.name)\n ORDER BY gr.name, groups_count DESC;\");\n\n @results2 = []\n\n index = 0\n @content.each do |r|\n @results2[index] = Result2.new r\n index = index + 1;\n end\n\n return @results2\n end",
"def build_result(question, evaluation_result, graded_test_case_types:)\n auto_grading = build_auto_grading(question, evaluation_result)\n graded_test_count = question.test_cases.where(test_case_type: graded_test_case_types).size\n passed_test_count = count_passed_test_cases(auto_grading, graded_test_case_types)\n\n considered_correct = check_correctness(question, auto_grading)\n grade = if graded_test_count == 0\n question.maximum_grade\n else\n question.maximum_grade * passed_test_count / graded_test_count\n end\n [considered_correct, grade, auto_grading, evaluation_result.evaluation_id]\n end",
"def build_result(question, evaluation_result, graded_test_case_types:)\n auto_grading = build_auto_grading(question, evaluation_result)\n graded_test_count = question.test_cases.where(test_case_type: graded_test_case_types).size\n passed_test_count = count_passed_test_cases(auto_grading, graded_test_case_types)\n\n considered_correct = check_correctness(question, auto_grading)\n grade = if graded_test_count == 0\n question.maximum_grade\n else\n question.maximum_grade * passed_test_count / graded_test_count\n end\n [considered_correct, grade, auto_grading, evaluation_result.evaluation_id]\n end",
"def get_subjects\n if params[:s].present?\n s_id = params[:s].to_i\n subjects_by_student = Subject.joins(\"INNER JOIN school_cycle_has_subjects ON subjects.id = school_cycle_has_subjects.subject_id INNER JOIN student_has_subjects ON school_cycle_has_subjects.id = student_has_subjects.school_cycle_has_subject_id\").where(\"student_id = ?\", s_id)\n msg = { \"success\": \"true\", \"subjects\": subjects_by_student }\n else\n msg = { \"success\": false, \"subjects\": 0 }\n end\n\n render json: msg\n end",
"def show\n\t\t@students = Student.where(school_id: @school.id)\n\t\t@group = {\"0\"=>[],\"1\"=>[],\"2\"=>[],\"3\"=>[],\"4\"=>[],\"5\"=>[],\"6\"=>[],\"7\"=>[],\"8\"=>[],\"9\"=>[],\"10\"=>[],\"11\"=>[],\"12\"=>[]}\n\t\t@st = []\n\t\t@students.each do |student|\n\t\t\t@group[student.last_course].push(student.average)\n\t\t\t#p student.average\n\t\tend\n\t\t@group.reject!{ |k,v| !v.any? }\n\t\t@courses = [];\n\t\t@grades = [];\n\t\t@group.each do |k,v|\n\t\t\t@group[k] = added(v);\n\t\t\t@courses.push(k);\n\t\t\t@grades.push(v[0].round(2));\n\t\tend\n\t\t@title = \"Informe del \" + (Time.now.year-1).to_s + \" al \" + (Time.now.year).to_s\n\n\t\t@ids=[]\n\t\t@students.each do |st|\n\t\t\t@ids.push(st.id)\n\t\tend\n\n\t\t@activities = Activity.joins(:students).where(students: {id: @ids})\n\t\t@programs_edu =\tProgram.where(line: \"epc\").joins(:activities).where(activities: {id: @activities})\n\t\t@programs_m =\tProgram.where(line: \"n\").joins(:activities).where(activities: {id: @activities})\n\t\t@programs_h =\tProgram.where(line: \"h\").joins(:activities).where(activities: {id: @activities})\n\n end",
"def build_test_case_records_from_test_results(question, auto_grading, evaluation_results) # rubocop:disable Metrics/AbcSize\n test_cases = question.test_cases.to_h { |test_case| [test_case.id, test_case] }\n evaluation_results.map do |result|\n test_case = find_test_case(test_cases, result['id'].to_i)\n result_run = result['run']\n\n error_message_sigkill = I18n.t('course.assessment.answer.programming_auto_grading.grade.evaluation_failed_syntax')\n messages ||= {\n error: result_run['code'] == 137 ? error_message_sigkill : result_run['stderr'],\n hint: test_case.hint,\n output: result_run['display'],\n code: result_run['code'],\n signal: result_run['signal']\n }.reject! { |_, v| v.blank? }\n\n auto_grading.test_results.build(auto_grading: auto_grading, test_case: test_case,\n passed: result_run['success'],\n messages: messages)\n end\n end",
"def get_group\n if params[:c].present? && params[:s].present?\n sc_id = params[:c].to_i\n s_id = params[:s].to_i\n group = SchoolCycleHasSubject.where(\"school_cycle_id = ? AND subject_id = ?\", sc_id, s_id).first\n if group.present?\n msg = { \"success\": \"true\", \"group\": group.id }\n else\n msg = { \"success\": false, \"group\": nil }\n end\n else\n msg = { \"success\": false, \"group\": nil }\n end\n\n render json: msg\n end",
"def getResultPhpMmr(ask,type,number,questionChild)\r\n name=\"#{type}_#{number}\"\r\n erbTemplate = getTemplate(\"../encuestas/templates/result_php_mmr.template\",binding)\r\n return erbTemplate.to_s\r\n end",
"def sequence_check_for_submission(sequence,group_hash,reversed_group_hash)\n\n result_array = Array.new\n aa_threshold = 0.9\n \n begin\n \n query = Bio::FastaFormat.new( sequence )\n query_name = query.definition\n sequence = query.to_seq\n\n existing_matched_group_exist = CustomizedProteinSequence.find_by(:chain => sequence.seq)\n if !existing_matched_group_exist.nil? # find existing sequence\n result_array << collection(query_name, \"WARN\", \"Your sequence exists in our database. Common Name: #{existing_matched_group_exist.header} \")\n return result_array\n end\n\n sequence.auto # Guess the type of sequence. Changes the class of sequence.\n query_sequence_type = sequence.seq.class == Bio::Sequence::AA ? 'protein' : 'gene'\n\n program = 'blastp'\n database = 'reductive_dehalogenase_protein'\n blast_options = get_blast_options\n\n\n blaster = Bio::Blast.local( program, \"#{Rails.root}/index/blast/#{database}\", blast_options)\n aa_report = blaster.query(sequence.seq) # sequence.seq automatically remove the \\n; possibly other wildcard\n aa_similarity = aa_report.hits().length.to_f / aa_report.db_num().to_f\n identity_with_90 = check_alignment_identity(aa_report, 90) # identity_with_90 contains all the header that share >=90% identity\n\n # group_hash => group : Array {seq_definition}\n # reversed_group_hash = seq_definition : group\n if identity_with_90.length > 0\n identified_group_at_aa_level = get_identified_group(identity_with_90,group_hash,reversed_group_hash) # identified_group_at_aa_level contains confirmed group in aa level \n else\n # if identity_with_90.length == 0; no RD with ~=90% identity => create new RD groups\n\n if aa_similarity >= aa_threshold\n last_group = CustomizedProteinSequence.group(:group).order(:group).last.group\n new_group_number = last_group + 1\n result_array << collection(query_name,\"NEW\", \"Your sequence belongs to a new RD group: #{new_group_number}\",new_group_number)\n else\n result_array << collection(query_name, \"FAILED\",\"Your sequence doesn't share 90\\% identity of any sequences in database at amino acid level.\")\n end\n\n return result_array\n end\n\n if identified_group_at_aa_level.length > 0\n result_array << collection(query_name, \"SUCCESS\",\"Your sequence belongs RD group: #{identified_group_at_aa_level.join(\",\")}\",identified_group_at_aa_level.join(\",\"))\n else\n result_array << collection(query_name, \"FAILED\",\"Your sequence doesn't share 90\\% identity with all representatives of the group at amino acid level.\")\n end\n\n return result_array\n \n rescue => exception\n # puts exception\n result_array << collection(query_name, \"ERROR\",\"Your sequence is not validated. Or send it to our lab for manual checking.\")\n end\n \n return result_array\n\n end",
"def exercise1\n @content = ActiveRecord::Base.connection.execute(\"\n SELECT\n u.name as user_name,\n COUNT(gr.name) as groups_count,\n CONCAT('[', COALESCE(STRING_AGG(gr.name, ', ' ), ''),']') as groups\n FROM ((users as u\n LEFT JOIN groups_users as gu ON u.id=gu.user_id)\n LEFT JOIN groups as gr ON gr.id = gu.group_id)\n GROUP BY user_name\n ORDER BY groups_count;\");\n\n @results1 = []\n\n index = 0\n @content.each do |r|\n @results1[index] = Result1.new r\n index = index + 1;\n end\n\n return @results1\n end",
"def show\n @students = CourseStudent.where(course_id: @course.id).pluck(:user_id, :role, :group_name).map{|student| {name: User.find(student[0]).full_name, role: student[1], group_name: student[2]} }\n @color = [\"info\", \"danger\", \"gray\", \"navy\", \"purple\", \"orange\", \"maroon\"]\n surveys = AssignedSurvey.select(:name, :survey_id)\n .where(course_id: params[:id])\n .group(:name, :survey_id)\n @assigned_surveys = []\n unless current_user.student? and not current_user.project_leader?(@course.id)\n surveys.each do |survey|\n answered = AssignedSurvey.where(answered: true, name: survey.name).count\n pending = AssignedSurvey.where(answered: false, name: survey.name).count\n @assigned_surveys << {#id: survey[:survey_id], #survey.id,\n name: survey.name, \n template: survey.survey.name, \n percentage: (answered.to_f/(answered + pending).to_f)*100}\n end\n else\n @assigned_surveys = AssignedSurvey.select(:id, :name, :course_id, :answered, :evaluated_user_id, :survey_id)\n .where(user_id: current_user.id, course_id: @course.id)\n\n end\n end",
"def process_course_results(meet_id,course)\n runner_entry = Struct.new(:runner_id, :runner_time, :result_id)\n runner_times = []\n score_list = []\n results = get_course_results(meet_id,course)\n results.each do |result|\n # if valid result\n if result.classifier == 0\n runner_gv = get_runner_gv(result,course,meet_id)\n score_list << (result.float_time * runner_gv)\n runner_times << runner_entry.new(result.runner_id, result.float_time, result.id)\n end\n end\n # return 0 if score_list.size < 3\n course_cgv = get_harmonic_mean(score_list)\n delta = update_meet_course_results(meet_id, results, course_cgv, course, runner_times)\n end",
"def show_p_and_a\n pas = GroupAn.find(params[:id])\n pq = pas.group.jsonQuestions\n render :json => { :paper_answers => pas, :paper_questions => pq, :question_count => pas.group.questions.count,:evaluate => pas.evaluate }\n end",
"def group(group_id = nil)\n group = if group_id\n fetch_or_setup_group(group_id)\n else\n subjects.values.sample\n end\n group || fetch_or_setup_group(group_id)\n end",
"def organizeDecResults( decResults, studentHashNames, sheet ) \n # Find values for name and results\n decName = decResults.pop\n name = sheet.translateName( decName )\n strResults = formatAnswersToSimple( sheet.translateAllAnswers(decResults) )\n strAmbig = sheet.translateAllAmbig( decResults )\n sheet.ambiguous_answers = strAmbig\n unless strAmbig == \"\" then\n course = Course.find(self.course_id)\n teacher = Teacher.find(course.teacher_id)\n ambigIssue = Issue.new( :code => 1, :resolved => false,\n :scansheet_id => sheet.id, :teacher_id => teacher.id, \n :name => \"Ambiguous Answers\" )\n ambigIssue.save\n end\n\n # Enter and save data for the sheet\n sheet.name = decName\n sheet.answers_string = decResults\n\n sheet.save\n # Find the student from the given students for a match\n theStudent = findStudentFromName( name, studentHashNames )\n grade = gradeStudent( strResults, self.answer_key ) \n # If found, then handle data from here.\n unless theStudent == nil then\n @newAssignmentStudent = AssignmentsStudents.new({ :assignment_id => self.id,\n :student_id => theStudent.id, :scansheet_id => sheet.id,\n :grade => grade,:results => strResults, :answer_key => self.answer_key })\n theStudent.grade = theStudent.compileGrade\n theStudent.save\n else \n course = Course.find(self.course_id)\n teacher = Teacher.find(course.teacher_id)\n nameIssue = Issue.new( :code => 2, :resolved => false,\n :scansheet_id => sheet.id, :teacher_id => teacher.id,\n :name => \"Name Not Found\" )\n nameIssue.save \n nameArr = name.split(\",\")\n @newStudent = Student.new( :first_name => (\"~\" + nameArr[0]),\n :middle_name => (\"~\" + nameArr[1]), :last_name => (\"~\" + nameArr[2]), :grade => grade,\n :course_id => self.course_id )\n @newStudent.save\n @newAssignmentStudent = AssignmentsStudents.new({ :assignment_id => self.id,\n :student_id => @newStudent.id, :scansheet_id => sheet.id, :grade => grade,\n :results => strResults, :answer_key => self.answer_key} )\n end\n @newAssignmentStudent.save\n end",
"def index\n if @course.groups.size.zero? && @course.students.size.positive? && @course.projects.size.positive?\n group_service = GroupCreationManager::GroupMatcher.new\n group_service.determine_algo_and_match(@course, params)\n @course.update(has_group: true)\n end\n if @course.has_group && @course.state != \"view_groups\"\n @course.update(state: \"view_groups\")\n end\n @groups = @course.groups\n @group ||= @course.groups.first\n if current_user.type == 'Professor'\n current_user.current_course_id = @course.id\n current_user.save\n end\n respond_to do |format|\n format.html\n format.csv {send_data @groups.to_csv, filename: \"groups-#{Date.today}.csv\"}\n end\n end",
"def grouped\n # temporary feature flag in case we need a prod 'kill' switch for this feature\n raise ApiErrors::FeatureDisabled unless Panoptes.flipper[:subject_group_selection].enabled?\n\n skip_policy_scope\n\n # setup the selector params from user input, note validation occurs in the operation class\n selector_param_keys = %i[workflow_id subject_set_id num_rows num_columns]\n selector_params = params.permit(*selector_param_keys)\n\n # Sanity check -- use a testing feature flag\n # against an allow listed workflow id env var\n allowed_workflow_ids = ENV.fetch('SUBJECT_GROUP_WORKFLOW_ID_ALLOWLIST').split(',')\n raise ApiErrors::FeatureDisabled unless allowed_workflow_ids.include?(selector_params[:workflow_id])\n\n group_selection_result = SubjectGroups::Selection.run!(\n num_rows: selector_params.delete(:num_rows),\n num_columns: selector_params.delete(:num_columns),\n uploader_id: ENV.fetch('SUBJECT_GROUP_UPLOADER_ID'),\n params: selector_params,\n user: api_user\n )\n # get the list of the groups 'placeholder' group_subject ids\n group_subject_ids = group_selection_result.subject_groups.map(&:group_subject_id)\n\n selected_subject_scope =\n Subject\n .where(id: group_subject_ids)\n .order(\"idx(array[#{group_subject_ids.join(',')}], id)\") # guardrails-disable-line\n\n selection_context = Subjects::SelectorContext.new(\n group_selection_result.subject_selector,\n group_subject_ids\n ).format\n\n # serialize the subject_group's group_subject data\n render json_api: SubjectSelectorSerializer.page(\n group_selection_result.subject_selector.params,\n selected_subject_scope,\n selection_context\n )\n end",
"def get_existing_results subgroup_id\n retVal = Array.new()\n # gather the outcome data entries for this outcome/subgroup pair\n results = OutcomeDataEntry.where(:outcome_id=>self.id, :subgroup_id=>subgroup_id).order(\"display_number ASC\")\n unless results.empty?\n results.each do |res|\n result_entry = Array.new()\n result_entry << res # store the result entry itself\n\n # obtain the measures associated with the data entry\n measures = res.outcome_measures\n unless measures.empty?\n result_entry << measures\n # obtain the data points associated with the measure\n dp_hash = Hash.new # a hash to store data points per measure\n measures.each do |m|\n dp_hash[m.id] = Hash.new\n datapoints = OutcomeDataPoint.where(:outcome_measure_id=>m.id)\n unless datapoints.empty?\n datapoints.each do |dp|\n dp_hash[m.id][dp.arm_id] = dp\n end\n end\n end\n result_entry << dp_hash\n else\n result_entry << [] # empty measures\n result_entry << {} # empty data points\n end\n retVal << result_entry\n end\n end\n return retVal\n end",
"def to_result\n [@index.result_identifier, self.score, self.count, @combinations.to_result, self.ids] if self.count && self.count > 0\n end",
"def generate_groups(groups, type)\r\n [].tap do |results|\r\n groups.each do |n, obj|\r\n group = {}\r\n group[\"name\"] = obj['name']\r\n group[\"code\"] = n\r\n group[\"risk_category\"] = \"AUTO\"\r\n group[type] = obj[type]\r\n results << group\r\n end\r\n end\r\nend",
"def for_subjects(subjects)\n result = Hash[subjects.map {|node| [node, false]}]\n subjects_by_id = Hash[subjects.map {|subject| [subject.id, subject]}]\n subject_rlshp_sources = Hash.new { |h, k| h[k] = [] }\n [:subject, :subject_agent_subrecord, :subject_agent_subrecord_place].each do |t|\n Subject.relationship_dependencies[t].each { |d| subject_rlshp_sources[d] << t }\n end\n\n subject_rlshp_sources.each do |model, sources|\n sources.each do |source|\n # i.e. one or more: subject_rlshp, subject_agent_subrecord_rlshp, subject_agent_subrecord_place_rlshp\n link_relationship = model.find_relationship(source)\n link_table = link_relationship.table_name\n\n link_relationship.reference_columns_for(model).each do |model_link_column|\n link_relationship.reference_columns_for(Subject).each do |subject_link_column|\n # Join subject_rlshp to (e.g.) accession\n linked_records = model\n .join(link_table,\n Sequel.qualify(link_table, model_link_column) => Sequel.qualify(model.table_name, :id))\n .filter(Sequel.qualify(link_table, subject_link_column) => subjects_by_id.keys)\n .select(Sequel.qualify(model.table_name, :id),\n Sequel.qualify(model.table_name, :publish),\n Sequel.qualify(model.table_name, :suppressed),\n Sequel.as(Sequel.qualify(link_table, subject_link_column),\n :subject_id))\n\n if model.columns.include?(:repo_id)\n linked_records = linked_records\n .select_append(Sequel.as(Sequel.qualify(model.table_name, :repo_id),\n :repository_id))\n end\n\n published_status = if model.included_modules.include?(TreeNodes)\n for_tree_nodes(linked_records\n .select_append(Sequel.qualify(model.table_name, :parent_id),\n Sequel.qualify(model.table_name, :root_record_id))\n .all)\n elsif model.to_s =~ /^Agent/\n for_agents_linked_to_subject(linked_records.all)\n else\n for_top_level_records(linked_records.all)\n end\n\n published_status.each do |linked_record, published|\n if published\n result[subjects_by_id.fetch(linked_record[:subject_id])] = true\n end\n end\n end\n end\n end\n end\n\n result\n end",
"def build_test_case_records(question, auto_grading, evaluation_results)\n build_test_case_records_from_test_results(question, auto_grading, evaluation_results)\n\n # Build failed test case records for test cases which were not found in any evaluation result.\n build_failed_test_case_records(question, auto_grading)\n end",
"def get_expected_result_by_id(project_id, test_case_id)\n test_case = self.retrieve_from_spira_by_id(project_id, test_case_id)\n steps = test_case['tcSteps']\n expected = []\n expected_hash = {}\n steps.each{|le_step|\n # expected.push JSON.parse(le_step['tsExpectedResult'])\n le_step['tsExpectedResult'].split('</div>').each { |item| expected.push(item.gsub( %r{</?[^>]+?>}, '' )) }\n }\n expected.each { |item| items = item.split(':'); expected_hash.merge!({items[0] => items[1] })}\n { :expected_results => expected_hash, :test_case_name => test_case['tcName'], :test_case_description => test_case['tcDescription'] }\n end",
"def create\n @assessment = nil?\n unless params[:test].nil?\n test = params[:test].to_i\n if Test.find(test)\n @assessment = @group.assessments.build(:test_id => test)\n @assessment.save\n end\n end\n @assessments = Assessment.all\n render :index\n end",
"def exam_def\n #este no debería de ir aquí pero marca error al intentarlo hacer en otro controlador\n #parece que una vez que hago un get en este controlador, ya no puedo cambiarlo.\n #por lo tanto los queries los voy a hacer aquí\n hash = params[:hash]\n exam_name = params[:exam_name]\n number_of_attempts = params[:number_of_attempts]\n creationYear = params[:creationYear].to_i\n creationMonth = params[:creationMonth].to_i\n creationDay = params[:creationDay].to_i\n creationHour = params[:creationHour].to_i\n creationMinute = params[:creationMinute].to_i\n startYear = params[:startYear].to_i\n startMonth = params[:startMonth].to_i\n startDay = params[:startDay].to_i\n startHour = params[:startHour].to_i\n startMinute = params[:startMinute].to_i\n endYear = params[:endYear].to_i\n endMonth = params[:endMonth].to_i\n endDay = params[:endDay].to_i\n endHour = params[:endHour].to_i\n endMinute = params[:endMinute].to_i\n\n timeZone = \"Monterrey\"\n\n user = User.find_by_id session[:user_id]\n master_exam = MasterExam.create(\n attempts: number_of_attempts,\n name: exam_name,\n dateCreation: Time.strptime(\"#{creationYear}-#{creationMonth}-#{creationDay} #{creationHour}:#{creationMinute}\", '%Y-%m-%d %H:%M').in_time_zone(timeZone),\n startDate: Time.strptime(\"#{startYear}-#{startMonth}-#{startDay} #{startHour}:#{startMinute}\", '%Y-%m-%d %H:%M').in_time_zone(timeZone),\n finishDate: Time.strptime(\"#{endYear}-#{endMonth}-#{endDay} #{endHour}:#{endMinute}\", '%Y-%m-%d %H:%M').in_time_zone(timeZone),\n user: user\n )\n \n hash.each_with_index do |(key, value), index|\n ExamDefinition.create( \n master_question: MasterQuestion.find_by_id( hash[key]['master_question_id'].to_i ),\n master_exam: MasterExam.find_by_id(master_exam.id),\n questionNum: index+1, \n weight: hash[key]['value'].to_f\n )\n end\n\n if check_prof\n flash[:notice] = \"Examen agregado exitosamente\"\n else\n flash[:notice] = \"Ejercicio creado exitosamente\"\n end\n\n respond_to do |format|\n format.json { render json: hash.to_json }\n end\n\n\tend",
"def show\n submission = Submission.get_submission_by_grouping_id_and_assignment_id(\n params[:group_id], params[:assignment_id])\n\n test_result = submission.test_group_results\n .includes(:test_results)\n .find(params[:test_group_result_id])\n .test_results.find(params[:id])\n\n respond_to do |format|\n format.xml{render xml: test_result.to_xml(root:\n 'test_result', skip_types: 'true')}\n format.json{render json: test_result.to_json}\n end\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission or test script result or test result\n render 'shared/http_status', locals: {code: '404', message:\n e}, status: 404\n end",
"def exam_scores(exam)\n ExamScore.where(exam_id: exam, student_id: id).take\n end",
"def set_exam_result\n @exam_result = ExamResult.find(params[:id])\n end",
"def get_authorization_divisionspermitted_paged_subject_id_with_http_info(subject_id, permission, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuthorizationApi.get_authorization_divisionspermitted_paged_subject_id ...\"\n end\n \n \n # verify the required parameter 'subject_id' is set\n fail ArgumentError, \"Missing the required parameter 'subject_id' when calling AuthorizationApi.get_authorization_divisionspermitted_paged_subject_id\" if subject_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'permission' is set\n fail ArgumentError, \"Missing the required parameter 'permission' when calling AuthorizationApi.get_authorization_divisionspermitted_paged_subject_id\" if permission.nil?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/authorization/divisionspermitted/paged/{subjectId}\".sub('{format}','json').sub('{' + 'subjectId' + '}', subject_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'permission'] = permission\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\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 \n auth_names = ['PureCloud OAuth']\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 => 'DivsPermittedEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthorizationApi#get_authorization_divisionspermitted_paged_subject_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def db_query_with_quiz_score(assignment_id, another_assignment_id = 0)\n\t\traw_data_array = Array.new\n\t\tassignment_ids = Array.new\n\t\tassignment_ids << assignment_id\n\t\tassignment_ids << another_assignment_id unless another_assignment_id == 0\n\t\tteams = AssignmentTeam.where(['parent_id in (?)', assignment_ids])\n\t\tteam_ids = Array.new\n\t\tteams.each{|team| team_ids << team.id }\n\t\tquiz_questionnnaires = QuizQuestionnaire.where(['instructor_id in (?)', team_ids])\n\t\tquiz_questionnnaire_ids = Array.new\n\t\tquiz_questionnnaires.each{|questionnaire| quiz_questionnnaire_ids << questionnaire.id }\n\t\tQuizResponseMap.where(['reviewed_object_id in (?)', quiz_questionnnaire_ids]).each do |response_map|\n\t\t\tquiz_score = response_map.quiz_score\n\t\t\tparticipant = Participant.find(response_map.reviewer_id)\n\t\t\traw_data_array << [participant.user_id, response_map.reviewee_id, quiz_score]\n\t\tend\n\t\traw_data_array\n\tend",
"def getResultPhpSmr(ask,type,number,questionChild)\r\n name=\"#{type}_#{number}\"\r\n erbTemplate = getTemplate(\"../encuestas/templates/result_php_smr.template\",binding)\r\n return erbTemplate.to_s\r\n end",
"def select_exam\n end",
"def get_groups\n\t\tif current_student.id.to_i == params[:id].to_i\n\t\t\t@student = Student.find(params[:id])\n\t\tend\n\t\trender 'get_groups'\n\tend",
"def db_query(assignment_id, another_assignment_id = 0, round_num, hasTopic)\n=begin\n\t query=\"SELECT U.id, RM.reviewee_id as submission_id, \"+\n\t\t \"sum(A.answer * Q.weight) / sum(QN.max_question_score * Q.weight) * 100 as total_score \"+\n\t\t\t# new way to calculate the grades of coding artifacts\n\t\t\t#\"100 - SUM((QN.max_question_score-A.answer) * Q.weight) AS total_score \"+\n\t\t\t\"from answers A \"+\n\t\t\t\"inner join questions Q on A.question_id = Q.id \"+\n\t\t\t\"inner join questionnaires QN on Q.questionnaire_id = QN.id \"+\n\t\t\t\"inner join responses R on A.response_id = R.id \"+\n\t\t\t\"inner join response_maps RM on R.map_id = RM.id \"+\n\t\t\t\"inner join participants P on P.id = RM.reviewer_id \"+\n\t\t\t\"inner join users U on U.id = P.user_id \"+\n\t\t\t\"inner join teams T on T.id = RM.reviewee_id \"\n\t\t\tquery += \"inner join signed_up_teams SU_team on SU_team.team_id = T.id \" if hasTopic == true\n\t\t\tquery += \"where RM.type='ReviewResponseMap' \"+\n\t\t\t\"and RM.reviewed_object_id = \"+ assignment_id.to_s + \" \" +\n\t\t\t\"and A.answer is not null \"+\n\t\t\t\"and Q.type ='Criterion' \"+\n\t\t\t#If one assignment is varying rubric by round (724, 733, 736) or 2-round peer review with (735), \n\t\t\t#the round field in response records corresponding to ReviewResponseMap will be 1 or 2, will not be null.\n\t\t\t\"and R.round = 2 \" \n\t\t\tquery+=\"and SU_team.is_waitlisted = 0 \" if hasTopic == true\n\t\t\tquery+=\"group by RM.id \"+\n\t\t\t\"order by RM.reviewee_id\"\n\n result = ActiveRecord::Base.connection.select_all(query)\n=end\n\t\traw_data_array = Array.new\n\t\tassignment_ids = Array.new\n\t\tassignment_ids << assignment_id\n\t\tassignment_ids << another_assignment_id unless another_assignment_id == 0\n\t\tReviewResponseMap.where(['reviewed_object_id in (?)', assignment_ids]).each do |response_map|\n\t\t\treviewer = response_map.reviewer.user\n\t\t\tteam = AssignmentTeam.find(response_map.reviewee_id)\n\t\t\ttopic_condition = ((hasTopic and SignedUpTeam.where(team_id: team.id).first.is_waitlisted == false) or !hasTopic)\n\t\t\tlast_valid_response = response_map.response.select{|r| r.round == round_num}.sort.last\n\t\t\tvalid_response = [last_valid_response] unless last_valid_response.nil?\n\t\t\tif topic_condition == true and !valid_response.nil? and !valid_response.empty?\n\t\t\t\tvalid_response.each do |response|\n\t\t\t\t\tanswers = Answer.where(response_id: response.id)\n\t\t\t\t\tmax_question_score = answers.first.question.questionnaire.max_question_score\n\t\t\t\t\ttemp_sum = 0\n\t\t\t\t\tweight_sum = 0\n\t\t\t\t\tvalid_answer = answers.select{|a| a.question.type == 'Criterion' and !a.answer.nil?}\n\t\t\t\t\tunless valid_answer.empty?\n\t\t\t\t\t\tvalid_answer.each do |answer|\n\t\t\t\t\t\t\ttemp_sum += answer.answer * answer.question.weight\n\t\t\t\t\t\t\tweight_sum += answer.question.weight\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tpeer_review_grade = 100.0 * temp_sum / (weight_sum * max_question_score)\n\t\t\t\t\t\traw_data_array << [reviewer.id, team.id, peer_review_grade.round(4)]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\traw_data_array\n\tend",
"def getmmr_s (questionChild,type,number,ask,listRows,hashNames)\r\n hashColumnas = getListOptionSelect(questionChild)\r\n tamRow = listRows.length\r\n tamColumn = hashColumnas.keys.length\r\n for i in 1..tamRow\r\n for j in 1..tamColumn\r\n name=\"#{type}_#{number}_#{i}_#{j}\"\r\n getContainsKey(hashNames,type,name)\r\n end\r\n end\r\n erbTemplate = getTemplate(\"../encuestas/templates/mmr_s.template\",binding)\r\n return erbTemplate.to_s\r\n end",
"def subjectify(options = {})\n result = []\n all_subjects = []\n sub_array = []\n options[:value].each_with_index do |subject, i|\n spl_sub = subject.split(QUERYSEP)\n sub_array << []\n subject_accum = ''\n spl_sub.each_with_index do |subsubject, j|\n spl_sub[j] = subject_accum + subsubject\n subject_accum = spl_sub[j] + QUERYSEP\n sub_array[i] << spl_sub[j]\n end\n all_subjects[i] = subject.split(QUERYSEP)\n end\n options[:value].each_with_index do |_subject, i|\n lnk = ''\n lnk_accum = ''\n all_subjects[i].each_with_index do |subsubject, j|\n lnk = lnk_accum + link_to(subsubject,\n \"/?f[subject_facet][]=#{CGI.escape sub_array[i][j]}\",\n class: 'search-subject', title: \"Search: #{sub_array[i][j]}\")\n lnk_accum = lnk + content_tag(:span, SEPARATOR, class: 'subject-level')\n end\n result << sanitize(lnk)\n end\n result\n end",
"def exec\n question = Question.find(self.question_id)\n tmp = Time.now.to_i\n\n\t\t# Compila a resposta\n compile_result = Judge::compile(self.lang,self.response,tmp)\n\n\t\t# Verifica se houve erro de compilacao\n if compile_result[0] != 0\n self.compile_errors = compile_result[1]\n self.correct = false\n else\n\n\t\t\t# Se compilou, executa os casos de teste.\n correct = Judge::test(lang,compile_result[1],question.test_cases,tmp)\n\n self.results = Hash.new\n self.correct = true\n\t\t\t# para cada caso de teste salva os dados retornados\n\t\t\t# os dados retornados estarao na variavel 'r'\n\t\t\t# cada caso de teste tem seus dados armazenados no hash 'results'\n correct.each do |id,r|\n\n self.results[id] = Hash.new\n self.results[id][:error] = false\n self.results[id][:diff_error] = false\n self.results[id][:time_error] = false\n self.results[id][:exec_error] = false\n self.results[id][:presentation_error] = false\n self.results[id][:content] = question.test_cases.find(id).content\n\n self.results[id][:title] = question.test_cases.find(id).title\n self.results[id][:show_input_output] = question.test_cases.find(id).show_input_output\n\n if question.test_cases.find(id).show_input_output\n self.results[id][:input] = r[1][0]\n self.results[id][:output_expected] = r[1][1]\n end\n\n self.results[id][:output] = r[1][2]\n self.results[id][:id] = id\n\n\t\t\t\t# cada erro possui um numero de identificacao\n if r[0] == 3\n self.correct = false\n self.results[id][:error] = true\n self.results[id][:diff_error] = true\n elsif r[0] == 2\n self.correct = false\n self.results[id][:error] = true\n self.results[id][:presentation_error] = true\n elsif r[0] == 143 || r[0] == 141\n self.correct = false\n self.results[id][:error] = true\n self.results[id][:time_error] = true\n elsif r[0] != 0\n self.correct = false\n self.results[id][:error] = true\n self.results[id][:exec_error] = true\n end\n\n\t\t\t\t# se o numero de tentativas for suficiente para mostrar dicas, salva a dica na resposta do caso de teste.\n if Answer.where(user_id: self.user_id, question_id: self.question_id, correct: false, compile_errors: nil).count >= question.test_cases.find(id).tip_limit-1 || self.correct\n self.results[id][:tip] = question.test_cases.find(id).tip\n end\n\n #self.results[id][:output2] = simple_format r[1][0]\n end\n end\n true\n end",
"def result_by_method(method)\n strings = @groups.map {|repeater| repeater.public_send(method)}\n RegexpExamples.permutations_of_strings(strings).map do |result|\n GroupResult.new(result, group_id)\n end\n end",
"def extract(answer_groups)\n @question_group.questions.collect do |question|\n results =\n case question\n when Rapidfire::Questions::Select, Rapidfire::Questions::Radio,\n Rapidfire::Questions::Checkbox\n answer_groups_answers = get_answer_groups_answers(answer_groups, question)\n all_answers = []\n answer_groups_answers.each do |text|\n if text.is_a?(FalseClass) || text.is_a?(TrueClass)\n all_answers << text\n else\n all_answers << text.split(',') unless text.nil?\n end\n end\n answers = all_answers.flatten\n\n answers.inject(Hash.new(0)) { |total, e| total[e] += 1; total } unless answers.nil?\n\n when Rapidfire::Questions::Short, Rapidfire::Questions::Date,\n Rapidfire::Questions::Long, Rapidfire::Questions::Numeric\n get_answer_groups_answers(answer_groups, question)\n end\n\n QuestionResult.new(question: question, results: results)\n end\n end",
"def test\n @chunks = Chunk.where(subject_id: params[:subject_id])\n @subject_id = params[:subject_id]\n js 'Subjects'\n end",
"def publish_exam\n @date = Date.today\n @exam_group = ExamGroup.shod(params[:format])\n @exam_group.update(is_published: true)\n @exam_group.exams.each(&:create_exam_event)\n @batch = @exam_group.batch\n @exam_groups ||= @batch.exam_groups.all\n end",
"def questions\n results = CONNECTION.execute(\"SELECT * FROM questions WHERE student_id = #{@id};\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << Question.new(result_hash[\"id\"], result_hash[\"student_id\"], result_hash[\"content\"])\n end\n \n return results_as_objects\n end",
"def generate_subjectid\n\t\tsubjectids = ( (1..999999).to_a - StudySubject.select('subjectid'\n\t\t\t).collect(&:subjectid).collect(&:to_i) )\n\t\tsprintf(\"%06d\",subjectids[rand(subjectids.length)].to_i)\n\tend",
"def publish_result\n @exam_group = ExamGroup.shod(params[:format])\n if @exam_group.is_published?\n flag = @exam_group.publish(@exam_group)\n publish_res(flag)\n else\n flash[:alert] = 'Exam scheduled not published'\n end\n redirect_to exams_exam_group_path(@exam_group)\n end",
"def demographics\n # Users who have had the maximum 3 attempts of the quiz OR Passed\n membership_ids = UserMembership.all.map { |membership|\n if membership.didUserPassCourse? || \n membership.course_attempts == 3\n membership.id\n end\n }.compact.uniq\n\n memberships_temp = UserMembership.find(membership_ids)\n course_ids = memberships_temp.map { |m| m.course.id }.compact.uniq\n\n @courses = Course.where(id: course_ids)\n @memberships = UserMembership.where(id: membership_ids)\n\n respond_to do |format|\n format.html\n format.csv { render text: generate_demographics_csv(@courses, @memberships) }\n end\n end",
"def resultcreate\n\t\t\ts = Student.last\n\t\t\tsn = s.roll_no\n\t\t\tsid = s.id\n\t\t\tr= Result.create(:student_roll=>sn,:student_id=>sid)\n\t\t\tr.save\n\t\tend",
"def create\n # receive datas\n word_id = params[:word_id]\n answer = params[:answer]\n @exam = Exam.find(params[:exam_id])\n\n #create a result_paper\n @rpaper = ResultPaper.new(:exam_id => @exam.id, :paper_id => @exam.paper_id, :user_id => current_user.id)\n @rpaper.save\n\n # index is for array index\n # each student only can answer once,never more(if only recreate the task)\n index = 0\n word_id.each do |f|\n is_right = 2\n Word.find(word_id[index]).meanings.each do |f|\n if f.content.to_s.strip == answer[index].to_s.strip\n is_right = 1\n break\n elsif f.content.to_s.strip.empty?\n is_right = 0\n end\n end\n\n @answer = ResultWord.new(:is_right => is_right,:word_id => word_id[index], :answer => answer[index],:result_paper_id => @rpaper.id)\n @answer.save\n \n index = index + 1\n end\n #generate the score\n all = ResultWord.where(:result_paper_id => @rpaper.id).count*1.00\n score = ResultWord.where(:is_right => 1,:result_paper_id => @rpaper.id).count\n\n @result_paper = ResultPaper.find(@rpaper.id)\n @result_paper.update_attributes(:score => score, :rate => (score/all)*100)\n @exam.update_attributes(:status => 2)\n\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'submit successfully created.' }\n end\n \n end",
"def set_exam_subject\n @exam_subject = ExamSubject.find(params[:id])\n end",
"def index\n # @test_suites = TestSuite.all\n\n @date = parse_date\n @group = parse_group\n @testing = parse_testing\n \n if @date && @group && @testing\n @test_suites = TestSuite.all\n @test_suites = @test_suites.where('started_at >= ? and started_at < ?', @date, @date + 1.day)\n @test_suites = @test_suites.joins(:student).where(students: { group_id: @group.id })\n @test_suites = @test_suites.where(testing: @testing)\n @test_suites = @test_suites.order('students.surname, students.name, students.patronymic ')\n end\n\n respond_to do |format|\n format.html\n format.pdf do\n render pdf: 'index'\n end\n end\n end",
"def get_patient_result(patient_id)\n qm = QualityMeasure.new(@measure_id, @sub_id)\n measure = Builder.new(get_db, qm.definition, @parameter_values)\n records = get_db.collection('records')\n result = records.map_reduce(measure.map_function, \"function(key, values){return values;}\",\n :out => {:inline => true}, \n :raw => true, \n :finalize => measure.finalize_function,\n :query => {:medical_record_number => patient_id, :test_id => @parameter_values['test_id']})\n raise result['err'] if result['ok']!=1\n result['results'][0]['value']\n end",
"def set_xmt_test_rand_exam\n @rand_exam = Xmt::Test::RandExam.find(params[:id])\n end",
"def test_results(id)\n return [] unless @rule_results\n\n @rule_results.select { |r| r.idref == id }\n end",
"def result\n if params.dig(:assessment, :type).present? && params.dig(:assessment, :type_id).present?\n type = params[:assessment][:type].camelize.constantize.where(id: params[:assessment][:type_id]).first rescue ''\n if type.present?\n all_questions = fetch_all_questions(type)\n total_qusts_count = all_questions.count \n if total_qusts_count > 0\n assessment_questions = Assessment.fetch_assessment_questions(all_questions.ids, current_user.id)\n result = {\n correct_answers: ((assessment_questions.where(is_correct: 'Y').count*100)/total_qusts_count),\n wrong_answers: ((assessment_questions.where(is_correct: 'N').count*100)/total_qusts_count),\n skipped_questions: ((assessment_questions.where(is_skipped: 'Y').count*100)/total_qusts_count) , \n unseen_questions: ((total_qusts_count-assessment_questions.count)*100)/total_qusts_count\n }\n render json: result\n else\n render json: {'type': 'No data found for selected type'}\n end\n else\n render json: {'type': 'Invalid selection of type or type id'}\n end\n else\n render json: {'Input': 'Invalid inputs'}\n end\n end",
"def create_assessment\n @unique_questions = []\n\n questions = QuizQuestion.for_language_course(self, [\"multiple_choice\", \"short_answer\"])\n questions_grouped_by_lesson = questions.group_by(&:lesson_id).values.shuffle\n\n setup_multiple_choice_questions(questions_grouped_by_lesson)\n setup_short_answer_questions(questions_grouped_by_lesson)\n\n @unique_questions\n end",
"def group_data_from_results(res, groupname, key)\n groups = res['groups']\n groups.each do |group|\n return group[key] if group['group_name'] == groupname\n end\n nil\n end",
"def answer_exam\n if params[:year_exam] \n questions ||= Question.where(year: params[:year_exam])\n assert(questions.kind_of?(Question))\n else\n questions ||= Question.all\n assert(questions.kind_of?(Question))\n end\n\n if !questions.empty?\n auxiliar_exam ||= push_questions_auxiliar(questions)\n @exam = push_questions(auxiliar_exam)\n else\n redirect_to_back(select_exam_path)\n if params[:year_exam]\n flash[:danger] = t(:year_exam_not_found)\n else\n flash[:danger] = t(:exam_not_found)\n end\n end\n end",
"def survey_answers_groups(survey_answers)\n result = survey_answers.inject(Dictionary.new) do |hash, sa|\n hash[sa.survey_id] = sa.to_csv\n hash\n end\n result.order_by\n end",
"def make_acct_groups\n\tputs \"Type in the number of students you have: \"\n\tnumber_students = gets.chomp.to_i\n\n\t# Construct the array with the numbers 1 ... number_stdnts\n\tstudent_id = Array.new(number_students) {|i| i+1 }\n\t#print student_id\n\n\tshuffle_id = student_id.shuffle.to_a\n\t#print shuffle_id\nmod4 = number_students % 4\n\n\tif (number_students == 6)\n\t\tnumber_groups = 2\n\telsif (mod4 ==3)\n\t\tnumber_groups = (number_students / 4) + 1\n\telse\n\t\tnumber_groups = (number_students / 4)\n\tend\n\n\tacct_groups = {} \t\n\tif (number_students == 6)\n\t\tfor i in 1..2\n\t\t\tif (i == 1)\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[0], shuffle_id[1], shuffle_id[2]]\n\t\t\telse\t\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[3], shuffle_id[4], shuffle_id[5]]\n\t\t\tend\n\t\tend\n\telsif (mod4 == 3)\n\t\tfor i in 1..number_groups\n\t\t\tif i <= number_groups -1\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1]]\n\t\t\telse\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2]]\n\t\t\tend\n\t\tend\n\telsif (mod4 == 2)\n\t\tfor i in 1..number_groups\n\t\t\tif i <= (number_groups-2)\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1]]\n\t\t\telsif (i == (number_groups -1))\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1], shuffle_id[4*i]]\n\t\t\telse\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1], shuffle_id[4*i], shuffle_id[4*i+1]]\n\t\t\tend\n\t\tend\n\telsif (mod4 == 1)\n\t\tfor i in 1..number_groups\n\t\t\tif i <= (number_groups-1)\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1]]\n\t\t\telse\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1], shuffle_id[4*i]]\n\t\t\tend\n\t\tend\n\telsif (mod4 == 0)\n\t\tfor i in 1..number_groups\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1]]\n\t\tend\n\tend\n\treturn acct_groups\nend",
"def exam_result\n if params[:exam_id]\n @exam = Exam.find(params[:exam_id])\n assert(exam.kind_of?(Exam))\n @exam = fill_user_answers(@exam)\n\n current_user.exams_total_questions += @exam.questions.count\n current_user.update_attribute(:exam_performance, current_user.exam_performance + [@exam.accepted_answers])\n\n @exam.save\n return @exam.user_answers\n else\n return redirect_to_back\n flash[:danger] = t(:exam_message)\n end\n end",
"def all_other_subject\n @user = User.find(params[:data])\n\n\n @all_other_subjects = @user.other_subject_assesses.order(\"id\")\n @title_groups_other_subjects = TitleGroupsOtherSubject.order(\"id\")\n\n render :layout => false\n end",
"def index\n @assignments = Assignment.all(order: :id)\n if current_user.student?\n # get results for assignments for the current user\n @a_id_results = Hash.new()\n @assignments.each do |a|\n if current_user.has_accepted_grouping_for?(a)\n grouping = current_user.accepted_grouping_for(a)\n if grouping.has_submission?\n submission = grouping.get_submission_used\n if submission.has_result? && submission.get_latest_result.released_to_students\n @a_id_results[a.id] = submission.get_latest_result\n end\n end\n end\n end\n render :student_assignment_list\n elsif current_user.ta?\n render :grader_index\n else\n render :index\n end\n end",
"def create\n submission = Submission.get_submission_by_grouping_id_and_assignment_id(\n params[:group_id], params[:assignment_id])\n\n test_group_result = submission.test_group_results\n .includes(:test_results)\n .find(params[:test_group_result_id])\n\n if test_group_result.test_results.create(test_result_params)\n render 'shared/http_status', locals: {code: '201', message:\n HttpStatusHelper::ERROR_CODE['message']['201']}, status: 201\n else\n # Some other error occurred\n render 'shared/http_status', locals: { code: '500', message:\n HttpStatusHelper::ERROR_CODE['message']['500'] }, status: 500\n end\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission or test script result\n render 'shared/http_status', locals: {code: '404', message:\n e}, status: 404\n end",
"def mcas_math\n student.latest_result_by_family_and_subject(\"MCAS\", \"Mathematics\") || MissingStudentAssessment.new\n end",
"def resultats(id_sondage)\n\n # récupérer le nombre de questions pour un sondage\n nbrQuestions = nombreQuestions(id_sondage)\n\n # récupérer le nombre de participations dans un sondage\n nbrUtilisateur = nombreUtilisateurs(id_sondage) \n \n # Moyennes des questions à point\n arrayMoy = QuestionPointService.instance.questionsPointsMoyennes(id_sondage)\n\n # Nombre de réponse pour chaque choix d'une question à choix unique\n questionsChoixUnique = QuestionChoixService.instance.questionsChoixUnique(id_sondage) # en vérifiant l'atribut estUnique= true\n\n # Nombre de réponse pour chaque choix d'une question à choix multiple\n questionsChoixMultiple = QuestionChoixService.instance.questionsChoixMultiple(id_sondage) \n\n hash = []\n\n res = {\n id_sondage: id_sondage.to_i,\n nombre_de_questions: nbrQuestions,\n nombre_de_participations: nbrUtilisateur,\n moyennes_generales_des_questions_a_points: arrayMoy,\n nombre_de_participations_sur_chaque_choix_des_questions_a_choix_unique: questionsChoixUnique,\n nombre_de_participations_sur_chaque_choix_des_questions_a_choix_multiple: questionsChoixMultiple\n }\n\n hash << res\n \n resultatHash = hash\n\n end",
"def build_test_case_records_from_report(question, auto_grading, test_report)\n test_cases = question.test_cases.to_h { |test_case| [test_case.identifier, test_case] }\n test_results = parse_test_report(question.language, test_report)\n\n test_results.map do |test_result|\n test_case = find_test_case(test_cases, test_result)\n auto_grading.test_results.build(auto_grading: auto_grading, test_case: test_case,\n passed: test_result.passed?,\n messages: test_result.messages)\n end\n end",
"def get_subjects\n if params[:c].present?\n sc_id = params[:c].to_i\n subjects = Subject.joins(:school_cycle_has_subjects).where(\"school_cycle_id = ?\", sc_id)\n msg = { \"success\": \"true\", \"subjects\": subjects }\n else\n msg = { \"success\": false, \"subjects\": 0 }\n end\n\n render json: msg\n end",
"def index\n \n if @current_user.is_school? \n redirect_to :action=>'show_by_school',:school_id=>@current_user.school_id\n else\n @qx=params[:qx_id]\n @qx=Qx.find(@current_user.qx_id) if @current_user.is_qx_admin?\n if @qx\n @schools=@qx.schools\n @reports=@exam.reports.where(school_id: @schools).group_by{|report|report.school_id}\n else\n @schools=School.all\n @reports=@exam.reports.group_by{|report|report.school_id}\n end\n end\n\n end",
"def show\n @exam_result = Xmt::Test::ExamResult.find(params[:id])\n @total_marks = @exam_result.question_scores.sum(:marks)\n end",
"def show\n @student = Student.find(params[:id])\n\n @maths = \"\"\n @english = \"\"\n @results = @student.nfers.order(\"date_taken ASC\")\n @maths_results = []\n @english_results = []\n\n \n if @student.nfers?\n \t@results.each do |r|\n \t\tif r.subject == \"Maths\"\n \t\t\t@maths_results << r\n \t\t\t@maths << \"[\"\n \t\t\tdate_string = r.date_taken.strftime(\"%Y-%m-%d\")\n\t\t\t\t@maths << (Time.parse(date_string.to_s).utc.to_i*1000).to_s\n\t\t\t\t@maths << \",\"\n\t\t\t\t@maths << r.ss.to_s\n\t\t\t\t@maths << \"], \"\n \t\tend\n \t\tif r.subject == \"English\"\n \t\t\t@english_results << r\n \t\t\t@english << \"[\"\n \t\t\tdate_string = r.date_taken.strftime(\"%Y-%m-%d\")\n\t\t\t\t@english << (Time.parse(date_string.to_s).utc.to_i*1000).to_s\n\t\t\t\t@english << \",\"\n\t\t\t\t@english << r.ss.to_s\n\t\t\t\t@english << \"], \"\n \t\tend \t\n \tend\t\n end\n\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def initialize(subjects)\n sub_data = [{\"id\"=>1,\"name\"=>\"ABS35H1F\", \"credit_hrs\"=>2}, {\"id\"=>2,\"name\"=>\"ACT20H1F\", \"credit_hrs\"=>3}, {\"id\"=>3,\"name\"=>\"ACT240H1\", \"credit_hrs\"=>6}, {\"id\"=>4,\"name\"=>\"ACT38H1F\", \"credit_hrs\"=>7}, {\"id\"=>5,\"name\"=>\"ACT3491F\", \"credit_hrs\"=>7},\n {\"id\"=>6,\"name\"=>\"ACT4601F\", \"credit_hrs\"=>10}, {\"id\"=>7,\"name\"=>\"ACT60H1F\", \"credit_hrs\"=>4}, {\"id\"=>8,\"name\"=>\"ANA300Y1\", \"credit_hrs\"=>8}, {\"id\"=>9,\"name\"=>\"ANT24H1F\", \"credit_hrs\"=>3}, {\"id\"=>10,\"name\"=>\"ANT3Y1Y\", \"credit_hrs\"=>5}]\n subjects = sub_data\n @subjects = subjects\n end",
"def questions_for_group group\n questions.select{|question|question.meta_attribute_entity_group==group}\n end",
"def handle_subjects(subjects)\n subjects.each do |link|\n subject = link['_resolved']\n term, *terms = subject['terms']\n ind1 = ' '\n code, *ind2 = case term['term_type']\n when 'uniform_title'\n value = term['term'].split(\" \")[0]\n first_indicator = '0'\n if value\n hsh = {}\n hsh['A'] = '2'\n hsh['An'] = '3'\n hsh['The'] = '4'\n articles = []\n articles = hsh.keys\n first_indicator = hsh[value] if articles.include?(value)\n end\n ['630', first_indicator, source_to_code(subject['source'])]\n when 'temporal'\n ['648', source_to_code(subject['source'])]\n when 'topical'\n ['650', source_to_code(subject['source'])]\n when 'geographic', 'cultural_context'\n ['651', source_to_code(subject['source'])]\n when 'genre_form', 'style_period'\n ['655', source_to_code(subject['source'])]\n when 'occupation'\n ['656', '7']\n when 'function'\n ['656', '7']\n else\n ['650', source_to_code(subject['source'])]\n end\n\n sfs = [['a', term['term']]]\n\n terms.each do |t|\n tag = case t['term_type']\n when 'uniform_title'; 't'\n when 'genre_form', 'style_period'; 'v'\n when 'topical', 'cultural_context'; 'x'\n when 'temporal'; 'y'\n when 'geographic'; 'z'\n end\n sfs << [tag, t['term']]\n end\n\n # code borrowed from Yale to export subject authority id\n unless subject['authority_id'].nil?\n sfs << ['0', subject['authority_id']]\n end\n\n \n # N.B. ind2 is an array at this point.\n if ind2[0] == '7'\n sfs << ['2', subject['source']]\n end\n\n # adding this code snippet because I'm making ind2 an array\n # for code 630 if the title begins with an article\n if (ind2.is_a?(Array) && code == '630')\n ind1, ind2 = ind2\n else\n ind2 = ind2[0]\n end\n\n df!(code, ind1, ind2).with_sfs(*sfs)\n end\n end",
"def index\n @study_periods = @year.study_periods\n @search = @study_periods.search(params[:q])\n @groups=@search.result(:distinct => true)\n end",
"def getAssessmentResults(sheet, year_row, start_row)\n stats = Hash.new { |h,k| h[k] = Hash.new { |h,k| h[k] = {} } }\n (0..100).step(3) do |sg_offset| # go down the rows\n blank = sheet.row(start_row + sg_offset)[TEST_TYPE_BLANK_COL]\n return start_row + sg_offset, stats if blank.nil? or (blank.is_a? String and blank.empty?)\n subgroup = sheet.row(start_row + sg_offset)[TEST_GROUP_COL]\n (START_SCORE_COL..START_SCORE_COL+8).step(4) do |offset| # and across\n year = sheet.row(year_row)[offset]\n stats[subgroup][year]['Advanced'] = sheet.row(start_row + sg_offset)[offset]\n stats[subgroup][year]['Proficient'] = sheet.row(start_row + sg_offset)[offset+1]\n stats[subgroup][year]['Fail'] = sheet.row(start_row + sg_offset)[offset+3]\n end\n end\n # maybe need a fall-through?\nend",
"def bersepadu\n a='(staffgrade_id=? ' if Employgrade.find(:all, :conditions=>['group_id=?', 4]).map(&:id).uniq.count!=0\n 0.upto(Employgrade.find(:all, :conditions=>['group_id=?', 4]).map(&:id).uniq.count-2) do |l| \n a=a+'OR staffgrade_id=? '\n end\n a=a+')'\n return a if position==1 && position2==0 && position3==0\n \n b='(staffgrade_id=? ' if Employgrade.find(:all, :conditions=>['group_id=?', 2]).map(&:id).uniq.count!=0\n 0.upto(Employgrade.find(:all, :conditions=>['group_id=?', 2]).map(&:id).uniq.count-2) do |l| \n b=b+'OR staffgrade_id=? '\n end\n b=b+')'\n return b if position==0 && position2==1 && position3==0\n \n c='(staffgrade_id=? ' if Employgrade.find(:all, :conditions=>['group_id=?', 1]).map(&:id).uniq.count!=0\n 0.upto(Employgrade.find(:all, :conditions=>['group_id=?', 1]).map(&:id).uniq.count-2) do |l| \n c=c+'OR staffgrade_id=? '\n end\n c=c+')'\n return c if position==0 && position2==0 && position3==1\n end"
] |
[
"0.5998218",
"0.59294164",
"0.5825492",
"0.56342965",
"0.55390203",
"0.54909605",
"0.54435915",
"0.5425885",
"0.53993165",
"0.5381499",
"0.53383166",
"0.53188086",
"0.53066975",
"0.53012055",
"0.52827716",
"0.5275306",
"0.5266171",
"0.5252848",
"0.52089965",
"0.52079445",
"0.5207846",
"0.51874083",
"0.51716125",
"0.5151079",
"0.51489687",
"0.51217175",
"0.51062274",
"0.51062274",
"0.5092087",
"0.5076517",
"0.5070807",
"0.50661045",
"0.5055395",
"0.5055125",
"0.50475466",
"0.50344944",
"0.5033115",
"0.5027942",
"0.5024056",
"0.50167537",
"0.50076896",
"0.5002576",
"0.49926844",
"0.49924117",
"0.49890226",
"0.498767",
"0.49861014",
"0.49727547",
"0.4969597",
"0.49656028",
"0.4963193",
"0.4947959",
"0.4937494",
"0.4934454",
"0.4909845",
"0.49074998",
"0.49027088",
"0.49020776",
"0.48992002",
"0.48991218",
"0.48937652",
"0.4890187",
"0.48800915",
"0.4870469",
"0.48700303",
"0.48695537",
"0.486415",
"0.4861805",
"0.48532438",
"0.48526695",
"0.48523688",
"0.48521614",
"0.48498073",
"0.48437798",
"0.48384747",
"0.4834392",
"0.48232636",
"0.482014",
"0.48181015",
"0.48062795",
"0.48046574",
"0.47899988",
"0.47812408",
"0.47808382",
"0.47804096",
"0.47714975",
"0.47702485",
"0.47655398",
"0.47617772",
"0.4760161",
"0.47584444",
"0.4753502",
"0.47487116",
"0.4743503",
"0.4736748",
"0.47300312",
"0.47285387",
"0.47240785",
"0.47207642",
"0.47204435"
] |
0.6695062
|
0
|
This action generate the result for particular student with his subject.
|
def exam_marks(subject, student)
exam = exam_data(subject)
exam_score = exam.scores(student)
unless exam_score.nil?
if exam.nil?
result = 'NA'
else
exam_score.nil? ? result = '-' : result = type_result(exam, exam_score)
end
result
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def exam_data(subject)\n Exam.result(subject.id, id)\n end",
"def get_subjects\n if params[:s].present?\n s_id = params[:s].to_i\n subjects_by_student = Subject.joins(\"INNER JOIN school_cycle_has_subjects ON subjects.id = school_cycle_has_subjects.subject_id INNER JOIN student_has_subjects ON school_cycle_has_subjects.id = student_has_subjects.school_cycle_has_subject_id\").where(\"student_id = ?\", s_id)\n msg = { \"success\": \"true\", \"subjects\": subjects_by_student }\n else\n msg = { \"success\": false, \"subjects\": 0 }\n end\n\n render json: msg\n end",
"def show\n @student = Student.find(params[:id])\n\n @maths = \"\"\n @english = \"\"\n @results = @student.nfers.order(\"date_taken ASC\")\n @maths_results = []\n @english_results = []\n\n \n if @student.nfers?\n \t@results.each do |r|\n \t\tif r.subject == \"Maths\"\n \t\t\t@maths_results << r\n \t\t\t@maths << \"[\"\n \t\t\tdate_string = r.date_taken.strftime(\"%Y-%m-%d\")\n\t\t\t\t@maths << (Time.parse(date_string.to_s).utc.to_i*1000).to_s\n\t\t\t\t@maths << \",\"\n\t\t\t\t@maths << r.ss.to_s\n\t\t\t\t@maths << \"], \"\n \t\tend\n \t\tif r.subject == \"English\"\n \t\t\t@english_results << r\n \t\t\t@english << \"[\"\n \t\t\tdate_string = r.date_taken.strftime(\"%Y-%m-%d\")\n\t\t\t\t@english << (Time.parse(date_string.to_s).utc.to_i*1000).to_s\n\t\t\t\t@english << \",\"\n\t\t\t\t@english << r.ss.to_s\n\t\t\t\t@english << \"], \"\n \t\tend \t\n \tend\t\n end\n\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def show\n\t\n\t@misses=Array.new\n\t@student.group.subjects.each do |subj|\n\t\ttmp=Array.new\n\t\t@student.misses.each do |miss|\n\t\t\tif Pair.find(miss.pair_id).subject==subj\n\t\t\t\ttmp << miss\n\t\t\tend\n\t\tend\n\t\t@misses << tmp\n\tend\n end",
"def index\n if(params[:subject]==nil)\n @sections = Section.all\n @sections = Section.find_by_sql(\"SELECT * FROM `sections`\njoin subjects\non subjects.id = subject_id\nwhere user_id = \n\" + session[:userid])\n else\n session[:subjectid]=params[:subject]\n \n \n @sections = Section.find(:all, :conditions=>\"subject_id = \"+params[:subject]+\" and user_id = \"+session[:userid])\n @subject = Subject.find(:all,:conditions=>\"id = \"+params[:subject])\n flash[:subjectname]=@subject[0].name \n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sections }\n end\n end",
"def set_student_result\n @student_result = StudentResult.find(params[:id])\n end",
"def exam\n if @errors.nil?\n redirect_to exam_score_exam_path(@exam)\n else\n @students = []\n students ||= @exam.exam_group.batch.students.all\n @students = @exam.select_subject(@students, students, @exam)\n @exam_grade ||= @exam.exam_group.batch.grading_levels.all\n render 'exam_score'\n end\n end",
"def index\n @student_results = StudentResult.all\n end",
"def index\n @student_subjects = StudentSubject.all\n end",
"def by_subject\n @exam = Exam.new\n session[:exam] = @exam\n @subjects = PlanSubject.find_unfinished_for(@user, :subjects => true)\n end",
"def subject_result(subject)\n mutation_results = @aggregate[subject].sort_by(&:index)\n\n Result::Subject.new(\n subject: subject,\n runtime: mutation_results.map(&:runtime).inject(0.0, :+),\n mutation_results: mutation_results\n )\n end",
"def list_subjects\r\n #TODO only list subjects from my own schools \r\n #because then people can still it \r\n school = School.find(params[:nid]) rescue render_return\r\n render_return if !logged_in_user.see_course?(school)\r\n render_p 'course_display/course_selection',{'caller'=>params[:caller],'school'=>school}\r\n end",
"def show\n @courses = @student.courses\n @submissions = @student.submissions.order('time_submitted DESC')\n @problemNames = Hash.new\n @testCaseResults = Hash.new\n \n @submissions.each do |submission|\n problem = Problem.find_by_id(submission.problem_id)\n if not problem.nil?\n @problemNames[submission.problem_id] = problem.title\n end\n \n if submission.total_cases > 0\n @testCaseResults[submission.id] = submission.success_cases.to_s + '/' + submission.total_cases.to_s\n else\n @testCaseResults[submission.id] = 'Compile Error'\n end\n end\n \n @initial_filter_title = \"\"\n if params.include?(:problem) and params[:problem].length > 0\n problem = Problem.find_by_title(params[:problem])\n if problem.nil?\n flash[:warning] = \"No problem was found with title #{params[:problem]}\"\n else\n @submissions = @student.submissions.order('time_submitted DESC').where(:problem_id => problem.id)\n @initial_filter_title = params[:problem]\n end\n end\n end",
"def show\n\t\tcreate_audit __method__, 'subject', @subject.id\n\tend",
"def create\n @test = Test.new(test_params)\n if @test.is_online \n @test.status = \"Not Started\" \n else\n @test.status = \"Ended\" \n end\n respond_to do |format|\n if @test.save \n\n @students = @test.subject_class.students #create student test result and set to zero to be edited by instructor\n \n @students.each do |student|\n result = TestResult.new(test_id: @test.id, student_id: student.id, score: 0, status: TestResult::STATUS_LIST[0], last_time_online: Date.today, time_finished: Date.today, reason: TestResult::REASON_LIST[3])\n if result.save\n puts \"==============================================\"\n puts \"test result created\"\n puts \"==============================================\"\n else\n puts \"==============================================\"\n puts result.errors.full_messages\n puts \"==============================================\"\n \n end\n \n \n end \n\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if current_user.admin?\n redirect_to rails_admin_url\n elsif current_user.reviewer?\n @q = SubjectOfSpeech.search(params[:q])\n @subject_of_speeches = @q.result(distinct: true)\n else\n # 自分で投稿した内容のみ表示する。\n # @subject_of_speeches = SubjectOfSpeech.all\n # @subject_of_speeches = current_user.subject_of_speeches.all\n @q = current_user.subject_of_speeches.search(params[:q])\n # @q = SubjectOfSpeech.search(params[:q])\n @subject_of_speeches = @q.result(distinct: true)\n # binding.pry\n end\n end",
"def subject_results\n env.subjects.map(&method(:subject_result))\n end",
"def display_result\n @company = Company.find(params[:id])\n @placement_exam = PlacementExam.find(params[:p_id])\n @student_score = StudentScore.where(placement_exams_id: @placement_exam)\n end",
"def get_subjects\n if params[:c].present?\n sc_id = params[:c].to_i\n subjects = Subject.joins(:school_cycle_has_subjects).where(\"school_cycle_id = ?\", sc_id)\n msg = { \"success\": \"true\", \"subjects\": subjects }\n else\n msg = { \"success\": false, \"subjects\": 0 }\n end\n\n render json: msg\n end",
"def index\n @subject = Subject.find(params[:subject_id])\n \n end",
"def get_group\n if params[:stu].present? && params[:sub].present?\n student_id = params[:stu].to_i\n subject_id = params[:sub].to_i\n student_subject = StudentHasSubject.joins(:school_cycle_has_subject).where(\"student_id = ? AND subject_id = ?\", student_id, subject_id).first\n if student_subject.present?\n msg = { \"success\": \"true\", \"student_subject\": student_subject.id }\n else\n msg = { \"success\": false, \"student_subject\": nil }\n end\n else\n msg = { \"success\": false, \"student_subject\": nil }\n end\n\n render json: msg\n end",
"def html\n # insufficient parameters\n if !params.has_key?(:utar_id) || !params.has_key?(:utar_password)\n @result = {:message => 'No utar credential specified'}\n render json: @result, :status => 400\n return\n end\n\n # find student from database\n student = Student.find_by(:utar_id => params[:utar_id])\n if(!student)\n @result = {:message => 'Student not found in Database'}\n render json: @result, :status => 404\n return\n end\n\n # check if campus is valid\n if(!Mechanizor.is_campus_valid?(student.campus))\n @result = {:message => 'Student campus error'}\n render json: @result, :status => 403\n return\n end\n\n # find the subject\n # use integer value of enum on find_by and new , eg: student[:campus] instead of student.campus\n subject = Subject.find_by(:code => params[:code], :campus => student[:campus])\n if(!subject)\n @result = {:message => 'Subject not found in Database'}\n render json: @result, :status => 404\n return\n end\n\n @subject_texts = Mechanizor.get_subject_html(params[:utar_id], params[:utar_password], subject.url, subject.code, student.campus)\n\n if !@subject_texts\n @result = {:message => 'Error accessing WBLE or student does not have this subject'}\n render json: @result, :status => 403\n return\n end\n\n @result = {:message => 'Successfully retrieved html for subject', :texts => @subject_texts}\n render json: @result\n end",
"def set_student_subject\n @student_subject = StudentSubject.find(params[:id])\n end",
"def get_subject_by_curricular_line\n @subjects = Subject.get_by_career(params[:career_id],params[:cl_id])\n render :json => @subjects\n end",
"def get_evaluations\n\t\tif current_student.id.to_i == params[:id].to_i\n\t\t\t@student = Student.find(params[:id])\n\t\t\t@evaluations = @student.evaluations\n\t\tend\n\t\trender 'get_evaluations'\n\tend",
"def get_student\n @student = Student.find(params[:student_id])\n end",
"def show\n @subject = get_subject\n end",
"def create\n @subject = current_user.subjects.new(subject_params)\n respond_to do |format|\n if @subject.save\n format.html { redirect_to @subject, notice: \"已成功创建学生账户:#{@subject.title}. \"}\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @dictations = @training_class.dictations\n\n if(params[:student_id])\n @student= Student.find(params[:student_id])\n @stu_diction_scores =@training_class.student_dictions(@student)\n @week_dates = WeekDate.group_days(@stu_diction_scores,@training_class)\n # @student_attendances =@attendances.student_attendances.where(student_id: @student)\n\n render \"index_for_special_student\"\n else\n render \"index\"\n end\n end",
"def index\n if params[:student_id]\n @enrollments = Enrollment.where student_id: params[:student_id]\n @student = Student.find params[:student_id]\n else\n @enrollments = Enrollment.all\n end\n\n end",
"def show\n\n @student = Student.find(params[:id])#search_stdId(params[:Id])\n\n end",
"def students\n if current_user.is_admin?\n @students= User.find(:all, :conditions => \"is_teacher = '0' and is_admin = '0'\")\n respond_to do |format|\n format.xml { render :xml => @students }\n end\n else\n respond_to do |format|\n format.xml { render :text => \"error\" }\n end\n end\n end",
"def show\n @user_subject = UserSubject.find(params[:id])\n end",
"def show\n respond_with(@subject_sample_search)\n end",
"def resultcreate\n\t\t\ts = Student.last\n\t\t\tsn = s.roll_no\n\t\t\tsid = s.id\n\t\t\tr= Result.create(:student_roll=>sn,:student_id=>sid)\n\t\t\tr.save\n\t\tend",
"def create\n @student_subject = StudentSubject.new(student_subject_params)\n\n respond_to do |format|\n if @student_subject.save\n format.html { redirect_to @student_subject, notice: 'Student subject was successfully created.' }\n format.json { render :show, status: :created, location: @student_subject }\n else\n format.html { render :new }\n format.json { render json: @student_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_courses\n\t\tif current_student.id.to_i == params[:id].to_i\n\t\t\t@student = Student.find(params[:id])\n\t\t\t@evaluations = @student.evaluations\n\t\tend\n\t\trender 'get_courses'\n\tend",
"def index\n\n @result\n if teacher_logged_in?\n courses = current_user.teaching_courses\n pageSize = 4\n curpage = params[:curpage]\n if curpage.to_i != 0\n curpage = curpage.to_i\n else\n curpage = 1\n end\n recordCount = courses.length\n currecordslen = (curpage-1) * pageSize\n maxAsize = (currecordslen + pageSize)\n records = []\n coursea = []\n coursea = courses\n if maxAsize > recordCount\n for i in currecordslen...recordCount\n records << coursea[i]\n end\n else\n records = coursea[currecordslen,pageSize]\n end\n cids = [1,2]\n pageinfo = PageInfo.new(curpage,pageSize,recordCount,records,cids)\n @result = pageinfo\n\n elsif student_logged_in?\n pageSize = 4\n curpage = params[:curpage]\n if curpage.to_i != 0\n curpage = curpage.to_i\n else\n curpage = 1\n end\n\n cuid = current_user.id\n grades = Grade.where(:user_id => \"#{cuid}\")\n tep = []\n grades.each do |grade|\n tep << grade.course_id\n end\n courses = Course.find(tep)\n recordCount = courses.length\n records = []\n currecordslen = (curpage-1) * pageSize\n records = Course.find_by_sql(\"select * from courses where id in (select course_id from grades where user_id = #{cuid}) limit #{pageSize} offset #{currecordslen}\")\n cids = [1,2]\n pageinfo = PageInfo.new(curpage,pageSize,recordCount,records,cids)\n @result = pageinfo\n end\n # render :text => \"#{@result}\"\n @result\n end",
"def show\n \n id = params[:id].to_i\n \n if id == 0\n @subject = Subject.find_by_subject(params[:id])\n else \n @subject = Subject.find(params[:id])\n end\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subject }\n end\n end",
"def get_matching_students\n\t\tstudent\n\tend",
"def create\n @student = Student.new(params[:student])\n #@student.userid = session[:other_user_id]\n @student.registration_year = AdminController::SchoolYear\n @other_user = get_other_user(@student.userid) # find the user for the added contact\n \n #@other_user = get_other_user(session[:other_user_id]) \n @students = Student.find(:all) \n studentid = 100\n for tempStudent in @students do\n if tempStudent.studentid > studentid\n studentid = tempStudent.studentid\n end\n end\n @student.studentid = studentid + 1\n @student.lastname = @student.lastname.capitalize\n @student.firstname = @student.firstname.capitalize\n if @student.middlename\n @student.middlename = @student.middlename.capitalize\n end\n\n respond_to do |format|\n if @student.save\n flash[:notice] = 'Student was successfully created.'\n format.html { redirect_to(@other_user) }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def text\n # insufficient parameters\n if !params.has_key?(:utar_id) || !params.has_key?(:utar_password)\n @result = {:message => 'No utar credential specified'}\n render json: @result, :status => 400\n return\n end\n\n # find student from database\n student = Student.find_by(:utar_id => params[:utar_id])\n if(!student)\n @result = {:message => 'Student not found in Database'}\n render json: @result, :status => 404\n return\n end\n\n # check if campus is valid\n if(!Mechanizor.is_campus_valid?(student.campus))\n @result = {:message => 'Student campus error'}\n render json: @result, :status => 403\n return\n end\n\n # find the subject\n # use integer value of enum on find_by and new , eg: student[:campus] instead of student.campus\n subject = Subject.find_by(:code => params[:code], :campus => student[:campus])\n if(!subject)\n @result = {:message => 'Subject not found in Database'}\n render json: @result, :status => 404\n return\n end\n\n @subject_texts = Mechanizor.get_subject_text(params[:utar_id], params[:utar_password], subject.url, subject.code, student.campus)\n\n if !@subject_texts\n @result = {:message => 'Error accessing WBLE or student does not have this subject'}\n render json: @result, :status => 403\n return\n end\n\n @result = {:message => 'Successfully retrieved text for subject', :texts => @subject_texts}\n render json: @result\n end",
"def index\n logged_in\n if @current_user.teacher?\n @subjects = Subject.where(teacher_id: @current_user.id)\n elsif @current_user.student?\n @subjects = Subject.where(id: Relation.select(:subject_id).where(student_id: @current_user.id))\n else\n @subjects = Subject.all\n end\n end",
"def get_subject\n out = ''\n if aggregate_count > 1 #multiple records of any type\n if type_count > 1 #multiple types of records\n if distinct_aggregate_count > 1 #multiple profiles\n others = (distinct_aggregate_count-1)\n out << \"and #{pluralize(others, 'other')} \"\n out << subject_aggregate.sub('was ','were ')\n out << \" #{type_count} times\"\n else\n out << subject_aggregate\n out << \" #{type_count} times\"\n end\n else\n if distinct_aggregate_count > 1 #multiple profiles\n others = (distinct_aggregate_count-1)\n out << \"and #{pluralize(others, 'other')} \"\n out << subject.sub('was ','were ')\n else\n out << subject\n end\n end\n else\n out << subject\n end\n return out.html_safe\n end",
"def index\n @mysubjects = Mysubject.all\n end",
"def show\n @semester_subject = SemesterSubject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @semester_subject }\n end\n end",
"def show\n @student = @cv.student\n end",
"def result_params\n params.require(:result).permit(:score, :student_id)\n end",
"def create\n @survey_result = SurveyResult.new(survey_result_params)\n\n @survey_result.student_id = current_student.id\n @survey_result.course_id = params[\"course_id\"]\n\n respond_to do |format|\n if @survey_result.save\n format.html { redirect_to student_path(current_student.id), notice: 'Survey result was successfully created.' }\n format.json { render action: 'show', status: :created, location: @survey_result }\n else\n format.html { render action: 'new' }\n format.json { render json: @survey_result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n if @current_user\n @students = Student.where.not(id: Relation.select(:student_id).where(subject_id: @subject.id))\n @inscrits = Student.where(id: Relation.select(:student_id).where(subject_id: @subject.id))\n else\n redirect_to request.referrer || root_path\n end\n end",
"def show\n @student = set_student\n end",
"def create\n @enrollment = Enrollment.new(enrollment_params)\n @enrollment.student = Student.find(params[:student_for_enrollment])\n @enrollment.subject = Subject.find(params[:subject])\n @enrollment.year = DateTime.now.year\n\n respond_to do |format|\n if @enrollment.save\n format.html { redirect_to '/students', notice: 'La Cursada se creó exitosamente.' }\n format.json { render :show, status: :created, location: @enrollment }\n else\n format.html { render :new }\n format.json { render json: @enrollment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n if params[:term]\n subject = Subject.find_by(term: params[:term])\n redirected_to subject\n return\n end\n\n search = Sunspot.new_search(Manifestation)\n subject = @subject\n search.build do\n with(:subject_ids).equal_to subject.id if subject\n end\n page = params[:work_page] || 1\n search.query.paginate(page.to_i, Manifestation.default_per_page)\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def index\n @thesubjects = Thesubject.all\n end",
"def find_student\n @student = Student.find(params[:id])\n end",
"def students\n @users = User.paginate(:page => params[:page], :per_page => 20).student\n @filter = \"All Students\"\n render :index\n end",
"def show\n\n @subject = Subject.find(params[:id])\n\n end",
"def index\n @q = Subject.search(params[:q])\n @subjects = @q.result(distinct: true).page(params[:page])\n end",
"def index\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n\n @students = $selected_course.students.collect{|student| {name: student.first + ' ' + student.last, student_id: student.id }}\n end",
"def show\n @subject = Subject.find(params[:id])\n end",
"def index\n @students = Student.where(:course_id => params[:course_id])\n end",
"def save_external_student\n @index = Index.find_all_by_student_id(params[:index][:id])\n if @index.size > 1\n @index = @index.detect { |i| i.status == 'studuje' && i.faculty == @user.person.faculty }\n else\n @index = @index.first\n end\n exam = Exam.new\n exam.index = @index\n session[:exam] = exam\n @subjects = @index.study_plan.unfinished_external_subjects\n end",
"def qualified_student\n @company = Company.find(params[:id])\n @placement_exam = PlacementExam.find(params[:exam_id])\n @score = StudentScore.where(placement_exams_id: @placement_exam)\n @student_score = @score.where(is_qualify: true)\n end",
"def data\n # insufficient parameters\n if !params.has_key?(:utar_id) || !params.has_key?(:utar_password)\n @result = {:message => 'No utar credential specified'}\n render json: @result, :status => 400\n return\n end\n\n # find student from database\n student = Student.find_by(:utar_id => params[:utar_id])\n if(!student)\n @result = {:message => 'Student not found in Database'}\n render json: @result, :status => 404\n return\n end\n\n # check if campus is valid\n if(!Mechanizor.is_campus_valid?(student.campus))\n @result = {:message => 'Student campus error'}\n render json: @result, :status => 403\n return\n end\n\n # find the subject\n # use integer value of enum on find_by and new , eg: student[:campus] instead of student.campus\n subject = Subject.find_by(:code => params[:code], :campus => student[:campus])\n if(!subject)\n @result = {:message => 'Subject not found in Database'}\n render json: @result, :status => 404\n return\n end\n\n @subject_data = Mechanizor.get_subject_data(params[:utar_id], params[:utar_password], subject.url, subject.code, student.campus)\n\n if !@subject_data\n @result = {:message => 'Error accessing WBLE or student does not have this subject'}\n render json: @result, :status => 403\n return\n end\n\n @result = {:message => 'Successfully retrieved files for subject', :data => @subject_data}\n render json: @result\n end",
"def particular_wise_student_transaction\n @search_method = 'particular_wise_student_transaction'\n @partial = 'finance_reports/reports/particular_wise_student_transaction'\n fetch_and_render\n end",
"def results\n if current_user.admin?\n @students = Student.all.search(params[:search])\n else\n @students = current_user.students.search(params[:search]) \n end\n \n respond_to do |format|\n format.html\n format.js\n end\n end",
"def save_subject\n @exam = session[:exam]\n if session[:exam].subject_id == nil\n session[:exam].subject_id = params[:subject][:id]\n end\n @indices = PlanSubject.find_unfinished_by_subject(\\\n session[:exam].subject_id, :indices => true)\n end",
"def create\n session[:setting] = \"\"\n @subject = @student.subject.create(subject_params)\n respond_to do |format|\n if @subject.save\n format.html { redirect_to student_path(@student), notice: 'Subject was successfully created.' }\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if params[:goto]\n student = Student.find_by_name(params[:goto])\n redirect_to student and return if student\n student = Student.find_by_number(params[:goto])\n redirect_to student and return if student\n redirect_to students_path and return\n end\n do_it(:order,'number')\n do_it(:per,50)\n \n @students = Student\n @students = Course.find(params[:course_id]).students if params[:course_id]\n @students = @students.where(klass_id:Grade.find(params[:grade_id]).klasses.collect(&:id)) if params[:grade_id]\n @students = @students.where(klass_id:params[:klass_id]) if params[:klass_id]\n @students = @students.where(paixuzi:params[:paixuzi]) if params[:paixuzi]\n @students = @students.where(surname:FamilyName.find(params[:surname_id]).hanzi) if params[:surname_id]\n @students = @students.where(number_prefix:params[:number_prefix]) if params[:number_prefix]\n @students = @students.where(klass2_id:params[:klass2_id]) if params[:klass2_id]\n @students = @students.order(params[:order])\n @students = @students.page(params[:page]).per(params[:per])\n @order = params[:order]\n end",
"def get_student\n @student = Student.find(params[:std_id])\n render json: @student\n end",
"def show\n @student = find_student # Load the student mentioned by id in the route\n end",
"def show\n \n @student= Student.find(params[:id])\n \n \n end",
"def result\n @exam = current_exam(params)\n\n @exam_reporter = @exam.evaluate(params[:answers])\n end",
"def show\n @courses = @student.courses\n @groups = @student.groups\n end",
"def subject_specialization\n mg_school_id=session[:current_user_school_id]\n # @examination_hod_logins=MdgExaminationHodLogin.find_by(:mg_user_id=>session[:user_id])\n examination_hod_logins=MgExaminationHodLogin.find_by(:mg_user_id=>session[:user_id])\n employee=MgEmployee.find_by(:id=>examination_hod_logins.mg_employee_id)\n subject=MgSubject.where(:is_deleted=>0, :mg_school_id=>mg_school_id, :mg_employee_specialization_id=>employee.hod_specialization_id)\n @subject_specialization=MgExamSubjectSpecializedEmployees.where(:is_deleted => 0, :mg_school_id=>session[:current_user_school_id], :mg_subject_id=>subject.pluck(:id)).paginate(page: params[:page], per_page: 10)\n \n end",
"def show\n @manual_subject = Manual::Subject.find(params[:id])\n\n redirect_to manual_subject_laboratories_path(@manual_subject)\n end",
"def manage_c6s\n sam_student_id = params[:sam_student_id]\n # retrieves courses which are supervised by the course coordinator\n @courses = current_staff.courses\n @hash = {}\n # if no student ID is submitted,\n # it lists all the students who missed practicals for the courses belonging to the course coordinator\n if sam_student_id.nil?\n @courses.each do |course|\n @hash[course.course_title] = AbsenceCertificate.where(\"certificate_type = ? AND course_id = ?\", \"C6\", course.id)\n end\n else\n # if a student ID is submitted, the absence certificates for that student are displayed\n student = Student.find_by(sam_student_id: sam_student_id)\n # if the student exists in the database, a hash is filled with their absence certificates (to be rendered/presented later in the corresponding view)\n if !student.nil?\n @courses.each do |course|\n @hash[course.course_title] = AbsenceCertificate.where(\"certificate_type = ? AND course_id = ? AND student_id = ?\", \"C6\", course.id, student.id)\n end\n # if no student is found with that ID, it sets an alert message and redirects user to the manage_c6s page\n else\n flash[:alert] = \"There is no student with student ID: #{sam_student_id}\"\n redirect_to manage_c6s_path\n end\n end\n end",
"def subject(instructor, school)\n school[:instructors].each do |i|\n return i[:subject] if i[:name] == instructor\n end\nend",
"def show\n @subject_class = @test.subject_class\n @students = @test.subject_class.students.order(:name)\n @test_questions = @test.test_questions\n @test_question = TestQuestion.new\n @test_question.test_id = @test.id\n end",
"def index\n if params[:student]\n query_hash = {}\n query_hash.merge!(:num => params[:student][:num].strip) if !params[:student][:num].blank?\n query_hash.merge!(:name => params[:student][:name].strip) if !params[:student][:name].blank?\n query_hash.merge!(:class_num => params[:student][:class]) if !params[:student][:class].blank?\n query_hash.merge!(:grade => params[:student][:grade]) if !params[:student][:grade].blank?\n else\n query_hash = \"grade > 0\"\n end\n \n @students = Student.where(query_hash)\n \n if params[:barcode]\n render :template=>\"/students/barcode\",:layout=>false\n else\n respond_to do |format|\n format.html {@students = @students.paginate(:page => params[:page], :per_page =>8)}\n format.json { render json: @students }\n format.csv do\n first_row = []\n csv_string = CSV.generate do |csv|\n # header row\n first_row += [\"学号\", \"学生\", \"班别\"]\n\n Event::RULE_LIST.each do |r|\n first_row += [r[0]]\n end\n\n first_row += [\"评级\"]\n csv << first_row\n # data rows\n\n @students.each do |s|\n data_row = []\n data_row += [\" \" + s.num + \" \",\n s.name,\n s.class_info]\n\n Event::RULE_LIST.each do |r|\n data_row << s.events.where(:rule_type=>r[1]).count\n end\n\n data_row << s.rating\n\n csv << data_row\n end\n end\n # send it to the browsah\n send_data csv_string.encode(\"GB18030\"),\n :type => 'text/csv; charset=GB18030; header=present',\n :disposition => \"attachment; filename=#{DateTime.now.strftime(\"%y-%m-%d %I:%M%p\")}.csv\"\n end\n end\n end\n \n \n end",
"def index\n @q = Student.ransack(params[:q])\n @students = @q.result(distinct: true).page(params[:page]).per(10) \n end",
"def show\n @student = Student.find(params[:id])\n if current_user.admin?\n @student.update_attributes(status: 'complete')\n @student.save!\n end\n respond_to do |format|\n format.html\n format.json { head :no_content }\n format.pdf do\n pdf = StudentPdf.new(@student)\n send_data pdf.render,\n filename: \"student_#{@student.name}\",\n type: 'application/pdf',\n disposition: 'inline'\n end\n end\n end",
"def qualify_student\n @company = Company.find(params[:id])\n @placement_exam = PlacementExam.find(params[:exam_id])\n qualify_student = params[:qualify]\n title = \"congratulations you are short \\\n listed for next round of \" + @company.name\n qualify_student.each do |i|\n @student = StudentScore.where(student_id: i, placement_exams_id: @placement_exam).take.update(is_qualify: true)\n content = Student.find(i).full_name\n PlacementNews.create(title: title, content: content)\n end\n flash[:notice] = 'Student short-listed successfully'\n redirect_to placement_exams_path\n end",
"def index\n\t @search = Subject.search do\n\t\t\tfulltext params[:search]\n\t\t end\n\t\t@subjects = @search.results\n\t\t#@subjects = Subject.all\n\tend",
"def index\n\n @attendances = @training_class.attendances\n\n if(params[:student_id])\n @student= Student.find(params[:student_id])\n @stu_attendances =@training_class.student_attendance(@student)\n @week_dates = WeekDate.group_days(@stu_attendances,@training_class)\n\n # @student_attendances =@attendances.student_attendances.where(student_id: @student)\n\n render \"index_for_special_student\"\n else\n render \"index\"\n end\n end",
"def index\n @students = Student.search @year_selected, @degree_selected\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @students }\n end\n end",
"def new\n # Don't want to be able to select student here, but not sure how to disable it\n @students = Student.where(:name => \"xxxx\")\n @subject = Subject.new\n @b_id = @subject.id\n\n respond_with(@resources, @students, @subject, @b_id)\n end",
"def show\n\t\t@param_subjects = ParamSubject.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {render json: @param_subjects}\n\t\tend\n\tend",
"def index\n if @subject_class\n \n @tests = Test.all.where(subject_class_id: @subject_class.id)\n\n else\n flash[:notice] = \"invalid request\"\n end\n end",
"def index\n @student_evaluation_case2s = StudentEvaluationCase2.all\n end",
"def show\n @student = @topic.student\n end",
"def show\n @students = Student.joins(:subjects)\n .select('students.name, students.email, students.age, students.gender, students.opinion, subjects.id as subject_id')\n .select('exam_results.name as exam_result_name, subjects.name as subject_name, exam_results.score')\n .select('CAST((exam_results.score / subjects.max_score) * 100 as int) as ratio')\n .where(id: params[:id])\n .order(id: :asc)\n\n avg_result = Student.joins(:subjects)\n .select('subjects.id as subject_id')\n .select('CAST(AVG(exam_results.score) as int) as avg_score') \n .select('MAX(exam_results.score) as max_score')\n .select('MIN(exam_results.score) as min_score')\n .group('subjects.id')\n .order('subjects.id')\n @score_hash = {}\n avg_result.each do |avg_res|\n h = Hash.new\n h[:avg_score] = avg_res.avg_score\n h[:max_score] = avg_res.max_score\n h[:min_score] = avg_res.min_score \n @score_hash[avg_res.subject_id] = h\n end\n end",
"def show\n\t\t@students = Student.where(school_id: @school.id)\n\t\t@group = {\"0\"=>[],\"1\"=>[],\"2\"=>[],\"3\"=>[],\"4\"=>[],\"5\"=>[],\"6\"=>[],\"7\"=>[],\"8\"=>[],\"9\"=>[],\"10\"=>[],\"11\"=>[],\"12\"=>[]}\n\t\t@st = []\n\t\t@students.each do |student|\n\t\t\t@group[student.last_course].push(student.average)\n\t\t\t#p student.average\n\t\tend\n\t\t@group.reject!{ |k,v| !v.any? }\n\t\t@courses = [];\n\t\t@grades = [];\n\t\t@group.each do |k,v|\n\t\t\t@group[k] = added(v);\n\t\t\t@courses.push(k);\n\t\t\t@grades.push(v[0].round(2));\n\t\tend\n\t\t@title = \"Informe del \" + (Time.now.year-1).to_s + \" al \" + (Time.now.year).to_s\n\n\t\t@ids=[]\n\t\t@students.each do |st|\n\t\t\t@ids.push(st.id)\n\t\tend\n\n\t\t@activities = Activity.joins(:students).where(students: {id: @ids})\n\t\t@programs_edu =\tProgram.where(line: \"epc\").joins(:activities).where(activities: {id: @activities})\n\t\t@programs_m =\tProgram.where(line: \"n\").joins(:activities).where(activities: {id: @activities})\n\t\t@programs_h =\tProgram.where(line: \"h\").joins(:activities).where(activities: {id: @activities})\n\n end",
"def index\n @program_subjects = ProgramSubject.all\n end",
"def create\n @title = t(:message_0, :scope => [:controller, :exams])\n unless @user.has_role? 'faculty_secretary'\n by_subject\n render :action => :by_subject\n else\n session[:exam] = nil\n end\n end",
"def index\n @user_subjects = UserSubject.all\n end",
"def student_show\n\t\t\tif (current_student.quizzes.exists?(:id => params[:id]))\n\t\t\t\tquiz = current_student.quizzes.find(params[:id])\n\t\t\t\tstudent_quiz_obj = StudentResultQuiz.where(student_id:current_student.id).where(quiz_id:quiz.id).first\n\t\t\t\tif( quiz.expiry_date < DateTime.current ) \t\n\t\t\t\t\tanswers = student_quiz_obj.student_ans\n\t\t\t\t\tstudent_result = student_quiz_obj.result\n\t\t\t\t\tif (student_result == nil)\n\t\t\t\t\t\tstudent_result = 0\n\t\t\t\t\t\tanswers = []\n\t\t\t\t\tend\n\t\t\t\t\tquestions = quiz.questions\n\t\t\t\t\trender json: {:quiz => quiz, :questions => questions, :student_answers => answers, :result => student_result}, status: 200\n\t\t\t\telsif (student_quiz_obj.result == nil)\n\t\t\t\t\tquestions = quiz.questions\n\t\t\t\t\trender json: questions, status: 200\n\t\t\t\telse\n\t\t\t\t\trender json: { error:\"You have already taken the quiz\" }, status: 422\n\t\t\t\tend\n\t\t\telse\n\t\t\t\trender json: { error:\"Quiz is not found\" }, status: 404\n\t\t\tend\n\t\tend",
"def add_student\n @phases=Phase.where(academic_session_id: session[:global_academic_session])\n\n @stud=Student.find_by(:id=>params[:id])\n\n # @student_phase = @stud.show_phase_id\n @student_phase = @stud.phase_id(session[:global_academic_session])\n\n\n if @stud.temp_tg_user_id != 0\n @custom=1\n respond_to do |format|\n format.js {render '/tutor_groups/js/add_student'}\n end\n else\n @stud.temp_tg_user_id = current_user.id\n @stud.save\n @students=Student.where(:temp_tg_user_id=>current_user.id)\n @from_js = true\n respond_to do |format|\n format.js {render '/tutor_groups/js/add_student'}\n end\n end\n end",
"def generate\n\t\t@vs = \"vitalsource\"\n\t\t@question = [\"What is your Student ID number?\",\"What is your favorite color?\",\"In what city were you born?\",\"What is your pet's name?\",\"What is your mother's maiden name?\"]\n\tend",
"def create\n @student_result = StudentResult.new(student_result_params)\n\n respond_to do |format|\n if @student_result.save\n format.html { redirect_to @student_result, notice: 'Student result was successfully created.' }\n format.json { render :show, status: :created, location: @student_result }\n else\n format.html { render :new }\n format.json { render json: @student_result.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.63951766",
"0.6393098",
"0.6243874",
"0.62334514",
"0.6139165",
"0.61361897",
"0.6117635",
"0.61086035",
"0.60716087",
"0.6052132",
"0.60311127",
"0.5965464",
"0.59487104",
"0.59451336",
"0.5895375",
"0.5881867",
"0.58758503",
"0.5858257",
"0.58528626",
"0.58441246",
"0.5842802",
"0.58271027",
"0.579278",
"0.57841086",
"0.578272",
"0.5776228",
"0.5772116",
"0.57612884",
"0.5759289",
"0.575734",
"0.57244384",
"0.5719919",
"0.5709168",
"0.5704435",
"0.5702066",
"0.56979465",
"0.5682701",
"0.567217",
"0.56678724",
"0.56525975",
"0.5650018",
"0.5648617",
"0.5643524",
"0.563137",
"0.56282127",
"0.5619938",
"0.5615976",
"0.5615834",
"0.56143844",
"0.5603425",
"0.5590179",
"0.5584687",
"0.5577755",
"0.5575365",
"0.55682623",
"0.5564167",
"0.5563274",
"0.55606705",
"0.55519956",
"0.55456",
"0.5543413",
"0.5540068",
"0.5533844",
"0.55296177",
"0.5523059",
"0.5520788",
"0.5520378",
"0.5516674",
"0.5516435",
"0.55160046",
"0.5510252",
"0.5499941",
"0.5492828",
"0.5487511",
"0.5486101",
"0.54820484",
"0.54796207",
"0.5479435",
"0.54766226",
"0.5475396",
"0.5473417",
"0.54637355",
"0.5462638",
"0.5460724",
"0.54578376",
"0.5457277",
"0.5454462",
"0.54535055",
"0.5450167",
"0.5448516",
"0.54472655",
"0.54457325",
"0.54300594",
"0.54286087",
"0.5428505",
"0.54281074",
"0.54242074",
"0.542331",
"0.54205775",
"0.5419896"
] |
0.5429369
|
93
|
This action manage the type of exam result i.e.Grades or Marks.
|
def type_result(e, es)
if exam_type == 'Grades'
es.grading_level.name || 'AB'
elsif exam_type == 'Marks'
[es.marks || 'AB', e.maximum_marks].join('/')
else
[[es.marks || 'AB', e.maximum_marks].join('/'), es.grading_level.name || '-'].join('|')
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_exam_result\n @exam_result = ExamResult.find(params[:id])\n end",
"def set_results\n @exam = Exam.find(params[:exam_id])\n end",
"def result\n @exam = current_exam(params)\n\n @exam_reporter = @exam.evaluate(params[:answers])\n end",
"def exam_result\n if params[:exam_id]\n @exam = Exam.find(params[:exam_id])\n assert(exam.kind_of?(Exam))\n @exam = fill_user_answers(@exam)\n\n current_user.exams_total_questions += @exam.questions.count\n current_user.update_attribute(:exam_performance, current_user.exam_performance + [@exam.accepted_answers])\n\n @exam.save\n return @exam.user_answers\n else\n return redirect_to_back\n flash[:danger] = t(:exam_message)\n end\n end",
"def set_exam_result_item\n @exam_result_item = ExamResultItem.find(params[:id])\n end",
"def show\n type = params[:type]\n @item\n @answers\n @hash_ans\n case(type)\n when 'word'\n @item = Word.find(params[:id])\n @answers = @item.word_answers\n when 'comp'\n @item = Completion.find(params[:id])\n @answers = @item.completion_answers\n when 'sen'\n @item = Scenario.find(params[:id])\n @answers = @item.scenario_answers\n end\n @hash_ans = split_into_hash_of_arrays(@answers) { |ans| ans.user } \n end",
"def select_exam\n end",
"def show\n @exam_result = Xmt::Test::ExamResult.find(params[:id])\n @total_marks = @exam_result.question_scores.sum(:marks)\n end",
"def create\n @quiz_result = QuizResult.new(params[:quiz_result])\n @quiz_result.student = current_student\n\n #If submitting.\n if @quiz_result.published\n @quiz_result.date = Time.now\n respond_to do |format|\n if @quiz_result.save\n @quiz_result.ocurrence = getOcurence @quiz_result\n @quiz_result.setGrade\n if @quiz_result.save\n format.html {redirect_to @quiz_result, notice: 'Quiz successfully answered.'}\n else\n format.html {redirect_to @quiz_result, notice: 'Error grading.'}\n end\n else\n format.html { render action: \"new\" }\n end\n end\n \n #If just saving, not submitting.\n else\n respond_to do |format|\n if @quiz_result.save\n format.html { redirect_to @quiz_result, notice: 'Quiz successfully saved.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end\n \n end",
"def exam\n if @errors.nil?\n redirect_to exam_score_exam_path(@exam)\n else\n @students = []\n students ||= @exam.exam_group.batch.students.all\n @students = @exam.select_subject(@students, students, @exam)\n @exam_grade ||= @exam.exam_group.batch.grading_levels.all\n render 'exam_score'\n end\n end",
"def result\n if params.dig(:assessment, :type).present? && params.dig(:assessment, :type_id).present?\n type = params[:assessment][:type].camelize.constantize.where(id: params[:assessment][:type_id]).first rescue ''\n if type.present?\n all_questions = fetch_all_questions(type)\n total_qusts_count = all_questions.count \n if total_qusts_count > 0\n assessment_questions = Assessment.fetch_assessment_questions(all_questions.ids, current_user.id)\n result = {\n correct_answers: ((assessment_questions.where(is_correct: 'Y').count*100)/total_qusts_count),\n wrong_answers: ((assessment_questions.where(is_correct: 'N').count*100)/total_qusts_count),\n skipped_questions: ((assessment_questions.where(is_skipped: 'Y').count*100)/total_qusts_count) , \n unseen_questions: ((total_qusts_count-assessment_questions.count)*100)/total_qusts_count\n }\n render json: result\n else\n render json: {'type': 'No data found for selected type'}\n end\n else\n render json: {'type': 'Invalid selection of type or type id'}\n end\n else\n render json: {'Input': 'Invalid inputs'}\n end\n end",
"def set_ResultType(value)\n set_input(\"ResultType\", value)\n end",
"def set_ResultType(value)\n set_input(\"ResultType\", value)\n end",
"def create\n @result = nil\n if (params.has_key?(:result) && params[:result][:type] == \"ResultDoubles\")\n @result = ResultDoubles.new(params[:result])\n else\n @result = Result.new(params[:result])\n end\n\n respond_to do |format|\n if @result.save\n calculate_ratings(@result)\n format.html { redirect_to :controller => \"home\", :action => \"index\", notice: 'Result was successfully created.' }\n format.json { render json: @result, status: :created, location: @result }\n else\n format.html { render action: \"new\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exam_result = ExamResult.new(exam_result_params)\n\n respond_to do |format|\n if @exam_result.save\n format.html { redirect_to @exam_result, notice: 'Exam result was successfully created.' }\n format.json { render :show, status: :created, location: @exam_result }\n else\n format.html { render :new }\n format.json { render json: @exam_result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n # resultが無い時\n unless @judge.result.present?\n # submitが無いときには別のテンプレート\n unless @judge.submits.exists?\n render :no_submit\n return\n end\n @judge.result = @judge.submits.sample.select_item\n @judge.save\n end\n end",
"def show_measures_form\n\t\t@ocde_id = params[:ocde_id]\n\t\t@subgroup_id = params[:subgroup_id]\n\t\t@project_id = params[:project_id]\n\t\tocde = OutcomeDataEntry.find(@ocde_id)\n\t\t@timepoint_id = params[:timepoint_id]\n\t\toutcome_type = params[:outcome_type]\n\t\toutcome_type = outcome_type == \"Time to Event\" ? \"survival\" : outcome_type\n\t\tif @project_id == 427 || @project_id == 553\n\t\t\t@all_measures = DefaultCevgMeasure.find(:all, :conditions=>[\"outcome_type = ? AND results_type=?\",outcome_type, 0])\n\t\telse\n\t\t\t@all_measures = DefaultOutcomeMeasure.find(:all,:conditions=>[\"outcome_type = ? AND measure_type <> ?\", outcome_type.downcase, 0])\t\t\n\t\tend\n\t\t@selected_measures = ocde.get_measures(outcome_type)\n\t\t@all_user_defined_measures = ocde.get_all_user_defined_measures\n\t\t@selected_timepoints = params[:selected_timepoints] #indicates the timepoint in the dropdown\n\t\t@show_measures_for = \"Outcome\"\n\tend",
"def display_result\n @company = Company.find(params[:id])\n @placement_exam = PlacementExam.find(params[:p_id])\n @student_score = StudentScore.where(placement_exams_id: @placement_exam)\n end",
"def set_outcome_measure_type\n @outcome_measure_type = OutcomeMeasureType.find(params[:id])\n end",
"def display_results()\n\t\t case @format\n when \"csv\"\n display_results_csv\n when \"html\"\n display_results_html\n when \"json\"\n display_results_json\n else\n display_results_csv\n end\n end",
"def question_type\n @type = params[:type]\n end",
"def set_exam\n @exam_answer = ExamAnswer.find(params[:id])\n end",
"def create\n\n @result = Result.new\n @result.name = params[:name]\n\n if params[:type] == \"Statuswechsel\"\n @result.type = \"ResultStateChange\"\n if params[:selected_state] != nil && params[:selected_state] != \"\"\n @state = State.find(params[:selected_state])\n @result.state = @state\n end\n end\n\n if params[:type] == \"Ereignistypen Menge aendern\"\n @result.type = \"ResultChangeEventTypeAmount\"\n\n if params[:event_type_operator] != nil && params[:event_type_operator] != \"\"\n @result.event_type_operator = params[:event_type_operator]\n\n if (params[:event_type_operator]) == \"Zur Menge Hinzufuegen\" || (params[:event_type_operator]) == \"Aus Menge entfernen\"\n\n if params[:add_event_types] != nil\n params[:add_event_types].each do |f|\n @event_type = EventType.find(f)\n @result.event_types << @event_type\n end\n end\n end\n end\n end\n\n if params[:info] != nil && (params[:type]) == \"Info\"\n @result.type = \"ResultInfo\"\n @result.info = params[:info]\n end\n\n if params[:type] == \"Client Sperren\"\n @result.type = \"ResultLock\"\n end\n\n respond_to do |format|\n if @result.save\n format.html { redirect_to @result, notice: 'Ergebnis wurde erfolgreich erzeugt' }\n format.json { render json: @result, status: :created, location: @result }\n else\n self.reload_edit_params\n format.html { render \"new\" } #redirect_to new_result_path\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @quiz_result = QuizResult.find(params[:id])\n\n respond_to do |format|\n if @quiz_result.update_attributes(params[:quiz_result])\n if @quiz_result.published == true\n @quiz_result.date = Time.now\n @quiz_result.ocurrence = getOcurence @quiz_result\n @quiz_result.setGrade\n if @quiz_result.save\n format.html { redirect_to @quiz_result, notice: 'Quiz result was successfully answered.' }\n else\n format.html { redirect_to @quiz_result, notice: 'Error grading.' }\n end\n else\n format.html { redirect_to @quiz_result, notice: 'Quiz result was successfully saved.' }\n end\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def publish_result\n @placement_exam = PlacementExam.all\n end",
"def update\n respond_to do |format|\n if @exam_result.update(exam_result_params)\n format.html { redirect_to @exam_result, notice: 'Exam result was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_result }\n else\n format.html { render :edit }\n format.json { render json: @exam_result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_effect_result(skill, result)\n self.total_damage ||= 0\n self.total_healing ||= 0\n\n case result[:detail][:concrete_type]\n when 'Damage'\n amount = result[:detail][:amount] \n self.total_damage += amount\n self.max_damage = {skill: skill, amount: amount} if self.max_damage.empty? or amount > self.max_damage[:amount]\n when 'Heal'\n amount = result[:detail][:amount] \n self.total_healing += amount\n self.max_healing = {skill: skill, amount: amount} if self.max_healing.empty? or amount > self.max_healing[:amount]\n end\n end",
"def view\n if @title == 'Action Items'\n ActionItems\n else\n Report\n end\n end",
"def choose_question\n if params.dig(:assessment, :type).present? && params.dig(:assessment, :type_id).present?\n type = params[:assessment][:type].camelize.constantize.where(id: params[:assessment][:type_id]).first rescue ''\n if type.present?\n all_questions = fetch_all_questions(type)\n if all_questions.count > 0\n assessment_questions = Assessment.fetch_assessment_questions(all_questions.ids, current_user.id)\n render json: calculate_remaining_qusts(all_questions, assessment_questions).order(\"RANDOM()\").limit(2).select(:id, :content, :options)\n else\n render json: {'type': 'No data found for selected type'}\n end\n else\n render json: {'type': 'Invalid selected type or type id'}\n end\n else\n render json: {'Input': 'Invalid inputs'}\n end\n end",
"def results_view\n end",
"def answer_exam\n if params[:year_exam] \n questions ||= Question.where(year: params[:year_exam])\n assert(questions.kind_of?(Question))\n else\n questions ||= Question.all\n assert(questions.kind_of?(Question))\n end\n\n if !questions.empty?\n auxiliar_exam ||= push_questions_auxiliar(questions)\n @exam = push_questions(auxiliar_exam)\n else\n redirect_to_back(select_exam_path)\n if params[:year_exam]\n flash[:danger] = t(:year_exam_not_found)\n else\n flash[:danger] = t(:exam_not_found)\n end\n end\n end",
"def exam_data(subject)\n Exam.result(subject.id, id)\n end",
"def action_type\n @rule_details.actions[0].type\n end",
"def test_result_test_type(test_result)\n test_test_type(test_result.test)\n end",
"def show\n result = Result.find_by_result_name(params[:id])\n @practical = result.practical\n @result_name = result.result_name\n\n if @practical\n @match_data = result.data\n @percentages = result.percentages\n session[:multiple_data] = nil\n else\n @percentage = result.data.first\n @user_1 = UserData.find_by(username: result.data.second)\n @user_2 = UserData.find_by(username: result.data.third)\n\n @date_ideas = Array.new\n if result.data.first == 0\n @date_ideas << \"Nothing...\"\n else\n result.data.fourth[0..2].each do |obj|\n @date_ideas << obj\n end\n end\n\n session[:compatability_data] = nil\n end\n end",
"def take\n @exam = current_exam(params)\n end",
"def set_exam\r\n @exam = Exam.find(params[:id])\r\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def apply_result(result)\n case result\n when FromScrimmageResult\n @field_position += result.yards_gained\n\n if @field_position >= 100\n touchdown\n elsif @field_position >= @line_to_gain\n first_down\n elsif @field_position <= 0\n safety\n elsif result.repeat_down\n # No-op\n else\n @down += 1\n if @down > 4\n turnover\n end\n end\n\n when OnePointConversionResult\n if result.success\n score(1)\n end\n kickoff\n\n when TwoPointConversionResult\n if result.success\n score(2)\n end\n kickoff\n\n when FieldGoalResult\n if result.success\n score(3)\n kickoff\n else\n change_of_possession\n new_downs\n end\n\n when ReturnableKickResult\n # This handles all three types of returnable kicks\n @field_position += result.kick_distance\n change_of_possession\n\n if result.touchback\n @field_position = result === KickoffResult ? 25 : 20\n else\n @field_position += result.return_distance\n end\n\n # Now check for a TD or safety\n # TODO dedup with scrimmage logic\n if @field_position >= 100\n touchdown\n elsif @field_position <= 0\n safety\n else\n new_downs\n end\n\n when TakeawayResult\n turnover\n @field_position += result.taking_team_yards_gained\n\n if @field_position >= 100\n touchdown\n elsif @field_position <= 0\n # touchback\n # TODO can there be a safety on a takeaway? technically i think yet but very rare\n @field_position = 20\n first_down\n end\n\n else\n raise \"unknown result type #{result.class}\"\n\n end\n\n # advance the clock\n # TODO two minute warning?\n @seconds_remaining -= result.seconds_elapsed\n if (@seconds_remaining <= 0) && (@play_type != :point_after_touchdown)\n @quarter += 1\n @seconds_remaining = 15 * 60\n\n if @quarter == 3\n puts \"--> End of half\"\n @possession = AWAY\n kickoff\n end\n end\n end",
"def outcome_details\n begin\n @project_id = params[:project_id]\n user_assigned = current_user.is_assigned_to_project(params[:project_id])\n @data_point = OutcomeDetailDataPoint.new\n action = ''\n\n # Now get any additional user instructions for this section\n @ef_instruction = EfInstruction.find(:first, :conditions=>[\"ef_id = ? and section = ? and data_element = ?\", params[:extraction_form_id].to_s, \"OUTCOME_DETAILS\", \"GENERAL\"])\n @ef_instruction = @ef_instruction.nil? ? \"\" : @ef_instruction.instructions\n\n by_category = EfSectionOption.is_section_by_category?(params[:extraction_form_id], 'outcome_detail')\n if by_category\n @data = QuestionBuilder.get_questions(\"outcome_detail\", params[:study_id], params[:extraction_form_id], {:user_assigned => user_assigned, :is_by_outcome=>true, :include_total=>false})\n action = 'question_based_section_by_category'\n else\n action = 'question_based_section'\n @data = QuestionBuilder.get_questions(\"outcome_detail\", params[:study_id], params[:extraction_form_id], {:user_assigned => user_assigned})\n end\n render :action=>\"#{action}\", :layout=>false\n rescue Exception => e\n puts \"ERROR: #{e.message}\\n\\n#{e.backtrace}\\n\\n\"\n end\n end",
"def set_exam\n\t\t@exam = Exam.find(params[:id])\n\tend",
"def index\n if params[:type] == 'UsedCar'\n used \n elsif params[:type] == 'CarAccessory'\n accessory\n else\n accident\n end \n end",
"def record_result(homescore, awayscore, status=\"COMPLETED\")\n super(homescore, awayscore, status)\n self.advance_contestants()\n end",
"def student_actions\n case params[:thing_to_do]\n when 'Advance year'\n advance_students\n when 'Revert year'\n revert_students\n when 'Deactivate'\n mass_deactivate\n when 'Activate'\n mass_reactivate\n when 'Edit teacher'\n editing_teacher\n when 'Assign tutor'\n assigning_tutor\n when 'Add notes'\n adding_notes\n else\n message = { message: 'That action is not defined.' }\n render json: message, status: :unprocessable_entity\n end\n end",
"def show_comparison_measures_form\n\t @timepoint_id = params[:timepoint_id]\n\t @selected_timepoints = params[:selected_timepoints]\n\t @extraction_form_id = params[:extraction_form_id]\n\t @study_id = params[:study_id]\n\t @project_id = params[:project_id]\n\t @comparison_id = params[:comparison_id]\n\t outcome_type = params[:outcome_type]\n\t @subgroup_id = params[:subgroup_id] == \"\" ? 0 : params[:subgroup_id]\n\n\t # section number specific to diagnostic test entries\n\t section_num = params[:dx_section]\n\n\t # get a list of all measures\n\t ocType = section_num.nil? ? outcome_type.downcase : \"diagnostic_#{section_num}\"\n\t ocType = ocType == \"time to event\" ? \"survival\" : ocType\n\t if @project_id == 427 || @project_id == 553\n\t \t@all_measures = DefaultCevgMeasure.where(:outcome_type=>ocType,:results_type=>1)\n\t else\n\t \t@all_measures = DefaultComparisonMeasure.where(:outcome_type=>ocType,:within_or_between=>1)\n\t end\n\t \n\t # get the measures for this particular comparison\n\t @selected_measures = ComparisonMeasure.where(:comparison_id=>@comparison_id)\n\t comparison = Comparison.find(@comparison_id)\n\t unless comparison.nil?\n\t\t @all_user_defined_measures = comparison.get_all_user_defined_measures\n\t\telse\n\t\t\t@all_user_defined_measures = []\n\t\tend\n\t \n\t unless section_num.nil?\t\n\t \t@show_measures_for = case section_num.to_i\n\t\t \twhen 1\n\t\t \t\t'Diagnostic Test Descriptive Result Measures'\n\t\t \twhen 2\n\t\t \t\t'Diagnostic Test Measures Assuming a Reference Standard'\n\t\t \telse\n\t\t \t\t'Diagnostic Test Measures for Additional Analysis'\n\t\t \tend\n\t\t\n\t else\t\n\t \t@show_measures_for = \"Between-Arm Comparison\"\n\t end\n\t render '/outcome_data_entries/show_measures_form'\n\tend",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def save_test\n @test = params[:question]\n @placement_exam = PlacementExam.find(params[:placement_exam_id])\n @student = Student.find(params[:student_id])\n @score = PlacementExam.calculateres(@test, @placement_exam.id, @student)\n end",
"def new\n @examination_kind = ExaminationKind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @examination_kind }\n end\n end",
"def update\n respond_to do |format|\n if @outcome_measure_type.update(outcome_measure_type_params)\n format.html { redirect_to @outcome_measure_type, notice: 'Outcome measure type was successfully updated.' }\n format.json { render :show, status: :ok, location: @outcome_measure_type }\n else\n format.html { render :edit }\n format.json { render json: @outcome_measure_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n if @submission.gradings.count > 0\n redirect_to edit_course_assessment_submission_grading_path(@course, @assessment, @submission, @submission.gradings.first)\n return\n end\n\n @summary = {qn_ans: {}}\n\n @assessment.questions.each_with_index do |q,i|\n if q.is_a?(Assessment::MpqQuestion)\n @summary[:qn_ans][q.id] = { qn: q.specific, i: i + 1 }\n @summary[:qn_ans][q.id][:sub_q] = {}\n q.as_question.sub_questions.each_with_index do |sq, si|\n @summary[:qn_ans][q.id][:sub_q][sq.id] = { qn: sq.specific, i: si + 1 }\n end\n else\n @summary[:qn_ans][q.id] = { qn: q.specific, i: i + 1 }\n end\n end\n\n eval_answer\n\n @submission.answers.each do |ans|\n qn = ans.question\n if qn.parent\n @summary[:qn_ans][qn.parent.question.id][:sub_q][qn.id][:ans] = ans\n else\n @summary[:qn_ans][qn.id][:ans] = ans\n end\n\n\n #suggest grading for auto grading question\n if qn.is_a?(Assessment::CodingQuestion) && qn.auto_graded?\n results = ans.result_hash[\"eval\"]\n evals = results ? results.select {|r| r}.length : 0\n tests = qn.data_hash[\"eval\"].length\n tests = tests == 0 ? 1 : tests\n grade = (qn.max_grade * evals / tests).to_i\n ag = ans.answer_grading.new\n ag.grade = grade\n\n @summary[:qn_ans][qn.question.id][:grade] = ag\n end\n end\n end",
"def o_type\n 2 #type for Answers\n end",
"def create\n student_answers_hash = assessment_info_params[:student_answers]\n student_answers = student_answers_hash.collect { |s| StudentAnswer.new( s)}\n\n assessment_info_map = assessment_info_params.except(:student_answers)\n\n\n\n assessment_info_map[:student_answers] = student_answers\n\n @assessment_info = AssessmentInfo.new( assessment_info_map )\n @assessment_info.student_user_id = current_user.id\n\n\n\n\n\n respond_to do |format|\n correct_count = 0\n if @assessment_info.save\n\n @assessment_info.student_answers.each do |student_answer|\n\n sa = StudentAnswer.find(student_answer.id)\n\n if sa.question.question_type == 0\n if sa.answer_choice_id == sa.question.question_answers.first.choice_id\n sa.correct = true\n correct_count = correct_count + 1\n else\n sa.correct = false\n end\n sa.save!\n elsif student_answer.question.question_type == 1\n if student_answer.answer_text == student_answer.question.answer\n sa.correct = true\n correct_count = correct_count + 1\n else\n sa.correct = false\n end\n sa.save!\n end\n\n end\n\n @assessment_info.result = correct_count.to_d/@assessment_info.student_answers.count*100\n #if result less than passing grade set the concept as incomplete\n @learned_concept = LearnedConcept.find_by(concept_id: @assessment_info.assessment.concept_id)\n if !@learned_concept\n\n @learned_concept = LearnedConcept.new\n @learned_concept.concept_id = @assessment_info.assessment.concept.id\n @learned_concept.learned_course_id = @assessment_info.assessment.concept.course_id\n end\n if @assessment_info.result < @assessment_info.assessment.min_passing_grade\n @learned_concept.completed = false\n else\n @learned_concept.completed = true\n end\n @learned_concept.save\n @assessment_info.save\n format.html { redirect_to @assessment_info, notice: 'assessment was submitted.' }\n format.json { render :show, status: :created, location: @assessment_info }\n else\n format.html { render :new }\n format.json { render json: @assessment_info.errors, status: :unprocessable_entity }\n end\n end\nend",
"def result_type(result_type='mixed')\n @query[:result_type] = result_type\n self\n end",
"def create\n\n @exam = Exam.new(exam_params)\n result=@exam.save\n @exam.add_questions_to_exam(@validated_question)\n respond_to do |format|\n if result\n format.html { redirect_to @exam, notice: \"已成功建立考试“#{@exam.name}.”\" }\n format.json { render :show, status: :created, location: @exam }\n else\n format.html { render :new }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def answer(data)\n @action = Action.find_by_class_assignment_id_and_user_id(\n @session[:assignment_id], @current_user.id)\n @action_problem = action.action_problems.find_by_problem_id_and_end_time(data[:problem].id, nil)\n @assignment_answer = AssignmentAnswer.create(\n :action_problem_id => @action_problem.id,\n :problem_id => data[:problem].id, \n :answer => data[:correct] || data[:incorrect], \n :correct => data.has_key?(:correct), \n :user_id => @current_user.id, \n :class_assignment_id => @session[:assignment_id], \n :time => Time.now)\n\n #action_problem.incorrect_answers += 1 if data.has_key?(:incorrect)\n #action_problem.first_assignment_answer_id = @assignment_answer.id if action_problem.first_assignment_answer_id.nil?\n #action_problem.save!\n\n if @assignment_answer.first_response? and @assignment_answer.problem.scaffold_id.nil?\n student_id = Student.find_by_user_id(@session[:user]).id\n sa = StudentAssignment.find_or_create_by_student_id_and_class_assignment_id(student_id, @session[:assignment_id])\n sa.increment(:correct_first_answers) if data[:correct] and -1 == @session[:hint_count]\n sa.increment(:all_first_answers)\n sa.save\n end\n # Question level table\n log = QuestionLevelLog.find_by_class_assignment_id_and_user_id_and_problem_id(\n @session[:assignment_id], @current_user.id, data[:problem].id)\n unless log.nil?\n # IF FIRST RESPONSE\n if log.first_action.nil?\n log.first_response_time = @assignment_answer.time\n # if request scaffold\n if @assignment_answer.answer.nil?\n log.first_action = 2\n log.correct = 0\n # if an answer\n else\n log.first_action = 0\n log.attempt_count += 1\n log.correct = @assignment_answer.correct? ? 1:0\n log.answer = @assignment_answer.answer\n if @assignment_answer.answer.class.to_s == \"HashWithIndifferentAccess\"\n log.answer_id = @assignment_answer.answer[:id] unless @assignment_answer.answer[:id].nil?\n log.input_text = @assignment_answer.answer[:body] unless @assignment_answer.answer[:body].nil?\n else\n log.input_text = @assignment_answer.answer\n end\n end\n # NOT THE FIRST RESPONSE\n else\n # if an answer\n unless @assignment_answer.answer.nil?\n log.attempt_count += 1\n end\n end\n log.save\n end\n end",
"def show\n @exam = Exam.find(params[:id])\n @question = Question.new\n end",
"def action_instances_tem\n type = params[:type]\n case type\n when \"edit_name\"\n respond_to do |format|\n @user = User.find(params[:data])\n if @user.update_attributes(full_name: params[:value])\n format.json { render json: @user }\n else\n format.json { render json: @user.errors.messages, status: :unprocessable_entity }\n end\n end\n\n when \"change_password\"\n respond_to do |format|\n @user = User.find(params[:data])\n if @user.valid_password?(params[:old_pass])\n if @user.update_attributes(password: params[:new_pass], password_confirmation: params[:new_pass])\n format.json { render json: @user }\n else\n format.json { render json: @user.errors.messages, status: :unprocessable_entity }\n end\n else\n format.json { render text: \"Current Password is incorrect\" }\n end\n end\n\n when \"long_create\"\n respond_to do |format|\n @current_title = CurrentTitle.find(params[:data])\n if @current_title.update_attributes(long_term: params[:value])\n format.json { render json: @current_title }\n else\n format.json { render json: @current_title.errors.messages, status: :unprocessable_entity }\n end\n end\n\n when \"long_edit\"\n respond_to do |format|\n @current_title = CurrentTitle.find(params[:data])\n if @current_title.update_attributes(long_term: params[:value])\n format.json { render json: @current_title }\n else\n format.json { render json: @current_title.errors.messages, status: :unprocessable_entity }\n end\n end\n\n when \"short_create\"\n respond_to do |format|\n @current_title = CurrentTitle.find(params[:data])\n if @current_title.update_attributes(short_term: params[:value])\n format.json { render json: @current_title }\n else\n format.json { render json: @current_title.errors.messages, status: :unprocessable_entity }\n end\n end\n \n when \"short_edit\"\n respond_to do |format|\n @current_title = CurrentTitle.find(params[:data])\n if @current_title.update_attributes(short_term: params[:value])\n format.json { render json: @current_title }\n else\n format.json { render json: @current_title.errors.messages, status: :unprocessable_entity }\n end\n end\n\n when \"delete_long\"\n respond_to do |format|\n @current_title = CurrentTitle.find(params[:data])\n @comments = Comment.where(current_title_id: params[:data], comment_type: \"long_term\")\n if @current_title.update_attributes(long_term: nil) && @comments.destroy_all\n format.json { render json: @current_title }\n else\n format.json { render json: @current_title.errors.messages, status: :unprocessable_entity }\n end\n end\n\n when \"delete_short\"\n respond_to do |format|\n @current_title = CurrentTitle.find(params[:data])\n @comments = Comment.where(current_title_id: params[:data], comment_type: \"short_term\")\n if @current_title.update_attributes(short_term: nil) && @comments.destroy_all\n format.json { render json: @current_title }\n else\n format.json { render json: @current_title.errors.messages, status: :unprocessable_entity }\n end\n end\n\n when \"create_comment\"\n p params[:comment], \"=================================\"\n comment_type = params[:comment_type] || nil\n sub_type = params[:sub_type] || nil\n obj_id = params[:obj_id] || nil\n\n respond_to do |format|\n @comment = Comment.new(comment: params[:comment], comment_type: sub_type, :\"#{comment_type}\" => obj_id, user_id: params[:data] )\n \n if @comment.save\n unless sub_type.eql?(\"\")\n owner_notification = Notification.create(user_id: params[:user_owner_id], obj_user_id: params[:data], notification_type: \"comment\", obj_id: obj_id, obj_type: \"#{comment_type}_#{sub_type}_owner\", is_seen: false) unless params[:user_owner_id].eql?(params[:data])\n if comment_type == \"evidence_id\"\n user_array = Evidence.find(obj_id).comments.map(&:user_id).uniq\n if user_array.length > 0\n user_array.delete(params[:user_owner_id].to_i)\n user_array.delete(params[:data].to_i)\n user_array.each do |user_id|\n notification = Notification.create(user_id: user_id, obj_user_id: params[:data], notification_type: \"comment\", obj_id: obj_id, obj_type: \"#{comment_type}_#{sub_type}\", is_seen: false)\n end\n end\n\n elsif comment_type == \"current_title_id\"\n user_array = CurrentTitle.find(obj_id).comments.map(&:user_id).uniq\n if user_array.length > 0\n user_array.delete(params[:user_owner_id].to_i)\n user_array.delete(params[:data].to_i)\n user_array.each do |user_id|\n notification = Notification.create(user_id: user_id, obj_user_id: params[:data], notification_type: \"comment\", obj_id: obj_id, obj_type: \"#{comment_type}_#{sub_type}\", is_seen: false)\n end\n end \n \n end \n else\n\n owner_notification = Notification.create(user_id: params[:user_owner_id], obj_user_id: params[:data], notification_type: \"comment\", obj_id: obj_id, obj_type: \"#{comment_type}_owner\", is_seen: false) unless params[:user_owner_id].eql?(params[:data])\n user_array = ShortTermObjective.find(obj_id).comments.map(&:user_id).uniq\n if user_array.length > 0\n user_array.delete(params[:user_owner_id].to_i)\n user_array.delete(params[:data].to_i)\n user_array.each do |user_id|\n notification = Notification.create(user_id: user_id, obj_user_id: params[:data], notification_type: \"comment\", obj_id: obj_id, obj_type: comment_type, is_seen: false)\n end\n end \n end\n \n format.json { render json: @comment }\n else\n format.json { render json: @comment.errors.messages, status: :unprocessable_entity }\n end\n end\n\n when \"edit_comment\"\n respond_to do |format|\n @comment = Comment.find(params[:data])\n if @comment.update_attributes(comment: params[:value])\n format.json { render json: @comment }\n else\n format.json { render json: @comment.errors.messages, status: :unprocessable_entity }\n end\n end\n\n when \"delete_comment\"\n respond_to do |format|\n @comment = Comment.find(params[:data])\n if @comment.destroy\n format.json { render json: @comment }\n else\n format.json { render json: @comment.errors.messages, status: :unprocessable_entity }\n end\n end\n\n when \"update_status\"\n respond_to do |format|\n @slot_assess = SlotAssess.find(params[:data])\n if @slot_assess.update_attributes(status: params[:status])\n format.json { render json: @slot_assess }\n else\n format.json { render json: @slot_assess.errors.messages, status: :unprocessable_entity }\n end\n end\n\n when \"create_short_term_objective\"\n @current_title = CurrentTitle.find(params[:data])\n\n @short_term_objective = ShortTermObjective.new(short_term: params[:short_term_objective], action_plan: params[:action_plan], target_date: params[:target_date], current_title_id: @current_title.id)\n respond_to do |format|\n if @short_term_objective.save\n format.json { render json: @short_term_objective }\n else\n format.json { render json: @short_term_objective.errors.messages, status: :unprocessable_entity }\n end\n end\n\n when \"edit_short_term_objective\"\n @short_term_objective = ShortTermObjective.find(params[:data])\n\n respond_to do |format|\n if @short_term_objective.update_attributes(short_term: params[:short_term_objective], action_plan: params[:action_plan], target_date: params[:target_date])\n format.json { render json: @short_term_objective }\n else\n format.json { render json: @short_term_objective.errors.messages, status: :unprocessable_entity }\n end\n end\n\n when \"delete_short_term_objective\"\n respond_to do |format|\n @short_term_objective = ShortTermObjective.find(params[:data])\n @comments = Comment.where(short_term_objective_id: params[:data])\n if @short_term_objective.destroy && @comments.destroy_all\n format.json { render json: @short_term_objective }\n else\n format.json { render json: @short_term_objective.errors.messages, status: :unprocessable_entity }\n end\n end\n \n when \"create_evidence\"\n slot_assess_ids = params[:values]\n evidence = params[:text]\n\n respond_to do |format|\n slot_assess_ids.each do |s|\n @evidence = Evidence.new(content: evidence, status: \"New\", slot_assess_id: s)\n unless @evidence.save\n format.json { render json: @evidence.errors.messages, status: :unprocessable_entity } \n end\n end\n format.json { render json: slot_assess_ids }\n end\n \n when \"edit_evidence\"\n @evidence = Evidence.find(params[:data])\n respond_to do |format|\n if @evidence.update_attributes(content: params[:value])\n format.json { render json: @evidence }\n else\n format.json { render json: @evidence.errors.messages, status: :unprocessable_entity }\n end\n end\n\n when \"delete_evidence\"\n respond_to do |format|\n @evidence = Evidence.find(params[:data])\n @comments = Comment.where(evidence_id: params[:data])\n if @evidence.destroy && @comments.destroy_all\n format.json { render json: @evidence }\n else\n format.json { render json: @evidence.errors.messages, status: :unprocessable_entity }\n end\n end\n\n when \"create_obj_evidence\"\n evidence = params[:text]\n obj_assess_id = params[:value]\n obj_type = params[:obj_type]\n\n respond_to do |format|\n\n @evidence = Evidence.new(content: evidence, status: \"New\", :\"#{obj_type}\" => obj_assess_id)\n if @evidence.save\n format.json { render json: @evidence }\n else\n format.json { render json: @evidence.errors.messages, status: :unprocessable_entity } \n end\n end\n\n when \"add_self_value\"\n respond_to do |format|\n @slot_assess = SlotAssess.find(params[:data])\n if @slot_assess.update_attributes(self_value: params[:self_value])\n format.json { render json: @slot_assess }\n else\n format.json { render json: @slot_assess.errors.messages, status: :unprocessable_entity }\n end\n end\n\n when \"add_self_score\"\n respond_to do |format|\n @other_subject_assess = OtherSubjectAssess.find(params[:data])\n if @other_subject_assess.update_attributes(self_score: params[:self_score])\n format.json { render json: @other_subject_assess }\n else\n format.json { render json: @other_subject_assess.errors.messages, status: :unprocessable_entity }\n end\n end\n\n when \"approve_slot_detail\"\n respond_to do |format|\n @slot_assess = SlotAssess.find(params[:data])\n approved_user = User.find(params[:approved_user_id])\n is_bod = params[:role]\n\n unless is_bod.eql?(\"\") #is bod\n p \"Bod\"\n if @slot_assess.update_attributes(value: params[:value], status: \"Passed\", approved_user_id: approved_user.id, is_notified: false)\n User.find(@slot_assess.user.id).update_attributes(new_approved: true)\n @notification2 = Notification.create(user_id: @slot_assess.user.id, obj_user_id: approved_user.id, notification_type: \"approve\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n format.json { render json: @slot_assess }\n else\n format.json { render json: @slot_assess.errors.messages, status: :unprocessable_entity }\n end\n else\n p \"Manager\"\n if @slot_assess.update_attributes(value: params[:value], approved_user_id: approved_user.id, is_notified: true)\n \n # for teamleader notification\n if approved_user.is_team_leader\n # Notify to user\n notification1 = Notification.create(user_id: @slot_assess.user.id, obj_user_id: approved_user.id, notification_type: \"approve\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n\n # Notify to manager -> submit\n manager = User.find(Department.find( @slot_assess.user.main_department_id).manager_id)\n notification2 = Notification.create(user_id: manager.id, obj_user_id: @slot_assess.user.id, notification_type: \"submit\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n end\n\n # for manager notification\n if approved_user.is_manager\n # Notify to user\n @notification = Notification.create(user_id: @slot_assess.user.id, obj_user_id: approved_user.id, notification_type: \"approve\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n \n # Notify to bod -> submit\n bod_users = User.where(is_bod: true).each do |bod_user|\n notification = Notification.create(user_id: bod_user.id, obj_user_id: @slot_assess.user.id, notification_type: \"submit\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n end\n end\n\n # for bod notification\n \n \n format.json { render json: @slot_assess }\n else\n format.json { render json: @slot_assess.errors.messages, status: :unprocessable_entity }\n end\n end\n end\n\n when \"approve_other_subject_detail\"\n respond_to do |format|\n @other_subject_assess = OtherSubjectAssess.find(params[:data])\n approved_user = User.find(params[:approved_user_id])\n is_bod = params[:role]\n\n unless is_bod.eql?(\"\") #is bod\n p \"Bod\"\n if @other_subject_assess.update_attributes(status: \"Passed\", approved_user_id: approved_user.id, score: params[:score], is_notified: false)\n @notification2 = Notification.create(user_id: @other_subject_assess.user.id, obj_user_id: approved_user.id, notification_type: \"approve\", obj_id: @other_subject_assess.id, obj_type: \"other_subject\", is_seen: false)\n format.json { render json: @other_subject_assess }\n else\n format.json { render json: @other_subject_assess.errors.messages, status: :unprocessable_entity }\n end\n else\n p \"Manager\"\n if @other_subject_assess.update_attributes(approved_user_id: approved_user.id, score: params[:score], is_notified: true)\n \n # for teamleader notification\n if approved_user.is_team_leader\n # Notify to user\n notification1 = Notification.create(user_id: @other_subject_assess.user.id, obj_user_id: approved_user.id, obj_type: \"other_subject\", notification_type: \"approve\", obj_id: @other_subject_assess.id, is_seen: false)\n\n # Notify to manager -> submit\n manager = User.find(Department.find( @other_subject_assess.user.main_department_id).manager_id)\n notification2 = Notification.create(user_id: manager.id, obj_user_id: @other_subject_assess.user.id, notification_type: \"submit\", obj_id: @other_subject_assess.id, obj_type: \"other_subject\", is_seen: false)\n end\n\n # for manager notification\n if approved_user.is_manager\n # Notify to user\n @notification = Notification.create(user_id: @other_subject_assess.user.id, obj_user_id: approved_user.id, notification_type: \"approve\", obj_id: @other_subject_assess.id, obj_type: \"other_subject\", is_seen: false)\n \n # Notify to bod -> submit\n bod_users = User.where(is_bod: true).each do |bod_user|\n notification = Notification.create(user_id: bod_user.id, obj_user_id: @other_subject_assess.user.id, notification_type: \"submit\", obj_id: @other_subject_assess.id, obj_type: \"other_subject\", is_seen: false)\n end\n end\n\n # for bod notification\n \n \n format.json { render json: @other_subject_assess }\n else\n format.json { render json: @other_subject_assess.errors.messages, status: :unprocessable_entity }\n end\n end \n end\n\n when \"reject_slot_in_timeline\"\n respond_to do |format|\n @slot_assess = SlotAssess.find(params[:data])\n approved_user = User.find(params[:approved_user_id])\n is_bod = params[:role]\n\n unless is_bod.eql?(\"\") #is bod\n p \"Bod\"\n if @slot_assess.update_attributes(status: \"Not Passed\", approved_user_id: params[:approved_user_id], is_notified: false)\n notification1 = Notification.create(user_id: @slot_assess.user.id, obj_user_id: approved_user.id, notification_type: \"reject\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n notification2 = Notification.create(user_id: Department.find(@slot_assess.user.main_department_id).manager_id, obj_user_id: approved_user.id, notification_type: \"return\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n notification3 = Notification.create(user_id: @slot_assess.user.team_leader_id, obj_user_id: approved_user.id, notification_type: \"return\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n format.json { render json: @slot_assess }\n else\n format.json { render json: @slot_assess.errors.messages, status: :unprocessable_entity }\n end\n else\n p \"Manager\"\n if @slot_assess.update_attributes(approved_user_id: params[:approved_user_id], is_notified: false)\n # for team leader & user notification\n if approved_user.is_manager\n notification1 = Notification.create(user_id: @slot_assess.user.id, obj_user_id: approved_user.id, notification_type: \"reject\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n notification3 = Notification.create(user_id: @slot_assess.user.team_leader_id, obj_user_id: approved_user.id, notification_type: \"return\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n end\n\n # for user notification\n if approved_user.is_team_leader\n notification1 = Notification.create(user_id: @slot_assess.user.id, obj_user_id: approved_user.id, notification_type: \"reject\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n end\n \n format.json { render json: @slot_assess }\n else\n format.json { render json: @slot_assess.errors.messages, status: :unprocessable_entity }\n end\n end\n end\n \n when \"reject_slot_detail\"\n respond_to do |format|\n @slot_assess = SlotAssess.find(params[:data])\n value = params[:value] || 1\n approved_user = User.find(params[:approved_user_id])\n is_bod = params[:role]\n\n unless is_bod.eql?(\"\") #is bod\n p \"Bod\"\n if @slot_assess.update_attributes(value: value, status: \"Not Passed\", approved_user_id: params[:approved_user_id], is_notified: false)\n notification1 = Notification.create(user_id: @slot_assess.user.id, obj_user_id: approved_user.id, notification_type: \"reject\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n notification2 = Notification.create(user_id: Department.find(@slot_assess.user.main_department_id).manager_id, obj_user_id: approved_user.id, notification_type: \"return\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n notification3 = Notification.create(user_id: @slot_assess.user.team_leader_id, obj_user_id: approved_user.id, notification_type: \"return\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n format.json { render json: @slot_assess }\n else\n format.json { render json: @slot_assess.errors.messages, status: :unprocessable_entity }\n end\n else\n p \"Manager\"\n if @slot_assess.update_attributes(value: value, approved_user_id: params[:approved_user_id], is_notified: false)\n # for team leader & user notification\n if approved_user.is_manager\n notification1 = Notification.create(user_id: @slot_assess.user.id, obj_user_id: approved_user.id, notification_type: \"reject\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n notification3 = Notification.create(user_id: @slot_assess.user.team_leader_id, obj_user_id: approved_user.id, notification_type: \"return\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n end\n\n # for user notification\n if approved_user.is_team_leader\n notification1 = Notification.create(user_id: @slot_assess.user.id, obj_user_id: approved_user.id, notification_type: \"reject\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n end\n \n format.json { render json: @slot_assess }\n else\n format.json { render json: @slot_assess.errors.messages, status: :unprocessable_entity }\n end\n end\n end\n\n when \"reject_other_subject_detail\"\n respond_to do |format|\n @other_subject_assess = OtherSubjectAssess.find(params[:data])\n approved_user = User.find(params[:approved_user_id])\n is_bod = params[:role]\n\n unless is_bod.eql?(\"\") #is bod\n p \"Bod\"\n if @other_subject_assess.update_attributes(status: \"Not Passed\", approved_user_id: params[:approved_user_id], is_notified: false)\n notification1 = Notification.create(user_id: @other_subject_assess.user.id, obj_user_id: approved_user.id, notification_type: \"reject\", obj_id: @other_subject_assess.id, obj_type: \"other_subject\", is_seen: false)\n notification2 = Notification.create(user_id: Department.find(@other_subject_assess.user.main_department_id).manager_id, obj_user_id: approved_user.id, notification_type: \"return\", obj_id: @other_subject_assess.id, obj_type: \"other_subject\", is_seen: false)\n notification3 = Notification.create(user_id: @other_subject_assess.user.team_leader_id, obj_user_id: approved_user.id, notification_type: \"return\", obj_id: @other_subject_assess.id, obj_type: \"other_subject\", is_seen: false)\n format.json { render json: @other_subject_assess }\n else\n format.json { render json: @other_subject_assess.errors.messages, status: :unprocessable_entity }\n end\n else\n p \"Manager\"\n if @other_subject_assess.update_attributes(approved_user_id: params[:approved_user_id], is_notified: false)\n # for team leader & user notification\n if approved_user.is_manager\n notification1 = Notification.create(user_id: @other_subject_assess.user.id, obj_user_id: approved_user.id, notification_type: \"reject\", obj_id: @other_subject_assess.id, obj_type: \"other_subject\", is_seen: false)\n notification3 = Notification.create(user_id: @other_subject_assess.user.team_leader_id, obj_user_id: approved_user.id, notification_type: \"return\", obj_id: @other_subject_assess.id, obj_type: \"other_subject\", is_seen: false)\n end\n\n # for user notification\n if approved_user.is_team_leader\n notification1 = Notification.create(user_id: @other_subject_assess.user.id, obj_user_id: approved_user.id, notification_type: \"reject\", obj_id: @other_subject_assess.id, obj_type: \"other_subject\", is_seen: false)\n end\n \n format.json { render json: @other_subject_assess }\n else\n format.json { render json: @other_subject_assess.errors.messages, status: :unprocessable_entity }\n end\n end \n end\n\n when \"withdraw_slot_detail\"\n respond_to do |format|\n @slot_assess = SlotAssess.find(params[:data])\n @user = User.find(@slot_assess.user.id)\n\n \n if @user.team_leader_id\n\n @notification = Notification.where(user_id: @user.team_leader_id, obj_user_id: @user.id, obj_id: @slot_assess.id, obj_type: \"slot\", notification_type: \"submit\").order(\"created_at desc\").first\n if @notification\n if @notification.destroy\n @slot_assess.update_attributes(is_notified: false)\n format.json { render json: @slot_assess }\n else\n format.json { render json: @slot_assess.errors.messages, status: :unprocessable_entity }\n end\n else\n format.text { render text: \"Can't withdraw slot assess without having been notified yet.\"}\n end\n else\n format.text { render text: \"This user's team leader is not availble. Please contact your Administrator to resolve.\"}\n end\n\n end\n\n when \"withdraw_other_subject_detail\"\n respond_to do |format|\n @other_subject_assesses = OtherSubjectAssess.find(params[:data])\n @user = User.find(@other_subject_assesses.user.id)\n\n \n if @user.team_leader_id\n @notification = Notification.where(user_id: @user.team_leader_id, obj_user_id: @user.id, obj_id: @other_subject_assesses.id, obj_type: \"other_subject\", notification_type: \"submit\").order(\"created_at desc\").first\n if @notification\n if @notification.destroy\n @other_subject_assesses.update_attributes(is_notified: false)\n format.json { render json: @other_subject_assesses }\n else\n format.json { render json: @other_subject_assesses.errors.messages, status: :unprocessable_entity }\n end\n else\n format.text { render text: \"Can't withdraw other subject assess without having been notified yet.\"}\n end\n else\n format.text { render text: \"This user's team leader is not availble. Please contact your Administrator to resolve.\"}\n end\n\n end\n\n when \"notify_for_detail\"\n respond_to do |format|\n @slot_assess = SlotAssess.find(params[:data])\n if @slot_assess.self_value\n @user = User.find(@slot_assess.user.id)\n\n if @user.team_leader_id\n @notification = Notification.new(user_id: @user.team_leader_id, obj_user_id: @user.id, notification_type: \"submit\", obj_id: @slot_assess.id, obj_type: \"slot\", is_seen: false)\n if @notification.save\n @slot_assess.update_attributes(is_notified: true)\n format.json { render json: @slot_assess }\n else\n format.json { render json: @slot_assess.errors.messages, status: :unprocessable_entity }\n end\n else\n format.text { render text: \"This user's team leader is not availble. Please contact your Administrator to resolve.\"}\n end\n else\n format.text { render text: \"Please add your self assessment before notify to your manager\"}\n end\n\n end\n\n when \"notify_for_other_subject_detail\"\n respond_to do |format|\n @other_subject_assess = OtherSubjectAssess.find(params[:data])\n if @other_subject_assess.self_score\n @user = User.find(@other_subject_assess.user.id)\n\n if @user.team_leader_id\n @notification = Notification.new(user_id: @user.team_leader_id, obj_user_id: @user.id, notification_type: \"submit\", obj_id: @other_subject_assess.id, obj_type: \"other_subject\", is_seen: false)\n if @notification.save\n @other_subject_assess.update_attributes(is_notified: true)\n format.json { render json: @other_subject_assess }\n else\n format.json { render json: @other_subject_assess.errors.messages, status: :unprocessable_entity }\n end\n else\n format.text { render text: \"This user's team leader is not availble. Please contact your Administrator to resolve.\"}\n end\n else\n format.text { render text: \"Please add your assessment result before notify to your manager\"}\n end\n\n end\n\n when \"update_notification_is_seen\"\n notification_type = []\n notification_type.push(params[:notification_type])\n if params[:notification_type] == \"approve\"\n notification_type.push(\"submit\")\n end\n\n if params[:notification_type] == \"reject\"\n notification_type.push(\"return\")\n end\n\n @user = User.find(params[:data])\n rs = false\n respond_to do |format|\n if @user.notifications.where(notification_type: notification_type).length > 0\n @user.notifications.where(notification_type: notification_type).each do |notification|\n if notification.update_attributes(is_seen: true)\n rs = true\n else\n rs = false\n end\n\n unless rs\n format.json { render json: @user.errors.messages, status: :unprocessable_entity }\n end\n end\n\n if rs\n format.json { render json: @user }\n end\n else\n format.json { render json: @user }\n end\n\n end\n\n\n end\n\n end",
"def index\n @outcome_measure_types = OutcomeMeasureType.all\n end",
"def insert_exam\n question_type = params[:question_type]\n percentage = params[:percentages]\n if percentage.map(&:to_i).sum == 100\n @placement_exam = PlacementExam.new(placement_exam_params)\n @placement_exam.save\n i = 0\n question_type.each do |q|\n Weightage.create(question_type_id: q,\n placement_exam_id: @placement_exam.id,\n percentage: percentage[i])\n i += 1\n end\n redirect_to create_exam_placement_exams_path\n flash[:notice] = t('placement_exam_created')\n else\n render 'create_exam'\n flash[:alert] = t('placement_exam_error')\n end\n end",
"def create\n @outcome_measure_type = OutcomeMeasureType.new(outcome_measure_type_params)\n\n respond_to do |format|\n if @outcome_measure_type.save\n format.html { redirect_to @outcome_measure_type, notice: 'Outcome measure type was successfully created.' }\n format.json { render :show, status: :created, location: @outcome_measure_type }\n else\n format.html { render :new }\n format.json { render json: @outcome_measure_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_result\n @result = Admin::Result.find(params[:id])\n end",
"def update\n @result = Result.find(params[:id])\n @result.name = params[:name]\n\n if params[:type] == \"Statuswechsel\"\n @result.type = \"ResultStateChange\"\n clear_entity\n if params[:selected_state] != nil && params[:selected_state] != \"\"\n @state = State.find(params[:selected_state])\n @result.state = @state\n end\n\n end\n\n if params[:type] == \"Ereignistypen Menge aendern\"\n @result.type = \"ResultChangeEventTypeAmount\"\n clear_entity\n if params[:event_type_operator] != nil && params[:event_type_operator] != \"\"\n @result.event_type_operator = params[:event_type_operator]\n\n if (params[:event_type_operator]) == \"Zur Menge Hinzufuegen\" || (params[:event_type_operator]) == \"Aus Menge entfernen\"\n\n if params[:add_event_types] != nil\n params[:add_event_types].each do |f|\n @event_type = EventType.find(f)\n @result.event_types << @event_type\n end\n end\n end\n end\n end\n\n if params[:info] != nil && (params[:type]) == \"Info\"\n @result.type = \"ResultInfo\"\n clear_entity\n @result.info = params[:info]\n end\n\n if params[:type] == \"Client Sperren\"\n @result.type = \"ResultLock\"\n clear_entity\n end\n\n respond_to do |format|\n if @result.save\n format.html { redirect_to @result, notice: 'Ergebnis wurde erfolgreich aktualisiert' }\n format.json { head :no_content }\n else\n self.reload_edit_params\n format.html { render \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @job_type = params[:job_type].blank? ? \"0\" : params[:job_type]\n @job_type = \"0\"\n if @job_type == \"0\"\n logger.debug @evaluation\n @evaluation = SocietyEvaluation.new\n elsif @job_type == \"1\"\n @evaluation = StudentEvaluation.new\n end\nlogger.debug '@evaluation'\nlogger.debug @evaluation\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @evaluation }\n end\n end",
"def genre\n case result_item.format\n when \"Book\"\n \"book\"\n when :book_item\n \"bookitem\"\n when :conference_paper\n \"proceeding\"\n when :conference_proceedings\n \"conference\"\n when :report\n \"report\"\n when :serial\n \"journal\"\n when \"Article\"\n \"article\"\n else\n nil\n end \n end",
"def act_on_question_types\n case question_type\n when 'yes_no_question' then handle_yes_no_question\n when 'or_question' then handle_or_question\n else\n handle_not_a_question\n end\n end",
"def show\n @discipline_class_exam_type = DisciplineClassExamType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline_class_exam_type }\n end\n end",
"def show\n submission = Submission.get_submission_by_grouping_id_and_assignment_id(\n params[:group_id], params[:assignment_id])\n\n test_result = submission.test_group_results\n .includes(:test_results)\n .find(params[:test_group_result_id])\n .test_results.find(params[:id])\n\n respond_to do |format|\n format.xml{render xml: test_result.to_xml(root:\n 'test_result', skip_types: 'true')}\n format.json{render json: test_result.to_json}\n end\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission or test script result or test result\n render 'shared/http_status', locals: {code: '404', message:\n e}, status: 404\n end",
"def results\n @study = Study.find(params[:study_id])\n if ExtractionFormSection.section_is_included(\"results\", @study.id, params[:extraction_form_id])\n @ef = ExtractionForm.find(params[:extraction_form_id])\n @extraction_form_id = @ef.id\n @is_diagnostic = ExtractionForm.is_diagnostic?(@ef.id)\n # if this is an RCT extraction form, get the existing outcome data entries\n # and any comparison information that go along with them. \n if !@is_diagnostic\n @existing_results = @study.get_existing_results_for_session(@ef.id)\n ocdes = @study.get_data_entries\n @existing_comparisons = OutcomeDataEntry.get_existing_comparisons_for_session(ocdes)\n @study_arms = Arm.find(:all, :conditions=>[\"study_id = ? AND extraction_form_id=?\",@study.id, @ef.id], :order=>\"display_number ASC\", :select=>[\"id\",\"title\",\"description\",\"display_number\",\"extraction_form_id\",\"note\",\"default_num_enrolled\",\"is_intention_to_treat\"])\n # if this is a diagnostic test form, get only the comparison information associated\n # with the results\n else\n @existing_results = []\n @existing_comparisons = []\n comparisons = @study.get_comparison_entries\n @study_arms = nil\n @existing_comparisons, @existing_comparators = OutcomeDataEntry.get_existing_diagnostic_comparisons_for_session(comparisons)\n end\n\n makeStudyActive(@study)\n session[:project_id] = @study.project_id\n @study_extforms = StudyExtractionForm.where(:study_id => @study.id)\n\n @project = Project.find(params[:project_id])\n model = @ef.is_diagnostic == true ? \"DiagnosticTest\" : \"Arm\"\n puts \"\\n\\n-----------------\\n\\nStudy: #{@study.id}\\nEF: #{@ef.id}\\n\\n\"\n @arms_or_tests = model.constantize.where(:study_id=>@study.id, :extraction_form_id=>@ef.id)\n @outcomes = Outcome.find(:all, :conditions=>[\"study_id=? AND extraction_form_id=?\",@study.id, @ef.id], :order=>[\"outcome_type ASC, title ASC\"])\n @cont_outcomes = @outcomes.select{|x| x.outcome_type == \"Continuous\"}\n @cat_outcomes = @outcomes.select{|x| x.outcome_type == \"Categorical\"}\n @survival_outcomes = @outcomes.select{|x| [\"Survival\",\"Time to Event\"].include?(x.outcome_type)}\n\n # FLAG TO NOT SHOW OUTCOME EDIT OPTIONS ON THE OUTCOME LIST\n @noedits = true\n # @cont_outcomes = Outcome.find(:all, :conditions=>[\"study_id=? AND outcome_type=? AND extraction_form_id=?\",@study.id,\"Continuous\",@ef.id],:select=>[\"id\",\"title\",\"units\",\"description\",\"extraction_form_id\"])\n # @cat_outcomes = Outcome.find(:all, :conditions=>[\"study_id=? AND outcome_type=? AND extraction_form_id=?\",@study.id,\"Categorical\",@ef.id],:select=>[\"id\",\"title\",\"units\",\"description\",\"extraction_form_id\"])\n # @survival_outcomes = Outcome.find(:all, :conditions=>[\"study_id=? AND outcome_type IN (?) AND extraction_form_id=?\",@study.id,[\"Survival\",\"Time to Event\"],@ef.id],:select=>[\"id\",\"title\",\"units\",\"description\",\"extraction_form_id\"])\t\t\n @timepoints_hash = Outcome.get_timepoints_hash(@cont_outcomes + @cat_outcomes)\n\n # GET THE SUBGROUPS ASSOCIATED WITH THESE OUTCOMES\n @outcomes = @cont_outcomes + @cat_outcomes + @survival_outcomes\n @outcome_subgroups = Outcome.get_subgroups_by_outcome(@outcomes)\n puts \"OUTCOME SUBGROUPS KEYS IS #{@outcome_subgroups.keys.join(\", \")} AND THE VALUE FOR THIS ONE IS #{@outcome_subgroups[\"90\"]}\\n\\n\"\n @subgroups = @outcome_subgroups.to_json\n else\n flash[\"error\"] = \"That section is not included in the current extraction form.\"\n redirect_to edit_project_study_path(params[:project_id], @study.id)\t\t\t\t\n end\n render :layout=>false\n end",
"def result_params\n params.require(:result).permit(:score, :student_id)\n end",
"def show_within_arm_comparison_measures_form\n\t @selected_timepoints = params[:selected_timepoints]\n\t @comparison_id = params[:comparison_id]\n\t @outcome_type = params[:outcome_type]\n\t @outcome_id = params[:outcome_id]\n\t @subgroup_id = params[:subgroup_id]\n\t @project_id = params[:project_id]\n\t # get a list of all measures\n\t @all_measures = DefaultComparisonMeasure.where(:outcome_type=>@outcome_type.downcase,:within_or_between=>0)\n\t # get the measures for this particular comparison\n\t @selected_measures = ComparisonMeasure.where(:comparison_id=>@comparison_id)\n\t \n\t comparison = Comparison.find(@comparison_id)\n\t unless comparison.nil?\n\t\t @all_user_defined_measures = comparison.get_all_user_defined_measures\n\t\telse\n\t\t\t@all_user_defined_measures = []\n\t\tend\n\n\t\t@show_measures_for = \"Within-Arm Comparison\"\n\t render '/outcome_data_entries/show_measures_form'\n\tend",
"def evaluate\n response = Quiz.find(params[:quiz_id]).evaluate(params[:questions], current_user)\n @answers = response[:answers]\n @nota = response[:grade]\n\n respond_to do |format|\n format.html { render 'evaluate' }\n end\n end",
"def create\n @scam = Scam.new(scam_params)\n\n @scam.result = SCAM_CHECKER.classify scam_params.values.join(' ')\n # @scam.result = SCAM_CHECKER.classify_with_score scam_params.values.join(' ')\n\n respond_to do |format|\n if @scam.save\n format.html { redirect_to @scam, notice: 'Analysis complete' }\n format.json { render :show, status: :created, location: @scam }\n else\n format.html { render :new }\n format.json { render json: @scam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @create_type = params[:new_submit] \n if @create_type == I18n.t('create') #create single record \n @new_type = \"1\"\n @student_attendance = StudentAttendance.new(params[:student_attendance])\n respond_to do |format|\n if @student_attendance.save\n format.html { redirect_to(@student_attendance, :notice => t('student_attendance.title')+\" \"+t('created')) }\n format.xml { render :xml => @student_attendance, :status => :created, :location => @student_attendance }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_attendance.errors, :status => :unprocessable_entity }\n end\n end\n elsif @create_type == I18n.t('student_attendance.create_class_schedule') #create multiple record (by class)\n @new_type = \"2\"\n @student_attendances_all = params[:student_attendances] \n @student_attendances = params[:student_attendances].values.collect {|student_attendance| StudentAttendance.new(student_attendance) }\n if @student_attendances.all?(&:valid?) \n @student_attendances.each(&:save!) # ref: to retrieve each value of @exammarks --> http://railsforum.com/viewtopic.php?id=11557 (Dazen2 007-10-07 05:27:42) \n flash[:notice] = I18n.t(\"saved_all_records\")\n redirect_to :action => 'index'\n else \n flash[:error] = I18n.t('student_attendance.data_invalid')\n render :action => 'new'\n flash.discard\n end \n elsif @create_type == I18n.t('student_attendance.create_intake') #create multiple record (by intake)\n @new_type = \"3\"\n @student_attendances_all = params[:student_attendances] \n @student_attendances = params[:student_attendances].values.collect {|student_attendance| StudentAttendance.new(student_attendance) }\n if @student_attendances.all?(&:valid?) \n @student_attendances.each(&:save!) # ref: to retrieve each value of @exammarks --> http://railsforum.com/viewtopic.php?id=11557 (Dazen2 007-10-07 05:27:42) \n #flash[:notice] = 'Successfully saved all records'\n #params[:student_attendance_ids] = [82,83,84,85,86,87] -testing OK\n flash[:notice] = I18n.t('student_attendance.confirm_complete_attendance')\n params[:student_attendance_ids] = @student_attendances.map(&:id)\n render :action => \"edit_multiple_intake\"\n flash.discard\n else \n flash[:error] = 'Data supplied was invalid.'\n render :action => 'new'\n flash.discard\n end\n end\n end",
"def publish_result\n @exam_group = ExamGroup.shod(params[:format])\n if @exam_group.is_published?\n flag = @exam_group.publish(@exam_group)\n publish_res(flag)\n else\n flash[:alert] = 'Exam scheduled not published'\n end\n redirect_to exams_exam_group_path(@exam_group)\n end",
"def show\n # Find the element and assign it to a global variable\n @entry = @class.find(params[:id]) \n \n # Get all assigned items\n\t\t@assignments = get_assignments(params[:type], params[:id])\n \n # Setup column names for assignments table\n\t\t@column_names = {\n\t\t\t\"keys\" => \"Key\",\n\t\t\t\"endusers\" => \"End User\",\n\t\t\t\"purchasers\" => \"Purchaser\",\n\t\t\t\"purchaseorders\" => \"Purchase Order\"\n\t\t}\n\tend",
"def create\n @qbank_id = ActiveRecord::Base.sanitize_sql(params[:qbank_id])\n @q_option = ActiveRecord::Base.sanitize_sql(params[:q_option])\n if Result.find(params[:result_id]).answers.size > 0\n redirect_to root_path\n else\n Answer.calculate(params[:test_id], @qbank_id, @q_option, current_user.id, params[:result_id])\n respond_to do |format|\n format.html { \n redirect_to user_test_results_details_path(current_user.id, params[:test_id], params[:result_id]), \n notice: 'Đã có kết quả.' \n }\n format.json { render :show, status: :created, location: @answer }\n end\n end\n end",
"def review; end",
"def other_subject_detail\n @user = User.find(params[:user_id])\n @other_subject_assess = OtherSubjectAssess.find(params[:data])\n @approved_user = User.find(@other_subject_assess.approved_user_id).full_name if @other_subject_assess.approved_user_id\n # @description = @other_subject_assess.slot.description.gsub(\". \", \".\\n\")\n # @guideline = @other_subject_assess.slot.guideline.gsub(\". \", \".\\n\")\n\n type = params[:type] || \"\"\n case type\n when \"\"\n @evidences = @other_subject_assess.evidences.limit(3).order(\"created_at desc\")\n when \"last_month\"\n @evidences = @other_subject_assess.evidences.where(\"created_at > ?\", (Time.now - 1.month)).order(\"created_at desc\")\n when \"last_6_months\"\n @evidences = @other_subject_assess.evidences.where(\"created_at > ?\", (Time.now - 6.month)).order(\"created_at desc\")\n when \"last_year\"\n @evidences = @other_subject_assess.evidences.where(\"created_at > ?\", (Time.now - 1.year)).order(\"created_at desc\") \n when \"show_all\"\n @evidences =@other_subject_assess.evidences.order(\"created_at desc\") \n end\n # @recently_added_slots = @user.other_subject_assesses.where(OtherSubjectAssess.arel_table[:status].not_eq(\"Not Added Yet\")).order(\"updated_at desc\")\n\n render :layout => false\n end",
"def grade(given_answer, user = nil, given_comment = nil)\n grade_report = QuestionGradeReport.new\n\n case self.question_type\n when \"single\"\n #puts \"Grading single choice question\"\n grade_report = grade_single_choice(given_answer)\n\n when \"multiple\"\n #puts \"Grading multiple choice question\"\n grade_report = grade_multiple_choice(given_answer)\n\n when \"match\"\n #puts \"Grading match question\"\n grade_report = grade_match_question(given_answer)\n\n when \"data_grid\"\n #todo: add data grid question type, all AJAX\n puts \"Grading daya grid questions\"\n\n when \"text_store\"\n #todo: Add text type question that only gets stored, no scoring\n\n when \"truefalse\"\n #todo: Add true false question type\n grade_report = grade_truefalse_choice(given_answer)\n\n else\n # todo: Raise exception if we got a question type we dont know how to grade\n puts \"ERROR: Do not know how to grade this!!\"\n end\n\n if given_comment\n grade_report.given_answer[\"comment\"] = given_comment.inject({}) do |memo, a|\n name, value = a\n memo[name.downcase] = value if value.present?\n\n memo\n end\n end\n\n grade_report.question_privacy = self.org_question_privacy(user.try :org)\n grade_report.content = self.content\n grade_report.question = self\n grade_report.user = user\n grade_report.save!\n\n return grade_report\n end",
"def create\n @result = Admin::Result.new(result_params)\n if @result.save && @result.result_check\n redirect_to @result, notice: t('notice.created',{model: \"#{t('activerecord.models.admin/result')}\"})\n else\n @games = Admin::Game.none\n @divisions = Admin::Division.none\n render :new\n return\n end\n end",
"def add(result_type)\n mf_debug \"result requested #{result_type}\"\n metric_options = metric_options_for_result_type(result_type)\n generator_class = MetricFu::Generator.get_generator(result_type)\n mf_debug \"result class found #{generator_class}\"\n generator = generator_class.new(metric_options)\n\n result_hash.merge!(generator.generate_result)\n\n generator.per_file_info(per_file_data) if generator.respond_to?(:per_file_info)\n end",
"def index\n #提供了培训班id,学员id,则 index 呈现 指定培训班下的/指定学员的/所有模考成绩\n if (params[:student_id] && params[:training_class_id])\n @student =Student.find(params[:student_id])\n @training_class =TrainingClass.find(params[:training_class_id])\n @examinations =@training_class.examinations\n @scores=@student.scores\n\n render 'index_with_all_examinations'\n\n elsif (params[:examination_id]) #指定了某次模考,则index 呈现关于此次模考所有有此模考成绩(所有学员的)\n @examination =Examination.find(params[:examination_id])\n @training_class =@examination.training_class\n @training_class_students =@training_class.students\n @scores=@examination.scores\n render 'index_for_all_students'\n else #默认情况下,则呈现数据库的所有 score 记录\n\n\n end\n end",
"def answer_form(type='html')\n if type.to_s == 'html'\n exercise_type.answer_partial\n end\n end",
"def result\n\n end",
"def add(result_type)\n mf_debug \"result requested #{result_type}\"\n clazz = MetricFu.const_get(result_type.to_s.gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase })\n mf_debug \"result class found #{clazz}\"\n metric_options = metric_options_for_result_type(result_type)\n inst = clazz.new(metric_options)\n\n result_hash.merge!(inst.generate_result)\n\n inst.per_file_info(per_file_data) if inst.respond_to?(:per_file_info)\n end",
"def show\n @examination_kind = ExaminationKind.find(params[:id])\n respond_to do |format|\n format.xml { render :xml => @examination_kind }\n end\n end",
"def exams_statistics\n end",
"def index\n @examination_kinds = ExaminationKind.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @examination_kinds }\n end\n end",
"def update_exam_score\n @exam = Exam.shod(params[:id])\n @exam_group = @exam.exam_group\n @batch = @exam_group.batch\n grades = @exam.exam_group.batch.grading_levels.order(min_score: :asc)\n @temps = params[:exams][:exam]\n @exam.score_exam(@temps, @batch, @exam, @exam_group, grades)\n exam\n end",
"def show\n case @user.action\n when \"CofA\"\n @action = \"Change Of Address\"\n when \"AR\"\n @action = \"Annual Report\"\n end\n end",
"def create\n @exam = Exam.new(params[:exam])\n\n respond_to do |format|\n if @exam.save\n format.html { redirect_to @exam, notice: 'Exam was successfully created.' }\n format.json { render json: @exam, status: :created, location: @exam }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.620552",
"0.6189071",
"0.6129202",
"0.60192055",
"0.5950334",
"0.59310293",
"0.58985204",
"0.58715355",
"0.58357334",
"0.57796127",
"0.576083",
"0.57585895",
"0.57585895",
"0.56722754",
"0.565495",
"0.5603482",
"0.55952436",
"0.5567693",
"0.55228853",
"0.54315674",
"0.5425949",
"0.542474",
"0.54246527",
"0.54195327",
"0.5418898",
"0.5414196",
"0.54029816",
"0.5396313",
"0.53914803",
"0.5371349",
"0.5366115",
"0.533563",
"0.5333995",
"0.5333988",
"0.53027",
"0.5296579",
"0.528817",
"0.52817637",
"0.52773845",
"0.52654237",
"0.5263706",
"0.5255932",
"0.5218216",
"0.52173924",
"0.52148074",
"0.521429",
"0.5214178",
"0.5214178",
"0.5214178",
"0.5214178",
"0.5214178",
"0.5214178",
"0.5214178",
"0.5214178",
"0.5214178",
"0.52130485",
"0.5209973",
"0.52017003",
"0.51889753",
"0.5188665",
"0.51752853",
"0.51557803",
"0.5155152",
"0.5154717",
"0.5154579",
"0.51536435",
"0.51533103",
"0.51446384",
"0.51350707",
"0.5123455",
"0.51218337",
"0.5108536",
"0.5105166",
"0.5101056",
"0.5093907",
"0.509108",
"0.50872546",
"0.5084876",
"0.5068476",
"0.5052927",
"0.505228",
"0.5050896",
"0.5039221",
"0.5030984",
"0.5028534",
"0.50282806",
"0.50277364",
"0.5026633",
"0.50243485",
"0.50237006",
"0.50206226",
"0.50205827",
"0.5020156",
"0.5018933",
"0.5013846",
"0.50135034",
"0.5012253",
"0.5008856",
"0.50085175",
"0.5007661"
] |
0.64122814
|
0
|
Calculate the total score for subject.
|
def exam_total(subject, total)
exam = exam_data(subject)
return if exam.nil?
total.to_f + exam.maximum_marks.to_f
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def score\n @subject.score\n end",
"def total_score\n\t\t0 + score_one.to_i + score_two.to_i + score_three.to_i + score_four.to_i\n\tend",
"def total_score\n plays.inject(0) { |sum, word| sum + Scoring.score(word) }\n end",
"def get_total_score\n scores.map(&:score).sum\n end",
"def get_total_score\n\t\tquestion_scores = Question_score.for_game_record(self.id)\n\t\tscore = 0\n\t\tquestion_scores.length.times do |i|\n\t\t\tscore += question_scores[i].score\n\t\tend\n\t\tscore\n\tend",
"def total_score\n\t\t@array = []\n\t\tself.attributes.each do |key, value|\n\t\t\tif key.to_s =~ /^score/\n\t\t\t\t@array << value\n\t\t\tend\n\t\tend\n\t\tunless @array ==[]\n\t\t\treturn @array.reduce(:+)\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend",
"def total_score\n return @plays.reduce(0) { |memo, word| memo + Scrabble::Scoring.score(word) }\n end",
"def get_alternative_total_score()\n # TODO The method get_total_score() above does not seem correct. Replace with this method.\n total_score = 0\n\n self.scores.each { |score| total_score = total_score + score.score }\n\n total_score\n end",
"def compute_total_score(scores)\n total = 0\n self.questionnaires.each do |questionnaire|\n total += questionnaire.get_weighted_score(self, scores)\n end\n return total\n end",
"def total_score \n \t\t@scores_array.reduce(0, :+) \n\tend",
"def score\n @score ||= (\n total = 0\n words.each do |word, rank|\n total += score_word(word, rank)\n end\n total\n )\n end",
"def total_score\n sum = 0\n @array_of_words.each do |a_word|\n sum+= Scrabble::Scoring.score(a_word)\n end\n return sum\n end",
"def average_score\n return nil if metrics.empty?\n totals = grades.includes(:subject).group_by(&:subject).map { |_, grades|\n grades.sum(&:weighted_score) }\n return 0 if totals.empty?\n totals.sum.to_f / totals.length\n end",
"def get_total_score\n total_score = 0\n \n self.map.questionnaire.questions.each{\n | question |\n item = Score.find_by_response_id_and_question_id(self.id, question.id)\n if(item != nil)\n total_score += item.score\n end\n } \n return total_score \n end",
"def total_score\n total_score = 0\n plays.each do |word|\n total_score += Scrabble::Scoring.score(word)\n end\n return total_score\n end",
"def total_score\n score || 0 #pos - neg\n end",
"def print_total_score\n calculate_score\n end",
"def total_score\n sum = self.games.sum{|game|game.points}\n sum.to_i / self.games.count\n end",
"def total_score(play)\n sum = 0;\n play.decision_array.each_with_index{|v, i|\n sum += 1 if v == decision_array[i] && i != 0 # exclude an example\n }\n sum\n end",
"def calculate_score(matches, total)\n # divide scores by our highest score for a range of 0 - 1, \n # then multiply by 10 for our 1-10 scoring.\n @prescore = (matches.count.to_f / total.to_f)\n if matches.count.to_f == 0.0 # if there are no tweets\n @@score = 0 # assign this to be 0 value\n else\n @@score = (matches.count.to_f / total.to_f) / 0.004574170332\n end\n end",
"def total_score(account,assign)\n total_sum = 0.00\n categories = score_categories(account,assign)\n non_null = 0\n\n p categories\n categories.each do |k,v|\n k == \"skills\" && v != 0 ? total_sum += v[:total_skills] : total_sum += v\n get_assoc(assign,k).size > 0 ? non_null +=1 : non_null = non_null\n end\n return total_sum/non_null\n end",
"def total\n @frame.inject(0){|rez, item| item ? rez + item[:score] : rez }\n end",
"def update_total_score\n @total_score += @score\n end",
"def total_score\n total = 0\n @cards.each do |card|\n total += card.value\n end\n\n sorted_cards = @cards.sort\n\n straights = get_straight(sorted_cards).reverse\n straights.each do |straight|\n total += 40\n sorted_cards.slice!(straight[0]..straight[1])\n end\n\n three_cards = get_number_of_a_kind(sorted_cards, 3)\n three_cards.each do |three|\n total += 20\n sorted_cards.slice!(three[0]..three[1])\n end\n\n pairs = get_number_of_a_kind(sorted_cards, 2)\n pairs.each do |pair|\n total += 10\n sorted_cards.slice!(pair[0]..pair[1])\n end\n\n total\n end",
"def calculate_final_score\n self.scores.average(:total_score)\n end",
"def score\n # add score caching\n total = 0\n self.votes.each do |vote|\n total += vote.value\n end\n total\n end",
"def total_score_skill(account,assign)\n score_categories = score_skills_assign(account,assign)\n sum = 0.00\n categories = (assign.skills.map{|h| h.category}).uniq\n\n score_categories.each do |k,v|\n sum += v\n end\n\n total = sum / categories.size\n end",
"def homework_total(student_id)\n @h_total = 0\n @h_earned = 0\n Grade.find_all_by_student_id(student_id).each do |grade|\n Task.find_all_by_id_and_category_id(grade.task_id, 1).each do |homework|\n @h_total += homework.total\n @h_earned += grade.earned\n end\n end\n if @h_total != 0 then return (@h_earned.percent_of(@h_total))*homework_weight else return 0 end\n end",
"def total_score\n Scrabble::Scoring.make_array_of_scores(@plays_array)\n @total_score_instance = Scrabble::Scoring.return_array_of_scores.inject(0, :+)\n end",
"def build_score(sub, mark, parent_subject_id = nil)\n subject_comp = sub_components.find_by(:type => sub.class.name, :obj_id => sub.id, :parent_subject_id => parent_subject_id)\n return unless subject_comp\n score = new_score(sub,mark,subject_comp)\n if sub.class.name == 'Subject'\n add_to_score_hash(sub, score.score.to_f)\n unless sub.exclude_for_final_score\n @total_score += score.score.to_f if sub.batch_subject_group_id.present? ? (sub.batch_subject_group.calculate_final ? false : true ) : true\n @total_max += score.max_score.to_f if (score.score.present? or score.is_absent) and (sub.batch_subject_group_id.present? ? (sub.batch_subject_group.calculate_final ? false : true ) : true)\n end\n elsif sub.class.name == 'BatchSubjectGroup' and sub.calculate_final\n @total_score += score.score.to_f \n @total_max += score.max_score.to_f if (score.score.present? or score.is_absent)\n end\n @scores.push score\n end",
"def score\n return @score\n end",
"def score\n @rolls.reduce(:+)\n end",
"def score\n total = 0\n docs = 0\n [@classes, @modules, @methods, @constants, @attrs].each do |collection|\n collection.each do |item|\n total += 1\n docs += 1 if item\n end\n end\n return 100 if total == 0\n return ((docs.to_f / total) * 100).to_i\n end",
"def score\n l = comments.length.to_f\n return 0 if l.zero?\n\n (comments.reduce(0) { |p, a| p + a.score } / l).round(1)\n end",
"def get_score (cards)\n\t\tscore = 0\n\t\tcards.each do |card|\n\t\t\tmeasure = card[0]\n\t\t\tscore += @score[measure]\n\t\tend\n\t\tscore\n\tend",
"def score\n votes.sum(:vote)\n end",
"def total_score(precision: nil, **opt)\n result = get_scores(**opt).values.compact.sum\n # noinspection RubyMismatchedArgumentType\n precision ? result.round(precision) : result\n end",
"def accumulate_summary_totals( score )\n @summary_totals[score] ||= 0\n @summary_totals[score] += 1\n end",
"def score\n total = 0\n achievements.each do |a|\n total += a.task.score\n end\n total\n end",
"def score\n @result.to_i\n end",
"def score\n @scoreTotal = @jogadas[0].down_pin + @jogadas[1].down_pin\n end",
"def score_calc\n\t\tif self.saturday.blank?\n\t\t\tscore = 0\n\t\telse\n\t\t\tscore = self.saturday + self.hobby + self.major + self.sleep + self.music\t\n\t\tend\n\t\treturn score\n\tend",
"def total_score(scores) #scores needs to be an array of floats\n\toverall_score = 0\n\tscores.each { |num| overall_score += num}\n\toverall_score\nend",
"def score\n @score || calculate_score\n end",
"def calculate\n score = 0\n\n names.each do |name|\n current_score = 0\n name_score = 0\n\n name.split('').each do |letter|\n current_score += LETTER_SCORES[letter]\n name_score = current_score\n end\n\n current_score *= names.index(name) + 1\n score += current_score\n end\n\n score\n end",
"def score(answered)\n score = 0\n answered.each do |a|\n score += a.value\n end\n # TODO: Decide whether safeguarding against negative scoring is worth it\n if (score < 0)\n score = 0\n end\n return score\n end",
"def overall_score(label_scores)\n label_scores.compact!\n label_scores.reduce { |acc, e| acc + e }.to_f / label_scores.size\n end",
"def citation_score\n total = 0\n traverse_tree do |citation, depth|\n total += citation.score_at(depth)\n end\n\n return total\n end",
"def score\n @cards.map(&:value).inject(:+)\n end",
"def user_score\n total_score = 0\n score.each do |_phase, categories|\n total_score += categories.reject { |category| category.include? \"oath\" }.count { |category| category[1] >= 80 }\n end\n total_score\n end",
"def score; end",
"def score\n s = Settings.instance\n s.faculty_weight.to_f * (s.rank_weight.to_f/self.rank.to_f + s.mandatory_weight.to_f*(self.mandatory ? 1.0 : 0.0))\n end",
"def res_score\n return 0 if report.users.size == 0\n ((report.unique_recipient_count / report.users.size.to_f) * 100).round(2)\n end",
"def res_score\n return 0 if report.users.size == 0\n ((report.unique_recipient_count / report.users.size.to_f) * 100).round(2)\n end",
"def score\n @score\n end",
"def score\n documented = @files.inject(0) {|sum, file| sum += file.total_documented }\n total = @files.inject(0) {|sum, file| sum += file.total_entities }\n ((documented.to_f / total) * 100).to_i\n end",
"def score\n end",
"def subject_result(subject)\n mutation_results = @aggregate[subject].sort_by(&:index)\n\n Result::Subject.new(\n subject: subject,\n runtime: mutation_results.map(&:runtime).inject(0.0, :+),\n mutation_results: mutation_results\n )\n end",
"def total_score\n\t\tall_scores = picks.collect { |pick|\n\t\t\tpicks_golfers = TournamentGolfer.where(golfer_id: pick.golfer_id, tournament_id: pick.pool.tournament_id).pluck(:total)[0]\n\t\t} - [nil] - [\"CUT\"]\n\t\tif all_scores.count < 5\n\t\t\treturn \"DQ\"\n\t\telse \n\t\t\tall_scores = all_scores.map {|score| score.to_i}\n\t\t\tall_scores = all_scores.sort\n\t\t\treturn all_scores[0..(pool.number_golfers_for_scoring-1)].sum\n\t\tend\n\tend",
"def total_score_language(account,assign)\n common = (assign.languages & account.languages).size\n total = assign.languages.size\n return (common * 100.00) /total\n end",
"def score(sentence)\n total_scores = 0\n rep_array = @sent_rep_compiler.compile(sentence)\n rep_array.each { |word| total_scores += @wts_scores_obj[word.id] }\n total_scores / rep_array.length\n end",
"def score\n while @current_roll < @rolls.size - 1\n init_roll\n\n if strike?\n score_strike\n elsif spare?\n score_spare\n else\n score_normal\n end\n end\n\n return @total_score\n end",
"def score\n while @current_roll < @rolls.size - 1\n init_roll\n\n if strike?\n score_strike\n elsif spare?\n score_spare\n else\n score_normal\n end\n end\n\n return @total_score\n end",
"def calculateScore\n\t\tif @game\n @score += [@gridPick.associatedTimer-@game.time,0].max\n\t\telse\n\t\t\t@score = 0\n\t\tend\n\tend",
"def score\n populate_frames.inject(0) {|a,v| a+ v.frame_total}\n end",
"def score\n return @score if @score != -1\n prod =\n [p_bases_covered, 0.01].max.to_f * # proportion of bases covered\n [p_not_segmented, 0.01].max.to_f * # prob contig has 0 changepoints\n [p_good, 0.01].max.to_f * # proportion of reads that mapped good\n [p_seq_true, 0.01].max.to_f # scaled 1 - mean per-base edit distance\n @score = [prod, 0.01].max\n end",
"def score\n calculator.score\n end",
"def score\n dealt.inject(0){|sum,card| sum + card.value}\n end",
"def process_scores\n applicable_subjects = []\n subjects.group_by(&:batch_subject_group).each_pair do |batch_group, batch_subjects|\n (batch_subjects << batch_group).compact.each do |sub|\n applicable_subjects << sub\n end\n end\n applicable_subjects.sort_by{|as| as.priority.to_i}.each do|sub|\n mark = student.converted_assessment_marks.detect{|cam| cam.markable_id == sub.id and \n cam.markable_type == sub.class.name and cam.assessment_group_batch_id == agb.id}\n next unless mark\n build_score(sub, mark)\n process_skills(sub,mark) if consider_skills_of_subjects(sub)\n process_attributes(sub, mark, agb.subject_attribute_assessments) if agb.subject_attribute_assessments.present? and sub.is_a?(Subject)\n end\n\n add_to_exam_totals_hash(@total_score)\n end",
"def score\r\n @health + points\r\n end",
"def total_score\n rank_items.to_a.sum { |item| item.rank_score * item.weight }\n end",
"def calculate_score\n @results.collect { |mir| mir.send(@column.to_sym) }.sum\n end",
"def score_factor_count\n com_count = self.complaints.finished.count\n dep_review_count = count_scorable_department_reviews\n city_review_count = count_scorable_city_reviews\n petition_count = self.petitions.finished.count\n return score_count = com_count + dep_review_count + city_review_count + petition_count\n end",
"def get_summary_score\n\t\t(self.taste_score + self.value_score + self.on_time_score)/3\n\tend",
"def calculate_score\n #set default user score value to 0 in the database but to prevent any errors and remove database dependencies i am including this line in the model as well\n score || 0\n self.games.each do |game|\n score+=game.points\n end\n score\n end",
"def exam_mar(subject, student, marks)\n exam = exam_data(subject)\n exam_score = exam.scores(student)\n return if exam.nil?\n marks.to_f + exam_score.marks.to_f\n end",
"def score\n @months.each_pair do |name, actions|\n @score += MonthlyScore.new(accounts).process(actions)\n end\n @score\n end",
"def calculate_marks\n stream = Stream.find(stream_id)\n sub_maps = stream.sub_str_maps.all\n xuser = self.user\n xcategory = xuser.personal.category\n xacademic = xuser.academic\n tenth_mark = xacademic.tenth_marks\n user_subs = xacademic.subject_entries.all\n total_special_sub = sub_maps.count\n total = 0\n user_subs.each do |us|\n total += us.marks\n sub_maps.each do |sm|\n if us.subject_id == sm.subject_id\n total += us.marks\n end\n end\n end\n self.calculated_marks = total*10000 + tenth_mark\n end",
"def compute_score\n\n total_score=0\n total_weights=0\n self.class.field_mappings.each do |field_name,field_config|\n if !field_config[:weight].blank?\n total_score += field_config[:weight].to_f * (self.class.blank_value?(self.send(field_name)) ? 0 : 1) # if the field is blank, it is a 0 regardless of weight, otherwise it is a 1 times its weight\n total_weights += field_config[:weight].to_f\n end\n end\n\n return ((total_score/total_weights)*100).ceil\n\n end",
"def calculate_score\n # @frames.flatten.compact.map(&:to_i).sum\n # @frames.map.with_index { |k, i| Frame.new((i+1), k.first, k.last).sum }.sum\n #my_frames = frames\n\n # TODO: actually calculate the score magically\n\n # Previous implementation\n # my_frames.map(&:sum).sum\n Frame.final_scoring(frames)\n end",
"def score\n while @current_roll < @rolls.size - 1\n init_roll\n\n if strike?\n score_strike\n elsif spare?\n score_spare\n else\n score_roll\n end \n end\n \n return @total_score\n end",
"def player_score(score)\n @grand_total += (score)\n end",
"def score\n 3*@tally + 5*@strength + 2*@wealth + @food + 30*@monsters_killed\n end",
"def score\n return @score unless @score.nil?\n\n @score = 0\n letters = @word.chars\n loop{ @score += @path.next * tiles_weights[letters.next] }\n @score\n end",
"def score\n w = 0.3\n time = diff_time()\n sum_goods = goods()\n sum_bads = bads()\n total = sum_goods + sum_bads\n (w * sum_goods * (sum_goods/total.to_f)**3 * (total/time)).floor\n end",
"def score\n @score ||= phonetic_levenshtein_distance + penalties\n end",
"def calculate_total_stat(items, stat)\n score = 0\n items.each do |i|\n score += i[stat]\n end\n return score\nend",
"def overall\n avg = @difficulty = @mood = @teaching_skills = 0.0\n @exams_difficulty = @helpfulness = 0.0\n count = 0 + sections.count\n count = 1 if count.zero?\n sections.each do |section|\n avg += section.professor_overall\n @difficulty += section.professor_difficulty\n @teaching_skills += section.professor_teaching\n @mood += section.professor_mood\n @exams_difficulty += section.professor_exam\n @helpfulness += section.professor_helpfulness\n end\n\n @difficulty /= count\n @teaching_skills /= count\n @mood /= count\n @exams_difficulty /= count\n @helpfulness /= count\n avg / count\n end",
"def sum_score\n my_activity_types.sum{|actype| actype.risk_score}\n end",
"def calculate_score\n raise \"Override and return the metric's score\"\n end",
"def score\n @total_score = 0\n @current_roll = 0\n @frame = 1\n\n while rolls?\n set_roll_logic\n if @frame > 10\n return @total_score\n else\n score_frame\n end\n end\n return @total_score\n end",
"def average_score\n numbers_without_zeros = self.comments.map{|comment| comment.overall_score}.reject{|n| n==0}\n return 0 if numbers_without_zeros == []\n preround = numbers_without_zeros.inject(:+)/numbers_without_zeros.count.to_f\n return preround.round\n end",
"def score\n return 0 unless valid?\n 100 * card_value_decimal * 15 ** 5\n end",
"def score_normal\n @total_score += @roll + @next_roll\n @current_roll +=2\n end",
"def score\n\n # Initialise local counters\n scoreCounter = 0\n rollIndex = 0\n frameIndex = 0\n\n # Block to run over all frames\n @rolls.each do |roll|\n if frameIndex < 10\n if strike?(rollIndex)\n # A strike means a special score and the frame is cleared in one roll\n scoreCounter += strikeScore(rollIndex)\n rollIndex += 1\n elsif spare?(rollIndex)\n # A strike means a special score and the frame is cleared in two rolls\n scoreCounter += spareScore(rollIndex)\n rollIndex += 2\n else\n # A strike means a regular score and the frame is cleared in two rolls\n scoreCounter += regularScore(rollIndex)\n rollIndex += 2\n end\n frameIndex += 1\n end\n end\n\n # Return value\n scoreCounter\n\n end",
"def average_score\n count = 0.0\n avrg = 0.0\n if self.cadets.empty?\n return 0.0\n else\n self.cadets.each do |cdt|\n unless cdt.discharged?\n avrg += cdt.average_score\n count += 1.0\n end\n end\n return count != 0.0 ? (avrg/count).round(1) : 0.0\n end\n end",
"def sum_score\n my_activity_types_by_log.sum{|actype| actype.risk_score}\n end",
"def score\n total_score = 0\n current_roll = 0\n\n while current_roll < @rolls.size - 1\n roll = @rolls[current_roll]\n next_roll = @rolls[current_roll + 1]\n\n if roll == 10 #strike\n total_score += 10 + @rolls[current_roll + 1] + @rolls[current_roll + 2]\n current_roll += 1\n elsif roll + next_roll == 10 #spare\n total_score += 10 + @rolls[current_roll + 2]\n current_roll += 2\n else #normal players\n total_score += roll + next_roll\n current_roll += 2\n end\n end\n\n return total_score\n end",
"def calculate_score(values)\n total = 0\n values.each do |card|\n total += card\n if total > 21 && card == 11\n total -= 10\n end\n end\n total\n end",
"def get_topic_score(topic)\n return calculate_score(lemmas_hash[topic]) if lemmas_hash[topic]\n end"
] |
[
"0.7412788",
"0.7293385",
"0.7287903",
"0.7121858",
"0.7106809",
"0.702995",
"0.69775045",
"0.69596213",
"0.69345564",
"0.68649745",
"0.6834966",
"0.6789869",
"0.67487013",
"0.6735753",
"0.6709669",
"0.6680427",
"0.6653593",
"0.6645651",
"0.6567231",
"0.6567094",
"0.6565219",
"0.6551462",
"0.6510414",
"0.65045124",
"0.6498541",
"0.647756",
"0.64348584",
"0.64304215",
"0.64293927",
"0.6427411",
"0.6384889",
"0.63751644",
"0.63169414",
"0.63016313",
"0.6293334",
"0.62575626",
"0.6243038",
"0.6231945",
"0.6231864",
"0.6205349",
"0.61856943",
"0.61850065",
"0.6184174",
"0.61763763",
"0.61552507",
"0.61521417",
"0.614498",
"0.61434853",
"0.6121075",
"0.60995317",
"0.6082682",
"0.6041101",
"0.60376805",
"0.60376805",
"0.6019453",
"0.59944206",
"0.59836453",
"0.59819376",
"0.59789675",
"0.59784424",
"0.597336",
"0.5973075",
"0.5973075",
"0.5971734",
"0.5971665",
"0.59672993",
"0.596443",
"0.5942034",
"0.59408104",
"0.59284616",
"0.59266335",
"0.5924536",
"0.5913288",
"0.59121096",
"0.5905756",
"0.5872542",
"0.58660364",
"0.58638",
"0.5861055",
"0.58577806",
"0.5853167",
"0.58530885",
"0.5853053",
"0.5848137",
"0.5832445",
"0.583138",
"0.58220285",
"0.58085954",
"0.5795683",
"0.5790899",
"0.57895434",
"0.5786917",
"0.57851386",
"0.5778694",
"0.57709754",
"0.5769705",
"0.57631695",
"0.5757741",
"0.5750998",
"0.5743364"
] |
0.72159237
|
3
|
Calculating the exam marks.
|
def exam_mar(subject, student, marks)
exam = exam_data(subject)
exam_score = exam.scores(student)
return if exam.nil?
marks.to_f + exam_score.marks.to_f
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def exam_marks(subject, student)\n exam = exam_data(subject)\n exam_score = exam.scores(student)\n unless exam_score.nil?\n if exam.nil?\n result = 'NA'\n else\n exam_score.nil? ? result = '-' : result = type_result(exam, exam_score)\n end\n result\n end \n end",
"def calculate_marks\n stream = Stream.find(stream_id)\n sub_maps = stream.sub_str_maps.all\n xuser = self.user\n xcategory = xuser.personal.category\n xacademic = xuser.academic\n tenth_mark = xacademic.tenth_marks\n user_subs = xacademic.subject_entries.all\n total_special_sub = sub_maps.count\n total = 0\n user_subs.each do |us|\n total += us.marks\n sub_maps.each do |sm|\n if us.subject_id == sm.subject_id\n total += us.marks\n end\n end\n end\n self.calculated_marks = total*10000 + tenth_mark\n end",
"def marks; end",
"def show\n @exam_result = Xmt::Test::ExamResult.find(params[:id])\n @total_marks = @exam_result.question_scores.sum(:marks)\n end",
"def calculate_marks(academic_record)\n marks = Hash.new\n marks[:sub1] = academic_record.sub1_marks.to_i if academic_record.sub1_marks\n marks[:sub2] = academic_record.sub2_marks.to_i if academic_record.sub2_marks\n marks[:sub3] = academic_record.sub3_marks.to_i if academic_record.sub3_marks\n marks[:sub4] = academic_record.sub4_marks.to_i if academic_record.sub4_marks\n marks[:sub5] = academic_record.sub5_marks.to_i if academic_record.sub5_marks\n marks[:sub6] = academic_record.sub6_marks.to_i if academic_record.sub6_marks\n marks[:sub7] = academic_record.sub7_marks.to_i if academic_record.sub7_marks\n marks[:sub8] = academic_record.sub8_marks.to_i if academic_record.sub8_marks\n marks[:sub9] = academic_record.sub9_marks.to_i if academic_record.sub9_marks\n marks[:sub10] = academic_record.sub10_marks.to_i if academic_record.sub10_marks\n\n marks = marks.sort {|x,y| y[1] <=> x[1]}.to_h\n array_marks = marks.values\n best4_marks = array_marks[0].to_i + array_marks[1].to_i + array_marks[2].to_i + array_marks[3].to_i\n\n calculated_marks = 1000000*best4_marks + 10000*academic_record.hs_marks_percent + 100*academic_record.tenth_marks_percent + academic_record.hs_year_pass-2000\n if academic_record.hs_board.downcase.eql?priority_board\n calculated_marks += priority_marks\n end\n calculated_marks\n end",
"def generate_marks\n exams.attending.each do |e|\n e.update_attribute :result, Course::VALID_MARKS.sample\n end\n end",
"def results(marks)\n # your code here\n avg = (marks.reduce(:+) / (marks.length).to_f).round(3)\n\n scores = {\n \"h\"=> 0,\n \"a\"=> 0,\n \"l\"=> 0\n }\n\n marks.each do |i|\n if i > 8\n scores[\"h\"] += 1\n elsif i == 7 || i == 8\n scores[\"a\"] += 1\n else \n scores[\"l\"] += 1\n end\n end\n if scores[\"a\"] == 0 && scores[\"l\"] == 0\n result = [avg, scores, 'They did well']\n else\n result = [avg, scores]\n end\n result\nend",
"def results(marks)\n dict = {'h' => 0, 'a'=> 0, 'l'=> 0}\n\n list = [(marks.sum.to_f / marks.count).round(3)]\n dict['h'] = marks.select { |m| m == 9 || m == 10 }.count\n dict['a'] = marks.select { |m| m == 7 || m == 8 }.count\n dict['l'] = marks.select { |m| m.between?(1,6) }.count\n list << dict\n dict['a'] == 0 && dict['l'] == 0 ? list << \"They did well\" : list\nend",
"def get_marks_in_subject(subject)\n self.subject_mark_mapping.each { |subjectMarkMap|\n if subjectMarkMap.subject && subjectMarkMap.subject.name == subject\n return subjectMarkMap.marks\n end\n }\n return 0;\n end",
"def marks(my_answers, correct_answers)\n marks = 0\n wrong = []\n my_answers.each_with_index do |x,i|\n if x == correct_answers[i]\n marks += 1\n else\n wrong << i + 1\n end\n end\n puts \"I scored #{marks} out of 20\"\n puts \"I got these questions wrong:\"\n puts wrong.empty? ? \"None!!\" : wrong.join(\",\") \nend",
"def exam_total(subject, total)\n exam = exam_data(subject)\n return if exam.nil?\n total.to_f + exam.maximum_marks.to_f\n end",
"def set_exam_mark\n @exam_mark = ExamMark.find(params[:id])\n end",
"def result\n @exam = current_exam(params)\n\n @exam_reporter = @exam.evaluate(params[:answers])\n end",
"def set_autotest_marks\n test_run = test_runs.first\n return if test_run.nil? || test_run.test_group_results.empty?\n\n result = get_latest_result\n complete_marks = true\n result.create_marks # creates marks for any new criteria that may have just been added\n result.marks.each do |mark|\n test_groups = mark.criterion.test_groups\n if test_groups.empty? # there's at least one manually-assigned mark\n complete_marks = false\n next\n end\n # don't update mark if there is an error\n next if test_run.test_group_results\n .exists?(error_type: TestGroupResult::ERROR_TYPE.slice(:no_results, :test_error).values)\n\n all_marks_earned = 0.0\n all_marks_total = 0.0\n test_groups.each do |test_group|\n res = test_run.test_group_results.find_by(test_group: test_group)\n all_marks_earned += res&.marks_earned || 0.0\n all_marks_total += res&.marks_total || 0.0\n end\n if all_marks_earned == 0 || all_marks_total == 0\n final_mark = 0.0\n elsif all_marks_earned >= all_marks_total\n final_mark = mark.criterion.max_mark\n elsif mark.criterion.is_a? CheckboxCriterion\n final_mark = 0\n else\n final_mark = (all_marks_earned / all_marks_total * mark.criterion.max_mark).round(2)\n if mark.criterion.instance_of? RubricCriterion\n # find the nearest mark associated to a level\n nearest_mark = mark.criterion.level_with_mark_closest_to(final_mark).mark\n final_mark = nearest_mark\n end\n end\n mark.mark = final_mark\n mark.save\n end\n\n # all marks are set by tests, can set the marking state to complete\n if complete_marks\n result.marking_state = Result::MARKING_STATES[:complete]\n result.save\n end\n end",
"def exams_info\n averege_scores = 0\n exams_accounted_scores = 0\n total_views = 0\n self.exams.each do |exam|\n total_views = total_views + exam.views\n\n if exam.feedback_avarage >= 0\n averege_scores = averege_scores + exam.feedback_avarage\n exams_accounted_scores = exams_accounted_scores + 1\n end\n end\n\n if exams_accounted_scores > 0\n averege_scores = averege_scores / exams_accounted_scores\n end\n\n return {averege_scores: averege_scores, total_views: total_views}\n end",
"def get_total_mark\n user_visibility = is_a_review? ? :peer_visible : :ta_visible\n Result.get_total_marks([self.id], user_visibility: user_visibility)[self.id]\n end",
"def exam\n if @errors.nil?\n redirect_to exam_score_exam_path(@exam)\n else\n @students = []\n students ||= @exam.exam_group.batch.students.all\n @students = @exam.select_subject(@students, students, @exam)\n @exam_grade ||= @exam.exam_group.batch.grading_levels.all\n render 'exam_score'\n end\n end",
"def mcas_math\n student.latest_result_by_family_and_subject(\"MCAS\", \"Mathematics\") || MissingStudentAssessment.new\n end",
"def gradeQuestion(studentAns, keyAns )\n # Value of correctness\n score = 0\n if studentAns == keyAns then\n score = 1\n end\n score\n end",
"def exam_mark_params\n params.require(:exam_mark).permit(:student_id, :exam_id, :exam_subject_id, :written_marks, :assessment_marks)\n end",
"def gradeQuestion(studentAns, keyAns )\n # Value of correctness\n score = 0\n if( studentAns == keyAns ) then\n score = 1\n end\n score\n end",
"def scale_marks\n max_mark_was = previous_changes[:max_mark].first\n # results with specific assignment\n results = Result.includes(submission: :grouping)\n .where(groupings: { assessment_id: assessment_id })\n all_marks = marks.where.not(mark: nil).where(result_id: results.ids)\n # all associated marks should have their mark value scaled to the change.\n updated_marks = {}\n all_marks.each do |mark|\n updated_marks[mark.id] = mark.scale_mark(max_mark, max_mark_was, update: false)\n end\n unless updated_marks.empty?\n Mark.upsert_all(all_marks.pluck_to_hash.map { |h| { **h.symbolize_keys, mark: updated_marks[h['id'].to_i] } })\n end\n updated_results = results.map do |result|\n [result.id, result.get_total_mark]\n end.to_h\n unless updated_results.empty?\n Result.upsert_all(\n results.pluck_to_hash.map { |h| { **h.symbolize_keys, total_mark: updated_results[h['id'].to_i] } }\n )\n end\n end",
"def grade(mark)\n\t## TODO write your code here. You might have to use multiple \n\t# if statements inside each other\t\n\n\treturn grade\nend",
"def get_marks_list(submission)\n criteria.map do |criterion|\n mark = submission.get_latest_result.marks.find_by(criterion: criterion)\n [(mark.nil? || mark.mark.nil?) ? '' : mark.mark,\n criterion.max_mark]\n end\n end",
"def check_marks\n stream = Stream.find(stream_id)\n sub_maps = stream.sub_str_maps.all\n xuser = self.user\n cat = xuser.personal.category\n academic = xuser.academic\n sub_mark = sub_maps.pluck(cat)\n\n user_subs = academic.subject_entries.all\n ok = false\n i = 0\n sub_maps.each do |su|\n ok = false\n user_subs.each do |as|\n if su.subject_id === as.subject_id\n if sub_mark[i] <= as.marks\n ok = true\n end\n end\n end\n unless ok\n errors.add(:stream_id, \"This stream cannot be choosen since you dont have required marks/subject\")\n break\n end\n i += 1\n end\n ok\n end",
"def add_mark(assessment, student_number, mark)\n assessment.marks[student_number] = mark\n end",
"def assignment_average_score(grade_hash, assignment_num)\n marks = assignment_scores(grade_hash, assignment_num)\n marks.sum / marks.length\nend",
"def group_by_marks(marks, pass_marks)\n marks.group_by do |k,v| \n v > pass_marks ? \"Passed\" : \"Failed\"\n end\n end",
"def build_exam_set\n @scores = new_collection\n @total_max = 0\n @total_score = 0\n @overrided_subjects = assessment_group.override_assessment_marks.find_all_by_course_id(batch.course_id).collect(&:subject_code)\n process_scores\n \n Models::ExamSet.new(\n :obj_id => assessment_group.id,\n :name => assessment_group.display_name,\n :scores => @scores,\n :aggregates => process_aggregates,\n :term_name => term_name(assessment_group),\n :term_exam => assessment_group.is_final_term,\n :group_exam => is_assessment_group?,\n :planner_exam => (assessment_group.is_final_term and (assessment_group.parent_type == 'AssessmentPlan')),\n :attendance_report => process_attendance,\n :planner_name => assessment_plan.name,\n :scoring_type => AssessmentGroup::SCORE[assessment_group.scoring_type],\n :show_percentage => (assessment_group.is_final_term && assessment_group.show_percentage?),\n :maximum_mark => assessment_group.maximum_marks,\n :hide_marks => assessment_group.hide_marks,\n :consider_skills => assessment_group.consider_skills\n )\n end",
"def update_marks\n result = self.grouping&.current_submission_used&.get_latest_result\n return page_not_found('No submission exists for that group') if result.nil?\n\n # We shouldn't be able to update marks if marking is already complete.\n if result.marking_state == Result::MARKING_STATES[:complete]\n render 'shared/http_status', locals: { code: '404', message:\n 'Marking for that submission is already completed' }, status: :not_found\n return\n end\n matched_criteria = assignment.criteria.where(name: params.keys)\n if matched_criteria.empty?\n render 'shared/http_status', locals: { code: '404', message:\n 'No criteria were found that match that request.' }, status: :not_found\n return\n end\n\n matched_criteria.each do |crit|\n mark_to_change = result.marks.find_or_initialize_by(criterion_id: crit.id)\n mark_to_change.mark = params[crit.name] == 'nil' ? nil : params[crit.name].to_f\n unless mark_to_change.save\n # Some error occurred (including invalid mark)\n render 'shared/http_status', locals: { code: '500', message:\n mark_to_change.errors.full_messages.first }, status: :internal_server_error\n return\n end\n end\n result.save\n render 'shared/http_status', locals: { code: '200', message:\n HttpStatusHelper::ERROR_CODE['message']['200'] }, status: :ok\n end",
"def average_calc(array_marks)\n # Sets counter to 0\n first_counter = 0\n # Sets the total marks to 0\n total_marks = 0\n # Take the 2d array and multiplies its width * length\n div_value = array_marks.size.to_i * array_marks[first_counter].size.to_i\n # Starts loop for how many dimensions are in the array\n\n while first_counter != array_marks.size\n\n # Sets counter to 0\n second_counter = 0\n # Starts loop for how many elements are in the aray dimensions\n\n while second_counter != array_marks[first_counter].size\n\n # Adds the mark to the total marks\n total_marks += array_marks[first_counter][second_counter].to_i\n # Adds one to counter\n second_counter += 1\n end\n # Adds one to counter\n first_counter += 1\n end\n # Takes average of the whole classes marks\n total_marks / div_value\n # Returns the average\nend",
"def finalise_assessment(assessment)\n assessment.marks.freeze\n end",
"def process_scores\n applicable_subjects = []\n subjects.group_by(&:batch_subject_group).each_pair do |batch_group, batch_subjects|\n (batch_subjects << batch_group).compact.each do |sub|\n applicable_subjects << sub\n end\n end\n applicable_subjects.sort_by{|as| as.priority.to_i}.each do|sub|\n mark = student.converted_assessment_marks.detect{|cam| cam.markable_id == sub.id and \n cam.markable_type == sub.class.name and cam.assessment_group_batch_id == agb.id}\n next unless mark\n build_score(sub, mark)\n process_skills(sub,mark) if consider_skills_of_subjects(sub)\n process_attributes(sub, mark, agb.subject_attribute_assessments) if agb.subject_attribute_assessments.present? and sub.is_a?(Subject)\n end\n\n add_to_exam_totals_hash(@total_score)\n end",
"def assignment_scores(grade_hash, assignment_num)\n grade_hash.map do |student, marks|\n marks[assignment_num - 1]\n end\nend",
"def index\n @exam_marks = ExamMark.all\n end",
"def ca_plus_mse\n total_formative * (100 - examweight)/100\n end",
"def get_review_emphasizes\n emphasizes = {\n reading: 0,\n reading_count: 0,\n writing: 0,\n writing_count: 0,\n group: 0,\n group_count: 0,\n homework: 0,\n homework_count: 0,\n test_count: 0\n }\n\n @reviews.each do |r|\n if r.amount_reading > 0\n emphasizes[:reading] += r.amount_reading\n emphasizes[:reading_count] += 1\n end\n if r.amount_writing > 0\n emphasizes[:writing] += r.amount_writing\n emphasizes[:writing_count] += 1\n end\n if r.amount_group > 0\n emphasizes[:group] += r.amount_group\n emphasizes[:group_count] += 1\n end\n if r.amount_homework > 0\n emphasizes[:homework] += r.amount_homework\n emphasizes[:homework_count] += 1\n end\n if r.only_tests\n emphasizes[:test_count] += 1\n end\n end\n\n if emphasizes[:reading_count] > 0\n emphasizes[:reading] = (emphasizes[:reading] / emphasizes[:reading_count]).round(2)\n end\n if emphasizes[:writing_count] > 0\n emphasizes[:writing] = (emphasizes[:writing] / emphasizes[:writing_count]).round(2)\n end\n if emphasizes[:group_count] > 0\n emphasizes[:group] = (emphasizes[:group] / emphasizes[:group_count]).round(2)\n end\n if emphasizes[:homework_count] > 0\n emphasizes[:homework] = (emphasizes[:homework] / emphasizes[:homework_count]).round(2)\n end\n\n emphasizes\n end",
"def percentage_grades_array(assignment)\n groupings = assignment.groupings\n .joins(:tas)\n .where(memberships: { user_id: id })\n grades = []\n\n if assignment.assign_graders_to_criteria\n criteria_ids = self.criterion_ta_associations.where(assessment_id: assignment.id).pluck(:criterion_id)\n out_of = criteria_ids.sum do |criterion_id|\n Criterion.find(criterion_id).max_mark\n end\n return [] if out_of.zero?\n\n mark_data = groupings.joins(current_result: :marks)\n .where('marks.criterion_id': criteria_ids)\n .where.not('marks.mark': nil)\n .pluck('results.id', 'marks.mark')\n .group_by { |x| x[0] }\n mark_data.values.each do |marks|\n next if marks.empty?\n\n subtotal = 0\n has_mark = false\n marks.each do |_, mark|\n subtotal += mark\n has_mark = true\n end\n grades << subtotal / out_of * 100 if has_mark\n end\n else\n out_of = assignment.max_mark\n groupings.includes(:current_result).find_each do |grouping|\n result = grouping.current_result\n unless result.nil? || result.total_mark.nil? || result.marking_state != Result::MARKING_STATES[:complete]\n percent = calculate_total_percent(result, out_of)\n unless percent == BLANK_MARK\n grades << percent\n end\n end\n end\n end\n grades\n end",
"def exams_statistics\n end",
"def evaluation\n responses = self.user_survey_responses\n correct_answers = 0.0\n responses.each do |response|\n answer = Answer.find(response.answer_id)\n correct_answers += 1 if answer.correct\n end\n if self.grade.nil?\n self.grade = Grade.create score: 0, gradable: self, user_id: self.user_id\n end\n if (responses.size != 0) then\n evaluation = (correct_answers/responses.size)*10\n #self.update_attributes result: evaluation\n if evaluation != grade.score\n self.grade.update_attributes score: evaluation\n end\n return evaluation\n else\n #self.update_attributes result: 0.0\n if grade.score != 0\n self.grade.update_attributes score: 0, gradable: self\n end\n return 0.0\n end\n end",
"def exam_scores(exam)\n ExamScore.where(exam_id: exam, student_id: id).take\n end",
"def exam_result\n if params[:exam_id]\n @exam = Exam.find(params[:exam_id])\n assert(exam.kind_of?(Exam))\n @exam = fill_user_answers(@exam)\n\n current_user.exams_total_questions += @exam.questions.count\n current_user.update_attribute(:exam_performance, current_user.exam_performance + [@exam.accepted_answers])\n\n @exam.save\n return @exam.user_answers\n else\n return redirect_to_back\n flash[:danger] = t(:exam_message)\n end\n end",
"def expected_grades\n metrics.count * course.students.count\n end",
"def marks\n marks = []\n if input =~ / *mark:(\\d\\S*)/i\n marks = $1.gsub /(\\d+)-(\\d+)/ do\n ($1.to_i..$2.to_i).to_a.join(',')\n end\n marks = marks.split(',').collect {|s| s.to_i}.sort\n end\n marks\n end",
"def streams_marks\n xuser = self.user\n xcategory = xuser.personal.category\n stream = Stream.where(id: stream_id)\n required_marks = stream.pluck(xcategory)[0]\n\n if required_marks < xuser.academic.twelfth_marks\n errors.add(:stream_id, \"Error total marks in twelfth standard is not sufficient\")\n end\n end",
"def expected_grades\n assignment.course.students.count\n end",
"def answerAccuracy( studentStringArray, keyString )\n keyAnsArr = formatAnswersFromSimple( keyString )\n # num of questions on the exam\n numQ = keyAnsArr.size\n accuracyArray = Array.new( )\n\n numQ.times do\n accuracyArray.push(0.0)\n end\n\n # For each student\n studentStringArray.each { |studentString|\n studentAnsArr = formatAnswersFromSimple( studentString )\n # For each question on the exam\n #for i in numQ\n counter = 0\n numQ.times do\n # Adds the correctness value to the array at that location\n accuracyArray[counter] += gradeQuestion( studentAnsArr[counter], keyAnsArr[counter] )\n counter += 1\n end\n }\n\n # Finds mean score for each question for every student\n numStudents = studentStringArray.size\n count = 0\n accuracyArray.size.times do\n accuracyArray[count] = accuracyArray[count] / numStudents\n count += 1\n end\n accuracyArray\n end",
"def completed_result_marks\n return @completed_result_marks if defined? @completed_result_marks\n\n @completed_result_marks = self.current_results\n .where(marking_state: Result::MARKING_STATES[:complete])\n .order(:total_mark)\n .pluck(:total_mark)\n end",
"def calculate_score(content, quiz_id)\n @total_correct_choices = 0\n choices.each do |key, value|\n @total_correct_choices += 1 if value\n end\n\n @full_credit = full_credit(quiz_id)\n @points_per_choice = @full_credit / @total_correct_choices\n\n @correct_choices = Array.new\n @incorrect_choices = Array.new\n\n student_choices(content) do |text, is_selected|\n if is_selected\n if choices[text]\n @correct_choices << text\n else\n @incorrect_choices << text\n end\n end\n end\n\n score = (@correct_choices.length - @incorrect_choices.length) * @points_per_choice\n normalize score, quiz_id\n end",
"def percentage_grades_array(assignment)\n grades = Array.new()\n out_of = assignment.max_mark\n assignment.groupings.includes(:current_result).joins(:tas)\n .where(memberships: { user_id: id }).find_each do |grouping|\n result = grouping.current_result\n unless result.nil? || result.total_mark.nil? || result.marking_state != Result::MARKING_STATES[:complete]\n percent = calculate_total_percent(result, out_of)\n unless percent == BLANK_MARK\n grades.push(percent)\n end\n end\n end\n\n return grades\n end",
"def grade_percentage\n passed_tests.count / my_tests.count\n end",
"def all_marks_given?(period)\n return Mark.where(:student_from_id => self, :period_id => period)\n end",
"def mcas_math\n # Look for the most recent of Next Gen or Legacy MCAS\n next_gen = student.latest_result_by_family_and_subject([\"Next Gen MCAS\",\"MCAS\"], \"Mathematics\") || MissingStudentAssessment.new\n end",
"def save_test\n @test = params[:question]\n @placement_exam = PlacementExam.find(params[:placement_exam_id])\n @student = Student.find(params[:student_id])\n @score = PlacementExam.calculateres(@test, @placement_exam.id, @student)\n end",
"def gradeStudent( studentString, keyString )\n # Number of correct answers\n numCorrect = 0.0\n studentAnsArr = formatAnswersFromSimple( studentString )\n keyArr = formatAnswersFromSimple( keyString )\n count = 0\n studentAnsArr.each { |sarr|\n numCorrect = numCorrect + gradeQuestion( sarr, keyArr[count] )\n count += 1\n }\n numCorrect / studentAnsArr.size\n end",
"def grade_percentage\n # get the number of passing tests as a float\n passing_tests = tests.select { |test| test.test_status == \"passed\" }.length.to_f\n # get total number of all that students tests\n all_tests = tests.length.to_f\n # calculate their passing_tests as a % of their total tests\n passing_tests / all_tests * 100\n end",
"def exam_data(subject)\n Exam.result(subject.id, id)\n end",
"def gradeStudent( studentString, keyString )\n # Number of correct answers\n numCorrect = 0.0\n studentAnsArr = formatAnswersFromSimple( studentString )\n keyArr = formatAnswersFromSimple( keyString )\n count = 0\n studentAnsArr.each { |sarr|\n numCorrect = numCorrect + gradeQuestion( sarr, keyArr[count] )\n count += 1\n }\n numCorrect / studentAnsArr.size\n end",
"def attendance_prediction\n\n @attendance = Math.exp(Coefficient.find_by({:name =>\"intercept\"}).value).round(0)\n end",
"def create\n @exam_mark = ExamMark.new(exam_mark_params)\n\n respond_to do |format|\n if @exam_mark.save\n format.html { redirect_to @exam_mark, notice: 'Exam mark was successfully created.' }\n format.json { render :show, status: :created, location: @exam_mark }\n else\n format.html { render :new }\n format.json { render json: @exam_mark.errors, status: :unprocessable_entity }\n end\n end\n end",
"def grade_percentage\n #Count all tests this student has passed\n tests_passed = BoatingTest.all.select {|test| test.student == self && test.test_status == \"passed\" }.length.to_f\n #Count all tests with this student\n all_tests = BoatingTest.all.select {|test| test.student == self}.length.to_f\n #Calculate percentage as float\n grade_percentage = tests_passed/all_tests\n grade_percentage.round(2)\n end",
"def set_score\n case competition.evaluation_type\n when 'mae'\n d1 = read_expected_csv.transpose\n d2 = read_csv.transpose\n df1 = Daru::DataFrame.new(extract_cols(d1), order: [:id, :value])\n df2 = Daru::DataFrame.new(extract_cols(d2), order: [:id, :value])\n means = df1.join(df2, on: [:id], how: :inner).vector_by_calculation { (value_1 - value_2).abs }\n self.evaluation_score = (means.sum.to_d / means.size.to_d)\n end\n end",
"def run_align_assess\n filename = self.generate_fasta_alignment_file_for_all\n string = \"./lib/AlignAssess_wShorterID #{filename} P\"\n seq_array = Array.new\n if system(string)\n seq_id_array = self.sequences.map{|s| s.seq_id}\n new_filename = filename + \"_assess\"\n f = File.new(new_filename, \"r\")\n flag = false\n read_row= 999999999\n cur_row = 0\n while (line = f.gets)\n if cur_row > read_row && flag\n if line == \"\\n\"\n flag =false\n else\n seq_array << line.split(\"\\t\")\n end\n elsif line == \"Pair-wise %ID over shorter sequence:\\n\"\n flag=true\n read_row = cur_row + 2\n end\n cur_row +=1\n end\n range = seq_array.length - 1\n #seq_array.each do |row|\n for row_num in 0..range\n for i in 1..range#(row_num) \n PercentIdentity.first_or_create(:seq1_id=>seq_id_array[row_num],\n :seq2_id=>seq_id_array[i],\n :alignment_name => self.alignment_name,\n :percent_id=>seq_array[row_num][i])\n # print \"[#{row_num}:#{i-1}=>#{row[i]}],\"\n end\n #print \"\\n\"\n end\n end\n end",
"def mark_total an_date\n the_count = marks.select{|m| m.mark_date == an_date}.count\n the_count == 0 ? \"\" : the_count \n end",
"def grade_percentage\n total = 0\n student_tests = BoatingTest.all.select {|test| test.student == self}\n student_tests.each do |test|\n if test.test_status == \"passed\"\n total += 1\n end\n end\n average = total.to_f / student_tests.length\n average * 100\n end",
"def create\n @answer = Answer.new(answer_params)\n\n @answer.question_id = flash[:question]\n @answer.student = current_student\n\n respond_to do |format|\n if @answer.save\n @question = @answer.question\n\n @answer.res1 = 0\n @answer.res2 = 0\n @answer.res3 = 0\n @answer.res4 = 0\n @answer.res5 = 0\n\n if @answer.ans1 == @question.ans1\n @answer.res1 = 1\n end\n if @answer.ans2 == @question.ans2\n @answer.res2 = 1\n end\n if @answer.ans3 == @question.ans3\n @answer.res3 = 1\n end\n if @answer.ans4 == @question.ans4\n @answer.res4 = 1\n end\n if @answer.ans5 == @question.ans5\n @answer.res5 = 1\n end\n\n @answer.total_res = @answer.res1 + @answer.res2 + @answer.res3 + @answer.res4 + @answer.res5\n @answer.save\n\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def average_assignment_score\n assignment_average_scores.inject(:+).to_f/num_assignments\n rescue ZeroDivisionError\n 0\n end",
"def accuracy\n\t\tnumber_of_documents > 0 ? number_of_right_classifications.fdiv(number_of_documents) : 0\n\tend",
"def create\n student_answers_hash = assessment_info_params[:student_answers]\n student_answers = student_answers_hash.collect { |s| StudentAnswer.new( s)}\n\n assessment_info_map = assessment_info_params.except(:student_answers)\n\n\n\n assessment_info_map[:student_answers] = student_answers\n\n @assessment_info = AssessmentInfo.new( assessment_info_map )\n @assessment_info.student_user_id = current_user.id\n\n\n\n\n\n respond_to do |format|\n correct_count = 0\n if @assessment_info.save\n\n @assessment_info.student_answers.each do |student_answer|\n\n sa = StudentAnswer.find(student_answer.id)\n\n if sa.question.question_type == 0\n if sa.answer_choice_id == sa.question.question_answers.first.choice_id\n sa.correct = true\n correct_count = correct_count + 1\n else\n sa.correct = false\n end\n sa.save!\n elsif student_answer.question.question_type == 1\n if student_answer.answer_text == student_answer.question.answer\n sa.correct = true\n correct_count = correct_count + 1\n else\n sa.correct = false\n end\n sa.save!\n end\n\n end\n\n @assessment_info.result = correct_count.to_d/@assessment_info.student_answers.count*100\n #if result less than passing grade set the concept as incomplete\n @learned_concept = LearnedConcept.find_by(concept_id: @assessment_info.assessment.concept_id)\n if !@learned_concept\n\n @learned_concept = LearnedConcept.new\n @learned_concept.concept_id = @assessment_info.assessment.concept.id\n @learned_concept.learned_course_id = @assessment_info.assessment.concept.course_id\n end\n if @assessment_info.result < @assessment_info.assessment.min_passing_grade\n @learned_concept.completed = false\n else\n @learned_concept.completed = true\n end\n @learned_concept.save\n @assessment_info.save\n format.html { redirect_to @assessment_info, notice: 'assessment was submitted.' }\n format.json { render :show, status: :created, location: @assessment_info }\n else\n format.html { render :new }\n format.json { render json: @assessment_info.errors, status: :unprocessable_entity }\n end\n end\nend",
"def update_exam_score\n @exam = Exam.shod(params[:id])\n @exam_group = @exam.exam_group\n @batch = @exam_group.batch\n grades = @exam.exam_group.batch.grading_levels.order(min_score: :asc)\n @temps = params[:exams][:exam]\n @exam.score_exam(@temps, @batch, @exam, @exam_group, grades)\n exam\n end",
"def result\n pass_fail(average(get_grades))\nend",
"def accuracy\n\n # Sum and square the error (difference) between predicted Y and actual Y\n summarization = @training_set.sum{|x, y| @hypothesis.error(x, y) ** 2}\n\n # Calculate the average of the errors\n (1.to_f / (2 * @training_set.length)) * summarization\n \n end",
"def grade_percentage\n my_test = BoatingTest.all.select do |test|\n test.student == self \n end \n passed_test = my_test.select do |test|\n test.status == \"passed\" \n end\n passed_test.count.to_f / my_test.count\n #binding.pry \n end",
"def grade_percentage\n # This is the total number of tests a student (self) has taken.\n student_tests = BoatingTest.all.select do |test|\n test.student == self\n end\n\n # From the total number of tests taken by that student (self), we just want\n # the one's that have passed.\n passed_test = student_tests.select do |test|\n test.status == \"passed\"\n end\n # From the total number of tests taken by that student (self), we just want\n # the one's that have failed.\n failed_test = student_tests.select do |test|\n test.status == \"failed\"\n end\n\n # Now we need to find the percent of tests that this student (self) has\n # passed compared to the total number of tests they have taken.\n # Multiply by 100 to get a % value instead of decimal.\n # ratio = (passed_test.length.to_f)/(student_tests.length)\n # ratio * 100 SAME AS BELOW\n ratio = \"%.2f\" % (passed_test.length.fdiv(student_tests.length)*100).to_s + \"%\"\n # The \"%.2f\"\n end",
"def test_grade\n input = self.test_session.user_input\n test_content = test.content\n grade = input.similar(test_content)\n grade.round(1)\n end",
"def create\n # receive datas\n word_id = params[:word_id]\n answer = params[:answer]\n @exam = Exam.find(params[:exam_id])\n\n #create a result_paper\n @rpaper = ResultPaper.new(:exam_id => @exam.id, :paper_id => @exam.paper_id, :user_id => current_user.id)\n @rpaper.save\n\n # index is for array index\n # each student only can answer once,never more(if only recreate the task)\n index = 0\n word_id.each do |f|\n is_right = 2\n Word.find(word_id[index]).meanings.each do |f|\n if f.content.to_s.strip == answer[index].to_s.strip\n is_right = 1\n break\n elsif f.content.to_s.strip.empty?\n is_right = 0\n end\n end\n\n @answer = ResultWord.new(:is_right => is_right,:word_id => word_id[index], :answer => answer[index],:result_paper_id => @rpaper.id)\n @answer.save\n \n index = index + 1\n end\n #generate the score\n all = ResultWord.where(:result_paper_id => @rpaper.id).count*1.00\n score = ResultWord.where(:is_right => 1,:result_paper_id => @rpaper.id).count\n\n @result_paper = ResultPaper.find(@rpaper.id)\n @result_paper.update_attributes(:score => score, :rate => (score/all)*100)\n @exam.update_attributes(:status => 2)\n\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'submit successfully created.' }\n end\n \n end",
"def grade\n rubric_file = File.open('rubric.txt')\n quiz_file = File.open('quiz.txt')\n\n rubric_lines = []\n rubric_file.lines { |line| rubric_lines << line }\n \n quiz_lines = []\n quiz_file.lines { |line| quiz_lines << line }\n\n correct_lines = []\n incorrect_lines = []\n\n quiz_lines.each do |line| \n if rubric_lines.find { |r| r == line } == nil\n incorrect_lines << line\n else\n correct_lines << line\n end\n end\n \n number_correct = correct_lines.size\n number_incorrect = incorrect_lines.size\n date = Time.new\n \n old_results_lines = []\n File.open('results.txt').lines { |line| old_results_lines << line }\n old_results = old_results_lines.join(\"\")\n new_results_entry = \"\\n --- #{date.strftime('%B %-d, %Y')} --- \\n#{number_correct} correct. #{number_incorrect} incorrect.\\n**INCORRECT** :\\n#{incorrect_lines.join('')}\\n\"\n \n File.open('results.txt', 'w') {|f| f.write(new_results_entry + old_results) }\nend",
"def calculate_average(correct_answers, total_answers)\n #this is an average. uses floats to get decimals, *100 because thats what a percentage is, and converts to an integer. '%.2f' % to round the float off to 2 decimal places\n if Helper.check_for_zero?(total_answers) == true\n puts \"You haven't taken any quizzes!!!\"\n return -1\n else\n average = (correct_answers.to_f * 100) / (total_answers.to_f * 100)\n average = average * 100\n return average.to_i\n end\n\n end",
"def grade_percentage\n\t\t#1. Collect all of the tests a student has taken \n\t\t#2. Find the percentage of tests the student has passed.\n\t\t#3. Return the amount as a float.\n\t\tgrade_arr = BoatingTest.all.select do |test|\n\t\t\ttest.student == self\n\t\tend\n\t\t\n\t\tgrade_arr = grade_arr.collect do |test|\n\t\t\ttest.status\n\t\tend\n\t\t(grade_arr.count(\"passed\").to_f/grade_arr.count.to_f) * 100\n\tend",
"def grade_percentage\n all_tests = BoatingTest.all.select do |test|\n test.student == self\n end\n passed_tests = all_tests.select do |test|\n test.status == \"passed\"\n end\n passed_tests.length.to_f/all_tests.length.to_f\n end",
"def update_subject_grade(all_grades,cid)\n currentMark = mark_per(all_grades.sum(\"worth\"), all_grades.sum(\"courseMark\"))\n Subject.update(cid, :currentMark => currentMark)\n end",
"def print\n @students = Student.all\n @passes_affirmative = Array.new\n @passes_negative = Array.new\n @group = params[:group]\n @groups = Group.all\n affirmative = 0\n negative = 0\n if [1,2,3,4,5,6].include? Time.now.month\n year = [Time.now.year - 1, Time.now.year]\n end\n @month = params[:month].to_i\n if params[:date_of] == \"0\" and params[:date_for] == \"0\"\n if [10, 12].include? params[:month].to_i\n date_of = \"1.#{params[:month]}.#{year[0]}\".to_date\n date_for = \"31.#{params[:month]}.#{year[0]}\".to_date\n elsif [9, 11].include? params[:month].to_i\n date_of = \"1.#{params[:month]}.#{year[0]}\".to_date\n date_for = \"30.#{params[:month]}.#{year[0]}\".to_date\n elsif params[:month].to_i == 2\n date_of = \"1.#{params[:month]}.#{year[1]}\".to_date\n date_for = \"28.#{params[:month]}.#{year[1]}\".to_date\n elsif [1, 3, 5].include? params[:month].to_i\n date_of = \"1.#{params[:month]}.#{year[1]}\".to_date\n date_for = \"31.#{params[:month]}.#{year[1]}\".to_date\n elsif [4, 6].include? params[:month].to_i\n date_of = \"1.#{params[:month]}.#{year[1]}\".to_date\n date_for = \"30.#{params[:month]}.#{year[1]}\".to_date\n end\n else\n date_of = params[:date_of].to_date\n date_for = params[:date_for].to_date\n end\n @students.each do |student|\n student.passes.each do |pass|\n if (date_of..date_for).include? pass.date_of\n if pass.cause == \"1\"\n affirmative = affirmative + pass.hours\n else\n negative = negative + pass.hours\n end\n end\n end\n @passes_affirmative[student.id] = affirmative\n @passes_negative[student.id] = negative\n affirmative = 0\n negative = 0\n end\n if params[:group] == \"0\"\n @students.each do |student|\n student.passes.each do |pass|\n if (date_of..date_for).include? pass.date_of\n if pass.cause == \"1\"\n affirmative = affirmative + pass.hours\n else\n negative = negative + pass.hours\n end\n end\n end\n @passes_affirmative[student.id] = affirmative\n @passes_negative[student.id] = negative\n affirmative = 0\n negative = 0\n end\n k =0\n studs = []\n @students.each do |student|\n studs[k] = Hash.new\n studs[k][:id] = student.id\n studs[k][:fio] = \"#{student.surname} #{student.name} #{student.fathername}\"\n studs[k][:group] = student.group.number\n studs[k][:passes_n] = @passes_negative[student.id]\n studs[k][:passes_a] = @passes_affirmative[student.id]\n studs[k][:passes_all] = @passes_affirmative[student.id] + @passes_negative[student.id]\n k = k + 1\n end\n studs = studs.sort_by { |k| k[:passes_n] }\n studs = studs.reverse!\n else\n @groups.each do |group|\n group.students.each do |student|\n student.passes.each do |pass|\n if (date_of..date_for).include? pass.date_of\n if pass.cause == \"1\"\n affirmative = affirmative + pass.hours\n else\n negative = negative + pass.hours\n end\n end\n end\n @passes_affirmative[group.id] = affirmative\n @passes_negative[group.id] = negative\n affirmative = 0\n negative = 0\n end\n end\n k = 0\n groups = []\n @groups.each do |group|\n groups[k] = Hash.new\n groups[k][:id] = group.id\n groups[k][:number] = group.number\n groups[k][:passes_n] = @passes_negative[group.id]\n groups[k][:passes_a] = @passes_affirmative[group.id]\n groups[k][:passes_all] = @passes_affirmative[group.id] + @passes_negative[group.id]\n k = k + 1\n end\n groups = groups.sort_by { |k| k[:passes_n] }\n groups = groups.reverse!\n end\n sum_a = 0\n sum_n = 0\n sum_all = 0\n if params[:group] == \"0\"\n @book = Spreadsheet::Workbook.new\n @sheet = @book.create_worksheet :name => \"Рейтинг за #{params[:month]}\"\n @sheet.row(1).push \"№\", \"ФИО\", \"Группа\", \"Пропуски по уважительной причине\", \"Пропуски по неуважительной причине\", \"Всего\", \"Примечание\"\n @sheet.row(1).height = 20\n @sheet.row(1).default_format = Spreadsheet::Format.new :weight => :bold\n @sheet.column(1).width = 45\n @sheet.column(2).width = 10\n @sheet.column(3).width = 20\n @sheet.column(4).width = 25\n @sheet.column(5).width = 25\n @sheet.column(6).width = 25\n @sheet.column(7).width = 35\n @i = 2\n studs.each do |studs|\n @sheet.row(@i).push \"#{@i - 1}\", \"#{studs[:fio]}\", studs[:group], studs[:passes_a], studs[:passes_n], studs[:passes_all]\n @sheet.row(@i).height = 20\n sum_a = sum_a + studs[:passes_a]\n sum_n = sum_n + studs[:passes_n]\n sum_all = sum_all + studs[:passes_all]\n @i += 1\n end\n @sheet.row(@i).push \"Всего:\",\" \", \" \", sum_a, sum_n, sum_all\n @sheet.row(@i).height = 20\n else\n @book = Spreadsheet::Workbook.new\n @sheet = @book.create_worksheet :name => \"Рейтинг за #{params[:month]}\"\n @sheet.row(1).push \"№\", \"Группа\", \"Пропуски по уважительной причине\", \"Пропуски по неуважительной причине\", \"Всего\", \"Примечание\"\n @sheet.row(1).height = 20\n @sheet.row(1).default_format = Spreadsheet::Format.new :weight => :bold\n @sheet.column(1).width = 10\n @sheet.column(2).width = 10\n @sheet.column(3).width = 25\n @sheet.column(4).width = 25\n @sheet.column(5).width = 25\n @sheet.column(6).width = 35\n @i = 2\n groups.each do |groups|\n @sheet.row(@i).push \"#{@i - 1}\", \"#{groups[:number]}\", groups[:passes_a], groups[:passes_n], groups[:passes_all]\n @sheet.row(@i).height = 20\n sum_a = sum_a + groups[:passes_a]\n sum_n = sum_n + groups[:passes_n]\n sum_all = sum_all + groups[:passes_all]\n @i += 1\n end\n @sheet.row(@i).push \"Всего:\",\" \", sum_a, sum_n, sum_all\n @sheet.row(@i).height = 20\n end\n @book.write \"#{Rails.root}/public/report.xls\"\n send_file \"#{Rails.root}/public/report.xls\", type: 'application/excel', disposition: 'attachment'\n end",
"def calculate_score(lemma_ids)\n polarities = []\n\n lemma_ids.each do |id|\n polarities << polarities_hash[id]\n end \n \n positive = polarities.flatten.count(:positive)\n negative = polarities.flatten.count(:negative)\n \n return if (positive + negative) == 0\n\n score = ((positive - negative).to_f) / (positive + negative)\n\n return score\n end",
"def examine\n if @examination_result.nil?\n @examination_result = run_examination\n else\n @examination_result\n end\n end",
"def determine_correctness\n answer = self.question.answer\n \t#Upcase to take care of all capitalization issues\n \tresponse = self.content.upcase\n\n \tanswer = answer.split(', ')\n\n \t#Score Keeping\n \tscore = 0\n \tscore_incremental = 1.0/answer.length\n \t\n \t#Determining how many of keywords are in response\n \tanswer.each do |correct_word|\n \t\tcorrect_word = correct_word.upcase\n \t\tif response.include?(correct_word)\n \t\t\tscore += score_incremental\n \t\tend\n \tend\n \tself.correctness = score\n end",
"def grade_percentage\n studentTests= BoatingTest.all.find_all{|test| test.student.first_name == self.first_name}\n totalTests= studentTests.length.to_f\n totalPassed= studentTests.find_all{|test| test.status == \"passed\"}\n numPassed= totalPassed.length.to_f\n percent= (numPassed/totalTests)*100\n end",
"def test_average\n\t\tassert_equal(90, @students[0].average, \"The first student's average score is not 90\")\n\t\tassert_equal(\"A\", @students[0].letter_grade, \"The first student's letter grade is not an A.\")\n\tend",
"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 run_quiz\n self.questions_explanation\n self.display_questions\n self.skipped_questions_explanation\n self.skipped_questions\n self.answers_explanation\n self.display_results\n self.show_score\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\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\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 score\n calculator.score\n end",
"def grades(input)\n lines = input.split(/\\n/)\n grades = lines[1..lines.length]\n s = lines[0].split(/\\s/)\n n = s[0].to_f\n m = s[1].to_f\n avgs = Hash.new\n grades.each do |line|\n split_line = line.split(/\\s/)\n avgs[split_line[0]] = split_line[1..m].inject(0){|sum, x| sum + x.to_f} / m\n end\n avg = (avgs.to_a.inject(0){|sum, x| sum + x[1].to_f} / n).round(2).to_s\n avgs.each do |k, v|\n avg += \"\\n\" + k.to_s + \" \" + v.to_s\n end\n puts avg\nend",
"def overall\n avg = @difficulty = @mood = @teaching_skills = 0.0\n @exams_difficulty = @helpfulness = 0.0\n count = 0 + sections.count\n count = 1 if count.zero?\n sections.each do |section|\n avg += section.professor_overall\n @difficulty += section.professor_difficulty\n @teaching_skills += section.professor_teaching\n @mood += section.professor_mood\n @exams_difficulty += section.professor_exam\n @helpfulness += section.professor_helpfulness\n end\n\n @difficulty /= count\n @teaching_skills /= count\n @mood /= count\n @exams_difficulty /= count\n @helpfulness /= count\n avg / count\n end",
"def calculate\n\t\taverage_rank\n\t\tfound_percent\n\tend",
"def points\n ((2 * base_points) / (1 + Math.exp(2 * (correct_answer - answer.to_f).abs))).to_i\n end",
"def set_acumen(student)\n student.average.nil? ? @acumen_one = 0 : @acumen_one = (100 - student.average.acumen_one).round(2)\n student.average.nil? ? @acumen_two = 0 : @acumen_two = (100 - student.average.acumen_two).round(2)\n end",
"def get_score\n\t\tscore = ((360000/((@end_time - @start_time).to_f + @save_time.to_f))*((@number_of_correct-@number_of_hint).fdiv(@number_of_correct+1))).truncate(2)\n\t\tif score < 0\n\t\t\treturn 0\n\t\telse\n\t\t\treturn score\n\t\tend\n\tend",
"def calculate\n score = 0\n\n names.each do |name|\n current_score = 0\n name_score = 0\n\n name.split('').each do |letter|\n current_score += LETTER_SCORES[letter]\n name_score = current_score\n end\n\n current_score *= names.index(name) + 1\n score += current_score\n end\n\n score\n end",
"def grade\n incorrect_question_ids = []\n\n # Add skipped questions to array\n unit.questions.each do |q|\n incorrect_question_ids << q.id unless answers && answers.has_key?(q.id.to_s)\n end\n\n return incorrect_question_ids unless answers\n\n # Add incorrectly answered questions to the array\n answers.each do |question_id, answer_index|\n incorrect_question_ids << question_id.to_i unless answer_is_correct? question_id, answer_index\n end\n\n return incorrect_question_ids\n end",
"def marks_dir\n dir \"/tmp/marks\"\n end"
] |
[
"0.7437175",
"0.69961363",
"0.6912861",
"0.66114014",
"0.6560791",
"0.6390787",
"0.63760436",
"0.62102973",
"0.6148726",
"0.5929783",
"0.5929743",
"0.58902735",
"0.5840896",
"0.58071953",
"0.5787153",
"0.5777845",
"0.5758071",
"0.57267874",
"0.57106924",
"0.5695518",
"0.56823933",
"0.56791914",
"0.56427956",
"0.56353587",
"0.56131804",
"0.55725336",
"0.5563527",
"0.55571383",
"0.55485165",
"0.5540558",
"0.5519238",
"0.5476557",
"0.5466498",
"0.54517925",
"0.5439816",
"0.5425246",
"0.5412402",
"0.5377163",
"0.53635913",
"0.5338014",
"0.5336362",
"0.5331819",
"0.53125143",
"0.5305271",
"0.53006256",
"0.5292539",
"0.527516",
"0.52553046",
"0.52149844",
"0.5212465",
"0.5212264",
"0.5208761",
"0.5203168",
"0.51970625",
"0.5191167",
"0.5190861",
"0.5181316",
"0.5170733",
"0.5162022",
"0.51400113",
"0.5135136",
"0.51296145",
"0.5119463",
"0.5119138",
"0.5114896",
"0.5107863",
"0.50910103",
"0.5073701",
"0.50726795",
"0.50492144",
"0.50313395",
"0.5027873",
"0.5021396",
"0.5014545",
"0.5013893",
"0.50104105",
"0.5009561",
"0.5008988",
"0.4998137",
"0.4996224",
"0.49922404",
"0.49794456",
"0.49785364",
"0.49648765",
"0.49642944",
"0.4957045",
"0.49527666",
"0.4952215",
"0.49514434",
"0.4949093",
"0.49446714",
"0.4941553",
"0.4936033",
"0.4934373",
"0.4932717",
"0.49214482",
"0.4911848",
"0.4910704",
"0.49036783",
"0.49008775"
] |
0.70685697
|
1
|
GET /posts GET /posts.json
|
def index
@posts = Post.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @posts}\n end\n end",
"def index\n render json: { posts: Post.all }\n end",
"def index\n @posts = Post.order(\"created_at DESC\").includes(:user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def index\n @posts = Post.all\n \n render json: @posts\n end",
"def show\n @post = Post.find(params[:id])\n\n render json: @post\n end",
"def show\n post = Post.find(params[:id])\n render json: post\n end",
"def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end",
"def display_posts\n begin\n response = RestClient.get \"#{@@DOMAIN}/api/posts.json?all\", authorization_hash\n\n puts \"Response code: #{response.code}\"\n puts \"Response cookies:\\n #{response.cookies}\\n\\n\"\n puts \"Response headers:\\n #{response.headers}\\n\\n\"\n puts \"Response content:\\n #{response.to_str}\"\n\n js = JSON response.body\n js.each do |item_hash|\n item_hash.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"def index\n @posts = Post.all.order(created_at: :asc)\n json_response(@posts)\n end",
"def show\n \trender json: Post.find(params[:id])\n end",
"def index\n render json: Post.all\n end",
"def show\n\t \trender json: Post.find(params[:id])\n\t end",
"def show\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n render json: @post\n end",
"def index\n @posts = Post.paginate(:page => params[:page], :per_page => 10).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n render json: Post.find(params[\"id\"])\n end",
"def index\n render json: { posts: current_user.posts.all.map(&:to_h) }\n end",
"def index\n @posts = Post.all\n @posts = paginate(@posts)\n authorize @posts\n\n render json: @posts, each_serializer: Api::V1::PostSerializer, meta: meta_attributes(@posts)\n end",
"def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def show\n @user = User.find(params[:id])\n @posts = @user.posts\n\n respond_to do |format|\n format.json { render json: {user: User._build(@user), posts: Post.build_posts(@posts)}, location: root_path }\n end\n end",
"def show\n render json: @post\n end",
"def show\n render json: @post\n end",
"def index\n\t\tgon.posts = Post.all.as_json\n\tend",
"def index\n # @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end",
"def get(options = {})\n response= handle_errors { self.class.get('/get', :query => options)}\n if response[\"posts\"][\"post\"].is_a?(Hash)\n Rubycious::Post.new response[\"posts\"][\"post\"]\n elsif response[\"posts\"][\"post\"].is_a?(Array)\n response[\"posts\"][\"post\"].collect{|i| Rubycious::Post.new(i)}\n else\n nil\n end\n end",
"def index\n\n # We display the posts be cronological inverted order\n if authenticated?\n @posts = Post.order('created_at DESC').page(params[:page])\n else\n @posts = Post.order('created_at DESC').where(:status => :true).page(params[:page])\n end\n \n respond_to do |format|\n format.html { render html: @posts }\n format.json { render json: @posts }\n end\n end",
"def show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n \n @post = Post.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 show\n @posts = @game.posts.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n respond_to do |format|\n format.json { render template: 'api/games/game.json' }\n end\n end",
"def show\n post = Post.find_by(id: params[:id])\n if post \n render json: post\n else\n render json: {errors: 'Not found'}\n end\n end",
"def show\n render :json => @post\n end",
"def get(options = EMPTY_HASH)\n parameters = Specification.new(\n tag: Types::Tags,\n dt: Types::Time,\n url: Types::URL,\n meta: Types::Boolean\n ).parameters(options)\n posts_from client.get(\"/posts/get\", parameters)\n end",
"def index\n @posts = Post.all\n # Post.all returns all of the posts currently in the \n # database as an array of Post records that we store \n # in an instance variable called @posts.\n # http://guides.rubyonrails.org/active_record_querying.html\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n # The respond_to block handles both HTML and JSON calls \n # to this action. If you browse to \n # http://localhost:3000/posts.json, you’ll see a JSON \n # containing all of the posts. \n end",
"def show\n render json: @post, serializer: Api::V1::PostSerializer\n end",
"def show\n @post = Post.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 show\n @post = Post.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 index\n @posts = PostService.getAllPosts\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render jsonapi: @post }\n end\n end",
"def index\n #@posts = Post.all\n @posts = Post.paginate( :page => params[:page],\n :per_page => 2\n )\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n @post = Post.where(:id => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n\t@posts = list_posts\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @post }\n format.json do\n render :json => @post.to_json(:only => [:id, :title, :text, :lat, :lng, :created_at, :post_type, :likes], \n :methods => [:image_url, :video_url], \n :include => [:comments])\n end\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end",
"def posts_list\n posts = Post.all.published.order(score: :desc, created_at: :desc)\n post_tags = Post.published.order(score: :desc, created_at: :desc).map { |post| Post.includes(:tags, :taggings).find_by(id: post.id).tags }\n categories = Category.all\n tags = Tag.all\n\n render_json(posts: posts, categories: categories, tags: tags, post_tags: post_tags)\n end",
"def index\n @posts = Post.all.order_by([:date_published, :desc]).page(params[:page]).per(20)\n #authorize! if cannot? :read, @posts\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n @post ||= Mist::Post.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 index\n page = params[:page]\n per_page = params[:per_page]\n\n posts = Post.order(published_at: :desc).page(page).per(per_page)\n\n # Передаём в заголовке общее количество страниц и записей.\n response.headers['Total-Pages'] = posts.total_pages\n response.headers['Total-Count'] = posts.total_count\n\n render json: posts\n end",
"def index\n render json: Post.all.order(id: :desc), each_serializer: V1::Posts::PostSerializer\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def posts\n posts = @client.entries(content_type: 'post').items\n posts || []\n end",
"def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html { render 'application/index' }\n format.json { render :json => { :post => @post.as_json } }\n end\n end",
"def show\r\n @post = root_post_of(Post.find(params[:id]))\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @post }\r\n end\r\n end",
"def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end",
"def index\n @art_posts = ArtPost.all\n\n render json: @art_posts\n end",
"def index\n per_page = params[:per_page] ? params[:per_page] : Post::PER_PAGE\n @posts = Post.by_published_date.paginate(page: params[:page], per_page: per_page)\n # Set count of posts and count of pages to query headers\n add_headers\n render json: @posts\n end",
"def show\n render json: {\n data: @post\n }\n end",
"def show\n @feed = Feed.find(params[:id])\n @posts = @feed.posts.order(\"published desc\").paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"def index\n # TODO: implement listing all posts\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts, :include => :tags }\n end\n end",
"def list\n comments = Comment.where(post: @post)\n render json: comments, status: 200\n end",
"def show\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 index\n\t \tif params[:title]\n\t\t render json: Post.search(params[:title])\n \t\telse\n\t \trender json: Post.all\n \tend\n\t end",
"def index\n unless can?(:manage, Post)\n @posts = @posts.published\n end\n \n respond_with @posts\n end",
"def index\n @posts = Post.all\n respond_with(@posts)\n end",
"def index\n @posts = Post.all.reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n render json: current_user.posts.all\n # TODO order posts alphabetically\n end",
"def index\n @posts = Post.includes(:author, channel: [:posts]).order(created_at: :desc)\n @posts = @posts.where(channel: @channel) if params[:channel_id]\n @posts = @posts.page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render jsonapi: @posts }\n end\n end",
"def show\n #@post = Post.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 index\n @page = params[:page] || 1\n @posts = @exchange.posts.page(@page, context: 0).for_view\n respond_to do |format|\n format.json do\n serializer = PostSerializer.new(\n @posts,\n links: { self: paginated_json_path(@posts.current_page),\n next: paginated_json_path(@posts.next_page),\n previous: paginated_json_path(@posts.previous_page) },\n include: %i[user]\n )\n render json: serializer.serialized_json\n end\n end\n end",
"def index\n @postos = Posto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postos }\n end\n end",
"def show\n @post = Post.find(params[:id])\n render json: @post, meta: { status: :ok }, meta_key: 'result'\n end",
"def show\n # @post = Post.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 index\n @api_v1_posts = Api::V1::Post.all\n end",
"def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end",
"def index\n respond_with Post.all\n end"
] |
[
"0.7865315",
"0.7494904",
"0.7494433",
"0.7494433",
"0.7488696",
"0.74314564",
"0.728645",
"0.728645",
"0.728645",
"0.72562826",
"0.72522277",
"0.7247287",
"0.7246305",
"0.72221965",
"0.72042215",
"0.72039723",
"0.7169929",
"0.71689725",
"0.71644753",
"0.7121855",
"0.71152896",
"0.7108617",
"0.70960873",
"0.7071454",
"0.7063796",
"0.70486146",
"0.7044637",
"0.7029959",
"0.69793427",
"0.6957234",
"0.6945899",
"0.6921306",
"0.6918641",
"0.6897198",
"0.689313",
"0.6890521",
"0.68769336",
"0.6876437",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6865055",
"0.6856369",
"0.6854135",
"0.68492866",
"0.6837785",
"0.6814047",
"0.67974555",
"0.67884254",
"0.6782457",
"0.6779375",
"0.6779375",
"0.6770256",
"0.67645854",
"0.6760845",
"0.6751376",
"0.6740988",
"0.6720944",
"0.6703801",
"0.66790265",
"0.6662053",
"0.6649574",
"0.66334385",
"0.6629263",
"0.66292495",
"0.6625863",
"0.6625277",
"0.6619148",
"0.6612677",
"0.6612347",
"0.659554",
"0.65946317",
"0.6584386",
"0.6583931",
"0.6578741",
"0.6564504",
"0.6556115",
"0.65437686",
"0.65419716",
"0.65410036",
"0.6528237",
"0.65246344",
"0.6520045",
"0.65119064",
"0.6511185",
"0.64960027",
"0.64946514",
"0.64891815",
"0.6476575",
"0.64645535",
"0.6463598"
] |
0.0
|
-1
|
GET /posts/1 GET /posts/1.json
|
def show
@post = Post.find(params[:id])
f= open("#{root_url}#{@post.image}")
@picture = EXIFR::JPEG.new(f)
@latitude=convert_to_google(@picture.exif.to_hash[:gps_latitude],
@picture.exif.to_hash[:gps_latitude_ref])
@longitude=convert_to_google(@picture.exif.to_hash[:gps_longitude],
@picture.exif.to_hash[:gps_longitude_ref])
if geo = Geocoder.search("#{@latitude},#{@longitude}").first
@city = geo.city || ""
@state = geo.state || ""
@zipcode = geo.postal_code || ""
end
# and in the view : <% @picture.exif.to_hash.each do |key, value| %>
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def show\n render json: Post.find(params[\"id\"])\n end",
"def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end",
"def show\n @post = Post.find(params[:id])\n\n render json: @post\n end",
"def show\n \trender json: Post.find(params[:id])\n end",
"def show\n post = Post.find(params[:id])\n render json: post\n end",
"def show\n\t \trender json: Post.find(params[:id])\n\t end",
"def show\n @post = Post.where(:id => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n render json: @post\n end",
"def index\n @posts = Post.all\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @posts}\n end\n end",
"def index\n\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def show\n \n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.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 show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.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 show\n @post = Post.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 index\n render json: { posts: Post.all }\n end",
"def show\n @post ||= Mist::Post.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 index\n @posts = Post.order(\"created_at DESC\").includes(:user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n # when you go to http://localhost:3000/posts/1, rails interprets this\n # as a call to the show action for the resource and passes 1 to the \n # :id paramater. Using this blog app you can do that by clicking the \n # show link for a post on the index page.\n\n @post = Post.find(params[:id])\n # The show action uses Post.find to search for a single record \n # in the database by its id value. After finding the record, Rails \n # displays it by using app/views/posts/show.html.erb\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n post = Post.find_by(id: params[:id])\n if post \n render json: post\n else\n render json: {errors: 'Not found'}\n end\n end",
"def index\n render json: Post.all\n end",
"def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def index\n @posts = Post.all.order(created_at: :asc)\n json_response(@posts)\n end",
"def index\n @posts = Post.all\n \n render json: @posts\n end",
"def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html { render 'application/index' }\n format.json { render :json => { :post => @post.as_json } }\n end\n end",
"def show\n render json: @post, serializer: Api::V1::PostSerializer\n end",
"def show\r\n @post = root_post_of(Post.find(params[:id]))\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @post }\r\n end\r\n end",
"def show\n render json: @post\n end",
"def show\n @api_v2_post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_v2_post }\n end\n end",
"def show\n render json: @post\n end",
"def index\n @posts = Post.paginate(:page => params[:page], :per_page => 10).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end",
"def index\n render json: Post.all.order(id: :desc), each_serializer: V1::Posts::PostSerializer\n end",
"def show\n render :json => @post\n end",
"def index\n # @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @posts }\n end\n end",
"def index\n @api_v1_posts = Api::V1::Post.all\n end",
"def show\n @post = Post.find(params[:id])\n render json: @post, meta: { status: :ok }, meta_key: 'result'\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render jsonapi: @post }\n end\n end",
"def show\n @posts = @game.posts.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n respond_to do |format|\n format.json { render template: 'api/games/game.json' }\n end\n end",
"def show\n @post = PostsService.getPostById(params[:id])\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def index\n #@posts = Post.all\n @posts = Post.paginate( :page => params[:page],\n :per_page => 2\n )\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n # Post.all returns all of the posts currently in the \n # database as an array of Post records that we store \n # in an instance variable called @posts.\n # http://guides.rubyonrails.org/active_record_querying.html\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n # The respond_to block handles both HTML and JSON calls \n # to this action. If you browse to \n # http://localhost:3000/posts.json, you’ll see a JSON \n # containing all of the posts. \n end",
"def index\n\n # We display the posts be cronological inverted order\n if authenticated?\n @posts = Post.order('created_at DESC').page(params[:page])\n else\n @posts = Post.order('created_at DESC').where(:status => :true).page(params[:page])\n end\n \n respond_to do |format|\n format.html { render html: @posts }\n format.json { render json: @posts }\n end\n end",
"def show\n @user = User.find(params[:id])\n @posts = @user.posts\n\n respond_to do |format|\n format.json { render json: {user: User._build(@user), posts: Post.build_posts(@posts)}, location: root_path }\n end\n end",
"def index\n\t\tgon.posts = Post.all.as_json\n\tend",
"def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end",
"def display_posts\n begin\n response = RestClient.get \"#{@@DOMAIN}/api/posts.json?all\", authorization_hash\n\n puts \"Response code: #{response.code}\"\n puts \"Response cookies:\\n #{response.cookies}\\n\\n\"\n puts \"Response headers:\\n #{response.headers}\\n\\n\"\n puts \"Response content:\\n #{response.to_str}\"\n\n js = JSON response.body\n js.each do |item_hash|\n item_hash.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def show\n #@post = Post.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 index\n @posts = Post.all\n @posts = paginate(@posts)\n authorize @posts\n\n render json: @posts, each_serializer: Api::V1::PostSerializer, meta: meta_attributes(@posts)\n end",
"def index\n @posts = Post.find(:all)\n end",
"def show\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 index\n render json: { posts: current_user.posts.all.map(&:to_h) }\n end",
"def show\n @feed = Feed.find(params[:id])\n @posts = @feed.posts.order(\"published desc\").paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"def index\n\t@posts = list_posts\n end",
"def show\n #GET a single post by ID\n @post = Post.find(params[:id])\n end",
"def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"def show\n @post = Post.find(params[:id])\n @title = @post.title\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n # TODO: implement listing all posts\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end",
"def show\n @blogpost = Blogpost.published.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blogpost }\n end\n end",
"def show\n # @post = Post.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 post(postid)\n request(:id => postid).posts.first\n end",
"def show\n Rails.logger.debug(\"Inside show \")\n @post = Post.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 show\n @posto = Posto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @posto }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @post }\n format.json do\n render :json => @post.to_json(:only => [:id, :title, :text, :lat, :lng, :created_at, :post_type, :likes], \n :methods => [:image_url, :video_url], \n :include => [:comments])\n end\n end\n end",
"def display_post\n begin\n # asks the user for the post id\n print \"Enter the post ID: \"\n id = STDIN.gets.chomp\n response = RestClient.get \"#{@@DOMAIN}/api/posts/#{id}.json\", authorization_hash\n\n js = JSON response.body\n js.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def index\n @posts = Post.all.reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = PostService.getAllPosts\n end",
"def show\n render json: {\n data: @post\n }\n end",
"def show\n @post = Post.find(params[:id])\n @videos = Video.get_for @post #where([\"post_id = ?\", params[:id]]).all\n @background = get_background_for @post #Background::DEFAULT #Background.where([\"post_id = ?\", params[:id]])\n @nav = get_navigation :for => 'post', :current => @post\n @menu = get_menu :for => 'post'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end",
"def get(options = {})\n response= handle_errors { self.class.get('/get', :query => options)}\n if response[\"posts\"][\"post\"].is_a?(Hash)\n Rubycious::Post.new response[\"posts\"][\"post\"]\n elsif response[\"posts\"][\"post\"].is_a?(Array)\n response[\"posts\"][\"post\"].collect{|i| Rubycious::Post.new(i)}\n else\n nil\n end\n end",
"def show\n if !params[:id]\n @post = Post.find_by_title('Welcome')\n elsif params[:id] =~ /^[a-zA-Z ]+$/\n @post = Post.find_by_title(params[:id])\n else\n @post = Post.find(params[:id].to_i)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @blogpost = Blogpost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blogpost }\n end\n end",
"def show\n @blog_post = BlogPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blog_post }\n end\n end",
"def index\n @post = Post.find_by_id(params[:post_id])\n if @post.nil?\n return render json: { error: \"Post not found\" }, status: :not_found\n end\n render json: @post.comments,status: 200\n end",
"def show\n @post2 = Post2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post2 }\n end\n end"
] |
[
"0.77110183",
"0.73537844",
"0.73433185",
"0.73379177",
"0.73228735",
"0.7293139",
"0.7275997",
"0.7256934",
"0.7161576",
"0.7158913",
"0.71552676",
"0.71552676",
"0.7119547",
"0.7094749",
"0.7094749",
"0.7094749",
"0.70943594",
"0.7071599",
"0.70607626",
"0.70452625",
"0.7032558",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.69897074",
"0.6955722",
"0.6955722",
"0.6954564",
"0.6937062",
"0.6936725",
"0.69257236",
"0.6917876",
"0.69010335",
"0.69005007",
"0.6894985",
"0.6893989",
"0.68756175",
"0.6860515",
"0.6853294",
"0.6853291",
"0.6847577",
"0.68364173",
"0.68232405",
"0.68093437",
"0.6804144",
"0.67621773",
"0.6743674",
"0.67226875",
"0.6720067",
"0.67147297",
"0.6713107",
"0.6699554",
"0.6693189",
"0.6679935",
"0.6655543",
"0.6644503",
"0.6641595",
"0.66299",
"0.6619761",
"0.66178924",
"0.66124725",
"0.6608166",
"0.66017526",
"0.6597235",
"0.65952027",
"0.65909946",
"0.65858185",
"0.6582703",
"0.658145",
"0.65768254",
"0.65733755",
"0.6568626",
"0.65668",
"0.655592",
"0.65385455",
"0.6525845",
"0.65144473",
"0.6513119",
"0.6497587",
"0.6497312",
"0.6493223",
"0.6491053",
"0.64720887",
"0.6471776",
"0.64655757",
"0.6455566",
"0.64530945",
"0.6448596",
"0.64456475",
"0.64289075"
] |
0.0
|
-1
|
GET /posts/new GET /posts/new.json
|
def new
@post = Post.new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end",
"def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n post = Post.new\n render json: post\n end",
"def new\n authenticated\n\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new \n @post = Post.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\r\n @post = Post.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @post }\r\n end\r\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n @title = \"New post\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end",
"def new\n @post = Post.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @title = \"Create New Post\"\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end",
"def new\n @post = Post.new\n # Creating a new post involves two actions. \n # The first is the new action, which \n # instantiates an empty Post object\n # The new.html.erb view displays this \n # empty Post to the user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n format.xml { render :xml => @post }\n end\n end",
"def new\n # responsbile for creating a new instance of a post\n @post = Post.new\n end",
"def new\n redirect_to posts_path and return unless Mist.authorized?(:create_post, self)\n @post = Mist::Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end",
"def new\n authorize\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n # @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @post }\n end\n end",
"def new\n @post = model.new\n\n respond_to do |format|\n format.html { render :action => resource_template(\"new\") }\n end\n end",
"def new\n @post = Post.new\n @title = \"New Post\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n format.json { render :json => @post }\n end\n end",
"def new\n @user = User.find(params[:user_id])\n @post = Post.new(:user_id => @user.id)\n @title = \"New Post\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @news_post = NewsPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news_post }\n end\n end",
"def new\n @news_post = NewsPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news_post }\n end\n end",
"def new\n @posto = Posto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @posto }\n end\n end",
"def new #http://localhost:3000/posts/new\n\t@post = Post.new #creates a new empty post,if a form is created for it, it will be empty as well \n end",
"def new\n @mypost = Mypost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mypost }\n end\n end",
"def new\n #@post = Post.new\n\n #respond_to do |format|\n # format.html # new.html.erb\n #format.json { render json: @post }\n #end\n end",
"def new\n @newspost = Newspost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspost }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @news_post }\n end\n end",
"def new\n @posttag = Posttag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @posttag }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html #{ redirect_to '/' }\n format.json { render json: @post }\n end\n end",
"def new\n @posts = Post.find(:all, :order => 'updated_at DESC')\n @post = Post.new\n @post.title = \"Überschrift*\"\n\n respond_to do |format|\n format.html { render :template => \"posts/new\" }\n format.xml { render :xml => @post }\n end\n end",
"def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def new\n @posttag = Posttag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @posttag }\n end\n end",
"def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def new\n @post = Post.new\n @tags = Tag.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @api_v2_post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_v2_post }\n end\n end",
"def new\n @post = Post.new()\n end",
"def new\n @post = Post.new()\n end",
"def new\n @post = Post.new()\n end",
"def new\n @post = Post.new #returns an empty post\n end",
"def new\n @post = current_user.posts.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end",
"def new\n @post = Post.new\n respond_with(@post)\n end",
"def new\n @post = Post.new\n respond_with(@post)\n end",
"def new\n\t\t@post = Post.new\n\t\trender :new\n\tend",
"def new\n @test_post = TestPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_post }\n end\n end",
"def new\n @blogpost = Blogpost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blogpost }\n end\n end",
"def new\n respond_to do |format|\n format.html { render :template => 'posts/new' } # we specify the template because in theory we could be reverting from a post to create \n format.js { render :partial => 'posts/reply' }\n end\n end",
"def new\n @posting = Posting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @posting }\n end\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end"
] |
[
"0.8041974",
"0.80156785",
"0.79855186",
"0.7931169",
"0.79215",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.78988296",
"0.78666586",
"0.78468144",
"0.78327304",
"0.7832491",
"0.7822257",
"0.7780887",
"0.7681105",
"0.7630568",
"0.7627285",
"0.75908595",
"0.7578067",
"0.75370306",
"0.7530152",
"0.7473938",
"0.74487615",
"0.7443868",
"0.74131733",
"0.74131733",
"0.7405905",
"0.73812896",
"0.73479295",
"0.7308366",
"0.7286089",
"0.7285293",
"0.72837895",
"0.7271229",
"0.7254161",
"0.7231453",
"0.7225646",
"0.72144365",
"0.7204585",
"0.7194356",
"0.71823084",
"0.71823084",
"0.71823084",
"0.7174505",
"0.71544987",
"0.71502286",
"0.71502286",
"0.71278226",
"0.7113166",
"0.7111857",
"0.710849",
"0.7106992",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334"
] |
0.0
|
-1
|
POST /posts POST /posts.json
|
def create
@post = Post.new(params[:post].merge!(:user => current_user))
if @post.save
flash[:notice] = 'Your post has been created.'
redirect_to root_path
else
render action: "new"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n render json: Post.create(params[\"post\"])\n end",
"def create\n respond_with Post.create(params[:posts])\n end",
"def create\n @post = Post.create(post_params)\n render json: @post, serializer: PostSerializer\n end",
"def create\n @post = Post.new(post_params)\n @post.user = current_user\n\n if @post.save\n render json: @post, status: :created, location: api_v1_post_path(@post), serializer: Api::V1::PostSerializer\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = current_user.posts.new(post_params)\n\n if @post.save\n render json: {\n data: @post\n }\n else\n render json: {\n errors: @post.errors\n }\n end\n end",
"def create\n post = @current_user.posts.create(post_params)\n\n if post.save\n render json: post\n else\n render json: { errors: post.errors.full_messages }, status: :forbidden\n end\n end",
"def create\n title = params[:title]\n body = params[:body]\n\n @post = current_user.posts.create(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end",
"def create\n @post = Post.new({ :title => params[:post][:title] })\n \n respond_to do |format|\n if @post.save\n format.json { render :json => { :post => @post.as_json}, :status => :created, :location => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find(params[:user_id])\n @post = @user.posts.new(post_params)\n\n if @post.save\n render json: @post, status: :created, location: [@user, @post]\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = Post.new(post_params)\n\n if @post.save\n render json: {\n message: 'Post was successfully created.'\n }, status: :created\n else\n render json: {\n errors: @post.errors,\n message: 'Post could not be created.'\n }, status: :unprocessable_entity\n end\n end",
"def post(id, opts = {})\r\n uri = url_for(\"posts/#{id}\", opts)\r\n response = RestClient.get(uri)\r\n JSON.parse response\r\n end",
"def create\n\n\n @post = current_user.posts.build(post_params)\n\n if @post.save\n\n render json: \"Posted successfully\", status: 201\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = Post.new(params[:post])\n respond_to do |format|\n if @post.save\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.create(params[:post])\n end",
"def create\n\t\tpost = @current_user.posts.create(post_params) \n\t\tif post.save\n\t\trender json: {success: true, auth_token: @current_user.authentication_token, post_id: post.id}\n\t else\n\t render json: {success: false, errors: post.errors.full_messages, message: \"Validation failed\"}, status: 422\n\t\tend \n\tend",
"def create_posts\n end",
"def create_posts\n end",
"def create_post\n begin\n #asks the user for the title, body, and whether it should be anonymous\n print \"Title: \"\n title = STDIN.gets.chomp\n print \"Body: \"\n body = STDIN.gets.chomp\n print \"Post as Anonymous? (y/n): \"\n anonymous = STDIN.gets.chomp.upcase == 'Y' ? true : false\n # check user information from login\n\n # Rails will reject this unless you configure the cross_forgery_request check to\n # a null_session in the receiving controller. This is because we are not sending\n # an authenticity token. Rails by default will only send the token with forms /users/new and\n # /users/1/edit and REST clients don't get those.\n # We could perhaps arrange to send this on a previous\n # request but we would then have to have an initial call (a kind of login perhaps).\n # This will automatically send as a multi-part request because we are adding a\n # File object.\n response = RestClient.post \"#{@@DOMAIN}/api/posts.json\",\n\n {\n post: {\n title: title,\n body: body,\n anonymous: anonymous\n },\n }, authorization_hash\n\n if (response.code == 201)\n puts \"Created successfully\"\n end\n puts \"URL for new resource: #{response.headers[:location]}\"\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def create\n @api_post = Api::Post.new(api_post_params)\n\n if @api_post.save\n render json: @api_post, status: :created, location: @api_post\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.json { render :show, status: :created, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \tif logged_in?\n params[:post][:user_id] = current_user.id\n @post = Post.new(post_params)\n if @post.save\n puts @post.published\n render json: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end\n end",
"def create\n respond_with Post.create(post_params)\n end",
"def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"def post(*args)\n request(:post, *args)\n end",
"def post(*args)\n request :post, *args\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_post = current_user.posts.new(api_post_params)\n if @api_post.save\n render :show\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def create\n authenticated\n\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new post_params\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n if @post.save\n render :show, status: :created, location: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n puts \"create post: #{post_params.inspect}\"\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n @title = \"Create New Post\"\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, :notice => 'Post was successfully created.' }\n format.json { render :json => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end",
"def create\n post_service = PostService.new(current_user, params)\n post_service.create_post\n #post_service.create\n respond_to do |format|\n if post_service.save?\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { redirect_to new_post_url, alert: post_service.errors }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.json { render json: @post, status: :created, location: @post }\n format.xml { render xml: @post, status: :created, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #raise params.inspect\n \n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @posts = Post.page(params[:page]).order('created_at desc')\n @post = Post.new(post_params)\n @user = User.where('account_id == ?', current_account.id)[0]\n respond_to do |format|\n if @post.save\n format.html { redirect_to '/posts' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :index }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\t\t\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user_post_param\n respond_to do |format|\n if @post.save\n format.html do\n redirect_to @post, notice:\n \"Post was successfully created.\"\n end\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json do\n render json: @post.errors, status:\n :unprocessable_entity\n end\n end\n end\n end",
"def create\n @api_v1_post = Api::V1::Post.new(api_v1_post_params)\n\n respond_to do |format|\n if @api_v1_post.save\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_post }\n else\n format.html { render :new }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = current_user.posts.new(params[:post])\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n @post.user_id = current_user.id\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { redirect_to posts_path, flash: { error: @post.errors.full_messages } }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def new\n post = Post.new\n render json: post\n end",
"def create\n @user = current_user\n @post = @user.posts.build(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save?\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @post = Post.new(params[:post])\r\n\r\n respond_to do |format|\r\n if @post.save\r\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\r\n format.json { render json: @post, status: :created, location: @post }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @post = Post.create(post_params)\n set_posts\n respond_to do |format|\n format.js\n format.html\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, :notice => \"slam\" }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { redirect_to posts_path }\n flash[:alert] = \"shit.\"\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n post\n end",
"def create\n @post = Post.new(content: params[:post][:content], user_id: @user.id)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @user }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { redirect_to @user }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @post = Post.new(post_params)\n @post.user_id = params[:user_id]\n if @post.save\n render json: @post, meta: { status: :created }, meta_key: 'result', status: :created\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = current_user.posts.new(post_params.merge(writter: current_user.name))\n\n if @post.save\n render json: {status: 1, id: @post.id.to_s, notice: \"新增成功,标题是:#{@post.title.capitalize}\", number: @post.number, errors: []}\n else\n render json: {status: -1, notice: \"新增失败,请先登录\", errors: @post.errors.full_messages}\n end\n end",
"def create\n puts \"Trying to Create New Post\"\n # Creates new post with given content tied to given userid\n @post = Post.new(post_params) \n if @post.save\n puts \"Post successfully created\"\n response.status=(201)\n render json: {status: \"Success\", message: [\"Post created!\"]}\n else\n # Error handling\n puts \"Something went wrong while creating new Post\"\n puts(@Post.errors.full_messages)\n response.status=(422)\n render json: { status: \"Error\", message: [@post.errors.full_messages]}\n end\n end",
"def create\n @post = current_user.posts.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to list_of_posts_post_path(@post.user), notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n execute(:post, *args)\n end",
"def create\n redirect_to posts_path and return unless Mist.authorized?(:create_post, self)\n coerce_date(params[:post], 'published_at')\n @post = Mist::Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, :notice => 'Post was successfully created.' }\n format.json { render :json => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = current_user.posts.build(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to new_post_successful_posts_path, notice: 'Anúncio criado com sucesso.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end",
"def create\n redirect_to login_path unless session[:user_id]\n message = 'Post was successfully created.'\n @post = Post.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: message }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n @post.user = User.find_by_auth_token!(cookies[:auth_token])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = current_user.posts.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n if @post.save\n redirect_to find_redirect(@post.page)\n else\n render :new\n render json: @post.errors, status: :unprocessable_entity\n end\n end"
] |
[
"0.74463975",
"0.73221767",
"0.73072433",
"0.7123966",
"0.7015686",
"0.701327",
"0.69841874",
"0.6939327",
"0.69313824",
"0.69053805",
"0.68196476",
"0.6812792",
"0.6793222",
"0.6792862",
"0.6779654",
"0.6779654",
"0.67625546",
"0.67602354",
"0.67515427",
"0.6735786",
"0.66983837",
"0.6694823",
"0.6676922",
"0.6648634",
"0.6618174",
"0.6609208",
"0.6576672",
"0.6567517",
"0.6535031",
"0.65248317",
"0.6517826",
"0.6512526",
"0.6512526",
"0.65004253",
"0.64875203",
"0.6482612",
"0.64796066",
"0.6479418",
"0.64762664",
"0.64762664",
"0.64762664",
"0.64762664",
"0.64762664",
"0.64762664",
"0.64762664",
"0.6452396",
"0.6443543",
"0.64413923",
"0.6439579",
"0.6431225",
"0.6411242",
"0.64027417",
"0.6402409",
"0.63972473",
"0.63956606",
"0.6388207",
"0.6388207",
"0.6380103",
"0.63764375",
"0.6374259",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.6369631",
"0.6361449",
"0.6350474",
"0.6349784",
"0.6345706",
"0.6312865",
"0.63084143",
"0.630361",
"0.63009614",
"0.62957925",
"0.6295694",
"0.62955",
"0.6294854",
"0.62942207",
"0.628781",
"0.62877417",
"0.6283785",
"0.6282612",
"0.6263583"
] |
0.0
|
-1
|
PUT /posts/1 PUT /posts/1.json
|
def update
@post = Post.find(params[:id])
respond_to do |format|
if @post.update_attributes(params[:post])
format.html { redirect_to @post, notice: 'Post was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @post.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update\n respond_with Post.update(params[:id], params[:posts])\n end",
"def update\n respond_with post.update(params[:id], params[:post])\n end",
"def update\n title = params[:title]\n body = params[:body]\n\n @post.update!(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end",
"def update\n authorize @post\n\n if @post.save\n render json: @post\n else\n render json: @post.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n respond_with Post.update(params[:id],post_params)\n end",
"def update\n\t\t@post = post.find(params[:id])\n\t\t@post.update_attributes(post_params)\n\t\trespond_to do |format|\n\t\t\tformat.html {redirect_to post_path(@post)}\n\t\t\tformat.json {render json: @post}\n\t\tend\n\tend",
"def update\n if @post.update({\n title: post_params[:title],\n content: post_params[:content],\n })\n render json: Post.all.as_json\n else\n render json: {errors: @post.errors.full_messages}, status: :unprocessable_entity\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.update(params[:id], params[:post])\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n @post.update_attributes(params[:post])\n format.html { redirect_to posts_url, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n end \n end",
"def update\n @api_post = Api::Post.find(params[:id])\n\n if @api_post.update(api_post_params)\n head :no_content\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def update\n id = Post.find(params[:id])._id\n \n respond_to do |format|\n if ((@post.update_attributes(params[:post])) && (@post._id = id))\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n redirect_to '/posts'\n end",
"def update\n\t\tif @post.update(post_params)\n\t\t\trender json: @post, status: :success\n\t\telse\n\t\t\trender json: @post.errors, status: :unprocessable_entity #422\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @api_v1_post.update(api_v1_post_params)\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_post }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request(:put, *args)\n end",
"def update\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n if (@post.update(params.permit(:title, :content)))\n render json: @post, status: :ok\n else\n render json: @post.errors, status: 422\n end\n end",
"def update\n\t\t# find our post\n\t\tid = params[:id]\n\t\t@post = Post.find(id)\n\n\t\t# increment the number of votes\n\t\tif params[:tweet] == \"true\"\n\t\t\t@post.votes = @post.votes + 1\n\t\t\t@post.save\n\t\telsif params[:flagged] == \"true\"\n\t\t\t@post.flagged = @post.flagged + 1\n\t\t\t@post.save\n\t\tend\n\t\t\n\t\t# TODO: ask Tom what this does again\n\t\trender :json => @post\n\tend",
"def put!\n request! :put\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to posts_path, notice: 'Post was successfully updated.' }\n format.json { render json: @post }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update! { posts_url }\n end",
"def update\n if @post.update(post_params)\n render json: {\n data: @post\n }\n else\n render json: {\n errors: @post.errors\n }\n end\n end",
"def update(*args)\n put(*args)\n end",
"def update(*args)\n put(*args)\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.json { render :show, status: :ok, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\n @post.update_attributes(params[:post])\n respond_with(@post)\n end",
"def update\n @api_v2_post = Post.find(params[:id])\n\n respond_to do |format|\n if @api_v2_post.update_attributes(params[:api_v2_post])\n format.html { redirect_to @api_v2_post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v2_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end",
"def update\n post = Post.find_by(id: params[:id])\n # byebug\n\n post.assign_attributes(update_params)\n if post.valid?\n post.save\n render json: post, status: :created\n else\n render json: {errors: post.errors.full_messages}, status: 422\n end\n end",
"def update_post(post_id, post_data)\n uri = \"#{@api_url}/#{@project_id}/posts/#{post_id}?access_token=#{@access_token}\"\n put uri, post_data\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'slam updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authenticated\n\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: '' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n update_resource_response(@post, blog_post_params)\n end",
"def update\n @post = Post.find_by_slug(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update(post_params)\n render action: \"show.json.jbuilder\"\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to :action => 'index', notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = current_user\n @post = @user.posts.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n post = current_user.posts.find_by_uuid(params[:id])\n return render_item_not_found('Post') unless post\n post.update_attributes(post_params)\n broadcast(post, 'update')\n head :ok\n end",
"def update\r\n @post = Post.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @post.update_attributes(params[:post])\r\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n @title = \"EDIT\"\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def update\n if @post.update(post_params)\n render json: {status: 1, id: @post.id.to_s, notice: \"修改成功,标题是:#{@post.title.capitalize}\", errors: []}\n else\n render json: {status: -1, notice: \"修改失败\", errors: @post.errors.fall_message}\n end\n end",
"def update\n respond_to do |format|\n @post.title = params[:title]\n @post.body = params[:body]\n @tags = params[:tags].split(',') unless params[:tags].blank?\n Post.transaction do\n if @post.save\n destroy_tags(@post, @tags)\n create_tags(@post, @tags)\n format.html { redirect_to posts_path, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n @action_path = post_path @post\n @method = :put\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n redirect_to posts_path and return unless Mist.authorized?(:update_post, self)\n @post = Mist::Post.find(params[:id])\n\n respond_to do |format|\n coerce_date(params[:post], 'published_at')\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end",
"def update\n @post = Post.update(params[:id], params[:post].permit(:caption))\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to magazine_post_path(@post.short_url), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"editor\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def update\n authorize\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post.update!(post_params)\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to \"/#{session[:username]}\", notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n if @post.update(post_params)\n render :show, status: :ok, location: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @post.update(post_params)\n render :show, status: :ok, location: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\t\n\t\tpost = @current_user.role == \"admin\" ? Post.find_by(id: params[:id]) : @current_user.posts.find_by(id: params[:id]) \n\t\tif post && post.update_attributes(post_params)\n\t\trender json: {success: true, auth_token: @current_user.authentication_token, post_id: post.id, post_desc: post.description}\n\t else\n\t render json: {success: false, message: \"not found or validation failed\"}, status: 422\n\t\tend \n\tend",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:article])\n format.html { redirect_to @post, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to sites_url, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_post\n @api_v1_post = Api::V1::Post.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @resource.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post}\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n clean = params.require(:post).permit(:title, :body, :tag)\n if @post.update_attributes(clean)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n @post.update_attributes(params[:post])\n flash[:notice] = \"Updated succesfully\"\n respond_with(@post)\n end",
"def update\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7308219",
"0.7123652",
"0.68159384",
"0.66432106",
"0.66181636",
"0.6607148",
"0.6583982",
"0.6564183",
"0.6552021",
"0.6532697",
"0.6511846",
"0.64877653",
"0.6446283",
"0.64321554",
"0.64155626",
"0.638547",
"0.63833165",
"0.63661736",
"0.63641906",
"0.6363359",
"0.63632154",
"0.6359975",
"0.63548297",
"0.63542086",
"0.6352791",
"0.6345763",
"0.63306063",
"0.6318297",
"0.6300069",
"0.6300069",
"0.6273585",
"0.62707883",
"0.62700063",
"0.6267426",
"0.6240362",
"0.6237036",
"0.62367743",
"0.62214875",
"0.6218219",
"0.6213732",
"0.62063664",
"0.61901885",
"0.61901885",
"0.61901885",
"0.61901885",
"0.61853313",
"0.6181859",
"0.6181859",
"0.61765033",
"0.6166637",
"0.61509615",
"0.6148211",
"0.6140376",
"0.6134548",
"0.6133479",
"0.61251056",
"0.61222315",
"0.61204594",
"0.6110559",
"0.6108299",
"0.60977256",
"0.6083164",
"0.6059843",
"0.6045384",
"0.60448086",
"0.6027209",
"0.6026328",
"0.60209423",
"0.60053504",
"0.5995274",
"0.59937966",
"0.598489",
"0.5965054",
"0.5965054",
"0.59429854",
"0.59422094",
"0.59290034",
"0.59253895",
"0.5915753",
"0.5909751",
"0.5909557",
"0.5909293",
"0.5900103",
"0.5898666"
] |
0.6165114
|
64
|
DELETE /posts/1 DELETE /posts/1.json
|
def destroy
@post = Post.find(params[:id])
@post.destroy
respond_to do |format|
format.html { redirect_to posts_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n post = Post.find(params[:id])\n if post.destroy\n render json: {status: \"success\", data: {id: params[:id]}}, status: :ok\n end\n end",
"def destroy\n @post.destroy\n render json: {}, status: :ok\n end",
"def destroy\n if @post.destroy\n render json: {\n post: @post\n }, status: :ok\n else\n render status: :bad_request\n end\n end",
"def destroy\n @api_v2_post = Post.find(params[:id])\n @api_v2_post.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v2_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_post.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_posts_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authenticated\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @post = Post.find(params[:id])\n # @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post.destroy\n\n json_response(@post)\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with Post.destroy(params[:id])\n end",
"def destroy\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n r.delete @post\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end",
"def destroy\n @api_post.destroy\n\n head :no_content\n end",
"def destroy\n @post.destroy\n render json: {\n data: {\n post: { key: @post.id },\n status: @post.status,\n }\n }\n end",
"def destroy\n\t\tpost = Post.find(params[:id])\n\t\t# byebug\n \tpost.destroy\n\t posts = Post.all\n \trender json: posts\n end",
"def destroy\r\n @post = Post.find(params[:id])\r\n @post.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to posts_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_path, notice: \"Post removed.\" }\n format.json { render 'destroy' }\n end\n end",
"def delete\n @post = Post.find(params[:id])\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path(client_id:current_user.client.id, per_page:5), notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with Post.destroy(params[:id])\n end",
"def destroy\r\n @post = Post.find(params[:id])\r\n @post.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to root_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @post.destroy\n\n head :no_content\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/posts' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n render json: Post.all.as_json\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to blog_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n @title = \"Kill Post\"\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to all_user_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html {redirect_to posts_url, notice: 'Post was successfully destroyed.'}\n format.json {head 200}\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path, notice: 'Post was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with post.destroy(params[:id])\n end",
"def destroy\n @post.destroy\n \n respond_to do |format|\n format.html { redirect_to post_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n Post.find(params[:id]).delete\n\n redirect_to '/'\n end",
"def destroy\n # @post = Post.find(params[:id])\n #@post.destroy\n\n #respond_to do |format|\n # format.html { redirect_to posts_url }\n #format.json { head :no_content }\n #end\n end",
"def delete(url)\n raise Error, \"Missing URL\" unless url\n get('posts/delete?uri=' << u(url))\n nil\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to news_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find_by_slug(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url, notice: \"Anúncio removido com sucesso.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.friendly.find(params[:id])\n @post.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Story deleted' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: \"Postitus edukalt kustutatud!\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Postagem excluida com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Postagem excluída com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mural_post.destroy\n respond_to do |format|\n format.html { redirect_to mural_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @posto = Posto.find(params[:id])\n @posto.destroy\n\n respond_to do |format|\n format.html { redirect_to postos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_post.destroy\n end"
] |
[
"0.8046884",
"0.76902676",
"0.7583626",
"0.75803024",
"0.7568048",
"0.75047046",
"0.75031126",
"0.74750155",
"0.74671036",
"0.74650854",
"0.746482",
"0.74589694",
"0.74589694",
"0.74589694",
"0.74589694",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.7423174",
"0.74059606",
"0.73990285",
"0.73928183",
"0.7389498",
"0.7371715",
"0.7371117",
"0.7349121",
"0.7344524",
"0.7342226",
"0.7338908",
"0.7313371",
"0.73123556",
"0.731156",
"0.73095584",
"0.7299751",
"0.7298017",
"0.7298017",
"0.7282874",
"0.7277125",
"0.7266815",
"0.7260945",
"0.72549784",
"0.7254856",
"0.7239102",
"0.7238946",
"0.7229726",
"0.7227931",
"0.7221013",
"0.721375",
"0.7211237",
"0.72097856",
"0.7190222",
"0.71850675",
"0.7171746",
"0.71533066",
"0.71457464",
"0.71434635",
"0.7142048",
"0.7139985",
"0.7137574"
] |
0.7428427
|
54
|
GET /venue_products/1 GET /venue_products/1.json
|
def show
@venue_product = VenueProduct.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @venue_product }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @api_v1_products = Product.all\n json_response(@api_v1_products)\n end",
"def show\n json_response(@api_v1_product)\n end",
"def show\n \n @product = Product.find(params[:id])\n @vendors = @product.vendor(:all)\n #@vendors = Vendor.find(params[:id])\n #@vendors = Vendor.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @venue_product = VenueProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venue_product }\n end\n end",
"def show\n render json: @product, status: 200\n end",
"def product(name)\n get(\"/apiproducts/#{name}\")\n end",
"def index\n @products = Product.all\n render json: @products\n end",
"def show\n render json: @product\n end",
"def show\n render json: @product\n end",
"def show\n result = Product.find(params[:id])\n render json: {\n status: :ok,\n product: result\n } \n end",
"def show\n @product = Product.find(params[:id])\n\n render json: @product\n end",
"def show\n @products = @vendor.products\n end",
"def show\n @product = Product.find(params[:id])\n json_response(params)\n end",
"def show\n product = Product.find_by_id(params[:id])\n\n render json: product\n end",
"def show\n @products = Product.find_by_id(params[:id])\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end",
"def index\n @food_products = FoodProduct.all\n render json: @food_products\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventories }\n end\n end",
"def show\n @venue = Venue.find(params[:id])\n\n render json: @venue\n end",
"def index\n \tproducts = Product.all\n \trender json: products\n \tend",
"def show\n @product = Product.find(params[:id])\n render json: @product, status: :ok\n end",
"def show\r\n @venue = Venue.fetch(params[:id])\r\n render json: @venue\r\n end",
"def show\n @home_searches_product = Home::Searches::Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_searches_product }\n end\n end",
"def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end",
"def show\n @onecompany_product = Onecompany::Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @onecompany_product }\n end\n end",
"def show\n render json: @product_buy_click\n end",
"def show\n render json: @food_product\n end",
"def show\n render :json => Producto.find(params[:id])\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def get_variant\n @product = Spree::Product.find_by :slug => params[:product_id]\n @variant = @product.find_variant_by_options(params[:ids].split(','))\n if @variant\n respond_to do |format|\n format.json {render json: {variant_id: @variant.id, image_ids: @variant.image_ids}}\n end\n end\n end",
"def index\n begin\n @products = Product.all\n render json: @products, status: 200\n rescue => exception\n render json: { errors: exception }\n end\n end",
"def index\n render :json => Producto.all\n end",
"def show\n @product = Product.find(params[:id])\n\n render json: @product\n end",
"def products\n request :public, :get, :products\n end",
"def index\n @products = Product.all\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end",
"def show\n @product = Product.eager_loading.find_by_uuid(params[:id])\n\n respond_to do |format|\n format.html { redirect_to edit_shop_product_path(@product.shop_id, @product)}\n format.json { render json: @product.as_json(:include => {:product_variants => {:include => [:option_types,:pictures]}, :shipping_category => {}}, :methods => [:taxon_ids]) }\n end\n end",
"def getKind\n @products = Product.where(\"kind = ?\", params[:kind]).available.PriceOrder.paginate(page: params[:page], per_page: 5)\n render json: @products\n end",
"def show\n @product = ProductProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end",
"def index\n @products = Product.all\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n end",
"def show\n @shopifyproduct = Shopifyproduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shopifyproduct }\n end\n end",
"def products\n Product.find_all_by_vendor_id(@id)\n end",
"def index\n @product_images = ProductImage.where(product_uuid: params[:product_id])\n render json: @product_images, status: 200\n end",
"def index\n @products = @user.products\n # was @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def index\n @product_delivereds = ProductDelivered.where(:subscription_id => @subscription.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_delivereds }\n end\n end",
"def index\n @size_to_products = SizeToProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @size_to_products }\n end\n end",
"def index\n limit = params[:limit]&.to_i || 10\n page = params[:page]&.to_i || 0\n if params[:available] == \"1\"\n @products = Product.paginate(page, limit).available\n else\n @products = Product.paginate(page, limit)\n end\n render json: @products\n end",
"def show\n #@restroom = Restroom.find(params[:id])\n @venue = client.venue(:query => params[:venue_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restroom }\n end\n end",
"def index\n @products = @co.products\n end",
"def index\n @product_colors = ProductColor.where(\"product_type_id = ?\", params[:get_product_type_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_colors }\n end\n end",
"def products\n FarMar::Product.by_vendor(id)\n end",
"def products\n FarMar::Product.by_vendor(id)\n end",
"def index\n @products = Product.all\n render json: {is_success: true, error_code: 200, message: \"Products Found Successfully\", result: @products}, status: 200\n end",
"def show\n @product = Product.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n # is_my_resource(params[:id])\n\n # prossumerProductsIds = Prossumer.find(params[:id]).products.ids\n render json: ProductAuth.where({product_id: params[:id], group_id: params[:group_id]}).first.as_json(:include => :product)\n end",
"def show\n @product = Product.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def index\n @products = Spree::Product.not_deleted.includes(:variants).page(params[:page]).per(Spree::Config[:orders_per_page])\n respond_with @products\n end",
"def show\n @product_delivered = ProductDelivered.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_delivered }\n end\n end",
"def index\n #@products = Product.all\n @products = Product.paginate( :page => params[:page],\n :per_page => 40\n )\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def show\n @product = @person.products.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @product }\n end\n end",
"def show\n @magento_product = MagentoProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @magento_product }\n end\n end",
"def set_api_v1_product\n begin\n @api_v1_product = Product.find(params[:id])\n rescue => ex\n json_response({error: ex.message}, :not_found)\n end\n end",
"def index\n @products = current_company.products.order('created_at desc').page(params[:page]).per(20)\n render json: @products, meta: {total_pages: @products.total_pages, total_count: @products.total_count}\n end",
"def show\n @online_store = OnlineStore.find(params[:id])\n @products = @online_store.products\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_store }\n end\n end",
"def show\n @paper_venue = PaperVenue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @paper_venue }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n end",
"def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end",
"def user_products\n @products = current_user.products\n\n respond_to do |format|\n format.html\n format.json { render json: @products }\n end\n end",
"def show\n @product_item = ProductItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_item }\n end\n end",
"def index\n @tipo_products = TipoProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_products }\n end\n end",
"def index\n @site_plans = @product.site_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_plans }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def index\n @products = Product.order('item_code ASC').page(params[:page]).per(25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end"
] |
[
"0.743204",
"0.730987",
"0.7213589",
"0.70481384",
"0.7044168",
"0.7021765",
"0.6987864",
"0.69718915",
"0.69664615",
"0.68962646",
"0.68946964",
"0.68872815",
"0.68672884",
"0.6861995",
"0.6859079",
"0.6854056",
"0.68468815",
"0.6840597",
"0.6788395",
"0.6785125",
"0.6762956",
"0.67590237",
"0.6736014",
"0.6728679",
"0.6724511",
"0.67081845",
"0.6706667",
"0.67043835",
"0.6703674",
"0.6702911",
"0.6702911",
"0.6702911",
"0.6702398",
"0.6700823",
"0.669605",
"0.6691882",
"0.66846144",
"0.66759247",
"0.6674522",
"0.6671376",
"0.6663379",
"0.66511655",
"0.66511655",
"0.66511655",
"0.66511655",
"0.6648572",
"0.6643941",
"0.66403115",
"0.6637521",
"0.66155994",
"0.66021585",
"0.65959907",
"0.65921307",
"0.65754396",
"0.6574771",
"0.65730226",
"0.6553755",
"0.6553755",
"0.65535283",
"0.65496767",
"0.65465933",
"0.6541883",
"0.65395224",
"0.65333205",
"0.6521644",
"0.65214497",
"0.65209407",
"0.6520554",
"0.65190816",
"0.6518528",
"0.65134233",
"0.6509828",
"0.6507984",
"0.65045995",
"0.65019435",
"0.64966255",
"0.64906466",
"0.64882815",
"0.6487634",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.6487553",
"0.648398"
] |
0.77853984
|
0
|
GET /venue_products/new GET /venue_products/new.json
|
def new
@venue_product = VenueProduct.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @venue_product }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @product = Product.new\n\n render json: @product\n end",
"def new\n @product = ProductProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json=> @product }\n end\n end",
"def new\n @product = Product.find(params[:product_id])\n @purchase = Purchase.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase }\n end\n end",
"def new\n @add_product = AddProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @add_product }\n end\n end",
"def new\n print params\n @product_sold = ProductSold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_sold }\n end\n end",
"def new\n @venue = Venue.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @venue }\n end\n end",
"def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venue }\n end\n end",
"def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venue }\n end\n end",
"def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venue }\n end\n end",
"def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venue }\n end\n end",
"def new\n @related_product = RelatedProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @related_product }\n end\n end",
"def new\n @magento_product = MagentoProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @magento_product }\n end\n end",
"def new\n @product_delivered = ProductDelivered.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_delivered }\n end\n end",
"def new\n @shopifyproduct = Shopifyproduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shopifyproduct }\n end\n end",
"def new\n @product = Product.new\n #@product = Product.find(params[:product_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @title = t('view.transfer_products.new_title')\n @transfer_product = TransferProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transfer_product }\n end\n end",
"def new\n @producttype = Producttype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @producttype }\n end\n end",
"def new\n @onecompany_product = Onecompany::Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @onecompany_product }\n end\n end",
"def new\n @breadcrumb = 'create'\n @product_type = ProductType.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_type }\n end\n end",
"def new\n @product_item = ProductItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @product_item }\n end\n end",
"def new\n @product = Product.new\n @categories = Category.find(:all)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n format.json { render :json => @product }\n end\n end",
"def new\n\t\t@product = Product.new\n\t\t@products = Product.all\n\t\t@attachment_file = AttachmentFile.new\n\t\t@action = 'create'\n\t\trespond_to do |format|\n\t\t format.html # new.html.erb\n\t\t format.json { render :json => @product }\n\t\tend\n end",
"def new\n @paper_venue = PaperVenue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @paper_venue }\n end\n end",
"def new\n @prod = Prod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @prod }\n end\n end",
"def new\n @tipo_product = TipoProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_product }\n end\n end",
"def new\n @star_product = Star::Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @star_product }\n end\n end",
"def new\n @producto = Producto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @producto }\n end\n end",
"def new\n @product = Product.new()\n \n respond_to do |format|\n format.js # new.js.rjs\n format.xml { render :xml => @product }\n end\n end",
"def new\n if params[:product_id]\n @badge.product = Product.find(params[:product_id])\n end\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @badge }\n end\n end",
"def new\n @shop = Shop.where([\"id = ?\", params[:shop_id]]).first\n raise \"お探しのお店が見つかりません\" unless @shop.present?\n @product = Product.new\n @provider = Provider.new\n @product_types = ProductType.all\n @countries = Country.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @manage_venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manage_venue }\n end\n end",
"def new\n @home_searches_product = Home::Searches::Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @home_searches_product }\n end\n end",
"def new\n @team_product_request = TeamProductRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team_product_request }\n end\n end",
"def new\n @store2product = Store2product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store2product }\n end\n end",
"def new\n @product_price = ProductPrice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_price }\n end\n end",
"def create\n @product = Product.new(product_args)\n\n if @product.save\n render json: Product.all, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def new\n @product2 = Product2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product2 }\n end\n end",
"def create\n @product = Product.create!(product_params)\n json_response(@product, :created)\n end",
"def new\n @productsbind = Productsbind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @productsbind }\n end\n end",
"def new\n @product_cat = ProductCat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_cat }\n end\n end",
"def new\n @product_line = ProductLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_line }\n end\n end",
"def new\n @product_owner = ProductOwner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_owner }\n end\n end",
"def new\n default_data\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def new\n @produto = Produto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produto }\n end\n end",
"def new\n @vendor = Vendor.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vendor }\n end\n end",
"def new\n @product = Product.new\n @units = Unit.all\n @brands = Brand.all\n @categories = Category.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product_transaction = ProductTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_transaction }\n end\n end",
"def new\n @breadcrumb = 'create'\n @product_family = ProductFamily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_family }\n end\n end",
"def new\n @product_import = ProductImport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @product_import }\n end\n end",
"def new\n @vendor = Vendor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vendor }\n end\n end",
"def new\n @product = Product.new\n @shop = current_user.shops.find_by_uuid(params[:shop_id])\n @product.product_variants.build\n\n respond_to do |format|\n format.html\n format.json { render json: @product}\n end\n end",
"def new\n @product = Product.new()\n respond_to do |format|\n format.js # new.js.rjs\n format.xml { render :xml => @product }\n end\n end",
"def new\n @product_stock = ProductStock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_stock }\n end\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n @category = Category.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @product_size = ProductSize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_size }\n end\n end"
] |
[
"0.7708331",
"0.75812113",
"0.7542354",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.7541824",
"0.75073606",
"0.74506176",
"0.74506176",
"0.74506176",
"0.74506176",
"0.742341",
"0.7411715",
"0.7391222",
"0.733222",
"0.73314184",
"0.7321725",
"0.7321725",
"0.7321725",
"0.7321725",
"0.7316893",
"0.7310573",
"0.7302483",
"0.7273056",
"0.7272558",
"0.72712773",
"0.7269687",
"0.7248674",
"0.72219205",
"0.72104895",
"0.7209359",
"0.7194098",
"0.7185467",
"0.7175552",
"0.717398",
"0.7167687",
"0.7151617",
"0.7104191",
"0.70970696",
"0.708708",
"0.7053893",
"0.7051895",
"0.7050011",
"0.70405203",
"0.70394933",
"0.70373327",
"0.7034251",
"0.70231485",
"0.7017287",
"0.701182",
"0.7000887",
"0.69979215",
"0.6983458",
"0.6983385",
"0.69689226",
"0.6968881",
"0.6968585",
"0.69660854",
"0.69643724",
"0.69633436",
"0.695954",
"0.6955399",
"0.6955334",
"0.69517255",
"0.6948967",
"0.6948967",
"0.6948967",
"0.6948967",
"0.6948967",
"0.6948967",
"0.6948967",
"0.6948967",
"0.6948967",
"0.6948967",
"0.6948967",
"0.6948967",
"0.6948967",
"0.6948967",
"0.6948967",
"0.6948967",
"0.69313484",
"0.69275784"
] |
0.79925734
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.