mumuki-laboratory 5.8.3 → 5.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/application/submission.js +25 -4
- data/app/controllers/application_controller.rb +4 -1
- data/app/controllers/concerns/organizations_controller_template.rb +3 -2
- data/app/controllers/exercise_solutions_controller.rb +1 -1
- data/app/controllers/exercises_controller.rb +3 -7
- data/app/controllers/login_controller.rb +6 -0
- data/app/helpers/contextualization_result_helper.rb +1 -1
- data/app/helpers/exercise_input_helper.rb +20 -5
- data/app/helpers/messages_helper.rb +4 -4
- data/app/helpers/organization_list_helper.rb +4 -0
- data/app/models/assignment.rb +50 -7
- data/app/models/concerns/contextualization.rb +3 -3
- data/app/models/concerns/guide_container.rb +15 -0
- data/app/models/concerns/submittable/submittable.rb +1 -1
- data/app/models/concerns/with_assignments.rb +10 -41
- data/app/models/concerns/with_discussions.rb +1 -1
- data/app/models/discussion.rb +7 -1
- data/app/models/exam.rb +14 -0
- data/app/models/exercise.rb +17 -1
- data/app/models/exercise/challenge.rb +1 -5
- data/app/models/guide.rb +1 -1
- data/app/models/language.rb +25 -8
- data/app/models/submission/submission.rb +1 -1
- data/app/views/discussions/_message.html.erb +1 -1
- data/app/views/exercise_solutions/_out_of_attempts.html.erb +6 -0
- data/app/views/exercise_solutions/_results.html.erb +3 -3
- data/app/views/exercises/_read_only.html.erb +1 -1
- data/app/views/layouts/_kids.html.erb +1 -1
- data/app/views/layouts/_organizations_listing.html.erb +1 -1
- data/app/views/layouts/exercise_inputs/forms/_interactive_form.html.erb +6 -6
- data/app/views/layouts/exercise_inputs/forms/_kids_form.html.erb +1 -1
- data/app/views/layouts/exercise_inputs/forms/_playground_form.html.erb +1 -1
- data/app/views/layouts/exercise_inputs/forms/_problem_form.html.erb +5 -5
- data/app/views/layouts/exercise_inputs/read_only_editors/_text.erb +3 -0
- data/app/views/layouts/modals/_kids_results.html.erb +1 -1
- data/db/migrate/20180725145801_add_submissions_caps_to_exams.rb +6 -0
- data/lib/mumuki/laboratory/controllers/results_rendering.rb +7 -5
- data/lib/mumuki/laboratory/locales/en.yml +4 -0
- data/lib/mumuki/laboratory/locales/es.yml +5 -0
- data/lib/mumuki/laboratory/locales/pt.yml +4 -0
- data/lib/mumuki/laboratory/mumukit/directives.rb +1 -0
- data/lib/mumuki/laboratory/status.rb +4 -0
- data/lib/mumuki/laboratory/status/discussion/discussion.rb +2 -14
- data/lib/mumuki/laboratory/status/submission/aborted.rb +4 -4
- data/lib/mumuki/laboratory/status/submission/errored.rb +4 -0
- data/lib/mumuki/laboratory/status/submission/failed.rb +4 -0
- data/lib/mumuki/laboratory/status/submission/manual_evaluation_pending.rb +1 -1
- data/lib/mumuki/laboratory/status/submission/passed.rb +0 -4
- data/lib/mumuki/laboratory/status/submission/passed_with_warnings.rb +5 -1
- data/lib/mumuki/laboratory/status/submission/pending.rb +4 -0
- data/lib/mumuki/laboratory/status/submission/running.rb +4 -0
- data/lib/mumuki/laboratory/status/submission/submission.rb +7 -17
- data/lib/mumuki/laboratory/version.rb +1 -1
- data/spec/controllers/discussions_controller_spec.rb +7 -0
- data/spec/controllers/exercise_solutions_controller_spec.rb +6 -1
- data/spec/controllers/messages_controller_spec.rb +7 -0
- data/spec/dummy/db/schema.rb +2 -0
- data/spec/factories/exam_factory.rb +1 -2
- data/spec/features/progressive_tips_spec.rb +4 -4
- data/spec/helpers/organization_list_helper_spec.rb +20 -0
- data/spec/models/assignment_spec.rb +2 -0
- data/spec/models/event_generation_spec.rb +6 -6
- data/spec/models/exercise_spec.rb +39 -32
- data/spec/models/guide_spec.rb +2 -2
- data/spec/models/interactive_spec.rb +1 -1
- data/spec/models/query_spec.rb +1 -2
- data/spec/models/question_spec.rb +1 -3
- data/spec/models/solution_spec.rb +33 -2
- data/spec/spec_helper.rb +1 -0
- data/vendor/assets/javascripts/codemirror-modes/php.js +236 -0
- metadata +14 -8
data/spec/models/guide_spec.rb
CHANGED
@@ -16,11 +16,11 @@ describe Guide, organization_workspace: :test do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'destroys the guides assignments for the given user' do
|
19
|
-
expect(an_exercise.
|
19
|
+
expect(an_exercise.find_assignment_for(extra_user)).to be_nil
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'does not destroy other guides assignments' do
|
23
|
-
expect(another_exercise.
|
23
|
+
expect(another_exercise.find_assignment_for(extra_user)).to be_truthy
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Interactive, organization_workspace: :test do
|
4
4
|
let!(:interactive) { create(:interactive) }
|
5
5
|
let!(:user) { create(:user) }
|
6
|
-
let(:assignment) { interactive.
|
6
|
+
let(:assignment) { interactive.assignment_for(user) }
|
7
7
|
let!(:bridge) { double(:bridge) }
|
8
8
|
before { allow_any_instance_of(Language).to receive(:bridge).and_return bridge }
|
9
9
|
|
data/spec/models/query_spec.rb
CHANGED
@@ -11,11 +11,10 @@ describe Query do
|
|
11
11
|
|
12
12
|
describe '#submit_query!' do
|
13
13
|
let!(:results) { exercise.submit_query!(user, query: 'foo', content: 'bar', cookie: ['foo', 'bar']) }
|
14
|
-
let(:assignment) { exercise.
|
14
|
+
let(:assignment) { exercise.find_assignment_for user }
|
15
15
|
|
16
16
|
it { expect(results[:status]).to eq :passed }
|
17
17
|
it { expect(results[:result]).to eq '5' }
|
18
|
-
it { expect(exercise.assignment_for(user)).to be_present }
|
19
18
|
it { expect(assignment.solution).to eq 'bar' }
|
20
19
|
it { expect(assignment.status).to eq :pending }
|
21
20
|
end
|
@@ -5,7 +5,7 @@ describe Query, organization_workspace: :test do
|
|
5
5
|
let(:student) { create(:user) }
|
6
6
|
|
7
7
|
describe '#submit_question!' do
|
8
|
-
let(:assignment) { exercise.
|
8
|
+
let(:assignment) { exercise.find_assignment_for student }
|
9
9
|
|
10
10
|
context 'when just a question on an empty assignment is sent' do
|
11
11
|
before { exercise.submit_question!(student, content: 'Please help!') }
|
@@ -14,7 +14,6 @@ describe Query, organization_workspace: :test do
|
|
14
14
|
it { expect(assignment.result).to be nil }
|
15
15
|
|
16
16
|
it { expect(assignment.solution).to be nil }
|
17
|
-
it { expect(exercise.assignment_for(student)).to be_present }
|
18
17
|
it { expect(assignment.messages.count).to eq 1 }
|
19
18
|
it { expect(assignment.submission_id).to_not be nil }
|
20
19
|
end
|
@@ -28,7 +27,6 @@ describe Query, organization_workspace: :test do
|
|
28
27
|
|
29
28
|
before { exercise.submit_question!(student, content: 'Please help!') }
|
30
29
|
|
31
|
-
it { expect(exercise.assignment_for(student)).to be_present }
|
32
30
|
it { expect(assignment.status).to eq :failed }
|
33
31
|
it { expect(assignment.result).to eq 'noop result' }
|
34
32
|
it { expect(assignment.solution).to eq 'x = 1' }
|
@@ -2,8 +2,39 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Solution, organization_workspace: :test do
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
let(:user) { create(:user) }
|
6
|
+
|
7
|
+
describe '#try_submit_solution!' do
|
8
|
+
|
9
|
+
context 'when on chapter' do
|
10
|
+
let(:problem) { create(:problem) }
|
11
|
+
let!(:chapter) {
|
12
|
+
create(:chapter, name: 'Functional Programming', lessons: [
|
13
|
+
create(:lesson, exercises: [problem])
|
14
|
+
]) }
|
15
|
+
|
16
|
+
before { reindex_current_organization! }
|
17
|
+
let!(:result) { problem.try_submit_solution! user }
|
18
|
+
|
19
|
+
it { expect(result).to eq problem.find_assignment_for(user) }
|
20
|
+
it { expect(result.attempts_left).to eq nil }
|
21
|
+
it { expect(result.attempts_left?).to be true }
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when on exam' do
|
25
|
+
let(:problem) { create(:problem) }
|
26
|
+
let!(:exam) { create(:exam, max_problem_submissions: 10, exercises: [problem]) }
|
27
|
+
|
28
|
+
before { reindex_current_organization! }
|
29
|
+
let(:result) { problem.try_submit_solution! user }
|
30
|
+
|
31
|
+
it { expect(result).to eq problem.find_assignment_for(user) }
|
32
|
+
it { expect(result.attempts_left).to eq 9 }
|
33
|
+
it { expect(result.attempts_left?).to be true }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#submit_solution!' do
|
7
38
|
|
8
39
|
before { expect_any_instance_of(Challenge).to receive(:automated_evaluation_class).and_return(Mumuki::Laboratory::Evaluation::Automated) }
|
9
40
|
before { expect_any_instance_of(Language).to receive(:run_tests!).and_return(bridge_response) }
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,236 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
// Modified to have always `startOpen = true`;
|
5
|
+
|
6
|
+
(function(mod) {
|
7
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
8
|
+
mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../clike/clike"));
|
9
|
+
else if (typeof define == "function" && define.amd) // AMD
|
10
|
+
define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../clike/clike"], mod);
|
11
|
+
else // Plain browser env
|
12
|
+
mod(CodeMirror);
|
13
|
+
})(function(CodeMirror) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
function keywords(str) {
|
17
|
+
var obj = {}, words = str.split(" ");
|
18
|
+
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
19
|
+
return obj;
|
20
|
+
}
|
21
|
+
|
22
|
+
// Helper for phpString
|
23
|
+
function matchSequence(list, end, escapes) {
|
24
|
+
if (list.length == 0) return phpString(end);
|
25
|
+
return function (stream, state) {
|
26
|
+
var patterns = list[0];
|
27
|
+
for (var i = 0; i < patterns.length; i++) if (stream.match(patterns[i][0])) {
|
28
|
+
state.tokenize = matchSequence(list.slice(1), end);
|
29
|
+
return patterns[i][1];
|
30
|
+
}
|
31
|
+
state.tokenize = phpString(end, escapes);
|
32
|
+
return "string";
|
33
|
+
};
|
34
|
+
}
|
35
|
+
function phpString(closing, escapes) {
|
36
|
+
return function(stream, state) { return phpString_(stream, state, closing, escapes); };
|
37
|
+
}
|
38
|
+
function phpString_(stream, state, closing, escapes) {
|
39
|
+
// "Complex" syntax
|
40
|
+
if (escapes !== false && stream.match("${", false) || stream.match("{$", false)) {
|
41
|
+
state.tokenize = null;
|
42
|
+
return "string";
|
43
|
+
}
|
44
|
+
|
45
|
+
// Simple syntax
|
46
|
+
if (escapes !== false && stream.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/)) {
|
47
|
+
// After the variable name there may appear array or object operator.
|
48
|
+
if (stream.match("[", false)) {
|
49
|
+
// Match array operator
|
50
|
+
state.tokenize = matchSequence([
|
51
|
+
[["[", null]],
|
52
|
+
[[/\d[\w\.]*/, "number"],
|
53
|
+
[/\$[a-zA-Z_][a-zA-Z0-9_]*/, "variable-2"],
|
54
|
+
[/[\w\$]+/, "variable"]],
|
55
|
+
[["]", null]]
|
56
|
+
], closing, escapes);
|
57
|
+
}
|
58
|
+
if (stream.match(/\-\>\w/, false)) {
|
59
|
+
// Match object operator
|
60
|
+
state.tokenize = matchSequence([
|
61
|
+
[["->", null]],
|
62
|
+
[[/[\w]+/, "variable"]]
|
63
|
+
], closing, escapes);
|
64
|
+
}
|
65
|
+
return "variable-2";
|
66
|
+
}
|
67
|
+
|
68
|
+
var escaped = false;
|
69
|
+
// Normal string
|
70
|
+
while (!stream.eol() &&
|
71
|
+
(escaped || escapes === false ||
|
72
|
+
(!stream.match("{$", false) &&
|
73
|
+
!stream.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/, false)))) {
|
74
|
+
if (!escaped && stream.match(closing)) {
|
75
|
+
state.tokenize = null;
|
76
|
+
state.tokStack.pop(); state.tokStack.pop();
|
77
|
+
break;
|
78
|
+
}
|
79
|
+
escaped = stream.next() == "\\" && !escaped;
|
80
|
+
}
|
81
|
+
return "string";
|
82
|
+
}
|
83
|
+
|
84
|
+
var phpKeywords = "abstract and array as break case catch class clone const continue declare default " +
|
85
|
+
"do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final " +
|
86
|
+
"for foreach function global goto if implements interface instanceof namespace " +
|
87
|
+
"new or private protected public static switch throw trait try use var while xor " +
|
88
|
+
"die echo empty exit eval include include_once isset list require require_once return " +
|
89
|
+
"print unset __halt_compiler self static parent yield insteadof finally";
|
90
|
+
var phpAtoms = "true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__";
|
91
|
+
var phpBuiltin = "func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";
|
92
|
+
CodeMirror.registerHelper("hintWords", "php", [phpKeywords, phpAtoms, phpBuiltin].join(" ").split(" "));
|
93
|
+
CodeMirror.registerHelper("wordChars", "php", /[\w$]/);
|
94
|
+
|
95
|
+
var phpConfig = {
|
96
|
+
name: "clike",
|
97
|
+
helperType: "php",
|
98
|
+
keywords: keywords(phpKeywords),
|
99
|
+
blockKeywords: keywords("catch do else elseif for foreach if switch try while finally"),
|
100
|
+
defKeywords: keywords("class function interface namespace trait"),
|
101
|
+
atoms: keywords(phpAtoms),
|
102
|
+
builtin: keywords(phpBuiltin),
|
103
|
+
multiLineStrings: true,
|
104
|
+
hooks: {
|
105
|
+
"$": function(stream) {
|
106
|
+
stream.eatWhile(/[\w\$_]/);
|
107
|
+
return "variable-2";
|
108
|
+
},
|
109
|
+
"<": function(stream, state) {
|
110
|
+
var before;
|
111
|
+
if (before = stream.match(/<<\s*/)) {
|
112
|
+
var quoted = stream.eat(/['"]/);
|
113
|
+
stream.eatWhile(/[\w\.]/);
|
114
|
+
var delim = stream.current().slice(before[0].length + (quoted ? 2 : 1));
|
115
|
+
if (quoted) stream.eat(quoted);
|
116
|
+
if (delim) {
|
117
|
+
(state.tokStack || (state.tokStack = [])).push(delim, 0);
|
118
|
+
state.tokenize = phpString(delim, quoted != "'");
|
119
|
+
return "string";
|
120
|
+
}
|
121
|
+
}
|
122
|
+
return false;
|
123
|
+
},
|
124
|
+
"#": function(stream) {
|
125
|
+
while (!stream.eol() && !stream.match("?>", false)) stream.next();
|
126
|
+
return "comment";
|
127
|
+
},
|
128
|
+
"/": function(stream) {
|
129
|
+
if (stream.eat("/")) {
|
130
|
+
while (!stream.eol() && !stream.match("?>", false)) stream.next();
|
131
|
+
return "comment";
|
132
|
+
}
|
133
|
+
return false;
|
134
|
+
},
|
135
|
+
'"': function(_stream, state) {
|
136
|
+
(state.tokStack || (state.tokStack = [])).push('"', 0);
|
137
|
+
state.tokenize = phpString('"');
|
138
|
+
return "string";
|
139
|
+
},
|
140
|
+
"{": function(_stream, state) {
|
141
|
+
if (state.tokStack && state.tokStack.length)
|
142
|
+
state.tokStack[state.tokStack.length - 1]++;
|
143
|
+
return false;
|
144
|
+
},
|
145
|
+
"}": function(_stream, state) {
|
146
|
+
if (state.tokStack && state.tokStack.length > 0 &&
|
147
|
+
!--state.tokStack[state.tokStack.length - 1]) {
|
148
|
+
state.tokenize = phpString(state.tokStack[state.tokStack.length - 2]);
|
149
|
+
}
|
150
|
+
return false;
|
151
|
+
}
|
152
|
+
}
|
153
|
+
};
|
154
|
+
|
155
|
+
CodeMirror.defineMode("php", function(config, parserConfig) {
|
156
|
+
var htmlMode = CodeMirror.getMode(config, (parserConfig && parserConfig.htmlMode) || "text/html");
|
157
|
+
var phpMode = CodeMirror.getMode(config, phpConfig);
|
158
|
+
|
159
|
+
function dispatch(stream, state) {
|
160
|
+
var isPHP = state.curMode == phpMode;
|
161
|
+
if (stream.sol() && state.pending && state.pending != '"' && state.pending != "'") state.pending = null;
|
162
|
+
if (!isPHP) {
|
163
|
+
if (stream.match(/^<\?\w*/)) {
|
164
|
+
state.curMode = phpMode;
|
165
|
+
if (!state.php) state.php = CodeMirror.startState(phpMode, htmlMode.indent(state.html, ""))
|
166
|
+
state.curState = state.php;
|
167
|
+
return "meta";
|
168
|
+
}
|
169
|
+
if (state.pending == '"' || state.pending == "'") {
|
170
|
+
while (!stream.eol() && stream.next() != state.pending) {}
|
171
|
+
var style = "string";
|
172
|
+
} else if (state.pending && stream.pos < state.pending.end) {
|
173
|
+
stream.pos = state.pending.end;
|
174
|
+
var style = state.pending.style;
|
175
|
+
} else {
|
176
|
+
var style = htmlMode.token(stream, state.curState);
|
177
|
+
}
|
178
|
+
if (state.pending) state.pending = null;
|
179
|
+
var cur = stream.current(), openPHP = cur.search(/<\?/), m;
|
180
|
+
if (openPHP != -1) {
|
181
|
+
if (style == "string" && (m = cur.match(/[\'\"]$/)) && !/\?>/.test(cur)) state.pending = m[0];
|
182
|
+
else state.pending = {end: stream.pos, style: style};
|
183
|
+
stream.backUp(cur.length - openPHP);
|
184
|
+
}
|
185
|
+
return style;
|
186
|
+
} else if (isPHP && state.php.tokenize == null && stream.match("?>")) {
|
187
|
+
state.curMode = htmlMode;
|
188
|
+
state.curState = state.html;
|
189
|
+
if (!state.php.context.prev) state.php = null;
|
190
|
+
return "meta";
|
191
|
+
} else {
|
192
|
+
return phpMode.token(stream, state.curState);
|
193
|
+
}
|
194
|
+
}
|
195
|
+
|
196
|
+
return {
|
197
|
+
startState: function() {
|
198
|
+
var html = CodeMirror.startState(htmlMode)
|
199
|
+
var php = (parserConfig.startOpen || true) ? CodeMirror.startState(phpMode) : null
|
200
|
+
return {html: html,
|
201
|
+
php: php,
|
202
|
+
curMode: (parserConfig.startOpen || true) ? phpMode : htmlMode,
|
203
|
+
curState: (parserConfig.startOpen || true) ? php : html,
|
204
|
+
pending: null};
|
205
|
+
},
|
206
|
+
|
207
|
+
copyState: function(state) {
|
208
|
+
var html = state.html, htmlNew = CodeMirror.copyState(htmlMode, html),
|
209
|
+
php = state.php, phpNew = php && CodeMirror.copyState(phpMode, php), cur;
|
210
|
+
if (state.curMode == htmlMode) cur = htmlNew;
|
211
|
+
else cur = phpNew;
|
212
|
+
return {html: htmlNew, php: phpNew, curMode: state.curMode, curState: cur,
|
213
|
+
pending: state.pending};
|
214
|
+
},
|
215
|
+
|
216
|
+
token: dispatch,
|
217
|
+
|
218
|
+
indent: function(state, textAfter) {
|
219
|
+
if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) ||
|
220
|
+
(state.curMode == phpMode && /^\?>/.test(textAfter)))
|
221
|
+
return htmlMode.indent(state.html, textAfter);
|
222
|
+
return state.curMode.indent(state.curState, textAfter);
|
223
|
+
},
|
224
|
+
|
225
|
+
blockCommentStart: "/*",
|
226
|
+
blockCommentEnd: "*/",
|
227
|
+
lineComment: "//",
|
228
|
+
|
229
|
+
innerMode: function(state) { return {state: state.curState, mode: state.curMode}; }
|
230
|
+
};
|
231
|
+
}, "htmlmixed", "clike");
|
232
|
+
|
233
|
+
CodeMirror.defineMIME("application/x-httpd-php", "php");
|
234
|
+
CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true});
|
235
|
+
CodeMirror.defineMIME("text/x-php", phpConfig);
|
236
|
+
});
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-laboratory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -72,28 +72,28 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '3.
|
75
|
+
version: '3.7'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '3.
|
82
|
+
version: '3.7'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: mumukit-inspection
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
89
|
+
version: '3.4'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
96
|
+
version: '3.4'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: mumukit-nuntius
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '6.0'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '6.0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: mumukit-directives
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -479,6 +479,7 @@ files:
|
|
479
479
|
- app/views/exercise_solutions/_expectations.html.erb
|
480
480
|
- app/views/exercise_solutions/_kids_results.html.erb
|
481
481
|
- app/views/exercise_solutions/_kids_results_button.html.erb
|
482
|
+
- app/views/exercise_solutions/_out_of_attempts.html.erb
|
482
483
|
- app/views/exercise_solutions/_results.html.erb
|
483
484
|
- app/views/exercise_solutions/_results_button.html.erb
|
484
485
|
- app/views/exercise_solutions/_results_title.html.erb
|
@@ -528,6 +529,7 @@ files:
|
|
528
529
|
- app/views/layouts/exercise_inputs/read_only_editors/_custom.html.erb
|
529
530
|
- app/views/layouts/exercise_inputs/read_only_editors/_multiple_choice.html.erb
|
530
531
|
- app/views/layouts/exercise_inputs/read_only_editors/_single_choice.html.erb
|
532
|
+
- app/views/layouts/exercise_inputs/read_only_editors/_text.erb
|
531
533
|
- app/views/layouts/mailer.html.erb
|
532
534
|
- app/views/layouts/mailer.text.erb
|
533
535
|
- app/views/layouts/modals/_guide_corollary.html.erb
|
@@ -795,6 +797,7 @@ files:
|
|
795
797
|
- db/migrate/20180702153442_create_upvotes.rb
|
796
798
|
- db/migrate/20180702175220_add_upvotes_count_to_discussions.rb
|
797
799
|
- db/migrate/20180704150839_rename_assignment_status_to_submission_status.rb
|
800
|
+
- db/migrate/20180725145801_add_submissions_caps_to_exams.rb
|
798
801
|
- db/migrate/20180802190437_add_approved_to_messages.rb
|
799
802
|
- db/seeds/users.rb
|
800
803
|
- lib/events.rb
|
@@ -966,6 +969,7 @@ files:
|
|
966
969
|
- spec/helpers/email_helper_spec.rb
|
967
970
|
- spec/helpers/exercise_input_helper_spec.rb
|
968
971
|
- spec/helpers/icons_helper_spec.rb
|
972
|
+
- spec/helpers/organization_list_helper_spec.rb
|
969
973
|
- spec/helpers/test_results_rendering_spec.rb
|
970
974
|
- spec/helpers/with_choices_spec.rb
|
971
975
|
- spec/helpers/with_navigation_spec.rb
|
@@ -1021,6 +1025,7 @@ files:
|
|
1021
1025
|
- vendor/assets/javascripts/codemirror-modes/javascript.min.js
|
1022
1026
|
- vendor/assets/javascripts/codemirror-modes/markdown.min.js
|
1023
1027
|
- vendor/assets/javascripts/codemirror-modes/matchbrackets.min.js
|
1028
|
+
- vendor/assets/javascripts/codemirror-modes/php.js
|
1024
1029
|
- vendor/assets/javascripts/codemirror-modes/placeholder.min.js
|
1025
1030
|
- vendor/assets/javascripts/codemirror-modes/prolog-autocomplete.js
|
1026
1031
|
- vendor/assets/javascripts/codemirror-modes/prolog.js
|
@@ -1151,6 +1156,7 @@ test_files:
|
|
1151
1156
|
- spec/helpers/email_helper_spec.rb
|
1152
1157
|
- spec/helpers/exercise_input_helper_spec.rb
|
1153
1158
|
- spec/helpers/icons_helper_spec.rb
|
1159
|
+
- spec/helpers/organization_list_helper_spec.rb
|
1154
1160
|
- spec/helpers/test_results_rendering_spec.rb
|
1155
1161
|
- spec/helpers/with_choices_spec.rb
|
1156
1162
|
- spec/helpers/with_navigation_spec.rb
|