Skip to content

Commit 7a5b6b8

Browse files
committed
Add sorting by LOC in the fallback page
1 parent ca216c6 commit 7a5b6b8

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
99
### Added
1010

1111
- Support for branches containing slashes (`/`) in their name
12+
- Sorting by LOC in fallback page
1213

1314
### Fixed
1415

src/stat/util.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ export function getFilter(): Promise<string> {
4141
}
4242

4343
export function openFallbackPage(data: LocData, org: string, repo: string) {
44+
const locByLangs = Object.entries(data.locByLangs).sort((a, b) => b[1] - a[1])
4445
const document = window.open()?.document
4546

4647
let locTable = ""
4748

48-
for (const [lang, loc] of Object.entries(data.locByLangs)) {
49+
for (const [lang, loc] of locByLangs) {
4950
const percent = ((loc / data.loc) * 100).toFixed(2)
5051
locTable += `<tr><td>${lang}</td><td>${loc.toLocaleString()}</td><td>${percent}%</td></tr>\n`
5152
}

0 commit comments

Comments
 (0)