Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links in Attendee Map Overridden by null. #175

Open
HarshKapadia2 opened this issue Jul 15, 2023 · 1 comment
Open

Links in Attendee Map Overridden by null. #175

HarshKapadia2 opened this issue Jul 15, 2023 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@HarshKapadia2
Copy link
Member

Background

To make it easier to convert a file with CatchUp attendee names to a format that adds their social media links, @tusharnankani added functionality to first create a Map of existing attendees and their social media handles, and secondly to use that map to generate the required link format.

Documentation for the Map generation and link format conversion is at https://github.com/OurTechCommunity/catchup/blob/main/util/README.md. Feel free to ask more questions!

Initial attendee name list format:

First_name Last_name
First_name Last_name
First_name Last_name

Final link format: (Eg: https://github.com/OurTechCommunity/catchup/blob/main/summary/sessions/139/attendees.adoc?plain=1)

link:<social_link>[First_name Last_name^]
link:<social_link>[First_name Last_name^]
link:<social_link>[First_name Last_name^]

Map format: (Generated in the summary directory as map.json once the command mentioned in the documentation is executed.)

[
	{
		"name": "First_name Last_name",
		"handle": "<social_link>"
	},
	...
]

Map property of overriding existing key values if set again:

image

Problem

If an attendee has their social media link set in previous CatchUp sessions, but does not have a link in the last CatchUp session that they attended, then their link gets overridden to null as per the logic below.

for (let line of fileContents) {
if (!line) continue; // skip empty lines
let [, link, name, onlyName] = line.match(attendeePattern) ?? [];
if (link && name) {
globalMap.set(name, link);
} else if (onlyName) {
globalMap.set(onlyName, null);
} else {
console.warn(`Error parsing line: ${line}, filePath: ${filePath}`);
}
}

Proposed Solution

We need to check that if an attendee's handle key in the map is not null (i.e., a link exists), then it should not be overwritten to null. Changes have to be made in the https://github.com/OurTechCommunity/catchup/blob/main/util/create-attendee-handle-map.js file.

Feel free to suggest other solutions!

On a side note, just for clarification, we should allow overwriting in other cases, because if an attendee requests a new link to be used from current sessions, then we should allow the current behaviour of replacing the older handle (link) with the new link.
(Yes, we can check to see if the old link and the new one are the same and replace it only if it is new, but I don't think it is worth adding a check for that, because the map is in memory and we're not reading/writing to a file till the entire map is ready.)

@HarshKapadia2 HarshKapadia2 added bug Something isn't working good first issue Good for newcomers labels Jul 15, 2023
@tusharnankani
Copy link
Member

Ooh, interesting catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants