打分BUG处理

This commit is contained in:
DESKTOP-I3JPKHK\wy 2025-04-22 18:01:28 +08:00
parent 6011f52a19
commit 08cf62a845
3 changed files with 45 additions and 29 deletions

View File

@ -38,7 +38,7 @@ class QuestionNumberView extends GetView<HomeworkReviewLogic> {
var studentQuestions = sateData.studentQuestions.value ?? [];
return $QuestionNumberScrollView(
controller:controller,
controller: controller,
sateData: sateData,
sateZoomData: sateZoomData,
studentQuestions: studentQuestions,
@ -141,27 +141,34 @@ Widget $questionNumberScrollView({
//
@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);
useValueChanged<int?, void>(studentScore.value, (_, __) {
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, (_, __) {
useValueChanged<int?, void>(item.studentScore, (_, __) {
studentScore.value = item.studentScore;
});
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);
return Container(
height: item.height! * scaleRatio * initScale,

View File

@ -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/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/toast_utils.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:zoom_widget/zoom_widget.dart';
@ -347,7 +348,17 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
sateData.data.value?.zgtAnnotate = null;
sateData.data.value?.showZgtAnnotate = 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);
});
}
},
),

View File

@ -173,7 +173,7 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
state.param.value.templateId ??= data.templateId;
state.param.value.studentId ??= data.studentId;
state.data.value = data;
} catch (e) {
print('获取数据报错了:$e');
@ -189,28 +189,26 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
void cancelAllRatings() {
var studentQuestions = state.studentQuestions.value;
if (state.data.value?.studentQuestions.isEmpty ?? true) return;
List<StudentQuestions> data = [];
for (var e in studentQuestions!) {
var newe = StudentQuestions.fromJson(e.toJson());
newe.studentScore = null;
data.add(newe);
if (e.studentScore != null) {
e.studentScore = null;
}
}
state.studentQuestions.value = data;
state.data.value?.studentQuestions = data;
// state.studentQuestions.value = data;
// state.data.value?.studentQuestions = data;
state.studentQuestions.update((_) {});
}
//
void allRating(int score) {
var studentQuestions = state.studentQuestions.value;
if (state.data.value?.studentQuestions.isEmpty ?? true) return;
List<StudentQuestions> data = [];
for (var e in studentQuestions!) {
var newe = StudentQuestions.fromJson(e.toJson());
newe.studentScore = score;
data.add(newe);
e.studentScore = score;
}
state.studentQuestions.value = data;
state.data.value?.studentQuestions = data;
// state.studentQuestions.value = data;
// state.data.value?.studentQuestions = data;
state.studentQuestions.update((_) {});
}
//