|
|
@ -248,6 +248,14 @@ class Problem extends Model { |
|
|
|
let key = syzoj.utils.md5(buf); |
|
|
|
let key = syzoj.utils.md5(buf); |
|
|
|
await fs.rename(path, TestData.resolvePath(key)); |
|
|
|
await fs.rename(path, TestData.resolvePath(key)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.testdata_id) { |
|
|
|
|
|
|
|
let tmp = this.testdata_id; |
|
|
|
|
|
|
|
this.testdata_id = null; |
|
|
|
|
|
|
|
await this.save(); |
|
|
|
|
|
|
|
let file = await TestData.fromID(tmp); |
|
|
|
|
|
|
|
await file.destroy(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let file = await TestData.create({ |
|
|
|
let file = await TestData.create({ |
|
|
|
filename: `test_data_${this.id}.zip`, |
|
|
|
filename: `test_data_${this.id}.zip`, |
|
|
|
md5: key |
|
|
|
md5: key |
|
|
|