Commit 7d0c1029 authored by Ayush's avatar Ayush

Minor bugfix

parent 97b3e363
......@@ -24,13 +24,13 @@ $input_data = $postData['input_data'];
$ret_stat = 0;
$template = strval(rand(1, 1000000));
$in_fname = "../user_execs/" . $uname . "/temp/temp_in" . $template;
$in_fname = "../user_execs/" . $uname . "//temp_sfcode_139213617964/temp_in" . $template;
$file = fopen($in_fname, 'w');
file_put_contents($in_fname, $input_data);
fclose($file);
$out_fname = "../user_execs/" . $uname . "/temp/temp_out" . $template;
$out_fname = "../user_execs/" . $uname . "//temp_sfcode_139213617964/temp_out" . $template;
if (strcmp($language, ".cpp") == 0) {
system("./../user_execs/" . $uname . "/" . $f_path . "/" . $filename . " < " . $in_fname . " > " . $out_fname, $ret_stat);
......
......@@ -35,7 +35,7 @@ if (isset($postData) && !empty($postData)) {
'username' => $username
];
mkdir('../users/' . $authData['username'], 0777, true);
mkdir('../user_execs/' . $authData['username'] . "/temp", 0777, true);
mkdir('../user_execs/' . $authData['username'] . "/temp_sfcode_139213617964", 0777, true);
$mysqli->query($sql1);
echo json_encode($authData);
}
......
......@@ -13,4 +13,4 @@
<textarea id="editor" name="editor"></textarea>
</div>
<app-input (valueEmit)="customInput = $event"></app-input>
<!-- <app-submit-try-code [problem]="problem"></app-submit-try-code> -->
<app-submit-try-code [problem]="question"></app-submit-try-code>
......@@ -33,8 +33,9 @@ export class RunCodeService {
// else {return throwError('error'); }
// }
tryTestcase(prob: Problem, index: number): Observable<boolean> {
return of(Math.floor(Math.random() * 2) === 1);
tryTestcase(prob: Question, index: number): Observable<boolean> {
// return of(Math.floor(Math.random() * 2) === 1);
}
compileQuestionFile(ques: Question, code: string[]): Observable<any> {
......
import {Component, Input, OnInit} from '@angular/core';
import {Problem} from '../problem';
// import {Problem} from '../problem';
import {RunCodeService} from '../run-code.service';
import {Question} from '../question';
@Component({
selector: 'app-submit-try-code',
......@@ -12,7 +13,7 @@ export class SubmitTryCodeComponent implements OnInit {
isActive = false;
nts: number[];
status: number[];
@Input() problem: Problem;
@Input() problem: Question;
submitting = 0;
constructor(public runCodeService: RunCodeService) { }
......@@ -20,8 +21,8 @@ export class SubmitTryCodeComponent implements OnInit {
ngOnInit(): void { }
reset(): void {
this.nts = Array(this.problem.n_testcases[this.submitting]).fill(1).map((x, i) => i);
this.status = Array(this.problem.n_testcases[this.submitting]).fill(0);
this.nts = [0, 1]; //Array(this.problem.n_testcases[this.submitting]).fill(1).map((x, i) => i);
this.status = [0, 0]; // Array(this.problem.n_testcases[this.submitting]).fill(0);
for (const i of this.nts) {
this.runCodeService.tryTestcase(this.problem, i)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment