Skip to content

Commit

Permalink
made some improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mfrasco committed Nov 12, 2023
1 parent 5bd00d2 commit ac1ae1e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nobles_and_peasants/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def login():
session.clear()
session["party_id"] = party["id"]
session["party_name"] = party_name
return redirect(url_for("what_is_this"))
return redirect(url_for("game.show_main"))

return redirect(url_for("show_login"))

Expand Down
8 changes: 7 additions & 1 deletion nobles_and_peasants/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ def ban_peasant():

# add the peasant to a banned table
insert_new_outlaw(noble_id=noble["id"], peasant_id=peasant["id"])
msg = f"{noble_name} has banned {peasant_name}!"
flash(msg)

return redirect(url_for("game.show_main"))


Expand Down Expand Up @@ -339,6 +342,8 @@ def add_money():
if result == "Yes":
reward = get_reward_for_difficulty(difficulty=difficulty)
increment_coin(player_name=player_name, coin=reward)
msg = f"{player_name} has earned {reward} coin for completing a {difficulty} quest!"
flash(msg)

return redirect(url_for("game.show_main"))

Expand Down Expand Up @@ -420,10 +425,11 @@ def assassinate():
msg = (
f"{winner_name} assassinated {loser_name}! {new_noble_name} is now a noble!"
)
flash(msg)
else:
move_coin_between_players(from_name=loser_name, to_name=winner_name)
msg = f"{winner_name} has taken all of the coin of {loser_name}"

flash(msg)
return redirect(url_for("game.show_main"))


Expand Down
2 changes: 1 addition & 1 deletion nobles_and_peasants/templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<option value="{{ d }}">{{ d }}</option>
{% endfor %}
</select>
<input class="input_box" type="number" name="quantity" placeholder="Quantity" min=1 required></input>
<input class="input_box" type="number" name="quantity" placeholder="Quantity" min=1 max=5 required></input>
<p></p>
<input class="submit_button" type="submit" value="Buy Drink"></input>
</form>
Expand Down
2 changes: 1 addition & 1 deletion tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_login(client, auth):
"""Test that logging in to a party sets session variables correctly."""
assert client.get("/auth/login", follow_redirects=True).status_code == 200
response = auth.login(party_name="party_name_1", password="maya")
assert "What is Nobles and Peasants?" in response.text
assert "Randomly Decide" in response.text

with client:
client.get("/")
Expand Down

0 comments on commit ac1ae1e

Please sign in to comment.