mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-09 16:01:30 +08:00
Merge branch 'develop' into features/inventory-items-relationships
This commit is contained in:
commit
d1e7ab5efb
18 changed files with 151 additions and 23 deletions
|
|
@ -50,7 +50,7 @@ GIT
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/scinote-eln/yomu
|
remote: https://github.com/scinote-eln/yomu
|
||||||
revision: 020ab670b2919f3b436e926a890d1dad23d75676
|
revision: 09b7b4910f59453970aab03d7b3ddb60b41db89a
|
||||||
branch: master
|
branch: master
|
||||||
specs:
|
specs:
|
||||||
yomu (0.2.4)
|
yomu (0.2.4)
|
||||||
|
|
|
||||||
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
||||||
1.29.3
|
1.29.4
|
||||||
|
|
|
||||||
|
|
@ -615,6 +615,7 @@ var ExperimnetTable = {
|
||||||
this.appendRows(result.data);
|
this.appendRows(result.data);
|
||||||
this.initDueDatePicker(result.data);
|
this.initDueDatePicker(result.data);
|
||||||
this.handleNoResults();
|
this.handleNoResults();
|
||||||
|
this.initProvisioningStatusPolling();
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
InfiniteScroll.init(this.table, {
|
InfiniteScroll.init(this.table, {
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,7 @@ class RepositoryRowsController < ApplicationController
|
||||||
return render json: { name: @repository_row.name } if update_params['repository_row'].present?
|
return render json: { name: @repository_row.name } if update_params['repository_row'].present?
|
||||||
|
|
||||||
column = row_cell_update.column
|
column = row_cell_update.column
|
||||||
cell = row_cell_update.cell
|
cell = row_cell_update.cell&.reload || row_cell_update.cell
|
||||||
data = { value_type: column.data_type, id: column.id, value: nil }
|
data = { value_type: column.data_type, id: column.id, value: nil }
|
||||||
|
|
||||||
return render json: data if cell.blank?
|
return render json: data if cell.blank?
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,11 @@
|
||||||
class="sticky top-0 right-0 bg-white flex z-50 flex-col h-[78px] pt-6">
|
class="sticky top-0 right-0 bg-white flex z-50 flex-col h-[78px] pt-6">
|
||||||
<div class="header flex w-full h-[30px] pr-6">
|
<div class="header flex w-full h-[30px] pr-6">
|
||||||
<repository-item-sidebar-title v-if="defaultColumns"
|
<repository-item-sidebar-title v-if="defaultColumns"
|
||||||
:editable="permissions?.can_manage && !defaultColumns?.archived" :name="defaultColumns.name"
|
:editable="permissions?.can_manage && !defaultColumns?.archived"
|
||||||
@update="update"></repository-item-sidebar-title>
|
:name="defaultColumns.name"
|
||||||
|
:archived="defaultColumns.archived"
|
||||||
|
@update="update">
|
||||||
|
</repository-item-sidebar-title>
|
||||||
<i id="close-icon" @click="toggleShowHideSidebar(null)"
|
<i id="close-icon" @click="toggleShowHideSidebar(null)"
|
||||||
class="sn-icon sn-icon-close ml-auto cursor-pointer my-auto mx-0"></i>
|
class="sn-icon sn-icon-close ml-auto cursor-pointer my-auto mx-0"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -375,6 +378,11 @@ export default {
|
||||||
initialSectionId: null,
|
initialSectionId: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
provide() {
|
||||||
|
return {
|
||||||
|
reloadRepoItemSidebar: this.reload,
|
||||||
|
}
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
window.repositoryItemSidebarComponent = this;
|
window.repositoryItemSidebarComponent = this;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
:preventLeavingUntilFilled="true"
|
:preventLeavingUntilFilled="true"
|
||||||
:attributeName="`${i18n.t('repositories.item_card.header_title')}`" :singleLine="true"
|
:attributeName="`${i18n.t('repositories.item_card.header_title')}`" :singleLine="true"
|
||||||
@editingEnabled="editingName = true" @editingDisabled="editingName = false" @update="updateName" @delete="handleDelete"></inline-edit>
|
@editingEnabled="editingName = true" @editingDisabled="editingName = false" @update="updateName" @delete="handleDelete"></inline-edit>
|
||||||
<h4 v-else class="item-name my-auto truncate text-xl" :title="name">
|
<h4 v-else class="item-name my-auto truncate text-xl" :title="computedName">
|
||||||
{{ name }}
|
{{ computedName }}
|
||||||
</h4>
|
</h4>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -21,6 +21,12 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
editable: Boolean,
|
editable: Boolean,
|
||||||
name: String,
|
name: String,
|
||||||
|
archived: Boolean,
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
computedName() {
|
||||||
|
return this.archived ? `(A) ${this.name}` : this.name;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
updateName(name) {
|
updateName(name) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div id="repository-status-value-wrapper" class="flex flex-col min-min-h-[46px] h-auto gap-[6px]">
|
<div ref="container" id="repository-status-value-wrapper" class="flex flex-col min-min-h-[46px] h-auto gap-[6px]">
|
||||||
<div class="font-inter text-sm font-semibold leading-5 truncate" :title="colName">
|
<div class="font-inter text-sm font-semibold leading-5 truncate" :title="colName">
|
||||||
{{ colName }}
|
{{ colName }}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -88,16 +88,25 @@ export default {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.selected = this.id;
|
this.selected = this.id;
|
||||||
});
|
});
|
||||||
|
this.replaceEmojiesInDropdown();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeSelected(id) {
|
changeSelected(id) {
|
||||||
this.selected = id;
|
this.selected = id;
|
||||||
if (id) {
|
if (id || id === null) {
|
||||||
this.update(id);
|
this.update(id);
|
||||||
|
this.replaceEmojiesInDropdown();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
parseEmoji(content) {
|
parseEmoji(content) {
|
||||||
return twemoji.parse(content);
|
return twemoji.parse(content);
|
||||||
|
},
|
||||||
|
replaceEmojiesInDropdown() {
|
||||||
|
setTimeout(() => {
|
||||||
|
twemoji.size = "24x24";
|
||||||
|
twemoji.base = '/images/twemoji/';
|
||||||
|
twemoji.parse(this.$refs.container);
|
||||||
|
}, 300);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@
|
||||||
</template>
|
</template>
|
||||||
</span>
|
</span>
|
||||||
<span v-else >
|
<span v-else >
|
||||||
<template v-if="colVal.datetime">
|
<template v-if="colVal.formatted">
|
||||||
{{ colVal.datetime.formatted }}
|
{{ colVal.formatted }}
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
{{ viewPlaceholder }}
|
{{ viewPlaceholder }}
|
||||||
|
|
@ -54,9 +54,10 @@
|
||||||
endDate: null,
|
endDate: null,
|
||||||
error: null,
|
error: null,
|
||||||
defaultStartDate: null,
|
defaultStartDate: null,
|
||||||
defaultEndDate: null
|
defaultEndDate: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
inject: ['reloadRepoItemSidebar'],
|
||||||
props: {
|
props: {
|
||||||
mode: String,
|
mode: String,
|
||||||
range: { type: Boolean, default: false },
|
range: { type: Boolean, default: false },
|
||||||
|
|
@ -171,7 +172,10 @@
|
||||||
success: () => {
|
success: () => {
|
||||||
this.defaultStartDate = this.startDate;
|
this.defaultStartDate = this.startDate;
|
||||||
this.defaultEndDate = this.endDate;
|
this.defaultEndDate = this.endDate;
|
||||||
if ($('.dataTable')[0]) $('.dataTable').DataTable().ajax.reload(null, false);
|
if ($('.dataTable')[0]) {
|
||||||
|
$('.dataTable').DataTable().ajax.reload(null, false);
|
||||||
|
this.reloadRepoItemSidebar();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,9 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setOperation($event) {
|
setOperation($event) {
|
||||||
|
if ($event !== this.operation) {
|
||||||
|
this.amount = null;
|
||||||
|
}
|
||||||
this.operation = $event;
|
this.operation = $event;
|
||||||
if ([2, 3].includes($event)) {
|
if ([2, 3].includes($event)) {
|
||||||
this.unit = this.stockValue.unit;
|
this.unit = this.stockValue.unit;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ module Cloneable
|
||||||
last_clone_number =
|
last_clone_number =
|
||||||
parent.public_send(self.class.table_name)
|
parent.public_send(self.class.table_name)
|
||||||
.select("substring(#{self.class.table_name}.name, '(?:^#{clone_label} )(\\d+)')::int AS clone_number")
|
.select("substring(#{self.class.table_name}.name, '(?:^#{clone_label} )(\\d+)')::int AS clone_number")
|
||||||
.where('name ~ ?', "^#{clone_label} \\d+ - #{name}$")
|
.where('name ~ ?', "^#{clone_label} \\d+ - #{Regexp.escape(name)}$")
|
||||||
.order(clone_number: :asc)
|
.order(clone_number: :asc)
|
||||||
.last&.clone_number
|
.last&.clone_number
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ class RepositoryStockValue < ApplicationRecord
|
||||||
self.repository_stock_unit_item = repository_cell
|
self.repository_stock_unit_item = repository_cell
|
||||||
.repository_column
|
.repository_column
|
||||||
.repository_stock_unit_items
|
.repository_stock_unit_items
|
||||||
.find(new_data[:unit_item_id])
|
.find_by(id: new_data[:unit_item_id])
|
||||||
self.last_modified_by = user
|
self.last_modified_by = user
|
||||||
new_amount = new_data[:amount].to_d
|
new_amount = new_data[:amount].to_d
|
||||||
delta = new_amount - amount.to_d
|
delta = new_amount - amount.to_d
|
||||||
|
|
@ -157,7 +157,7 @@ class RepositoryStockValue < ApplicationRecord
|
||||||
value.repository_stock_unit_item = value.repository_cell
|
value.repository_stock_unit_item = value.repository_cell
|
||||||
.repository_column
|
.repository_column
|
||||||
.repository_stock_unit_items
|
.repository_stock_unit_items
|
||||||
.find(payload['unit_item_id'])
|
.find_by(id: payload['unit_item_id'])
|
||||||
value
|
value
|
||||||
else
|
else
|
||||||
raise ActiveRecord::RecordInvalid, 'Missing amount value'
|
raise ActiveRecord::RecordInvalid, 'Missing amount value'
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ module RepositoryDatatable
|
||||||
!scope[:repository].is_a?(RepositorySnapshot) &&
|
!scope[:repository].is_a?(RepositorySnapshot) &&
|
||||||
value_object.data.present? &&
|
value_object.data.present? &&
|
||||||
value_object.low_stock_threshold.present?
|
value_object.low_stock_threshold.present?
|
||||||
data[:reminder] = value_object.low_stock_threshold > value_object.data
|
data[:reminder] = value_object.low_stock_threshold >= value_object.data
|
||||||
if data[:reminder] && value_object.data&.positive?
|
if data[:reminder] && value_object.data&.positive?
|
||||||
data[:reminder_text] =
|
data[:reminder_text] =
|
||||||
I18n.t('repositories.item_card.reminders.stock_low', stock_formated: value_object.formatted)
|
I18n.t('repositories.item_card.reminders.stock_low', stock_formated: value_object.formatted)
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,8 @@ class Extends
|
||||||
RepositoryStockValue
|
RepositoryStockValue
|
||||||
)
|
)
|
||||||
|
|
||||||
|
STI_PRELOAD_CLASSES = %w(LinkedRepository)
|
||||||
|
|
||||||
# Array of preload relations used in search query for repository rows
|
# Array of preload relations used in search query for repository rows
|
||||||
REPOSITORY_ROWS_PRELOAD_RELATIONS = []
|
REPOSITORY_ROWS_PRELOAD_RELATIONS = []
|
||||||
|
|
||||||
|
|
|
||||||
7
config/initializers/preload_stis.rb
Normal file
7
config/initializers/preload_stis.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
unless Rails.application.config.eager_load
|
||||||
|
Rails.application.config.to_prepare do
|
||||||
|
Extends::STI_PRELOAD_CLASSES.each(&:constantize)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require File.expand_path('app/helpers/database_helper')
|
||||||
|
|
||||||
|
class AddExternalIdToRepositoryColumnItems < ActiveRecord::Migration[6.1]
|
||||||
|
include DatabaseHelper
|
||||||
|
|
||||||
|
def up
|
||||||
|
add_column :repository_list_items, :external_id, :string, null: true
|
||||||
|
add_column :repository_checklist_items, :external_id, :string, null: true
|
||||||
|
add_index :repository_list_items,
|
||||||
|
%i(repository_column_id external_id),
|
||||||
|
unique: true,
|
||||||
|
name: 'unique_index_repository_list_items_on_external_id'
|
||||||
|
add_index :repository_checklist_items,
|
||||||
|
%i(repository_column_id external_id),
|
||||||
|
unique: true,
|
||||||
|
name: 'unique_index_repository_checklist_items_on_external_id'
|
||||||
|
add_gin_index_without_tags(:repository_list_items, :external_id)
|
||||||
|
add_gin_index_without_tags(:repository_checklist_items, :external_id)
|
||||||
|
|
||||||
|
remove_index :repository_rows, :external_id, unique: true, name: 'unique_index_repository_rows_on_external_id'
|
||||||
|
add_index :repository_rows,
|
||||||
|
%i(repository_id external_id),
|
||||||
|
unique: true,
|
||||||
|
name: 'unique_index_repository_rows_on_external_id'
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
remove_index :repository_rows, name: 'unique_index_repository_rows_on_external_id'
|
||||||
|
add_index :repository_rows, :external_id, unique: true, name: 'unique_index_repository_rows_on_external_id'
|
||||||
|
|
||||||
|
remove_index :repository_rows, name: 'index_repository_checklist_items_on_external_id'
|
||||||
|
remove_index :repository_rows, name: 'index_repository_list_items_on_external_id'
|
||||||
|
remove_index :repository_checklist_items, name: 'unique_index_repository_checklist_items_on_external_id'
|
||||||
|
remove_index :repository_list_items, name: 'unique_index_repository_list_items_on_external_id'
|
||||||
|
remove_column :repository_checklist_items, :external_id, :string, null: true
|
||||||
|
remove_column :repository_list_items, :external_id, :string, null: true
|
||||||
|
end
|
||||||
|
end
|
||||||
10
db/schema.rb
10
db/schema.rb
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2023_10_23_091358) do
|
ActiveRecord::Schema[7.0].define(version: 2023_11_07_163821) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "btree_gist"
|
enable_extension "btree_gist"
|
||||||
enable_extension "pg_trgm"
|
enable_extension "pg_trgm"
|
||||||
|
|
@ -657,9 +657,12 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_23_091358) do
|
||||||
t.bigint "last_modified_by_id"
|
t.bigint "last_modified_by_id"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.string "external_id"
|
||||||
t.index "trim_html_tags((data)::text) gin_trgm_ops", name: "index_repository_checklist_items_on_data", using: :gin
|
t.index "trim_html_tags((data)::text) gin_trgm_ops", name: "index_repository_checklist_items_on_data", using: :gin
|
||||||
|
t.index "trim_html_tags((external_id)::text) gin_trgm_ops", name: "index_repository_checklist_items_on_external_id", using: :gin
|
||||||
t.index ["created_by_id"], name: "index_repository_checklist_items_on_created_by_id"
|
t.index ["created_by_id"], name: "index_repository_checklist_items_on_created_by_id"
|
||||||
t.index ["last_modified_by_id"], name: "index_repository_checklist_items_on_last_modified_by_id"
|
t.index ["last_modified_by_id"], name: "index_repository_checklist_items_on_last_modified_by_id"
|
||||||
|
t.index ["repository_column_id", "external_id"], name: "unique_index_repository_checklist_items_on_external_id", unique: true
|
||||||
t.index ["repository_column_id"], name: "index_repository_checklist_items_on_repository_column_id"
|
t.index ["repository_column_id"], name: "index_repository_checklist_items_on_repository_column_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -750,9 +753,12 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_23_091358) do
|
||||||
t.bigint "last_modified_by_id"
|
t.bigint "last_modified_by_id"
|
||||||
t.datetime "created_at", precision: nil, null: false
|
t.datetime "created_at", precision: nil, null: false
|
||||||
t.datetime "updated_at", precision: nil, null: false
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
|
t.string "external_id"
|
||||||
|
t.index "trim_html_tags((external_id)::text) gin_trgm_ops", name: "index_repository_list_items_on_external_id", using: :gin
|
||||||
t.index "trim_html_tags(data) gin_trgm_ops", name: "index_repository_list_items_on_data", using: :gin
|
t.index "trim_html_tags(data) gin_trgm_ops", name: "index_repository_list_items_on_data", using: :gin
|
||||||
t.index ["created_by_id"], name: "index_repository_list_items_on_created_by_id"
|
t.index ["created_by_id"], name: "index_repository_list_items_on_created_by_id"
|
||||||
t.index ["last_modified_by_id"], name: "index_repository_list_items_on_last_modified_by_id"
|
t.index ["last_modified_by_id"], name: "index_repository_list_items_on_last_modified_by_id"
|
||||||
|
t.index ["repository_column_id", "external_id"], name: "unique_index_repository_list_items_on_external_id", unique: true
|
||||||
t.index ["repository_column_id"], name: "index_repository_list_items_on_repository_column_id"
|
t.index ["repository_column_id"], name: "index_repository_list_items_on_repository_column_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -817,7 +823,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_23_091358) do
|
||||||
t.index "trim_html_tags((name)::text) gin_trgm_ops", name: "index_repository_rows_on_name", using: :gin
|
t.index "trim_html_tags((name)::text) gin_trgm_ops", name: "index_repository_rows_on_name", using: :gin
|
||||||
t.index ["archived"], name: "index_repository_rows_on_archived"
|
t.index ["archived"], name: "index_repository_rows_on_archived"
|
||||||
t.index ["archived_by_id"], name: "index_repository_rows_on_archived_by_id"
|
t.index ["archived_by_id"], name: "index_repository_rows_on_archived_by_id"
|
||||||
t.index ["external_id"], name: "unique_index_repository_rows_on_external_id", unique: true
|
t.index ["repository_id", "external_id"], name: "unique_index_repository_rows_on_external_id", unique: true
|
||||||
t.index ["repository_id"], name: "index_repository_rows_on_repository_id"
|
t.index ["repository_id"], name: "index_repository_rows_on_repository_id"
|
||||||
t.index ["restored_by_id"], name: "index_repository_rows_on_restored_by_id"
|
t.index ["restored_by_id"], name: "index_repository_rows_on_restored_by_id"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# rubocop:disable Metrics/BlockLength
|
||||||
|
|
||||||
namespace :data do
|
namespace :data do
|
||||||
Rails.logger = Logger.new(STDOUT)
|
Rails.logger = Logger.new(STDOUT)
|
||||||
|
|
||||||
|
|
@ -5,7 +9,6 @@ namespace :data do
|
||||||
task clean_temp_files: :environment do
|
task clean_temp_files: :environment do
|
||||||
Rails.logger.info "Cleaning temporary files older than 3 days"
|
Rails.logger.info "Cleaning temporary files older than 3 days"
|
||||||
TempFile.where("created_at < ?", 3.days.ago).each do |tmp_file|
|
TempFile.where("created_at < ?", 3.days.ago).each do |tmp_file|
|
||||||
|
|
||||||
TempFile.transaction do
|
TempFile.transaction do
|
||||||
begin
|
begin
|
||||||
tmp_file.destroy!
|
tmp_file.destroy!
|
||||||
|
|
@ -194,4 +197,37 @@ namespace :data do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc 'Reset protocols creator user assignments'
|
||||||
|
task reset_protocols_creator_user_assignments: :environment do
|
||||||
|
ActiveRecord::Base.transaction do
|
||||||
|
owner_role = UserRole.find_predefined_owner_role
|
||||||
|
protocols =
|
||||||
|
Protocol.where(protocol_type: Protocol::REPOSITORY_TYPES)
|
||||||
|
.joins('LEFT OUTER JOIN "user_assignments" ON "user_assignments"."assignable_type" = \'Protocol\' ' \
|
||||||
|
'AND "user_assignments"."assignable_id" = "protocols"."id" ' \
|
||||||
|
'AND "user_assignments"."assigned" = 1 ' \
|
||||||
|
'AND "user_assignments"."user_id" = "protocols"."added_by_id"')
|
||||||
|
.where('"user_assignments"."id" IS NULL')
|
||||||
|
.distinct
|
||||||
|
protocols.find_each do |protocol|
|
||||||
|
new_user_assignment = protocol.user_assignments
|
||||||
|
.find_or_initialize_by(user: protocol.added_by, team: protocol.team)
|
||||||
|
new_user_assignment.user_role = owner_role
|
||||||
|
new_user_assignment.assigned_by = protocol.added_by
|
||||||
|
new_user_assignment.assigned = :manually
|
||||||
|
new_user_assignment.save!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Extract missing asset texts'
|
||||||
|
task extract_missing_asset_texts: :environment do
|
||||||
|
Asset.joins(:file_blob)
|
||||||
|
.where.missing(:asset_text_datum)
|
||||||
|
.where(file_blob: { content_type: Constants::TEXT_EXTRACT_FILE_TYPES })
|
||||||
|
.find_each(&:extract_asset_text)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# rubocop:enable Metrics/BlockLength
|
||||||
|
|
|
||||||
|
|
@ -749,7 +749,7 @@ RSpec.describe 'Api::V1::InventoryCellsController', type: :request do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'Response with inventory cell, stock cell, missing stock unit' do
|
it 'Response with inventory cell, stock cell, empty stock unit' do
|
||||||
hash_body = nil
|
hash_body = nil
|
||||||
empty_item = create(:repository_row, repository: @valid_inventory)
|
empty_item = create(:repository_row, repository: @valid_inventory)
|
||||||
invalid_file_body = @valid_stock_body.deep_dup
|
invalid_file_body = @valid_stock_body.deep_dup
|
||||||
|
|
@ -759,9 +759,15 @@ RSpec.describe 'Api::V1::InventoryCellsController', type: :request do
|
||||||
inventory_id: @valid_inventory.id,
|
inventory_id: @valid_inventory.id,
|
||||||
item_id: empty_item.id
|
item_id: empty_item.id
|
||||||
), params: invalid_file_body.to_json, headers: @valid_headers
|
), params: invalid_file_body.to_json, headers: @valid_headers
|
||||||
expect(response).to have_http_status 404
|
expect(response).to have_http_status 201
|
||||||
expect { hash_body = json }.not_to raise_exception
|
expect { hash_body = json }.not_to raise_exception
|
||||||
expect(hash_body['errors'][0]).to include('status': 404)
|
expect(hash_body[:data]).to match(
|
||||||
|
JSON.parse(
|
||||||
|
ActiveModelSerializers::SerializableResource
|
||||||
|
.new(RepositoryCell.last, serializer: Api::V1::InventoryCellSerializer)
|
||||||
|
.to_json
|
||||||
|
)['data']
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'Response with inventory cell, stock cell, missing amount' do
|
it 'Response with inventory cell, stock cell, missing amount' do
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue