Skip to content

fix: use CSV header to resolve column indices dynamically#114

Open
Jah-yee wants to merge 1 commit into
drkrillo:mainfrom
Jah-yee:fix/dynamic-column-indices
Open

fix: use CSV header to resolve column indices dynamically#114
Jah-yee wants to merge 1 commit into
drkrillo:mainfrom
Jah-yee:fix/dynamic-column-indices

Conversation

@Jah-yee
Copy link
Copy Markdown

@Jah-yee Jah-yee commented Jun 2, 2026

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:

  • Added colIdx object that maps column names to their index positions
  • Language filter now uses row[colIdx.language] instead of row[1]
  • Sort by comments now uses row[colIdx.comments] instead of row[4]
  • Language aggregation in the filter population also uses colIdx.language

The CSV header is: repo,language,title,url,comments,labels,state

  • language = index 1
  • comments = index 4

The fix is backwards-compatible with the current column order.

Testing

  • Single-file change (app/frontend/index.html)
  • No functional changes to existing behavior — only resilience against future column reordering
  • All references to row[N] that depended on column positions are updated

Fixes #108

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.
@drkrillo
Copy link
Copy Markdown
Owner

drkrillo commented Jun 2, 2026

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!

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.

[FIX]: Use column names instead of hardcoded indexes for filtering and sorting in frontend

2 participants