打分BUG处理
This commit is contained in:
parent
6011f52a19
commit
08cf62a845
|
|
@ -38,7 +38,7 @@ class QuestionNumberView extends GetView<HomeworkReviewLogic> {
|
||||||
var studentQuestions = sateData.studentQuestions.value ?? [];
|
var studentQuestions = sateData.studentQuestions.value ?? [];
|
||||||
|
|
||||||
return $QuestionNumberScrollView(
|
return $QuestionNumberScrollView(
|
||||||
controller:controller,
|
controller: controller,
|
||||||
sateData: sateData,
|
sateData: sateData,
|
||||||
sateZoomData: sateZoomData,
|
sateZoomData: sateZoomData,
|
||||||
studentQuestions: studentQuestions,
|
studentQuestions: studentQuestions,
|
||||||
|
|
@ -141,27 +141,34 @@ Widget $questionNumberScrollView({
|
||||||
|
|
||||||
// 单道题得分框
|
// 单道题得分框
|
||||||
@hwidget
|
@hwidget
|
||||||
Widget $scoringQuestionsView(BuildContext context, List<StudentQuestions>? studentQuestions,StudentQuestions item, HomeworkReviewLogic logic, double scaleRatio, double initScale) {
|
Widget $scoringQuestionsView(BuildContext context, List<StudentQuestions>? studentQuestions, StudentQuestions item, HomeworkReviewLogic logic, double scaleRatio, double initScale) {
|
||||||
var studentScore = useState<int?>(item.studentScore);
|
var studentScore = useState<int?>(item.studentScore);
|
||||||
|
|
||||||
useValueChanged<int?, void>(studentScore.value, (_, __) {
|
useValueChanged<int?, void>(item.studentScore, (_, __) {
|
||||||
item.studentScore = studentScore.value;
|
|
||||||
|
|
||||||
// 校验是否自动提交 对于已经批阅过的试题 不重复自动提交
|
|
||||||
var annotateTime = logic.state.data.value?.annotateTime;
|
|
||||||
if (annotateTime == null) {
|
|
||||||
var noRatingGiven = studentQuestions!.firstWhereOrNull((e) => e.studentScore == null);
|
|
||||||
if (noRatingGiven == null) logic.submit(context);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
useValueChanged<StudentQuestions, void>(item, (_, __) {
|
|
||||||
studentScore.value = item.studentScore;
|
studentScore.value = item.studentScore;
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
return () {};
|
/// 学生打分数据
|
||||||
|
studentScoreListener() {
|
||||||
|
item.studentScore = studentScore.value;
|
||||||
|
if (item.studentScore == null) return;
|
||||||
|
|
||||||
|
// 校验是否自动提交 对于已经批阅过的试题 不重复自动提交
|
||||||
|
var annotateTime = logic.state.data.value?.annotateTime;
|
||||||
|
if (annotateTime == null) {
|
||||||
|
var noRatingGiven = studentQuestions!.firstWhereOrNull((e) => e.studentScore == null);
|
||||||
|
if (noRatingGiven == null) logic.submit(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
studentScore.addListener(studentScoreListener);
|
||||||
|
|
||||||
|
return () {
|
||||||
|
studentScore.removeListener(studentScoreListener);
|
||||||
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
var padinVal = item.correctRate > 0 ? EdgeInsets.only(top: 6.4.h) : EdgeInsets.symmetric(vertical: 2.h);
|
var padinVal = item.correctRate > 0 ? EdgeInsets.only(top: 6.4.h) : EdgeInsets.symmetric(vertical: 2.h);
|
||||||
return Container(
|
return Container(
|
||||||
height: item.height! * scaleRatio * initScale,
|
height: item.height! * scaleRatio * initScale,
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import 'package:making_school_asignment_app/common/job/marking_models/do_test_qu
|
||||||
import 'package:making_school_asignment_app/common/mixins/event_bus_mixin.dart';
|
import 'package:making_school_asignment_app/common/mixins/event_bus_mixin.dart';
|
||||||
import 'package:making_school_asignment_app/common/utils/anti_shake_throttling.dart';
|
import 'package:making_school_asignment_app/common/utils/anti_shake_throttling.dart';
|
||||||
import 'package:making_school_asignment_app/common/utils/cached_network_img.dart';
|
import 'package:making_school_asignment_app/common/utils/cached_network_img.dart';
|
||||||
|
import 'package:making_school_asignment_app/common/utils/toast_utils.dart';
|
||||||
import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
|
import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
|
||||||
import 'package:making_school_asignment_app/page/home_page/children/homework_review/configuration_files/index.dart';
|
import 'package:making_school_asignment_app/page/home_page/children/homework_review/configuration_files/index.dart';
|
||||||
import 'package:zoom_widget/zoom_widget.dart';
|
import 'package:zoom_widget/zoom_widget.dart';
|
||||||
|
|
@ -347,7 +348,17 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
sateData.data.value?.zgtAnnotate = null;
|
sateData.data.value?.zgtAnnotate = null;
|
||||||
sateData.data.value?.showZgtAnnotate = null;
|
sateData.data.value?.showZgtAnnotate = null;
|
||||||
if (sateData.data.value != null) {
|
if (sateData.data.value != null) {
|
||||||
sateData.data.update((_) => logic.submit(Get.context ?? context));
|
sateData.data.update((_) {
|
||||||
|
var theStudentQuestions = sateData.studentQuestions.value;
|
||||||
|
if (theStudentQuestions?.isNotEmpty ?? false) {
|
||||||
|
var noMarking = theStudentQuestions?.firstWhereOrNull((e) => e.studentScore == null);
|
||||||
|
if (noMarking != null) {
|
||||||
|
ToastUtils.showInfo("未提交!请为第${noMarking.questionNo}题打分,再手动提交");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logic.submit(Get.context ?? context);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -189,28 +189,26 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
||||||
void cancelAllRatings() {
|
void cancelAllRatings() {
|
||||||
var studentQuestions = state.studentQuestions.value;
|
var studentQuestions = state.studentQuestions.value;
|
||||||
if (state.data.value?.studentQuestions.isEmpty ?? true) return;
|
if (state.data.value?.studentQuestions.isEmpty ?? true) return;
|
||||||
List<StudentQuestions> data = [];
|
|
||||||
for (var e in studentQuestions!) {
|
for (var e in studentQuestions!) {
|
||||||
var newe = StudentQuestions.fromJson(e.toJson());
|
if (e.studentScore != null) {
|
||||||
newe.studentScore = null;
|
e.studentScore = null;
|
||||||
data.add(newe);
|
}
|
||||||
}
|
}
|
||||||
state.studentQuestions.value = data;
|
// state.studentQuestions.value = data;
|
||||||
state.data.value?.studentQuestions = data;
|
// state.data.value?.studentQuestions = data;
|
||||||
|
state.studentQuestions.update((_) {});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 全部统一打分
|
// 全部统一打分
|
||||||
void allRating(int score) {
|
void allRating(int score) {
|
||||||
var studentQuestions = state.studentQuestions.value;
|
var studentQuestions = state.studentQuestions.value;
|
||||||
if (state.data.value?.studentQuestions.isEmpty ?? true) return;
|
if (state.data.value?.studentQuestions.isEmpty ?? true) return;
|
||||||
List<StudentQuestions> data = [];
|
|
||||||
for (var e in studentQuestions!) {
|
for (var e in studentQuestions!) {
|
||||||
var newe = StudentQuestions.fromJson(e.toJson());
|
e.studentScore = score;
|
||||||
newe.studentScore = score;
|
|
||||||
data.add(newe);
|
|
||||||
}
|
}
|
||||||
state.studentQuestions.value = data;
|
// state.studentQuestions.value = data;
|
||||||
state.data.value?.studentQuestions = data;
|
// state.data.value?.studentQuestions = data;
|
||||||
|
state.studentQuestions.update((_) {});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 全对评分
|
// 全对评分
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue