wpt.fyi
                                
                                 wpt.fyi copied to clipboard
                                
                                    wpt.fyi copied to clipboard
                            
                            
                            
                        Compat2021: change summary numbers up top when changing the feature dropdown
Reported by @robnyman to me on chat.
https://wpt.fyi/compat2021 by default shows overall numbers and graphs.
Changing to https://wpt.fyi/compat2021?feature=aspect-ratio updates the graphs, but not the summary numbers, making it tricky to tell at a glance what the current score for each is.
@stephenmcgruer is all the data there for make this fix easy?
I think that was originally a specifically requested feature; top-level scores were meant to be top-level always. That said, we can change it of course.
Currently the summaries draw their values from the summary CSVs (https://github.com/Ecosystem-Infra/wpt-results-analysis/blob/gh-pages/data/compat2021/summary-experimental.csv), but the same data should (he says) be available in the data tables I think:
https://github.com/web-platform-tests/wpt.fyi/blob/main/webapp/components/compat-2021.js#L38
One could get the data table for the current feature, and then look at the last row for the current % passing.
Wait, sorry, wasn't thinking. You don't need to use the data-table at all, the summary csv literally has it broken down per feature anyway. So just check what the current feature is and either calculate fifths (for all-features), or grab the specific feature otherwise.
It sounds like something we might have discussion, yeah. This would be the code to change right?
https://github.com/web-platform-tests/wpt.fyi/blob/b13ac69e72416b99e98583da5eaf4c8941af09ac/webapp/components/compat-2021.js#L485-L496
This would be the code to change right?
Yep. You'd need to change the properties to take the current feature too I believe: https://github.com/web-platform-tests/wpt.fyi/blob/b13ac69e72416b99e98583da5eaf4c8941af09ac/webapp/components/compat-2021.js#L463