-
Notifications
You must be signed in to change notification settings - Fork 1
links to task attempt pages and pages themselves #415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
40a4e2a
links to task attempt pages and pages themselves
PeeachPie 4faa4d6
links to task attempt pages and pages themselves
PeeachPie d43d174
links to task attempt pages and pages themselves
PeeachPie f2b728c
PredefenceEightToTenMinutesNoSlideCheckFeedbackEvaluator: fixed
PeeachPie 7d3d73d
links to task attempt pages and pages themselves
PeeachPie 7af3d9c
Merge branch 'master' into links_to_task_attempts_151
HadronCollider 654cd97
check_task_attempt_access
PeeachPie f827e44
Merge remote-tracking branch 'origin' into links_to_task_attempts_151
PeeachPie 63da1f1
new columns in task attempt
PeeachPie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.git | ||
venv | ||
.venv | ||
.idea | ||
.ssl | ||
__pycache__ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.venv | ||
venv | ||
.idea | ||
ssl | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from app.root_logger import get_root_logger | ||
|
||
from bson import ObjectId | ||
from flask import Blueprint, render_template, jsonify, request, session | ||
from app.localisation import * | ||
|
||
from app.api.task_attempts import get_task_attempt | ||
from app.check_access import check_access | ||
from app.lti_session_passback.auth_checkers import check_admin, check_auth | ||
from app.utils import check_arguments_are_convertible_to_object_id | ||
|
||
routes_task_attempts = Blueprint('routes_task_attempts', __name__) | ||
logger = get_root_logger() | ||
|
||
@check_arguments_are_convertible_to_object_id | ||
@routes_task_attempts.route('/task_attempts/<task_attempt_id>/', methods=['GET']) | ||
def view_task_attempt(task_attempt_id: str): | ||
HadronCollider marked this conversation as resolved.
Show resolved
Hide resolved
|
||
""" | ||
Route to view page with task attempt. | ||
|
||
:param task_attempt_id: Task attempt identifier | ||
:return: Page or an empty dictionary with 404 HTTP code if access was denied. | ||
""" | ||
|
||
if not check_access({'_id': ObjectId(task_attempt_id)}): | ||
return {}, 404 | ||
|
||
# Нужна ли проверка авторизации? | ||
|
||
task_attempt, task_attempt_status_code = get_task_attempt(task_attempt_id) | ||
|
||
if task_attempt.get('message') != 'OK': | ||
return task_attempt, task_attempt_status_code | ||
|
||
return render_template( | ||
'task_attempt.html', | ||
task_attempt_id=task_attempt_id, | ||
task_id=task_attempt['task_id'], | ||
username=task_attempt['username'], | ||
training_scores=task_attempt['training_scores'], | ||
is_passed_back=task_attempt['is_passed_back'], | ||
), 200 |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
function getTrainingsTable(trainingScores, isPassedBack) { | ||
const trainingsTable = {}; | ||
|
||
Object.keys(trainingScores).forEach(trainingId => { | ||
if (trainingsTable[trainingId] === undefined) { | ||
trainingsTable[trainingId] = {}; | ||
} | ||
trainingsTable[trainingId].score = trainingScores[trainingId]; | ||
}); | ||
|
||
Object.keys(isPassedBack).forEach(trainingId => { | ||
if (trainingsTable[trainingId] === undefined) { | ||
trainingsTable[trainingId] = {}; | ||
} | ||
trainingsTable[trainingId].passedBackStatus = isPassedBack[trainingId]; | ||
}); | ||
|
||
return trainingsTable; | ||
} | ||
|
||
function createTableHeaderElement() { | ||
const trainingIdHeaderElement = document.createElement("th"); | ||
trainingIdHeaderElement.innerHTML = "training_id"; | ||
|
||
const trainingScoreHeaderElement = document.createElement("th"); | ||
trainingScoreHeaderElement.innerHTML = "score"; | ||
|
||
const trainingStatusHeaderElement = document.createElement("th"); | ||
trainingStatusHeaderElement.innerHTML = "pass_back_status"; | ||
|
||
const tableHeaderElement = document.createElement("tr"); | ||
|
||
tableHeaderElement.append(trainingIdHeaderElement, trainingScoreHeaderElement, trainingStatusHeaderElement); | ||
|
||
return tableHeaderElement; | ||
} | ||
|
||
function createTableRowElement(trainingInfo, trainingId) { | ||
const tableRowElement = document.createElement("tr"); | ||
|
||
const tableRowIdElement = document.createElement("td"); | ||
tableRowIdElement.innerHTML = `<a href="/trainings/statistics/${trainingId}/">${trainingId}</a>`; | ||
|
||
const tableRowScoreElement = document.createElement("td"); | ||
tableRowScoreElement.innerHTML = trainingInfo.score.toFixed(2) || "none"; | ||
|
||
const tableRowStatusElement = document.createElement("td"); | ||
tableRowStatusElement.innerHTML = trainingInfo.passedBackStatus || "none"; | ||
|
||
tableRowElement.append(tableRowIdElement, tableRowScoreElement, tableRowStatusElement); | ||
|
||
return tableRowElement; | ||
} | ||
|
||
function showRelatedTrainingsTable(trainingScores, isPassedBack) { | ||
const trainingsTable = getTrainingsTable(trainingScores, isPassedBack); | ||
|
||
const tableElement = document.getElementById("related-trainings-table"); | ||
|
||
tableElement.appendChild(createTableHeaderElement()); | ||
|
||
Object.keys(trainingsTable).forEach(trainingId => { | ||
tableElement.appendChild(createTableRowElement(trainingsTable[trainingId], trainingId)); | ||
}); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block header %} | ||
<link rel="stylesheet" href="{{ url_for('static', filename='css/task_attempt.css') }}"> | ||
<link rel="stylesheet" href="{{ url_for('static', filename='css/index.css') }}"> | ||
<link rel="stylesheet" href="{{ url_for('static', filename='css/libraries/jquery-ui/jquery-ui.min.css') }}"> | ||
|
||
{% endblock %} | ||
|
||
{% block content %} | ||
<div class="base-container"> | ||
<h3>{{ title }}</h3> | ||
<h3>Информация по попытке с ID {{ task_attempt_id }}</h3> | ||
<h3>task_id: {{ task_id }}</h3> | ||
<h3>Имя пользователя: {{ username }}</h3> | ||
<div class="related-trainings-container"> | ||
<h3>Связанные тренировки:</h3> | ||
<table id="related-trainings-table" class="table center-align-table"></table> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Добавьте в таблицу столбцы с
|
||
</div> | ||
</div> | ||
<script src="{{ url_for('static', filename='js/libraries/jquery.min.js') }}"></script> | ||
<script src="{{ url_for('static', filename='js/task_attempts.js') }}"></script> | ||
<script type="text/javascript"> | ||
showRelatedTrainingsTable({{ training_scores|tojson|safe }}, {{ is_passed_back|tojson|safe }}); | ||
</script> | ||
{% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HadronCollider marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[constants] | ||
presentation_file_max_size_in_megabytes=16 | ||
app_secret_key=secret_key_placeholder | ||
lti_consumer_key=secretconsumerkey | ||
lti_consumer_secret=supersecretconsumersecret | ||
version_file=VERSION.json | ||
backup_path=../dump/database-dump/ | ||
|
||
[mongodb] | ||
url=mongodb://localhost:27017/ | ||
database_name=database | ||
|
||
[vosk] | ||
url=ws://localhost:2700 | ||
|
||
[whisper] | ||
url=http://whisper:9000/asr | ||
|
||
[user_agent_platform] | ||
windows=True | ||
linux=True | ||
|
||
[user_agent_browser] | ||
chrome=89 | ||
firefox=87 | ||
|
||
[locale] | ||
language=ru | ||
|
||
[bugreport] | ||
form_link=https://docs.google.com/forms/d/e/1FAIpQLScUudcDPUwtTvmN_sbeljicHYhubK7pPQIM1o8Wh54HstT2BQ/viewform?usp=sf_link | ||
[email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,4 +46,4 @@ language=ru | |
|
||
[bugreport] | ||
form_link=https://docs.google.com | ||
[email protected] | ||
[email protected] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.