Skip to content

Commit

Permalink
fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
x2rr committed Mar 10, 2021
1 parent 5229468 commit 4608213
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ var setBadge = (fundcode, Realtime, type) => {
sum = (NAV - NAV / (1 + NAVCHGRT * 0.01)) * num
} else {
let gsz = isNaN(val.GSZ) ? null : val.GSZ
if (gsz) {
if (gsz && NAV) {
sum = (gsz - NAV) * num
}
}
Expand Down Expand Up @@ -415,14 +415,16 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
(item) => item.code == val.FCODE
);
let num = slt[0].num ? slt[0].num : 0;
allAmount += val.NAV * num;
let NAV = isNaN(val.NAV) ? null : val.NAV;
allAmount += NAV * num;
var sum = 0;
if (val.PDATE != "--" && val.PDATE == val.GZTIME.substr(0, 10)) {
sum = (val.NAV - val.NAV / (1 + val.NAVCHGRT * 0.01)) * num
let NAVCHGRT = isNaN(val.NAVCHGRT) ? 0 : val.NAVCHGRT;
sum = (NAV - NAV / (1 + NAVCHGRT * 0.01)) * num
} else {
let gsz = isNaN(val.GSZ) ? null : val.GSZ;
if (gsz) {
sum = (gsz - val.NAV) * num;
if (gsz != null && NAV != null) {
sum = (gsz - NAV) * num;
}

}
Expand Down
5 changes: 4 additions & 1 deletion src/popup/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,10 @@ export default {
allNum += parseFloat(val.amount);
});
allCostGains = allCostGains.toFixed(2);
let allCostGainsRate = ((allCostGains * 100) / allNum).toFixed(2);
let allCostGainsRate = (
(allCostGains * 100) /
(allNum - allCostGains)
).toFixed(2);
return [allCostGains, allCostGainsRate];
},
containerClass() {
Expand Down

0 comments on commit 4608213

Please sign in to comment.