Fix ordering videos by uploaded to yt and decrease vids shown

This commit is contained in:
hak8or 2018-02-24 23:42:42 -05:00
parent 9ac93a540e
commit e140cae317
2 changed files with 6 additions and 5 deletions

View File

@ -28,7 +28,7 @@ namespace YTManager.Controllers {
private readonly MediaDB db; private readonly MediaDB db;
// Maximum number of channels to return per query. // Maximum number of channels to return per query.
private readonly int max_per_query = 20; private readonly int max_per_query = 10;
// Constructor to fetch the db context. // Constructor to fetch the db context.
public ChannelsController(MediaDB context) => db = context; public ChannelsController(MediaDB context) => db = context;

View File

@ -1,4 +1,5 @@
using System.Linq; using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
@ -36,7 +37,7 @@ namespace YTManager.Controllers {
} }
// Maximum number of entries to return per query. // Maximum number of entries to return per query.
private readonly int max_per_query = 20; private readonly int max_per_query = 18;
// DB context used for all these calls. // DB context used for all these calls.
private readonly MediaDB db; private readonly MediaDB db;
@ -50,7 +51,7 @@ namespace YTManager.Controllers {
// Get all the relevant videos. // Get all the relevant videos.
var vids = await db.Videos var vids = await db.Videos
.Include(v => v.Channel) .Include(v => v.Channel)
.OrderByDescending(i => i.AddedtoDB) .OrderByDescending(i => i.AddedToYT)
.Take(max_per_query) .Take(max_per_query)
.ToListAsync(); .ToListAsync();
@ -70,7 +71,7 @@ namespace YTManager.Controllers {
var vids = await db.Videos var vids = await db.Videos
.Include(v => v.Channel) .Include(v => v.Channel)
.Where(v => v.Channel.Title == channelName) .Where(v => v.Channel.Title == channelName)
.OrderByDescending(i => i.AddedtoDB) .OrderByDescending(i => i.AddedToYT)
.Take(max_per_query) .Take(max_per_query)
.ToListAsync(); .ToListAsync();