From f4426f2e4358d3521f8bf89e2cb4532debdff5c2 Mon Sep 17 00:00:00 2001 From: Matt Lott Date: Fri, 24 Oct 2014 14:05:51 -0700 Subject: [PATCH] Save user code errors without 'Line N: ' prefix --- app/schemas/models/user_code_problem.coffee | 1 + app/views/play/level/tome/SpellView.coffee | 8 +++++++- .../user_code_problems/user_code_problem_handler.coffee | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/schemas/models/user_code_problem.coffee b/app/schemas/models/user_code_problem.coffee index 12273de02..01546ea8a 100644 --- a/app/schemas/models/user_code_problem.coffee +++ b/app/schemas/models/user_code_problem.coffee @@ -15,6 +15,7 @@ _.extend UserCodeProblemSchema.properties, errId: {type: 'string'} errLevel: {type: 'string'} errMessage: {type: 'string'} + errMessageNoLineInfo: {type: 'string'} errRange: {type: 'array'} errType: {type: 'string'} language: {type: 'string'} diff --git a/app/views/play/level/tome/SpellView.coffee b/app/views/play/level/tome/SpellView.coffee index 59787a867..f1dd39be6 100644 --- a/app/views/play/level/tome/SpellView.coffee +++ b/app/views/play/level/tome/SpellView.coffee @@ -539,7 +539,13 @@ module.exports = class SpellView extends CocoView @userCodeProblem.set 'errHint', aetherProblem.hint if aetherProblem.hint @userCodeProblem.set 'errId', aetherProblem.id if aetherProblem.id @userCodeProblem.set 'errLevel', aetherProblem.level if aetherProblem.level - @userCodeProblem.set 'errMessage', aetherProblem.message if aetherProblem.message + if aetherProblem.message + @userCodeProblem.set 'errMessage', aetherProblem.message + # Save error message without 'Line N: ' prefix + messageNoLineInfo = aetherProblem.message + if lineInfoMatch = messageNoLineInfo.match /^Line [0-9]+\: / + messageNoLineInfo = messageNoLineInfo.slice(lineInfoMatch[0].length) + @userCodeProblem.set 'errMessageNoLineInfo', messageNoLineInfo @userCodeProblem.set 'errRange', aetherProblem.range if aetherProblem.range @userCodeProblem.set 'errType', aetherProblem.type if aetherProblem.type @userCodeProblem.set 'language', aether.language.id if aether.language?.id diff --git a/server/user_code_problems/user_code_problem_handler.coffee b/server/user_code_problems/user_code_problem_handler.coffee index dbd99aa79..a4424b6f9 100644 --- a/server/user_code_problems/user_code_problem_handler.coffee +++ b/server/user_code_problems/user_code_problem_handler.coffee @@ -11,6 +11,7 @@ class UserCodeProblemHandler extends Handler 'errId' 'errLevel' 'errMessage' + 'errMessageNoLineInfo' 'errRange' 'errType' 'language'