Skip to content

Commit

Permalink
Merge pull request #53 from ooemperor/dev
Browse files Browse the repository at this point in the history
Performance Tuning and minor bug fixes
  • Loading branch information
ooemperor authored May 23, 2024
2 parents 2a44f18 + 2710b14 commit 1fe3550
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
3 changes: 3 additions & 0 deletions codeGrader/backend/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ def addSubmission() -> dict:


@app.route("/submission/<int:id_>", methods=["GET"])
@cache.memoize(config.cache_timeout, unless=cache_bypass)
@authentication
def submission(id_) -> dict:
"""
Expand All @@ -551,6 +552,7 @@ def submission(id_) -> dict:


@app.route("/submissions", methods=['GET'])
@cache.cached(config.cache_timeout, unless=cache_bypass, query_string=True)
@authentication
def submissions() -> dict:
"""
Expand Down Expand Up @@ -594,6 +596,7 @@ def testcase(id_) -> dict:


@app.route("/testcases", methods=['GET'])
@cache.cached(config.cache_timeout, unless=cache_bypass, query_string=True)
@authentication
def testcases() -> dict:
"""
Expand Down
2 changes: 1 addition & 1 deletion codeGrader/backend/db/Exercise.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Exercise(Base):
passive_deletes=True,
lazy="subquery",
join_depth=3,
backref=backref("TaskExercise", lazy="joined", join_depth=3)
backref=backref("TaskExercise", lazy="subquery", join_depth=3)
)

def get_profile(self):
Expand Down
5 changes: 3 additions & 2 deletions codeGrader/backend/db/Subject.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ class Subject(Base):
cascade="all",
passive_deletes=True,
lazy="subquery",
backref=backref("ExerciseSubject", lazy="joined")
join_depth=1,
backref=backref("ExerciseSubject", lazy="joined", join_depth=1)
)

memberships = relationship(
Expand All @@ -83,7 +84,7 @@ class Subject(Base):
cascade="all",
passive_deletes=True,
lazy="noload",
backref=backref("MembershipSubject", lazy="joined", join_depth=3)
backref=backref("MembershipSubject", lazy="joined", join_depth=2)
)

def get_profile(self) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion codeGrader/backend/db/Task.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class Task(Base):
cascade="all",
passive_deletes=True,
lazy="subquery",
backref=backref("TaskTestCase", lazy="subquery")
backref=backref("TaskTestCase", lazy="noload")
)

def get_profile(self) -> dict:
Expand Down
4 changes: 2 additions & 2 deletions codeGrader/backend/db/TestCase.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ def toJson(self, recursive: bool = True) -> dict:

out = dict()
out["id"] = self.id
out["task"] = self.TaskTestCase.toJson()
out["task_id"] = out["task"]["id"]
#out["task"] = self.TaskTestCase.toJson()
out["task_id"] = self.task_id
out["input_file"] = self.input_file.toJson(include_binary=False)
out["input_file_id"] = self.input_file.id
out["output_file"] = self.output_file.toJson(include_binary=False)
Expand Down
2 changes: 1 addition & 1 deletion codeGrader/frontend/admin/templates/task.html
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ <h2 class="accordion-header">
</th>
</tr>

{% for sub in submissions | sort(attribute='id') %}
{% for sub in submissions | sort(reverse=true, attribute='id') %}
<tr>
<td>
{{ sub["id"] }}
Expand Down

0 comments on commit 1fe3550

Please sign in to comment.