commit
46df9e5381
3 changed files with 32 additions and 14 deletions
|
|
@ -1,16 +1,15 @@
|
|||
import 'dart:async';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
import 'package:fluffychat/pangea/choreographer/controllers/error_service.dart';
|
||||
import 'package:fluffychat/pangea/constants/choreo_constants.dart';
|
||||
import 'package:fluffychat/pangea/repo/full_text_translation_repo.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
import '../../models/custom_input_translation_model.dart';
|
||||
import '../../models/it_response_model.dart';
|
||||
import '../../models/it_step.dart';
|
||||
|
|
@ -135,13 +134,14 @@ class ITController {
|
|||
|
||||
currentITStep = null;
|
||||
|
||||
final ITResponseModel res = await (useCustomInput ||
|
||||
currentText.isEmpty ||
|
||||
translationId == null ||
|
||||
completedITSteps.last.chosenContinuance?.indexSavedByServer ==
|
||||
null
|
||||
? _customInputTranslation(currentText)
|
||||
: _systemChoiceTranslation(translationId));
|
||||
final ITResponseModel res = await _customInputTranslation(currentText);
|
||||
// final ITResponseModel res = await (useCustomInput ||
|
||||
// currentText.isEmpty ||
|
||||
// translationId == null ||
|
||||
// completedITSteps.last.chosenContinuance?.indexSavedByServer ==
|
||||
// null
|
||||
// ? _customInputTranslation(currentText)
|
||||
// : _systemChoiceTranslation(translationId));
|
||||
|
||||
if (res.goldContinuances != null && res.goldContinuances!.isNotEmpty) {
|
||||
goldRouteTracker = GoldRouteTracker(
|
||||
|
|
@ -227,6 +227,8 @@ class ITController {
|
|||
userId: choreographer.userId!,
|
||||
roomId: choreographer.roomId!,
|
||||
classId: choreographer.classId,
|
||||
goldTranslation: goldRouteTracker.fullTranslation,
|
||||
goldContinuances: goldRouteTracker.continuances,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class Section {
|
|||
final data = <String, dynamic>{};
|
||||
data['title'] = title;
|
||||
data['class_total'] = classTotal;
|
||||
data['data'] = data.map((e) => e.toJson()).toList();
|
||||
(data['data'] as List).map((item) => Data.fromJson(item)).toList();
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:fluffychat/pangea/constants/model_keys.dart';
|
||||
import 'package:fluffychat/pangea/models/it_response_model.dart';
|
||||
|
||||
class CustomInputRequestModel {
|
||||
String text;
|
||||
|
|
@ -9,6 +10,9 @@ class CustomInputRequestModel {
|
|||
String roomId;
|
||||
String? classId;
|
||||
|
||||
String? goldTranslation;
|
||||
List<Continuance>? goldContinuances;
|
||||
|
||||
CustomInputRequestModel({
|
||||
required this.text,
|
||||
required this.customInput,
|
||||
|
|
@ -17,6 +21,8 @@ class CustomInputRequestModel {
|
|||
required this.userId,
|
||||
required this.roomId,
|
||||
required this.classId,
|
||||
required this.goldTranslation,
|
||||
required this.goldContinuances,
|
||||
});
|
||||
|
||||
factory CustomInputRequestModel.fromJson(json) => CustomInputRequestModel(
|
||||
|
|
@ -27,6 +33,12 @@ class CustomInputRequestModel {
|
|||
userId: json['user_id'],
|
||||
roomId: json['room_id'],
|
||||
classId: json['class_id'],
|
||||
goldTranslation: json['gold_translation'],
|
||||
goldContinuances: json['gold_continuances'] != null
|
||||
? List.from(json['gold_continuances'])
|
||||
.map((e) => Continuance.fromJson(e))
|
||||
.toList()
|
||||
: null,
|
||||
);
|
||||
|
||||
toJson() => {
|
||||
|
|
@ -37,5 +49,9 @@ class CustomInputRequestModel {
|
|||
'user_id': userId,
|
||||
'room_id': roomId,
|
||||
'class_id': classId,
|
||||
'gold_translation': goldTranslation,
|
||||
'gold_continuances': goldContinuances != null
|
||||
? List.from(goldContinuances!.map((e) => e.toJson()))
|
||||
: null,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue