fix: use CSV header to resolve column indices dynamically#114
Open
Jah-yee wants to merge 1 commit into
Open
Conversation
Replace hardcoded column indexes (row[1] for language, row[4] for comments) with dynamic lookup from the CSV header row. This prevents filtering and sorting from silently breaking if column order changes. Fixes drkrillo#108.
Owner
|
Hey @Jah-yee ! Thanks for your interest in contributing. Before reviewing the PR, make sure to follow its PR template. Also, make sure that you have read the CONTRIBUTING.md file and that you are alligned with it. Thanks for undrestanding! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The JavaScript code references CSV columns by fixed index (row[1] for language, row[4] for comments). If the CSV column order ever changes, filtering and sorting will silently break.
Fix
Replace hardcoded indexes with dynamic lookup from the CSV header row:
colIdxobject that maps column names to their index positionsrow[colIdx.language]instead ofrow[1]row[colIdx.comments]instead ofrow[4]colIdx.languageThe CSV header is:
repo,language,title,url,comments,labels,stateThe fix is backwards-compatible with the current column order.
Testing
Fixes #108