aboutsummaryrefslogtreecommitdiff
path: root/src/feature/topanime.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/feature/topanime.rs')
-rw-r--r--src/feature/topanime.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/feature/topanime.rs b/src/feature/topanime.rs
index cccc976..94edd30 100644
--- a/src/feature/topanime.rs
+++ b/src/feature/topanime.rs
@@ -30,12 +30,12 @@ impl Anime {
30 30
31pub struct TopAnime { 31pub struct TopAnime {
32 animes: Vec<Anime>, 32 animes: Vec<Anime>,
33 last_access: f64, 33 last_update: f64,
34} 34}
35 35
36impl Feature for TopAnime { 36impl Feature for TopAnime {
37 fn name(&self) -> &'static str { 37 fn name(&self) -> &'static str {
38 "Tasterank" 38 "TopAnime"
39 } 39 }
40 fn init(&mut self) {} 40 fn init(&mut self) {}
41 fn handle(&mut self, a: Api, m: Message) -> Result<FeatureResult, String> { 41 fn handle(&mut self, a: Api, m: Message) -> Result<FeatureResult, String> {
@@ -95,14 +95,14 @@ impl TopAnime {
95 pub fn new() -> TopAnime { 95 pub fn new() -> TopAnime {
96 let mut t = TopAnime { 96 let mut t = TopAnime {
97 animes: vec![], 97 animes: vec![],
98 last_access: 0f64, 98 last_update: 0f64,
99 }; 99 };
100 t.init(); 100 t.init();
101 t 101 t
102 } 102 }
103 fn update_animes(&mut self) -> Result<(), io::Error> { 103 fn update_animes(&mut self) -> Result<(), io::Error> {
104 let now = time::precise_time_s(); 104 let now = time::precise_time_s();
105 if now - self.last_access < 3600.0f64 { 105 if now - self.last_update < 3600.0f64 {
106 return Ok(()); 106 return Ok(());
107 } 107 }
108 let mut f = try!(File::open("data/animescore.json")); 108 let mut f = try!(File::open("data/animescore.json"));
@@ -113,7 +113,7 @@ impl TopAnime {
113 Err(e) => return Err(io::Error::new(io::ErrorKind::InvalidData, format!("{}", e))), 113 Err(e) => return Err(io::Error::new(io::ErrorKind::InvalidData, format!("{}", e))),
114 }; 114 };
115 self.animes = v; 115 self.animes = v;
116 self.last_access = now; 116 self.last_update = now;
117 Ok(()) 117 Ok(())
118 } 118 }
119} 119}