@@ -575,50 +575,23 @@ public Map<Code, List<Dividend>> doInBackground() {
575575 final TransactionSummary transactionSummary = transactionSummaries .get (i );
576576 final Code code = ((Transaction )transactionSummary .getChildAt (0 )).getStockInfo ().code ;
577577 Dividend latestDividend = org .yccheok .jstock .portfolio .Utils .getLatestDividend (dividendSummary , code );
578-
579- final Duration duration ;
580-
581- SimpleDate date = null ;
582-
583- if (latestDividend == null ) {
584- for (int j = 0 , ej = transactionSummary .getChildCount (); j < ej ; j ++) {
585- Transaction transaction = (Transaction )transactionSummary .getChildAt (j );
586- SimpleDate simpleDate = transaction .getContract ().getDate ();
587- if (date == null ) {
588- date = simpleDate ;
589- } else {
590- if (date .compareTo (simpleDate ) > 0 ) {
591- date = simpleDate ;
592- }
593- }
594- }
595- } else {
596- date = latestDividend .date ;
597- }
598-
599- Calendar c = date .getCalendar ();
600- c .add (Calendar .DATE , 1 );
601- SimpleDate startDate = new SimpleDate (c );
602- SimpleDate endDate = new SimpleDate ();
603- if (startDate .compareTo (endDate ) > 0 ) {
604- this .setProgress (i + 1 );
605- continue ;
606- }
607- duration = new Duration (startDate , endDate );
608-
609- List <Dividend > suggestedDividends = new ArrayList <Dividend >();
578+
579+ List <Dividend > suggestedDividends = new ArrayList <>();
610580 for (StockServerFactory stockServerFactory : Factories .INSTANCE .getStockServerFactories (code )) {
611581 if (isCancelled ()) {
612582 break ;
613583 }
614584
615585 DividendServer dividendServer = stockServerFactory .getDividendServer ();
616586 if (dividendServer != null ) {
617- List <Dividend > dividends = dividendServer .getDividends (code , duration );
618- for (Dividend dividend : dividends ) {
619- if (false == duration .isContains (dividend .date )) {
620- continue ;
587+ List <Dividend > dividends = dividendServer .getDividends (code );
588+ for (Dividend dividend : dividends ) {
589+ if (latestDividend != null ) {
590+ if (latestDividend .date .compareTo (dividend .date ) >= 0 ) {
591+ continue ;
592+ }
621593 }
594+
622595 double total = dividend .amount * quantityQuery .getBalance (code , dividend .date );
623596 if (total == 0 ) {
624597 continue ;
0 commit comments