diff options
author | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2020-02-07 22:12:31 -0500 |
---|---|---|
committer | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2020-02-07 22:12:31 -0500 |
commit | 16c0e847452629c2af9fa1dac7a9d83ae3846c62 (patch) | |
tree | 75f1896b5de502143caa9d88f67b3996a8b364fb /src/db.rs | |
parent | 06dbcc08dd75cdcb790e3f41180114cbcddb8bc8 (diff) |
Properly display running entries as a table
Diffstat (limited to 'src/db.rs')
-rw-r--r-- | src/db.rs | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -241,16 +241,24 @@ pub fn get_raw_data_keys(conn: &PgConnection) -> Result<Vec<models::RawDataKey>, Ok(rows) } -pub fn get_entries(conn: &PgConnection, username: &str) -> Result<Vec<models::Entry>, Error> { +pub fn get_entries( + conn: &PgConnection, + username: &str, + entry_type: &str, +) -> Result<Vec<models::Entry>, Error> { use crate::schema::entries; let r = entries::table - .filter(entries::username.eq(username)) + .filter( + entries::username + .eq(username) + .and(entries::entry_type.eq(entry_type)), + ) .get_results::<models::Entry>(conn)?; Ok(r) } pub fn get_template( - conn: &PgConnection, + _conn: &PgConnection, entry_type: &str, ) -> Result<template::TemplateSpec, Error> { match entry_type { |