Skip to content

Commit

Permalink
Add option to exclude completed tasks from summary report
Browse files Browse the repository at this point in the history
  • Loading branch information
stevencohn committed Apr 28, 2024
1 parent a9c1fba commit 84879ea
Show file tree
Hide file tree
Showing 14 changed files with 101 additions and 30 deletions.
21 changes: 18 additions & 3 deletions OneMore/Commands/Reminders/ReportRemindersCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ private sealed class Item
private const string HeaderCss = "font-family:'Segoe UI Light';font-size:10.0pt";

private OneNote.Scope scope;
private bool showCompleted;
private OneNote one;
private Page page;
private XNamespace ns;
Expand Down Expand Up @@ -75,6 +76,13 @@ public override async Task Execute(params object[] args)
scope = OneNote.Scope.Notebooks;
}

if (args.Length < 2 || args[2] is not string completedArg ||
!bool.TryParse(completedArg, out showCompleted))
{
// opposite of default in dialog, but this is backwards-compatible
showCompleted = true;
}

if (!await CollectReminders(scope))
{
return;
Expand All @@ -94,6 +102,7 @@ public override async Task Execute(params object[] args)
}

scope = dialog.Scope;
showCompleted = dialog.IncludeCompleted;

if (!await CollectReminders(scope))
{
Expand Down Expand Up @@ -130,7 +139,7 @@ public override async Task Execute(params object[] args)
var now = DateTime.Now.ToShortFriendlyString();
container.Add(
new Paragraph($"{Resx.ReminderReport_LastUpdated} {now} " +
$"(<a href=\"onemore://ReportRemindersCommand/refresh/{scope}\">{Resx.word_Refresh}</a>)"),
$"(<a href=\"onemore://ReportRemindersCommand/refresh/{scope}/{showCompleted}\">{Resx.word_Refresh}</a>)"),
new Paragraph(string.Empty)
);

Expand Down Expand Up @@ -212,8 +221,14 @@ private async Task<bool> CollectReminders(OneNote.Scope scope)
WoYear = calendar.GetWeekOfYear(reminder.Due, weekRule, firstDay)
};

if (reminder.Status == ReminderStatus.Completed ||
reminder.Status == ReminderStatus.Deferred)
if (reminder.Status == ReminderStatus.Completed)
{
if (showCompleted)
{
inactive.Add(item);
}
}
else if (reminder.Status == ReminderStatus.Deferred)
{
inactive.Add(item);
}
Expand Down
53 changes: 29 additions & 24 deletions OneMore/Commands/Reminders/ReportRemindersDialog.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions OneMore/Commands/Reminders/ReportRemindersDialog.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//************************************************************************************************
// Copyright © 2022 Steven M Cohn. All rights reserved.
// Copyright © 2022 Steven M Cohn. All rights reserved.
//************************************************************************************************

