set proglang based on exenv
try to guess exenv based on proglang
This commit is contained in:
@@ -23,7 +23,7 @@ module ProformaService
|
||||
title: @exercise.title,
|
||||
description: @exercise.description,
|
||||
internal_description: nil,
|
||||
# proglang: proglang, where can we get this information?
|
||||
proglang: proglang,
|
||||
files: task_files,
|
||||
tests: tests,
|
||||
uuid: uuid,
|
||||
@@ -44,6 +44,12 @@ module ProformaService
|
||||
)
|
||||
end
|
||||
|
||||
def proglang
|
||||
regex = %r{^openhpi/co_execenv_(?<language>[^:]*):(?<version>[^-]*)(?>-.*)?$}
|
||||
match = regex.match @exercise.execution_environment.docker_image
|
||||
match ? {name: match[:language], version: match[:version]} : nil
|
||||
end
|
||||
|
||||
def uuid
|
||||
@exercise.update(uuid: SecureRandom.uuid) if @exercise.uuid.nil?
|
||||
@exercise.uuid
|
||||
|
Reference in New Issue
Block a user