Browse Source

Merge branch 'master' of http://git.choozmo.com:3000/choozmo/HHH_Course into master

jeter20131220 3 years ago
parent
commit
5d204fe78f
1 changed files with 10 additions and 2 deletions
  1. 10 2
      api/main.py

+ 10 - 2
api/main.py

@@ -96,11 +96,19 @@ def make_ci_df():
         date_format = "%Y-%M-%d %H:%M:%S"
    
         #fdate = datetime.strptime(row['ts_date'],date_format)
-        fdate = row['time_stamp'].strftime('%Y-%m-%d')
+        fdate = row['time_stamp'].strftime('%Y-%m-%d %H時 %M分')
         
         df = df.append({'serial id':row['id'],'姓名':row['name'],'公司':row['organization']
         ,'職稱':row['position'],'電話':row['phone'],"e-mail":row['email'],'已匯款,後五碼':row['cert_last5']
         ,'如何知道這個課程':row['where_learn'],'爲什麼想報名':row['why_sign'],'Line_ID':row['line_id'],'報名日期':fdate}, ignore_index=True)
+    
+    cols = list(df.columns.values)
+    print(cols)
+    df = df[['報名日期','姓名','serial id','公司'
+        ,'職稱','電話',"e-mail",'已匯款,後五碼'
+        ,'如何知道這個課程','爲什麼想報名','Line_ID']]
+    cols = list(df.columns.values)
+    print(cols)
     save_sheet(df,'client_info','result')
     
 def save_sheet(df,filename,tabname,startpos='A1'):
@@ -114,4 +122,4 @@ def save_sheet(df,filename,tabname,startpos='A1'):
     gc = gspread.authorize(credentials)
     spread = Spread(filename,creds=credentials)
 
-    spread.df_to_sheet(df, index=False, sheet=tabname, start=startpos, replace=False)
+    spread.df_to_sheet(df, index=True, sheet=tabname, start=startpos, replace=True)