Persist live status and migrate legacy live data
- Add user_live_status to store hi score, hi combo count, and clear count per chart - Expand user_live_goal to persist achieved live_goal_reward_id entries instead of only coarse goal types - Update live reward handling to refresh live status and sync newly achieved live goals on every clear - Return live status and achieved goal ids from stored user data in /api/live/status - Aggregate profile liveCnt from stored user_live_status instead of hardcoded values - Load complete-rank thresholds from live info for goal evaluation - Migrate legacy user_live_record data into user_live_status and backfill achievable live goals on startup Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
@@ -4,9 +4,11 @@ import "honoka-chan/internal/constant"
|
||||
|
||||
type UserLiveGoal struct {
|
||||
ID int `xorm:"id pk autoincr"`
|
||||
LiveDifficultyID int `xorm:"live_difficulty_id"`
|
||||
UserID int `xorm:"user_id"`
|
||||
LiveDifficultyID int `xorm:"live_difficulty_id index"`
|
||||
UserID int `xorm:"user_id index"`
|
||||
LiveGoalRewardID int `xorm:"live_goal_reward_id index"`
|
||||
GoalType constant.LiveGoalType `xorm:"goal_type"`
|
||||
Rank int `xorm:"rank"`
|
||||
CompletedAt int64 `xorm:"completed_at"`
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package usermodel
|
||||
|
||||
type UserLiveStatus struct {
|
||||
ID int `xorm:"id pk autoincr"`
|
||||
UserID int `xorm:"user_id unique(user_live_status_pair) index"`
|
||||
LiveDifficultyID int `xorm:"live_difficulty_id unique(user_live_status_pair) index"`
|
||||
HiScore int `xorm:"hi_score"`
|
||||
HiComboCount int `xorm:"hi_combo_count"`
|
||||
ClearCnt int `xorm:"clear_cnt"`
|
||||
InsertDate int64 `xorm:"insert_date"`
|
||||
UpdateDate int64 `xorm:"update_date"`
|
||||
}
|
||||
|
||||
func (UserLiveStatus) TableName() string {
|
||||
return "user_live_status"
|
||||
}
|
||||
Reference in New Issue
Block a user