Skip to content

Commit

Permalink
Merge pull request #48 from SEbbaDK/server-fix-contribution-deseriali…
Browse files Browse the repository at this point in the history
…sation

server: Fix contribution deserialization
  • Loading branch information
SEbbaDK authored May 25, 2021
2 parents af8afd9 + 5992e86 commit 5d70128
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions server/database/create-materialized-views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CREATE MATERIALIZED VIEW leaderboardWeekly AS
FROM (
SELECT userID, SUM (score) AS score
FROM contributions
WHERE dateTime BETWEEN date_trunc('week', CURRENT_DATE) AND CURRENT_DATE
WHERE dateTime BETWEEN date_trunc('week', CURRENT_DATE) AND NOW()
GROUP BY userID
) AS s
RIGHT OUTER JOIN
Expand All @@ -28,7 +28,7 @@ CREATE MATERIALIZED VIEW leaderboardMonthly AS
FROM (
SELECT userID, SUM (score) AS score
FROM contributions
WHERE dateTime BETWEEN date_trunc('month', CURRENT_DATE) AND CURRENT_DATE
WHERE dateTime BETWEEN date_trunc('month', CURRENT_DATE) AND NOW()
GROUP BY userID
) AS s
RIGHT OUTER JOIN
Expand Down
2 changes: 1 addition & 1 deletion server/shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: maptogether-server
version: 0.3.1
version: 0.3.2

authors:
- SEbbaDK
Expand Down
4 changes: 2 additions & 2 deletions server/src/contribution.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class Contribution
def self.from_json(json_obj)
# contribution_id: json_obj["contributionid"]?.as(Int64 | Nil),
contribution = Contribution.new(
user_id: json_obj["id"].as(Int64),
user_id: json_obj["user_id"].as(Int64),
type: json_obj["type"].as(Int64),
changeset: json_obj["changeset"].as(Int64),
score: json_obj["score"].as(Int64),
date_time: Time.parse_iso8601(json_obj.["datetime"].as(String)),
date_time: Time.parse_iso8601(json_obj.["date_time"].as(String)),
)
end
end

0 comments on commit 5d70128

Please sign in to comment.