Skip to content

Commit

Permalink
Merge branch 'project-issues' into project-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JarneClauw committed May 23, 2024
2 parents c79623f + 1b0fc8f commit 0a108be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 0 additions & 4 deletions backend/project/endpoints/projects/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ def get(self, uid=None):
courses_student = [c[0] for c in courses_student]
# Filter the projects based on the query parameters
filters = dict(request.args)
invalid_filters = set(filters.keys()) - {"project_id", "title", "course_id"}
if invalid_filters:
data["message"] = f"Invalid query parameters {invalid_filters}"
return data, 400
conditions = []
for key, value in filters.items():
if key in Project.__table__.columns:
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/utils/fetches/FetchProjects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import {
ProjectDeadline,
ShortSubmission,
} from "../../pages/project/projectDeadline/ProjectDeadline.tsx";
import { Me } from "../../types/me.ts";
const API_URL = import.meta.env.VITE_APP_API_HOST;

export const fetchProjectPage = async () => {
const projects = await fetchProjects();
const me = await fetchMe();
const projects = await fetchProjects(me);
return { projects, me };
};

export const fetchProjects = async () => {
export const fetchProjects = async (me: Me) => {
try {
const response = await authenticatedFetch(`${API_URL}/projects`);
const jsonData = await response.json();
Expand All @@ -24,7 +25,7 @@ export const fetchProjects = async () => {
const project_id = url_split[url_split.length - 1];
const response_submissions = await (
await authenticatedFetch(
encodeURI(`${API_URL}/submissions?project_id=${project_id}`)
encodeURI(`${API_URL}/submissions?project_id=${project_id}&uid=${me.uid}`)
)
).json();

Expand Down

0 comments on commit 0a108be

Please sign in to comment.