1
This commit is contained in:
@@ -1888,6 +1888,7 @@ pub(crate) fn map_custom_world_library_entry_from_profile_snapshot(
|
||||
play_count: snapshot.play_count,
|
||||
remix_count: snapshot.remix_count,
|
||||
like_count: snapshot.like_count,
|
||||
recent_play_count_7d: 0,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1916,6 +1917,7 @@ pub(crate) fn map_custom_world_gallery_entry_snapshot(
|
||||
play_count: snapshot.play_count,
|
||||
remix_count: snapshot.remix_count,
|
||||
like_count: snapshot.like_count,
|
||||
recent_play_count_7d: snapshot.recent_play_count_7d,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2395,6 +2397,7 @@ pub(crate) fn map_puzzle_work_profile(
|
||||
play_count: snapshot.play_count,
|
||||
remix_count: snapshot.remix_count,
|
||||
like_count: snapshot.like_count,
|
||||
recent_play_count_7d: snapshot.recent_play_count_7d,
|
||||
publish_ready: snapshot.publish_ready,
|
||||
anchor_pack: map_puzzle_anchor_pack(snapshot.anchor_pack),
|
||||
}
|
||||
@@ -2438,6 +2441,13 @@ pub(crate) fn map_puzzle_runtime_level_snapshot(
|
||||
started_at_ms: snapshot.started_at_ms,
|
||||
cleared_at_ms: snapshot.cleared_at_ms,
|
||||
elapsed_ms: snapshot.elapsed_ms,
|
||||
time_limit_ms: snapshot.time_limit_ms,
|
||||
remaining_ms: snapshot.remaining_ms,
|
||||
paused_accumulated_ms: snapshot.paused_accumulated_ms,
|
||||
pause_started_at_ms: snapshot.pause_started_at_ms,
|
||||
freeze_accumulated_ms: snapshot.freeze_accumulated_ms,
|
||||
freeze_started_at_ms: snapshot.freeze_started_at_ms,
|
||||
freeze_until_ms: snapshot.freeze_until_ms,
|
||||
leaderboard_entries: snapshot
|
||||
.leaderboard_entries
|
||||
.into_iter()
|
||||
@@ -3948,6 +3958,7 @@ pub struct CustomWorldLibraryEntryRecord {
|
||||
pub play_count: u32,
|
||||
pub remix_count: u32,
|
||||
pub like_count: u32,
|
||||
pub recent_play_count_7d: u32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
@@ -3970,6 +3981,7 @@ pub struct CustomWorldGalleryEntryRecord {
|
||||
pub play_count: u32,
|
||||
pub remix_count: u32,
|
||||
pub like_count: u32,
|
||||
pub recent_play_count_7d: u32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
@@ -4411,6 +4423,22 @@ pub struct PuzzleRunNextLevelRecordInput {
|
||||
pub advanced_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct PuzzleRunPauseRecordInput {
|
||||
pub run_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub paused: bool,
|
||||
pub updated_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct PuzzleRunPropRecordInput {
|
||||
pub run_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub prop_kind: String,
|
||||
pub used_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct BigFishPlayReportRecordInput {
|
||||
pub session_id: String,
|
||||
@@ -4556,6 +4584,7 @@ pub struct PuzzleWorkProfileRecord {
|
||||
pub play_count: u32,
|
||||
pub remix_count: u32,
|
||||
pub like_count: u32,
|
||||
pub recent_play_count_7d: u32,
|
||||
pub publish_ready: bool,
|
||||
pub anchor_pack: PuzzleAnchorPackRecord,
|
||||
}
|
||||
@@ -4616,6 +4645,13 @@ pub struct PuzzleRuntimeLevelRecord {
|
||||
pub started_at_ms: u64,
|
||||
pub cleared_at_ms: Option<u64>,
|
||||
pub elapsed_ms: Option<u64>,
|
||||
pub time_limit_ms: u64,
|
||||
pub remaining_ms: u64,
|
||||
pub paused_accumulated_ms: u64,
|
||||
pub pause_started_at_ms: Option<u64>,
|
||||
pub freeze_accumulated_ms: u64,
|
||||
pub freeze_started_at_ms: Option<u64>,
|
||||
pub freeze_until_ms: Option<u64>,
|
||||
pub leaderboard_entries: Vec<PuzzleLeaderboardEntryRecord>,
|
||||
}
|
||||
|
||||
@@ -4834,6 +4870,7 @@ pub struct BigFishWorkSummaryRecord {
|
||||
pub play_count: u32,
|
||||
pub remix_count: u32,
|
||||
pub like_count: u32,
|
||||
pub recent_play_count_7d: u32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize)]
|
||||
@@ -4861,6 +4898,8 @@ struct CompatibleBigFishWorkSummaryRecord {
|
||||
remix_count: u32,
|
||||
#[serde(default)]
|
||||
like_count: u32,
|
||||
#[serde(default)]
|
||||
recent_play_count_7d: u32,
|
||||
}
|
||||
|
||||
impl CompatibleBigFishWorkSummaryRecord {
|
||||
@@ -4889,6 +4928,7 @@ impl CompatibleBigFishWorkSummaryRecord {
|
||||
play_count: self.play_count,
|
||||
remix_count: self.remix_count,
|
||||
like_count: self.like_count,
|
||||
recent_play_count_7d: self.recent_play_count_7d,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4964,6 +5004,62 @@ mod tests {
|
||||
assert_eq!(items[0].like_count, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn puzzle_run_mapper_backfills_missing_timer_fields() {
|
||||
let result = PuzzleRunProcedureResult {
|
||||
ok: true,
|
||||
run_json: Some(
|
||||
r#"{
|
||||
"run_id":"puzzle-run-1",
|
||||
"entry_profile_id":"puzzle-profile-1",
|
||||
"cleared_level_count":0,
|
||||
"current_level_index":1,
|
||||
"current_grid_size":3,
|
||||
"played_profile_ids":["puzzle-profile-1"],
|
||||
"previous_level_tags":["雨夜","猫咪","神庙"],
|
||||
"current_level":{
|
||||
"run_id":"puzzle-run-1",
|
||||
"level_index":1,
|
||||
"grid_size":3,
|
||||
"profile_id":"puzzle-profile-1",
|
||||
"level_name":"雨夜拼图",
|
||||
"author_display_name":"测试作者",
|
||||
"theme_tags":["雨夜","猫咪","神庙"],
|
||||
"cover_image_src":null,
|
||||
"board":{
|
||||
"rows":3,
|
||||
"cols":3,
|
||||
"pieces":[{
|
||||
"piece_id":"piece-1",
|
||||
"correct_row":0,
|
||||
"correct_col":0,
|
||||
"current_row":0,
|
||||
"current_col":0,
|
||||
"merged_group_id":null
|
||||
}],
|
||||
"merged_groups":[],
|
||||
"selected_piece_id":null
|
||||
},
|
||||
"status":"Playing"
|
||||
},
|
||||
"recommended_next_profile_id":null
|
||||
}"#
|
||||
.to_string(),
|
||||
),
|
||||
error_message: None,
|
||||
};
|
||||
|
||||
let run = map_puzzle_run_procedure_result(result)
|
||||
.expect("旧 puzzle run JSON 缺计时字段时应按默认值兼容");
|
||||
let level = run.current_level.expect("兼容后仍应保留当前关卡");
|
||||
|
||||
assert_eq!(run.run_id, "puzzle-run-1");
|
||||
assert!(level.started_at_ms > 0);
|
||||
assert_eq!(level.time_limit_ms, 0);
|
||||
assert_eq!(level.remaining_ms, 0);
|
||||
assert!(level.leaderboard_entries.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn big_fish_works_mapper_backfills_missing_owner_user_id_for_private_lists() {
|
||||
let result = BigFishWorksProcedureResult {
|
||||
|
||||
Reference in New Issue
Block a user