Skip to content

Commit

Permalink
handle release date on missing tab correct #46
Browse files Browse the repository at this point in the history
  • Loading branch information
trembon committed Aug 16, 2024
1 parent a51159d commit b3d3123
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
31 changes: 20 additions & 11 deletions src/db/switchTitlesDB.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ import (
)

type TitleAttributes struct {
Id string `json:"id"`
Name string `json:"name,omitempty"`
Version json.Number `json:"version,omitempty"`
Region string `json:"region,omitempty"`
ReleaseDate int `json:"releaseDate,omitempty"`
Publisher string `json:"publisher,omitempty"`
IconUrl string `json:"iconUrl,omitempty"`
Screenshots []string `json:"screenshots,omitempty"`
BannerUrl string `json:"bannerUrl,omitempty"`
Description string `json:"description,omitempty"`
Size int `json:"size,omitempty"`
Id string `json:"id"`
Name string `json:"name,omitempty"`
Version json.Number `json:"version,omitempty"`
Region string `json:"region,omitempty"`
ReleaseDate int `json:"releaseDate,omitempty"`
ParsedReleaseDate string
Publisher string `json:"publisher,omitempty"`
IconUrl string `json:"iconUrl,omitempty"`
Screenshots []string `json:"screenshots,omitempty"`
BannerUrl string `json:"bannerUrl,omitempty"`
Description string `json:"description,omitempty"`
Size int `json:"size,omitempty"`
}

type SwitchTitle struct {
Expand Down Expand Up @@ -70,6 +71,14 @@ func CreateSwitchTitleDB(titlesFile, versionsFile io.Reader) (*SwitchTitlesDB, e
}
result.TitlesMap[idPrefix] = switchTitle

// parse the release date to a date string
prd := strconv.Itoa(attr.ReleaseDate)
if len(prd) == 8 {
attr.ParsedReleaseDate = prd[0:4] + "-" + prd[4:6] + "-" + prd[6:8]
} else {
attr.ParsedReleaseDate = prd
}

//process Updates
if strings.HasSuffix(id, "800") {
updates := versions[id[0:len(id)-3]+"000"]
Expand Down
4 changes: 2 additions & 2 deletions src/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type SwitchTitle struct {
TitleId string `json:"titleId"`
Icon string `json:"icon"`
Region string `json:"region"`
ReleaseDate int `json:"release_date"`
ReleaseDate string `json:"release_date"`
}

type LibraryTemplateData struct {
Expand Down Expand Up @@ -455,7 +455,7 @@ func (g *GUI) getMissingGames() []SwitchTitle {
Name: v.Attributes.Name,
Icon: v.Attributes.BannerUrl,
Region: v.Attributes.Region,
ReleaseDate: v.Attributes.ReleaseDate,
ReleaseDate: v.Attributes.ParsedReleaseDate,
})
}
return result
Expand Down
2 changes: 1 addition & 1 deletion src/resources/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ $(function () {
{field: "name",title: "Title", headerFilter:"input",formatter:"textarea",width:350},
{title: "Title id", headerSort:false, field: "titleId"},
{title: "Region", headerSort:true,headerFilter:"input",formatter:"textarea", field: "region"},
{title: "Release date", headerSort:true, field: "release_date"},
{title: "Release date", headerSort:true, field: "release_date", sorter:"date", sorterParams:{format:"YYYY-MM-DD"}},
],
});
}
Expand Down

0 comments on commit b3d3123

Please sign in to comment.