Skip to content

Commit

Permalink
add dispaly the lesson's titile
Browse files Browse the repository at this point in the history
  • Loading branch information
ee4ga9d committed Nov 21, 2024
1 parent 438bed4 commit 644cd98
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 11 deletions.
Binary file modified .vs/EbbinghausMemoryApp/v15/Server/sqlite3/storage.ide
Binary file not shown.
Binary file modified .vs/EbbinghausMemoryApp/v15/Server/sqlite3/storage.ide-shm
Binary file not shown.
Binary file modified .vs/EbbinghausMemoryApp/v15/Server/sqlite3/storage.ide-wal
Binary file not shown.
13 changes: 9 additions & 4 deletions EbbinghausMemoryApp/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* 日期: 2024-07-18
* 描述: 主窗体。可增删书籍、课程,提醒每日应复习的课程。
* v1.0.2.2 增加按下Delete键可删除树节点的课程
*
* v1.0.2.3 增加提示的时候有课程名称
* 版本: 1.0.2.2
* 版权: x.com/0EE4GA9d © 2024
******************************************************************************/
Expand All @@ -16,6 +16,7 @@ namespace EbbinghausMemoryApp
using EbbinghausMemoryApp.Controls;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

public partial class FormMain : Form
{
Expand Down Expand Up @@ -126,16 +127,20 @@ private void NotifyTask()
{
using (HelperClass h = new HelperClass())
{
bool b = h.QueryTaskCountByDate(DateTime.Today);
if (!b)
bool b = this.calendar.ToDoItems.ContainsKey(DateTime.Today);
if (b)
{
try
{
List<ToDoItem> list = calendar.ToDoItems[DateTime.Today];
string msgText = "";
if (list != null && list.Count > 0)
msgText = string.Join(",\r", list.Select(m => m.Description).ToArray());
var contentBuilder = new Microsoft.Toolkit.Uwp.Notifications.ToastContentBuilder()
.AddArgument("action", "viewConversation")
.AddArgument("conversationId", 9813)
.AddText(this.Text)
.AddText("今天尚有复习任务未完成");
.AddText($"今天尚有复习任务【{msgText}】未完成");
contentBuilder.Show();
}
catch (Exception ex)
Expand Down
21 changes: 16 additions & 5 deletions EbbinghausMemoryApp/HelperClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* 描述: UI和数据库模型的辅助类。
* 2024.7.24 增加课程类规划。
* bugfix:today->dateQuery at func QueryMouthTask
* 2024.11.21 增加显示课程名称 v1.0.2.4
* 版本: 1.0
* 版权: x.com/0EE4GA9d © 2024
******************************************************************************/
Expand Down Expand Up @@ -245,11 +246,12 @@ public Dictionary<DateTime, List<ToDoItem>> QueryMouthTask(DateTime dateQuery)
//bugfix:today->dateQuery 2024.7.24
DateTime currentM = dateQuery.AddDays(-dateQuery.Day + 1);
DateTime nextM = currentM.AddMonths(1);

var reviewTimes = db.Database.SqlQuery<ToDoItem>($@"Select a.Id,a.[ReviewDateTime],a.[Reviewed] as IsCompleted,b.[Content] as Description,a.Experience From ReviewTimes a ,studyitems b
//bugfix:dispaly the lesson title
string sql = $@"Select a.Id,a.[ReviewDateTime],a.[Reviewed] as IsCompleted,b.[Content]|| '/' ||c.[Content] as Description,a.Experience From ReviewTimes a ,studyitems b,BookItems c
where reviewdatetime>='{currentM.ToString("yyyy-MM-dd")}' and reviewdatetime< '{nextM.ToString("yyyy-MM-dd")}'
and
a.studyitemid=b.id").ToList();
a.studyitemid=b.id and b.BookId=c.id";
var reviewTimes = db.Database.SqlQuery<ToDoItem>(sql).ToList();

foreach (var rt in reviewTimes)
{
Expand All @@ -275,7 +277,16 @@ public bool QueryTaskCountByDate(DateTime date)
m.Reviewed == false).Count() == 0;
}
}

public string QueryTaskNameByDate(DateTime date)
{
using (var db = new AppDbContext())
{
var todayStr = date.ToString("yyyy-MM-dd");
var list = db.ReviewTimes.Where(m => m.ReviewDateTime.Substring(0, 10) == todayStr &&
m.Reviewed == false).ToList();
return string.Join(",", list.Select(m => m.StudyItem.Content).ToList());
}
}
public bool SaveReviewState(int reviewId, bool state, string desc)
{
using (var db = new AppDbContext())
Expand Down Expand Up @@ -329,7 +340,7 @@ public bool LessonPlan()

for (int i = 0; i <= gap; i++)
{
string cName = $"L{LessonBegin + i* LessonDay}-L{LessonBegin + (i+1) * LessonDay}";
string cName = $"L{LessonBegin + i * LessonDay}-L{LessonBegin + (i + 1) * LessonDay}";
if (LessonBegin + (i + 1) * LessonDay > LessonTotal)
cName = $"L{LessonBegin + i * LessonDay}-L{LessonTotal}";
if (LessonTotal == LessonBegin + i * LessonDay)
Expand Down
4 changes: 2 additions & 2 deletions EbbinghausMemoryApp/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2.2")]
[assembly: AssemblyFileVersion("1.0.2.2")]
[assembly: AssemblyVersion("1.0.2.4")]
[assembly: AssemblyFileVersion("1.0.2.4")]

0 comments on commit 644cd98

Please sign in to comment.