Skip to content
This repository was archived by the owner on Oct 3, 2022. It is now read-only.

Commit 1512aa7

Browse files
authored
Merge pull request #29 from BinderDyn/bugfix-weekday-productivity
Fixed the wrong display of percentages and removed unnecessary scroll…
2 parents 4c4245d + 0815035 commit 1512aa7

File tree

9 files changed

+111
-11
lines changed

9 files changed

+111
-11
lines changed
58.3 KB
Binary file not shown.

.vs/TakeMyTime.NETCore/v16/.suo

-6 KB
Binary file not shown.

TakeMyTime.BLL.Tests/ProjectTypeLogicTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ public void GetProjectTypes_Test()
5050

5151
// ACT
5252
var projectTypes = projectTypeLogic.GetProjectTypes();
53-
projectTypeLogic.Dispose();
5453

5554
// ASSERT
5655
Assert.IsTrue(projectTypes.Count() == 3);
56+
projectTypeLogic.Dispose();
5757
}
5858

5959
[TestMethod]

TakeMyTime.WPF/Projects/ProjectOverview.xaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@
7676
Margin="18"
7777
Visibility="Visible"
7878
SelectionChanged="lv_Projects_SelectionChanged"
79-
SelectionMode="Single"
80-
ScrollViewer.VerticalScrollBarVisibility="Visible">
79+
SelectionMode="Single">
8180
<!--<ListView.Resources>
8281
<Style TargetType="{x:Type GridViewColumnHeader}">
8382
<Setter Property="HorizontalContentAlignment" Value="Left"></Setter>

TakeMyTime.WPF/Resources/Dashboard.Designer.cs

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TakeMyTime.WPF/Resources/Dashboard.de-DE.resx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,18 @@
120120
<data name="Friday" xml:space="preserve">
121121
<value>Freitag</value>
122122
</data>
123+
<data name="LabelAssignmentDistribution" xml:space="preserve">
124+
<value>Verteilte Arbeitszeit bei ausgewähltem Projekt</value>
125+
</data>
126+
<data name="LabelMostProductiveWeekdays" xml:space="preserve">
127+
<value>Produktivste Wochentage</value>
128+
</data>
129+
<data name="LabelTotalShareOfProjects" xml:space="preserve">
130+
<value>Arbeitszeit verteilt auf alle Projekte</value>
131+
</data>
132+
<data name="LabelWorkingTimeHistory" xml:space="preserve">
133+
<value>Durchschnittliche Arbeitszeit verteilt auf alle Zeiteinträge zum ausgewählten Projekt</value>
134+
</data>
123135
<data name="Monday" xml:space="preserve">
124136
<value>Montag</value>
125137
</data>

TakeMyTime.WPF/Resources/Dashboard.resx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,18 @@
120120
<data name="Friday" xml:space="preserve">
121121
<value>Friday</value>
122122
</data>
123+
<data name="LabelAssignmentDistribution" xml:space="preserve">
124+
<value>Working time shared among assignments for selected project</value>
125+
</data>
126+
<data name="LabelMostProductiveWeekdays" xml:space="preserve">
127+
<value>Most productive weekday distribution</value>
128+
</data>
129+
<data name="LabelTotalShareOfProjects" xml:space="preserve">
130+
<value>Working time shared among all projects</value>
131+
</data>
132+
<data name="LabelWorkingTimeHistory" xml:space="preserve">
133+
<value>Average working time on selected project for all log entries</value>
134+
</data>
123135
<data name="Monday" xml:space="preserve">
124136
<value>Monday</value>
125137
</data>

TakeMyTime.WPF/Statistics/Dashboard.xaml

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,28 @@
1616
<Grid>
1717
<Grid.RowDefinitions>
1818
<RowDefinition Height="3*"></RowDefinition>
19+
<RowDefinition Height="40"></RowDefinition>
1920
<RowDefinition></RowDefinition>
2021
</Grid.RowDefinitions>
2122
<Grid Grid.Row="0">
2223
<Grid.RowDefinitions>
24+
<RowDefinition Height="40"></RowDefinition>
2325
<RowDefinition Height="40"></RowDefinition>
2426
<RowDefinition Height="2*"></RowDefinition>
27+
<RowDefinition Height="40"></RowDefinition>
2528
<RowDefinition></RowDefinition>
2629
</Grid.RowDefinitions>
2730
<Grid.ColumnDefinitions>
2831
<ColumnDefinition></ColumnDefinition>
2932
<ColumnDefinition></ColumnDefinition>
3033
</Grid.ColumnDefinitions>
31-
<lvc:PieChart Grid.Row="1" Grid.Column="0"
34+
<Label Grid.Row="1" Content="{x:Static resources:Dashboard.LabelTotalShareOfProjects}"
35+
FontFamily="Segoe UI"
36+
Foreground="{StaticResource LightWhite}"
37+
FontWeight="Bold"
38+
FontSize="20"
39+
VerticalAlignment="Bottom"></Label>
40+
<lvc:PieChart Grid.Row="2" Grid.Column="0"
3241
Margin="10"
3342
LegendLocation="Right" Series="{Binding ShareOfProjects}"
3443
x:Name="pc_ProjectShare"
@@ -38,18 +47,30 @@
3847
Grid.Row="0"
3948
Grid.Column="1"
4049
HorizontalAlignment="Left"
41-
Content="{x:Static resources:Dashboard.ProjectFilterLabel}"></Label>
50+
Content="{x:Static resources:Dashboard.ProjectFilterLabel}"
51+
Foreground="{StaticResource LightWhite}"></Label>
4252
<ComboBox
4353
Margin="0 5 50 0"
4454
Grid.Row="0" Grid.Column="1"
4555
x:Name="cb_ProjectFilter"
4656
Width="200"
4757
HorizontalAlignment="Right"
58+
Foreground="{StaticResource LightWhite}"
4859
ItemsSource="{Binding ProjectViewModels}"
4960
SelectionChanged="cb_ProjectFilter_SelectionChanged"
5061
DisplayMemberPath="Name"
5162
></ComboBox>
52-
<lvc:PieChart Grid.Row="1"
63+
<Label x:Name="lbl_AssignmentShare"
64+
Grid.Row="1"
65+
Grid.Column="1"
66+
Content="{x:Static resources:Dashboard.LabelAssignmentDistribution}"
67+
FontFamily="Segoe UI"
68+
FontSize="20"
69+
Foreground="{StaticResource LightWhite}"
70+
FontWeight="Bold"
71+
VerticalAlignment="Bottom"
72+
Visibility="Hidden"></Label>
73+
<lvc:PieChart Grid.Row="2"
5374
Margin="10"
5475
Grid.Column="1"
5576
Series="{Binding ShareOfAssignments}"
@@ -58,8 +79,18 @@
5879
Visibility="Hidden"
5980
InnerRadius="50"
6081
></lvc:PieChart>
82+
<Label x:Name="lbl_WorkingTimeHistory"
83+
Grid.Row="3"
84+
Grid.Column="0"
85+
Grid.ColumnSpan="2"
86+
FontWeight="Bold"
87+
FontSize="20"
88+
VerticalAlignment="Bottom"
89+
Visibility="Hidden"
90+
Foreground="{StaticResource LightWhite}"
91+
Content="{x:Static resources:Dashboard.LabelWorkingTimeHistory}"></Label>
6192
<lvc:CartesianChart
62-
Grid.Row="2"
93+
Grid.Row="4"
6394
Grid.Column="0"
6495
Grid.ColumnSpan="2"
6596
Visibility="Hidden"
@@ -77,15 +108,21 @@
77108
</lvc:CartesianChart>
78109

