+ def get_sp(self, uid, char_id):
+ sheet = self.get_char_sheet(uid, char_id)
+
+ # TODO: we also have to calculate how much we earned from a
+ # currently training skill
+
+ actual_sp = 0
+
+ for skill in sheet.skills:
+ actual_sp += skill.skillpoints
+
+ live_sp = actual_sp + self.get_training_sp(uid, char_id)
+
+ return live_sp
+
+ def get_spps(self, uid, char_id):
+ """
+ Calculate and returns the skill points per hour for the given character.
+ """
+ skill = self.get_skill_in_training(uid, char_id)
+
+ if not skill.skillInTraining:
+ return (0, 0)
+
+ total_sp = skill.trainingDestinationSP - skill.trainingStartSP
+ total_time = skill.trainingEndTime - skill.trainingStartTime
+
+ spps = float(total_sp) / total_time
+
+ return (spps, skill.trainingStartTime)
+
+ def get_training_sp(self, uid, char_id):
+ """
+ returns the additional SP that the in-training skill has acquired
+ """
+
+ spps_tuple = self.get_spps(uid, char_id)
+
+ print spps_tuple
+
+ if not spps_tuple:
+ return 0
+
+ spps, start_time = spps_tuple
+
+ eve_time = time.time() #evetime is utc, right?
+
+ time_diff = eve_time - start_time
+
+ return (spps * time_diff)
+
+