set proglang based on exenv

try to guess exenv based on proglang
This commit is contained in:
Karol
2022-09-24 15:24:12 +02:00
parent f5758ecb5e
commit 77999f75df
4 changed files with 42 additions and 10 deletions

View File

@@ -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