fix: fixed dragging of deal in the same status
This commit is contained in:
@ -4,7 +4,7 @@ import { DealSchema } from "@/client";
|
||||
import { getNewLexorank, sortByLexorank } from "@/utils/lexorank";
|
||||
|
||||
const useGetNewRank = () => {
|
||||
const { deals, statuses } = useStatusesContext();
|
||||
const { statuses } = useStatusesContext();
|
||||
|
||||
const getNewRankForSameStatus = (
|
||||
statusDeals: DealSchema[],
|
||||
@ -20,10 +20,12 @@ const useGetNewRank = () => {
|
||||
: [overDealIndex, overDealIndex + 1];
|
||||
|
||||
const leftLexorank =
|
||||
leftIndex >= 0 ? LexoRank.parse(deals[leftIndex].lexorank) : null;
|
||||
leftIndex >= 0
|
||||
? LexoRank.parse(statusDeals[leftIndex].lexorank)
|
||||
: null;
|
||||
const rightLexorank =
|
||||
rightIndex < deals.length
|
||||
? LexoRank.parse(deals[rightIndex].lexorank)
|
||||
rightIndex < statusDeals.length
|
||||
? LexoRank.parse(statusDeals[rightIndex].lexorank)
|
||||
: null;
|
||||
|
||||
return getNewLexorank(leftLexorank, rightLexorank).toString();
|
||||
|
||||
Reference in New Issue
Block a user