Merge pull request #5698 from artoscinote/ma_SCI_8774

Fix and amend result table metadata saving [SCI-8774]
This commit is contained in:
artoscinote 2023-07-03 09:56:22 +02:00 committed by GitHub
commit cd70625a10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -41,11 +41,19 @@
contents.attr('value', data);
metadata.attr('value', JSON.stringify({cells: hot.getCellsMeta().map(
(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) {
return {
col: x.col,
row: x.row,
className: x.className || ''
className: x.className || '',
calculated: calculated
}
} else {
return null

View file

@ -70,6 +70,7 @@ class ResultTablesController < ApplicationController
@result.table.last_modified_by = current_user
@result.table.team = current_team
@result.assign_attributes(update_params)
@result.table.metadata = JSON.parse(update_params[:table_attributes][:metadata])
flash_success = t("result_tables.update.success_flash",
module: @my_module.name)
if @result.archived_changed?(from: false, to: true)