Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Commit

Permalink
Fix most recent data not being displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
gediminasz committed Dec 2, 2019
1 parent 69dfa1b commit 8117847
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.2.1

* Fixed most recent data not being displayed by adding 24 month limit.

## 0.2.0

* Added tooltips to show rating values within the charts.
Expand Down
15 changes: 10 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,18 @@ function fetchStats(userId) {
}

function fetchStatsHistory(userId) {
const body = new FormData;
const body = new FormData();
body.append("job", 12);
body.append("user_no", userId);
body.append("month_begin", 10);
body.append("month_end", 12);
body.append("year_begin", 2017);
body.append("year_end", 2050);

const now = new Date();
const year = now.getFullYear();
const month = now.getMonth() + 1;
body.append("year_begin", year - 2); // GTS API returns up to two years of data
body.append("month_begin", month);
body.append("year_end", year);
body.append("month_end", month);

return fetch("https://www.gran-turismo.com/us/api/gt7sp/profile/", { method: "POST", body })
.then(response => response.json())
.then(({ stats_history }) => stats_history);
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.2.0",
"version": "0.2.1",
"manifest_version": 2,
"name": "DR/SR Charts",
"description": "See your DR/SR charts under your GT Sport profile.",
Expand Down

0 comments on commit 8117847

Please sign in to comment.