Skip to content

Commit

Permalink
fix: extra validation before push
Browse files Browse the repository at this point in the history
  • Loading branch information
dsrkafuu committed Mar 19, 2022
1 parent 964abe0 commit c334c24
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": true,
"type": "module",
"name": "skyline-overlay",
"version": "3.4.0",
"version": "3.4.1",
"description": "A modern customizable horizon FFXIV miniparse overlay.",
"license": "Apache-2.0",
"author": "DSRKafuU <dsrkafuu@outlook.com> (https://dsrkafuu.net)",
Expand Down
12 changes: 10 additions & 2 deletions src/store/modules/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,16 @@ class API {
// if last data (false) this data (true) which indicates a new battle,
// push last data (false) into a new history
if (lastData && !lastData.isActive && payload.isActive) {
this.historys.length >= 5 && this.historys.pop();
this.historys.unshift({ time: Date.now(), ...lastData });
// extra validation before push,
// do not push empty battle into history
if (
lastData.encounter.duration !== '00:00' &&
lastData.encounter.durationSeconds !== 0 &&
lastData.encounter.dps !== 0
) {
this.historys.length >= 5 && this.historys.pop();
this.historys.unshift({ time: Date.now(), ...lastData });
}
}
// record data for future use
lastData = cloneDeep(payload);
Expand Down

1 comment on commit c334c24

@DieMoe233
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已同步

Please sign in to comment.