| 165 | } |
| 166 | |
| 167 | export const apply = (ctx) => ctx.addScript( |
| 168 | 'problemStat', 'Recalculates nSubmit and nAccept in problem status.', |
| 169 | Schema.object({ |
| 170 | udoc: Schema.boolean(), |
| 171 | pdoc: Schema.boolean(), |
| 172 | psdoc: Schema.boolean(), |
| 173 | }), |
| 174 | async (arg, report) => { |
| 175 | if (arg.pdoc === undefined || arg.pdoc) { |
| 176 | const start = Date.now(); |
| 177 | await pdoc(report); |
| 178 | report({ message: `pdoc finished in ${Date.now() - start}ms` }); |
| 179 | } |
| 180 | if (arg.udoc === undefined || arg.udoc) { |
| 181 | const start = Date.now(); |
| 182 | await udoc(report); |
| 183 | report({ message: `udoc finished in ${Date.now() - start}ms` }); |
| 184 | } |
| 185 | return true; |
| 186 | }, |
| 187 | ); |