const categories = [
{
name: “Social Capital”,
questions: [
{ id: 1, text: “Key relationships are tied to the company, not just the founder”, score: 0 },
// …4 more questions
],
totalScore: 0
},
{
name: “Authority & Influence”,
questions: [
{ id: 6, text: “The business is seen as an authority independent of the founder”, score: 0 },
// …4 more questions
],
totalScore: 0
},
// …other categories
];

function calculateScores(categories) {
return categories.map(cat => {
const total = cat.questions.reduce((sum, q) => sum + q.score, 0);
return { …cat, totalScore: total };
});
}