Skip to content

Instantly share code, notes, and snippets.

import requests
res = requests.post('http://localhost:8000/api/token-auth/',
data={'username': 'admin',
'password': 'admin'}).json()
token = res['token']
|-- images/
|-- img-1234.jpg
|-- ...
|-- images_resize/
|-- img-1234.jpg
|-- ...
|-- opensfm/
|-- see mapillary/opensfm repository for more info
|-- depthmaps/
|-- merged.ply # Облако точек без привязки к географическим координатам
def update
if (criteria_to_remove = params[:delete])
model = criteria_to_remove.keys.first
field = criteria_to_remove.values.first
feed.update(criteria: feed.criteria.except(model).deep_merge({ model => feed.criteria[model].except(field) }) )
redirect_to edit_admin_feed_path(feed), notice: 'Критерии фида отредактированы успешно'
elsif params[:criteria].present?
class AssetPolicy < ApplicationPolicy
# some code
class MetricScope < Scope
def resolve
if superadmin?
scope.all
else
scope.none
end
def new
kind = Kind.find(params[:asset][:kind])
borrower_id = params[:asset][:borrower]
borrower = borrower_id.present? ? Borrower.find(borrower_id) : nil
terbank_id = params[:asset][:borrower_terbank] || borrower.terbank.id.to_s
holder_type = params[:asset][:holder_type]
new_params = { kind: kind, borrower: borrower, borrower_terbank: terbank_id }
new_params.merge!({ holder_type: holder_type }) if holder_type
require 'rails_helper'
RSpec.describe AssetsController, type: :controller do
describe 'all AssetsController actions' do
let!(:sbi_department) { create(:sbi_department) }
let!(:sbi_terbank) { create(:terbank, department: sbi_department) }
let!(:sbi_terbank_other) { create(:terbank, department: sbi_department) }
let!(:sbi_borrower) { create(:borrower, terbank: sbi_terbank) }
let!(:sbi_borrower_other) { create(:borrower, terbank: sbi_terbank_other) }