Implement cooldown feature for nobility advancement
- Added logic in FalukantService to calculate the next available advancement date based on the user's last advancement. - Updated the frontend to display a cooldown message indicating when the user can next advance in nobility. - Enhanced the NobilityView component to handle and format the next advancement date appropriately.
This commit is contained in:
@@ -2907,6 +2907,13 @@ class FalukantService extends BaseService {
|
||||
],
|
||||
attributes: ['labelTr', 'level']
|
||||
});
|
||||
let nextAdvanceAt = null;
|
||||
if (falukantUser.lastNobilityAdvanceAt) {
|
||||
const last = new Date(falukantUser.lastNobilityAdvanceAt);
|
||||
const next = new Date(last.getTime());
|
||||
next.setDate(next.getDate() + 7);
|
||||
nextAdvanceAt = next.toISOString();
|
||||
}
|
||||
const currentTitleLevel = nobility.level;
|
||||
const nextTitle = await TitleOfNobility.findOne({
|
||||
where: {
|
||||
@@ -2922,7 +2929,8 @@ class FalukantService extends BaseService {
|
||||
});
|
||||
return {
|
||||
current: nobility,
|
||||
next: nextTitle
|
||||
next: nextTitle,
|
||||
nextAdvanceAt
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user