Skip to content

Commit

Permalink
Set DefaultSortingOption to SortingOption.Views
Browse files Browse the repository at this point in the history
  • Loading branch information
brminnick committed Mar 16, 2020
1 parent b2f16d5 commit ca0d19f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion GitTrends.Shared/Constants/SortingConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace GitTrends.Shared
{
class SortingConstants
{
public const SortingOption DefaultSortingOption = SortingOption.Stars;
public const SortingOption DefaultSortingOption = SortingOption.Views;

readonly static Lazy<Dictionary<SortingOption, string>> _sortingOptionsDictionaryHolder = new Lazy<Dictionary<SortingOption, string>>(CreateSortingDictionary);

Expand Down
6 changes: 3 additions & 3 deletions GitTrends.UITests/Tests/RepositoriesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void VerifySortingOptions(SortingOption sortingOption)
finalTopRepository = RepositoryPage.GetVisibleRepositoryList().First();
finalSecondTopRepository = RepositoryPage.GetVisibleRepositoryList().Skip(1).First();

Assert.GreaterOrEqual(initialTopRepository.StarCount, initialSecondTopRepository.StarCount);
Assert.GreaterOrEqual(initialTopRepository.TotalViews, initialSecondTopRepository.TotalViews);

Assert.AreNotEqual(initialTopRepository, finalTopRepository);
Assert.AreNotEqual(initialSecondTopRepository, finalSecondTopRepository);
Expand All @@ -52,7 +52,7 @@ public void VerifySortingOptions(SortingOption sortingOption)
switch (sortingOption)
{
case SortingOption.Stars:
Assert.LessOrEqual(finalTopRepository.StarCount, finalSecondTopRepository.StarCount);
Assert.GreaterOrEqual(finalTopRepository.StarCount, finalSecondTopRepository.StarCount);
break;
case SortingOption.Clones:
Assert.GreaterOrEqual(finalTopRepository.TotalClones, finalSecondTopRepository.TotalClones);
Expand All @@ -70,7 +70,7 @@ public void VerifySortingOptions(SortingOption sortingOption)
Assert.GreaterOrEqual(finalTopRepository.TotalUniqueViews, finalSecondTopRepository.TotalUniqueViews);
break;
case SortingOption.Views:
Assert.GreaterOrEqual(finalTopRepository.TotalViews, finalSecondTopRepository.TotalViews);
Assert.LessOrEqual(finalTopRepository.TotalViews, finalSecondTopRepository.TotalViews);
break;
default:
throw new NotSupportedException();
Expand Down
2 changes: 2 additions & 0 deletions GitTrends/ViewModels/RepositoryViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ async Task ExecutePullToRefreshCommand(string repositoryOwner)
{
const int repositoriesPerFetch = 100;

AnalyticsService.Track("Refresh Triggered", "Sorting Option", _sortingService.CurrentOption.ToString());

try
{
await foreach (var retrievedRepositories in _gitHubGraphQLApiService.GetRepositories(repositoryOwner, repositoriesPerFetch).ConfigureAwait(false))
Expand Down

0 comments on commit ca0d19f

Please sign in to comment.