Rename upcomingVoting -> nextNonCompletedVoting

This commit is contained in:
Kalle
2022-06-12 23:19:16 +03:00
parent 1b2376a951
commit 52fea7fcc9
9 changed files with 26 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
export {
lastCompletedVoting,
upcomingVoting,
nextNonCompletedVoting,
monthsVotingRange,
} from "./voting-time";

View File

@@ -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 = {

View File

@@ -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));
}