@@ -123,6 +123,15 @@ def build_stack_for_round(items: list[tuple[str, str, colors.Color]], col_width:
123123# -----------------------------
124124# miniblock section
125125# -----------------------------
126+ def has_round_gap (rounds : list [int ]) -> bool :
127+ if len (rounds ) < 2 :
128+ return False
129+ for a , b in zip (rounds , rounds [1 :]):
130+ if b != a + 1 :
131+ return True
132+ return False
133+
134+
126135def build_miniblock_section (miniblock : dict [str , Any ], page_usable_width : float ) -> list [Flowable ]:
127136 flow = []
128137 styles = getSampleStyleSheet ()
@@ -143,9 +152,8 @@ def build_miniblock_section(miniblock: dict[str, Any], page_usable_width: float)
143152 flow .append (Spacer (1 , 6 ))
144153 return flow
145154
146- first_r = miniblock .get ("first_seen_round" , 0 )
147- last_r = miniblock .get ("last_seen_round" , 0 )
148- rounds = list (range (first_r , last_r + 1 ))
155+ mentioned = miniblock .get ("mentioned" , {})
156+ rounds = sorted (mentioned .keys ())
149157
150158 num_cols = max (1 , len (rounds ))
151159 col_width = page_usable_width / num_cols
@@ -160,24 +168,26 @@ def build_miniblock_section(miniblock: dict[str, Any], page_usable_width: float)
160168 items = mentioned .get (r , [])
161169 drawing = build_stack_for_round (items , col_width )
162170 cells .append (drawing )
171+ gap = has_round_gap (rounds )
163172
164173 tbl = Table (
165174 [header , cells ],
166175 colWidths = [col_width ] * num_cols ,
167176 hAlign = "LEFT" ,
168177 )
169178
170- tbl .setStyle (
171- TableStyle (
172- [
173- ("GRID" , (0 , 0 ), (- 1 , - 1 ), 0.25 , colors .grey ),
174- ("BACKGROUND" , (0 , 0 ), (- 1 , 0 ), colors .whitesmoke ),
175- ("ALIGN" , (0 , 0 ), (- 1 , 0 ), "CENTER" ),
176- ("FONTSIZE" , (0 , 0 ), (- 1 , 0 ), ROUND_HEADER_FONT ),
177- ("VALIGN" , (0 , 1 ), (- 1 , - 1 ), "TOP" ),
178- ]
179- )
180- )
179+ style = [
180+ ("GRID" , (0 , 0 ), (- 1 , - 1 ), 0.25 , colors .grey ),
181+ ("BACKGROUND" , (0 , 0 ), (- 1 , 0 ), colors .whitesmoke ),
182+ ("ALIGN" , (0 , 0 ), (- 1 , 0 ), "CENTER" ),
183+ ("FONTSIZE" , (0 , 0 ), (- 1 , 0 ), ROUND_HEADER_FONT ),
184+ ("VALIGN" , (0 , 1 ), (- 1 , - 1 ), "TOP" ),
185+ ]
186+
187+ if gap :
188+ style .append (("BOX" , (0 , 0 ), (- 1 , - 1 ), 2 , colors .red ))
189+
190+ tbl .setStyle (TableStyle (style ))
181191
182192 flow .append (tbl )
183193 flow .append (Spacer (1 , 8 ))
0 commit comments