mirror of
https://github.com/whyour/qinglong.git
synced 2026-06-13 06:16:12 +08:00
fix: normalize env position to integer values
Agent-Logs-Url: https://github.com/whyour/qinglong/sessions/b15f49c2-c873-406f-b52b-fcdf41e2eb6c Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
parent
df677b8ad0
commit
25a8fa692a
|
|
@ -27,10 +27,10 @@ export default class EnvService {
|
||||||
envs.length > 0 &&
|
envs.length > 0 &&
|
||||||
typeof envs[envs.length - 1].position === 'number'
|
typeof envs[envs.length - 1].position === 'number'
|
||||||
) {
|
) {
|
||||||
position = envs[envs.length - 1].position!;
|
position = this.getPrecisionPosition(envs[envs.length - 1].position!);
|
||||||
}
|
}
|
||||||
const tabs = payloads.map((x) => {
|
const tabs = payloads.map((x) => {
|
||||||
position = position - stepPosition;
|
position = this.getPrecisionPosition(position - stepPosition);
|
||||||
const tab = new Env({ ...x, position });
|
const tab = new Env({ ...x, position });
|
||||||
return tab;
|
return tab;
|
||||||
});
|
});
|
||||||
|
|
@ -116,7 +116,7 @@ export default class EnvService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private getPrecisionPosition(position: number): number {
|
private getPrecisionPosition(position: number): number {
|
||||||
return parseFloat(position.toPrecision(16));
|
return Math.trunc(parseFloat(position.toPrecision(16)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async envs(searchText: string = '', query: any = {}): Promise<Env[]> {
|
public async envs(searchText: string = '', query: any = {}): Promise<Env[]> {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user