ichieh commited on
Commit
0f717a2
·
1 Parent(s): 9efb272

Update Google Apps Script to handle payment status and note fields

Browse files
Files changed (1) hide show
  1. sync_settings.gs +19 -11
sync_settings.gs CHANGED
@@ -22,8 +22,8 @@ function doPost(e) {
22
 
23
  // 如果是第一次儲存,建立標題列
24
  if (participantsSheet.getLastRow() === 0) {
25
- participantsSheet.getRange('A1:I1').setValues([[
26
- 'ID', '暱稱', 'Email', 'FB連結', '自我介紹', '桌次', '座位號', '是否為桌長', '報名時間'
27
  ]]);
28
  }
29
 
@@ -38,7 +38,9 @@ function doPost(e) {
38
  participant.table_id,
39
  participant.seat_number,
40
  participant.is_table_leader || false,
41
- participant.created_at
 
 
42
  ]);
43
 
44
  return ContentService.createTextOutput(JSON.stringify({
@@ -51,8 +53,8 @@ function doPost(e) {
51
  // 備份參與者資料
52
  var participantsSheet = sheet.getSheetByName('Participants') || sheet.insertSheet('Participants');
53
  participantsSheet.clear();
54
- participantsSheet.getRange('A1:I1').setValues([[
55
- 'ID', '暱稱', 'Email', 'FB連結', '自我介紹', '桌次', '座位號', '是否為桌長', '報名時間'
56
  ]]);
57
 
58
  var participants = data.participants;
@@ -67,10 +69,12 @@ function doPost(e) {
67
  p.table_id,
68
  p.seat_number,
69
  p.is_table_leader || false,
70
- p.created_at
 
 
71
  ];
72
  });
73
- participantsSheet.getRange(2, 1, values.length, 9).setValues(values);
74
  }
75
 
76
  return ContentService.createTextOutput(JSON.stringify({success: true}))
@@ -101,8 +105,10 @@ function doPost(e) {
101
  introduction: row[4] || '',
102
  table_id: row[5],
103
  seat_number: row[6],
104
- is_table_leader: row[7] === 'true' || row[7] === true, // 修正這裡
105
- created_at: row[8]
 
 
106
  });
107
  }
108
 
@@ -154,8 +160,10 @@ function doGet() {
154
  introduction: row[4] || '',
155
  table_id: row[5],
156
  seat_number: row[6],
157
- is_table_leader: row[7] === 'true' || row[7] === true, // 修正這裡
158
- created_at: row[8]
 
 
159
  });
160
  }
161
  }
 
22
 
23
  // 如果是第一次儲存,建立標題列
24
  if (participantsSheet.getLastRow() === 0) {
25
+ participantsSheet.getRange('A1:K1').setValues([[
26
+ 'ID', '暱稱', 'Email', 'FB連結', '自我介紹', '桌次', '座位號', '是否為桌長', '報名時間', '付款狀態', '備註'
27
  ]]);
28
  }
29
 
 
38
  participant.table_id,
39
  participant.seat_number,
40
  participant.is_table_leader || false,
41
+ participant.created_at,
42
+ participant.has_paid || false,
43
+ participant.note || ''
44
  ]);
45
 
46
  return ContentService.createTextOutput(JSON.stringify({
 
53
  // 備份參與者資料
54
  var participantsSheet = sheet.getSheetByName('Participants') || sheet.insertSheet('Participants');
55
  participantsSheet.clear();
56
+ participantsSheet.getRange('A1:K1').setValues([[
57
+ 'ID', '暱稱', 'Email', 'FB連結', '自我介紹', '桌次', '座位號', '是否為桌長', '報名時間', '付款狀態', '備註'
58
  ]]);
59
 
60
  var participants = data.participants;
 
69
  p.table_id,
70
  p.seat_number,
71
  p.is_table_leader || false,
72
+ p.created_at,
73
+ p.has_paid || false,
74
+ p.note || ''
75
  ];
76
  });
77
+ participantsSheet.getRange(2, 1, values.length, 11).setValues(values);
78
  }
79
 
80
  return ContentService.createTextOutput(JSON.stringify({success: true}))
 
105
  introduction: row[4] || '',
106
  table_id: row[5],
107
  seat_number: row[6],
108
+ is_table_leader: row[7] === 'true' || row[7] === true,
109
+ created_at: row[8],
110
+ has_paid: row[9] === 'true' || row[9] === true,
111
+ note: row[10] || ''
112
  });
113
  }
114
 
 
160
  introduction: row[4] || '',
161
  table_id: row[5],
162
  seat_number: row[6],
163
+ is_table_leader: row[7] === 'true' || row[7] === true,
164
+ created_at: row[8],
165
+ has_paid: row[9] === 'true' || row[9] === true,
166
+ note: row[10] || ''
167
  });
168
  }
169
  }