From 15158ccfa543eb32fbcaf22627a697702016d882 Mon Sep 17 00:00:00 2001 From: William Jordan-Cooley Date: Thu, 11 Jan 2024 15:59:54 -0500 Subject: [PATCH 1/2] gpt it implemented :) --- .../controllers/it_controller.dart | 28 ++++++++++--------- lib/pangea/config/environment.dart | 4 +-- lib/pangea/models/class_analytics_model.dart | 2 +- .../custom_input_translation_model.dart | 16 +++++++++++ 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/lib/pangea/choreographer/controllers/it_controller.dart b/lib/pangea/choreographer/controllers/it_controller.dart index da6a9b2a3..5f7c5fc8e 100644 --- a/lib/pangea/choreographer/controllers/it_controller.dart +++ b/lib/pangea/choreographer/controllers/it_controller.dart @@ -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, ), ); } diff --git a/lib/pangea/config/environment.dart b/lib/pangea/config/environment.dart index e55f66423..209811621 100644 --- a/lib/pangea/config/environment.dart +++ b/lib/pangea/config/environment.dart @@ -27,8 +27,8 @@ class Environment { } static String get choreoApi { - // return "http://localhost:8000/choreo"; - return dotenv.env['CHOREO_API'] ?? 'Not found'; + return "http://localhost:8000/choreo"; + // return dotenv.env['CHOREO_API'] ?? 'Not found'; } static String get choreoApiKey { diff --git a/lib/pangea/models/class_analytics_model.dart b/lib/pangea/models/class_analytics_model.dart index 3e37ee4d1..ba7f642ce 100644 --- a/lib/pangea/models/class_analytics_model.dart +++ b/lib/pangea/models/class_analytics_model.dart @@ -64,7 +64,7 @@ class Section { final data = {}; 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; } } diff --git a/lib/pangea/models/custom_input_translation_model.dart b/lib/pangea/models/custom_input_translation_model.dart index 7d2989d73..37d6c7a88 100644 --- a/lib/pangea/models/custom_input_translation_model.dart +++ b/lib/pangea/models/custom_input_translation_model.dart @@ -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? 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, }; } From 7e042f127f3be39c7826b0286f28dcc7e5e881fc Mon Sep 17 00:00:00 2001 From: William Jordan-Cooley Date: Thu, 11 Jan 2024 17:07:16 -0500 Subject: [PATCH 2/2] switching back to staging choreo --- lib/pangea/config/environment.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pangea/config/environment.dart b/lib/pangea/config/environment.dart index 209811621..e55f66423 100644 --- a/lib/pangea/config/environment.dart +++ b/lib/pangea/config/environment.dart @@ -27,8 +27,8 @@ class Environment { } static String get choreoApi { - return "http://localhost:8000/choreo"; - // return dotenv.env['CHOREO_API'] ?? 'Not found'; + // return "http://localhost:8000/choreo"; + return dotenv.env['CHOREO_API'] ?? 'Not found'; } static String get choreoApiKey {