Skip to content

Commit

Permalink
fix classic mode not creating game
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaojustin committed May 1, 2024
1 parent df1dc59 commit 613b9d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 3 additions & 6 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def fetch_object_ids(mode):
"""
Fetches met museum api for all object ids.
"""
if mode == "":
if mode == "classic":
url = "https://collectionapi.metmuseum.org/public/collection/v1/objects"
else:
base_url = "https://collectionapi.metmuseum.org/public/collection/v1/objects?departmentIds="
Expand Down Expand Up @@ -155,11 +155,8 @@ def create_game(mode):
- Image
"""
print("Creating game...")
if mode == "":
print("Selected mode: Classic")
else:
print(f"Selected mode: {mode}")

print(f"Selected mode: {mode}")

# get all objects
object_ids = fetch_object_ids(mode)
random.shuffle(object_ids)
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/Pages/Game/Start.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ export default function Start() {

/**
* gamemodes:
* "" is classic
* "classic"
* "asian"
* "medieval"
* "music"
*/
const [mode, setMode] = useState("");
const [mode, setMode] = useState("classic");

// game state to be shared by all game pages
const [gameState, setGameState] = useState({
Expand Down Expand Up @@ -107,7 +107,7 @@ const Menu = ({ setStage, setMode }) => {
}}
onClick={() => {
setStage("game");
setMode("");
setMode("classic");
}}
>
<Image src="/icons/temple.png" boxSize={20} />
Expand Down

0 comments on commit 613b9d5

Please sign in to comment.