getHandUpList method

Future<void> getHandUpList()

Implementation

Future<void> getHandUpList() async {
  if (getRole() == RoleEnum.student || getRole() == RoleEnum.supervisor) {
    TCICLog.info(
      "学生或督导角色不能获取举手列表",
      actionModule: ActionModule.tcicController.name,
      actionName: ActionName.getHandUpList.name,
    );
    return;
  }
  var body = GetHandUpListBody(classId: _config.classId, page: 1, limit: 10);
  var data = await networkService.getHandUpList(body);
  if (data != null) {
    if (data.errorCode == 0 && data.members.isNotEmpty) {
      final handUpList = <UserHandUpInfo>[];
      for (var element in data.members) {
        handUpList.add(
          UserHandUpInfo(
            userId: element.userId,
            userName: element.userName,
            handUpTimes: element.handUpTimes,
            handUpTimestamp: element.handUpTimestamp,
          ),
        );
      }
      TCICLog.info(
        "getHandUpList: ${handUpList.map((e) => e.userId)}",
        actionModule: ActionModule.tcicController.name,
        actionName: ActionName.getHandUpList.name,
      );
      _handsUpInfoObs.updateHandUpList(handUpList, "getHandUpList");
    }
  }
}