Giter VIP home page Giter VIP logo

leaderboard's People

Contributors

zepinos avatar

Watchers

 avatar

leaderboard's Issues

It's not sorting based on score

Hi,

I've used http://localhost:8080/admin/createLeaderboardInfo?name=Ashu&period=DAY&sort=DESC
to create multiple rows.

Then I used http://localhost:8080/leaderboard/appendScore?position=4&userId=4&score=6
to append score and user id.

And finally using http://localhost:8080/admin/listLeaderboardInfo?startPosition=0&endPosition=99

I expect the result of this api to be sorted based on score, but it's not sorting based on score.
It is simply returning in order of key's position !

So it's not really a leader-board !!

Also, I can see this :

if (epochHashOperations.hasKey(currentEpochKey, userId)) {

		// TODO 마지막으로 점수를 저장한 timestamp 을 가져와 ZSet 에서 사용자의 등록된 점수 조회
		Long currentEpoch = epochHashOperations.get(currentEpochKey, userId);

		Double currentScore = zSetOperations.score(currentKey, currentEpoch + ":" + userId);

		if ((sort == Sort.ASC && currentScore.doubleValue() < score) ||
				(sort == Sort.DESC && currentScore > score)) {

			// TODO 현재 timestamp 와 점수를 저장

		}

	} else {

		// TODO 등록된 정보가 없다면 최초 등록이기 때문에 무조건 등록

	}

So main logic is for us //TODO !
And you haven't even used ZSET, but just kept it in comment.

So, this isn't very helpful, as it's not behaving like leader-board !

See, I've given different scores so the list should be sorted based on score, but see the output, it is not sorted based on score, but it is just appearing based on position.

http://localhost:8080/admin/listLeaderboardInfo?startPosition=0&endPosition=99

{
"leaderboardInfoList": [
{
"name": "MyLeaderBoard001",
"period": "DAY",
"sort": "DESC",
"status": "USE"
},
{
"name": "MyLeaderBoard002",
"period": "DAY",
"sort": "DESC",
"status": "USE"
},
{
"name": "MyLeaderBoard003",
"period": "DAY",
"sort": "DESC",
"status": "USE"
},
{
"name": "Abhishek",
"period": "DAY",
"sort": "DESC",
"status": "USE"
},
{
"name": "Ashu",
"period": "DAY",
"sort": "DESC",
"status": "USE"
}
],
"status": 0
}

Here, score of Abhishek is highest, then my score, and leaderboard001, 2, 3 are also in different score !

So, please let me know asap, if I'm doing something wrong, or you haven't really implemented entire leaderboard.

Thanks and Regards,
Ashutosh Pathak

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.