Skip to content

Commit 1fe3550

Browse files
authored
Merge pull request #53 from ooemperor/dev
Performance Tuning and minor bug fixes
2 parents 2a44f18 + 2710b14 commit 1fe3550

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

codeGrader/backend/api/app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ def addSubmission() -> dict:
537537

538538

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

552553

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

595597

596598
@app.route("/testcases", methods=['GET'])
599+
@cache.cached(config.cache_timeout, unless=cache_bypass, query_string=True)
597600
@authentication
598601
def testcases() -> dict:
599602
"""

codeGrader/backend/db/Exercise.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Exercise(Base):
7878
passive_deletes=True,
7979
lazy="subquery",
8080
join_depth=3,
81-
backref=backref("TaskExercise", lazy="joined", join_depth=3)
81+
backref=backref("TaskExercise", lazy="subquery", join_depth=3)
8282
)
8383

8484
def get_profile(self):

codeGrader/backend/db/Subject.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ class Subject(Base):
7272
cascade="all",
7373
passive_deletes=True,
7474
lazy="subquery",
75-
backref=backref("ExerciseSubject", lazy="joined")
75+
join_depth=1,
76+
backref=backref("ExerciseSubject", lazy="joined", join_depth=1)
7677
)
7778

7879
memberships = relationship(
@@ -83,7 +84,7 @@ class Subject(Base):
8384
cascade="all",
8485
passive_deletes=True,
8586
lazy="noload",
86-
backref=backref("MembershipSubject", lazy="joined", join_depth=3)
87+
backref=backref("MembershipSubject", lazy="joined", join_depth=2)
8788
)
8889

8990
def get_profile(self) -> dict:

codeGrader/backend/db/Task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class Task(Base):
108108
cascade="all",
109109
passive_deletes=True,
110110
lazy="subquery",
111-
backref=backref("TaskTestCase", lazy="subquery")
111+
backref=backref("TaskTestCase", lazy="noload")
112112
)
113113

114114
def get_profile(self) -> dict:

codeGrader/backend/db/TestCase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ def toJson(self, recursive: bool = True) -> dict:
104104

105105
out = dict()
106106
out["id"] = self.id
107-
out["task"] = self.TaskTestCase.toJson()
108-
out["task_id"] = out["task"]["id"]
107+
#out["task"] = self.TaskTestCase.toJson()
108+
out["task_id"] = self.task_id
109109
out["input_file"] = self.input_file.toJson(include_binary=False)
110110
out["input_file_id"] = self.input_file.id
111111
out["output_file"] = self.output_file.toJson(include_binary=False)

codeGrader/frontend/admin/templates/task.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ <h2 class="accordion-header">
451451
</th>
452452
</tr>
453453

454-
{% for sub in submissions | sort(attribute='id') %}
454+
{% for sub in submissions | sort(reverse=true, attribute='id') %}
455455
<tr>
456456
<td>
457457
{{ sub["id"] }}

0 commit comments

Comments
 (0)