m1m02530125 Claude Sonnet 4.6 commited on
Commit
4ea893d
·
1 Parent(s): ff44cbb

feat: PDFレイアウトを従業員グループ積み重ね形式に変更

Browse files

画像サンプルに合わせ、従業員を複数グループに分けて縦に積み重ねる
レイアウトに全面変更。これにより A4 横向き 1 枚に確実に収まる。

【変更点】
- 従業員を 2〜5 ブロックに自動分割(emp_h ≥ 9pt になる最小ブロック数)
- 各ブロックを _build_block_table() で独立テーブルとして生成
- 集計行を末尾に別テーブルとして追加(コンパクトな 1 行 "0 熟0" 形式)
- 左右のヘッダーセルを "氏名" → "N月" ラベル(濃紺背景・白文字)に変更
- rowHeights= をコンストラクタに渡す方式を継続(_calc() リセット対策)
- 各ブロックの行高さをページ高さから逆算して自動決定

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. export/pdf_exporter.py +183 -148
export/pdf_exporter.py CHANGED
@@ -143,6 +143,96 @@ def _slot_default(b_pos, d_pos) -> tuple[str, str]:
143
 
144
  # ── メイン出力 ────────────────────────────────────────────────────────────
145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  def export_pdf(
147
  path: str,
148
  period: SchedulePeriod,
@@ -150,12 +240,12 @@ def export_pdf(
150
  assignments: dict,
151
  ):
152
  """
153
- シフト表を PDF に出力する(横向き A4)。
154
 
155
- フォーマット:
156
- 行: 従業員(1行1人)
157
- 列: 日付(1列1日)
158
- 両端に氏名列
159
  """
160
  from db import repositories as repo
161
  requests = repo.get_shift_requests(period.id)
@@ -163,62 +253,31 @@ def export_pdf(
163
 
164
  font_name = _register_font()
165
 
166
- # ── ページ設定 ────────────────────────────────────────────────────
167
- MARGIN = 5 * mm # 余白を狭めてテーブル領域を最大化
168
  doc = SimpleDocTemplate(
169
  path,
170
  pagesize=landscape(A4),
171
- leftMargin=MARGIN,
172
- rightMargin=MARGIN,
173
- topMargin=MARGIN,
174
- bottomMargin=MARGIN,
175
  )
176
 
177
- dates = period.date_range()
178
- n = len(dates)
179
- n_emp = len(employees)
180
- n_sum = 4 # SLOT_ROWS の行数(固定)
181
 
182
- # ── 使用可能幅から列幅を計算(最小幅なし・必ず1ページに収める) ──
183
- page_w = landscape(A4)[0] - 2 * MARGIN
184
- name_w = 16 * mm # 氏名列幅
185
- data_w = (page_w - 2 * name_w) / n # 日付1列の幅(min 制限なし)
186
  col_widths = [name_w] + [data_w] * n + [name_w]
187
 
188
- font_size = max(6, min(8, int(data_w / mm * 0.55)))
189
- font_size_name = font_size
190
-
191
- # ── 行高さを先に計算してコンストラクタへ渡す ─────────────────────
192
- # ※ tbl._rowHeights を後付けしても doc.build() の _calc() でリセットされるため
193
- # 必ず rowHeights= パラメータで渡すこと
194
- TITLE_H = 24 # タイトル段落の実質高さ(12pt行 + spaceAfter 3mm)
195
- page_h = landscape(A4)[1] - 2 * MARGIN - TITLE_H
196
- row_h_hdr = 10
197
- row_h_dow = 10
198
- row_h_sum = 18
199
- avail_emp = page_h - row_h_hdr - row_h_dow - n_sum * row_h_sum
200
- row_h_emp = max(10, min(20, int(avail_emp / max(n_emp, 1))))
201
- row_heights = [row_h_hdr, row_h_dow] + [row_h_emp] * n_emp + [row_h_sum] * n_sum
202
-
203
- # ── テーブルデータ構築 ────────────────────────────────────────────
204
- start_d = date.fromisoformat(period.start_date)
205
 
206
- # 行 0: 日付番号
207
- row_dates = ["氏名"] + [str(d.day) for d in dates] + ["氏名"]
208
- # 行 1: 曜日
209
- row_dows = [""] + [DAY_JP[d.weekday()] for d in dates] + [""]
210
-
211
- # 従業員データ行
212
- emp_rows = []
213
- for emp in employees:
214
- row = [emp.name]
215
- for d in dates:
216
- text, _ = _get_shift_text(emp.id, d.isoformat(), assignments, req_map)
217
- row.append(text)
218
- row.append(emp.name)
219
- emp_rows.append(row)
220
 
221
- # 集計行(ポジション×スロット)
222
  count_map = defaultdict(int)
223
  skilled_map = defaultdict(int)
224
  for (emp_id, ds, slot_v), pos_v in assignments.items():
@@ -228,11 +287,66 @@ def export_pdf(
228
  skilled_map[(ds, slot_v, pos_v)] += 1
229
 
230
  SLOT_ROWS = [
231
- ("朝 ホール", TimeSlot.BREAKFAST, Position.HALL),
232
- ("朝 厨房", TimeSlot.BREAKFAST, Position.KITCHEN),
233
- ("夜 ホール", TimeSlot.DINNER, Position.HALL),
234
- ("夜 厨房", TimeSlot.DINNER, Position.KITCHEN),
235
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  sum_rows = []
237
  for lbl, slot, pos in SLOT_ROWS:
238
  row = [lbl]
@@ -240,97 +354,33 @@ def export_pdf(
240
  ds = d.isoformat()
241
  cnt = count_map[(ds, slot.value, pos.value)]
242
  sk = skilled_map[(ds, slot.value, pos.value)]
243
- row.append(f"{cnt}\n熟{sk}")
244
  row.append("")
245
  sum_rows.append(row)
246
 
247
- # 全行まとめ(rowHeights をコンストラクタに渡す)
248
- table_data = [row_dates, row_dows] + emp_rows + sum_rows
249
- tbl = Table(table_data, colWidths=col_widths, rowHeights=row_heights, repeatRows=2)
250
 
251
- cmds = [
252
- # 基本
253
  ("FONTNAME", (0, 0), (-1, -1), font_name),
254
- ("FONTSIZE", (0, 0), (-1, -1), font_size),
255
  ("ALIGN", (0, 0), (-1, -1), "CENTER"),
256
  ("VALIGN", (0, 0), (-1, -1), "MIDDLE"),
257
  ("GRID", (0, 0), (-1, -1), 0.4, COL_GRID),
258
- # セル余白を詰めて行を狭くしても文字が収まるようにする
259
  ("TOPPADDING", (0, 0), (-1, -1), 1),
260
  ("BOTTOMPADDING", (0, 0), (-1, -1), 1),
261
  ("LEFTPADDING", (0, 0), (-1, -1), 2),
262
  ("RIGHTPADDING", (0, 0), (-1, -1), 2),
263
- # 氏名列(左・右)
264
- ("ALIGN", (0, 0), (0, -1), "LEFT"),
265
- ("ALIGN", (-1, 0), (-1, -1), "LEFT"),
266
- ("FONTSIZE", (0, 2), (0, -1), font_size_name),
267
- ("FONTSIZE", (-1, 2), (-1, -1), font_size_name),
268
- ("BACKGROUND", (0, 2), (0, -1), COL_NAME),
269
- ("BACKGROUND", (-1, 2), (-1, -1), COL_NAME),
270
- ("FONTNAME", (0, 2), (0, -1), font_name),
271
- ("FONTNAME", (-1, 2), (-1, -1), font_name),
272
- # ヘッダー行0,1 の氏名列
273
- ("BACKGROUND", (0, 0), (0, 1), COL_NAME),
274
- ("BACKGROUND", (-1, 0), (-1, 1), COL_NAME),
275
- # ヘッダー全体(平日)
276
- ("BACKGROUND", (1, 0), (n, 1), COL_HDR_WD),
277
- ("FONTSIZE", (0, 0), (-1, 1), font_size + 1),
278
- ("FONTNAME", (0, 0), (-1, 1), font_name),
279
  ]
280
-
281
- # 土日ヘッダー色・文字色
282
- for i, d in enumerate(dates):
283
- col = i + 1
284
- dow = d.weekday()
285
- if dow == 5:
286
- cmds += [
287
- ("BACKGROUND", (col, 0), (col, 1), COL_HDR_SAT),
288
- ("TEXTCOLOR", (col, 0), (col, 1), COL_TXT_SAT),
289
- ]
290
- elif dow == 6:
291
- cmds += [
292
- ("BACKGROUND", (col, 0), (col, 1), COL_HDR_SUN),
293
- ("TEXTCOLOR", (col, 0), (col, 1), COL_TXT_SUN),
294
- ]
295
-
296
- # 従業員行の色
297
- for row_idx, emp in enumerate(employees):
298
- r = 2 + row_idx
299
- is_even = (row_idx % 2 == 1)
300
- row_bg = COL_EVEN if is_even else COL_WHITE
301
-
302
- # 行ベース色
303
- cmds.append(("BACKGROUND", (1, r), (n, r), row_bg))
304
-
305
- for i, d in enumerate(dates):
306
- col = i + 1
307
- date_str = d.isoformat()
308
- dow = d.weekday()
309
- text, style = _get_shift_text(emp.id, date_str, assignments, req_map)
310
-
311
- if style == "leave":
312
- cmds.append(("BACKGROUND", (col, r), (col, r), COL_LEAVE))
313
- cmds.append(("TEXTCOLOR", (col, r), (col, r), COL_TXT_SAT))
314
- elif style == "off":
315
- if dow == 5:
316
- cmds.append(("BACKGROUND", (col, r), (col, r), COL_SAT_D))
317
- elif dow == 6:
318
- cmds.append(("BACKGROUND", (col, r), (col, r), COL_SUN_D))
319
- cmds.append(("TEXTCOLOR", (col, r), (col, r), COL_TXT_OFF))
320
- elif style == "assigned_note":
321
- cmds.append(("FONTNAME", (col, r), (col, r), font_name))
322
-
323
- # 集計行の色
324
  for rel, (lbl, slot, pos) in enumerate(SLOT_ROWS):
325
- r = 2 + n_emp + rel
326
- key = (slot, pos)
327
- c_ = SHIFT_CONSTRAINTS.get(key, {})
328
  min_req = c_.get("min", 0)
329
  min_sk = c_.get("min_skilled", 0)
330
-
331
- cmds.append(("BACKGROUND", (0, r), (0, r), COL_SUM_BG))
332
- cmds.append(("FONTSIZE", (0, r), (-1, r), font_size - 1))
333
-
334
  for i, d in enumerate(dates):
335
  col = i + 1
336
  ds = d.isoformat()
@@ -342,24 +392,9 @@ def export_pdf(
342
  bg = COL_SUM_WARN
343
  else:
344
  bg = COL_SUM_OK
345
- cmds.append(("BACKGROUND", (col, r), (col, r), bg))
346
- cmds.append(("BACKGROUND", (-1, r), (-1, r), COL_SUM_BG))
347
-
348
- tbl.setStyle(TableStyle(cmds))
349
 
350
- # ── ストーリー構築 ────────────────────────────────────────────────
351
- title_style = ParagraphStyle(
352
- "Title",
353
- fontName=font_name,
354
- fontSize=12,
355
- alignment=TA_CENTER,
356
- textColor=COL_HDR_TITLE,
357
- spaceAfter=3 * mm,
358
- )
359
- title_text = (
360
- f"{start_d.month}月 シフト表  "
361
- f"{period.start_date} 〜 {period.end_date}"
362
- )
363
 
364
- story = [Paragraph(title_text, title_style), tbl]
365
  doc.build(story)
 
143
 
144
  # ── メイン出力 ────────────────────────────────────────────────────────────
145
 
146
+ def _build_block_table(
147
+ block_emps, dates, assignments, req_map, col_widths,
148
+ font_name, font_size, n, emp_h, hdr_h, dow_h, period_label,
149
+ ):
150
+ """従業員グループ1ブロック分のテーブルを生成する。"""
151
+ n_block = len(block_emps)
152
+
153
+ row_dates = [period_label] + [str(d.day) for d in dates] + [period_label]
154
+ row_dows = [""] + [DAY_JP[d.weekday()] for d in dates] + [""]
155
+
156
+ emp_rows = []
157
+ for emp in block_emps:
158
+ row = [emp.name]
159
+ for d in dates:
160
+ text, _ = _get_shift_text(emp.id, d.isoformat(), assignments, req_map)
161
+ row.append(text)
162
+ row.append(emp.name)
163
+ emp_rows.append(row)
164
+
165
+ table_data = [row_dates, row_dows] + emp_rows
166
+ row_heights = [hdr_h, dow_h] + [emp_h] * n_block
167
+
168
+ tbl = Table(table_data, colWidths=col_widths,
169
+ rowHeights=row_heights, repeatRows=0)
170
+
171
+ cmds = [
172
+ ("FONTNAME", (0, 0), (-1, -1), font_name),
173
+ ("FONTSIZE", (0, 0), (-1, -1), font_size),
174
+ ("ALIGN", (0, 0), (-1, -1), "CENTER"),
175
+ ("VALIGN", (0, 0), (-1, -1), "MIDDLE"),
176
+ ("GRID", (0, 0), (-1, -1), 0.4, COL_GRID),
177
+ ("TOPPADDING", (0, 0), (-1, -1), 1),
178
+ ("BOTTOMPADDING", (0, 0), (-1, -1), 1),
179
+ ("LEFTPADDING", (0, 0), (-1, -1), 2),
180
+ ("RIGHTPADDING", (0, 0), (-1, -1), 2),
181
+ # 左右 氏名列
182
+ ("ALIGN", (0, 0), (0, -1), "LEFT"),
183
+ ("ALIGN", (-1, 0), (-1, -1), "LEFT"),
184
+ ("BACKGROUND", (0, 0), (0, -1), COL_NAME),
185
+ ("BACKGROUND", (-1, 0), (-1, -1), COL_NAME),
186
+ ("FONTNAME", (0, 2), (0, -1), font_name),
187
+ ("FONTNAME", (-1, 2), (-1, -1), font_name),
188
+ # ヘッダー行(日付・曜日)
189
+ ("BACKGROUND", (1, 0), (n, 1), COL_HDR_WD),
190
+ ("FONTSIZE", (0, 0), (-1, 1), font_size + 1),
191
+ ("FONTNAME", (0, 0), (-1, 1), font_name),
192
+ # 期間ラベルセルは濃紺
193
+ ("BACKGROUND", (0, 0), (0, 0), COL_HDR_TITLE),
194
+ ("BACKGROUND", (-1, 0), (-1, 0), COL_HDR_TITLE),
195
+ ("TEXTCOLOR", (0, 0), (0, 0), colors.white),
196
+ ("TEXTCOLOR", (-1, 0), (-1, 0), colors.white),
197
+ ("FONTSIZE", (0, 0), (0, 0), font_size),
198
+ ("FONTSIZE", (-1, 0), (-1, 0), font_size),
199
+ ]
200
+
201
+ # 土日ヘッダー着色
202
+ for i, d in enumerate(dates):
203
+ col = i + 1
204
+ dow = d.weekday()
205
+ if dow == 5:
206
+ cmds += [("BACKGROUND", (col, 0), (col, 1), COL_HDR_SAT),
207
+ ("TEXTCOLOR", (col, 0), (col, 1), COL_TXT_SAT)]
208
+ elif dow == 6:
209
+ cmds += [("BACKGROUND", (col, 0), (col, 1), COL_HDR_SUN),
210
+ ("TEXTCOLOR", (col, 0), (col, 1), COL_TXT_SUN)]
211
+
212
+ # 従業員行の着色
213
+ for row_idx, emp in enumerate(block_emps):
214
+ r = 2 + row_idx
215
+ row_bg = COL_EVEN if row_idx % 2 == 1 else COL_WHITE
216
+ cmds.append(("BACKGROUND", (1, r), (n, r), row_bg))
217
+ for i, d in enumerate(dates):
218
+ col = i + 1
219
+ date_str = d.isoformat()
220
+ dow = d.weekday()
221
+ text, style = _get_shift_text(emp.id, date_str, assignments, req_map)
222
+ if style == "leave":
223
+ cmds.append(("BACKGROUND", (col, r), (col, r), COL_LEAVE))
224
+ cmds.append(("TEXTCOLOR", (col, r), (col, r), COL_TXT_SAT))
225
+ elif style == "off":
226
+ if dow == 5:
227
+ cmds.append(("BACKGROUND", (col, r), (col, r), COL_SAT_D))
228
+ elif dow == 6:
229
+ cmds.append(("BACKGROUND", (col, r), (col, r), COL_SUN_D))
230
+ cmds.append(("TEXTCOLOR", (col, r), (col, r), COL_TXT_OFF))
231
+
232
+ tbl.setStyle(TableStyle(cmds))
233
+ return tbl
234
+
235
+
236
  def export_pdf(
237
  path: str,
238
  period: SchedulePeriod,
 
240
  assignments: dict,
241
  ):
242
  """
243
+ シフト表を PDF に出力する(横向き A4・1ページ)。
244
 
245
+ レイアウト:
246
+ 従業員を複数グループに分けて縦に積み重ねて表示し、
247
+ すべてが A4 横向き 1 枚に収まるよう行高さを自動調整する。
248
+ 末尾に集計行(朝/夜 × ホール/厨房)を追加。
249
  """
250
  from db import repositories as repo
251
  requests = repo.get_shift_requests(period.id)
 
253
 
254
  font_name = _register_font()
255
 
256
+ MARGIN = 5 * mm
 
257
  doc = SimpleDocTemplate(
258
  path,
259
  pagesize=landscape(A4),
260
+ leftMargin=MARGIN, rightMargin=MARGIN,
261
+ topMargin=MARGIN, bottomMargin=MARGIN,
 
 
262
  )
263
 
264
+ dates = list(period.date_range())
265
+ n = len(dates)
266
+ n_emp = len(employees)
267
+ N_SUM = 4 # 集計行数(固定)
268
 
269
+ # ── 列幅 ─────────────────────────────────────────────────────────
270
+ page_w = landscape(A4)[0] - 2 * MARGIN
271
+ name_w = 16 * mm
272
+ data_w = (page_w - 2 * name_w) / n
273
  col_widths = [name_w] + [data_w] * n + [name_w]
274
 
275
+ font_size = max(6, min(9, int(data_w / mm * 0.6)))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
 
277
+ start_d = date.fromisoformat(period.start_date)
278
+ period_label = f"{start_d.month}月" # 左右ヘッダーセルのラベル
 
 
 
 
 
 
 
 
 
 
 
 
279
 
280
+ # ── 集計データ ────────────────────────────────────────────────────
281
  count_map = defaultdict(int)
282
  skilled_map = defaultdict(int)
283
  for (emp_id, ds, slot_v), pos_v in assignments.items():
 
287
  skilled_map[(ds, slot_v, pos_v)] += 1
288
 
289
  SLOT_ROWS = [
290
+ ("朝 ホール", TimeSlot.BREAKFAST, Position.HALL),
291
+ ("朝 厨房", TimeSlot.BREAKFAST, Position.KITCHEN),
292
+ ("夜 ホール", TimeSlot.DINNER, Position.HALL),
293
+ ("夜 厨房", TimeSlot.DINNER, Position.KITCHEN),
294
  ]
295
+
296
+ # ── レイアウト計算 ────────────────────────────────────────────────
297
+ # タイトル段落の実高さ: fontSize=11, leading≈13pt, spaceAfter=3pt
298
+ TITLE_H = 16
299
+ GAP = 3 # ブロック間・ブロックと集計の隙間 (pt)
300
+ HDR_H = 11 # 日付番号行高さ
301
+ DOW_H = 10 # 曜日行高さ
302
+ SUM_H = 13 # 集計行高さ
303
+
304
+ page_h = landscape(A4)[1] - 2 * MARGIN - TITLE_H
305
+
306
+ # ブロック数を 2〜5 で試して emp_h ≥ 9pt になる最小値を採用
307
+ best_nb, best_per, best_emp_h = 2, n_emp, 9
308
+ for nb in range(2, 6):
309
+ emps_per = (n_emp + nb - 1) // nb
310
+ # ブロック間の gap + 集計前の gap
311
+ gap_total = GAP * (nb + 1)
312
+ sum_total = N_SUM * SUM_H
313
+ block_h = (page_h - sum_total - gap_total) / nb
314
+ emp_h_calc = (block_h - HDR_H - DOW_H) / max(emps_per, 1)
315
+ if emp_h_calc >= 9:
316
+ best_nb, best_per, best_emp_h = nb, emps_per, emp_h_calc
317
+ break
318
+
319
+ n_blocks = best_nb
320
+ emps_per = best_per
321
+ emp_h = max(9, min(20, int(best_emp_h)))
322
+
323
+ # 従業員をブロックに分割
324
+ blocks = [employees[i:i + emps_per] for i in range(0, n_emp, emps_per)]
325
+
326
+ # ── ストーリー構築 ────────────────────────────────────────────────
327
+ title_style = ParagraphStyle(
328
+ "Title",
329
+ fontName=font_name, fontSize=11,
330
+ alignment=TA_CENTER, textColor=COL_HDR_TITLE,
331
+ spaceAfter=3,
332
+ )
333
+ title_text = (
334
+ f"{start_d.month}月 シフト表 "
335
+ f"{period.start_date} 〜 {period.end_date}"
336
+ )
337
+
338
+ story = [Paragraph(title_text, title_style)]
339
+
340
+ for block_emps in blocks:
341
+ tbl = _build_block_table(
342
+ block_emps, dates, assignments, req_map,
343
+ col_widths, font_name, font_size, n,
344
+ emp_h, HDR_H, DOW_H, period_label,
345
+ )
346
+ story.append(tbl)
347
+ story.append(Spacer(1, GAP))
348
+
349
+ # ── 集計テーブル ──────────────────────────────────────────────────
350
  sum_rows = []
351
  for lbl, slot, pos in SLOT_ROWS:
352
  row = [lbl]
 
354
  ds = d.isoformat()
355
  cnt = count_map[(ds, slot.value, pos.value)]
356
  sk = skilled_map[(ds, slot.value, pos.value)]
357
+ row.append(f"{cnt} 熟{sk}")
358
  row.append("")
359
  sum_rows.append(row)
360
 
361
+ sum_tbl = Table(sum_rows, colWidths=col_widths,
362
+ rowHeights=[SUM_H] * N_SUM, repeatRows=0)
 
363
 
364
+ sum_cmds = [
 
365
  ("FONTNAME", (0, 0), (-1, -1), font_name),
366
+ ("FONTSIZE", (0, 0), (-1, -1), max(5, font_size - 1)),
367
  ("ALIGN", (0, 0), (-1, -1), "CENTER"),
368
  ("VALIGN", (0, 0), (-1, -1), "MIDDLE"),
369
  ("GRID", (0, 0), (-1, -1), 0.4, COL_GRID),
 
370
  ("TOPPADDING", (0, 0), (-1, -1), 1),
371
  ("BOTTOMPADDING", (0, 0), (-1, -1), 1),
372
  ("LEFTPADDING", (0, 0), (-1, -1), 2),
373
  ("RIGHTPADDING", (0, 0), (-1, -1), 2),
374
+ ("BACKGROUND", (0, 0), (0, -1), COL_SUM_BG),
375
+ ("BACKGROUND", (-1, 0), (-1, -1), COL_SUM_BG),
376
+ ("ALIGN", (0, 0), (0, -1), "LEFT"),
377
+ ("FONTSIZE", (0, 0), (0, -1), max(5, font_size - 1)),
 
 
 
 
 
 
 
 
 
 
 
 
378
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
379
  for rel, (lbl, slot, pos) in enumerate(SLOT_ROWS):
380
+ key = (slot, pos)
381
+ c_ = SHIFT_CONSTRAINTS.get(key, {})
 
382
  min_req = c_.get("min", 0)
383
  min_sk = c_.get("min_skilled", 0)
 
 
 
 
384
  for i, d in enumerate(dates):
385
  col = i + 1
386
  ds = d.isoformat()
 
392
  bg = COL_SUM_WARN
393
  else:
394
  bg = COL_SUM_OK
395
+ sum_cmds.append(("BACKGROUND", (col, rel), (col, rel), bg))
 
 
 
396
 
397
+ sum_tbl.setStyle(TableStyle(sum_cmds))
398
+ story.append(sum_tbl)
 
 
 
 
 
 
 
 
 
 
 
399
 
 
400
  doc.build(story)