namespace River.OneMoreAddIn.Commands
{
using Resx = River.OneMoreAddIn.Properties.Resources;
using Resx = Properties.Resources;


internal partial class ReportRemindersDialog : UI.MoreForm
Expand All @@ -20,7 +20,6 @@ public ReportRemindersDialog()
Localize(new string[]
{
"introLabel",
"groupBox=word_Scope",
"notebooksRadio=phrase_AllNotebooks",
"notebookRadio=phrase_AllSectionInTheCurrentNotebook",
"sectionRadio=phrase_TheCurrentSection",
Expand All @@ -31,6 +30,9 @@ public ReportRemindersDialog()
}


public bool IncludeCompleted => showCompletedBox.Checked;


public OneNote.Scope Scope
{
get
Expand Down
9 changes: 9 additions & 0 deletions OneMore/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions OneMore/Properties/Resources.ar-SA.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2452,6 +2452,10 @@ ISO-code then comma then language name</comment>
<value>توليد تقرير للتذكير في هذا النطاق</value>
<comment>label</comment>
</data>
<data name="ReportRemindersDialog_showCompletedBox.Text" xml:space="preserve">
<value>تضمين التذكيرات المكتملة</value>
<comment>checkbox</comment>
</data>
<data name="ReportRemindersReuseDialog_newRadio.Text" xml:space="preserve">
<value>إنشاء صفحة تقرير جديدة</value>
<comment>radio</comment>
Expand Down
4 changes: 4 additions & 0 deletions OneMore/Properties/Resources.de-DE.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2449,6 +2449,10 @@ Wähle Nein, um eine leere Zeile zwischen den Absätzen zu halten</value>
<value>Erstelle Bericht für Erinnerungen in diesem Bereich</value>
<comment>label</comment>
</data>
<data name="ReportRemindersDialog_showCompletedBox.Text" xml:space="preserve">
<value>Fügen Sie abgeschlossene Erinnerungen hinzu</value>
<comment>checkbox</comment>
</data>
<data name="ReportRemindersReuseDialog_newRadio.Text" xml:space="preserve">
<value>Erstelle eine neue Berichtsseite</value>
<comment>radio</comment>
Expand Down
4 changes: 4 additions & 0 deletions OneMore/Properties/Resources.es-ES.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2452,6 +2452,10 @@ Seleccione No para mantener una línea vacía entre los párrafos</value>
<value>Genere un informe para recordatorios en este alcance</value>
<comment>label</comment>
</data>
<data name="ReportRemindersDialog_showCompletedBox.Text" xml:space="preserve">
<value>Incluir recordatorios completados</value>
<comment>checkbox</comment>
</data>
<data name="ReportRemindersReuseDialog_newRadio.Text" xml:space="preserve">
<value>Crear una nueva página de informe</value>
<comment>radio</comment>
Expand Down
4 changes: 4 additions & 0 deletions OneMore/Properties/Resources.fr-FR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2451,6 +2451,10 @@ Sélectionnez Non pour conserver une ligne vide entre les paragraphes</value>
<value>Générer un rapport pour les rappels dans cette portée</value>
<comment>label</comment>
</data>
<data name="ReportRemindersDialog_showCompletedBox.Text" xml:space="preserve">
<value>Inclure les rappels terminés</value>
<comment>checkbox</comment>
</data>
<data name="ReportRemindersReuseDialog_newRadio.Text" xml:space="preserve">
<value>Créer une nouvelle page de rapport</value>
<comment>radio</comment>
Expand Down
4 changes: 4 additions & 0 deletions OneMore/Properties/Resources.he-IL.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2469,6 +2469,10 @@ ISO-code then comma then language name</comment>
<value>צור דוח לתזכורות בהיקף זה</value>
<comment>label</comment>
</data>
<data name="ReportRemindersDialog_showCompletedBox.Text" xml:space="preserve">
<value>כלול תזכורות שהושלמו</value>
<comment>checkbox</comment>
</data>
<data name="ReportRemindersReuseDialog_newRadio.Text" xml:space="preserve">
<value>צור דף דוח חדש</value>
<comment>radio</comment>
Expand Down
4 changes: 4 additions & 0 deletions OneMore/Properties/Resources.nl-NL.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2453,6 +2453,10 @@ Selecteer NO om één lege regel tussen paragrafen te behouden</value>
<value>Genereer rapport voor herinneringen in deze scope</value>
<comment>label</comment>
</data>
<data name="ReportRemindersDialog_showCompletedBox.Text" xml:space="preserve">
<value>Voeg voltooide herinneringen toe</value>
<comment>checkbox</comment>
</data>
<data name="ReportRemindersReuseDialog_newRadio.Text" xml:space="preserve">
<value>Maak een nieuwe rapportpagina</value>
<comment>radio</comment>
Expand Down
4 changes: 4 additions & 0 deletions OneMore/Properties/Resources.pl-PL.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2465,6 +2465,10 @@ Wybierz Nie, aby zachować jedną pustą linię między akapitami</value>
<value>Wygeneruj raport dla przypomnień w tym zakresie</value>
<comment>label</comment>
</data>
<data name="ReportRemindersDialog_showCompletedBox.Text" xml:space="preserve">
<value>Dołącz ukończone przypomnienia</value>
<comment>checkbox</comment>
</data>
<data name="ReportRemindersReuseDialog_newRadio.Text" xml:space="preserve">
<value>Utwórz nową stronę raportu</value>
<comment>radio</comment>
Expand Down
4 changes: 4 additions & 0 deletions OneMore/Properties/Resources.pt-BR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2453,6 +2453,10 @@ Selecione Não para manter uma linha vazia entre os parágrafos</value>
<value>Gerar relatório para lembretes neste escopo</value>
<comment>label</comment>
</data>
<data name="ReportRemindersDialog_showCompletedBox.Text" xml:space="preserve">
<value>Incluir lembretes concluídos</value>
<comment>checkbox</comment>
</data>
<data name="ReportRemindersReuseDialog_newRadio.Text" xml:space="preserve">
<value>Crie uma nova página de relatório</value>
<comment>radio</comment>
Expand Down
4 changes: 4 additions & 0 deletions OneMore/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2489,6 +2489,10 @@ Select No to keep one empty line between paragraphs</value>
<value>Generate report for reminders in this scope</value>
<comment>label</comment>
</data>
<data name="ReportRemindersDialog_showCompletedBox.Text" xml:space="preserve">
<value>Include completed reminders</value>
<comment>checkbox</comment>
</data>
<data name="ReportRemindersReuseDialog_newRadio.Text" xml:space="preserve">
<value>Create a new report page</value>
<comment>radio</comment>
Expand Down
4 changes: 4 additions & 0 deletions OneMore/Properties/Resources.zh-CN.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2451,6 +2451,10 @@ ISO-code then comma then language name</comment>
<value>在此范围中生成提醒的报告</value>
<comment>label</comment>
</data>
<data name="ReportRemindersDialog_showCompletedBox.Text" xml:space="preserve">
<value>包括已完成的提醒</value>
<comment>checkbox</comment>
</data>
<data name="ReportRemindersReuseDialog_newRadio.Text" xml:space="preserve">
<value>创建一个新的报告页面</value>
<comment>radio</comment>
Expand Down

0 comments on commit 84879ea

Please sign in to comment.