Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
emrergin committed Apr 15, 2024
1 parent 9994ffc commit 7af53d5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 25 deletions.
6 changes: 3 additions & 3 deletions src/components/Experiment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
SessionType,
SessionType2,
} from "@/utilities/types";
import Round3 from "./Round";
import Round from "./Round";
import Intro3 from "./IntroGuess";

function Experiment({ data }: { data: SessionType | SessionType2 }) {
Expand Down Expand Up @@ -68,7 +68,7 @@ function Experiment({ data }: { data: SessionType | SessionType2 }) {

{(data.treatment === "QSR" || data.treatment === "BSR") &&
phase === Phase.Main && (
<Round3
<Round
bsr={data.treatment === "BSR"}
roundParameters={data.round_parameters}
priors={data.prior}
Expand All @@ -84,7 +84,7 @@ function Experiment({ data }: { data: SessionType | SessionType2 }) {
)}
{(data.treatment === "QSR2" || data.treatment === "BSR2") &&
phase === Phase.Main && (
<Round3
<Round
bsr={data.treatment === "BSR2"}
roundParameters={data.round_parameters}
phaseFunction={setPhase}
Expand Down
11 changes: 1 addition & 10 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import { GetServerSideProps } from "next";
import { prisma } from "@/database";
import { Session } from "@prisma/client";
import { SessionType, SessionType2 } from "@/utilities/types";
// import Experiment2 from "@/components/Experiment2";

export default function Home({
data,
}: InferGetServerSidePropsType<typeof getServerSideProps>) {
return <Experiment data={data} />;
// }
}

const defaultSession: Omit<Session, "id"> = {
Expand Down Expand Up @@ -43,19 +42,11 @@ export const getServerSideProps: GetServerSideProps<{
sessionData.end_time = JSON.parse(JSON.stringify(sessionData?.end_time));
sessionData.round_parameters = shuffle(sessionData.round_parameters);

// if (sessionData.treatment === "QSR" || sessionData.treatment === "BSR") {
// return {
// props: {
// data: sessionData as SessionType,
// },
// };
// } else {
return {
props: {
data: sessionData,
},
};
// }
};

function shuffle(array: number[]) {
Expand Down
13 changes: 1 addition & 12 deletions src/utilities/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Round, Session } from "@prisma/client";
import { Session } from "@prisma/client";

export interface SessionType
extends Omit<
Expand All @@ -19,20 +19,9 @@ export interface SessionType2
treatment: "QSR2" | "BSR2";
}

// export type Round2 = Omit<
// Round,
// | "first_draw_blue"
// | "second_draw_blue"
// | "third_draw_blue"
// | "fourth_draw_blue"
// | "fifth_draw_blue"
// | "sixth_draw_blue"
// >;

export enum Phase {
Intro = "INTRO",
Intro2 = "INTRO2",
// Trial = "TRIAL",
Main = "MAIN",
Demographics = "DEMO",
Gps = "GPS",
Expand Down

0 comments on commit 7af53d5

Please sign in to comment.