Skip to content

Commit

Permalink
bugfix/uploader (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJJackson authored Jan 31, 2024
1 parent 1b76040 commit 9017e2a
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
2 changes: 0 additions & 2 deletions src/app-bundles/time-series-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ export default createRestBundle({
doSaveFieldNamesToTimeseries: (newObject, instrumentId, dataLoggerId, tableId) => ({ dispatch, store, apiPost }) => {
dispatch({ type: 'ASSIGN_FIELD_NAMES_TO_TIMESERIES_START' });
const toastId = tLoading('Creating new timeseries...');
const { projectId } = store.selectProjectsIdByRoute();
const { newTs, existingTs } = newObject;

const uri = '/timeseries';
const formData = [];

newTs.forEach(item => formData.push({
project_id: projectId,
instrument_id: instrumentId,
name: item?.field_name,
}));
Expand Down
2 changes: 0 additions & 2 deletions src/app-pages/project/batch-plotting/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ const getStyle = (_index) => ({
export const generateNewChartData = (measurements, timeseries, chartSettings) => {
const { show_comments, show_masked, show_nonvalidated } = chartSettings || {};

console.log('test measurements, ts', measurements, timeseries)

if (measurements.length && timeseries.length) {
const data = measurements.map((elem, index) => {
if (elem && timeseries.length) {
Expand Down
6 changes: 1 addition & 5 deletions src/upload-parsers/inclinometer_measurements.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,8 @@ const inclinometerMeasurementParser = {
required: true,
useFilterComponent: true,
provider: state => {
const regex = new RegExp('/projects/(.*)/instruments');
const match = state.instruments._lastResource.match(regex);
const projectId = match && match.length >= 2 ? match[1] : '';

return Object.keys(state.instrumentTimeseries)
.filter(key => (key.charAt(0) !== '_' && state.instrumentTimeseries[key].project_id === projectId))
.filter(key => key.charAt(0) !== '_')
.map(key => ({
value: key,
text: `${state.instrumentTimeseries[key].instrument} - ${state.instrumentTimeseries[key].name}`,
Expand Down
9 changes: 2 additions & 7 deletions src/upload-parsers/timeseries_measurements.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ const timeseriesMeasurementParser = {
prePostFilter: (data) => (
/** this will work for single timeseries_id, needs to be updated to allow for multiple */
data.reduce((accum, current) => {
const { timeseries_id, time, value, masked, validated, annotation, project_id } = current;
const { timeseries_id, time, value, masked, validated, annotation } = current;

return ({
...accum,
timeseries_id,
project_id,
items: (accum['items'] || []).concat([{
time: DateTime.fromISO(time, { zone: 'utc' }),
value,
Expand All @@ -30,12 +29,8 @@ const timeseriesMeasurementParser = {
required: true,
useFilterComponent: true,
provider: state => {
const regex = new RegExp('/projects/(.*)/instruments');
const match = state.instruments._lastResource.match(regex);
const projectId = match && match.length >= 2 ? match[1] : '';

return Object.keys(state.instrumentTimeseries)
.filter(key => (key.charAt(0) !== '_' && state.instrumentTimeseries[key].project_id === projectId))
.filter(key => key.charAt(0) !== '_')
.map(key => ({
value: key,
text: `${state.instrumentTimeseries[key].instrument} - ${state.instrumentTimeseries[key].name}`,
Expand Down

0 comments on commit 9017e2a

Please sign in to comment.