Skip to content

Commit 905514c

Browse files
author
sreeder
committed
change id's to localdatetime instead of indexes
1 parent 999bd61 commit 905514c

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/api/ODM1_1_1/services/edit_service.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,12 @@ def get_variable(self, variable_id):
295295
def change_value(self, value, operator):
296296
filtered_points = self.get_filtered_points()
297297

298-
ids = filtered_points["ValueID"].astype(int).tolist()
298+
ids = filtered_points.index.tolist()#["ValueID"].astype(int).tolist()
299299
self.memDB.updateValue(ids, operator, float(value))
300300
self._populate_series()
301301

302302
## update filtered_dataframe
303-
self.filtered_dataframe = self._series_points_df[self._series_points_df['ValueID'].isin(ids)]
303+
self.filtered_dataframe = self._series_points_df[self._series_points_df.index.isin(ids)]
304304

305305
def add_points(self, points):
306306
# todo: add the ability to send in multiple datetimes to a single 'point'
@@ -313,7 +313,7 @@ def add_points(self, points):
313313
def delete_points(self):
314314
filtered_points = self.get_filtered_points()
315315
if not filtered_points.empty:
316-
values = filtered_points['ValueID'].astype(float).tolist()
316+
values = filtered_points.index.tolist()#['ValueID'].astype(float).tolist()
317317

318318
self.memDB.delete(values)
319319
self._populate_series()
@@ -334,17 +334,17 @@ def interpolate(self):
334334
mdf = df["DataValue"].mask(issel)
335335
mdf.interpolate(method = "time", inplace=True)
336336
tmp_filter_list["DataValue"]=mdf[issel]
337-
ids = tmp_filter_list['ValueID'].tolist()
337+
ids = tmp_filter_list.index.tolist()
338338

339339
#update_list = [(row["DataValue"], row["ValueID"]) for index, row in tmp_filter_list.iterrows()]
340-
update_list = [{"value": row["DataValue"], "id": row["ValueID"]} for index, row in tmp_filter_list.iterrows()]
340+
update_list = [{"value": row["DataValue"], "id": index} for index, row in tmp_filter_list.iterrows()]
341341

342342
self.memDB.update(update_list)
343343

344344

345345
self._populate_series()
346346

347-
self.filtered_dataframe = self._series_points_df[self._series_points_df['ValueID'].isin(ids)]
347+
self.filtered_dataframe = self._series_points_df[self._series_points_df.index.isin(ids)]
348348

349349
def drift_correction(self, gap_width):
350350
if self.isOneGroup():
@@ -356,15 +356,15 @@ def drift_correction(self, gap_width):
356356
f = lambda row : row["DataValue"]+(gap_width * ((row.name-startdate).total_seconds() / x_l))
357357
tmp_filter_list["DataValue"]=tmp_filter_list.apply(f, axis = 1)
358358

359-
update_list = [{"value": row["DataValue"], "id": row["ValueID"]} for index, row in tmp_filter_list.iterrows()]
359+
update_list = [{"value": row["DataValue"], "id": index} for index, row in tmp_filter_list.iterrows()]
360360

361-
ids = tmp_filter_list['ValueID'].tolist()
361+
ids = tmp_filter_list.index.tolist()#['ValueID'].tolist()
362362
self.memDB.update(update_list)
363363

364364

365365
self._populate_series()
366366

367-
self.filtered_dataframe = self._series_points_df[self._series_points_df['ValueID'].isin(ids)]
367+
self.filtered_dataframe = self._series_points_df[self._series_points_df.index.isin(ids)]
368368
return True
369369
return False
370370

@@ -397,7 +397,8 @@ def flag(self, qualifier_id):
397397
#self._cursor.executemany(query, [(str(x[0]),) for x in filtered_points])
398398
self._cursor.executemany(query, [(str(x),) for x in filtered_points["ValueID"].astype(int).tolist()])
399399
'''
400-
self.memDB.updateFlag(filtered_points["ValueID"].astype(int).tolist(), qualifier_id)
400+
self.memDB.updateFlag(filtered_points.index.tolist(), qualifier_id)
401+
#["ValueID"].astype(int).tolist(), qualifier_id)
401402

402403
###################
403404
# Save/Restore

0 commit comments

Comments
 (0)