call async version of teachers in inviteSpaceTeachersToAnalyticsRoom … (#1082)
* call async version of teachers in inviteSpaceTeachersToAnalyticsRoom to ensure teachers aren't double invited to analytics rooms * log breadcrumb on error getting message offset * better error logging for activity fromJSON method
This commit is contained in:
parent
a7009e7b36
commit
ff0ab7e00b
4 changed files with 25 additions and 10 deletions
|
|
@ -100,7 +100,7 @@ extension AnalyticsRoomExtension on Room {
|
|||
}
|
||||
|
||||
final List<User> participants = analyticsRoom.getParticipants();
|
||||
final List<User> uninvitedTeachers = teachersLocal
|
||||
final List<User> uninvitedTeachers = (await teachers)
|
||||
.where((teacher) => !participants.contains(teacher))
|
||||
.toList();
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:fluffychat/pangea/models/analytics/construct_use_model.dart';
|
|||
import 'package:fluffychat/pangea/models/analytics/constructs_model.dart';
|
||||
import 'package:fluffychat/pangea/models/practice_activities.dart/practice_activity_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
/// A wrapper around a list of [OneConstructUse]s, used to simplify
|
||||
/// the process of filtering / sorting / displaying the events.
|
||||
|
|
@ -145,14 +146,16 @@ class ConstructListModel {
|
|||
level = levelCalculation.floor();
|
||||
} else {
|
||||
level = 0;
|
||||
ErrorHandler.logError(
|
||||
e: "Calculated level in Nan or Infinity",
|
||||
data: {
|
||||
"totalXP": totalXP,
|
||||
"prevXP": prevXP,
|
||||
"level": levelCalculation,
|
||||
},
|
||||
Sentry.addBreadcrumb(
|
||||
Breadcrumb(
|
||||
data: {
|
||||
"totalXP": totalXP,
|
||||
"prevXP": prevXP,
|
||||
"level": levelCalculation,
|
||||
},
|
||||
),
|
||||
);
|
||||
ErrorHandler.logError(e: "Calculated level in Nan or Infinity");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import 'package:collection/collection.dart';
|
|||
import 'package:fluffychat/pangea/enum/activity_type_enum.dart';
|
||||
import 'package:fluffychat/pangea/models/pangea_token_model.dart';
|
||||
import 'package:fluffychat/pangea/models/practice_activities.dart/practice_activity_model.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
// includes feedback text and the bad activity model
|
||||
class ActivityQualityFeedback {
|
||||
|
|
@ -118,6 +119,16 @@ class MessageActivityResponse {
|
|||
});
|
||||
|
||||
factory MessageActivityResponse.fromJson(Map<String, dynamic> json) {
|
||||
if (!json.containsKey('activity')) {
|
||||
Sentry.addBreadcrumb(Breadcrumb(data: {"json": json}));
|
||||
throw Exception('Activity not found in message activity response');
|
||||
}
|
||||
|
||||
if (json['activity'] is! Map<String, dynamic>) {
|
||||
Sentry.addBreadcrumb(Breadcrumb(data: {"json": json}));
|
||||
throw Exception('Activity is not a map in message activity response');
|
||||
}
|
||||
|
||||
return MessageActivityResponse(
|
||||
activity: PracticeActivityModel.fromJson(
|
||||
json['activity'] as Map<String, dynamic>,
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
class MessageSelectionOverlay extends StatefulWidget {
|
||||
final ChatController chatController;
|
||||
|
|
@ -485,8 +486,8 @@ class MessageOverlayController extends State<MessageSelectionOverlay>
|
|||
|
||||
try {
|
||||
return _messageRenderBox?.localToGlobal(Offset.zero);
|
||||
} catch (e, s) {
|
||||
ErrorHandler.logError(e: "Error getting message offset: $e", s: s);
|
||||
} catch (e) {
|
||||
Sentry.addBreadcrumb(Breadcrumb(message: "Error getting message offset"));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue