- show games in progress as well
This commit is contained in:
		
							parent
							
								
									640cdbbc1a
								
							
						
					
					
						commit
						bb61000bea
					
				@ -272,9 +272,7 @@ function list_results_by_game(game) {
 | 
			
		||||
            test_group_box.append(nickname_box);
 | 
			
		||||
 | 
			
		||||
            result_group.forEach((record) => {
 | 
			
		||||
                if (record["state"] !== "concluded") {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                let concluded = record["state"] === "concluded";
 | 
			
		||||
 | 
			
		||||
                let test_summary_record = document.createElement("section");
 | 
			
		||||
                test_summary_record.classList.add("test-summary-record");
 | 
			
		||||
@ -285,17 +283,21 @@ function list_results_by_game(game) {
 | 
			
		||||
                let duration_sec = document.createElement("section");
 | 
			
		||||
                duration_sec.classList.add("summary-duration");
 | 
			
		||||
                let start_time = unix_time_to_human_readable(record["start_time"]);
 | 
			
		||||
                duration_sec.innerHTML = `${start_time}-`
 | 
			
		||||
                test_summary_record.append(duration_sec);
 | 
			
		||||
 | 
			
		||||
                if (concluded) {
 | 
			
		||||
                    let end_time = unix_time_to_human_readable(record["end_time"]);
 | 
			
		||||
 | 
			
		||||
                    let summary = record["summary"];
 | 
			
		||||
                duration_sec.innerHTML = `${start_time}-<br>${end_time}<br>${summary["correct_answer_n"]}/${summary["challenge_n"]}`;
 | 
			
		||||
                    duration_sec.innerHTML += `<br>${end_time}<br>${summary["correct_answer_n"]}/${summary["challenge_n"]}`;
 | 
			
		||||
 | 
			
		||||
                    let percentage = document.createElement("section");
 | 
			
		||||
                    percentage.classList.add("summary-percentage");
 | 
			
		||||
                    let r = Math.floor((summary["correct_answer_n"] / summary["challenge_n"]) * 100);
 | 
			
		||||
                    percentage.innerHTML = `${r}%`;
 | 
			
		||||
 | 
			
		||||
                test_summary_record.append(duration_sec, percentage);
 | 
			
		||||
                    test_summary_record.append(percentage);
 | 
			
		||||
 | 
			
		||||
                    if (record["best"]) {
 | 
			
		||||
                        let best_badge = document.createElement("section");
 | 
			
		||||
@ -303,6 +305,7 @@ function list_results_by_game(game) {
 | 
			
		||||
                        best_badge.innerText = "LEGJOBB";
 | 
			
		||||
                        test_summary_record.append(best_badge);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                test_group_box.appendChild(test_summary_record);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user