mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
code_review: PR #711
* SourceGit.Commands.* should not reference code in SourceGit.ViewModels. Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
309db6e362
commit
8b3d129890
3 changed files with 6 additions and 5 deletions
|
@ -1,15 +1,14 @@
|
|||
using System;
|
||||
using SourceGit.ViewModels;
|
||||
|
||||
namespace SourceGit.Commands
|
||||
{
|
||||
public class Statistics : Command
|
||||
{
|
||||
public Statistics(string repo)
|
||||
public Statistics(string repo, int max)
|
||||
{
|
||||
WorkingDirectory = repo;
|
||||
Context = repo;
|
||||
Args = $"log --date-order --branches --remotes -{Preference.Instance.MaxHistoryCommits} --pretty=format:\"%ct$%aN\"";
|
||||
Args = $"log --date-order --branches --remotes -{max} --pretty=format:\"%ct$%aN\"";
|
||||
}
|
||||
|
||||
public Models.Statistics Result()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
using LiveChartsCore;
|
||||
using LiveChartsCore.Defaults;
|
||||
using LiveChartsCore.SkiaSharpView;
|
||||
|
@ -138,7 +139,8 @@ namespace SourceGit.Models
|
|||
public Statistics()
|
||||
{
|
||||
_today = DateTime.Now.ToLocalTime().Date;
|
||||
_thisWeekStart = _today.AddDays(((int)_today.DayOfWeek + (int)CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek) % 7 - 7);
|
||||
var weekOffset = (7 + (int)_today.DayOfWeek - (int)CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek) % 7;
|
||||
_thisWeekStart = _today.AddDays(-weekOffset);
|
||||
_thisMonthStart = _today.AddDays(1 - _today.Day);
|
||||
|
||||
All = new StatisticsReport(StaticsticsMode.All, DateTime.MinValue);
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
var result = new Commands.Statistics(repo).Result();
|
||||
var result = new Commands.Statistics(repo, Preference.Instance.MaxHistoryCommits).Result();
|
||||
Dispatcher.UIThread.Invoke(() =>
|
||||
{
|
||||
_data = result;
|
||||
|
|
Loading…
Reference in a new issue