if totalXP calculation is negative, reset to 0 (#1107)
This commit is contained in:
parent
b3ed80215a
commit
7ff4efadbc
2 changed files with 13 additions and 5 deletions
|
|
@ -139,13 +139,17 @@ class ConstructListModel {
|
|||
(total, construct) => total + construct.points,
|
||||
);
|
||||
|
||||
if (totalXP < 0) {
|
||||
totalXP = 0;
|
||||
}
|
||||
|
||||
// Don't call .floor() if NaN or Infinity
|
||||
// https://pangea-chat.sentry.io/issues/6052871310
|
||||
final double levelCalculation = 1 + sqrt((1 + 8 * totalXP / 100) / 2);
|
||||
if (!levelCalculation.isNaN && levelCalculation.isFinite) {
|
||||
level = levelCalculation.floor();
|
||||
} else {
|
||||
level = 0;
|
||||
level = 1;
|
||||
Sentry.addBreadcrumb(
|
||||
Breadcrumb(
|
||||
data: {
|
||||
|
|
|
|||
|
|
@ -172,8 +172,10 @@ class MessageTranslationCardState extends State<MessageTranslationCard> {
|
|||
const Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InlineTooltip(
|
||||
instructionsEnum: InstructionsEnum.l1Translation,
|
||||
Expanded(
|
||||
child: InlineTooltip(
|
||||
instructionsEnum: InstructionsEnum.l1Translation,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
@ -182,8 +184,10 @@ class MessageTranslationCardState extends State<MessageTranslationCard> {
|
|||
const Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InlineTooltip(
|
||||
instructionsEnum: InstructionsEnum.clickAgainToDeselect,
|
||||
Expanded(
|
||||
child: InlineTooltip(
|
||||
instructionsEnum: InstructionsEnum.clickAgainToDeselect,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue