Commit 0931166eab69b8c5a790f172caddc472dd791198

Authored by r-ujihara
1 parent 00c83ad5

評価取り込み3回目

... ... @@ -42,13 +42,16 @@
42 42
43 43 <ion-card *ngIf="buttonDisabled" class="answer-card">
44 44 <ion-card-content class="answer-content">
45   - <ion-item>
46   - <ion-thumbnail item-left>
47   - <img src="assets/img/ok.png" *ngIf="result == '正解'">
48   - <img src="assets/img/ng.png" *ngIf="result != '正解'">
49   - </ion-thumbnail>
50   - <ion-card-title color="{{resultcolor}}">{{result}}</ion-card-title>
51   - </ion-item>
  45 + <ion-grid>
  46 + <ion-row align-items-center>
  47 + <ion-col>
  48 + <img src="assets/img/ok.png" *ngIf="result == '正解'">
  49 + <img src="assets/img/ng.png" *ngIf="result != '正解'">
  50 + </ion-col>
  51 + <ion-col col-auto><font size="5" [innerHTML] = "result" [color]="result != '正解' ? 'blue' : 'red'"></font></ion-col>
  52 + <ion-col></ion-col>
  53 + </ion-row>
  54 + </ion-grid>
52 55
53 56 <p><br>解答</p>
54 57 <font size="5" [innerHTML] = "qa1.answerString"></font>
... ...
... ... @@ -30,7 +30,6 @@ export class ExtqaPage {
30 30 nv: NavController;
31 31 selected: number;
32 32 result: string;
33   - resultcolor: string;
34 33 selectstate: Array<boolean> = new Array();
35 34 subscription;
36 35 screenHeight:number;
... ... @@ -65,22 +64,20 @@ export class ExtqaPage {
65 64 }
66 65 this.selectstate[id] = true;
67 66 this.selected = id;
  67 + this.content.scrollToBottom(300);
68 68 }
69 69
70 70 openAnswer() {
71 71 if (this.buttonDisabled == null)
72 72 {
73 73 this.result = "解答";
74   - this.resultcolor = "dark";
75 74
76 75 if (this.selected === this.qa1.answerId) { //正解
77 76 this.result = "正解";
78   - this.resultcolor = "danger";
79 77 this.positiveCnt++;
80 78 }
81 79 else {
82 80 this.result = "不正解";
83   - this.resultcolor = "primary";
84 81 }
85 82
86 83 this.buttonDisabled = true;
... ...
... ... @@ -24,6 +24,7 @@ export class ExtunitPage {
24 24 list1num: number;
25 25
26 26 currentItem: Unit;
  27 + positiveCnt: number;
27 28
28 29 constructor(public navCtrl: NavController, public navParams: NavParams, private dataSevice: DataService) {
29 30 this.menuId = navParams.get("menuId");
... ... @@ -53,6 +54,14 @@ export class ExtunitPage {
53 54 }
54 55 }
55 56
  57 + ionViewWillLeave(){
  58 + var key: string;
  59 + var value: string;
  60 + key = this.menuId.toString() + "ext";
  61 + value = this.positiveCnt.toString();
  62 + this.dataSevice.savePositiveInfo(key, value);
  63 + }
  64 +
56 65 itemSelected(item: Unit) {
57 66 this.currentItem = item;
58 67 this.navCtrl.push(ExtqaPage,{menuId: this.menuId, unitId: item.unitId, title:item.unitName});
... ... @@ -77,6 +86,7 @@ export class ExtunitPage {
77 86 {
78 87 var svdata = val[i].toString().split(":");
79 88 this.list1state[i] = svdata[1] + "問中" + svdata[0] + "問正解!";
  89 + this.positiveCnt = +svdata[0];
80 90 }
81 91 }
82 92 });
... ...
... ... @@ -7,7 +7,7 @@
7 7 <ion-header>
8 8
9 9 <ion-navbar color="primary">
10   - <ion-title>Top</ion-title>
  10 + <ion-title text-center>Top</ion-title>
11 11 </ion-navbar>
12 12
13 13 </ion-header>
... ...
... ... @@ -38,13 +38,17 @@
38 38
39 39 <ion-card *ngIf="buttonDisabled" class="answer-card">
40 40 <ion-card-content class="answer-content">
41   - <ion-item>
42   - <ion-thumbnail item-left>
43   - <img src="assets/img/ok.png" *ngIf="result == '正解'">
44   - <img src="assets/img/ng.png" *ngIf="result != '正解'">
45   - </ion-thumbnail>
46   - <ion-card-title color="{{resultcolor}}">{{result}}</ion-card-title>
47   - </ion-item>
  41 + <ion-grid>
  42 + <ion-row align-items-center>
  43 + <ion-col>
  44 + <img src="assets/img/ok.png" *ngIf="result == '正解'">
  45 + <img src="assets/img/ng.png" *ngIf="result != '正解'">
  46 + </ion-col>
  47 + <ion-col col-auto><font size="5" [innerHTML] = "result" [color]="result != '正解' ? 'blue' : 'red'"></font></ion-col>
  48 + <ion-col>
  49 + </ion-col>
  50 + </ion-row>
  51 + </ion-grid>
48 52
49 53 <p><br>解答</p>
50 54 <font size="5" [innerHTML] = "qa1.answerString"></font>
... ...
... ... @@ -30,7 +30,6 @@ export class QaPage {
30 30 nv: NavController;
31 31 selected: number;
32 32 result: string;
33   - resultcolor: string;
34 33 selectstate: Array<boolean> = new Array();
35 34 subscription;
36 35 screenHeight:number;
... ... @@ -68,22 +67,20 @@ export class QaPage {
68 67 }
69 68 this.selectstate[id] = true;
70 69 this.selected = id;
  70 + this.content.scrollToBottom(300);
71 71 }
72 72
73 73 openAnswer() {
74 74 if (this.buttonDisabled == null)
75 75 {
76 76 this.result = "解答";
77   - this.resultcolor = "dark";
78 77
79 78 if (this.selected === this.qa1.answerId) { //正解
80 79 this.result = "正解";
81   - this.resultcolor = "danger";
82 80 this.positiveCnt++;
83 81 }
84 82 else {
85 83 this.result = "不正解";
86   - this.resultcolor = "primary";
87 84 }
88 85
89 86 this.buttonDisabled = true;
... ...
... ... @@ -15,55 +15,55 @@
15 15 <ion-item-divider color="light">>
16 16 {{list_f[0].title}}
17 17 </ion-item-divider>
18   - <canvas #baseChart0 height="70" class="status-canvas"></canvas>
  18 + <canvas #baseChart0 height="120" class="status-canvas"></canvas>
19 19 </ion-item-group>
20 20
21 21 <ion-item-group>
22 22 <ion-item-divider color="light">>
23 23 {{list_f[1].title}}
24 24 </ion-item-divider>
25   - <canvas #baseChart1 height="70" class="status-canvas"></canvas>
  25 + <canvas #baseChart1 height="120" class="status-canvas"></canvas>
26 26 </ion-item-group>
27 27
28 28 <ion-item-group>
29 29 <ion-item-divider color="light">>
30 30 {{list_f[2].title}}
31 31 </ion-item-divider>
32   - <canvas #baseChart2 height="70" class="status-canvas"></canvas>
  32 + <canvas #baseChart2 height="120" class="status-canvas"></canvas>
33 33 </ion-item-group>
34 34
35 35 <ion-item-group>
36 36 <ion-item-divider color="light">>
37 37 {{list_f[3].title}}
38 38 </ion-item-divider>
39   - <canvas #baseChart3 height="70" class="status-canvas"></canvas>
  39 + <canvas #baseChart3 height="120" class="status-canvas"></canvas>
40 40 </ion-item-group>
41 41
42 42 <ion-item-group>
43 43 <ion-item-divider color="light">>
44 44 {{list_f[4].title}}
45 45 </ion-item-divider>
46   - <canvas #baseChart4 height="70" class="status-canvas"></canvas>
  46 + <canvas #baseChart4 height="120" class="status-canvas"></canvas>
47 47 </ion-item-group>
48 48
49 49 <ion-item-group>
50 50 <ion-item-divider color="light">>
51 51 {{list_f[5].title}}
52 52 </ion-item-divider>
53   - <canvas #baseChart5 height="70" class="status-canvas"></canvas>
  53 + <canvas #baseChart5 height="120" class="status-canvas"></canvas>
54 54 </ion-item-group>
55 55
56 56 <ion-item-group>
57 57 <ion-item-divider color="light">>
58 58 {{list_f[6].title}}
59 59 </ion-item-divider>
60   - <canvas #baseChart6 height="70" class="status-canvas"></canvas>
  60 + <canvas #baseChart6 height="120" class="status-canvas"></canvas>
61 61 </ion-item-group>
62 62
63 63 <ion-item-group>
64 64 <ion-item-divider color="light">>
65 65 {{list_f[7].title}}
66 66 </ion-item-divider>
67   - <canvas #baseChart7 height="70" class="status-canvas"></canvas>
  67 + <canvas #baseChart7 height="120" class="status-canvas"></canvas>
68 68 </ion-item-group>
69 69 </ion-content>
... ...
... ... @@ -57,7 +57,7 @@ export class StatusPage {
57 57 }
58 58 }],
59 59 yAxes: [{
60   - barThickness: 20
  60 + barThickness: 30
61 61 }]
62 62 }
63 63
... ... @@ -71,11 +71,11 @@ export class StatusPage {
71 71 constructor(public navCtrl: NavController, public navParams: NavParams, private dataSevice: DataService) {
72 72
73 73 this.list_f = dataSevice.getMenuFirst();
74   - for(var i = 0; i < this.list_f.length; i++){
75   -//    this.chartLabels.push(this.list_f[i].title);
76   - }
77 74
78   -   this.chartLabels.push("");
  75 +//   this.chartLabels.push("");
  76 +   this.chartLabels.push("基礎");
  77 +   this.chartLabels.push("応用");
  78 +
79 79 this.getChartData();
80 80 }
81 81
... ... @@ -103,20 +103,23 @@ export class StatusPage {
103 103 var key: string;
104 104 key = this.list_f[i].menuId.toString();
105 105 promiseArray1.push(this.dataSevice.getInfo(key));
  106 + promiseArray1.push(this.dataSevice.getInfo(key+"ext"));
106 107 }
107 108
108 109 Promise.all(promiseArray1)
109 110 .then(val =>
110 111 {
111   - for(var i = 0; i< this.list_f.length; i++)
  112 + for(var i = 0; i< (this.list_f.length * 2); i++)
112 113 {
113 114 var cdata: ChartData = { label:'正答率',
114 115 data: new Array(),
115   - backgroundColor:['rgba(255, 99, 132, 0.2)'],
116   - borderColor:['rgba(255,99,132,1)'],
  116 + backgroundColor:['rgba(255, 99, 132, 0.2)','rgba(255, 159, 64, 0.2)'],
  117 + borderColor:['rgba(255,99,132,1)','rgba(255, 159, 64, 1)'],
117 118 borderWidth:2 };
118 119 var num: number;
119 120 var score: number;
  121 + var numext: number;
  122 + var scoreext: number;
120 123 if(val[i] == null)
121 124 {
122 125 num = 0;
... ... @@ -125,12 +128,25 @@ export class StatusPage {
125 128 {
126 129 num = +val[i];
127 130 }
128   - score = Math.floor((num / this.dataSevice.getQaCnt(this.list_f[i].menuId)) * 100);
  131 + if(val[i+1] == null)
  132 + {
  133 + numext = 0;
  134 + }
  135 + else
  136 + {
  137 + numext = +val[i+1];
  138 + }
  139 + score = Math.floor((num / this.dataSevice.getQaCnt(this.list_f[i / 2].menuId)) * 100);
129 140 // score = 10*i + 10;
  141 + scoreext = Math.floor((numext / this.dataSevice.getExtQaCnt(this.list_f[i / 2].menuId)) * 100);
130 142 cdata.data.push(score);
  143 + cdata.data.push(scoreext);
  144 +
131 145 this.chartData = new Array();
132 146 this.chartData.push(cdata);
133   - this.getChart(this.getCanvas(i).nativeElement);
  147 + this.getChart(this.getCanvas(i / 2).nativeElement);
  148 +
  149 + i++;
134 150 }
135 151
136 152 });
... ...
... ... @@ -45,7 +45,7 @@
45 45 </ion-card-header>
46 46
47 47 <ion-fab right top>
48   - <button ion-fab color="danger" mini>
  48 + <button ion-fab color="danger" >
49 49 <ion-icon *ngIf="openkeyword1" name="bowtie"></ion-icon>
50 50 <ion-icon *ngIf="openkeyword1 == false" name="key"></ion-icon>
51 51 </button>
... ... @@ -73,7 +73,7 @@
73 73 <img src="assets/img/unitdisable.png" *ngIf="list2dsp == false"/>
74 74
75 75 <ion-fab right top *ngIf="list2dsp">
76   - <button ion-fab color="danger" mini>
  76 + <button ion-fab color="danger">
77 77 <ion-icon *ngIf="openkeyword2" name="bowtie"></ion-icon>
78 78 <ion-icon *ngIf="openkeyword2 == false" name="key"></ion-icon>
79 79 </button>
... ... @@ -101,7 +101,7 @@
101 101 <img src="assets/img/unitdisable.png" *ngIf="list3dsp == false"/>
102 102
103 103 <ion-fab right top *ngIf="list3dsp">
104   - <button ion-fab color="danger" mini>
  104 + <button ion-fab color="danger">
105 105 <ion-icon *ngIf="openkeyword3" name="bowtie"></ion-icon>
106 106 <ion-icon *ngIf="openkeyword3 == false" name="key"></ion-icon>
107 107 </button>
... ... @@ -129,7 +129,7 @@
129 129 <img src="assets/img/unitdisable.png" *ngIf="list4dsp == false"/>
130 130
131 131 <ion-fab right top *ngIf="list4dsp">
132   - <button ion-fab color="danger" mini>
  132 + <button ion-fab color="danger">
133 133 <ion-icon *ngIf="openkeyword4" name="bowtie"></ion-icon>
134 134 <ion-icon *ngIf="openkeyword4 == false" name="key"></ion-icon>
135 135 </button>
... ... @@ -157,7 +157,7 @@
157 157 <img src="assets/img/unitdisable.png" *ngIf="list5dsp == false"/>
158 158
159 159 <ion-fab right top *ngIf="list5dsp">
160   - <button ion-fab color="danger" mini>
  160 + <button ion-fab color="danger">
161 161 <ion-icon *ngIf="openkeyword5" name="bowtie"></ion-icon>
162 162 <ion-icon *ngIf="openkeyword5 == false" name="key"></ion-icon>
163 163 </button>
... ... @@ -185,7 +185,7 @@
185 185 <img src="assets/img/unitdisable.png" *ngIf="list6dsp == false"/>
186 186
187 187 <ion-fab right top *ngIf="list6dsp">
188   - <button ion-fab color="danger" mini>
  188 + <button ion-fab color="danger">
189 189 <ion-icon *ngIf="openkeyword6" name="bowtie"></ion-icon>
190 190 <ion-icon *ngIf="openkeyword6 == false" name="key"></ion-icon>
191 191 </button>
... ... @@ -213,7 +213,7 @@
213 213 <img src="assets/img/unitdisable.png" *ngIf="list7dsp == false"/>
214 214
215 215 <ion-fab right top *ngIf="list7dsp">
216   - <button ion-fab color="danger" mini>
  216 + <button ion-fab color="danger">
217 217 <ion-icon *ngIf="openkeyword7" name="bowtie"></ion-icon>
218 218 <ion-icon *ngIf="openkeyword7 == false" name="key"></ion-icon>
219 219 </button>
... ...
... ... @@ -110,6 +110,16 @@ export class DataService {
110 110 return num;
111 111 }
112 112
  113 + public getExtQaCnt(menuId:number): number {
  114 + var num = 0;
  115 + for (var i = 0; i < this.extqa.length; i++) {
  116 + if (this.extqa[i].menuId === menuId) {
  117 + num++;
  118 + }
  119 + }
  120 + return num;
  121 + }
  122 +
113 123 public getQa(menuId: number, unitId: number): Qa[] {
114 124 var qaItem: Qa[] = new Array();
115 125 for (var i = 0; i < this.subject.length; i++) {
... ...
Please register or login to post a comment