فهرست منبع

fix(questionnaire): allow equal future scores

Developer 2 ماه پیش
والد
کامیت
316673deee
4فایلهای تغییر یافته به همراه8 افزوده شده و 11 حذف شده
  1. 2 2
      components/CusNotice/index2.vue
  2. 1 1
      pagesPublish/questionnaireFill.vue
  3. 3 6
      tests/perillScore.test.js
  4. 2 2
      utils/perillScore.js

+ 2 - 2
components/CusNotice/index2.vue

@@ -14,8 +14,8 @@
 				<div class="notice-box-content-p2">The following 36 statements describe the ideal state of a team. Please score the actual performance of the team being tested on each statement from two perspectives:</div>
 				<div class="notice-box-content-p1">1、同意度:1-5分共5个等级,假如您完全同意该团队当下达到了所描述的状态为5分,假如您完全不同意该团队当下达到了所描述的状态为1分</div>
 				<div class="notice-box-content-p2">Agreement: There are 5 levels ranging from 1 to 5. Score of 5 if you completely agree that the team has reached the statement. Score of 1 if you completely disagree.</div>
-				<div class="notice-box-content-p1">2、一年后期待:1-5分共5个等级,请评估团队在此项陈述方面一年后可达成的表现;一年后期待分必须高于现状评分。</div>
-				<div class="notice-box-content-p2">Future expectation: Rate the performance the team can achieve in one year from 1 to 5. The future expectation score must be higher than the current score.</div>
+				<div class="notice-box-content-p1">2、一年后期待:1-5分共5个等级,请评估团队在此项陈述方面一年后可达成的表现;一年后期待分不得低于现状评分。</div>
+				<div class="notice-box-content-p2">Future expectation: Rate the performance the team can achieve in one year from 1 to 5. The future expectation score must not be lower than the current score.</div>
 				<div class="notice-box-content-p1">完成这个问卷调查大约需要15-20分钟。如有任何疑问,欢迎添加大衡同学企业微信联系。</div>
 				<div class="notice-box-content-p2">Completing these questions should take approximately 15-20 minutes. If you have any questions, please feel free to scan below QR code to contact with Transcend.</div>
 				<div class="notice-box-content-info adffcac">

+ 1 - 1
pagesPublish/questionnaireFill.vue

@@ -283,7 +283,7 @@
 				if (firstInvalidExpectationIndex > -1) {
 					uni.showModal({
 						title: '提示',
-						content: '一年后期待分应高于现状评分,请注意!',
+						content: '一年后期待分不得低于现状评分,请注意!',
 						showCancel: false,
 						success: res => { if (res.confirm) this.scrollToQuestion(firstInvalidExpectationIndex); }
 					});

+ 3 - 6
tests/perillScore.test.js

@@ -10,13 +10,10 @@ const method = (assessmentMethod, score) => ({
 })
 
 assert.equal(validateFutureExpectation([method('1', 3), method('2', 4)]), '')
+assert.equal(validateFutureExpectation([method('1', 3), method('2', 3)]), '')
 assert.equal(
-	validateFutureExpectation([method('1', 3), method('2', 3)]),
-	'一年后期待分应高于现状评分,请注意!'
-)
-assert.equal(
-	validateFutureExpectation([method('1', 3), method('2', '')]),
-	'一年后期待分应高于现状评分,请注意!'
+	validateFutureExpectation([method('1', 3), method('2', 2)]),
+	'一年后期待分不得低于现状评分,请注意!'
 )
 assert.equal(
 	validateFutureExpectation([

+ 2 - 2
utils/perillScore.js

@@ -7,8 +7,8 @@ function selectedScore(methods, assessmentMethod) {
 function validateFutureExpectation(methods) {
 	const currentScore = selectedScore(methods, '1')
 	const futureScore = selectedScore(methods, '2')
-	if (currentScore === null || futureScore === null || futureScore <= currentScore) {
-		return '一年后期待分应高于现状评分,请注意!'
+	if (currentScore === null || futureScore === null || futureScore < currentScore) {
+		return '一年后期待分不得低于现状评分,请注意!'
 	}
 	return ''
 }