finished top 30
This commit is contained in:
@ -14,16 +14,13 @@ import { SystemVoiceCustomization } from "@/components/(customization)/systemvoi
|
|||||||
import { MapIconCustomization } from "@/components/(customization)/mapiconcustomization/page";
|
import { MapIconCustomization } from "@/components/(customization)/mapiconcustomization/page";
|
||||||
import { getMapIcons } from "@/components/(customization)/mapiconcustomization/actions";
|
import { getMapIcons } from "@/components/(customization)/mapiconcustomization/actions";
|
||||||
import { ChunithmRecentPlays } from "@/components/RecentChunithmScores/page";
|
import { ChunithmRecentPlays } from "@/components/RecentChunithmScores/page";
|
||||||
import { getUserRecentPlays } from "@/components/RecentChunithmScores/action";
|
import { getUserRatingBaseList } from "@/components/RecentChunithmScores/action";
|
||||||
|
|
||||||
|
|
||||||
const getChuniRecent = async () => {
|
const getChuniRecent = async () => {
|
||||||
const recentRating = await getUserRecentPlays();
|
const recentRating = await getUserRatingBaseList();
|
||||||
return { recentRating };
|
return { recentRating };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const getAvatarHeadAccessories = async () => {
|
const getAvatarHeadAccessories = async () => {
|
||||||
const avatarParts = await getAllAvatarParts(2); // head
|
const avatarParts = await getAllAvatarParts(2); // head
|
||||||
return { avatarParts };
|
return { avatarParts };
|
||||||
@ -79,8 +76,8 @@ const Page = async () => {
|
|||||||
const AllStaticNameplates = await getAllNameplates();
|
const AllStaticNameplates = await getAllNameplates();
|
||||||
const AllSystemVoices = await getAllSystemVoices();
|
const AllSystemVoices = await getAllSystemVoices();
|
||||||
const AllMapIcons = await getAllMapIcons();
|
const AllMapIcons = await getAllMapIcons();
|
||||||
const RecentChuniPlays = await getChuniRecent();
|
|
||||||
|
|
||||||
|
const RecentChuniPlays = await getChuniRecent();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-10">
|
<div className="p-10">
|
||||||
@ -89,7 +86,6 @@ const Page = async () => {
|
|||||||
<TabsTrigger value="scores">Scores</TabsTrigger>
|
<TabsTrigger value="scores">Scores</TabsTrigger>
|
||||||
<TabsTrigger value="customize">Customize</TabsTrigger>
|
<TabsTrigger value="customize">Customize</TabsTrigger>
|
||||||
<TabsTrigger value="RecentPlays">Top / Recent Plays</TabsTrigger>
|
<TabsTrigger value="RecentPlays">Top / Recent Plays</TabsTrigger>
|
||||||
|
|
||||||
</TabsList>
|
</TabsList>
|
||||||
<TabsContent value="scores">
|
<TabsContent value="scores">
|
||||||
<ChunithmScorePlaylog />
|
<ChunithmScorePlaylog />
|
||||||
@ -125,7 +121,7 @@ const Page = async () => {
|
|||||||
<div></div>
|
<div></div>
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
<TabsContent value="RecentPlays">
|
<TabsContent value="RecentPlays">
|
||||||
<ChunithmRecentPlays chuniProfileRecentPlays={RecentChuniPlays}/>
|
<ChunithmRecentPlays chuniProfileRecentPlays={RecentChuniPlays} />
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,7 +2,7 @@ import { SignInForm } from "@/auth/components/signin/signin";
|
|||||||
|
|
||||||
const PublicHomePage = () => {
|
const PublicHomePage = () => {
|
||||||
return (
|
return (
|
||||||
<div className="h-screen flex items-center justify-center">
|
<div className="flex h-screen items-center justify-center">
|
||||||
<SignInForm />
|
<SignInForm />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -1,35 +1,52 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import { getAuth } from "@/auth/queries/getauth";
|
import { getAuth } from "@/auth/queries/getauth";
|
||||||
import { supportedVersionNumber } from "@/lib/helpers";
|
import { supportedVersionNumber } from "@/lib/helpers";
|
||||||
import { artemis } from "@/lib/prisma";
|
import { artemis } from "@/lib/prisma";
|
||||||
|
|
||||||
export async function getUserRecentPlays() {
|
export async function getUserRatingBaseList() {
|
||||||
const { user } = await getAuth();
|
const { user } = await getAuth();
|
||||||
|
|
||||||
if (!user || !user.accessCode) {
|
if (!user || !user.accessCode) {
|
||||||
throw new Error("User is not authenticated or accessCode is missing");
|
throw new Error("User is not authenticated or accessCode is missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
const userRatingBaseHotList = await artemis.chuni_profile_rating.findMany({
|
try {
|
||||||
where: {
|
// fuck prisma sometimes man
|
||||||
user: user.UserId,
|
const results = await artemis.$queryRaw<any[]>`
|
||||||
// userRatingBaseList recent 30 // userRatingBaseHotList recent 15
|
SELECT
|
||||||
type: "userRatingBaseList",
|
cpr.score,
|
||||||
version: supportedVersionNumber, // TODO: eventually change this so the user can set their own version
|
csm.chartId,
|
||||||
},
|
csm.title,
|
||||||
select: {
|
csm.level,
|
||||||
score:true,
|
csm.genre,
|
||||||
difficultId: true,
|
csm.jacketPath,
|
||||||
musicId: true,
|
csm.artist,
|
||||||
type:true,
|
'Increase' AS rating_change,
|
||||||
version: true,
|
CASE
|
||||||
romVersionCode: true,
|
WHEN cpr.score >= 1009000 THEN CAST(csm.level AS DECIMAL(10,2)) * 100 + 215
|
||||||
id: true,
|
WHEN cpr.score >= 1007500 THEN CAST(csm.level AS DECIMAL(10,2)) * 100 + 200 + (cpr.score - 1007500) / 100
|
||||||
index:true,
|
WHEN cpr.score >= 1005000 THEN CAST(csm.level AS DECIMAL(10,2)) * 100 + 150 + (cpr.score - 1005000) / 50
|
||||||
user: true,
|
WHEN cpr.score >= 1000000 THEN CAST(csm.level AS DECIMAL(10,2)) * 100 + 100 + (cpr.score - 1000000) / 100
|
||||||
|
WHEN cpr.score >= 975000 THEN CAST(csm.level AS DECIMAL(10,2)) * 100 + (cpr.score - 975000) / 250
|
||||||
|
WHEN cpr.score >= 925000 THEN CAST(csm.level AS DECIMAL(10,2)) * 100 - 300 + (cpr.score - 925000) * 3 / 500
|
||||||
|
WHEN cpr.score >= 900000 THEN CAST(csm.level AS DECIMAL(10,2)) * 100 - 500 + (cpr.score - 900000) * 4 / 500
|
||||||
|
WHEN cpr.score >= 800000 THEN ((CAST(csm.level AS DECIMAL(10,2)) * 100 - 500) / 2 + (cpr.score - 800000) * ((CAST(csm.level AS DECIMAL(10,2)) - 500) / 2) / 100000)
|
||||||
|
ELSE 0
|
||||||
|
END AS rating
|
||||||
|
FROM
|
||||||
|
chuni_profile_rating cpr
|
||||||
|
JOIN
|
||||||
|
chuni_static_music csm ON cpr.musicId = csm.songId AND cpr.difficultId = csm.chartId AND cpr.version = csm.version
|
||||||
|
WHERE
|
||||||
|
cpr.user = ${user.UserId} AND cpr.version = ${supportedVersionNumber} AND cpr.type = 'userRatingBaseList'
|
||||||
|
ORDER BY
|
||||||
|
cpr.index ASC
|
||||||
|
`;
|
||||||
|
|
||||||
},
|
// Return results
|
||||||
});
|
return results;
|
||||||
return userRatingBaseHotList;
|
} catch (error) {
|
||||||
}
|
console.error("Error fetching songs with titles:", error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,23 +1,66 @@
|
|||||||
import { chuni_profile_rating, chuni_profile_recent_rating } from '@/prisma/schemas/artemis/generated/artemis';
|
import React, { FC } from "react";
|
||||||
import React, { FC } from 'react';
|
import {
|
||||||
|
chuni_profile_rating,
|
||||||
|
chuni_static_music,
|
||||||
|
} from "@/prisma/schemas/artemis/generated/artemis";
|
||||||
|
|
||||||
type chunithm_recent = chuni_profile_rating
|
type ChunithmRecent = chuni_profile_rating &
|
||||||
|
chuni_static_music & { rating: number; jacketPath: string | undefined };
|
||||||
|
|
||||||
type ChunithmProfileRecentPlays = {
|
type ChunithmProfileRecentPlays = {
|
||||||
chuniProfileRecentPlays: {
|
chuniProfileRecentPlays: {
|
||||||
recentRating: chunithm_recent[];
|
recentRating: ChunithmRecent[];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ChunithmRecentPlays: FC<ChunithmProfileRecentPlays> = ({ chuniProfileRecentPlays }) => {
|
export const ChunithmRecentPlays: FC<ChunithmProfileRecentPlays> = ({
|
||||||
|
chuniProfileRecentPlays,
|
||||||
|
}) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{chuniProfileRecentPlays.recentRating.map((playersRecentRatingList, index) => (
|
{chuniProfileRecentPlays.recentRating.map(
|
||||||
<div key={index}>
|
(playersRecentRatingList, index) => {
|
||||||
{playersRecentRatingList.score}
|
const jacketPath = playersRecentRatingList.jacketPath?.replace(
|
||||||
|
".dds",
|
||||||
</div>
|
".png",
|
||||||
))}
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
key={index}
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "flex-start",
|
||||||
|
marginBottom: "8px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div style={{ marginRight: "20px" }}>{index + 1}.</div>
|
||||||
|
{jacketPath && (
|
||||||
|
<img
|
||||||
|
src={`/JacketArt/${jacketPath}`}
|
||||||
|
alt="Jacket"
|
||||||
|
style={{ width: "80px", height: "80px" }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<div>
|
||||||
|
<ul className="pl-2">
|
||||||
|
<li>
|
||||||
|
<strong>Title:</strong> {playersRecentRatingList.title}
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<strong>Score:</strong>{" "}
|
||||||
|
{playersRecentRatingList.score?.toLocaleString()}
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<strong>Rating:</strong>{" "}
|
||||||
|
{(playersRecentRatingList.rating / 100).toFixed(2)}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user