init project

This commit is contained in:
Jasder
2020-03-09 00:40:16 +08:00
commit 2937b2a94d
6549 changed files with 7215173 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
json.name challenge.subject
json.position challenge.position
json.tag_count challenge.challenge_tags_count

View File

@@ -0,0 +1,19 @@
# 新建关卡
json.choice_url new_shixun_challenge_path(shixun_identifier, st: 1) if @power == 0
json.practice_url new_shixun_challenge_path(shixun_identifier, st: 0) if @power == 0
json.go_back_url shixun_challenges_path
if @prev_challenge
json.prev_challenge do
json.id @prev_challenge.id
json.st @prev_challenge.st
end
end
if @next_challenge
json.next_challenge do
json.id @next_challenge.id
json.st @next_challenge.st
end
end
json.position @position
json.name @challenge.try(:subject)

View File

@@ -0,0 +1,3 @@
json.array! @answers do |answer|
json.(answer, :id, :name, :contents, :level, :score)
end

View File

@@ -0,0 +1,3 @@
json.status 1
json.messages "新建成功"
json.challenge_id @challenge.id

View File

@@ -0,0 +1 @@
json.challenge_choose_id @challenge_choose.id

View File

@@ -0,0 +1,2 @@
json.status 1
json.message "操作成功"

View File

@@ -0,0 +1,2 @@
json.status 1
json.message "删除成功!"

View File

@@ -0,0 +1,2 @@
json.status @status
json.challenge_id @challenge.id

View File

@@ -0,0 +1,26 @@
json.partial! "challenges/top_common_data", shixun_identifier: @shixun.identifier
json.chooses do
json.array! @chooses do |choose|
json.choose_id choose.id
json.type choose.category
end
end
json.st @challenge.st
if @tab == 0
# 本关任务tab的编辑模式
json.(@challenge, :id, :subject, :task_pass, :difficulty, :score, :exec_time, :st)
json.tags @challenge.challenge_tags.map(&:name)
elsif @tab == 1
# 评测设置的编辑模式
json.(@challenge, :id, :path, :exec_path, :show_type, :original_picture_path, :expect_picture_path, :picture_path,
:web_route, :test_set_score, :test_set_average, :exec_time)
json.has_web_route @shixun.has_web_route?
json.test_sets @challenge.test_sets do |set|
json.hidden (set.is_public ? 0 : 1)
json.(set, :input, :output, :score, :match_rule)
end
elsif @tab == 2
# 参考答案
json.(@challenge, :answer)
end

View File

@@ -0,0 +1,11 @@
json.(@challenge_choose, :challenge_id, :subject, :answer,
:standard_answer, :score, :difficult,
:position, :category)
json.st @challenge.st
# 选项的参数
json.choose_contents @challenge_choose.challenge_questions do |question|
json.(question, :option_name, :position, :right_key)
end
json.tags @challenge_choose.challenge_tags.map(&:name)

View File

@@ -0,0 +1,32 @@
# 公共接口,新建关卡任务
# json.partial! 'challenges/new_link', shixun_identifier: @shixun.identifier
json.description @shixun.description
json.power @editable
json.shixun_identifier @shixun.identifier
json.shixun_status @shixun.status
json.is_jupyter @shixun.is_jupyter?
json.allow_skip @shixun.task_pass
# 列表
if @challenges.present?
json.challenge_list @challenges do |challenge|
json.challenge_id challenge.id
json.position challenge.position
json.st challenge.st
json.name challenge.subject
json.score challenge.score
json.passed_count challenge.user_passed_count
json.playing_count challenge.playing_count
json.name_url shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier)
#json.open_game challenge.open_game(@user.id, @shixun)
if @editable
json.edit_url edit_shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier)
json.delete_url shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier)
json.up_url index_up_shixun_challenge_path(challenge, :shixun_identifier => @shixun.identifier) unless challenge.position < 2
json.down_url index_down_shixun_challenge_path(challenge, :shixun_identifier => @shixun.identifier) if @shixun.challenges_count != challenge.position
end
#json.passed challenge.has_passed?(@user.id)
json.status challenge.user_tpi_status @user.id
end
end

View File

@@ -0,0 +1,2 @@
json.status 1
json.message "下移成功"

View File

@@ -0,0 +1,2 @@
json.status 1
json.message "上移成功"

View File

@@ -0,0 +1,13 @@
# 导航栏公共数据
json.partial! "challenges/top_common_data", shixun_identifier: @shixun.identifier
# st: 0 实践任务, 1 选择题任务
json.st @st
# 过关任务的默认值
json.task_pass_default @task_pass_default
json.submit_url shixun_challenges_path(@shixun, :st => @st)

View File

@@ -0,0 +1,10 @@
# 导航栏公共数据
json.partial! "challenges/top_common_data", shixun_identifier: @shixun.identifier
json.(@challenge, :id, :subject, :task_pass, :difficulty, :score, :exec_time, :st)
json.tags @challenge.challenge_tags.map(&:name)

View File

@@ -0,0 +1,3 @@
json.(@challenge_choose, :challenge_id, :subject, :answer,
:standard_answer, :score, :difficult,
:position, :category)

View File

@@ -0,0 +1,3 @@
json.status 1
json.messages "更新成功!"
json.challenge_id @challenge.id

View File

@@ -0,0 +1 @@
json.challenge_choose_id @challenge_choose.try(:id)