Skip to content

Commit

Permalink
Handle expanded group names in sessions with highlights
Browse files Browse the repository at this point in the history
The code incorrectly took for granted that a session with an highlight would
always use acronyms for the types of groups (e.g., "WG" instead of "Working
Group"), and failed to recognize the name of the group if the expanded form
was used.

While it may be a good idea to keep session titles short, code should still
handle the expanded form. Done in this update.
  • Loading branch information
tidoust committed Sep 9, 2024
1 parent 9b5ecf5 commit afd30f0
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 11 deletions.
12 changes: 12 additions & 0 deletions test/check-group-highlight.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ describe('The group meetings highlight code', function () {
}]);
});

it('finds group names even when no acronym is used', async function () {
const project = await fetchTestProject();
const sessionNumber = 7;
const errors = await validateSession(sessionNumber, project);
assert.deepStrictEqual(errors, []);

const session = project.sessions.find(s => s.number === sessionNumber);
assert.deepStrictEqual(
toGroupNames(session.groups),
['Web Payments WG']);
});

it('does not merge meetings when an highlight is used in one of them', async function () {
const project = await fetchTestProject();
const errors = await validateProject(project);
Expand Down
7 changes: 7 additions & 0 deletions test/data/group-highlight.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ export default {
title: '> Just an highlight',
room: 'Room 3',
meeting: 'Monday, 9:00'
},

{
number: 7,
title: 'Web Payments Working Group: money money money',
room: 'Room 3',
meeting: 'Monday, 11:00'
}
]
}
26 changes: 20 additions & 6 deletions test/data/ref-group-highlight.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,16 @@ <h2>Sessions overview</h2>
<tr>
<th>Feel good sessions</th>
<td>0</td>
<td>5</td>
<td>5</td>
<td>6</td>
<td>6</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>Total</th>
<td>0</td>
<td>6</td>
<td>6</td>
<td>7</td>
<td>7</td>
</tr>
</tfoot>
</table>
Expand Down Expand Up @@ -142,7 +142,7 @@ <h3>Monday (2042-02-10)</h3>
<tr>
<th>
11:00 - 13:00
<p class="nbrooms">2 meetings</p>
<p class="nbrooms">3 meetings</p>
</th>
<td class="">
<p><b><a href="https://github.com/w3c/tpac-breakouts/issues/1">#1</a></b>: WICG: Digital Credentials API
Expand All @@ -152,7 +152,10 @@ <h3>Monday (2042-02-10)</h3>
<p><b><a href="https://github.com/w3c/tpac-breakouts/issues/4">#4</a></b>: Second Screen WG > OSP
</p>
</td>
<td></td>
<td class="">
<p><b><a href="https://github.com/w3c/tpac-breakouts/issues/7">#7</a></b>: Web Payments Working Group: money money money
</p>
</td>
</tr>
<tr>
<th>
Expand Down Expand Up @@ -194,6 +197,12 @@ <h3>WAI-Engage: Web Accessibility CG</h3>
<li>Monday, 9:00 - 11:00 (Room 2) (#3)</li>
</ul>
</section>
<section id="g83744">
<h3>Web Payments WG</h3>
<ul>
<li>Monday, 11:00 - 13:00 (Room 3), topic: money money money (#7)</li>
</ul>
</section>
<section id="g80485">
<h3>Web Platform Incubator CG</h3>
<ul>
Expand Down Expand Up @@ -237,6 +246,11 @@ <h2>Data for Saving/Restoring Schedule</h2>
room: Room 3
meeting:
- Monday, 9:00
- number: 7
reset: all
room: Room 3
meeting:
- Monday, 11:00

</pre>
</section>
Expand Down
10 changes: 5 additions & 5 deletions tools/lib/groups.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import { fetchW3CGroups } from './w3c.mjs';
export async function fetchSessionGroups(session, groups2W3CID) {
function normalizeTitle(title) {
return title
.replace(/ (BG|Business Group)($|,| and| &)/gi, ' BG$2')
.replace(/ (CG|Community Group)($|,| and| &)/gi, ' CG$2')
.replace(/ (IG|Interest Group)($|,| and| &)/gi, ' IG$2')
.replace(/ (WG|Working Group)($|,| and| &)/gi, ' WG$2')
.replace(/ (TF|Task Force)($|,| and| &)/gi, ' TF$2')
.replace(/ (BG|Business Group)($|,| and| &|:|>)/gi, ' BG$2')
.replace(/ (CG|Community Group)($|,| and| &|:|>)/gi, ' CG$2')
.replace(/ (IG|Interest Group)($|,| and| &|:|>)/gi, ' IG$2')
.replace(/ (WG|Working Group)($|,| and| &|:|>)/gi, ' WG$2')
.replace(/ (TF|Task Force)($|,| and| &|:|>)/gi, ' TF$2')
.trim();
}

Expand Down

0 comments on commit afd30f0

Please sign in to comment.