Skip to content

Commit 22ef056

Browse files
author
Jon Myrick
authored
Merge pull request CodewarsClone#91 from CodewarsClone/output
Output
2 parents 18dd5d9 + 123d5fb commit 22ef056

9 files changed

Lines changed: 84 additions & 46 deletions

File tree

gulpfile.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ var cachebust = new CacheBuster();
2121
const paths = {
2222
jsSource: ['./src/components/**/*.js', './src/components/*.js'],
2323
cssFiles: './src/**/*.css',
24-
// indexFiles: './src/index.html',
24+
indexFile: './src/index.html',
2525
scssFiles: './src/**/**/*.scss',
26-
// index: './src/index.html',
27-
// htmlFiles: './src/**/*.html',
26+
htmlFiles: './src/**/*.html',
2827
dist: './src/dist',
2928
};
3029

src/components/mainService.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,20 @@ angular.module('app').service('mainService', function($http, $q, $sce) {
1212
this.testExamples = (solution, examples) => {
1313
return $http({
1414
method: 'POST',
15-
url: `/api/test/examples`,
15+
url: `http://192.168.0.186:3030/api/test/examples`,
1616
data: {
1717
script: solution,
1818
examples: examples
1919
}
2020
});
2121
};
2222

23+
// 192.168.0.186:3030
24+
2325
this.testSuite = (solution, kataid) => {
2426
return $http({
2527
method: 'POST',
26-
url: `/api/test/suite/${kataid}`,
28+
url: `http://192.168.0.186:3030/api/test/suite/${kataid}`,
2729
data: {
2830
script: solution
2931
}

src/components/menus/menu.html

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,20 @@
3737
<br>
3838
</ul>
3939
</div>
40-
<div class="top-menu">
41-
<ul class='ul-top'>
42-
<li>
43-
<div class='li65'><img src='./assets/imgs/asset_30.png' class='li65-img'></div>
44-
</li>
45-
<li>
46-
<div class='li65'><img src='./assets/imgs/asset_31.png' class='li65-img'></div>
47-
</li>
48-
<li class='li170'>
49-
<li>{{userPic}}</li>
50-
<li>kyu</li>
51-
<li>lvl</li>
52-
</li>
53-
</ul>
54-
</div>
55-
<main>
56-
<ui-view class='main-div'></ui-view>
57-
</main>
58-
</div>
40+
<!--~~~~~~~~~~~~ TOP MENU ~~~~~~~~~~~~~~~~~-->
41+
<div class="top-menu">
42+
<div class='ul-top'>
43+
<div class='li65'><img src='./assets/imgs/asset_30.png' class='li65-img'></div>
44+
<div class='li65'><img src='./assets/imgs/asset_31.png' class='li65-img'></div>
45+
<div class='li170'>
46+
<img src='{{userPic}}' class='li170-img'>
47+
<div>{{userKyu}}</div>
48+
<div>{{userPoints}}</div>
49+
</div>
50+
</div>
51+
</div>
52+
</div>
53+
<main>
54+
<ui-view class='main-div'></ui-view>
55+
</main>
56+
</div>

src/components/menus/menu.scss

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ $grey-color: #C0C0C0;
4141
background-color: $sidebar-color;
4242
height: 100vh;
4343
width: 55px;
44+
padding: 5px 0 0 0;
4445
float: left;
4546
position: fixed;
4647
left: 0;
@@ -109,30 +110,39 @@ $grey-color: #C0C0C0;
109110

110111

111112
.li65 {
112-
width: 65px;
113+
width: 65px;
114+
margin:auto;
115+
display: flex;
116+
justify-content: center;
113117
}
114118

115119

116120

117121
.li65-img {
118-
margin: auto;
119-
vertical-align: center;
120-
height: 25px;
122+
margin:auto;
123+
vertical-align: center;
124+
height: 25px;
125+
align-self:center;
121126
}
122127

123128

124129

125130
.li170 {
126-
width: 170px;
127-
display: flex;
128-
flex-direction: row;
129-
justify-content: space-around;
131+
width: 170px;
132+
display: flex;
133+
flex-direction: row;
134+
margin: auto;
135+
justify-content: center;
130136
}
131137

132138

133139

134140
.li170-img {
135-
vertical-align: center;
141+
vertical-align: center;
142+
height: 40px;
143+
border-radius: 10px;
144+
margin: 5px auto;
145+
align-self: center;
136146
}
137147

138148

src/components/menus/menuCtrl.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
angular.module('app').controller('menuCtrl', function($scope, $state, mainService, $stateParams){
2+
$scope.userPic = mainService.user.picture_url;
3+
$scope.userKyu = mainService.user.kyu_level;
4+
// $scope.userPoints = mainService.user.points;
25
});
Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
2-
<h2 class="font20-reg">Output</h2><br>
3-
<p class="font14-reg">Time: {{time}}</p>
4-
<div>
5-
<div class='font20-reg' ng-repeat="test in output">
6-
<p>This is the output.</p><br>
7-
8-
<p class="font14-lit-gray">{{test.test}}</p>
9-
<p class="font14-lit-gray">{{test.result}}</p>
1+
<div>
2+
<p class="font14-reg">Time: {{time}} <span class='pass'> Passed: </span>{{testPass}} <span class='fail'> Failed: </span>{{testFail}} </p>
3+
<div class="font14-reg" ng-repeat='val in answer'>
4+
<hr>
5+
<u>Test Results:</u> <br><br>
6+
{{val.value}}
7+
<div class='val1'ng-repeat='val1 in val.nest'>
8+
<span>{{val1.value}}</span>
9+
<div class='val2' ng-repeat='val2 in val1.nest'>
10+
<span ng-class="val2.passed ? 'pass' : 'fail'">{{val2.value}}</span>
11+
</div>
1012
</div>
1113
</div>
14+
</div>

src/components/training/training.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
</select>
2424
</div>
2525
<div class="assorted-options">
26-
<div class="view-options">Here's where view options go</div>
27-
<div class="view-options">Here's where view options go</div>
28-
<div class="view-options">Here's where view options go</div>
2926
</div>
3027
</div>
3128
</div>

src/components/training/training.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ $clone-wars-color: rgb(217, 217, 217);
1717
$grey-color: #C0C0C0;
1818
$green-color: #5F8120;
1919
$grey-color2: #3B3C3E;
20+
$pass: #7C9A44;
21+
$fail: #C05C40;
2022

2123
// STUFF ALONG THE TOP
2224
.training-top {
@@ -179,4 +181,20 @@ hr {
179181

180182
.pre-line {
181183
white-space: pre-line;
184+
}
185+
186+
.pass {
187+
color: $pass;
188+
}
189+
190+
.fail {
191+
color: $fail;
192+
}
193+
194+
.val1 {
195+
padding: 0 0 0 15px;
196+
}
197+
198+
.val2 {
199+
padding: 0 0 0 30px;
182200
}

src/components/training/trainingCtrl.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,21 @@ angular.module('app').controller('trainingCtrl', function ($scope, $state, mainS
7979
$scope.testSuite = function () {
8080
var solutions = solutionsCode.getValue();
8181
$scope.showOutput();
82+
var t0 = performance.now();
8283
solutions = solutions
8384
.replace(/\s*\n*\r*\/\/.*\n*\r*/g, '')
8485
.replace(/\n\s*\./g, `.`)
8586
.replace(/\\n/g, " ")
8687
.replace(/\s+/g, " ");
8788
mainService.testSuite(solutions, $scope.kataid).then((response) => {
88-
console.log(response.data);
89+
var t1 = performance.now();
90+
$scope.answer = response.data.nest;
91+
console.log(response.data.nest[0]);
92+
93+
$scope.time = Math.round(t1 - t0) + " ms";
94+
$scope.testPass = response.data.passCount;
95+
$scope.testFail = response.data.testCount - response.data.passCount;
96+
8997
});
9098
};
9199

0 commit comments

Comments
 (0)