fix: 活动结束后活动关卡被误判成常驻关卡

This commit is contained in:
uye
2023-07-01 00:24:54 +08:00
parent b702c7492b
commit 6af3cf04d0
2 changed files with 38 additions and 11 deletions

View File

@@ -117,5 +117,37 @@ namespace MaaWpfGui.Models
// regular stage, always open
return true;
}
/// <summary>
/// Determine whether the stage is open or will open
/// </summary>
/// <returns>Whether stage is open</returns>
public bool IsStageOpenOrWillOpen()
{
if (Activity != null)
{
if (!Activity.IsExpired)
{
return true;
}
// expired activity
if (!Activity.IsResourceCollection)
{
return false;
}
// expired resource activity, check open days
}
// resource stage
if (OpenDays != null && OpenDays.Any())
{
return true;
}
// regular stage, always open
return true;
}
}
}

View File

@@ -237,10 +237,8 @@ namespace MaaWpfGui.Services
UtcExpireTime = GetDateTime(stageObj["Activity"], "UtcExpireTime"),
},
};
if (!stageInfo.Activity.IsExpired)
{
tempStage.Add(stageInfo.Display, stageInfo);
}
tempStage.Add(stageInfo.Display, stageInfo);
}
continue;
@@ -266,10 +264,7 @@ namespace MaaWpfGui.Services
},
};
if (!stageInfo.Activity.IsExpired)
{
tempStage.Add(stageInfo.Display, stageInfo);
}
tempStage.Add(stageInfo.Display, stageInfo);
}
}
catch (Exception e)
@@ -395,12 +390,12 @@ namespace MaaWpfGui.Services
}
/// <summary>
/// Gets all stage list
/// Gets all open or will open stage list
/// </summary>
/// <returns>All stage list</returns>
/// <returns>Open or will open stage list</returns>
public IEnumerable<CombinedData> GetStageList()
{
return _stages.Values.Where(stage => !stage.IsHidden);
return _stages.Values.Where(stage => !stage.IsHidden && stage.IsStageOpenOrWillOpen());
}
}
}