LCOV - code coverage report
Current view: top level - lib/_classes/math - budget_recalculation.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 9 0.0 %
Date: 2024-10-04 11:09:33 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright 2023 The terCAD team. All rights reserved.
       2             : // Use of this source code is governed by a CC BY-NC-ND 4.0 license that can be found in the LICENSE file.
       3             : 
       4             : import 'package:app_finance/_classes/math/abstract_recalculation.dart';
       5             : import 'package:app_finance/_classes/structure/budget_app_data.dart';
       6             : 
       7             : class BudgetRecalculation extends AbstractRecalculation {
       8             :   BudgetAppData change;
       9             :   BudgetAppData? initial;
      10             : 
      11           0 :   BudgetRecalculation({
      12             :     required this.change,
      13             :     this.initial,
      14             :   });
      15             : 
      16           0 :   @override
      17             :   double getDelta() {
      18           0 :     if (initial?.amountLimit == 0 && change.amountLimit > 0) {
      19           0 :       return (initial?.amount ?? 0.0) / change.amountLimit;
      20           0 :     } else if (!change.hidden && initial?.hidden == false && change.amountLimit > 0) {
      21           0 :       return initial!.amountLimit * initial!.progress / change.amountLimit;
      22             :     } else {
      23             :       return 0.0;
      24             :     }
      25             :   }
      26             : 
      27           0 :   BudgetRecalculation updateBudget() {
      28           0 :     change.progress = getDelta();
      29           0 :     change.amount = initial?.amount ?? 0.0;
      30             :     return this;
      31             :   }
      32             : }

Generated by: LCOV version 1.14