Skip to content

Commit

Permalink
Merge pull request #83 from Capstone-Projects-2024-Spring/Gao
Browse files Browse the repository at this point in the history
Updated bug and img policy
  • Loading branch information
Dem0nMaxwell authored May 1, 2024
2 parents 082af2a + e19304b commit a3a9dc2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def google_callback():

# Insert user info into the database if doesn"t exists yet
if Database.query(uname, "UserInfo") is None:
Database.insert(UserInfo, _username=uname, _password=token["access_token"], _email=uname)
Database.insert(UserInfo, _username=uname, _password=token["access_token"], _email=uname, _profile_photo=picture)
Database.insert(UserData, _username=uname,_email=uname,_accuracy=0,_wins=0,_losses=0,_freq_mistyped_words=0,_total_playing_time=0,_top_wpm=0,_num_races=0,_user_in_game_picture=picture,_last_login_time=datetime.now(timezone.utc))
user_letter_data = {
"_username": uname,
Expand Down Expand Up @@ -1025,7 +1025,7 @@ def validate_username(self, key, _username):
#creates database tables and used for testing purposes(insert/update/query/delete)
with app._app.app_context():

#app.db.drop_all()
# app.db.drop_all()

app.db.create_all()

Expand All @@ -1034,7 +1034,7 @@ def validate_username(self, key, _username):
#for example, do not repeat the same number in the num_row as it might have repeated _username and _email (which is suppose to be unique)
#if you want to re-populate with the same num_rows, you must run app.db.dropall() before this method
#after testing, you can repeat the number, but preferrably not to do that
#Database.populate_sample_date(100)
# Database.populate_sample_date(100)

#this method returns a list represention of top-n largest mistyped letters
# top_n_letters = Database.get_top_n_letters("user35", 6)
Expand Down
2 changes: 1 addition & 1 deletion static/js/content/Leaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Leaderboard() {
{leaderboardData.map((player, index) => (
<tr key={player.username} className={index === 0 ? 'rank-one' : index === 1 ? 'rank-two' : index === 2 ? 'rank-three' : ''}>
<td>
<img src={player.profile_photo} alt="Profile" />
<img src={player.profile_photo} alt="Profile" referrerPolicy="no-referrer"/>
</td>
<td className="username">
<strong>{player.username}</strong>
Expand Down
2 changes: 1 addition & 1 deletion static/js/reusable/SinglePlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function ThrillTyperGame() {
stopTimerInterval();
const endTime = new Date().getTime();
const elapsedTime = (endTime - startTime) / 1000;
const wordsPerMinute = Math.round((correctCharsTyped / 5 / elapsedTime) * 60);
const wordsPerMinute = Math.round((currentCharIndex / 5 / elapsedTime) * 60);
const accuracy = (correctCharsTyped / totalCharsTyped) * 100;
document.getElementById("result").innerHTML = `Congratulations! You completed the game in ${elapsedTime.toFixed(2)} seconds. Your speed: ${wordsPerMinute} WPM. Your accuracy: ${accuracy.toFixed(2)}%`;
document.getElementById("input-box").value = "";
Expand Down

0 comments on commit a3a9dc2

Please sign in to comment.