traitify-magis 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77d4c1445bcdcced1bc75f9a405024865ccaaa72
4
- data.tar.gz: e3b2e3b262f0d90d12538ab578f76961298b2eba
3
+ metadata.gz: daceb8b68c2d5c0944cc5198013faa4d84a96d89
4
+ data.tar.gz: ea9b709ad95acde0699aefe363be8c3fb534b6b3
5
5
  SHA512:
6
- metadata.gz: 1488cc8e7226decf71cc3164473850e92034f51f020b88b10e4f3fa0eb2750c8af0c2725ac5ec96df35c567d46d84ae39159fa0c32a3fefd6f51bb39740eebdd
7
- data.tar.gz: b184638344a7835d202b5b71841e13b3c001abd70da141f76ddfcd6d453c62e424998333b8dd58dd0ae33547ce944a88fc90ba3b02193b2928cbe552bc521c57
6
+ metadata.gz: cf70b346f09358f0ca9822a9e4ba28eb59d085d2b5ab419e76f03d23371a7fca87f361e06bd0740ca130230846b7c69299dd6d74340569845352f52a7db33552
7
+ data.tar.gz: 5feb80cf8603f5cfb163244e4595b03bcea90d880a4a7c27120e5182fe5a68619c19cc210eb283c8468da9e0e34024b5d692760ab45cd760791c8e02d5e49560
@@ -1,3 +1,3 @@
1
1
  module TraitifyMagis
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -4,10 +4,13 @@ require "traitify"
4
4
  require 'active_support/inflector'
5
5
 
6
6
  class Api < Sinatra::Base
7
- before "/majis.js" do
8
- @traitify = Magis.load_configuration("traitify")
9
- @traitify[:decks].each do |deck|
10
- create_assessment(deck)
7
+ before "*" do
8
+ unless session["decks"]
9
+ @traitify = Magis.load_configuration("traitify")
10
+ @traitify["decks"].each do |deck|
11
+ create_assessment(deck)
12
+ end
13
+ session["decks"] = @traitify["decks"]
11
14
  end
12
15
  end
13
16
 
@@ -21,14 +24,16 @@ class Api < Sinatra::Base
21
24
  traitify.secret = ENV["TRAITIFY_SECRET"] || traitify_credentials["secret_key"]
22
25
  traitify.api_host = ENV["TRAITIFY_API_HOST"] || traitify_credentials["api_host"]
23
26
  traitify.api_version = ENV["TRAITIFY_API_VERSION"] || traitify_credentials["api_version"]
27
+ p "creating assessment"
24
28
  if Magis.db["users"]["assessments"][id]
25
29
  assessment_id = traitify.create_assessment(deck_id: id).id
30
+ assessments = Magis.db["users"]["assessments"]
31
+ assessments[id] = {
32
+ id.camelcase(:lower) => assessment_id
33
+ }
34
+
26
35
  Magis.db["users"].update({"_id" => current_user["_id"]}, {
27
- "$set" => {
28
- assessments: {
29
- id.camelcase(:lower) => assessment_id
30
- }
31
- }
36
+ "$set" => assessments
32
37
  })
33
38
 
34
39
  assessment_id
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traitify-magis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hashrocket Workstation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-26 00:00:00.000000000 Z
11
+ date: 2015-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: traitify