From a902b4ca1c28581571f5d373998ea88e70718596 Mon Sep 17 00:00:00 2001
From: Aditya <aditya2041999@gmail.com>
Date: Sat, 29 May 2021 16:25:25 +0530
Subject: [PATCH 1/4] fixed

---
 app/models/submission.js                                   | 2 +-
 app/pods/components/submissions-heat-map-view/component.js | 2 +-
 app/pods/components/submissions-heat-map-view/template.hbs | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/models/submission.js b/app/models/submission.js
index 049478fc..b9feca03 100644
--- a/app/models/submission.js
+++ b/app/models/submission.js
@@ -16,7 +16,7 @@ export default Model.extend({
   explanation: DS.attr(),
   is_top_submission: DS.attr(),
   plagiarism_detected: DS.attr(),
-  content: DS.belongsTo('content'),
+  content: DS.belongsTo('content', { inverse: null }),
   contest: DS.belongsTo('contest'),
   user: DS.belongsTo('user'),
   createdAt: DS.attr(),
diff --git a/app/pods/components/submissions-heat-map-view/component.js b/app/pods/components/submissions-heat-map-view/component.js
index d60c288b..ecdb6140 100644
--- a/app/pods/components/submissions-heat-map-view/component.js
+++ b/app/pods/components/submissions-heat-map-view/component.js
@@ -27,7 +27,7 @@ export default class SubmissionHeatMapComponent extends Component {
       },
       date: this.date,
       user_id: this.userId,
-      include: 'problem,contest',
+      include: 'problem,contest,content',
       exclude: 'problem.*,user.*,contest.*',
       page: this.page
     })
diff --git a/app/pods/components/submissions-heat-map-view/template.hbs b/app/pods/components/submissions-heat-map-view/template.hbs
index 4d0a2605..f889935b 100644
--- a/app/pods/components/submissions-heat-map-view/template.hbs
+++ b/app/pods/components/submissions-heat-map-view/template.hbs
@@ -23,7 +23,7 @@
         <tbody>
           {{#each submissions as |submission|}}
           <tr>
-            <td class="py-3">{{submission.problem.name}}</td>
+            <td class="py-3">{{submission.content.name}}</td>
             <td class="py-3">{{submission.score}}</td>
             <td class="py-3">{{submission.language}}</td>
             <td class="py-3">{{moment-from submission.createdAt}}</td>

From a6e83d328a97054a8d708e57a02b9a0660d4fc54 Mon Sep 17 00:00:00 2001
From: Aditya <aditya2041999@gmail.com>
Date: Sat, 29 May 2021 19:56:19 +0530
Subject: [PATCH 2/4] fixed: relation of content and submission model

---
 app/models/content.js    | 1 +
 app/models/submission.js | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/models/content.js b/app/models/content.js
index 899b16c2..b0d3aba6 100644
--- a/app/models/content.js
+++ b/app/models/content.js
@@ -12,6 +12,7 @@ export default Model.extend({
   quiz: DS.belongsTo('quiz'),
   project: DS.belongsTo('project'),
   contest: DS.hasMany('contest'),
+  submission:DS.hasMany('submission'),
   bookmarkedContent: DS.belongsTo('bookmarked-content'),
   topSubmission: DS.belongsTo('submission'),
   progress: DS.belongsTo('progress'),
diff --git a/app/models/submission.js b/app/models/submission.js
index b9feca03..76b5a978 100644
--- a/app/models/submission.js
+++ b/app/models/submission.js
@@ -16,7 +16,7 @@ export default Model.extend({
   explanation: DS.attr(),
   is_top_submission: DS.attr(),
   plagiarism_detected: DS.attr(),
-  content: DS.belongsTo('content', { inverse: null }),
+  content: DS.belongsTo('content', { inverse: 'submission' }),
   contest: DS.belongsTo('contest'),
   user: DS.belongsTo('user'),
   createdAt: DS.attr(),

From f639855c2e09fe5267176ede882cbcf95e648899 Mon Sep 17 00:00:00 2001
From: Aditya <aditya2041999@gmail.com>
Date: Sat, 29 May 2021 20:04:09 +0530
Subject: [PATCH 3/4] fixed:naming

---
 app/models/content.js    | 2 +-
 app/models/submission.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/models/content.js b/app/models/content.js
index b0d3aba6..4181a053 100644
--- a/app/models/content.js
+++ b/app/models/content.js
@@ -12,7 +12,7 @@ export default Model.extend({
   quiz: DS.belongsTo('quiz'),
   project: DS.belongsTo('project'),
   contest: DS.hasMany('contest'),
-  submission:DS.hasMany('submission'),
+  submissions:DS.hasMany('submission'),
   bookmarkedContent: DS.belongsTo('bookmarked-content'),
   topSubmission: DS.belongsTo('submission'),
   progress: DS.belongsTo('progress'),
diff --git a/app/models/submission.js b/app/models/submission.js
index 76b5a978..057e867c 100644
--- a/app/models/submission.js
+++ b/app/models/submission.js
@@ -16,7 +16,7 @@ export default Model.extend({
   explanation: DS.attr(),
   is_top_submission: DS.attr(),
   plagiarism_detected: DS.attr(),
-  content: DS.belongsTo('content', { inverse: 'submission' }),
+  content: DS.belongsTo('content', { inverse: 'submissions' }),
   contest: DS.belongsTo('contest'),
   user: DS.belongsTo('user'),
   createdAt: DS.attr(),

From af4bd179fe3636724a83f86164aab65cb43fafd4 Mon Sep 17 00:00:00 2001
From: Aditya <aditya2041999@gmail.com>
Date: Sat, 29 May 2021 22:08:58 +0530
Subject: [PATCH 4/4] fixed: pagination and optimization

---
 app/pods/components/submissions-heat-map-view/component.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/pods/components/submissions-heat-map-view/component.js b/app/pods/components/submissions-heat-map-view/component.js
index ecdb6140..44dd62b1 100644
--- a/app/pods/components/submissions-heat-map-view/component.js
+++ b/app/pods/components/submissions-heat-map-view/component.js
@@ -27,8 +27,8 @@ export default class SubmissionHeatMapComponent extends Component {
       },
       date: this.date,
       user_id: this.userId,
-      include: 'problem,contest,content',
-      exclude: 'problem.*,user.*,contest.*',
+      include: 'content',
+      exclude: 'user.*,content.*',
       page: this.page
     })
     this.set('submissions', submissions)
