v0.1.3 release
fixed some issues, forgot which ones
This commit is contained in:
parent
7f138cf73f
commit
b25949a8f3
9 changed files with 35 additions and 7 deletions
|
@ -20,6 +20,14 @@ public static class UsersRepository
|
|||
await using var db = new AppDBContext();
|
||||
return await db.Users.FirstOrDefaultAsync(user => user.UserID == userId);
|
||||
}
|
||||
|
||||
public static async Task<UserData> getUserByEmailRawAsync(string email)
|
||||
{
|
||||
await using var db = new AppDBContext();
|
||||
return await db.Users
|
||||
.Where(user => user.Email == email)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public static async Task<UserData> getUserByEmailAsync(string email)
|
||||
{
|
||||
|
|
|
@ -10,6 +10,11 @@ public class TheManager
|
|||
return (DateTimeOffset.Now.ToUnixTimeMilliseconds() - post.CreatedAt);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the value without a minus, if it exists
|
||||
/// </summary>
|
||||
/// <param name="num"></param>
|
||||
/// <returns></returns>
|
||||
private static long getValue(long num)
|
||||
{
|
||||
return num < 0 ? num * -1 : num;
|
||||
|
@ -17,13 +22,13 @@ public class TheManager
|
|||
|
||||
public static long getBumpValue(PostData post)
|
||||
{
|
||||
return getValue( 10 * 60000 - getDiff(post)) + getDiff(post) / post.Comments.Count;
|
||||
return 10 * 60000 - getDiff(post) + ( 60000 * (post.Comments.Count + 1));
|
||||
}
|
||||
|
||||
public static async Task<List<PostData>> getPostList(string boardTag)
|
||||
{
|
||||
List<PostData> threads = await PostsRepository.getPostsByBoardAsync(boardTag);
|
||||
return threads.OrderBy(getBumpValue).ToList();
|
||||
return threads.OrderBy(getBumpValue).Reverse().ToList();
|
||||
}
|
||||
|
||||
public static async Task bumpThreads(BoardData board)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue