Commit 0931166eab69b8c5a790f172caddc472dd791198

Authored by r-ujihara
1 parent 00c83ad5

評価取り込み3回目

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