diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 6213850..5cae591 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -1,57 +1,30 @@ -name: Build & deploy - +name: Flutter Web on: push: branches: - master - pull_request: - branches: - - master - jobs: build: - name: Build - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Install Flutter - uses: subosito/flutter-action@v1 - with: - flutter-version: '2.0.5' - - - name: Get dependencies - run: flutter pub get - - - name: Test project - run: flutter test - - - name: Build release project - run: flutter build web - - - name: Upload production-ready build files - uses: actions/upload-artifact@v2 - with: - name: production-files - path: ./build/web - - deploy: - name: Deploy - needs: build + name: Build Web + env: + my_secret: ${{secrets.commit_secret}} runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' - steps: - - name: Download artifact - uses: actions/download-artifact@v2 - with: - name: production-files - path: ./build - - - name: Deploy to gh-pages - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./build \ No newline at end of file + - uses: actions/checkout@v1 + - uses: subosito/flutter-action@v1 + with: + channel: 'dev' + - run: flutter config --enable-web + - run: flutter pub get + - run: flutter build web --release + - run: | + cd build/web + git init + git config --global user.email praslnx8@gmail.com + git config --global user.name praslnx8 + git status + git remote add origin https://${{secrets.commit_secret}}@github.com/wealth-wave/wealth_wave.git + git checkout -b gh-pages + git add --all + git commit -m "update" + git push origin gh-pages -f \ No newline at end of file diff --git a/lib/domain/models/investment.dart b/lib/domain/models/investment.dart index 496d1e8..de78ad9 100644 --- a/lib/domain/models/investment.dart +++ b/lib/domain/models/investment.dart @@ -73,12 +73,17 @@ class Investment { Future getValueOn( {required final DateTime date, bool considerFuturePayments = false}) async { + final maturityDate = this.maturityDate; + final futureDate = maturityDate != null && maturityDate.isBefore(date) + ? maturityDate + : date; + final payments = await getTransactions().then((transactions) => transactions .map((transaction) => transaction.toPayment()) .toList(growable: true)); if (considerFuturePayments) { getSips().then((sips) => Future.wait(sips.map((sip) => sip - .getFuturePayment(till: date) + .getFuturePayment(till: futureDate) .then((futurePayments) => payments.addAll(futurePayments))))); } @@ -90,12 +95,12 @@ class Investment { payments: payments, value: value, valueUpdatedOn: valueUpdatedOn); return _irrCalculator.calculateValueOnIRR( irr: irr, - futureDate: date, + futureDate: futureDate, currentValue: value, currentValueUpdatedOn: valueUpdatedOn); } else if (irr != null) { return _irrCalculator.calculateFutureValueOnIRR( - payments: payments, irr: irr, date: date); + payments: payments, irr: irr, date: futureDate); } else { throw Exception('Value and IRR are null'); } diff --git a/pubspec.lock b/pubspec.lock index cfda62a..ba8d30f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -165,10 +165,10 @@ packages: dependency: transitive description: name: collection - sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.1" + version: "1.18.0" convert: dependency: transitive description: @@ -362,18 +362,18 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.5.0" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" mime: dependency: transitive description: @@ -715,6 +715,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" + source: hosted + version: "0.3.0" web_socket_channel: dependency: transitive description: @@ -756,5 +764,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.0.6 <4.0.0" + dart: ">=3.2.0-194.0.dev <4.0.0" flutter: ">=3.10.0"