Skip to content

Commit

Permalink
Merge pull request #13 from avantifellows/main
Browse files Browse the repository at this point in the history
Docker fix, adding quiz link button
  • Loading branch information
pritamps authored Nov 4, 2022
2 parents 97a011e + 2b459de commit 8366a36
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 65 deletions.
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ FROM python:3.9

LABEL Pritam "[email protected]"

WORKDIR /app
WORKDIR /code

COPY requirements.txt /app/requirements.txt
COPY requirements.txt /code/requirements.txt
ADD generate_table /app

RUN pip install -r /app/requirements.txt
RUN pip install -r /code/requirements.txt

COPY . /app
COPY ./app /code

EXPOSE 80

# RUN python generate_table
CMD ["python", "app/main.py"]
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5050", "--reload"]
3 changes: 0 additions & 3 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from models.student_quiz_report import StudentQuizReportController
from db.student_quiz_reports_db import StudentQuizReportsDB
from routers.student_quiz_reports import StudentQuizReportsRouter
from routers.reports import ReportsRouter

from fastapi.staticfiles import StaticFiles
Expand All @@ -19,11 +18,9 @@

student_quiz_reports_db = StudentQuizReportsDB(db)
student_quiz_reports_controller = StudentQuizReportController(student_quiz_reports_db)
student_quiz_reports_router = StudentQuizReportsRouter(student_quiz_reports_controller)
reports_router = ReportsRouter(student_quiz_reports_controller)

reports_router = ReportsRouter(student_quiz_reports_controller)
app.include_router(student_quiz_reports_router.router)
app.include_router(reports_router.router)


Expand Down
13 changes: 12 additions & 1 deletion app/routers/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
"rank": "Rank",
}

QUIZ_URL = (
"https://quiz.avantifellows.org/quiz/{quiz_id}?userId={user_id}&apiKey={api_key}"
)
AF_API_KEY = "6qOO8UdF1EGxLgzwIbQN"


class ReportsRouter:
def __init__(
Expand Down Expand Up @@ -61,7 +66,13 @@ def student_quiz_report(request: Request, session_id: str, user_id: str):
)
report_data = {}
report_data["student_name"] = ""
report_data["student_id"] = data[0]["user_id"]
test_id = data[0]["test_id"]
user_id = data[0]["user_id"]

report_data["student_id"] = user_id
report_data["test_link"] = QUIZ_URL.format(
quiz_id=test_id, user_id=user_id, api_key=AF_API_KEY
)

section_reports = []
overall_performance = {}
Expand Down
52 changes: 0 additions & 52 deletions app/routers/student_quiz_reports.py

This file was deleted.

19 changes: 16 additions & 3 deletions app/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,25 @@ body {
box-shadow: 1px 1px 5px #535353;
}


#answer_sheet_button {
display: table;
margin: 30px auto 0 auto;
text-align: center;
font-size: 14pt;
background-color: #29973E;
border-radius: 10px;
text-decoration: none;
color: white;
padding: 10px 40px 10px 40px;
box-shadow: 1px 1px 5px #535353;
}

#test_summary_card {
display: inline-flex;
margin-left: auto;
margin-right: auto;
margin-top: 50px;
font-size: 22pt;
font-weight: bold;
justify-content: center;
background-color: #EBF5FE;
Expand All @@ -49,13 +62,13 @@ body {
padding: 5px;
aspect-ratio: 1;
display: flex;
font-size: 12pt;
font-size: 20pt;
}

#test_summary_card .test_details {
display: block;
margin: auto;
font-size: 14pt;
font-size: 22pt;
}

#section_heading {
Expand Down
4 changes: 4 additions & 0 deletions app/templates/student_quiz_report.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
</div>
</div>

<a id="answer_sheet_button" target="_blank" href={{report_data["test_link"]}}>
Click here to review your answers
</a>

<section id="overall_performance">
<div id="section_heading">Overall Performance</div>
{% set score_details = report_data["overall_performance"] %}
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
app:
build: .
volumes:
- "./:/app"
- "./app:/code"
ports:
- "5050:5050"
depends_on:
Expand Down

0 comments on commit 8366a36

Please sign in to comment.