diff --git a/app/models/configuration.rb b/app/models/configuration.rb --- a/app/models/configuration.rb +++ b/app/models/configuration.rb @@ -1,3 +1,5 @@ +require 'yaml' + # # This class also contains various login of the system. # @@ -6,6 +8,7 @@ SYSTEM_MODE_CONF_KEY = 'system.mode' @@configurations = nil + @@task_grading_info = nil def self.get(key) if @@configurations == nil @@ -47,6 +50,10 @@ return true end + def self.show_grading_result + return (get(SYSTEM_MODE_CONF_KEY)=='analysis') + end + def self.allow_test_request(user) mode = get(SYSTEM_MODE_CONF_KEY) if (mode=='contest') @@ -55,6 +62,13 @@ return false if mode=='analysis' return true end + + def self.task_grading_info + if @@task_grading_info==nil + read_grading_info + end + return @@task_grading_info + end protected def self.read_config @@ -74,5 +88,11 @@ end end end + + def self.read_grading_info + f = File.open(TASK_GRADING_INFO_FILENAME) + @@task_grading_info = YAML.load(f) + f.close + end end