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

Add guide alarms endpoint #12

Merged
merged 1 commit into from
Jul 12, 2024
Merged

Add guide alarms endpoint #12

merged 1 commit into from
Jul 12, 2024

Conversation

hugo-vrijswijk
Copy link
Contributor

@hugo-vrijswijk hugo-vrijswijk commented Jul 11, 2024

});

// Convert the array of alarms to an object with the wfs as the key
return Object.fromEntries(alarms.map((alarm) => [alarm.wfs, alarm])) as Record<WfsType, GuideAlarm>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the confusion, I have read different opinions about having "variable" key objects against having arrays of objects with a specific key with value equals to the variable.
I like your approach and maybe you can enlighten me about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, there's something to be said for either approach. In this case, I chose for it because there's a very limited number of values, and the values should always exist. In an array, there's no certainty that a value will exist because you have to iterate over the array. This way, if it doesn't things will break early

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, we are lucky that GN and GS use the same wavefront sensors, then those names should not change, even after the desired wfs upgrade.

@dngomez
Copy link
Contributor

dngomez commented Jul 12, 2024

LGTM!

@hugo-vrijswijk hugo-vrijswijk merged commit f3f779f into main Jul 12, 2024
2 checks passed
@hugo-vrijswijk hugo-vrijswijk deleted the guide-alarms branch July 12, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants