pytest-dev / pytest-dev/pytest-html
Got incorrect sort when the content of cell is the numeric value of the float type.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 779
- Forks
- 260
- PR merge metrics
- No merged PRs in 30d
Description
I insert one cell to store the numeric value of the float type in summary section as following shown.
cells.insert(11, '<th class="sortable" data-column-type="speedup">speedup</th>')
And the speedup is the numeric value of the float type.
In genericSort fuction, convert the value of cell into lowcase, I think should check whether the value is a numeric type.
If yes, should return parseFloat(a[key]) - parseFloat(b[key])
sorted = list.sort((a, b) => {
if (!isNaN(parseFloat(a[key])) && !isNaN(parseFloat(a[key]))){
return parseFloat(a[key]) - parseFloat(b[key])
}
return a[key] === b[key] ? 0 : a[key] > b[key] ? 1 : -1
})
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the genericSort function responsible for sorting the inserted summary cells, starting from the speedup column described in the issue. Check how float values are compared versus lowercased strings, then verify that numeric speedup values sort by their numeric value while nonnumeric values retain the existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100