From 36df57a07b6388287a6c547e65bcce5048c5257a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 6 Dec 2018 10:42:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AF=B9=E5=B7=B2=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=96=87=E7=AB=A0=E7=9A=84=E6=A0=A1=E5=AF=B9=E6=A3=80?= =?UTF-8?q?=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/check/identify.sh | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/scripts/check/identify.sh b/scripts/check/identify.sh index 51a501517f..1bb479a2e2 100644 --- a/scripts/check/identify.sh +++ b/scripts/check/identify.sh @@ -54,15 +54,23 @@ rule_translation_revised() { && [ "$TOTAL" -eq 1 ] && echo "匹配规则:校对译文" } -# 发布译文:发布多篇译文 +# 发布译文:发布一篇译文 rule_translation_published() { - [ "$TSL_D" -ge 1 ] && [ "$PUB_A" -ge 1 ] && [ "$TSL_D" -eq "$PUB_A" ] \ - && ensure_identical SRC D TSL A 1 \ + [ "$TSL_D" -eq 1 ] && [ "$PUB_A" -eq 1 ] \ + && ensure_identical TSL D PUB A 1 \ && check_category TSL D \ + && check_category PUB A \ && [ "$TOTAL" -eq $((TSL_D + PUB_A)) ] \ && echo "匹配规则:发布译文 ${PUB_A} 篇" } +# 校对已发布:只能校对一篇 +rule_published_revised() { + [ "$PUB_M" -eq 1 ] \ + && check_category PUB M \ + && [ "$TOTAL" -eq 1 ] && echo "匹配规则:校对已发布" +} + # 定义常见错误 # 未知错误 @@ -76,6 +84,12 @@ error_translation_requested_multiple() { && echo "匹配错误:申领多篇,请一次仅申领一篇" } +# 提交多篇 +error_translation_completed_multiple() { + [ "$TSL_A" -gt 1 ] \ + && echo "匹配错误:提交多篇,请一次仅提交一篇" +} + # 执行检查并输出匹配项目 do_check() { rule_bypass_check \ @@ -84,8 +98,10 @@ do_check() { || rule_translation_completed \ || rule_translation_revised \ || rule_translation_published \ + || rule_published_revised \ || { error_translation_requested_multiple \ + || error_translation_completed_multiple \ || error_undefined exit 1 }