Skip to content

Commit

Permalink
more data to streaks #1
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed May 11, 2015
1 parent 82da843 commit d55bc63
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 8 additions & 1 deletion applications/api.moon
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,19 @@ format_user = (u) ->
}

format_streak = do
fields = {"id", "start_date", "end_date", "hour_offset"}
fields = {
"id", "start_date", "end_date", "hour_offset", "title", "short_description"
}

(s) ->
import Streaks from require "models"
out = {f, s[f] for f in *fields}
out.host = format_user s\get_user!

out.publish_status = Streaks.publish_statuses\to_name s.publish_status
out.rate = Streaks.rates\to_name s.rate
out.category = Streaks.categories\to_name s.category

out

class StreakApi extends lapis.Application
Expand Down
1 change: 0 additions & 1 deletion spec/applications/api_spec.moon
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ describe "api", ->
status, res = request_with_key "/api/1/my-streaks"
assert.same 200, status


assert.same {}, res.hosted
assert.same {s1.id}, [s.id for s in *res.joined.upcoming]
assert.same {s2.id}, [s.id for s in *res.joined.completed]
Expand Down

0 comments on commit d55bc63

Please sign in to comment.