summaryrefslogtreecommitdiff
path: root/kpov_judge
diff options
context:
space:
mode:
Diffstat (limited to 'kpov_judge')
-rwxr-xr-xkpov_judge/web/kpov_judge/kpov_judge.py21
-rw-r--r--kpov_judge/web/kpov_judge/templates/index.html3
2 files changed, 16 insertions, 8 deletions
diff --git a/kpov_judge/web/kpov_judge/kpov_judge.py b/kpov_judge/web/kpov_judge/kpov_judge.py
index 0499b11..7171c7f 100755
--- a/kpov_judge/web/kpov_judge/kpov_judge.py
+++ b/kpov_judge/web/kpov_judge/kpov_judge.py
@@ -42,6 +42,7 @@ def before_request():
@app.route('/')
def root():
student_id = flask.app.request.environ.get('REMOTE_USER', 'Nobody')
+ # env = flask.app.request.environ
tasks = g.db.tasks.find(dict(), {'task_id':1})
if tasks is not None:
task_list = [i['task_id'] for i in tasks]
@@ -198,9 +199,13 @@ def task_greeting(task_id, lang):
# generate the parameters as soon as the student visits
params, meta = get_params(task_id, student_id, db)
try:
+ public_params = dict()
+ for k, v in meta:
+ if meta.get('public', False):
+ public_params[k] = params.get(k, "???")
instructions = db.task_instructions.find({'task_id': task_id})[0]
instructions = instructions.get(lang,
- app.config['DEFAULT_LANG'])
+ app.config['DEFAULT_LANG']).format(**public_params)
except:
try:
instructions = instructions.values()[0]
@@ -209,14 +214,14 @@ def task_greeting(task_id, lang):
computer_list = db.student_computers.find({'task_id':task_id, 'student_id': student_id})
if request.args.get('narediStack', 'false') == 'true':
#db.student_tasks.update({'task_id':task_id, 'student_id': student_id}, {'$set': {'create_openstack': True}}, upsert = True)
- openstackCreated = False # Spremeni na True, ko odkomentiras zgornjo vrstico.
+ openstackCreated = False # Spremeni na True, ko odkomentiras zgornjo vrstico.
else:
- if db.student_tasks.find({'task_id':task_id, 'student_id': student_id, 'openstack_created': True}).count() > 0:
- openstackCreated = True
- elif db.student_tasks.find({'task_id':task_id, 'student_id': student_id, 'create_openstack': True}).count() > 0:
- openstackCreated = True
- else:
- openstackCreated = False
+ if db.student_tasks.find({'task_id':task_id, 'student_id': student_id, 'openstack_created': True}).count() > 0:
+ openstackCreated = True
+ elif db.student_tasks.find({'task_id':task_id, 'student_id': student_id, 'create_openstack': True}).count() > 0:
+ openstackCreated = True
+ else:
+ openstackCreated = False
return render_template('task_greeting.html', computers = computer_list, lang=lang, openstack = openstackCreated, instructions=instructions)
@app.route('/tasks/<task_id>/params.json', methods=['GET', 'POST'])
diff --git a/kpov_judge/web/kpov_judge/templates/index.html b/kpov_judge/web/kpov_judge/templates/index.html
index 2ceb378..193f419 100644
--- a/kpov_judge/web/kpov_judge/templates/index.html
+++ b/kpov_judge/web/kpov_judge/templates/index.html
@@ -4,6 +4,9 @@
Zdravo, {{student_id}}
</p>
<p>
+{{env}}
+</p>
+<p>
Trenutno so na voljo naloge:
<ul>
{% for t in tasks %}