Skip to content

Commit

Permalink
Merge pull request #68 from Novacer/fix-compile-error
Browse files Browse the repository at this point in the history
Fix compile errors not being handled correctly in build algo
  • Loading branch information
Novacer committed Oct 21, 2019
2 parents b8d5af4 + 78b8c20 commit 03d9fcf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Expand Up @@ -30,7 +30,9 @@ def log(msg):
if len(byte_code.errors) != 0:
log('COMPILE ERROR =====')
for error in byte_code.errors:
log(error)
formatted_error = error.replace('"', "'")
log(formatted_error)
logger.close()
return {
'done': True,
'success': False,
Expand Down
2 changes: 1 addition & 1 deletion frontend/angular-src/src/app/graph/graph.component.html
Expand Up @@ -31,7 +31,7 @@ <h4>{{ finalAlpha }}</h4>
</canvas>
</div>

<ng-container *ngIf="!done">
<ng-container *ngIf="!done && !failed">
<div class="spinner">
<mat-spinner></mat-spinner>
</div>
Expand Down
11 changes: 9 additions & 2 deletions frontend/angular-src/src/app/graph/graph.component.ts
Expand Up @@ -44,6 +44,7 @@ export class GraphComponent implements OnInit, OnDestroy {
private code: string;

public done: boolean;
public failed: boolean;
public finalAlpha: number;

private xaxis: string[];
Expand All @@ -63,6 +64,7 @@ export class GraphComponent implements OnInit, OnDestroy {
private editor: EditorService,
private scroll: ScrollToService) {
this.done = false;
this.failed = false;
this.logChannel = null;
this.xaxis = [];
this.dataset1 = [];
Expand Down Expand Up @@ -213,8 +215,7 @@ export class GraphComponent implements OnInit, OnDestroy {
else if (this.type === 'custom') {

this.log = this.log.concat('Sending code for compilation, fingers crossed it works!', '\n',
`Trying to execute between ${this.start} to ${this.end}`, '\n',
'If it takes a long time it probably failed (no failure msg yet) :(', '\n');
`Executing backtest between ${this.start} to ${this.end}`, '\n');

this.extractDataFromAPI(
this.editor.executeSrcCode(this.code, this.capitalBase, this.start, this.end, this.logChannel)
Expand Down Expand Up @@ -247,6 +248,12 @@ export class GraphComponent implements OnInit, OnDestroy {
return;
} else if (!response.done) {
return;
} else if (response.hasOwnProperty('success') && !response.success) {
this.failed = true;
if (this.ws) {
this.ws.close();
}
return;
} else {

if (this.subscription) this.subscription.unsubscribe();
Expand Down

0 comments on commit 03d9fcf

Please sign in to comment.