mcy_new #1
|
|
@ -117,13 +117,36 @@ class Utils {
|
||||||
|
|
||||||
for (var stu in data.students) {
|
for (var stu in data.students) {
|
||||||
stu.kgtStu = kgt.where((w) => w.studentId == stu.studentId).toList();
|
stu.kgtStu = kgt.where((w) => w.studentId == stu.studentId).toList();
|
||||||
stu.kgtStu!.sort((a, b) => num.parse(a.questionNo).compareTo(num.parse(b.questionNo)));
|
// stu.kgtStu!.sort((a, b) => num.parse(a.questionNo).compareTo(num.parse(b.questionNo)));
|
||||||
|
// stu.kgtStu!.sort((a, b) => num.parse(a.questionNo).compareTo(num.parse(b.questionNo)));
|
||||||
|
stu.kgtStu!.sort((a, b) {
|
||||||
|
try {
|
||||||
|
if (RegExp(r'^\d*\.?\d+$').hasMatch(a.questionNo) && RegExp(r'^\d*\.?\d+$').hasMatch(b.questionNo)) {
|
||||||
|
return num.parse(a.questionNo).compareTo(num.parse(b.questionNo));
|
||||||
|
} else {
|
||||||
|
throw Exception();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
return a.questionNo.toLowerCase().compareTo(b.questionNo.toLowerCase());
|
||||||
|
}
|
||||||
|
});
|
||||||
stu.kgtOkCount = stu.kgtStu!.where((w) => w.state == 3).length;
|
stu.kgtOkCount = stu.kgtStu!.where((w) => w.state == 3).length;
|
||||||
stu.kgtErrorCount = stu.kgtStu!.where((w) => w.state == 2).length;
|
stu.kgtErrorCount = stu.kgtStu!.where((w) => w.state == 2).length;
|
||||||
stu.kgtAnswerCount = stu.kgtStu!.where((w) => w.state != 0).length;
|
stu.kgtAnswerCount = stu.kgtStu!.where((w) => w.state != 0).length;
|
||||||
|
|
||||||
stu.zgtStu = zgt.where((w) => w.studentId == stu.studentId).toList();
|
stu.zgtStu = zgt.where((w) => w.studentId == stu.studentId).toList();
|
||||||
stu.zgtStu!.sort((a, b) => num.parse(a.questionNo).compareTo(num.parse(b.questionNo)));
|
// stu.zgtStu!.sort((a, b) => num.parse(a.questionNo).compareTo(num.parse(b.questionNo)));
|
||||||
|
stu.zgtStu!.sort((a, b) {
|
||||||
|
try {
|
||||||
|
if (RegExp(r'^\d*\.?\d+$').hasMatch(a.questionNo) && RegExp(r'^\d*\.?\d+$').hasMatch(b.questionNo)) {
|
||||||
|
return num.parse(a.questionNo).compareTo(num.parse(b.questionNo));
|
||||||
|
} else {
|
||||||
|
throw Exception();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
return a.questionNo.toLowerCase().compareTo(b.questionNo.toLowerCase());
|
||||||
|
}
|
||||||
|
});
|
||||||
//正确
|
//正确
|
||||||
stu.zgtOkCount = stu.zgtStu!.where((w) => w.state == 3).length;
|
stu.zgtOkCount = stu.zgtStu!.where((w) => w.state == 3).length;
|
||||||
//错误
|
//错误
|
||||||
|
|
@ -167,21 +190,20 @@ class Utils {
|
||||||
|
|
||||||
var stuDtls = data.dtls.where((w) => w.studentId == stu.studentId);
|
var stuDtls = data.dtls.where((w) => w.studentId == stu.studentId);
|
||||||
var secList = [];
|
var secList = [];
|
||||||
for(var sec in stuDtls){
|
for (var sec in stuDtls) {
|
||||||
if(sec.useTime >= 1){
|
if (sec.useTime >= 1) {
|
||||||
var date = DateTime.parse(sec.lastAnswerTime!);
|
var date = DateTime.parse(sec.lastAnswerTime!);
|
||||||
var lastSec =(date.difference(DateTime(1970)).inSeconds).floor();
|
var lastSec = (date.difference(DateTime(1970)).inSeconds).floor();
|
||||||
|
|
||||||
secList.add(lastSec);
|
secList.add(lastSec);
|
||||||
secList.add(lastSec - sec.useTime);
|
secList.add(lastSec - sec.useTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
secList.sort();
|
secList.sort();
|
||||||
var maxSec = secList.isNotEmpty?secList.last:0;
|
var maxSec = secList.isNotEmpty ? secList.last : 0;
|
||||||
var minSec = secList.isNotEmpty?secList.first:0;
|
var minSec = secList.isNotEmpty ? secList.first : 0;
|
||||||
var secTime = secList.isNotEmpty?maxSec-minSec:0;
|
var secTime = secList.isNotEmpty ? maxSec - minSec : 0;
|
||||||
stu.ttlSec = second2HMS(secTime);
|
stu.ttlSec = second2HMS(secTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data.students.sort((a, b) {
|
data.students.sort((a, b) {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,8 @@ class KnowledgePoint extends StatefulWidget {
|
||||||
final String className;
|
final String className;
|
||||||
final String homeworkId;
|
final String homeworkId;
|
||||||
final int subject;
|
final int subject;
|
||||||
KnowledgePoint({Key? key, required this.knowsList, required this.data, required this.className, required this.homeworkId,required this.subject}) : super(key: key);
|
const KnowledgePoint(
|
||||||
|
{super.key, required this.knowsList, required this.data, required this.className, required this.homeworkId, required this.subject});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<KnowledgePoint> createState() => _KnowledgePointState();
|
State<KnowledgePoint> createState() => _KnowledgePointState();
|
||||||
|
|
@ -23,7 +24,7 @@ class KnowledgePoint extends StatefulWidget {
|
||||||
class _KnowledgePointState extends State<KnowledgePoint> {
|
class _KnowledgePointState extends State<KnowledgePoint> {
|
||||||
void goQuickCheckPersonalPath(studentId) {
|
void goQuickCheckPersonalPath(studentId) {
|
||||||
if (studentId != null) {
|
if (studentId != null) {
|
||||||
Get.toNamed(Routes.studentPersonalPage, arguments: {'studentId': studentId, 'homeworkId': widget.homeworkId,'subject':widget.subject});
|
Get.toNamed(Routes.studentPersonalPage, arguments: {'studentId': studentId, 'homeworkId': widget.homeworkId, 'subject': widget.subject});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -208,89 +209,92 @@ class _KnowledgePointState extends State<KnowledgePoint> {
|
||||||
child: quickText('知识点掌握情况', color: const Color.fromRGBO(92, 92, 92, 1), size: 14.sp, fontWeight: FontWeight.bold),
|
child: quickText('知识点掌握情况', color: const Color.fromRGBO(92, 92, 92, 1), size: 14.sp, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: widget.knowsList.isNotEmpty? ListView(
|
child: widget.knowsList.isNotEmpty
|
||||||
children: widget.knowsList.value.map((item) {
|
? ListView(
|
||||||
return Container(
|
children: widget.knowsList.value.map((item) {
|
||||||
margin: EdgeInsets.only(bottom: 15.h, left: 15.r, right: 15.r),
|
return Container(
|
||||||
child: Column(
|
margin: EdgeInsets.only(bottom: 15.h, left: 15.r, right: 15.r),
|
||||||
mainAxisSize: MainAxisSize.min,
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
Row(
|
children: [
|
||||||
children: [
|
Row(
|
||||||
Expanded(
|
children: [
|
||||||
flex: 10,
|
Expanded(
|
||||||
child: Row(
|
flex: 10,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
quickText(item.knowledgeName, size: 12.sp, color: const Color.fromRGBO(152, 152, 152, 1)),
|
||||||
|
quickText('${item.okRate!.toStringAsFixed(0)}%', size: 12.sp, color: const Color.fromRGBO(64, 64, 64, 1)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 10.w),
|
||||||
|
const Expanded(flex: 1, child: SizedBox()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 3.h),
|
||||||
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
quickText(item.knowledgeName, size: 12.sp, color: const Color.fromRGBO(152, 152, 152, 1)),
|
Expanded(
|
||||||
quickText('${item.okRate!.toStringAsFixed(0)}%', size: 12.sp, color: const Color.fromRGBO(64, 64, 64, 1)),
|
flex: 10,
|
||||||
],
|
child: LinearPercentIndicator(
|
||||||
),
|
padding: EdgeInsets.zero,
|
||||||
),
|
animation: true,
|
||||||
SizedBox(width: 10.w),
|
lineHeight: 10.h,
|
||||||
const Expanded(flex: 1, child: SizedBox()),
|
animationDuration: 2500,
|
||||||
],
|
percent: item.okRate! / 100,
|
||||||
),
|
progressColor: Theme.of(context).primaryColor,
|
||||||
SizedBox(height: 3.h),
|
backgroundColor: const Color.fromRGBO(219, 224, 243, 1),
|
||||||
Row(
|
barRadius: Radius.circular(10.r),
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
)),
|
||||||
children: [
|
SizedBox(width: 10.w),
|
||||||
Expanded(
|
InkWell(
|
||||||
flex: 10,
|
onTap: () {
|
||||||
child: LinearPercentIndicator(
|
List<Questions> ques = widget.data.questions
|
||||||
padding: EdgeInsets.zero,
|
.where((w) => w.knows.indexWhere((k) => k.knowledgeId == item.knowledgeId) > -1)
|
||||||
animation: true,
|
.toList();
|
||||||
lineHeight: 10.h,
|
List<Students> array2 = [...widget.data.students];
|
||||||
animationDuration: 2500,
|
for (var stu in array2) {
|
||||||
percent: item.okRate! / 100,
|
stu.queDtls = widget.data.dtls
|
||||||
progressColor: Theme.of(context).primaryColor,
|
.where((w) =>
|
||||||
backgroundColor: const Color.fromRGBO(219, 224, 243, 1),
|
w.studentId == stu.studentId &&
|
||||||
barRadius: Radius.circular(10.r),
|
ques.indexWhere((q) => w.templateId == q.templateId && w.questionNo == q.questionNo) > -1)
|
||||||
)),
|
.toList();
|
||||||
SizedBox(width: 10.w),
|
int okCount = stu.queDtls!.where((w) => w.state == 3).length;
|
||||||
InkWell(
|
int ttlCount = stu.queDtls!.length;
|
||||||
onTap: () {
|
stu.okRate = Utils.calcRate(okCount, ttlCount);
|
||||||
List<Questions> ques =
|
stu.queDtls!.sort((a, b) {
|
||||||
widget.data.questions.where((w) => w.knows.indexWhere((k) => k.knowledgeId == item.knowledgeId) > -1).toList();
|
num num1 = num.parse(a.questionNo);
|
||||||
List<Students> array2 = [...widget.data.students];
|
num num2 = num.parse(b.questionNo);
|
||||||
for (var stu in array2) {
|
return num1.compareTo(num2);
|
||||||
stu.queDtls = widget.data.dtls
|
});
|
||||||
.where((w) =>
|
}
|
||||||
w.studentId == stu.studentId &&
|
|
||||||
ques.indexWhere((q) => w.templateId == q.templateId && w.questionNo == q.questionNo) > -1)
|
|
||||||
.toList();
|
|
||||||
int okCount = stu.queDtls!.where((w) => w.state == 3).length;
|
|
||||||
int ttlCount = stu.queDtls!.length;
|
|
||||||
stu.okRate = Utils.calcRate(okCount, ttlCount);
|
|
||||||
stu.queDtls!.sort((a, b) {
|
|
||||||
num num1 = num.parse(a.questionNo);
|
|
||||||
num num2 = num.parse(b.questionNo);
|
|
||||||
return num1.compareTo(num2);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
showPeopleListDialog(
|
showPeopleListDialog(
|
||||||
context: context,
|
context: context,
|
||||||
title: item.knowledgeName,
|
title: item.knowledgeName,
|
||||||
arr: array2,
|
arr: array2,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
quickText('查看', size: 12.sp, color: const Color.fromRGBO(239, 135, 20, 1)),
|
quickText('查看', size: 12.sp, color: const Color.fromRGBO(239, 135, 20, 1)),
|
||||||
Icon(Icons.arrow_forward_ios, size: 11.sp, color: const Color.fromRGBO(239, 135, 20, 1)),
|
Icon(Icons.arrow_forward_ios, size: 11.sp, color: const Color.fromRGBO(239, 135, 20, 1)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
)
|
);
|
||||||
],
|
}).toList())
|
||||||
),
|
: MyEmptyWidget(imgWidth: 100.r, imgHeight: 100.r, font: 8.sp),
|
||||||
);
|
|
||||||
}).toList()): MyEmptyWidget(imgWidth: 100.r, imgHeight: 100.r, font: 8.sp),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue