Continued work on the Results screen graphing and text

This commit is contained in:
Jaap Marsman 2022-11-02 21:07:23 +08:00
parent dd21e575cd
commit 416f9c232f
5 changed files with 96 additions and 43 deletions

View File

@ -14,10 +14,6 @@ func _ready():
pass
func on_finished():
pass
func _process(_delta):
time_lefts = $"TwentySecondTimer".time_left
$"Panel/TimeRemaining".text = str(time_lefts)
@ -61,7 +57,6 @@ func _on_TwentySecondTimer_timeout():
$"TwentySecondTimer".stop()
global_ints.generate_results = true
on_finished()
$"../Results".visible = true
if global_ints.locked_observations_intervals_remaining > 1:
@ -120,5 +115,4 @@ func _on_Button_pressed():
$"TwentySecondTimer".stop()
global_ints.generate_results = true
on_finished()
$"../Results".visible = true

View File

@ -26,8 +26,33 @@ func _on_BackMainMenu_pressed():
func _on_Results_visibility_changed():
if global_ints.generate_results == true:
global_ints.generate_results = false
global_ints.total_observed_time = global_ints.total_behaviours / 3
global_ints.one_behaviour_percent = (global_ints.one_behaviour_score / global_ints.total_behaviours) * 100
global_ints.two_behaviour_percent = (global_ints.two_behaviour_score / global_ints.total_behaviours) * 100
global_ints.three_behaviour_percent = (global_ints.three_behaviour_score / global_ints.total_behaviours) * 100
global_ints.four_behaviour_percent = (global_ints.four_behaviour_score / global_ints.total_behaviours) * 100
global_ints.five_behaviour_percent = (global_ints.five_behaviour_score / global_ints.total_behaviours) * 100
var result_text : String
result_text = str("wins: ", global_ints.five_behaviour_score , " Losses: ", global_ints.two_behaviour_score, " blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah ")
result_text = str("Date: xx-xx-xxxx \nTime: X to X \n \nThis Time Sampling Form (TSF) observation was completed by %T. %S was observed for %time minutes during %AL. \n \nDuring the observation, OBS1 was observed x out of x times, resulting in xx%. OBS2 was observed x out of x times, resulting in xx%. OBS3 was observed x out of x times, resulting in xx%. OBS4 was observed x out of x times, resulting in xx%. OBS5 was observed x out of x times, resulting in xx%. xx intervals were not scored.")
result_text = str("Date: xx-xx-xxxx \nTime: ", global_ints.observation_start_time , " to " , global_ints.observation_end_time , "\n \nThis Time Sampling Form (TSF) observation was completed by %T. %S was observed for %time minutes during %AL. \n \nDuring the observation, OBS1 was observed x out of x times, resulting in xx%. OBS2 was observed x out of x times, resulting in xx%. OBS3 was observed x out of x times, resulting in xx%. OBS4 was observed x out of x times, resulting in xx%. OBS5 was observed x out of x times, resulting in xx%. xx intervals were not scored.")
result_text = str("Date: " , global_ints.ddmmyyyy , "\nTime: ", global_ints.observation_start_time , " to " , global_ints.observation_end_time , "\n \nThis Time Sampling Form (TSF) observation was completed by " , global_ints.observer_person_name , ". " , global_ints.observed_person_name , " was observed for " , global_ints.total_observed_time , " minute(s) during " , global_ints.observed_activity , ". \n \nDuring the observation, The ", global_ints.one_behaviour," behaviour was observed ", global_ints.one_behaviour_score, " out of ",global_ints.total_behaviours," times, resulting in ",global_ints.one_behaviour_percent,"%. The ",global_ints.two_behaviour," behaviour was observed ",global_ints.two_behaviour_score," out of ",global_ints.total_behaviours," times, resulting in ",global_ints.two_behaviour_percent,"%. The ",global_ints.three_behaviour," behaviour was observed ",global_ints.three_behaviour_score," out of ",global_ints.total_behaviours," times, resulting in ",global_ints.three_behaviour_percent,"%. The ", global_ints.four_behaviour," behaviour was observed ",global_ints.four_behaviour_score," out of ",global_ints.total_behaviours," times, resulting in ",global_ints.four_behaviour_percent,"%. The ",global_ints.five_behaviour," behaviour was observed ",global_ints.five_behaviour_score," out of ",global_ints.total_behaviours," times, resulting in ",global_ints.five_behaviour_percent,"%. ",global_ints.six_behaviour_score," intervals were not scored.")
$"%FullResult".text = result_text
# This is where we generate the bars
$"%ObsBar1".max_value = global_ints.total_behaviours
$"%ObsBar1".value = global_ints.one_behaviour_score
$"%ObsBar2".max_value = global_ints.total_behaviours
$"%ObsBar2".value = global_ints.two_behaviour_score
$"%ObsBar3".max_value = global_ints.total_behaviours
$"%ObsBar3".value = global_ints.three_behaviour_score
$"%ObsBar4".max_value = global_ints.total_behaviours
$"%ObsBar4".value = global_ints.four_behaviour_score
$"%ObsBar5".max_value = global_ints.total_behaviours
$"%ObsBar5".value = global_ints.five_behaviour_score

View File

