Skip to content

Commit

Permalink
decided to re-add the usesSubquadrats property to the PlotRDS type to…
Browse files Browse the repository at this point in the history
… avoid cascading issues. Value has been defaulted to false. Additionally updating API endpoints for Personnel table to use RoleID instead of Role
  • Loading branch information
siddheshraze committed Jul 5, 2024
1 parent c08b6a3 commit 5715810
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
3 changes: 1 addition & 2 deletions frontend/app/api/formsearch/personnelblock/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ export async function GET(request: NextRequest): Promise<NextResponse<PersonnelR
personnelID: row.PersonnelID,
firstName: row.FirstName,
lastName: row.LastName,
role: row.Role
// ... other fields as needed
roleID: row.RoleID
}));

// Properly mapping results to return an array of { label, code }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function QuadratsDataGrid() {
editable: true,
type: 'singleSelect',
valueOptions: unitSelectionOptions
}
};

const addNewRowToGrid = () => {
const id = randomId();
Expand Down
3 changes: 1 addition & 2 deletions frontend/components/datagrids/msvdatagrid.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { GridActionsCellItem, GridCellParams, GridColDef, GridEventListener, GridFilterModel, GridRowEditStopReasons, GridRowId, GridRowModel, GridRowModes, GridRowModesModel, GridSortModel, GridToolbar, GridToolbarContainer, GridToolbarProps, GridValidRowModel, ToolbarPropsOverrides, useGridApiRef } from '@mui/x-data-grid';
import { GridActionsCellItem, GridCellParams, GridColDef, GridEventListener, GridFilterModel, GridRowEditStopReasons, GridRowId, GridRowModel, GridRowModes, GridRowModesModel, GridSortModel, GridToolbar, GridToolbarContainer, GridToolbarProps, ToolbarPropsOverrides, useGridApiRef } from '@mui/x-data-grid';
import { Alert, Button, Checkbox, FormControlLabel, FormGroup, Snackbar } from '@mui/material';
import AddIcon from '@mui/icons-material/Add';
import EditIcon from '@mui/icons-material/Edit';
Expand All @@ -23,7 +23,6 @@ import { useLockAnimation } from '@/app/contexts/lockanimationcontext';
import CheckIcon from '@mui/icons-material/Check';
import ErrorIcon from '@mui/icons-material/Error';
import HourglassEmptyIcon from '@mui/icons-material/HourglassEmpty';
import BlockIcon from '@mui/icons-material/Block';
import { CensusDateRange, OrgCensusRDS } from '@/config/sqlrdsdefinitions/orgcensusrds';
import { HTTPResponses, unitSelectionOptions } from '@/config/macros';
import { gridColumnsArrayMSVRDS } from '@/config/sqlrdsdefinitions/views/measurementssummaryviewrds';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const PersonnelAutocompleteMultiSelect: React.FC<PersonnelAutocompleteMul
onOpen={() => setOpen(true)}
onClose={() => setOpen(false)}
options={options}
getOptionLabel={(option) => `${option.lastName}, ${option.firstName} | ${option.role}`}
getOptionLabel={(option) => `${option.lastName}, ${option.firstName} | ${option.roleID}`}
isOptionEqualToValue={(option, value) => JSON.stringify(option) === JSON.stringify(value)}
loading={loading}
value={undefined}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {GridColDef} from '@mui/x-data-grid';
import {IDataMapper, parseDate} from "../../datamapper";
import {bitToBoolean, booleanToBit, unitSelectionOptions} from '@/config/macros';
import {bitToBoolean, booleanToBit} from '@/config/macros';

export type CoreMeasurementsRDS = {
id?: number;
Expand Down
4 changes: 3 additions & 1 deletion frontend/config/sqlrdsdefinitions/tables/plotrds.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {GridColDef} from '@mui/x-data-grid';
import {IDataMapper} from '../../datamapper';
import {bitToBoolean, booleanToBit, unitSelectionOptions} from '@/config/macros';
import { unitSelectionOptions} from '@/config/macros';

export type PlotRDS = {
id?: number;
Expand All @@ -20,6 +20,7 @@ export type PlotRDS = {
plotShape?: string;
plotDescription?: string;
numQuadrats?: number;
usesSubquadrats?: boolean;
};

export type Plot = PlotRDS | undefined;
Expand Down Expand Up @@ -63,6 +64,7 @@ export class PlotsMapper implements IDataMapper<PlotsResult, PlotRDS> {
plotShape: item.PlotShape != null ? String(item.PlotShape) : undefined,
plotDescription: item.PlotDescription != null ? String(item.PlotDescription) : undefined,
numQuadrats: item.NumQuadrats !== null ? Number(item.NumQuadrats) : undefined,
usesSubquadrats: false
}));
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/config/sqlrdsdefinitions/tables/quadratrds.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GridColDef } from '@mui/x-data-grid';
import { IDataMapper } from "../../datamapper";
import { ColumnStates, unitSelectionOptions } from '@/config/macros';
import { ColumnStates } from '@/config/macros';
import { ValidationFunction, RowValidationErrors } from '@/config/macros/formdetails';

export type QuadratRDS = {
Expand Down

0 comments on commit 5715810

Please sign in to comment.