Skip to content

Commit

Permalink
Merge pull request #63 from EmpowrOrg/make-starter-code-nonnull
Browse files Browse the repository at this point in the history
Make starter code nonnull
  • Loading branch information
dri94 authored Nov 13, 2022
2 parents 13bbebd + fc705b1 commit 95d5b86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions swiftplugin/swiftplugin/static/js/src/swiftplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,17 @@ function SwiftPluginXBlock(runtime, element) {

function updateValues(response) {
$(`#select-lang-btn`).text(response.display_language);
if(!response?.allowed_languages?.length) $(`#select-lang-btn`).addClass("disabled");
if (!response?.allowed_languages?.length) $(`#select-lang-btn`).addClass("disabled");
$.each(response.allowed_languages, function (key, value) {
$(`#ul-1`).append($('<li>', {
class: "dropdown-item",
value: value[1],
text: value[1],
'data-mark': key,
'click': function() {
'click': function () {
$(`#select-lang-btn`).text(value[1])
myCodeMirror.setOption("mode", value[2])
}
}
}))
})
}
Expand Down
5 changes: 4 additions & 1 deletion swiftplugin/swiftplugin/swiftplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ def get_problem_info(self, data, suffix=''):
return response
assignment_code = self.get_starter_code(assignment_codes=response['assignmentCodes'])
solution_code = assignment_code["solutionCode"]
starter_code = assignment_code['starterCode']
if starter_code is None:
starter_code = ""
return {
'reference_id': self.reference_id,
'problem_description': response['instructions'],
Expand All @@ -188,7 +191,7 @@ def get_problem_info(self, data, suffix=''):
'show_submit_button': True,
'display_language': assignment_code['displayName'],
'allowed_languages': self.get_allowed_languages(response['assignmentCodes']),
'starter_code': assignment_code['starterCode'],
'starter_code': starter_code,
}

def is_blank(self, my_string):
Expand Down

0 comments on commit 95d5b86

Please sign in to comment.