@ -2,6 +2,11 @@ extends Node
# For testing purposes - make the intervals 4 seconds instead of 20
var date
var ddmmyyyy
var total_observed_time : int
var timer_duration : int = 20
var observation_minutes : int = 1
@ -45,10 +50,16 @@ var total_behaviours : int
var one_behaviour_score : int
var two_behaviour_score : int
var three_behaviour_score : int
var four_behaviour_score: int
var four_behaviour_score : int
var five_behaviour_score : int
var six_behaviour_score : int
var one_behaviour_percent : int
var two_behaviour_percent : int
var three_behaviour_percent : int
var four_behaviour_percent : int
var five_behaviour_percent : int
func reset_all_vars():
observation_minutes = 1
@ -91,6 +102,18 @@ func reset_all_vars():
four_behaviour_score = 0
five_behaviour_score = 0
six_behaviour_score = 0
one_behaviour_percent = 0
two_behaviour_percent = 0
three_behaviour_percent = 0
four_behaviour_percent = 0
five_behaviour_percent = 0
observation_start_time = ""
observation_end_time = ""
date = ""
ddmmyyyy = ""
total_observed_time = 0

View File

@ -4,6 +4,8 @@ extends CanvasLayer
var date_time
var check_time_var : int
var ddmmyyyy : String
var date
onready var date_time_display = $"%CurrentTime"
onready var global_ints = $"/root/GlobalInts"
@ -51,6 +53,10 @@ func _ready():
$"ObservationWindow".visible = false
$"Results".visible = false
$"EditScreen".visible = false
global_ints.date = OS.get_date()
global_ints.ddmmyyyy = str(global_ints.date.day, "-", global_ints.date.month, "-", global_ints.date.year)
func _process(_delta):
check_time_var += 1

View File

@ -1033,6 +1033,16 @@ Or does text-wrap work?
Can I get integers in? Must be able to, concatenate."
autowrap = true
[node name="ObsBar1" type="ProgressBar" parent="Results/Panel"]
unique_name_in_owner = true
margin_left = 271.0
margin_top = 422.0
margin_right = 1063.0
margin_bottom = 447.0
size_flags_horizontal = 3
step = 1.0
percent_visible = false
[node name="GridContainer" type="GridContainer" parent="Results/Panel"]
anchor_left = 0.5
anchor_top = 0.5
@ -1046,83 +1056,78 @@ columns = 2
[node name="ObsTitle1" type="Label" parent="Results/Panel/GridContainer"]
unique_name_in_owner = true
margin_right = 50.0
margin_right = 792.0
margin_bottom = 26.0
custom_fonts/font = SubResource( 12 )
text = "Item1"
[node name="ObsBar1" type="ProgressBar" parent="Results/Panel/GridContainer"]
margin_left = 54.0
margin_right = 846.0
margin_bottom = 20.0
size_flags_horizontal = 3
step = 1.0
percent_visible = false
[node name="ObsTitle2" type="Label" parent="Results/Panel/GridContainer"]
unique_name_in_owner = true
margin_top = 30.0
margin_right = 50.0
margin_bottom = 56.0
margin_left = 796.0
margin_right = 846.0
margin_bottom = 26.0
custom_fonts/font = SubResource( 12 )
text = "Item2"
[node name="ObsBar2" type="ProgressBar" parent="Results/Panel/GridContainer"]
margin_left = 54.0
unique_name_in_owner = true
margin_top = 30.0
margin_right = 846.0
margin_bottom = 50.0
margin_right = 792.0
margin_bottom = 31.0
size_flags_horizontal = 3
step = 1.0
percent_visible = false
[node name="ObsTitle3" type="Label" parent="Results/Panel/GridContainer"]
unique_name_in_owner = true
margin_top = 60.0
margin_right = 50.0
margin_bottom = 86.0
margin_left = 796.0
margin_top = 30.0
margin_right = 846.0
margin_bottom = 56.0
custom_fonts/font = SubResource( 12 )
text = "Item3"
[node name="ObsBar3" type="ProgressBar" parent="Results/Panel/GridContainer"]
margin_left = 54.0
unique_name_in_owner = true
margin_top = 60.0
margin_right = 846.0
margin_bottom = 80.0
margin_right = 792.0
margin_bottom = 61.0
size_flags_horizontal = 3
step = 1.0
percent_visible = false
[node name="ObsTitle4" type="Label" parent="Results/Panel/GridContainer"]
unique_name_in_owner = true
margin_top = 90.0
margin_right = 50.0
margin_bottom = 116.0
margin_left = 796.0
margin_top = 60.0
margin_right = 846.0
margin_bottom = 86.0
custom_fonts/font = SubResource( 12 )
text = "Item4"
[node name="ObsBar4" type="ProgressBar" parent="Results/Panel/GridContainer"]
margin_left = 54.0
unique_name_in_owner = true
margin_top = 90.0
margin_right = 846.0
margin_bottom = 110.0
margin_right = 792.0
margin_bottom = 91.0
size_flags_horizontal = 3
step = 1.0
percent_visible = false
[node name="ObsTitle5" type="Label" parent="Results/Panel/GridContainer"]
unique_name_in_owner = true
margin_top = 120.0
margin_right = 50.0
margin_bottom = 146.0
margin_left = 796.0
margin_top = 90.0
margin_right = 846.0
margin_bottom = 116.0
custom_fonts/font = SubResource( 12 )
text = "Item5"
[node name="ObsBar5" type="ProgressBar" parent="Results/Panel/GridContainer"]
margin_left = 54.0
unique_name_in_owner = true
margin_top = 120.0
margin_right = 846.0
margin_bottom = 140.0
margin_right = 792.0
margin_bottom = 121.0
size_flags_horizontal = 3
step = 1.0
percent_visible = false