OurTechCommunity / catchup

The OTC CatchUp web app and workflows.
https://catchup.ourtech.community
MIT License
15 stars 9 forks source link

Links in Attendee Map Overridden by `null`. #175

Open HarshKapadia2 opened 1 year ago

HarshKapadia2 commented 1 year ago

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.

https://github.com/OurTechCommunity/catchup/blob/c27e13324cbde84099095b928320d804ec97f09d/util/create-attendee-handle-map.js#L44-L54

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.)

tusharnankani commented 1 year ago

Ooh, interesting catch!