79110
</Grid>
111+
<Label Grid.Row="1"
112+
Foreground="{StaticResource LightWhite}"
113+
FontWeight="Bold"
114+
FontSize="20"
115+
VerticalAlignment="Bottom"
116+
Content="{x:Static resources:Dashboard.LabelMostProductiveWeekdays}"></Label>
80117
<lvc:CartesianChart
81-
Grid.Row="3"
118+
Grid.Row="2"
82119
Margin="10"
83120
x:Name="cc_MostProductiveWeekdays">
84121
<lvc:CartesianChart.AxisX>
85122
<lvc:Axis x:Name="weekdays_x_Axis" Labels="{Binding WeekdayLabels}"></lvc:Axis>
86123
</lvc:CartesianChart.AxisX>
87124
<lvc:CartesianChart.AxisY>
88-
<lvc:Axis x:Name="weekdays_y_Axis"></lvc:Axis>
125+
<lvc:Axis x:Name="weekdays_y_Axis" LabelFormatter="{Binding YAxisFormatter}"></lvc:Axis>
89126
</lvc:CartesianChart.AxisY>
90127
</lvc:CartesianChart>
91128
</Grid>

TakeMyTime.WPF/Statistics/Dashboard.xaml.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public void LoadSharesOfAssignments(int project_id)
9595

9696
this.pc_AssignmentShare.Series = this.ShareOfAssignments;
9797
this.pc_AssignmentShare.Visibility = Visibility.Visible;
98+
this.lbl_AssignmentShare.Visibility = Visibility.Visible;
9899
}
99100

100101
public void LoadProductiveDays(int project_id)
@@ -112,6 +113,7 @@ public void LoadProductiveDays(int project_id)
112113
this.cc_Productivity.Series = this.ProductiveDays;
113114
this.dateAxis.LabelFormatter = Formatter;
114115
this.cc_Productivity.Visibility = Visibility.Visible;
116+
this.lbl_WorkingTimeHistory.Visibility = Visibility.Visible;
115117
DataContext = this;
116118
}
117119

@@ -121,14 +123,15 @@ public void LoadMostProductiveDays()
121123
this.MostProductiveWeekDaysViewModels = this.statisticsLogic.GetMostProductiveWeekDays();
122124
var series = new ColumnSeries
123125
{
124-
Values = this.MostProductiveWeekDaysViewModels.Select(vm => Math.Round(vm.Value, 2)).AsChartValues()
126+
Values = this.MostProductiveWeekDaysViewModels.Select(vm => Math.Round(vm.Value, 2)).AsChartValues(),
125127
};
126128
series.Fill = Brushes.Orange;
127129
this.MostProductiveWeekdays.Add(series);
128130
this.cc_MostProductiveWeekdays.Series = this.MostProductiveWeekdays;
129-
130131
this.WeekdayLabels = ResolveWeekdayNames(this.MostProductiveWeekDaysViewModels);
131132
this.weekdays_x_Axis.Labels = this.WeekdayLabels;
133+
this.YAxisFormatter = val => string.Format("{0:0.#}%", val * 100);
134+
this.weekdays_y_Axis.LabelFormatter = this.YAxisFormatter;
132135
DataContext = this;
133136
}
134137

@@ -156,6 +159,7 @@ private string[] ResolveWeekdayNames(IEnumerable<MostProductiveWeekDaysViewModel
156159
public Dictionary<string, double> ProjectShares { get; set; }
157160
public IEnumerable<ProductivityViewModel> ProductiveEntryDays { get; set; }
158161
public Func<double, string> Formatter { get; set; }
162+
public Func<double, string> YAxisFormatter { get; set; }
159163
public IEnumerable<MostProductiveWeekDaysViewModel> MostProductiveWeekDaysViewModels { get; set; }
160164
public string[] WeekdayLabels { get; set; }
161165

0 commit comments

Comments
 (0)