///|
/// 数据校验:检查台账数据本身是否自洽,返回问题列表(空列表表示通过)。
/// 校验项:
/// - 每个比赛有名字;比赛名字不重复
/// - deadline_date 符合 YYYY-MM-DD(月 01–12,日 01–31)
/// - verified_at 符合 YYYY-MM-DD(同上;表示该行最后核实日期)
/// - plan_status 只能是“在途”或“关注”
/// - 每个比赛的材料清单非空
/// - 每件作品有名字;作品名字不重复
/// - 标志位不自相矛盾:allows_existing_works 与 requires_first_publish
/// 同时为真;allows_existing_works 与 requires_new_work 同时为真;
/// allows_existing_works 与 requires_no_prior_entry 同时为真
///|
pub fn validate_data(
comps : Array[Competition],
works : Array[Work],
) -> Array[String] {
let issues : Array[String] = []
let seen_comp_names : Array[String] = []
for i in 0.. Bool {
if s.length() != 10 {
return false
}
let chars = s.to_array()
if chars[4] != '-' || chars[7] != '-' {
return false
}
for i in [0, 1, 2, 3, 5, 6, 8, 9] {
if !chars[i].is_ascii_digit() {
return false
}
}
let month_ok = (chars[5] == '0' && chars[6] >= '1' && chars[6] <= '9') ||
(chars[5] == '1' && chars[6] >= '0' && chars[6] <= '2')
let day_ok = (chars[8] == '0' && chars[9] >= '1' && chars[9] <= '9') ||
((chars[8] == '1' || chars[8] == '2') && chars[9] >= '0' && chars[9] <= '9') ||
(chars[8] == '3' && chars[9] >= '0' && chars[9] <= '1')
month_ok && day_ok
}