@@ -13,9 +13,9 @@ import {WritableAdapter} from "graphlabs.core.visualizer";
13
13
14
14
import { /*Component,*/ SFC } from 'react' ;
15
15
import { init1 , graphModel1 , init2 , graphModel2 , initres , /*graphModelres,*/ init , graphModel } from './ForMyGraphModel' ;
16
- import { message_0 , message_0_changing , num_0 , num_0_changing , message_1 , message_1_changing } from './ForMeVars' ;
17
- import { GetNewRandomGraph , GetNewRandomGraphForThatOne , ChooseTask } from './Ops' ;
18
- import { CheckingAnswer } from "./CheckAnswer" ;
16
+ import { message_0 , message_0_changing , num_0 , num_0_changing , message_1 , message_1_changing , mark_0 , mark_0_changing , T_s , T_s_changing , T_s_shawing } from './ForMeVars' ;
17
+ import { ChooseTask } from './Ops' ;
18
+ import { CheckingAnswer , StartDifficult , LastCheckingAnswer } from "./CheckAnswer" ;
19
19
import { GraphsInit } from "./GraphsInit"
20
20
21
21
class App extends Template {
@@ -25,7 +25,11 @@ class App extends Template {
25
25
} ;
26
26
27
27
componentWillMount ( ) {
28
+ StartDifficult ( ) ;
29
+ mark_0_changing ( 0 ) ;
28
30
GraphsInit ( ) ;
31
+ let timerId = setInterval ( ( ) => { T_s_changing ( T_s - 1 ) ; this . forceUpdate ( ) ; } , 1000 ) ;
32
+ window . setTimeout ( ( ) => { clearInterval ( timerId ) ; LastCheckingAnswer ( ) ; } , 1000 * 45 * 60 ) ;
29
33
}
30
34
31
35
/*public constructor(props: {}) { // не совсем понимаю, почему овервайт этих функций происходит автоматически и без конструктора
@@ -80,25 +84,37 @@ class App extends Template {
80
84
Toolbar . prototype . getButtonList = ( ) => {
81
85
function beforeComplete ( this : App ) : Promise < { success : boolean ; fee : number } > {
82
86
return new Promise ( ( resolve => {
83
- resolve ( CheckingAnswer ( ) ) ;
87
+ resolve ( LastCheckingAnswer ( ) ) ;
84
88
} ) ) ;
85
89
}
86
90
ToolButtonList . prototype . beforeComplete = beforeComplete . bind ( this ) ;
87
91
ToolButtonList . prototype . help = ( ) => `В данном задании вы должны построить результат операции, указанной в задании в правой части экрана. Для этого вы можете добавлять любое число вершин/рёбер. Также вы можете удалять любое число вершин, не инцидентных ни одному ребру или рёбер. Оценка зависит только от того, правильно ли вы построите граф.` ;
88
92
89
93
ToolButtonList . prototype . toolButtons = {
90
94
"http://gl-backend.svtz.ru:5000/odata/downloadImage(name='add_vertex.png')" : ( ) => {
95
+ const start = new Date ( ) . getTime ( ) ;
91
96
adapter . addVertex ( ) ;
97
+ const end = new Date ( ) . getTime ( ) ;
98
+ T_s_changing ( T_s - Math . round ( ( end - start ) / 1000 ) ) ;
92
99
} ,
93
100
"http://gl-backend.svtz.ru:5000/odata/downloadImage(name='add_edge.png')" : ( ) => { // Меняю имя всем рёбрам на адекватные - ужасный костыль
101
+ const start = new Date ( ) . getTime ( ) ;
94
102
adapter . addEdge ( ) ;
95
103
graphModel . edges . forEach ( ( e :IEdge , i = 0 ) => { e . name = `${ i ++ } ` ; } ) ;
104
+ const end = new Date ( ) . getTime ( ) ;
105
+ T_s_changing ( T_s - Math . round ( ( end - start ) / 1000 ) ) ;
96
106
} ,
97
107
"http://gl-backend.svtz.ru:5000/odata/downloadImage(name='remove_vertex.png')" : ( ) => { // Меняю имя всем рёбрам на адекватные - ужасный костыль
108
+ const start = new Date ( ) . getTime ( ) ;
98
109
adapter . removeVertex ( ) ;
110
+ const end = new Date ( ) . getTime ( ) ;
111
+ T_s_changing ( T_s - Math . round ( ( end - start ) / 1000 ) ) ;
99
112
} ,
100
113
"http://gl-backend.svtz.ru:5000/odata/downloadImage(name='remove_edge.png')" : ( ) => { // Меняю имя всем рёбрам на адекватные - ужасный костыль
114
+ const start = new Date ( ) . getTime ( ) ;
101
115
adapter . removeEdge ( ) ;
116
+ const end = new Date ( ) . getTime ( ) ;
117
+ T_s_changing ( T_s - Math . round ( ( end - start ) / 1000 ) ) ;
102
118
}
103
119
} ;
104
120
return ToolButtonList ;
@@ -110,14 +126,16 @@ class App extends Template {
110
126
< div > Панель инструментов</ div >
111
127
< Buttons />
112
128
< button type = { "button" } style = { { border : '1px double black' , background : 'white' , margin : '4px' } } onClick = { ( ) => {
129
+ CheckingAnswer ( ) ;
113
130
num_0_changing ( num_0 + 1 ) ;
114
131
GraphsInit ( ) ;
115
132
this . forceUpdate ( ) ;
116
133
if ( num_0 === 7 ) { // удалить кнопку было бы хорошо
117
- message_1_changing ( "Операций больше нет " ) ;
134
+ message_1_changing ( "Завершите выполнение теста. " ) ;
118
135
this . disable ( ) ;
119
136
}
120
137
} } > { message_1 } </ button >
138
+ < div > Time left: { T_s_shawing ( ) } </ div >
121
139
</ div > ) ;
122
140
}
123
141
return Toolbar ;
@@ -165,7 +183,7 @@ class App extends Template {
165
183
</ p >
166
184
< div >
167
185
< p >
168
- { num_0 !== 6 ?"1." :'' } < GraphVisualizer
186
+ { num_0 !== 1 ?"1." :'' } < GraphVisualizer
169
187
graph = { graphModel1 }
170
188
adapterType = { 'readable' }
171
189
namedEdges = { false }
@@ -174,7 +192,7 @@ class App extends Template {
174
192
edgeNaming = { false }
175
193
incidentEdges = { false }
176
194
/>
177
- { num_0 !== 6 ?"2." :'' } < GraphVisualizer
195
+ { num_0 !== 1 ?"2." :'' } < GraphVisualizer
178
196
graph = { graphModel2 }
179
197
adapterType = { 'readable' }
180
198
namedEdges = { false }
0 commit comments