Skip to content

Commit

Permalink
Handle case for new rows
Browse files Browse the repository at this point in the history
  • Loading branch information
sharadsw committed Jan 28, 2025
1 parent f5a319d commit 1556f3f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ import { getIcon, unknownIcon } from '../InitialContext/icons';
import type { Dataset } from '../WbPlanView/Wrapped';
import { configureHandsontable } from './handsontable';
import { useHotHooks } from './hooks';
import { getPhysicalColToMappingCol, getSelectedRegions, setHotData } from './hotHelpers';
import {
getPhysicalColToMappingCol,
getSelectedRegions,
setHotData,
} from './hotHelpers';
import { useHotProps } from './hotProps';
import type { WbMapping } from './mapping';
import { fetchWbPickLists } from './pickLists';
Expand Down Expand Up @@ -75,9 +79,9 @@ function WbSpreadsheetComponent({
const physicalCol = hot.toPhysicalColumn(visualCol ?? 0);

const createdRecords =
validation.uploadResults.interestingRecords[physicalRow]?.[
physicalCol
];
validation.uploadResults.interestingRecords[
physicalRow
]?.[physicalCol];

if (
visualRow === undefined ||
Expand Down Expand Up @@ -129,14 +133,14 @@ function WbSpreadsheetComponent({
} as const)
: ({
row_above: {
disabled: () => isReadOnly,
disabled: () => isReadOnly || dataset.isupdate,
},
row_below: {
disabled: () => isReadOnly,
disabled: () => isReadOnly || dataset.isupdate,
},
remove_row: {
disabled: () => {
if (isReadOnly) return true;
if (isReadOnly || dataset.isupdate) return true;
// Or if called on the last row
const selectedRegions = getSelectedRegions(hot);
return (
Expand Down
5 changes: 4 additions & 1 deletion specifyweb/workbench/upload/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,10 @@ def _commit_uploader(result):
packs = []
# Yes, we don't care about reverse here.
for row in range(len(parent.data)):
r, be = look_up_in_backer(row)
pack = look_up_in_backer(row)
if pack is None: continue

r, be = pack
rows_to_backup.append(dict(zip(parent.columns, r)))
packs.append(be)

Expand Down

0 comments on commit 1556f3f

Please sign in to comment.