Skip to content

Commit 5fdae05

Browse files
committed
Revert "Merge pull request #158 from SPARSH1608/mysql"
This reverts commit 9d34110, reversing changes made to bd19df5.
1 parent 9d34110 commit 5fdae05

File tree

14 files changed

+54
-138
lines changed

14 files changed

+54
-138
lines changed

app/helpers/json-to-table.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

app/pods/components/code-editor-component/template.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
</div>
1919
{{/if}}
2020
<SubmissionResult
21-
@allowedLanguages={{contest.allowedLanguages}}
2221
@fullScreen={{fullScreen}}
2322
@judgeResult={{if (not submission.codeTaskGroup.isRunning) lastResult}} />
2423
</div>

app/pods/components/code-window/component.js

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import Component from '@ember/component';
22
import { action, computed } from '@ember/object';
3-
import { inject as service } from '@ember/service';
43

54
export default class CodeWindowComponent extends Component {
6-
@service('language-selection') languageSelection;
7-
85
isLanguageSelectOpen = false
96
customInputOpen = true
107
customInput = ''
@@ -51,15 +48,9 @@ export default class CodeWindowComponent extends Component {
5148
code: "csharp",
5249
mode: "csharp",
5350
source: ""
54-
},
55-
{
56-
name: "MySQL 10",
57-
code: "mysql",
58-
mode: "mysql",
59-
source: ""
6051
}
6152
]
62-
53+
6354
setSubmission = () => {
6455
this.set('selectedLanguage', this.languageSpecs.find(spec => spec.code === this.submission.language))
6556
this.set('selectedLanguage.source', window.atob(this.submission.solution.source))
@@ -89,10 +80,11 @@ export default class CodeWindowComponent extends Component {
8980

9081
@action
9182
selectLanguage(languageCode) {
92-
let selectedLanguage = this.languageSpecs.find((spec) => spec.code === languageCode);
93-
this.set('selectedLanguage', selectedLanguage);
94-
this.languageSelection.set('selectedLanguage', selectedLanguage);
95-
this.trigger("restoreCodeFromStorage");
83+
// console.log(languageCode)
84+
this.set('selectedLanguage', this.get('languageSpecs').find((spec) => {
85+
return spec.code === languageCode
86+
}))
87+
this.trigger("restoreCodeFromStorage")
9688
}
9789

9890
@action
Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
11
import Component from '@ember/component';
2-
import { inject as service } from '@ember/service';
3-
import {jsonToTable} from '../../../util/json-to-table'
42

53
export default Component.extend({
6-
languageSelection: service('language-selection'),
7-
8-
init() {
9-
this._super(...arguments);
10-
let contest = this.get('contest');
11-
},
12-
jsonToTable(data) {
13-
const table = jsonToTable(data);
14-
return table;
15-
}
164
});
Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,33 @@
1-
2-
31
<div class="py-4">
4-
<p>{{markdown-to-html problem.details.description}}</p>
5-
2+
<p>
3+
{{markdown-to-html problem.details.description}}
4+
</p>
65
<div class="extra-bold">Input Format</div>
7-
8-
<pre>{{problem.details.input_format}}</pre>
9-
10-
6+
<p>
7+
{{markdown-to-html problem.details.input_format}}
8+
</p>
119
<div class="extra-bold">Constraints</div>
1210
<div class="bg-grey br-5 w-60 px-4 py-2 my-2">
13-
<p>{{markdown-to-html problem.details.constraints}}</p>
11+
<p>
12+
{{markdown-to-html problem.details.constraints}}
13+
</p>
1414
</div>
15-
1615
<div class="extra-bold">Output Format</div>
17-
<pre>{{problem.details.output_format}}</pre>
16+
<p>
17+
{{markdown-to-html problem.details.output_format}}
18+
</p>
1819
<div class="extra-bold">Sample Input</div>
1920
<div class="bg-grey br-5 w-60 px-4 py-2 my-2">
20-
<pre>{{ problem.details.sample_input}}</pre>
21+
<pre>{{problem.details.sample_input}}</pre>
2122
</div>
22-
2323
<div class="extra-bold">Sample Output</div>
2424
<div class="bg-grey br-5 w-60 px-4 py-2 my-2">
25-
{{#if (includes contest.allowedLanguages "mysql")}}
26-
<pre>{{json-to-table problem.details.sample_output}}</pre>
27-
{{else}}
2825
<pre>{{problem.details.sample_output}}</pre>
29-
{{/if}}
30-
3126
</div>
32-
3327
{{#if problem.details.explanation}}
3428
<div class="extra-bold">Explanation</div>
3529
<div class="bg-grey br-5 w-60 px-4 py-2 my-2">
3630
{{markdown-to-html problem.details.explanation}}
3731
</div>
3832
{{/if}}
39-
</div>
33+
</div>

app/pods/components/problem-view/template.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
{{#liquid-if (eq selectedTab "problem")}}
3535
<ProblemExplanation
36-
@problem={{problem}} @contest={{contest}} />
36+
@problem={{problem}} />
3737
{{else if (eq selectedTab "submissions")}}
3838
<SubmissionsList
3939
@contest={{contest}}

app/pods/components/project-view/template.hbs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,9 @@
5757
{{/if}}
5858
</div>
5959
</div>
60-
6160
{{#if (or submitProjectTask.isRunning lastResult)}}
6261
<div class="mt-4">
6362
<SubmissionResult
64-
@allowedLanguages={{contest.allowedLanguages}}
6563
@contentType={{content.type}}
6664
@judgeResult={{if (not submitProjectTask.isRunning) lastResult}}
6765
/>

app/pods/components/run-result/component.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ import { computed } from '@ember/object';
44
export default class RunResultComponent extends Component {
55
didRender() {
66
this.element.scrollIntoView({behavior: "smooth", block: "end" })
7-
87
}
98

109
@computed('judgeResult')
1110
get output() {
12-
1311
if (this.judgeResult.data){
1412
return window.atob(this.judgeResult.data.output)
1513
} else if (this.judgeResult.error) {
Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,44 @@
11
import Component from '@ember/component';
22
import { computed } from '@ember/object';
3-
import { jsonToTable } from '../../../util/json-to-table';
4-
5-
export default Component.extend({
63

4+
export default class SubmissionResult extends Component {
75
didRender() {
8-
this._super(...arguments);
9-
this.element.scrollIntoView({ behavior: "smooth", block: "end" });
10-
},
6+
this.element.scrollIntoView({ behavior: "smooth", block: "end" })
7+
}
118

12-
isRunning: computed('judgeResult', function() {
13-
return !this.get('judgeResult');
14-
}),
9+
@computed('judgeResult')
10+
get isRunning() {
11+
return !this.judgeResult
12+
}
1513

16-
isErrored: computed('judgeResult', function() {
17-
return !!this.get('judgeResult')?.stderr;
18-
}),
14+
@computed('judgeResult')
15+
get isErrored() {
16+
return !!this.judgeResult.stderr
17+
}
1918

20-
isSubmission: computed('judgeResult', function() {
21-
return !!this.get('judgeResult')?.testcases;
22-
}),
19+
@computed('judgeResult')
20+
get isSubmission() {
21+
return !!(this.judgeResult.testcases)
22+
}
2323

24-
errorPayload: computed('isErrored', function() {
25-
if (this.get('isErrored')) {
26-
return window.atob(this.get('judgeResult')?.stderr || this.get('judgeResult')?.stdout);
24+
@computed('isErrored')
25+
get errorPayload() {
26+
if (this.isErrored) {
27+
return window.atob(this.judgeResult.stderr || this.judgeResult.stdout)
2728
}
28-
}),
29-
30-
output: computed('isSubmission', function() {
31-
if (!this.get('isSubmission')) {
32-
const output = window.atob(this.get('judgeResult')?.stdout);
29+
}
3330

34-
return output;
31+
@computed('isSubmission')
32+
get output() {
33+
if (!this.isSubmission) {
34+
return window.atob(this.judgeResult.stdout)
3535
}
36-
}),
36+
}
3737

38-
testcasesPayload: computed('isSubmission', function() {
39-
if (this.get('isSubmission')) {
40-
return this.get('judgeResult')?.testcases;
38+
@computed('isSubmission')
39+
get testcasesPayload() {
40+
if (this.isSubmission) {
41+
return this.judgeResult.testcases
4142
}
42-
}),
43-
44-
jsonToTable(data) {
45-
const table = jsonToTable(data);
46-
return table;
4743
}
48-
});
44+
}

app/pods/components/submission-result/submission-success/template.hbs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
<span class="font-sm bold">
33
Compilation Successful
44
</span>
5-
65
{{#if output}}
7-
{{#if (includes allowedLanguages "mysql")}}
8-
<pre class="mt-3 bg-grey p-4">{{json-to-table output}}</pre>
9-
{{else}}
10-
<pre class="mt-3 bg-grey p-4">{{output}}</pre>
11-
{{/if}}
6+
<pre class="mt-3 bg-grey p-4">{{output}}</pre>
127
{{/if}}
138
</div>
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
<div class="{{unless fullScreen "border-card mb-5"}} p-0">
2-
3-
42
{{#if isRunning}}
53
<SubmissionResult::SubmissionStatus />
64
{{else if isErrored}}
75
<SubmissionResult::SubmissionError @output={{errorPayload}} />
86
{{else if isSubmission}}
97
<SubmissionResult::SubmissionTestcases @testcases={{testcasesPayload}} />
108
{{else}}
11-
<SubmissionResult::SubmissionSuccess
12-
@message={{message}}
13-
@output={{output}}
14-
@allowedLanguages={{allowedLanguages}}
15-
/>
16-
9+
<SubmissionResult::SubmissionSuccess @message={{message}} @output={{output}} />
1710
{{/if}}
1811
</div>

app/services/language-selection.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

app/util/json-to-table.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

config/environment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@ module.exports = function (environment) {
101101
ENV.apiHost + "/api/v2/jwt/refresh/";
102102

103103
return ENV;
104-
};
104+
};

0 commit comments

Comments
 (0)