mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
code_style: use ?:
instead of if...else
branches
This commit is contained in:
parent
dc407b6033
commit
f15dd52fdd
1 changed files with 3 additions and 12 deletions
|
@ -40,10 +40,7 @@ namespace SourceGit.Models
|
||||||
if (timespan.TotalHours > 1)
|
if (timespan.TotalHours > 1)
|
||||||
return $"{(int)timespan.TotalHours} hours ago";
|
return $"{(int)timespan.TotalHours} hours ago";
|
||||||
|
|
||||||
if (timespan.TotalMinutes > 1)
|
return timespan.TotalMinutes < 1 ? "Just now" : $"{(int)timespan.TotalMinutes} minutes ago";
|
||||||
return $"{(int)timespan.TotalMinutes} minutes ago";
|
|
||||||
|
|
||||||
return $"Just now";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var diffYear = today.Year - committerTime.Year;
|
var diffYear = today.Year - committerTime.Year;
|
||||||
|
@ -54,16 +51,10 @@ namespace SourceGit.Models
|
||||||
return diffMonth == 1 ? "Last month" : $"{diffMonth} months ago";
|
return diffMonth == 1 ? "Last month" : $"{diffMonth} months ago";
|
||||||
|
|
||||||
var diffDay = today.Day - committerTime.Day;
|
var diffDay = today.Day - committerTime.Day;
|
||||||
if (diffDay > 0)
|
return diffDay == 1 ? "Yesterday" : $"{diffDay} days ago";
|
||||||
return diffDay == 1 ? "Yesterday" : $"{diffDay} days ago";
|
|
||||||
|
|
||||||
return "Today";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (diffYear == 1)
|
return diffYear == 1 ? "Last year" : $"{diffYear} years ago";
|
||||||
return "Last year";
|
|
||||||
|
|
||||||
return $"{diffYear} years ago";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue