fix: restore match3d indexed visibility reads
This commit is contained in:
@@ -23,13 +23,13 @@ use spacetimedb::AnonymousViewContext;
|
||||
|
||||
/// 抓大鹅公开广场列表投影。
|
||||
///
|
||||
/// `match3d_work_profile` 是玩法源表,HTTP gallery 只订阅这个轻量 view,
|
||||
/// `match_3_d_work_profile` 是玩法源表,HTTP gallery 只订阅这个轻量 view,
|
||||
/// 避免每个公开列表请求重新调用 procedure 扫描和组装全量列表。
|
||||
#[spacetimedb::view(accessor = match3d_gallery_view, public)]
|
||||
pub fn match3d_gallery_view(ctx: &AnonymousViewContext) -> Vec<Match3DGalleryViewRow> {
|
||||
let mut items = ctx
|
||||
.db
|
||||
.match3d_work_profile()
|
||||
.match_3_d_work_profile()
|
||||
.by_match3d_work_publication_status()
|
||||
.filter(MATCH3D_PUBLICATION_PUBLISHED)
|
||||
.filter(|row| row.visible)
|
||||
@@ -501,7 +501,7 @@ fn compile_match3d_draft_tx(
|
||||
validate_config(&config)?;
|
||||
let existing_work = ctx
|
||||
.db
|
||||
.match3d_work_profile()
|
||||
.match_3_d_work_profile()
|
||||
.profile_id()
|
||||
.find(&input.profile_id)
|
||||
.filter(|row| row.owner_user_id == input.owner_user_id);
|
||||
@@ -695,15 +695,14 @@ fn list_match3d_works_tx(
|
||||
) -> Result<Vec<Match3DWorkSnapshot>, String> {
|
||||
let rows = if input.published_only {
|
||||
ctx.db
|
||||
.match3d_work_profile()
|
||||
.iter()
|
||||
// 中文注释:列表页优先稳定性,避免二级索引 filter 初始化异常直接打爆模块实例。
|
||||
.filter(|row| row.publication_status == MATCH3D_PUBLICATION_PUBLISHED)
|
||||
.match_3_d_work_profile()
|
||||
.by_match3d_work_publication_status()
|
||||
.filter(MATCH3D_PUBLICATION_PUBLISHED)
|
||||
.collect::<Vec<_>>()
|
||||
} else {
|
||||
require_non_empty(&input.owner_user_id, "match3d owner_user_id")?;
|
||||
ctx.db
|
||||
.match3d_work_profile()
|
||||
.match_3_d_work_profile()
|
||||
.iter()
|
||||
.filter(|row| row.owner_user_id == input.owner_user_id)
|
||||
.collect::<Vec<_>>()
|
||||
@@ -727,14 +726,14 @@ fn get_match3d_work_detail_tx(
|
||||
) -> Result<Match3DWorkSnapshot, String> {
|
||||
let row = ctx
|
||||
.db
|
||||
.match3d_work_profile()
|
||||
.match_3_d_work_profile()
|
||||
.profile_id()
|
||||
.find(&input.profile_id)
|
||||
.filter(|row| {
|
||||
row.owner_user_id == input.owner_user_id
|
||||
|| row.publication_status == MATCH3D_PUBLICATION_PUBLISHED
|
||||
})
|
||||
.ok_or_else(|| "match3d_work_profile 不存在".to_string())?;
|
||||
.ok_or_else(|| "match_3_d_work_profile 不存在".to_string())?;
|
||||
build_work_snapshot(&row)
|
||||
}
|
||||
|
||||
@@ -744,7 +743,7 @@ fn delete_match3d_work_tx(
|
||||
) -> Result<Vec<Match3DWorkSnapshot>, String> {
|
||||
let work = find_owned_work(ctx, &input.profile_id, &input.owner_user_id)?;
|
||||
ctx.db
|
||||
.match3d_work_profile()
|
||||
.match_3_d_work_profile()
|
||||
.profile_id()
|
||||
.delete(&work.profile_id);
|
||||
for run in ctx
|
||||
@@ -782,14 +781,14 @@ fn start_match3d_run_tx(
|
||||
}
|
||||
let work = ctx
|
||||
.db
|
||||
.match3d_work_profile()
|
||||
.match_3_d_work_profile()
|
||||
.profile_id()
|
||||
.find(&input.profile_id)
|
||||
.filter(|row| {
|
||||
row.owner_user_id == input.owner_user_id
|
||||
|| row.publication_status == MATCH3D_PUBLICATION_PUBLISHED
|
||||
})
|
||||
.ok_or_else(|| "match3d_work_profile 不存在".to_string())?;
|
||||
.ok_or_else(|| "match_3_d_work_profile 不存在".to_string())?;
|
||||
let started_at_ms = if input.started_at_ms > 0 {
|
||||
input.started_at_ms
|
||||
} else {
|
||||
@@ -966,11 +965,11 @@ fn find_owned_work(
|
||||
require_non_empty(profile_id, "match3d profile_id")?;
|
||||
require_non_empty(owner_user_id, "match3d owner_user_id")?;
|
||||
ctx.db
|
||||
.match3d_work_profile()
|
||||
.match_3_d_work_profile()
|
||||
.profile_id()
|
||||
.find(&profile_id.to_string())
|
||||
.filter(|row| row.owner_user_id == owner_user_id)
|
||||
.ok_or_else(|| "match3d_work_profile 不存在".to_string())
|
||||
.ok_or_else(|| "match_3_d_work_profile 不存在".to_string())
|
||||
}
|
||||
|
||||
fn find_owned_run(
|
||||
@@ -1260,17 +1259,17 @@ fn click_result(
|
||||
fn upsert_work(ctx: &ReducerContext, work: Match3DWorkProfileRow) {
|
||||
if ctx
|
||||
.db
|
||||
.match3d_work_profile()
|
||||
.match_3_d_work_profile()
|
||||
.profile_id()
|
||||
.find(&work.profile_id)
|
||||
.is_some()
|
||||
{
|
||||
ctx.db
|
||||
.match3d_work_profile()
|
||||
.match_3_d_work_profile()
|
||||
.profile_id()
|
||||
.delete(&work.profile_id);
|
||||
}
|
||||
ctx.db.match3d_work_profile().insert(work);
|
||||
ctx.db.match_3_d_work_profile().insert(work);
|
||||
}
|
||||
|
||||
fn replace_session(
|
||||
@@ -1291,10 +1290,10 @@ fn replace_work(
|
||||
next: Match3DWorkProfileRow,
|
||||
) {
|
||||
ctx.db
|
||||
.match3d_work_profile()
|
||||
.match_3_d_work_profile()
|
||||
.profile_id()
|
||||
.delete(¤t.profile_id);
|
||||
ctx.db.match3d_work_profile().insert(next);
|
||||
ctx.db.match_3_d_work_profile().insert(next);
|
||||
}
|
||||
|
||||
fn clone_session(row: &Match3DAgentSessionRow) -> Match3DAgentSessionRow {
|
||||
|
||||
Reference in New Issue
Block a user