Skip to content

Commit c2f986f

Browse files
authored
Merge pull request #11 from codingburgas/feature/student
Feature/student
2 parents 4475435 + adc0c8d commit c2f986f

File tree

20 files changed

+1732
-133
lines changed

20 files changed

+1732
-133
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
2+
# More GitHub Actions for Azure: https://github.com/Azure/actions
3+
# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions
4+
5+
name: Build and deploy Python app to Azure Web App - MyPathTeam9
6+
7+
on:
8+
push:
9+
branches:
10+
- feature/student
11+
workflow_dispatch:
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read #This is required for actions/checkout
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python version
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.12'
26+
27+
- name: Create and start virtual environment
28+
run: |
29+
python -m venv venv
30+
source venv/bin/activate
31+
32+
- name: Install dependencies
33+
run: pip install -r requirements.txt
34+
35+
# Optional: Add step to run tests here (PyTest, Django test suites, etc.)
36+
37+
- name: Zip artifact for deployment
38+
run: zip release.zip ./* -r
39+
40+
- name: Upload artifact for deployment jobs
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: python-app
44+
path: |
45+
release.zip
46+
!venv/
47+
48+
deploy:
49+
runs-on: ubuntu-latest
50+
needs: build
51+
environment:
52+
name: 'Production'
53+
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
54+
permissions:
55+
id-token: write #This is required for requesting the JWT
56+
contents: read #This is required for actions/checkout
57+
58+
steps:
59+
- name: Download artifact from build job
60+
uses: actions/download-artifact@v4
61+
with:
62+
name: python-app
63+
64+
- name: Unzip artifact for deployment
65+
run: unzip release.zip
66+
67+
68+
- name: Login to Azure
69+
uses: azure/login@v2
70+
with:
71+
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_47B771A6D4EF40798F7D83ECD157A32C }}
72+
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_4AC4E0BB098949FF8DA8568B7168F2FE }}
73+
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_4B5361A8AA16407EA7EF65B224104413 }}
74+
75+
- name: 'Deploy to Azure Web App'
76+
uses: azure/webapps-deploy@v3
77+
id: deploy-to-webapp
78+
with:
79+
app-name: 'MyPathTeam9'
80+
slot-name: 'Production'
81+

My_path_team9/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ def create_app(config):
1616

1717
from .auth import auth_bp
1818
from .main import main_bp
19+
from .student import student_bp
1920

2021
app.register_blueprint(auth_bp)
2122
app.register_blueprint(main_bp)
23+
app.register_blueprint(student_bp)
2224

2325
return app

My_path_team9/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
app = create_app(Config)
66

7-
"""with app.app_context():
8-
db.create_all()"""
7+
with app.app_context():
8+
db.create_all()
99

1010
if __name__ == '__main__':
1111
app.run()

My_path_team9/auth/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class User(db.Model, UserMixin):
77
id = db.Column(db.Integer, primary_key=True)
88
username = db.Column(db.String(80), unique=True, nullable=False)
99
email = db.Column(db.String(120), unique=True, nullable=False)
10-
__password = db.Column("password", db.String(128), nullable=False)
10+
__password = db.Column("password", db.String(300), nullable=False)
1111
role = db.Column(db.String(20), nullable=False)
1212

1313
@property

My_path_team9/auth/routes.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from urllib import request
2+
13
from flask import render_template, redirect, url_for, flash
24
from flask_login import login_user, logout_user, current_user, login_required
35
from . import auth_bp
@@ -21,7 +23,7 @@ def login():
2123
login_user(user)
2224

2325
if user.role == 'student':
24-
return redirect(url_for('student_bp.student_dashboard'))
26+
return redirect(url_for('student.survey'))
2527

2628
elif user.role == 'teacher':
2729
return redirect(url_for('teacher_bp.teacher_dashboard'))
@@ -71,5 +73,5 @@ def register():
7173
@login_required
7274
def logout():
7375
logout_user()
74-
flash('Logged out successfully.', 'info')
75-
return redirect(url_for("main_bp.index"))
76+
print('Logged out successfully.')
77+
return redirect(url_for("main.home"))

My_path_team9/config.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
class Config:
77
SECRET_KEY = os.environ.get('SECRET_KEY') or 'your-secret-key-here'
88

9-
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
10-
'sqlite:///' + os.path.join(basedir, 'app.db')
9+
SQLALCHEMY_DATABASE_URI = 'mssql+pyodbc://CloudSAd5c2a932:Viktoriq21@mypath.database.windows.net/mypath?driver=ODBC+Driver+17+for+SQL+Server'
1110

1211

1312
SQLALCHEMY_TRACK_MODIFICATIONS = False

My_path_team9/main/templates/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
{% block content %}
66
<div class="text-center">
7-
<h1>Welcome to <span style="font-family: 'Courier New', monospace; color: #17416D;">My_Path</span></h1>
7+
<h1>Welcome to My Path</h1>
8+
<h4>Our goal is to make teaching easier and learning more engaging through <br>an innovative platform that offers high-quality,
9+
teacher-approved video lessons tailored to the school curriculum. </h4>
810
<p><a href="{{ url_for('auth.login') }}" class="btn btn-primary mt-3">Login to Continue</a></p>
911
</div>
1012

My_path_team9/static/logo.png

80.6 KB
Loading

My_path_team9/student/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from flask import Blueprint
2+
3+
student_bp = Blueprint('student', __name__, template_folder='templates',url_prefix = '/student')
4+
5+
from . import routes

My_path_team9/student/forms.py

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
from flask_wtf import FlaskForm
2+
from wtforms import RadioField, SelectField, SelectMultipleField, widgets, SubmitField
3+
from wtforms import StringField, PasswordField, SubmitField
4+
from wtforms.validators import DataRequired, Length, EqualTo, Email, Optional
5+
from wtforms.validators import URL
6+
7+
class MultiCheckboxField(SelectMultipleField):
8+
widget = widgets.ListWidget(prefix_label=False)
9+
option_widget = widgets.CheckboxInput()
10+
11+
class SurveyForm(FlaskForm):
12+
class_section = RadioField('Which class and section are you in?', choices=[
13+
('9A', '9A'), ('9B', '9B'), ('9C', '9V'), ('9D', '9G')
14+
])
15+
16+
study_time = RadioField('How many hours a day do you study outside school?', choices=[
17+
('under_1', 'Less than 1 hour'),
18+
('1_2', '1–2 hours'),
19+
('2_3', '2–3 hours'),
20+
('over_3', 'More than 3 hours')
21+
])
22+
23+
interest_level = RadioField('How interested are you in the school material?', choices=[
24+
('very_high', 'Very high'),
25+
('medium', 'Medium'),
26+
('low', 'Low'),
27+
('none', 'Not interested')
28+
])
29+
30+
confidence = RadioField('How confident do you feel before tests/exams?', choices=[
31+
('very', 'Very confident'),
32+
('moderate', 'Moderately confident'),
33+
('low', 'Not very confident'),
34+
('stressed', 'Stressed')
35+
])
36+
37+
memory_method = RadioField('What’s your easiest way to remember information?', choices=[
38+
('notes', 'Taking notes'),
39+
('videos', 'Watching videos'),
40+
('repetition', 'Repeating information')
41+
])
42+
43+
online_learning = RadioField('How often do you use online learning resources?', choices=[
44+
('daily', 'Daily'),
45+
('few_times', 'Several times a week'),
46+
('rarely', 'Rarely'),
47+
('never', 'Never')
48+
])
49+
50+
hardest_subject = SelectField('Which subject do you find most difficult?', choices=[
51+
('Natural sciences', 'Natural sciences'),
52+
('mathematics', 'Mathematics'),
53+
('languages', 'Languages'),
54+
('social sciences', 'Social sciences'),
55+
('other', 'Other')
56+
])
57+
58+
favorite_subject = SelectField('What is your favorite school subject?', choices=[
59+
('Natural sciences', 'Natural sciences'),
60+
('mathematics', 'Mathematics'),
61+
('languages', 'Languages'),
62+
('social sciences', 'Social sciences'),
63+
('other', 'Other')
64+
])
65+
66+
social_time = RadioField('How much time do you spend on social media/games daily?', choices=[
67+
('under_1', 'Less than 1 hour'),
68+
('1_3', '1–3 hours'),
69+
('over_3', 'More than 3 hours')
70+
])
71+
72+
video_platforms = MultiCheckboxField('Which platforms do you use most for video lessons?', choices=[
73+
('youtube', 'YouTube'),
74+
('ucha_se', 'Ucha.se'),
75+
('khan', 'Khan Academy'),
76+
('online_school', 'Online School')
77+
])
78+
79+
video_helpful = RadioField('Do video lessons help you understand the material better?', choices=[
80+
('very', 'Very much'),
81+
('somewhat', 'Somewhat'),
82+
('not_much', 'Not really'),
83+
('not_at_all', 'Not at all')
84+
])
85+
86+
lesson_quality = MultiCheckboxField('What are the most important qualities of a good video lesson?', choices=[
87+
('short_clear', 'Short and clear'),
88+
('examples', 'With examples and exercises'),
89+
('visuals', 'With visuals and animations'),
90+
('slow_clear', 'Explained slowly and clearly')
91+
])
92+
93+
ideal_length = RadioField('What is the ideal length of a video lesson?', choices=[
94+
('under_5', 'Less than 5 minutes'),
95+
('5_10', '5–10 minutes'),
96+
('10_20', '10–20 minutes'),
97+
('doesnt_matter', 'Doesn’t matter as long as it’s useful')
98+
])
99+
100+
videos_for_tests = RadioField('Do you watch video lessons when preparing for tests?', choices=[
101+
('always', 'Always'),
102+
('sometimes', 'Sometimes'),
103+
('only_if_needed', 'Only if I don’t understand'),
104+
('never', 'Never')
105+
])
106+
107+
review_before_class = RadioField('How often do you review lessons before class?', choices=[
108+
('always', 'Always'),
109+
('sometimes', 'Sometimes'),
110+
('never', 'Never')
111+
])
112+
113+
submit = SubmitField('Submit')
114+
115+
116+
class SettingsForm(FlaskForm):
117+
username = StringField('Username', validators=[DataRequired()])
118+
email = StringField('Email', validators=[DataRequired(), Email()])
119+
current_password = PasswordField('Current Password', validators=[Optional()])
120+
new_password = PasswordField('New Password', validators=[Optional()])
121+
confirm_password = PasswordField('Confirm New Password', validators=[
122+
Optional(),
123+
EqualTo('new_password', message='Passwords must match')
124+
])
125+
submit = SubmitField('Save Changes')
126+
class VideoSubmissionForm(FlaskForm):
127+
video_link = StringField('Video Link', validators=[
128+
DataRequired(), URL(), Length(max=500)
129+
])
130+
submit = SubmitField('Submit')

0 commit comments

Comments
 (0)