Marthee commited on
Commit
d25a836
·
verified ·
1 Parent(s): b66f47c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -53
app.py CHANGED
@@ -46,12 +46,13 @@ def getInfotoMeasure():
46
 
47
  @app.route('/getprojectnames/',methods=['GET'])
48
  def getprjnamesfromTestAPI():
49
- prjnames=API.getPrjNames()
50
  # API.AppendtablestoSheets()
51
- return jsonify(prjnames)
52
 
53
  @app.route('/getprojectparts/<jsdata>',methods=['GET'])
54
  def getprjpartsfromTestAPI(jsdata):
 
55
  prjparts,partsIds=API.getprjParts(jsdata)
56
  return jsonify([prjparts,partsIds])
57
 
@@ -468,33 +469,24 @@ def checktables():
468
  newvalues= t1Diff1['ProjectName'].values
469
  returnString=''
470
  returnString=['Changes have been made in Projects. Would you like to retrieve them in the console? By saying yes, you may need to repeat the website related processes(if any).','project',(newvalues).tolist(),table2.to_dict()]
 
471
  if (not t2Diff.empty)or( not t2Diff1.empty) :
472
- print(t2Diff,t2Diff1)
473
  if projectname:
474
- for i in range(len(t2Diff1['ProjectId'].values)):
475
- print(t2Diff1['ProjectId'].values[i] ,a[row[0]][0][0])
476
  if int(t2Diff1['ProjectId'].values[i]) ==int(a[row[0]][0][0]):
477
  differentParts.append(t2Diff1['ProjectPart'].iloc[i])
478
  if len(differentParts)>0:
479
  returnString=['Changes have been made in Parts. Would you like to retrieve them in the console?','part',differentParts]
480
- print(returnString)
481
-
482
  if (not t3Diff.empty) or (not t3Diff1.empty) :
483
  differentSections=[]
484
- if projectpart and projectname:
485
- print(t3Diff1)
486
-
487
- roww=t3Diff1.iloc[np.where((t3Diff1['ProjectId']==int(prjid) ) & (t3Diff1['ProjectPartId']==int(projectpartid)) ) ]
488
- print('wweee',prjid,projectpartid)
489
  for i in range(len(roww['ProjectId'].values)):
490
- # if roww.shape[0]>0:
491
- print(roww['ProjectSection'].iloc[i] )
492
- differentSections.append(str(roww['ProjectSection'].iloc[i]))
493
- print(differentSections)
494
  if len(differentSections)>0:
495
  returnString=['Changes have been made in Sections. Would you like to retrieve them in the console?','section',differentSections]
496
- print(differentSections)
497
-
498
  # if not t2Diff.empty:
499
  # newvalues= t2Diff['ProjectName'].values
500
  # else:
@@ -525,41 +517,6 @@ def checktables():
525
 
526
  return jsonify(returnString)
527
 
528
- # @app.route('/getnewparts',methods=["GET", "POST"])
529
-
530
-
531
- def prjsectionsRefreshAPItable3(table3,projectname,projectpart):
532
- # table1,table2,table3=API.GenerateTables()
533
- # projectname = request.args.get('prjname')
534
-
535
- url_1 = prjnamesURL.replace('/edit#gid=', '/export?format=csv&gid=')
536
- table1N = pd.read_csv(url_1)
537
-
538
- url_2 = prjpartsURL.replace('/edit#gid=', '/export?format=csv&gid=')
539
- table2N = pd.read_csv(url_2)
540
-
541
- url_3 = prjsectionsURL.replace('/edit#gid=', '/export?format=csv&gid=')
542
- table3N = pd.read_csv(url_3)
543
-
544
- differentSections=[]
545
- returnString=''
546
- t3Diff1=table3[~table3.isin(table3N)].dropna()
547
- t3Diff=table3N[~table3N.isin(table3)].dropna()
548
-
549
- a1 = table1N.to_numpy()
550
- row = np.where(a1 == projectname)
551
- prjid=a1[row[0]][0][0]
552
- a2 = table2N.to_numpy()
553
- row2 = np.where(a2 == projectpart)
554
- partid=a2[row2[0]][0][1]
555
-
556
- for i in range(len(t3Diff['ProjectId'].values)):
557
- roww=table3N.iloc[np.where((table3N['ProjectId']==prjid) & (table3N['ProjectPartId']==partid) ) ]
558
- differentSections.append(roww['ProjectSection'].iloc[i])
559
- # returnString=['Changes have been made in Parts. Would you like to retrieve them in the console?','part',differentParts]
560
- print(differentSections)
561
- return returnString
562
-
563
  @app.route('/refreshDropbox',methods=["GET", "POST"])
564
  def checkdropbox():
565
  print('checkingggdf')
 
46
 
47
  @app.route('/getprojectnames/',methods=['GET'])
48
  def getprjnamesfromTestAPI():
49
+ prjnames,prjids=API.getPrjNames()
50
  # API.AppendtablestoSheets()
51
+ return jsonify([prjnames,prjids])
52
 
53
  @app.route('/getprojectparts/<jsdata>',methods=['GET'])
54
  def getprjpartsfromTestAPI(jsdata):
55
+ print('kkkk',jsdata)
56
  prjparts,partsIds=API.getprjParts(jsdata)
57
  return jsonify([prjparts,partsIds])
58
 
 
469
  newvalues= t1Diff1['ProjectName'].values
470
  returnString=''
471
  returnString=['Changes have been made in Projects. Would you like to retrieve them in the console? By saying yes, you may need to repeat the website related processes(if any).','project',(newvalues).tolist(),table2.to_dict()]
472
+
473
  if (not t2Diff.empty)or( not t2Diff1.empty) :
 
474
  if projectname:
475
+ for i in range(len(t2Diff1['ProjectId'].values)):
 
476
  if int(t2Diff1['ProjectId'].values[i]) ==int(a[row[0]][0][0]):
477
  differentParts.append(t2Diff1['ProjectPart'].iloc[i])
478
  if len(differentParts)>0:
479
  returnString=['Changes have been made in Parts. Would you like to retrieve them in the console?','part',differentParts]
480
+
 
481
  if (not t3Diff.empty) or (not t3Diff1.empty) :
482
  differentSections=[]
483
+ if projectpart and projectname:
484
+ roww=t3Diff1.iloc[np.where((t3Diff1['ProjectId']==int(prjid) ) & (t3Diff1['ProjectPartId']==int(projectpartid)) ) ]
 
 
 
485
  for i in range(len(roww['ProjectId'].values)):
486
+ differentSections.append(str(roww['ProjectSection'].iloc[i]))
 
 
 
487
  if len(differentSections)>0:
488
  returnString=['Changes have been made in Sections. Would you like to retrieve them in the console?','section',differentSections]
489
+
 
490
  # if not t2Diff.empty:
491
  # newvalues= t2Diff['ProjectName'].values
492
  # else:
 
517
 
518
  return jsonify(returnString)
519
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
520
  @app.route('/refreshDropbox',methods=["GET", "POST"])
521
  def checkdropbox():
522
  print('checkingggdf')