Bowling score calc. program correction
1.ボウリングスコア集計プログラム修正
現在のプログラムに不具合が見つかりましたので修正します。
2.不具合内容
(1)内容
「データ追加時、総ゲーム数の表示更新がされない」
(2)原因
データ追加処理において、表示処理はあったものの、トータルゲーム数の更新処理が抜けていた。
(3)対策
データ書き込み処理に、トータルゲーム数を更新する処理を追加
3.修正箇所
修正関数部のみを掲載します。
def ExcecProc(sender):
res = 0 #input data is OK
dnum = 0 #init. data num.
nd1 = nd_sc1.text #set new data1
nd2 = nd_sc2.text #set new data2
nd3 = nd_sc3.text #set new data3
if nd1.isdecimal() == False or nd2.isdecimal() == False or nd3.isdecimal() == False:
msg = 'One or more are not decimal'
print(msg)
err_msg.txt = msg
res = -1
return res
if nd1 == '' or nd2 == '' or nd3 == '': #One or more are blank?
msg = 'One or more are blank!'
print(msg)
err_msg.text = msg
res = -10
return res
if int(nd1) == 0 or int(nd2) == 0 or int(nd3) == 0: #One or more are zero?
msg = 'One or more are zero!'
print(msg)
err_msg.text = msg
res = -20
return res
if int(nd1) != 999 and int(nd1) > 300:
res = -30
if int(nd2) != 999 and int(nd2) > 300:
res = -40
if int(nd3) != 999 and int(nd3) > 300:
res = -50
if res < 0:
msg = 'One or more are over 300'
print(msg)
err_msg.text = msg
return res
#Read Date
regdate = nd_date.text #input reg. date
if int(nd1) != 999:
writeData(regdate, nd1) #with set_highScore
dnum += 1
if int(nd2) != 999:
writeData(regdate, nd2) #with set_highScore
dnum += 1
if int(nd3) != 999:
writeData(regdate, nd3) #with set_highScore
dnum += 1
totalGameNum += dnum #renew total GameNum @20250410
if(dnum == 3): #3game in a day?
setTotal3g(int(nd1), int(nd2), int(nd3))
displayTotal3gHS()
displayTotalGameNum() #Renew Total Game Num.
displayHighScore()
displayHighScoreInYear()
displayYearsData()
displayThisYearData()
displayMonthAve()
displayTotalGameNum()
displayTotal3gHS()
上記の🟥部分が追加分です。