September 2018
Intermediate to advanced
328 pages
9h 10m
English
The fifth and final section contains functions to calculate totals by category, which we'll utilize in the pie charts, as follows:
void upsertCategoryNode(int categoryId, float transactionRaw, float transactionCooked) { struct Node *foundNode = findNodeById(categoryId, categoriesHead); if (foundNode != NULL) { foundNode->rawAmount += transactionRaw; foundNode->cookedAmount += transactionCooked; } else { appendNode(&categoriesHead, categoryId, categoryId, transactionRaw, transactionCooked); }}void buildValuesByCategoryList() { struct Node *node = transactionsHead; while (node != NULL) { upsertCategoryNode(node->categoryId, node->rawAmount, node->cookedAmount); node = node->next; }}void recalculateForCategories() { categoriesHead ...Read now
Unlock full access