This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| res = requests.post('http://localhost:8000/api/token-auth/', | |
| data={'username': 'admin', | |
| 'password': 'admin'}).json() | |
| token = res['token'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| |-- images/ | |
| |-- img-1234.jpg | |
| |-- ... | |
| |-- images_resize/ | |
| |-- img-1234.jpg | |
| |-- ... | |
| |-- opensfm/ | |
| |-- see mapillary/opensfm repository for more info | |
| |-- depthmaps/ | |
| |-- merged.ply # Облако точек без привязки к географическим координатам |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AssetPolicy < ApplicationPolicy | |
| # some code | |
| class MetricScope < Scope | |
| def resolve | |
| if superadmin? | |
| scope.all | |
| else | |
| scope.none | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) } |