基本功能已投入使用,孩子们上课听写单词有进步了,算是给老母亲的奖励吧,尤其是二宝,一天背30+个单词,也不烦躁了。
一、统计目标
不过随着知识点记录量的增加,越来越想知道今天的复习计划制定多少合适,那就来一张统计表吧。
二、统计逻辑
前三项指标都容易,明天的复习量怎么计算呢?
【明日复习量】= (明天 +今天+ 前1天+前5天+前13天+前29天)的知识点数量之和。其中“明天”的计划量,现在不得而知,所以可以把“明天”的计划量忽略一下,只计算已知的量。
三、详细脚本
使用脚本如下:
today = QDate.currentDate().toString('yyyy-MM-dd')
today_1 = QDate.currentDate().addDays(-1).toString('yyyy-MM-dd')
today_2 = QDate.currentDate().addDays(-5).toString('yyyy-MM-dd')
today_6 = QDate.currentDate().addDays(-13).toString('yyyy-MM-dd')
today_14 = QDate.currentDate().addDays(-29).toString('yyyy-MM-dd')
qr_tongji.setQuery("select "+'科目'+",sum("+'知识点总量'+") as '知识点总量', sum("+'已入计划量'+") as '已入计划量',sum("+'未入计划量'+") as '未入计划量',sum("+'当天的复习量'+") AS '明天的复习量' "
"from ( "
"SELECT c.sub_name as '科目', 0 as '知识点总量' , 0 as '已入计划量', 0 as '未入计划量', count(distinct b.word_id) AS '当天的复习量' "
"from memory b,words a, subject c "
"where a.word_id = b.word_id and a.sub_id = c.sub_id "
" and a.stu_id = '" + self.stu_id +
"' and b.first_time in ('" + today+"','"+ today_1+"','"+ today_2+"','"+ today_6+"','"+ today_14+"') "
" group by c.sub_name"
" union "
"SELECT c.sub_name as '科目', count(a.word_id) as '知识点总量' ,"
" count(distinct b.word_id) as '已入计划量', count(a.word_id)-count(distinct b.word_id) as '未入计划量', 0 AS '当天的复习量' "
" FROM words a "
" INNER join subject c on a.sub_id = c.sub_id"
" LEFT join memory b on a.word_id = b.word_id "
" WHERE a.stu_id ='" + str(self.stu_id) + "'"
" group by c.sub_name ) "
" group by "+'科目'
)
结果如下: