Skip to content

Commit

Permalink
Merge pull request #104 from mitian233/master
Browse files Browse the repository at this point in the history
New feature: Now support delete chunithm data
  • Loading branch information
Diving-Fish authored Aug 23, 2023
2 parents 14811be + 2ca6862 commit aa4c186
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
16 changes: 15 additions & 1 deletion database/routes/chunithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@ async def update_records_chuni():
ChuniRecord.insert_many(arr).execute()
return {"message": "更新成功"}

@app.route("/chuni/player/delete_records", methods=['DELETE'])
@login_required
async def delete_records_chuni():
"""
*需要登录
删除您的中二查分器数据。
"""
nums = ChuniRecord.delete().where(ChuniRecord.player == g.user.id).execute()
await compute_ra(g.user)
return {
"message": nums
}

def lerp(x1, x2, y1, y2, x):
val = (x - x1) / (x2 - x1) * (y2 - y1) + y1
Expand Down Expand Up @@ -199,9 +211,11 @@ async def compute_ra(player: Player):
total += single_ra(record)
for record in r10:
total += single_ra(record)
player.chuni_rating = total / 40
rating = total / 40
player.chuni_rating = rating
player.access_time = time.time()
player.save()
return rating


@app.route("/chuni/player/records")
Expand Down
18 changes: 9 additions & 9 deletions web/src/components/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,14 @@ export default {
});
},
delete_records() {
axios
.delete(
"https://www.diving-fish.com/api/maimaidxprober/player/delete_records"
)
.then((resp) => {
this.$message.success("已删除" + resp.data.message + "条数据");
setTimeout("window.location.reload()", 1500);
});
axios.all([
axios.delete("https://www.diving-fish.com/api/maimaidxprober/player/delete_records"),
axios.delete("https://www.diving-fish.com/api/chunithmprober/player/delete_records")
]).then(axios.spread((maimaiResp,chuniResp)=>{
this.$message.success("已删除舞萌查分器" + maimaiResp.data.message + "条数据");
this.$message.success("已删除中二节奏查分器" + chuniResp.data.message + "条数据");
setTimeout("window.location.reload()", 1500);
}));
},
change_password() {
if (!this.$refs.changePasswordForm.validate()) return;
Expand Down Expand Up @@ -376,4 +376,4 @@ export default {
display: flex;
align-items: center;
}
</style>
</style>

0 comments on commit aa4c186

Please sign in to comment.