@@ -43,19 +43,22 @@ async function load() {
4343 }
4444}
4545
46- /** New API: activity. commits_summary; legacy: root commits_summary */
46+ /** Root commits_summary; legacy: activity. commits_summary */
4747const commitsSummary = computed (() => {
4848 const root = stats .value ;
49- return root? .activity ? . commits_summary ?? root? .commits_summary ?? {};
49+ return root? .commits_summary ?? root? . activity ? .commits_summary ?? {};
5050});
5151
5252const commitTypeRaw = computed (() => {
5353 const root = stats .value ;
54- return (
55- root? .activity ? .commit_type ??
56- root? .commit_type ? .commit_type_by_week ??
57- {}
58- );
54+ const ct = root? .commit_type ?? root? .activity ? .commit_type ;
55+ if (! ct || typeof ct !== " object" ) {
56+ return {};
57+ }
58+ if (ct .commit_type_by_week && typeof ct .commit_type_by_week === " object" ) {
59+ return ct .commit_type_by_week ;
60+ }
61+ return ct;
5962});
6063
6164const commitTypeWeeks = computed (() => {
@@ -75,10 +78,14 @@ const commitTypes = computed(() => {
7578 return orderedCommitTypes (typeSet);
7679});
7780
78- /** activity.derived.weekly_lines_history: week -> { extension -> line count } */
81+ /** Root weekly_lines_history; legacy: activity.derived.weekly_lines_history */
7982const weeklyLinesHistory = computed (() => {
8083 const root = stats .value ;
81- return root? .activity ? .derived ? .weekly_lines_history ?? {};
84+ return (
85+ root? .weekly_lines_history ??
86+ root? .activity ? .derived ? .weekly_lines_history ??
87+ {}
88+ );
8289});
8390
8491const weeklyLinesWeeks = computed (() => Object .keys (weeklyLinesHistory .value ).sort ());
@@ -111,6 +118,7 @@ const weeklyLinesExtensions = computed(() =>
111118const busFactorRaw = computed (() => {
112119 const root = stats .value ;
113120 return (
121+ root? .bus_factor ??
114122 root? .risks ? .bus_factor ??
115123 root? .post_data ? .bus_factor ??
116124 root? .commits_summary ? .post_data ? .bus_factor
@@ -165,7 +173,7 @@ const codeChurn21dPercent = computed(() => {
165173
166174const codeChurn21dRaw = computed (() => {
167175 const root = stats .value ;
168- return root? .activity ? . code_churn_21d ?? root? .code_churn_21d ?? {};
176+ return root? .code_churn_21d ?? root? . activity ? .code_churn_21d ?? {};
169177});
170178
171179const codeChurnAddedLines = computed (() => {
@@ -607,7 +615,7 @@ onUnmounted(() => {
607615 < span class = " font-semibold" > Lines of code by week< / span>
608616 < div
609617 class = " tooltip tooltip-right before:max-w-xs before:text-left before:whitespace-normal"
610- data- tip= " Stacked area: estimated lines per file extension at the end of each week (from activity.derived. weekly_lines_history)."
618+ data- tip= " Stacked area: estimated lines per file extension at the end of each week (weekly_lines_history)."
611619 >
612620 < button
613621 type= " button"
0 commit comments