Skip to content

Commit

Permalink
💻 Reduce achievements time (#5605)
Browse files Browse the repository at this point in the history
While working on another PR I found out that a new user that tries to create a class has to wait a lot of time for their first class to show. This happens because the `showAchievements` functions has some timeouts of 6 seconds, so the user, as a minimum has to wait this long if they get an achievement. 

Therefore I reduced the time of the achievements a bit.


**How to test**

* Log in as teacher3
* Create a class
* The class shouldn't take ages to load

Other way to test:

* Log in as teacher1
* Duplicate a class
* The for teachers page should reload quickly

You can try that on `main`  and see the difference (remember to clear the site data and restore the devdb in order for the achievement to be shown again)
  • Loading branch information
jpelay authored Jun 12, 2024
1 parent 16f1246 commit b4abbe2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions static/js/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,15 +672,15 @@ export async function showAchievements(achievements: Achievement[] | undefined,
$('#achievement_pop_up').removeAttr('reload');
$('#achievement_pop_up').removeAttr('redirect');
location.reload();
}, achievements.length * 6000);
}, achievements.length * 3000);
}
if (redirect) {
$('#achievement_pop_up').attr('redirect', redirect);
setTimeout(function(){
$('#achievement_pop_up').removeAttr('reload');
$('#achievement_pop_up').removeAttr('redirect');
window.location.pathname = redirect;
}, achievements.length * 6000);
}, achievements.length * 3000);
}
}

Expand All @@ -692,11 +692,11 @@ function showAchievement(achievement: Achievement) {
$('#achievement_pop_up').fadeIn(1000, function () {
setTimeout(function(){
$('#achievement_pop_up').fadeOut(1000);
}, 4000);
}, 1000);
});
setTimeout(()=>{
resolve();
;} , 6000
;} , 1000
);
});
}
Expand Down Expand Up @@ -785,7 +785,7 @@ export async function delete_program(id: string, prompt: string) {
updateSelectOptions('adventure');
// this function decreases the total programs saved
updateProgramCount();
const response = await postJsonWithAchievements('/programs/delete', { id });
const response = await postJsonWithAchievements('/programs/delete', { id });
showAchievements(response.achievement, true, "");
// issue request on the Bar component.
console.log("resp", response)
Expand Down
8 changes: 4 additions & 4 deletions static/js/appbundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -105440,15 +105440,15 @@ def note_with_error(value, err):
$("#achievement_pop_up").removeAttr("reload");
$("#achievement_pop_up").removeAttr("redirect");
location.reload();
}, achievements.length * 6e3);
}, achievements.length * 3e3);
}
if (redirect2) {
$("#achievement_pop_up").attr("redirect", redirect2);
setTimeout(function() {
$("#achievement_pop_up").removeAttr("reload");
$("#achievement_pop_up").removeAttr("redirect");
window.location.pathname = redirect2;
}, achievements.length * 6e3);
}, achievements.length * 3e3);
}
}
function showAchievement(achievement) {
Expand All @@ -105459,12 +105459,12 @@ def note_with_error(value, err):
$("#achievement_pop_up").fadeIn(1e3, function() {
setTimeout(function() {
$("#achievement_pop_up").fadeOut(1e3);
}, 4e3);
}, 1e3);
});
setTimeout(() => {
resolve2();
;
}, 6e3);
}, 1e3);
});
}
function removeBulb() {
Expand Down
2 changes: 1 addition & 1 deletion static/js/appbundle.js.map

Large diffs are not rendered by default.

0 comments on commit b4abbe2

Please sign in to comment.