Skip to content

Commit b8e47ff

Browse files
#RI-3612-initial commit
1 parent 6c29ed0 commit b8e47ff

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

redisinsight/api/src/modules/browser/dto/z-set.dto.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ export class ZSetMemberDto {
8282
})
8383
@IsDefined()
8484
@IsNumber({ maxDecimalPlaces: 15 })
85-
@Type(() => Number)
86-
score: number;
85+
// @Type(() => Number)
86+
score: number | string;
8787
}
8888

8989
export class AddMembersToZSetDto extends KeyDto {

redisinsight/api/src/modules/browser/services/z-set-business/z-set-business.service.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
Logger,
66
NotFoundException,
77
} from '@nestjs/common';
8-
import { isNull } from 'lodash';
8+
import { isNull, isNaN } from 'lodash';
99
import * as isGlob from 'is-glob';
1010
import config from 'src/utils/config';
1111
import { catchAclError, catchTransactionError, unescapeGlob } from 'src/utils';
@@ -375,7 +375,6 @@ export class ZSetBusinessService {
375375
nextCursor: null,
376376
members: [],
377377
};
378-
379378
while (result.nextCursor !== 0 && result.members.length < count) {
380379
const scanResult = await this.browserTool.execCommand(
381380
clientOptions,
@@ -406,11 +405,13 @@ export class ZSetBusinessService {
406405
const result: ZSetMemberDto[] = [];
407406
while (reply.length) {
408407
const member = reply.splice(0, 2);
408+
const score = isNaN(parseFloat(member[1])) ? member[1] : parseFloat(member[1]);
409409
result.push(plainToClass(ZSetMemberDto, {
410410
name: member[0],
411-
score: parseFloat(member[1]),
411+
score,
412412
}));
413413
}
414+
414415
return result;
415416
}
416417

0 commit comments

Comments
 (0)