mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-28 14:18:04 -05:00
Rename upcomingVoting -> nextNonCompletedVoting
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export {
|
||||
lastCompletedVoting,
|
||||
upcomingVoting,
|
||||
nextNonCompletedVoting,
|
||||
monthsVotingRange,
|
||||
} from "./voting-time";
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { PLUS_DOWNVOTE, PLUS_UPVOTE } from "~/constants";
|
||||
import type { UsersForVoting } from "~/db/models/plusVotes.server";
|
||||
import type { User } from "~/db/types";
|
||||
import type { PlusVoteFromFE } from "./types";
|
||||
import { upcomingVoting } from "./voting-time";
|
||||
import { nextNonCompletedVoting } from "./voting-time";
|
||||
|
||||
const LOCAL_STORAGE_KEY = "plusVoting";
|
||||
|
||||
@@ -84,7 +84,7 @@ function useLoadInitialStateFromLocalStorageEffect({
|
||||
>;
|
||||
setVotes: React.Dispatch<React.SetStateAction<PlusVoteFromFE[]>>;
|
||||
}) {
|
||||
const { month, year } = upcomingVoting(new Date());
|
||||
const { month, year } = nextNonCompletedVoting(new Date());
|
||||
|
||||
React.useEffect(() => {
|
||||
const usersForVotingFromLocalStorage =
|
||||
@@ -181,7 +181,7 @@ function votesToLocalStorage({
|
||||
usersForVoting?: UsersForVoting;
|
||||
votes: PlusVoteFromFE[];
|
||||
}) {
|
||||
const { month, year } = upcomingVoting(new Date());
|
||||
const { month, year } = nextNonCompletedVoting(new Date());
|
||||
|
||||
invariant(usersForVoting);
|
||||
const toLocalStorage: VotingLocalStorageData = {
|
||||
|
||||
@@ -19,8 +19,7 @@ export function lastCompletedVoting(now: Date): MonthYear {
|
||||
});
|
||||
}
|
||||
|
||||
// xxx: rename... nextNonCompletedVoting ?
|
||||
export function upcomingVoting(now: Date): MonthYear {
|
||||
export function nextNonCompletedVoting(now: Date): MonthYear {
|
||||
return nextMonth(lastCompletedVoting(now));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user