default ordering
This commit is contained in:
@@ -198,8 +198,14 @@ impl HanimeProvider {
|
||||
|
||||
async fn get(&self, cache: VideoCache, pool: DbPool, page: u8, query: String, sort:String) -> Result<Vec<VideoItem>> {
|
||||
let index = format!("{}:{}:{}", query, page, sort);
|
||||
let order_by = sort.split(".").collect::<Vec<&str>>()[0].to_string();
|
||||
let ordering = sort.split(".").collect::<Vec<&str>>()[1].to_string();
|
||||
let order_by = match sort.contains("."){
|
||||
true => sort.split(".").collect::<Vec<&str>>()[0].to_string(),
|
||||
false => "created_at_unix".to_string(),
|
||||
};
|
||||
let ordering = match sort.contains("."){
|
||||
true => sort.split(".").collect::<Vec<&str>>()[1].to_string(),
|
||||
false => "desc".to_string(),
|
||||
};
|
||||
let old_items = match cache.get(&index) {
|
||||
Some((time, items)) => {
|
||||
if time.elapsed().unwrap_or_default().as_secs() < 60 * 60 * 12 {
|
||||
|
||||
Reference in New Issue
Block a user