Skip to content

Commit

Permalink
feat: regex pattern set for Score (for override only) field
Browse files Browse the repository at this point in the history
  • Loading branch information
MAAngamarca committed Mar 12, 2024
1 parent 45d5fa7 commit 1930cc6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lms/static/js/staff_debug_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ var StaffDebug = (function() {
return string.replace(/[.*+?^:${}()|[\]\\]/g, '\\$&');
};

var sanitizeScore = function(string){
return string.replace(/[^0-9.]/g, '');
};

var getUser = function(locationName) {
var sanitizedLocationName = sanitizeString(locationName);
var uname = $('#sd_fu_' + sanitizedLocationName).val();
Expand All @@ -24,6 +28,7 @@ var StaffDebug = (function() {
if (score === '') {
score = $('#sd_fs_' + sanitizedLocationName).attr('placeholder');
}
score = sanitizeScore(score)
return score;
};

Expand Down
2 changes: 1 addition & 1 deletion lms/templates/staff_problem_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ <h3>${_('Actions')}</h3>
% if can_override_problem_score:
<div>
<label for="sd_fs_${location.block_id}">${_('Score (for override only)')}:</label>
<input type="text" tabindex="0" id="sd_fs_${location.block_id}" placeholder="0"/>
<input type="number" tabindex="0" id="sd_fs_${location.block_id}" placeholder="0"/>
<label for="sd_fs_${location.block_id}"> / ${max_problem_score}</label>
</div>
% endif
Expand Down

0 comments on commit 1930cc6

Please sign in to comment.