From 1f91a4ffa36c602fcac7b8f511ad8244634c96e1 Mon Sep 17 00:00:00 2001 From: jordancaraballo Date: Tue, 22 Oct 2024 19:44:17 +0000 Subject: [PATCH] Fixing bug from #46 where classes were not saved --- eo_validation/validation_dashboard.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/eo_validation/validation_dashboard.py b/eo_validation/validation_dashboard.py index 79c1e69..790d06a 100644 --- a/eo_validation/validation_dashboard.py +++ b/eo_validation/validation_dashboard.py @@ -756,12 +756,21 @@ def create_property_widgets(self, properties): def changed_checked_widget(b): + # compute seconds per point taken self._seconds_per_point = round( time.time() - self._current_time, 4) + + # update date of validated point self._feature['properties']['date'] = str(pd.Timestamp.now()) + + # update seconds per point taken self._feature['properties']['seconds_taken'] = \ self._seconds_per_point - self._feature['properties']['verified'] = True + + # Update the properties with the new values + for widget in self.property_widgets: + self._feature['properties'][widget._property_key] = \ + widget.value # updating the information with new data self.geo_data_layer.geo_dataframe.loc[ @@ -798,6 +807,7 @@ def on_click_polygon_object(self, event, feature, **kwargs): # Dynamically create input widgets for each property self.property_widgets = self.create_property_widgets( self._feature['properties']) + save_button = widgets.Button(description="Save") geom_type = self._feature['geometry']['type'] centroid = self.calculate_centroid( @@ -829,6 +839,7 @@ def save_changes(_): original_data = copy.deepcopy(self.geo_data_layer.data) original_feature = copy.deepcopy(self._feature) + # Update the properties with the new values for widget in self.property_widgets: self._feature['properties'][widget._property_key] = \