fix: map live fetch status failure code
This commit is contained in:
@@ -45,6 +45,18 @@ def main() -> None:
|
|||||||
"popup selection reset should prefer default_play_url"
|
"popup selection reset should prefer default_play_url"
|
||||||
assert re.search(r"fetch_status.*last_fetch_at", popup_source, re.S) or "update_time" in popup_source, \
|
assert re.search(r"fetch_status.*last_fetch_at", popup_source, re.S) or "update_time" in popup_source, \
|
||||||
"popup metadata should use fetch_status and last_fetch_at/update_time"
|
"popup metadata should use fetch_status and last_fetch_at/update_time"
|
||||||
|
assert re.search(r"normalized === '0'.*待抓取", popup_source, re.S), \
|
||||||
|
"popup should map fetch_status 0 to pending label"
|
||||||
|
assert re.search(r"normalized === '1'.*已抓取", popup_source, re.S), \
|
||||||
|
"popup should map fetch_status 1 to success label"
|
||||||
|
assert re.search(r"normalized === '2'.*抓取失败", popup_source, re.S), \
|
||||||
|
"popup should map fetch_status 2 to failure label"
|
||||||
|
assert re.search(r"normalized === '0'.*待抓取", detail_source, re.S), \
|
||||||
|
"page should map fetch_status 0 to pending label"
|
||||||
|
assert re.search(r"normalized === '1'.*已抓取", detail_source, re.S), \
|
||||||
|
"page should map fetch_status 1 to success label"
|
||||||
|
assert re.search(r"normalized === '2'.*抓取失败", detail_source, re.S), \
|
||||||
|
"page should map fetch_status 2 to failure label"
|
||||||
|
|
||||||
assert "/match/detail" in api_source, "match detail API path should stay on /match/detail"
|
assert "/match/detail" in api_source, "match detail API path should stay on /match/detail"
|
||||||
|
|
||||||
|
|||||||
@@ -71,9 +71,9 @@ const getFetchStatusText = (value: unknown) => {
|
|||||||
const text = normalizeText(value)
|
const text = normalizeText(value)
|
||||||
if (!text) return ''
|
if (!text) return ''
|
||||||
const normalized = text.toLowerCase()
|
const normalized = text.toLowerCase()
|
||||||
if (normalized === 'success' || normalized === '1') return '已抓取'
|
|
||||||
if (normalized === 'pending' || normalized === '0') return '待抓取'
|
if (normalized === 'pending' || normalized === '0') return '待抓取'
|
||||||
if (normalized === 'failed' || normalized === '-1') return '抓取失败'
|
if (normalized === 'success' || normalized === '1') return '已抓取'
|
||||||
|
if (normalized === 'failed' || normalized === 'error' || normalized === '2') return '抓取失败'
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -518,9 +518,9 @@ const getLiveFetchStatusText = (value: unknown) => {
|
|||||||
const text = normalizeLiveText(value)
|
const text = normalizeLiveText(value)
|
||||||
if (!text) return ''
|
if (!text) return ''
|
||||||
const normalized = text.toLowerCase()
|
const normalized = text.toLowerCase()
|
||||||
if (normalized === 'success' || normalized === '1') return '已抓取'
|
|
||||||
if (normalized === 'pending' || normalized === '0') return '待抓取'
|
if (normalized === 'pending' || normalized === '0') return '待抓取'
|
||||||
if (normalized === 'failed' || normalized === '-1') return '抓取失败'
|
if (normalized === 'success' || normalized === '1') return '已抓取'
|
||||||
|
if (normalized === 'failed' || normalized === 'error' || normalized === '2') return '抓取失败'
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user