mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-21 23:46:21 +08:00
Merge pull request #5698 from artoscinote/ma_SCI_8774
Fix and amend result table metadata saving [SCI-8774]
This commit is contained in:
commit
cd70625a10
|
@ -41,11 +41,19 @@
|
||||||
contents.attr('value', data);
|
contents.attr('value', data);
|
||||||
metadata.attr('value', JSON.stringify({cells: hot.getCellsMeta().map(
|
metadata.attr('value', JSON.stringify({cells: hot.getCellsMeta().map(
|
||||||
(x) => {
|
(x) => {
|
||||||
|
const {row, col} = x;
|
||||||
|
const plugins = hot.plugin;
|
||||||
|
const cellId = plugins.utils.translateCellCoords({row, col});
|
||||||
|
const calculated = plugins.matrix.getItem(cellId)?.value ||
|
||||||
|
hot.getDataAtCell(row, col) ||
|
||||||
|
null;
|
||||||
|
|
||||||
if (x) {
|
if (x) {
|
||||||
return {
|
return {
|
||||||
col: x.col,
|
col: x.col,
|
||||||
row: x.row,
|
row: x.row,
|
||||||
className: x.className || ''
|
className: x.className || '',
|
||||||
|
calculated: calculated
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
|
|
|
@ -70,6 +70,7 @@ class ResultTablesController < ApplicationController
|
||||||
@result.table.last_modified_by = current_user
|
@result.table.last_modified_by = current_user
|
||||||
@result.table.team = current_team
|
@result.table.team = current_team
|
||||||
@result.assign_attributes(update_params)
|
@result.assign_attributes(update_params)
|
||||||
|
@result.table.metadata = JSON.parse(update_params[:table_attributes][:metadata])
|
||||||
flash_success = t("result_tables.update.success_flash",
|
flash_success = t("result_tables.update.success_flash",
|
||||||
module: @my_module.name)
|
module: @my_module.name)
|
||||||
if @result.archived_changed?(from: false, to: true)
|
if @result.archived_changed?(from: false, to: true)
|
||||||
|
|
Loading…
Reference in a new issue