Skip to content
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

Fix assign teachers #45

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions course.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@ def search_teachers():
if not validate_string_pattern(search_term):
return make_response("Invalid search term", 400)

teachers = db.session.query(User).join(Teacher).filter(
User.active == True,
User.name.ilike(f'%{search_term}%')
).all()
teachers = db.session.query(User).filter(User.active == True, User.is_teacher == True,
User.name.ilike(f'%{search_term}%')).all()
SamuelVch98 marked this conversation as resolved.
Show resolved Hide resolved
results = [{'id': teacher.id, 'text': f'{teacher.name} {teacher.first_name}'} for teacher in teachers]
return jsonify(results)

Expand Down
17 changes: 1 addition & 16 deletions templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,6 @@
<div id="content">
{% block pagecontent %}{% endblock %}
</div>
{% block additionalfooter %}
<script>
$(document).ready(function () {
$('#confirmationModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);

var message = button.data('message');
var url = button.data('url');

var modal = $(this);
modal.find('.modal-body').text(message);
modal.find('#confirmationForm').attr('action', url);
});
});
</script>
{% endblock %}
{% block additionalfooter %}{% endblock %}
</body>
</html>
2 changes: 0 additions & 2 deletions user.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ def user_profile(user_id, current_year):
if researcher:
preferences = db.session.query(PreferenceAssignment).filter_by(researcher_id=researcher.id,
course_year=current_year).all()

courses = []
if current_user and requested_user.organization:
courses = db.session.query(Course).filter(Course.year == current_year,
Expand Down Expand Up @@ -201,7 +200,6 @@ def update_user_profile(user_id):
user.organization_id = organization_code
user.is_admin = is_admin
user.is_teacher = is_teacher
user.is_researcher = is_researcher
if is_researcher:
if researcher is None:
create_researcher(user.id, researcher_type, max_loads)
Expand Down