Time based leaderboards, last n days clarification
S
Selim Ober
started a topic
over 5 years ago
I've been experimenting with time based leaderboards by following the tutorial. It works fine but I wanted to be sure if I understand correctly the dynamics of it.
In the tutorial, the example states it's been built for the last 30 days. But in my tests, the name of the snapshot is {leaderboard_name}..SNAPSHOT.2017-03-01, i.e the beginning of the month.
So I have a conflicting model in my mind of the concepts of monthly updating / resetting leaderboards, which are set to the beginning of the month, and the time filter we created in the format of: ${now - 30 * 24 * 60 * 60 * 1000} which is the last 30 days.
Same question stands for last 7 days and last 24 hours as well.
Thanks
Best Answer
C
Customer Support
said
over 5 years ago
Hello forum peopliii!
I just wanted to share Liam's solution here so that it will help you guys if you also come across the problem....
Hi Selim,
No problem. You can set up event as follows. We have a won and lost
value and some time values with default value expressions so the dates
will automatically be added to scores
For day we're using ${format(today, 'yyyyMMdd')} //for today it'll return "20170329"
For week we're using ${format(today, 'yyyyww')} //for this week it will return "201714"
For month we're using ${format(today, 'yyyymm')} //for this month it will return "201703"
No you can create you leaderboards like below.
Day
Week
Month
With these in place you are now ready to post a score. When you test this in the test harness you notice it looks like this.
{
"@class": ".LogEventRequest",
"eventKey": "points_LB",
"pointsWon": 0,
"pointsLost": 0,
"day": "${format(today, 'yyyyMMdd')}",
"week": "${format(today, 'yyyyww')}",
"month": "${format(today, 'yyyyMM')}"
}
You can remove the day/week/month default values when sending this
event. You' only need to send it with the won and lost attributes.
{
"@class": ".LogEventRequest",
"eventKey": "points_LB",
"pointsWon": 0,
"pointsLost": 0
}
Once posted you can check out the results in the leaderboard manage
screen. With this system a partition will be created for each unique
day/week/month value that gets automatically passed in from the event.
Try that and let me know if it work as expected.
I just wanted to share Liam's solution here so that it will help you guys if you also come across the problem....
Hi Selim,
No problem. You can set up event as follows. We have a won and lost
value and some time values with default value expressions so the dates
will automatically be added to scores
For day we're using ${format(today, 'yyyyMMdd')} //for today it'll return "20170329"
For week we're using ${format(today, 'yyyyww')} //for this week it will return "201714"
For month we're using ${format(today, 'yyyymm')} //for this month it will return "201703"
No you can create you leaderboards like below.
Day
Week
Month
With these in place you are now ready to post a score. When you test this in the test harness you notice it looks like this.
{
"@class": ".LogEventRequest",
"eventKey": "points_LB",
"pointsWon": 0,
"pointsLost": 0,
"day": "${format(today, 'yyyyMMdd')}",
"week": "${format(today, 'yyyyww')}",
"month": "${format(today, 'yyyyMM')}"
}
You can remove the day/week/month default values when sending this
event. You' only need to send it with the won and lost attributes.
{
"@class": ".LogEventRequest",
"eventKey": "points_LB",
"pointsWon": 0,
"pointsLost": 0
}
Once posted you can check out the results in the leaderboard manage
screen. With this system a partition will be created for each unique
day/week/month value that gets automatically passed in from the event.
Try that and let me know if it work as expected.
Regards,
Liam
Customer Support
said
over 5 years ago
Hi Selim,
I've followed up with you in your ticket on this issue.
Selim Ober
I've been experimenting with time based leaderboards by following the tutorial. It works fine but I wanted to be sure if I understand correctly the dynamics of it.
In the tutorial, the example states it's been built for the last 30 days. But in my tests, the name of the snapshot is {leaderboard_name}..SNAPSHOT.2017-03-01, i.e the beginning of the month.
So I have a conflicting model in my mind of the concepts of monthly updating / resetting leaderboards, which are set to the beginning of the month, and the time filter we created in the format of: ${now - 30 * 24 * 60 * 60 * 1000} which is the last 30 days.
Same question stands for last 7 days and last 24 hours as well.
Thanks
Hello forum peopliii!
I just wanted to share Liam's solution here so that it will help you guys if you also come across the problem....
Hi Selim,
No problem. You can set up event as follows. We have a won and lost value and some time values with default value expressions so the dates will automatically be added to scores
For day we're using ${format(today, 'yyyyMMdd')} //for today it'll return "20170329"For week we're using ${format(today, 'yyyyww')} //for this week it will return "201714"
For month we're using ${format(today, 'yyyymm')} //for this month it will return "201703"
No you can create you leaderboards like below.
Day
WeekMonth
With these in place you are now ready to post a score. When you test this in the test harness you notice it looks like this.{
"@class": ".LogEventRequest",
"eventKey": "points_LB",
"pointsWon": 0,
"pointsLost": 0,
"day": "${format(today, 'yyyyMMdd')}",
"week": "${format(today, 'yyyyww')}",
"month": "${format(today, 'yyyyMM')}"
}
You can remove the day/week/month default values when sending this event. You' only need to send it with the won and lost attributes.
{
"@class": ".LogEventRequest",
"eventKey": "points_LB",
"pointsWon": 0,
"pointsLost": 0
}
Once posted you can check out the results in the leaderboard manage screen. With this system a partition will be created for each unique day/week/month value that gets automatically passed in from the event. Try that and let me know if it work as expected.
Regards,
Liam
- Oldest First
- Popular
- Newest First
Sorted by PopularCustomer Support
Hello forum peopliii!
I just wanted to share Liam's solution here so that it will help you guys if you also come across the problem....
Hi Selim,
No problem. You can set up event as follows. We have a won and lost value and some time values with default value expressions so the dates will automatically be added to scores
For day we're using ${format(today, 'yyyyMMdd')} //for today it'll return "20170329"For week we're using ${format(today, 'yyyyww')} //for this week it will return "201714"
For month we're using ${format(today, 'yyyymm')} //for this month it will return "201703"
No you can create you leaderboards like below.
Day
WeekMonth
With these in place you are now ready to post a score. When you test this in the test harness you notice it looks like this.{
"@class": ".LogEventRequest",
"eventKey": "points_LB",
"pointsWon": 0,
"pointsLost": 0,
"day": "${format(today, 'yyyyMMdd')}",
"week": "${format(today, 'yyyyww')}",
"month": "${format(today, 'yyyyMM')}"
}
You can remove the day/week/month default values when sending this event. You' only need to send it with the won and lost attributes.
{
"@class": ".LogEventRequest",
"eventKey": "points_LB",
"pointsWon": 0,
"pointsLost": 0
}
Once posted you can check out the results in the leaderboard manage screen. With this system a partition will be created for each unique day/week/month value that gets automatically passed in from the event. Try that and let me know if it work as expected.
Regards,
Liam
Customer Support
Hi Selim,
I've followed up with you in your ticket on this issue.
Regards,
Liam
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics