Marthee commited on
Commit
969c9bc
·
verified ·
1 Parent(s): 8d413b3

Update google_sheet_Legend.py

Browse files
Files changed (1) hide show
  1. google_sheet_Legend.py +36 -0
google_sheet_Legend.py CHANGED
@@ -726,4 +726,40 @@ def DoorsLegend(Dictionary,spreadsheetId,worksheet):
726
  model_cell.color = (213 / 255, 219 / 255, 255 / 255)
727
  pygsheets.DataRange('A2', 'B2', worksheet=worksheet).apply_format(model_cell)
728
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
729
  ######################
 
726
  model_cell.color = (213 / 255, 219 / 255, 255 / 255)
727
  pygsheets.DataRange('A2', 'B2', worksheet=worksheet).apply_format(model_cell)
728
 
729
+ def delete3_2(deletedrows,dictionary):
730
+
731
+ items=[]
732
+ print('dletefromlegend3.2')
733
+ idx=0
734
+ myDict=eval(dictionary)
735
+ df_doors=pd.DataFrame(myDict)
736
+ # deletedrows=eval(deletedrows)
737
+ strings=deletedrows['content']
738
+ for item in strings:
739
+ newitem=str(item).split('\n \n')
740
+ if 'single' in str(newitem):
741
+ current_value = df_doors.loc[df_doors['Type'] == 'Single Doors', 'Quantity'].values[0]
742
+
743
+ # Step 2: Subtract one from the current value
744
+ new_value = int(current_value) - 1
745
+
746
+ # Step 3: Update the DataFrame with the new value
747
+ df_doors.loc[df_doors['Type'] == 'Single Doors', 'Quantity'] = str(new_value)
748
+
749
+ # Print the updated DataFrame to verify the change
750
+ print(df_doors)
751
+ elif 'double' in str(newitem):
752
+ current_value = df_doors.loc[df_doors['Type'] == 'Double Doors', 'Quantity'].values[0]
753
+ print(current_value)
754
+ # Step 2: Subtract one from the current value
755
+ new_value = int(current_value) - 1
756
+ print(new_value)
757
+ # Step 3: Update the DataFrame with the new value
758
+ df_doors.loc[df_doors['Type'] == 'Double Doors', 'Quantity'] = str(new_value)
759
+
760
+ # Print the updated DataFrame to verify the change
761
+ print(df_doors)
762
+ df_doors = df_doors[['Type', 'Quantity']]
763
+ return df_doors
764
+
765
  ######################