DM FIX: Use the Spanish translations for which we have values; fallback to en otherwise

--- src/objective8/translation.clj
+++ src/objective8/translation.clj
@@ -4,65 +4,63 @@

 ;;TODO move translations to external files

-(declare spanish-translations)
-
-(def translation-config
-  {:dictionary {:en { :base {:header-logo-text "Objective[8]"
-                             :header-logo-title "Go to home page"
-                             :project-status! "ALPHA: We are still testing, find out more"
-                             :browsehappy! "You are using an outdated browser. Please upgrade your browser to improve your experience."}
-                     :navigation-global {:sign-in-text "Sign in"
-                                         :sign-in-title "Go to sign in"
-                                         :sign-out-text "Sign out"
-                                         :sign-out-title "Go to sign out"
-                                         :profile-text "Profile"
-                                         :profile-title "Go to user profile"}
-                     :share-widget {:title "Share this page:"
-                                    :facebook-title "Share on Facebook..."
-                                    :facebook-text "Share on Facebook"
-                                    :google-plus-title "Plus one this page on Google"
-                                    :google-plus-text "Google +1"
-                                    :twitter-title "Share this page on Twitter"
-                                    :twitter-text "Tweet"
-                                    :linkedin-title "Share this page on LinkedIn"
-                                    :linkedin-text "Share on LinkedIn"
-                                    :reddit-title "Submit this page to Reddit"
-                                    :reddit-text "Submit to Reddit"
-                                    :url-label "URL to share"
-                                    :url-title "The link to this page"}
-                     :error-404 {:doc-title "Error 404 | Objective[8]"
-                                 :doc-description "Sorry the page you requested can't be found."
-                                 :page-title "Sorry the page you requested can't be found."
-                                 :page-intro "The page you were trying to reach at this address doesn't seem to exist. This is usually the result of a bad or outdated link. We apologise for any inconvenience."
-                                 :page-content! "
What can I do now?

Please return to the home page.

To report an issue visit our github issues page.

" }
-                     :notifications {:drafting-has-started "Drafting has started on this objective!"
-                                     :drafting-started-helper-text "This means that you can no longer ask or answer questions, comment, or invite new writers.  However, you can follow and contribute to the drafting progress "
-                                     :go-to-drafting "here."}
-                     :index {:doc-title "Objective[8]"
-                             :doc-description ""
-                             :index-welcome "Collaborative policy making for democratic organisations."
-                             :index-intro "Gather community opinion, generate ideas, share, discuss, vote and collaborate with experts to draft new policy."
-                             :index-get-started "Objectives"
-                             :index-get-started-title "Objectives"
-                             :index-learn-more "Learn more"
-                             :index-learn-more-title "Learn more"}
-                     :sign-in {:doc-title "Sign in or Sign up | Objective[8]"
-                               :doc-description "Sign in or Sign up to Objective [8]"
-                               :page-title "Sign in or Sign up"
-                               :twitter-sign-in-btn "Sign in with twitter"
-                               :twitter-sign-in-title "Sign in with twitter"
-                               :reassurance "We will never post to Twitter without your permission."}
-                     :project-status {:doc-title "Project status | Objective[8]"
-                                      :doc-description ""
-                                      :page-title "Alpha phase"
-                                      :page-intro "We are developing and designing Objective[8] in the open. This allows the tool evolve as you use it, as you give feedback, and as the developers update and add content."
-                                      :page-content! "
It is important to note that during this time data may be removed or destroyed as part of our process. Any of the views and data expressed here is to be used for example purposes only and does not accurately represent the real views of users.

How to get involved

This project is open source and we are inviting people to collaborate with us to build a better tool. For developers and you can find the code on github at https://github.com/ThoughtWorksInc/objective8. We will also be adding details for upcoming usability sessions shortly.

Have you got an idea?

We are really interested in user feedback and are currently inviting people to leave comments our github issues page.
" }
-                     :learn-more {:doc-title "Learn more | Objective[8]"
-                                  :doc-description ""
-                                  :page-title "Objective[8] 101"
-                                  :sub-title "What are the basics?"
-                                  :page-intro "Objective8 is a platform to enable collaborative policy making for democratic organisations."
-                                  :page-content! "
+(def english-translations
+  {:base {:header-logo-text "Objective[8]"
+          :header-logo-title "Go to home page"
+          :project-status! "ALPHA: We are still testing, find out more"
+          :browsehappy! "You are using an outdated browser. Please upgrade your browser to improve your experience."}
+   :navigation-global {:sign-in-text "Sign in"
+                       :sign-in-title "Go to sign in"
+                       :sign-out-text "Sign out"
+                       :sign-out-title "Go to sign out"
+                       :profile-text "Profile"
+                       :profile-title "Go to user profile"}
+   :share-widget {:title "Share this page:"
+                  :facebook-title "Share on Facebook..."
+                  :facebook-text "Share on Facebook"
+                  :google-plus-title "Plus one this page on Google"
+                  :google-plus-text "Google +1"
+                  :twitter-title "Share this page on Twitter"
+                  :twitter-text "Tweet"
+                  :linkedin-title "Share this page on LinkedIn"
+                  :linkedin-text "Share on LinkedIn"
+                  :reddit-title "Submit this page to Reddit"
+                  :reddit-text "Submit to Reddit"
+                  :url-label "URL to share"
+                  :url-title "The link to this page"}
+   :error-404 {:doc-title "Error 404 | Objective[8]"
+               :doc-description "Sorry the page you requested can't be found."
+               :page-title "Sorry the page you requested can't be found."
+               :page-intro "The page you were trying to reach at this address doesn't seem to exist. This is usually the result of a bad or outdated link. We apologise for any inconvenience."
+               :page-content! "
What can I do now?

Please return to the home page.

To report an issue visit our github issues page.

" }
+   :notifications {:drafting-has-started "Drafting has started on this objective!"
+                   :drafting-started-helper-text "This means that you can no longer ask or answer questions, comment, or invite new writers.  However, you can follow and contribute to the drafting progress "
+                   :go-to-drafting "here."}
+   :index {:doc-title "Objective[8]"
+           :doc-description ""
+           :index-welcome "Collaborative policy making for democratic organisations."
+           :index-intro "Gather community opinion, generate ideas, share, discuss, vote and collaborate with experts to draft new policy."
+           :index-get-started "Objectives"
+           :index-get-started-title "Objectives"
+           :index-learn-more "Learn more"
+           :index-learn-more-title "Learn more"}
+   :sign-in {:doc-title "Sign in or Sign up | Objective[8]"
+             :doc-description "Sign in or Sign up to Objective [8]"
+             :page-title "Sign in or Sign up"
+             :twitter-sign-in-btn "Sign in with twitter"
+             :twitter-sign-in-title "Sign in with twitter"
+             :reassurance "We will never post to Twitter without your permission."}
+   :project-status {:doc-title "Project status | Objective[8]"
+                    :doc-description ""
+                    :page-title "Alpha phase"
+                    :page-intro "We are developing and designing Objective[8] in the open. This allows the tool evolve as you use it, as you give feedback, and as the developers update and add content."
+                    :page-content! "
It is important to note that during this time data may be removed or destroyed as part of our process. Any of the views and data expressed here is to be used for example purposes only and does not accurately represent the real views of users.

How to get involved

This project is open source and we are inviting people to collaborate with us to build a better tool. For developers and you can find the code on github at https://github.com/ThoughtWorksInc/objective8. We will also be adding details for upcoming usability sessions shortly.

Have you got an idea?

We are really interested in user feedback and are currently inviting people to leave comments our github issues page.
" }
+   :learn-more {:doc-title "Learn more | Objective[8]"
+                :doc-description ""
+                :page-title "Objective[8] 101"
+                :sub-title "What are the basics?"
+                :page-intro "Objective8 is a platform to enable collaborative policy making for democratic organisations."
+                :page-content! "

Policy is used by governments and organisations to make consistent and fair decisions in order to achieve desired outcomes.

An objective is a change that could be achieved by introducing new policy.  For example: improving access to public housing, or increasing the safety of our roads.

@@ -72,307 +70,307 @@

You can get involved and have your say by creating and sharing objectives, offering your opinion through comments, asking and answering questions, suggesting policy writers, or even providing feedback on the policy drafts themselves.  The whole process is open and transparent.

 *As the site is still under development, these features have not yet been implemented. Check back soon!
 "
-                                  :get-started-button-title "Get started"
-                                  :get-started-button-text "Get started"}
-                     :objective-nav {:title "Navigation for"
-                                     :details "Details"
-                                     :questions "Questions"
-                                     :writers "Writers"}
-                     :objective-list {:doc-title "Objectives | Objective[8]"
-                                      :doc-description ""
-                                      :page-title "Objectives"
-                                      :create-button-title "Create an objective"
-                                      :create-button-text "Create an objective"
-                                      :please "Please"
-                                      :sign-in "sign in"
-                                      :to "to create an objective."
-                                      :subtitle "Recently created objectives"
-                                      :drafting-begins "Drafting begins on"
-                                      :objectives-intro-text "Objective[8] centers its policy drafting process around objectives. An objective is a change that could be achieved by introducing new policy." }
-                     :objective-create {:doc-title "Create an Objective | Objective[8]"
-                                        :doc-description "Create an Objective ..."
-                                        :page-title "Create an objective"
-                                        :page-intro "An objective is a change that could be achieved by introducing new policy. For example: improving access to public housing, or increasing the safety of our roads."
-                                        :headline-label "Headline"
-                                        :headline-title "3 characters minimum, 120 characters maximum"
-                                        :headline-prompt "A headline should encourage contribution or discussion"
-                                        :goals-label "Goals"
-                                        :goals-prompt "A goal is what you’d like your change to achieve"
-                                        :goals-title "50 characters minimum, 200 characters maximum"
-                                        :background-label "Background"
-                                        :background-prompt "Provide further information on why achieving this objective is important or necessary"
-                                        :background-title "Enter optional background text up to 1000 characters"
-                                        :end-date-label "Drafting start date"
-                                        :end-date-prompt "On this date, the drafting phase begins. You should give participants enough time to generate useful information, and to recruit and vote for potential policy writers."
-                                        :drafting-not-yet-implemented "(Please note: since this site is still under development, the drafting phase has not yet been implemented)"
-                                        :end-date-title "Please enter an end date"
-                                        :end-date-placeholder"yyyy-mm-dd"
-                                        :submit "Create"}
-                     :objective-view {:doc-title "Objective | Objective[8]"
-                                      :doc-description "Objective  ..."
-                                      :background-label "Background"
-                                      :goals-label "Goals"
-                                      :end-date-label "Drafting begins: "
-                                      :created-message "Your objective has been created!"}
-                     :comment-view {:created-message "Your comment has been added!"
-                                    :comment-title "Comments"
-                                    :no-comments "There are no comments yet."}
-                     :comment-create {:comment-label "Your comment"
-                                      :comment-title "Comments are a maximum length of 500 characters"
-                                      :post-button "Add comment"}
-                     :comment-sign-in {:please "Please"
-                                       :sign-in "sign in"
-                                       :to "to start commenting."}
-                     :question-list {:questions-about "Questions about"
-                                     :page-intro "Gather background information such as opinions and experiences by asking a question.  Your question should be focussed and specific, as the answers will influence the policy drafting process."
-                                     :question-list-heading "Recently asked questions"
-                                     :no-questions "There are no questions yet."}
-                     :question-create {:add-a-question "Add a question to this objective"
-                                       :question-label "Question"
-                                       :question-title "Questions are a maximum length of 500 characters"
-                                       :post-button "Add"}
-                     :question-view {:added-message "Your question has been added!"
-                                     :added-answer-message "Your answer has been added!"}
-                     :question-sign-in {:please "Please"
-                                        :sign-in "sign in"
-                                        :to "to add a question." }
-                     :answer-view   {:created-message "Your answer has been posted!"
-                                     :answer-title "Answers"
-                                     :no-answers "No one has answered this question yet."}
-                     :answer-create {:answer-label "Your answer"
-                                     :answer-title "Answers are a maximum length of 500 characters"
-                                     :post-button "Post your answer"}
-                     :answer-sign-in {:please "Please"
-                                      :sign-in "sign in"
-                                      :to "to answer this question."}
-                     :invitation {:doc-title "Candidate policy writers | Objective[8]"
-                                  :doc-description "Candidate policy writers..."
-                                  :page-title "Invite a policy writer"
-                                  :page-intro "Do you know someone with the enthusiasm and expertise to help draft this policy?"
-                                  :writer-name-label "Writer name: "
-                                  :writer-name-title "Writer names are a maximum length of 50 characters"
-                                  :reason-label "They should help draft this policy, because: "
-                                  :reason-title "Reasons are a maximum length of 1000 characters"
-                                  :submit "Create an invite"}
-                     :invitation-sign-in {:please "Please"
-                                          :sign-in "sign in"
-                                          :to "to invite a policy writer."}
-                     :invitation-response {:doc-title "Invitation to draft | Objective[8]"
-                                           :doc-description "Invitation to help draft policy"
-                                           :page-title "Can you help us to draft some policy?"
-                                           :page-intro "You've been invited to help draft some policy!"
-                                           :for-objective-text "Help write policy to achieve this objective: "
-                                           :rsvp-text "If you're interested, you can sign in and accept the invitation below."
-                                           :sign-in-to-accept "Sign in to accept"
-                                           :accept "Accept"
-                                           :decline "Decline"}
-                     :invitation-banner {:message "Respond to your invitation to help draft policy"}
-                     :candidate-list {:doc-title "Candidate policy writers | Objective[8]"
-                                      :doc-description "Candidate policy writers..."
-                                      :page-intro "Writers work with each other and the community to draft policy."
-                                      :candidate-list-heading "Recently added candidate writers"
-                                      :no-candidates "No candidate writers have been invited yet."}
-                     :current-draft {:page-intro "Current draft"
-                                     :no-drafts "There are currently no drafts for this objective"}
-                     :draft-detail {:doc-title "Policy draft | Objective[8]"
-                                    :doc-description "Draft policy for objective ... "}
-                     :edit-draft {:doc-title "Edit draft | Objective[8]"
-                                  :doc-description "Draft policy"
-                                  :preview "Preview"
-                                  :submit "Submit"}
-                     :sign-up {:doc-title "Sign up almost there | Objective[8]"
-                               :doc-description ""
-                               :page-title "Almost there"
-                               :welcome "Adding your email address will let us notify you when you receive responses to comments, objectives and votes."
-                               :username-label "Username"
-                               :username-title "Create your username"
-                               :not-unique "Username already exists"
-                               :not-well-formed "Username must be 1-16 characters in length, containing only letters and numbers"
-                               :email-label "Email"
-                               :email-title "Add your email title"
-                               :button "Create account"}}}
-
-   :es spanish-translations
+                :get-started-button-title "Get started"
+                :get-started-button-text "Get started"}
+   :objective-nav {:title "Navigation for"
+                   :details "Details"
+                   :questions "Questions"
+                   :writers "Writers"}
+   :objective-list {:doc-title "Objectives | Objective[8]"
+                    :doc-description ""
+                    :page-title "Objectives"
+                    :create-button-title "Create an objective"
+                    :create-button-text "Create an objective"
+                    :please "Please"
+                    :sign-in "sign in"
+                    :to "to create an objective."
+                    :subtitle "Recently created objectives"
+                    :drafting-begins "Drafting begins on"
+                    :objectives-intro-text "Objective[8] centers its policy drafting process around objectives. An objective is a change that could be achieved by introducing new policy." }
+   :objective-create {:doc-title "Create an Objective | Objective[8]"
+                      :doc-description "Create an Objective ..."
+                      :page-title "Create an objective"
+                      :page-intro "An objective is a change that could be achieved by introducing new policy. For example: improving access to public housing, or increasing the safety of our roads."
+                      :headline-label "Headline"
+                      :headline-title "3 characters minimum, 120 characters maximum"
+                      :headline-prompt "A headline should encourage contribution or discussion"
+                      :goals-label "Goals"
+                      :goals-prompt "A goal is what you’d like your change to achieve"
+                      :goals-title "50 characters minimum, 200 characters maximum"
+                      :background-label "Background"
+                      :background-prompt "Provide further information on why achieving this objective is important or necessary"
+                      :background-title "Enter optional background text up to 1000 characters"
+                      :end-date-label "Drafting start date"
+                      :end-date-prompt "On this date, the drafting phase begins. You should give participants enough time to generate useful information, and to recruit and vote for potential policy writers."
+                      :drafting-not-yet-implemented "(Please note: since this site is still under development, the drafting phase has not yet been implemented)"
+                      :end-date-title "Please enter an end date"
+                      :end-date-placeholder"yyyy-mm-dd"
+                      :submit "Create"}
+   :objective-view {:doc-title "Objective | Objective[8]"
+                    :doc-description "Objective  ..."
+                    :background-label "Background"
+                    :goals-label "Goals"
+                    :end-date-label "Drafting begins: "
+                    :created-message "Your objective has been created!"}
+   :comment-view {:created-message "Your comment has been added!"
+                  :comment-title "Comments"
+                  :no-comments "There are no comments yet."}
+   :comment-create {:comment-label "Your comment"
+                    :comment-title "Comments are a maximum length of 500 characters"
+                    :post-button "Add comment"}
+   :comment-sign-in {:please "Please"
+                     :sign-in "sign in"
+                     :to "to start commenting."}
+   :question-list {:questions-about "Questions about"
+                   :page-intro "Gather background information such as opinions and experiences by asking a question.  Your question should be focussed and specific, as the answers will influence the policy drafting process."
+                   :question-list-heading "Recently asked questions"
+                   :no-questions "There are no questions yet."}
+   :question-create {:add-a-question "Add a question to this objective"
+                     :question-label "Question"
+                     :question-title "Questions are a maximum length of 500 characters"
+                     :post-button "Add"}
+   :question-view {:added-message "Your question has been added!"
+                   :added-answer-message "Your answer has been added!"}
+   :question-sign-in {:please "Please"
+                      :sign-in "sign in"
+                      :to "to add a question." }
+   :answer-view   {:created-message "Your answer has been posted!"
+                   :answer-title "Answers"
+                   :no-answers "No one has answered this question yet."}
+   :answer-create {:answer-label "Your answer"
+                   :answer-title "Answers are a maximum length of 500 characters"
+                   :post-button "Post your answer"}
+   :answer-sign-in {:please "Please"
+                    :sign-in "sign in"
+                    :to "to answer this question."}
+   :invitation {:doc-title "Candidate policy writers | Objective[8]"
+                :doc-description "Candidate policy writers..."
+                :page-title "Invite a policy writer"
+                :page-intro "Do you know someone with the enthusiasm and expertise to help draft this policy?"
+                :writer-name-label "Writer name: "
+                :writer-name-title "Writer names are a maximum length of 50 characters"
+                :reason-label "They should help draft this policy, because: "
+                :reason-title "Reasons are a maximum length of 1000 characters"
+                :submit "Create an invite"}
+   :invitation-sign-in {:please "Please"
+                        :sign-in "sign in"
+                        :to "to invite a policy writer."}
+   :invitation-response {:doc-title "Invitation to draft | Objective[8]"
+                         :doc-description "Invitation to help draft policy"
+                         :page-title "Can you help us to draft some policy?"
+                         :page-intro "You've been invited to help draft some policy!"
+                         :for-objective-text "Help write policy to achieve this objective: "
+                         :rsvp-text "If you're interested, you can sign in and accept the invitation below."
+                         :sign-in-to-accept "Sign in to accept"
+                         :accept "Accept"
+                         :decline "Decline"}
+   :invitation-banner {:message "Respond to your invitation to help draft policy"}
+   :candidate-list {:doc-title "Candidate policy writers | Objective[8]"
+                    :doc-description "Candidate policy writers..."
+                    :page-intro "Writers work with each other and the community to draft policy."
+                    :candidate-list-heading "Recently added candidate writers"
+                    :no-candidates "No candidate writers have been invited yet."}
+   :current-draft {:page-intro "Current draft"
+                   :no-drafts "There are currently no drafts for this objective"}
+   :draft-detail {:doc-title "Policy draft | Objective[8]"
+                  :doc-description "Draft policy for objective ... "}
+   :edit-draft {:doc-title "Edit draft | Objective[8]"
+                :doc-description "Draft policy"
+                :preview "Preview"
+                :submit "Submit"}
+   :sign-up {:doc-title "Sign up almost there | Objective[8]"
+             :doc-description ""
+             :page-title "Almost there"
+             :welcome "Adding your email address will let us notify you when you receive responses to comments, objectives and votes."
+             :username-label "Username"
+             :username-title "Create your username"
+             :not-unique "Username already exists"
+             :not-well-formed "Username must be 1-16 characters in length, containing only letters and numbers"
+             :email-label "Email"
+             :email-title "Add your email title"
+             :button "Create account"}})
+
+(def spanish-translations
+  {:base {:header-logo-text "Objective[8]"
+          :header-logo-title "Inicio"
+          #_:project-status! #_"Spanish(ALPHA: We are still in development and testing, find out more)"
+          :browsehappy! "Por favor actualiza tu navegador para que tengas una mejor experiencia."}
+   :navigation-global {:sign-in-text "Entrar"
+                       :sign-in-title "Iniciar sesión"
+                       :sign-out-text "Salir"
+                       :sign-out-title "Cerrar sesión"
+                       :profile-text "Perfil"
+                       :profile-title "Perfil"}
+   :share-widget {:title "Compartir"
+                  :facebook-title "Compartir en Facebook"
+                  :facebook-text "Compartir en Facebook"
+                  :google-plus-title "Compartir en Google+"
+                  :google-plus-text "Compartir en Google+"
+                  :twitter-title "Compartir en Twitter"
+                  :twitter-text "Compartir en Twitter"
+                  :linkedin-title "Compartir en LinkedIn"
+                  :linkedin-text "Compartir en LinkedIn"
+                  :reddit-title "Compartir en Reddit"
+                  :reddit-text "Compartir en Reddit"
+                  :url-label "Comparte el link"
+                  :url-title "Comparte el link"}
+   :error-404 {#_:doc-title #_"Spanish(Error 404 | Objective[8])"
+               #_:doc-description #_"Spanish(Sorry the page you requested can't be found.)"
+               #_:page-title #_"Spanish(Sorry the page you requested can't be found.)"
+               #_:page-intro #_"Spanish(The page you were trying to reach at this address doesn't seem to exist. This is usually the result of a bad or outdated link. We apologise for any inconvenience.)"
+               :page-content! "
What can I do now?

Please return to the home page.

To report an issue visit our github issues page.

" }
+   :notifications {#_:drafting-has-started #_"Spanish(...)"
+                   #_:drafting-started-helper-text #_"Spanish(...)"
+                   #_:go-to-drafting #_"Spanish(...)"}
+   :index {:doc-title "Objective[8]"
+           #_:doc-description #_""
+           :index-welcome "Politicos colaborando con organizaciones democráticas"
+           :index-intro "Recolectar la opinion de la comunidad, generar ideas, compartir, discutir, votar y colaborar con expertos para redactar nuevas politicas."
+           :index-get-started "Objetivo"
+           :index-get-started-title "Objetivo"
+           :index-learn-more "Más información"
+           :index-learn-more-title "Más información"}
+   :sign-in {:doc-title "Entrar | Objective[8]"
+             :doc-description "Entrar"
+             #_:page-title #_"Spanish(Sign in or Sign up)"
+             :twitter-sign-in-btn "Entra con Twitter"
+             :twitter-sign-in-title "Entra con Twitter"
+             #_:reassurance #_"Spanish(We will never post to Twitter without your permission.)"}
+   :project-status {#_:doc-title #_"Spanish(Project status | Objective [8])"
+                    #_:doc-description #_""
+                    #_:page-title #_"Spanish(Alpha phase)"
+                    #_:page-intro #_"Spanish(We are developing and designing Objective[8] in the open. This allows the tool evolve as you use it, as you give feedback, and as the developers update and add content.)"
+                    #_:page-content! #_"Spanish(
It is important to note that during this time data may be removed or destroyed as part of our process. Any of the views and data expressed here is to be used for example purposes only and does not accurately represent the real views of users.

How to get involved

This project is open source and we are inviting people to collaborate with us to build a better tool. For developers and you can find the code on github at https://github.com/ThoughtWorksInc/objective8. We will also be adding details for upcoming usability sessions shortly.

Have you got an idea?

We are really interested in user feedback and are currently inviting people to leave comments our github issues page.
)" }
+   :learn-more {#_:doc-title #_"Spanish(Learn more) | Objective[8]"
+                #_:doc-description #_""
+                #_:page-title #_"Spanish(...)"
+                #_:sub-title #_"Spanish(...)"
+                #_:page-intro #_"Spanish(...)"
+                #_:get-started-button-title #_"Spanish(...)"
+                #_:get-started-button-text #_"Spanish(...)"
+                #_:page-content! #_"Spanish(...)"}
+   :objective-nav {#_:title #_"Spanish(Navigation for)"
+                   #_:details #_"Spanish(Details)"
+                   #_:questions #_"Spanish(Questions)"
+                   #_:writers #_"Spanish(Writers)"}
+   :objective-list {#_:doc-title #_"Spanish(Objectives | Objective[8])"
+                    #_:doc-description #_""
+                    #_:page-title #_"Spanish(Objectives)"
+                    #_:create-button-title #_"Spanish(Create an objective)"
+                    #_:create-button-text #_"Spanish(Create an objective)"
+                    #_:please #_"Spanish(Please)"
+                    #_:sign-in #_"Spanish(sign in)"
+                    #_:to #_"Spanish(to create an objective.)"
+                    #_:subtitle #_"Spanish(Recently created objectives)"
+                    #_:drafting-begins #_"Spanish(Drafting begins on)"
+                    #_:objectives-intro-text #_"Spanish(...)"}
+   :objective-create {:doc-title "Crea un objetivo | Objective[8]"
+                      :doc-description "Crea un objetivo"
+                      :page-title "Crea un objetivo"
+                      #_:page-intro #_"Spanish(...)"
+                      #_:headline-label #_"Spanish(...)"
+                      :headline-title "3 carateres mínimo, 120 carateres máximo"
+                      #_:headline-prompt #_"Spanish(...)"
+                      #_:headline-placeholder #_"Spanish(...)"
+                      :goals-label "Meta"
+                      #_:goals-prompt #_"Spanish(...)"
+                      :goals-title "50 carateres mínimo, 200 carateres máximo"
+                      #_:goals-placeholder #_"Spanish(...)"
+                      #_:background-label #_"Spanish(...)"
+                      #_:background-prompt #_"Spanish(...)"
+                      :background-title "Escribe una descripcion máximo de 1000 caracteres."
+                      #_:end-date-label #_"Spanish(...)"
+                      #_:end-date-prompt #_"Spanish(...)"
+                      #_:drafting-not-yet-implemented #_"Spanish(...)"
+                      :end-date-title "Por favor escribe la fecha de vencimiento"
+                      :end-date-placeholder "yyyy-mm-dd"
+                      :submit "Crear"}
+   :objective-view {:doc-title "Objetivo | Objective[8]"
+                    #_:doc-description #_""
+                    #_:background-label #_"Spanish(Background)"
+                    :goals-label "Meta"
+                    :end-date-label "Fecha de vencimiento"
+                    :created-message "Tu objetivo ha sido creado"}
+   :comment-view {:created-message "Tu comentario ha sido creado"
+                  :comment-title "Comentarios"
+                  #_:no-comments #_"Spanish(There are no comments yet.)"}
+   :comment-create {#_:comment-label #_"Spanish(Your comment)"
+                    :comment-title "Los comentarios son máximo de 500 caracteres."
+                    #_:post-button #_"Spanish(Add comment)"}
+   :comment-sign-in {#_:please #_"Spanish(Please)"
+                     #_:sign-in #_"Spanish(sign in)"
+                     #_:to #_"Spanish(to start commenting.)"}
+   :question-list {#_:questions-about #_"Spanish(Questions about)"
+                   #_:page-intro #_"Spanish(...)"
+                   #_:question-list-heading #_"Spanish(...)"
+                   #_:no-questions #_"Spanish(There are no questions yet.)" }
+   :question-create {#_:question-label #_"Spanish(Question)"
+                     #_:question-title #_"Spanish(Questions are a maximum length of 500 characters)"
+                     #_:post-button #_"Spanish(Add)"}
+   :question-view {#_:added-message #_"Spanish(Your question has been added!)"
+                   #_:added-answer-message #_"Spanish(Your answer has been added!)"}
+   :question-sign-in {#_:please #_"Spanish(Please)"
+                      #_:sign-in #_"Spanish(sign in)"
+                      #_:to #_"Spanish(to ask a question.)" }
+   :answer-view   {#_:created-message #_"Spanish(Your answer has been posted!)"
+                   #_:answer-title #_"Spanish(Answers)"
+                   #_:no-answers #_"Spanish(No one has answered this question yet.)"}
+   :answer-create {#_:answer-label #_"Spanish(Your answer)"
+                   #_:answer-title #_"Spanish(Answers are a maximum length of 500 characters)"
+                   #_:post-button #_"Spanish(Post your answer)"}
+   :answer-sign-in {#_:please #_"Spanish(Please)"
+                    #_:sign-in #_"Spanish(sign in)"
+                    #_:to #_"Spanish(to answer this question.)"}
+   :invitation {#_:doc-title #_"Spanish(...)"
+                #_:doc-description #_"Spanish(...)"
+                #_:page-title #_"Spanish(...)"
+                #_:page-intro #_"Spanish(...)"
+                #_:writer-name-label #_"Spanish(...)"
+                #_:writer-name-title #_"Spanish(...)"
+                #_:reason-label #_"Spanish(...)"
+                #_:reason-title #_"Spanish(...)"
+                #_:submit #_"Spanish(...)"}
+   :invitation-response {#_:doc-title #_"Spanish(...)"
+                         #_:doc-description #_"Spanish(...)"
+                         #_:page-title #_"Spanish(...)"
+                         #_:page-intro #_"Spanish(...)"
+                         #_:for-objective-text #_"Spanish(...)"
+                         #_:rsvp-text #_"Spanish(...)"
+                         #_:sign-in-to-accept #_"Spanish(...)"
+                         #_:accept #_"Spanish(...)"
+                         #_:decline #_"Spanish(...)"}
+   :invitation-sign-in {#_:please #_"Spanish(...)"
+                        #_:sign-in #_"Spanish(...)"
+                        #_:to #_"Spanish(...)"}
+   :invitation-banner {#_:message #_"Spanish(...)"}
+   :candidate-list {#_:page-intro #_"Spanish(...)"
+                    #_:candidate-list-heading #_"Spanish(...)"
+                    #_:no-candidates #_"Spanish(...)"}
+   :current-draft {#_:page-intro #_"Spanish(...)"
+                   #_:no-drafts #_"Spanish(...)"}
+   :edit-draft {#_:doc-title #_"Spanish(...)"
+                #_:doc-description #_"Spanish(...)"
+                #_:preview #_"Spanish(...)"
+                #_:submit #_"Spanish(...)"}
+   :sign-up {:doc-title "Perfil | Objective[8]"
+             #_:doc-description #_""
+             #_:page-title #_""
+             :welcome  "Tu correo electrónico nos permitira informarte cuando recivas respuestas a tus comentarios, objetivos y votos."
+             #_:username-label #_""
+             #_:username-title #_""
+             #_:not-unique #_""
+             #_:not-well-formed #_""
+             :email-label  "Correo electrónico"
+             :email-title  "Escribe tu cuenta de correo electrónico"
+             #_:button #_""}})
+
+(def translation-config
+  {:dictionary {:en english-translations
+                :es spanish-translations}

    :dev-mode? false
    :fallback-locale :en
    :log-missing-translations-function (fn [{:keys [locale ks scope]}]
                                         (log/warn (str "Missing translations! " locale ks scope)))})

-
-(def spanish-translations {}
-  #_{:es {:base {:header-logo-text "Objective[8]"
-                  :header-logo-title "Inicio"
-                  :project-status! "Spanish(ALPHA: We are still in development and testing, find out more)"
-                  :browsehappy! "Por favor actualiza tu navegador para que tengas una mejor experiencia."}
-           :navigation-global {:sign-in-text "Entrar"
-                               :sign-in-title "Iniciar sesión"
-                               :sign-out-text "Salir"
-                               :sign-out-title "Cerrar sesión"
-                               :profile-text "Perfil"
-                               :profile-title "Perfil"}
-           :share-widget {:title "Compartir"
-                          :facebook-title "Compartir en Facebook"
-                          :facebook-text "Compartir en Facebook"
-                          :google-plus-title "Compartir en Google+"
-                          :google-plus-text "Compartir en Google+"
-                          :twitter-title "Compartir en Twitter"
-                          :twitter-text "Compartir en Twitter"
-                          :linkedin-title "Compartir en LinkedIn"
-                          :linkedin-text "Compartir en LinkedIn"
-                          :reddit-title "Compartir en Reddit"
-                          :reddit-text "Compartir en Reddit"
-                          :url-label "Comparte el link"
-                          :url-title "Comparte el link"}
-           :error-404 {:doc-title "Spanish(Error 404 | Objective[8])"
-                       :doc-description "Spanish(Sorry the page you requested can't be found.)"
-                       :page-title "Spanish(Sorry the page you requested can't be found.)"
-                       :page-intro "Spanish(The page you were trying to reach at this address doesn't seem to exist. This is usually the result of a bad or outdated link. We apologise for any inconvenience.)"
-                       :page-content! "
What can I do now?

Please return to the home page.

To report an issue visit our github issues page.

" }
-           :notifications {:drafting-has-started "Spanish(...)"
-                           :drafting-started-helper-text "Spanish(...)"
-                           :go-to-drafting "Spanish(...)"}
-           :index {:doc-title "Objective[8]"
-                   :doc-description ""
-                   :index-welcome "Politicos colaborando con organizaciones democráticas"
-                   :index-intro "Recolectar la opinion de la comunidad, generar ideas, compartir, discutir, votar y colaborar con expertos para redactar nuevas politicas."
-                   :index-get-started "Objetivo"
-                   :index-get-started-title "Objetivo"
-                   :index-learn-more "Más información"
-                   :index-learn-more-title "Más información"}
-           :sign-in {:doc-title "Entrar | Objective[8]"
-                     :doc-description "Entrar"
-                     :page-title "Spanish(Sign in or Sign up)"
-                     :twitter-sign-in-btn "Entra con Twitter"
-                     :twitter-sign-in-title "Entra con Twitter"
-                     :reassurance "Spanish(We will never post to Twitter without your permission.)"}
-           :project-status {:doc-title "Spanish(Project status | Objective [8])"
-                            :doc-description ""
-                            :page-title "Spanish(Alpha phase)"
-                            :page-intro "Spanish(We are developing and designing Objective[8] in the open. This allows the tool evolve as you use it, as you give feedback, and as the developers update and add content.)"
-                            :page-content! "Spanish(
It is important to note that during this time data may be removed or destroyed as part of our process. Any of the views and data expressed here is to be used for example purposes only and does not accurately represent the real views of users.

How to get involved

This project is open source and we are inviting people to collaborate with us to build a better tool. For developers and you can find the code on github at https://github.com/ThoughtWorksInc/objective8. We will also be adding details for upcoming usability sessions shortly.

Have you got an idea?

We are really interested in user feedback and are currently inviting people to leave comments our github issues page.
)" }
-           :learn-more {:doc-title "Spanish(Learn more) | Objective[8]"
-                        :doc-description ""
-                        :page-title "Spanish(...)"
-                        :sub-title "Spanish(...)"
-                        :page-intro "Spanish(...)"
-                        :get-started-button-title "Spanish(...)"
-                        :get-started-button-text "Spanish(...)"
-                        :page-content! "Spanish(...)"}
-           :objective-nav {:title "Spanish(Navigation for)"
-                           :details "Spanish(Details)"
-                           :questions "Spanish(Questions)"
-                           :writers "Spanish(Writers)"}
-           :objective-list {:doc-title "Spanish(Objectives | Objective[8])"
-                            :doc-description ""
-                            :page-title "Spanish(Objectives)"
-                            :create-button-title "Spanish(Create an objective)"
-                            :create-button-text "Spanish(Create an objective)"
-                            :please "Spanish(Please)"
-                            :sign-in "Spanish(sign in)"
-                            :to "Spanish(to create an objective.)"
-                            :subtitle "Spanish(Recently created objectives)"
-                            :drafting-begins "Spanish(Drafting begins on)"
-                            :objectives-intro-text "Spanish(...)"}
-           :objective-create {:doc-title "Crea un objetivo | Objective[8]"
-                              :doc-description "Crea un objetivo"
-                              :page-title "Crea un objetivo"
-                              :page-intro "Spanish(...)"
-                              :headline-label "Spanish(...)"
-                              :headline-title "3 carateres mínimo, 120 carateres máximo"
-                              :headline-prompt "Spanish(...)"
-                              :headline-placeholder "Spanish(...)"
-                              :goals-label "Meta"
-                              :goals-prompt "Spanish(...)"
-                              :goals-title "50 carateres mínimo, 200 carateres máximo"
-                              :goals-placeholder "Spanish(...)"
-                              :background-label "Spanish(...)"
-                              :background-prompt "Spanish(...)"
-                              :background-title "Escribe una descripcion máximo de 1000 caracteres."
-                              :end-date-label "Spanish(...)"
-                              :end-date-prompt "Spanish(...)"
-                              :drafting-not-yet-implemented "Spanish(...)"
-                              :end-date-title "Por favor escribe la fecha de vencimiento"
-                              :end-date-placeholder "yyyy-mm-dd"
-                              :submit "Crear"}
-           :objective-view {:doc-title "Objetivo | Objective[8]"
-                            :doc-description ""
-                            :background-label "Spanish(Background)"
-                            :goals-label "Meta"
-                            :end-date-label "Fecha de vencimiento"
-                            :created-message "Tu objetivo ha sido creado"}
-           :comment-view {:created-message "Tu comentario ha sido creado"
-                          :comment-title "Comentarios"
-                          :no-comments "Spanish(There are no comments yet.)"}
-           :comment-create {:comment-label "Spanish(Your comment)"
-                            :comment-title "Los comentarios son máximo de 500 caracteres."
-                            :post-button "Spanish(Add comment)"}
-           :comment-sign-in {:please "Spanish(Please)"
-                             :sign-in "Spanish(sign in)"
-                             :to "Spanish(to start commenting.)"}
-           :question-list {:questions-about "Spanish(Questions about)"
-                           :page-intro "Spanish(...)"
-                           :question-list-heading "Spanish(...)"
-                           :no-questions "Spanish(There are no questions yet.)" }
-           :question-create {:question-label "Spanish(Question)"
-                             :question-title "Spanish(Questions are a maximum length of 500 characters)"
-                             :post-button "Spanish(Add)"}
-           :question-view {:added-message "Spanish(Your question has been added!)"
-                           :added-answer-message "Spanish(Your answer has been added!)"}
-           :question-sign-in {:please "Spanish(Please)"
-                              :sign-in "Spanish(sign in)"
-                              :to "Spanish(to ask a question.)" }
-           :answer-view   {:created-message "Spanish(Your answer has been posted!)"
-                           :answer-title "Spanish(Answers)"
-                           :no-answers "Spanish(No one has answered this question yet.)"}
-           :answer-create {:answer-label "Spanish(Your answer)"
-                           :answer-title "Spanish(Answers are a maximum length of 500 characters)"
-                           :post-button "Spanish(Post your answer)"}
-           :answer-sign-in {:please "Spanish(Please)"
-                            :sign-in "Spanish(sign in)"
-                            :to "Spanish(to answer this question.)"}
-           :invitation {:doc-title "Spanish(...)"
-                        :doc-description "Spanish(...)"
-                        :page-title "Spanish(...)"
-                        :page-intro "Spanish(...)"
-                        :writer-name-label "Spanish(...)"
-                        :writer-name-title "Spanish(...)"
-                        :reason-label "Spanish(...)"
-                        :reason-title "Spanish(...)"
-                        :submit "Spanish(...)"}
-           :invitation-response {:doc-title "Spanish(...)"
-                                 :doc-description "Spanish(...)"
-                                 :page-title "Spanish(...)"
-                                 :page-intro "Spanish(...)"
-                                 :for-objective-text "Spanish(...)"
-                                 :rsvp-text "Spanish(...)"
-                                 :sign-in-to-accept "Spanish(...)"
-                                 :accept "Spanish(...)"
-                                 :decline "Spanish(...)"}
-           :invitation-sign-in {:please "Spanish(...)"
-                                :sign-in "Spanish(...)"
-                                :to "Spanish(...)"}
-           :invitation-banner {:message "Spanish(...)"}
-           :candidate-list {:page-intro "Spanish(...)"
-                            :candidate-list-heading "Spanish(...)"
-                            :no-candidates "Spanish(...)"}
-           :current-draft {:page-intro "Spanish(...)"
-                           :no-drafts "Spanish(...)"}
-           :edit-draft {:doc-title "Spanish(...)"
-                        :doc-description "Spanish(...)"
-                        :preview "Spanish(...)"
-                        :submit "Spanish(...)"}
-           :sign-up {:doc-title "Perfil | Objective[8]"
-                     :doc-description ""
-                     :page-title ""
-                     :welcome  "Tu correo electrónico nos permitira informarte cuando recivas respuestas a tus comentarios, objetivos y votos."
-                     :username-label ""
-                     :username-title ""
-                     :not-unique ""
-                     :not-well-formed ""
-                     :email-label  "Correo electrónico"
-                     :email-title  "Escribe tu cuenta de correo electrónico"
-                     :button ""}}})
-
-
 (def t (tower/make-t translation-config))


Pass ctx parameter.

Pass ctx parameter.

--- src/oc/storage/api/entries.clj
+++ src/oc/storage/api/entries.clj
@@ -417,7 +417,7 @@
       :else
       reply)))

-(defn- update-poll-vote [conn org board entry poll user reply-id add?]
+(defn- update-poll-vote [conn ctx org board entry poll user reply-id add?]
   (let [user-has-voted? (some #(when (= % (:user-id user)) %) (:replies poll))

         updated-poll-replies (mapv (partial update-reply (:user-id user) reply-id add?) (:replies poll))
@@ -1085,9 +1085,9 @@
                 false))})

   ;; Actions
-  :post! (fn [ctx] (update-poll-vote conn (:existing-org ctx) (:existing-board ctx) (:existing-entry ctx)
+  :post! (fn [ctx] (update-poll-vote conn ctx (:existing-org ctx) (:existing-board ctx) (:existing-entry ctx)
                     (:existing-poll ctx) (:user ctx) reply-id true))
-  :delete! (fn [ctx] (update-poll-vote conn (:existing-org ctx) (:existing-board ctx) (:existing-entry ctx)
+  :delete! (fn [ctx] (update-poll-vote conn ctx (:existing-org ctx) (:existing-board ctx) (:existing-entry ctx)
                     (:existing-poll ctx) (:user ctx) reply-id false))

   ;; Responses
@@ -1108,15 +1108,6 @@
                        (reaction-res/aggregate-reactions (:existing-reactions ctx))
                        (:access-level ctx)
                        (-> ctx :user :user-id)))})
-  ; :handle-created (fn [ctx]
-  ;                   (entry-rep/render-entry
-  ;                    (:existing-org ctx)
-  ;                    (:existing-board ctx)
-  ;                    (:existing-entry ctx)
-  ;                    (:existing-comments ctx)
-  ;                    (reaction-res/aggregate-reactions (:existing-reactions ctx))
-  ;                    (:access-level ctx)
-  ;                    (-> ctx :user :user-id)))
   :handle-unprocessable-entity (fn [ctx]
     (api-common/unprocessable-entity-response (:reason ctx))))


revision id fix

revision id fix

--- src/oc/storage/api/entries.clj
+++ src/oc/storage/api/entries.clj
@@ -414,7 +414,7 @@
                        org-uuid (:uuid org)
                        entry (entry-res/get-entry conn entry-uuid)
                        existing-version (if (zero? (:revision-id (:data ctx)))
-                                          entry
+                                          (assoc entry :revision-id 0)
                                           (entry-res/get-version
                                            conn
                                            entry-uuid


Wire into async

Wire into async

--- src/onyx/coordinator/async.clj
+++ src/onyx/coordinator/async.clj
@@ -3,8 +3,7 @@
             [com.stuartsierra.component :as component]
             [dire.core :as dire]
             [onyx.coordinator.extensions :as extensions]
-            [onyx.coordinator.log.datomic]
-            [onyx.coordinator.sync.zookeeper]))
+            [onyx.coordinator.planning :as planning]))

 (def eviction-delay 5000)

@@ -18,8 +17,8 @@
   (extensions/mark-peer-dead log peer))

 (defn plan-job [log job]
-;  (let [phases (planning/phase-discovery job)])
-  (extensions/plan-job log job))
+  (let [task (planning/discover-tasks (:catalog job) (:workflow job))]
+    (extensions/plan-job log job)))

 (defn acknowledge-task [log task]
   (extensions/ack log task))


Convolute complete ch to outside loop.

Convolute complete ch to outside loop.

--- src/onyx/peer/virtual_peer.clj
+++ src/onyx/peer/virtual_peer.clj
@@ -6,8 +6,8 @@
             [onyx.peer.task-pipeline :refer [task-pipeline]]))

 (defn payload-loop [sync queue payload-ch shutdown-ch status-ch]
-  (loop [pipeline nil]
-    (let [complete-ch (chan 1)]
+  (let [complete-ch (chan 1)]
+    (loop [pipeline nil]
       (when-let [[v ch] (alts!! [shutdown-ch complete-ch payload-ch] :priority true)]
         (when-not (nil? pipeline)
           (component/stop pipeline))


Pass currency in SQS email message.

Pass currency in SQS email message.

--- src/open_company/lib/email.clj
+++ src/open_company/lib/email.clj
@@ -10,6 +10,7 @@
    :note schema/Str
    :reply-to (schema/maybe schema/Str)
    :company-slug schema/Str
+   :currency schema/Str
    :snapshot {schema/Keyword schema/Any}})

 (defn ctx->trigger [post-data {company :company user :user su :stakeholder-update}]
@@ -24,6 +25,7 @@
    :subject (:subject post-data)
    :note (:note post-data)
    :reply-to (:email user)
+   :currency (:currency company)
    :company-slug (:slug company)
    :snapshot su})


add line-start?

add line-start?

--- src/main/clojure/clojure/tools/reader/reader_types.clj
+++ src/main/clojure/clojure/tools/reader/reader_types.clj
@@ -357,3 +357,9 @@
             (not (whitespace? (peek-char ~reader))))
      (log-source* ~reader (^{:once true} fn* [] ~@body) true)
      (do ~@body)))
+
+(defn line-start?
+  "Returns true if rdr is an IndexingReader and the current char starts a new line"
+  [rdr]
+  (when (indexing-reader? rdr)
+    (zero? (get-column-number rdr))))


Refactored to leverage pe-datomic-utils function.

--- src/pe_core_testutils/core.clj
+++ src/pe_core_testutils/core.clj
@@ -6,10 +6,8 @@
 ;; Test fixture maker
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (defn make-db-refresher-fixture-fn
-  [db-uri conn partition & schema-filenames]
+  [db-uri conn partition schema-files]
   (fn [f]
-    (reset! conn (ducore/refresh-db db-uri schema-filenames))
-    @(d/transact @conn [{:db/id (d/tempid :db.part/db)
-                         :db/ident partition
-                         :db.install/_partition :db.part/db}])
+    (reset! conn (ducore/refresh-db db-uri schema-files))
+    (ducore/transact-partition @conn partition)
     (f)))


(PDB-3723) Improve storage benchmark facts for perf testing

[rlb@puppet.com: split commit; adjust message]

--- src/puppetlabs/puppetdb/cli/fact_storage_benchmark.clj
+++ src/puppetlabs/puppetdb/cli/fact_storage_benchmark.clj
@@ -22,7 +22,12 @@
                (for [n (range unique-static-facts)]
                  [(str "unique-static-" n) (str "unique-static-" certname "-" n)])
                (for [n (range unique-changing-facts)]
-                 [(str "changing-" n) (str "changing-static-" certname "-" n "-" generation-num)]))]
+                 [(str "changing-" n) (str "changing-static-" certname "-" n "-" generation-num)])
+               ;; some facts with various degrees of selectivity for testing query perf.
+               [["two-values" (mod (hash certname) 2)]
+                ["three-values" (mod (hash certname) 3)]
+                ["four-values" (mod (hash certname) 4)]
+                ["hundred-values" (mod (hash certname) 100)]])]
     {:certname certname
      :environment "production"
      :producer_timestamp (t/now)
@@ -91,10 +96,10 @@
    {:name "medium"
     :num-threads 5
     :num-nodes 1000
-    :num-generations 5
-    :shared-static-facts 100
-    :unique-static-facts 100
-    :unique-changing-facts 50}
+    :num-generations 20
+    :shared-static-facts 200
+    :unique-static-facts 780
+    :unique-changing-facts 20}

    {:name "large"
     :num-threads 5
@@ -102,7 +107,8 @@
     :num-generations 2
     :shared-static-facts 100
     :unique-static-facts 100
-    :unique-changing-facts 50}])
+    :unique-changing-facts 50}
+   ])

 (defn unique-index-by [rel k]
   (->> rel


STORM-635. logviewer returns 404 if storm_home/logs is a symlinked dir.

--- storm-core/src/clj/backtype/storm/daemon/logviewer.clj
+++ storm-core/src/clj/backtype/storm/daemon/logviewer.clj
@@ -258,8 +258,7 @@
     (let [file (.getCanonicalFile (File. root-dir fname))
           file-length (.length file)
           path (.getCanonicalPath file)]
-      (if (= (File. root-dir)
-             (.getParentFile file))
+      (if (.exists file)
         (let [default-length 51200
               length (if length
                        (min 10485760 length)


CMR-2458: Updating test comment.

CMR-2458: Updating test comment.

--- system-int-test/test/cmr/system_int_test/search/granule_spatial_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/granule_spatial_search_test.clj
@@ -48,7 +48,7 @@
   [& ords]
   (codec/url-encode (umm-s/set-coordinate-system :geodetic (apply polygon ords))))

-;; Tests that invalid spatial areas are detected and error messages are returned.
+;; Tests search failure conditions
 (deftest spatial-search-validation-test
   (testing "All granules spatial"
     (testing "Success"


Commit intermédiaire sur CSB en Clojure (Ligue Argent en cours)

--- clojure/codingame/competition/coders-strike-back/src/coders_strike_back/core.clj
+++ clojure/codingame/competition/coders-strike-back/src/coders_strike_back/core.clj
@@ -1,5 +1,7 @@
 (ns coders-strike-back.core
   (:gen-class))
+
+(def checkpoint-core-size 100)

 (defn inc-atom [curr-val] (inc curr-val))
 (defn dec-atom [curr-val] (dec curr-val))
@@ -13,19 +15,49 @@
 (defn convert-degree-to-radian [degree]
   (* degree (/ Math/PI 180)))

-;;Compute boost value between 0 and 100
+;; Conversion degrés en radians :
+;; rad  = degrés * M_PI / 180
+(defn convert-radian-to-degree [radian]
+  (* radian (/ 180 Math/PI)))
+
+;; Conversion d'un double en entier avec arrondi
+(defn convert-to-int [float-value]
+ (Integer/valueOf (Math/round float-value)))
+
+;;Angle entre 2 points (x1,y1) et (x2,y2)
+(defn angle-between-2-points [x1 y1 x2 y2]
+  (let [ d (distance x1 y1 x2 y2) dx (/ (- x2 x1) d) dy (/ (- y2 y1) d) angle (convert-radian-to-degree (Math/acos dx))]
+    (if (< dy 0) (- 360.0 angle) angle)))
+
+(defn after [val1 val2] (if (> (- val2 val1) 0) true false))
+(defn before [val1 val2] (if (< (- val2 val1) 0) true false))
+
+;;Compute a boost value between 0 and 100
 (defn compute-boost [next-checkpoint-distance next-checkpoint-angle]
   (cond
     (> (Math/abs next-checkpoint-angle) 90) "0"
+    (and (< next-checkpoint-distance 1000) (> (Math/abs next-checkpoint-angle) 30)) "0"
+    ;;(and (< next-checkpoint-distance 1000) (< (Math/abs next-checkpoint-angle) 30)) "50"
     (< (Math/abs next-checkpoint-angle) 30) "100"
-    (and (< next-checkpoint-distance 1000) (> (Math/abs next-checkpoint-angle) 30)) "0"
-    (and (< next-checkpoint-distance 1000) (< (Math/abs next-checkpoint-angle) 30)) "50"
     (> next-checkpoint-distance 4000) "100"
     true (str (Integer/valueOf (Math/round (* 100 (Math/abs (Math/cos (convert-degree-to-radian next-checkpoint-angle)))))))))

-(defn compute-x [next-checkpoint-x] next-checkpoint-x)
+(defn compute-x [x next-checkpoint-x next-checkpoint-angle next-checkpoint-distance]
+  (if (> next-checkpoint-distance 1000)
+    (cond
+      (and (>= next-checkpoint-angle -90) (<= next-checkpoint-angle 90) (before next-checkpoint-x x))
+        (convert-to-int (+ next-checkpoint-x (* checkpoint-core-size (Math/cos next-checkpoint-angle))))
+      (and (>= next-checkpoint-angle -90) (<= next-checkpoint-angle 90) (after next-checkpoint-x x))
+        (convert-to-int (- next-checkpoint-x (* checkpoint-core-size (Math/cos next-checkpoint-angle))))
+      (or (<= -180 next-checkpoint-angle -90 ) (>= 180 next-checkpoint-angle 90))
+        (convert-to-int (- next-checkpoint-x (* checkpoint-core-size (Math/cos next-checkpoint-angle)))))
+    next-checkpoint-x))

-(defn compute-y [next-checkpoint-y] next-checkpoint-y)
+(defn compute-y [y next-checkpoint-y next-checkpoint-angle next-checkpoint-distance]
+  (if (cond
+        (and (>= next-checkpoint-angle 0)  (<= next-checkpoint-angle 180)) (convert-to-int (- next-checkpoint-y (* checkpoint-core-size (Math/sin next-checkpoint-angle))))
+        (and (< next-checkpoint-angle 0) (>= next-checkpoint-angle -180)) (convert-to-int (+ next-checkpoint-y (* checkpoint-core-size (Math/sin next-checkpoint-angle)))))
+   next-checkpoint-y))

 (def boost-used? (atom false))
 (def game-loop-counter (atom 0))
@@ -43,7 +75,7 @@
                    nextCheckpointX (read) nextCheckpointY (read)
                    nextCheckpointDist (read) nextCheckpointAngle (read)
                    opponentX (read) opponentY (read)
-                   opponent-distance (distance (Integer/valueOf x) (Integer/valueOf y) (Integer/valueOf opponentX) (Integer/valueOf opponentY))]
+                   opponent-distance (distance x y opponentX opponentY)]
                   ; nextCheckpointX: x position of the next check point
                   ; nextCheckpointY: y position of the next check point
                   ; nextCheckpointDist: distance to the next checkpoint
@@ -54,26 +86,29 @@
                   ; (binding [*out* *err*]
                   ;   (println "Debug messages..."))
                   (binding [*out* *err*]
-                    (println (str "Has the boost be used ? : " @boost-used?))
+                    (println (str "Has the boost been used ? : " @boost-used?))
+                    (println (str "Next check point distance coordinates : (" nextCheckpointX "," nextCheckpointY ")"))
                     (println (str "Given next check point distance : " nextCheckpointDist))
-                    (println (str "Calculated next check point distance : " (distance x y opponentX opponentY)))
+                    (println (str "Calculated next check point distance : " (distance x y nextCheckpointX nextCheckpointY)))
                     (println (str "Pod angle with checkpoint : " nextCheckpointAngle))
-                    (println (str "Game loop counter : " @game-loop-counter))
+                    (println (str "Calculated Pod angle with checkpoint : " (angle-between-2-points x y nextCheckpointX nextCheckpointY)))
                     (println (str "Pod Position : (" x "," y ")"))
                     (println (str "Opponent pod Position : (" opponentX "," opponentY ")"))
-                    (println (str "Opponent distance : " opponent-distance)))
+                    (println (str "Opponent distance : " opponent-distance))
+                    (println (str "Calculated Pod angle with opponent : " (angle-between-2-points x y opponentX opponentY)))
+                    (println (str "Game loop counter : " @game-loop-counter)))

                   ; You have to output the target position
                   ; followed by the power (0 <= thrust <= 100)
                   ; i.e.: "x y thrust"
-                  (print (compute-x nextCheckpointX))
+                  (print (compute-x x nextCheckpointX nextCheckpointAngle nextCheckpointDist))
                   (print " ")
-                  (print (compute-y nextCheckpointY))
+                  (print (compute-y y nextCheckpointY nextCheckpointAngle nextCheckpointDist))
                   (print " ")
                   (print (compute-action
-                           (Integer/valueOf nextCheckpointX) (Integer/valueOf nextCheckpointY)
-                           (Integer/valueOf nextCheckpointDist) (Integer/valueOf nextCheckpointAngle)
-                           (Integer/valueOf opponentX) (Integer/valueOf opponentY)
-                           boost-used? game-loop-counter))
-                  (println ""))))
+                           nextCheckpointX nextCheckpointY
+                           nextCheckpointDist nextCheckpointAngle
+                           opponentX opponentY
+                           boost-used? game-loop-counter)))
+        (println "")))


Add wrap-reset-modified-files-with-source-change middleware.

--- src/ring/middleware/incise.clj
+++ src/ring/middleware/incise.clj
@@ -1,5 +1,6 @@
 (ns ring.middleware.incise
   (:require [clojure.java.io :refer [file]]
+            [ns-tracker.core :refer [ns-tracker]]
             [incise.parsers.core :refer [parse]])
   (:import [java.io File]))

@@ -25,7 +26,7 @@
     (or (nil? previous-modification-time)
         (< previous-modification-time last-modification-time))))

-(defn wrap-incise
+(defn wrap-incise-parse
   "Call parse on each modified file in the given dir with each request."
   [handler & {:keys [in out]}]
   (let [orig-out *out*
@@ -41,3 +42,23 @@
              (map parse)
              (dorun)))
       (handler request))))
+
+(defn wrap-reset-modified-files-with-source-change
+  "An almost copy of wrap-reload, but instead of reloading modified files this
+   ensurs that the next time parse is called all content files are reparsed.
+
+   Takes the following options:
+     :dirs - A list of directories that contain the source files.
+             Defaults to [\"src\"]."
+  [handler & [options]]
+  (let [source-dirs (:dirs options ["src"])
+        modified-namespaces (ns-tracker source-dirs)]
+    (fn [request]
+      (when-not (empty? (modified-namespaces))
+        (reset! file-modification-times {}))
+      (handler request))))
+
+(defn wrap-incise
+  [handler & args]
+  (-> (apply wrap-incise-parse handler args)
+      (wrap-reset-modified-files-with-source-change)))


Fixed error handling in get-saved-posts

Fixed error handling in get-saved-posts

--- src/saved_for_reddit/core.cljs
+++ src/saved_for_reddit/core.cljs
@@ -81,13 +81,14 @@
                                    {:with-credentials? false
                                     :oauth-token (:token @app-state)}))
             posts (-> response :body :data :children)
-            error (:error response)]
+            error (-> response :body :error)]
         (println "received response")
+        (println response)
         (if (clojure.string/blank? error)
           (doseq [p posts]
             (println (process-json-post p))
             (swap! saved-posts #(conj % %2) (assoc (:data p) :key (-> p :data :id))))
-          (handle-error error)))))
+          (handle-error (str error " " (:error-text response) "\nYour API token might've expired") error)))))

 (defn process-after-token-acquire []
   (js/console.log "Token acquired...")
@@ -97,7 +98,7 @@
                                    {:with-credentials? false
                                     :oauth-token (:token @app-state)}))
             body  (:body response)
-            error (:error body)]
+            error nil #_(:error body)]
         (println response)
         (if (or (nil? error) (clojure.string/blank? error))
           (do


[WM] update lein profiles

[WM] update lein profiles

--- resources/leiningen/new/kraken_http_api/project.clj
+++ resources/leiningen/new/kraken_http_api/project.clj
@@ -30,6 +30,6 @@
                                    :password [:gpg :env]}}
   :uberjar-name "{{name}}.jar"
   :profiles {:uberjar {:aot :all}
-             :dev-common {:resource-paths ["dev-resources"]}
-             :dev-overrides {}
-             :dev [:dev-common :dev-overrides]})
+             :dev {:resource-paths ["dev-resources"]}
+             :test {:dependencies [[clj-http "2.0.0"]]
+                    :jvm-opts ["-Dlog-level=INFO"]}})


Updates permission check test to use variable concept ids

--- access-control-app/int_test/cmr/access_control/int_test/permission_check_test.clj
+++ access-control-app/int_test/cmr/access_control/int_test/permission_check_test.clj
@@ -80,29 +80,30 @@
         coll1 (ingest-prov1-collection "coll1")
         coll2 (ingest-prov1-collection "coll2")
         coll3 (ingest-prov1-collection "coll3")
-        gran1 (mdb/save-concept (u/conn-context)
-                                {:format "application/echo10+xml"
-                                 :metadata granule-metadata
-                                 :concept-type :granule
-                                 :provider-id "PROV1"
-                                 :native-id "gran1"
-                                 :revision-id 1
-                                 :extra-fields {:short-name "gran1"
-                                                :entry-title "gran1"
-                                                :entry-id "gran1"
-                                                :granule-ur "gran1ur"
-                                                :version-id "v1"
-                                                :parent-collection-id coll1
-                                                :parent-entry-title "coll1"}})
+        gran1 (:concept-id
+                (mdb/save-concept (u/conn-context)
+                                  {:format "application/echo10+xml"
+                                   :metadata granule-metadata
+                                   :concept-type :granule
+                                   :provider-id "PROV1"
+                                   :native-id "gran1"
+                                   :revision-id 1
+                                   :extra-fields {:short-name "gran1"
+                                                  :entry-title "gran1"
+                                                  :entry-id "gran1"
+                                                  :granule-ur "gran1ur"
+                                                  :version-id "v1"
+                                                  :parent-collection-id coll1
+                                                  :parent-entry-title "coll1"}}))
         ;; local helpers to make the body of the test cleaner
         create-acl #(:concept_id (ac/create-acl (u/conn-context) % {:token token}))
         update-acl #(ac/update-acl (u/conn-context) %1 %2 {:token token})
         get-collection-permissions #(get-permissions %1 coll1)
-        get-granule-permissions #(get-permissions %1 (:concept-id gran1))]
+        get-granule-permissions #(get-permissions %1 gran1)]

     (testing "no permissions granted"
       (are [user permissions]
-        (= {"C1200000001-PROV1" permissions}
+        (= {coll1 permissions}
            (get-collection-permissions user))
         :guest []
         :registered []
@@ -118,7 +119,7 @@

         (testing "for guest users"
           (are [user permissions]
-            (= {"C1200000001-PROV1" permissions}
+            (= {coll1 permissions}
                (get-collection-permissions user))
             :guest ["read" "order"]
             :registered []
@@ -132,7 +133,7 @@
                                                :collection_applicable true
                                                :provider_id "PROV1"}})
           (are [user permissions]
-            (= {"C1200000001-PROV1" permissions}
+            (= {coll1 permissions}
                (get-collection-permissions user))
             :guest []
             :registered ["read" "order"]
@@ -148,7 +149,7 @@
                                                :provider_id "PROV1"}})

           (are [user permissions]
-            (= {"C1200000001-PROV1" permissions}
+            (= {coll1 permissions}
                (get-collection-permissions user))
             :guest []
             :registered []
@@ -166,7 +167,7 @@
                                                    :collection_applicable true
                                                    :provider_id "PROV1"}})
               (are [user permissions]
-                (= {"C1200000001-PROV1" permissions}
+                (= {coll1 permissions}
                    (get-collection-permissions user))
                 :guest []
                 :registered []
@@ -184,20 +185,20 @@
                                        :provider_id "PROV1"}})
             (testing "for collection in ACL's entry titles"
               (are [user permissions]
-                (= {"C1200000002-PROV1" permissions}
-                   (get-permissions user "C1200000002-PROV1"))
+                (= {coll2 permissions}
+                   (get-permissions user coll2))
                 :guest ["read"]
                 :registered []))
             (testing "for collection not in ACL's entry titles"
               (are [user permissions]
-                (= {"C1200000003-PROV1" permissions}
-                   (get-permissions user "C1200000003-PROV1"))
+                (= {coll3 permissions}
+                   (get-permissions user coll3))
                 :guest []
                 :registered []))))))

     (testing "granule level permissions"
       (testing "no permissions granted"
-        (is (= {"G1200000004-PROV1" []}
+        (is (= {gran1 []}
                (get-granule-permissions "user1")))))))

 (deftest collection-catalog-item-identifier-access-value-test
@@ -223,10 +224,10 @@
     (u/wait-until-indexed)

     (testing "no permissions granted"
-      (is (= {"C1200000000-PROV1" []
-              "C1200000001-PROV1" []
-              "C1200000002-PROV1" []
-              "C1200000003-PROV1" []}
+      (is (= {coll1 []
+              coll2 []
+              coll3 []
+              coll4 []}
              (get-coll-permissions))))

     (let [acl-id (create-acl
@@ -238,10 +239,10 @@
                                             :provider_id "PROV1"}})]

       (testing "ACL matching all access values"
-        (is (= {"C1200000000-PROV1" ["read"]
-                "C1200000001-PROV1" ["read"]
-                "C1200000002-PROV1" ["read"]
-                "C1200000003-PROV1" []}
+        (is (= {coll1 ["read"]
+                coll2 ["read"]
+                coll3 ["read"]
+                coll4 []}
                (get-coll-permissions))))

       (testing "ACL matching only high access values"
@@ -252,10 +253,10 @@
                                                     :collection_identifier {:access_value {:min_value 4 :max_value 10}}
                                                     :provider_id "PROV1"}})

-        (is (= {"C1200000000-PROV1" []
-                "C1200000001-PROV1" ["read"]
-                "C1200000002-PROV1" ["read"]
-                "C1200000003-PROV1" []}
+        (is (= {coll1 []
+                coll2 ["read"]
+                coll3 ["read"]
+                coll4 []}
                (get-coll-permissions))))

       (testing "ACL matching only one access value"
@@ -266,10 +267,10 @@
                                                     :collection_identifier {:access_value {:min_value 4 :max_value 5}}
                                                     :provider_id "PROV1"}})

-        (is (= {"C1200000000-PROV1" []
-                "C1200000001-PROV1" ["read"]
-                "C1200000002-PROV1" []
-                "C1200000003-PROV1" []}
+        (is (= {coll1 []
+                coll2 ["read"]
+                coll3 []
+                coll4 []}
                (get-coll-permissions))))

       (testing "ACL matching only collections with undefined access values"
@@ -282,10 +283,10 @@
                                                                                :include_undefined_value true}}
                                                     :provider_id "PROV1"}})

-        (is (= {"C1200000000-PROV1" ["read"]
-                "C1200000001-PROV1" ["read"]
-                "C1200000002-PROV1" ["read"]
-                "C1200000003-PROV1" ["read"]}
+        (is (= {coll1 ["read"]
+                coll2 ["read"]
+                coll3 ["read"]
+                coll4 ["read"]}
                (get-coll-permissions)))))))

 (deftest collection-catalog-item-identifier-temporal-test
@@ -312,10 +313,10 @@
         update-acl #(ac/update-acl (u/conn-context) %1 %2 {:token token})
         get-coll-permissions #(get-permissions :guest coll1 coll2 coll3 coll4)]
     (u/wait-until-indexed)
-    (is (= {"C1200000000-PROV1" []
-            "C1200000001-PROV1" []
-            "C1200000002-PROV1" []
-            "C1200000003-PROV1" []}
+    (is (= {coll1 []
+            coll2 []
+            coll3 []
+            coll4 []}
            (get-coll-permissions)))

     (let [acl-id (create-acl
@@ -329,10 +330,10 @@
                                             :provider_id "PROV1"}})]

       (testing "\"intersect\" mask"
-        (is (= {"C1200000000-PROV1" ["read"]
-                "C1200000001-PROV1" ["read"]
-                "C1200000002-PROV1" ["read"]
-                "C1200000003-PROV1" []}
+        (is (= {coll1 ["read"]
+                coll2 ["read"]
+                coll3 ["read"]
+                coll4 []}
                (get-coll-permissions))))

       (testing "\"disjoint\" mask"
@@ -344,10 +345,10 @@
                                                                                :end_date "2006-01-01T00:00:00Z"
                                                                                :mask "disjoint"}}
                                                     :provider_id "PROV1"}})
-        (is (= {"C1200000000-PROV1" ["read"]
-                "C1200000001-PROV1" []
-                "C1200000002-PROV1" ["read"]
-                "C1200000003-PROV1" []}
+        (is (= {coll1 ["read"]
+                coll2 []
+                coll3 ["read"]
+                coll4 []}
                (get-coll-permissions))))

       (testing "\"contains\" mask"
@@ -359,10 +360,10 @@
                                                                                :end_date "2006-01-01T00:00:00Z"
                                                                                :mask "contains"}}
                                                     :provider_id "PROV1"}})
-        (is (= {"C1200000000-PROV1" []
-                "C1200000001-PROV1" ["read"]
-                "C1200000002-PROV1" []
-                "C1200000003-PROV1" []}
+        (is (= {coll1 []
+                coll2 ["read"]
+                coll3 []
+                coll4 []}
                (get-coll-permissions)))))))

 ;; For CMR-3210:
@@ -392,7 +393,7 @@

     (testing "no permissions granted"
       (are [user permissions]
-        (= {"C1200000001-PROV1" permissions}
+        (= {coll1 permissions}
            (get-coll1-permissions user))
         :guest []
         :registered []
@@ -407,7 +408,7 @@
         (u/wait-until-indexed)

         (are [user permissions]
-          (= {"C1200000001-PROV1" permissions}
+          (= {coll1 permissions}
              (get-coll1-permissions user))
           :guest ["update" "delete"]
           :registered []
@@ -421,7 +422,7 @@
                                            :target "INGEST_MANAGEMENT_ACL"}})

           (are [user permissions]
-            (= {"C1200000001-PROV1" permissions}
+            (= {coll1 permissions}
                (get-coll1-permissions user))
             :guest []
             :registered ["update" "delete"]
@@ -435,7 +436,7 @@
                                            :target "INGEST_MANAGEMENT_ACL"}})

           (are [user permissions]
-            (= {"C1200000001-PROV1" permissions}
+            (= {coll1 permissions}
                (get-coll1-permissions user))
             :guest []
             :registered []


some refactoring; fix a performance regression

--- iwaswhere-web/src/clj/iwaswhere_web/graph/query.clj
+++ iwaswhere-web/src/clj/iwaswhere_web/graph/query.clj
@@ -65,21 +65,21 @@
 (defn get-comments
   "Extract all comments for entry."
   [entry g n]
-  (merge entry
-         {:comments (->> (flatten (uc/find-edges g {:dest         n
-                                                    :relationship :COMMENT}))
+  (let [edges (uc/find-edges g {:dest n :relationship :COMMENT})
+        comment-ids (->> (flatten edges)
                          (remove :mirror?)
-                         (mapv :src)
-                         (sort))}))
+                         (map :src)
+                         (sort))]
+    (merge entry {:comments (vec comment-ids)})))

 (defn get-tags-mentions-matches
   "Extract matching timestamps for query."
   [g query]
   (let [mapper (fn [tag-type]
                  (fn [tag]
-                   (set (map :dest
-                             (uc/find-edges g {:src          {tag-type tag}
-                                               :relationship :CONTAINS})))))
+                   (let [q {:src {tag-type tag} :relationship :CONTAINS}
+                         edges (uc/find-edges g q)]
+                     (set (map :dest edges)))))
         t-matched (map (mapper :tag) (map s/lower-case (:tags query)))
         pt-matched (map (mapper :ptag) (map s/lower-case (:tags query)))
         m-matched (map (mapper :mention) (map s/lower-case (:mentions query)))]
@@ -98,13 +98,14 @@
 (defn get-linked-entries
   "Extract all linked entries for entry, including their comments."
   [entry g n sort-by-upvotes?]
-  (let [linked (->> (flatten (uc/find-edges g {:src n :relationship :LINKED}))
-                    ;(remove :mirror?)
-                    (mapv :dest)
-                    (sort))]
-    (merge entry {:linked-entries-list (if sort-by-upvotes?
-                                         (sort compare-w-upvotes linked)
-                                         linked)})))
+  (let [sort-fn (fn [ids]
+                  (if sort-by-upvotes?
+                    (sort compare-w-upvotes ids)
+                    (sort ids)))
+        linked (->> (flatten (uc/find-edges g {:src n :relationship :LINKED}))
+                    (map :dest)
+                    (sort-fn))]
+    (merge entry {:linked-entries-list (vec linked)})))

 (defn extract-sorted-entries
   "Extracts nodes and their properties in descending timestamp order by looking
@@ -136,9 +137,9 @@
                                                  (get-nodes-for-day g query))
                           ; set with all timestamps (leads to full scan)
                           :else (:sorted-entries current-state))
-        matched-entries (mapv mapper-fn matched-ids)
-        parent-ids (filterv identity (mapv :comment-for matched-entries))
-        parents (mapv mapper-fn parent-ids)
+        matched-entries (map mapper-fn matched-ids)
+        parent-ids (filter identity (map :comment-for matched-entries))
+        parents (map mapper-fn parent-ids)
         entries (flatten [matched-entries parents])]
     (if sort-by-upvotes?
       (sort compare-w-upvotes entries)


Don't show maintenance mode dialog if it's the net::ERR_CONNECTION_REFUSED thing (#518)

--- src/cljs/org/broadinstitute/firecloud_ui/utils.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/utils.cljs
@@ -149,6 +149,18 @@
 (defonce pending-calls (atom []))

+(defn- check-maintenance-mode [status-code status-text]
+  (or (= status-code 502)
+      ;; status code 0 means maintenance mode--unless it's this net::ERR_CONNECTION_REFUSED thing
+      ;; which has a completely empty response, so exclude that.
+      (and (= status-code 0)
+           (not (empty? status-text)))))
+
+(defn- check-server-down [status-code]
+  (or (= 501 status-code)
+      (<= 503 status-code 599)))
+
+
 (defn ajax-orch [path arg-map & {:keys [service-prefix ignore-auth-expiration?] :or {service-prefix "/api"}}]
   (assert (= (subs path 0 1) "/") (str "Path must start with '/': " path))
   (let [on-done (:on-done arg-map)]
@@ -156,11 +168,11 @@
            arg-map :url (str (config/api-url-root) service-prefix path)
            :headers (merge {"Authorization" (str "Bearer " @access-token)}
                            (:headers arg-map))
-           :on-done (fn [{:keys [status-code] :as m}]
+           :on-done (fn [{:keys [status-code status-text] :as m}]
                       (when (and (not @server-down?)  (not @maintenance-mode?))
                         (cond
-                          (contains? #{0 502} status-code) (reset! maintenance-mode? true)
-                          (contains? (set (range 501 600)) status-code) (reset! server-down? true)))
+                          (check-maintenance-mode status-code status-text) (reset! maintenance-mode? true)
+                          (check-server-down status-code) (reset! server-down? true)))
                       ;; Handle auth token expiration
                       (if (and (= status-code 401) (not ignore-auth-expiration?))
                         (do


oops, forgot to add basket store

oops, forgot to add basket store


Use simpler metadata syntax

Use simpler metadata syntax

--- src/main/clojure/clojure/test/check/generators.cljc
+++ src/main/clojure/clojure/test/check/generators.cljc
@@ -1214,16 +1214,16 @@
         (one-of [(choose 65 90)
                  (choose 97 122)])))

-(def ^{:private true} char-symbol-special
+(def ^:private char-symbol-special
   "Generate non-alphanumeric characters that can be in a symbol."
   (elements [\* \+ \! \- \_ \?]))

-(def ^{:private true} char-keyword-rest
+(def ^:private char-keyword-rest
   "Generate characters that can be the char following first of a keyword."
   (frequency [[2 char-alphanumeric]
               [1 char-symbol-special]]))

-(def ^{:private true} char-keyword-first
+(def ^:private char-keyword-first
   "Generate characters that can be the first char of a keyword."
   (frequency [[2 char-alpha]
               [1 char-symbol-special]]))
@@ -1263,24 +1263,24 @@
                          (#?(:clj = :cljs identical?) \- c))
                      (digit? d))))

-(def ^{:private true} namespace-segment
+(def ^:private namespace-segment
   "Generate the segment of a namespace."
   (->> (tuple char-keyword-first (vector char-keyword-rest))
        (such-that (fn [[c [d]]] (not (+-or---digit? c d))))
        (fmap (fn [[c cs]] (clojure.string/join (cons c cs))))))

-(def ^{:private true} namespace
+(def ^:private namespace
   "Generate a namespace (or nil for no namespace)."
   (->> (vector namespace-segment)
        (fmap (fn [v] (when (seq v)
                        (clojure.string/join "." v))))))

-(def ^{:private true} keyword-segment-rest
+(def ^:private keyword-segment-rest
   "Generate segments of a keyword (between \\:)"
   (->> (tuple char-keyword-rest (vector char-keyword-rest))
        (fmap (fn [[c cs]] (clojure.string/join (cons c cs))))))

-(def ^{:private true} keyword-segment-first
+(def ^:private keyword-segment-first
   "Generate segments of a keyword that can be first (between \\:)"
   (->> (tuple char-keyword-first (vector char-keyword-rest))
        (fmap (fn [[c cs]] (clojure.string/join (cons c cs))))))
@@ -1308,12 +1308,12 @@
                (core/keyword ns (clojure.string/join (cons c cs)))))
        (resize-symbolish-generator)))

-(def ^{:private true} char-symbol-first
+(def ^:private char-symbol-first
   (frequency [[10 char-alpha]
               [5 char-symbol-special]
               [1 (return \.)]]))

-(def ^{:private true} char-symbol-rest
+(def ^:private char-symbol-rest
   (frequency [[10 char-alphanumeric]
               [5 char-symbol-special]
               [1 (return \.)]]))


fix up foreign-libs javascript reloading a bit

--- sidecar/src/figwheel_sidecar/build_middleware/javascript_reloading.clj
+++ sidecar/src/figwheel_sidecar/build_middleware/javascript_reloading.clj
@@ -19,25 +19,31 @@
   (let [path (cljs.closure/lib-rel-path {:provides [namesp]})]
     (io/file output-dir path)))

-(defn safe-js->ns [foreign-libs file-path]
-  (:provides
-   ;; first check if a foreign-lib addresses this file
-   (or (some->> foreign-libs
-                (filter #(.endsWith file-path (:file %)))
-                first)
-       (try (bapi/parse-js-ns file-path)
-            (catch Throwable e
-              ;; couldn't parse js for namespace
-              {})))))
+(defn foreign-libs-provides [foreign-libs file-path]
+  (some->> foreign-libs
+           (filter #(.endsWith file-path (:file %)))
+           first
+           :provides
+           not-empty))
+
+(defn safe-js->ns [file-path]
+  (try (some-> (bapi/parse-js-ns file-path)
+               :provides
+               not-empty)
+       (catch Throwable e
+         ;; couldn't parse js for namespace
+         nil)))

 (defn best-try-js-ns [state foreign-libs js-file-path]
-  (let [provs (and (.exists (io/file js-file-path))
-                   (safe-js->ns foreign-libs js-file-path))]
-    (if-not (empty? provs)
+  (letfn [(get-provides [js-path]
+            (and (.exists (io/file js-path))
+                 (or
+                  (safe-js->ns js-path)
+                  (foreign-libs-provides foreign-libs js-path))))]
+    (if-let [provs (get-provides js-file-path)]
       provs
       (if-let [out-file (cljs-target-file-from-foreign (:output-dir state) js-file-path)]
-        (and (.exists out-file)
-             (safe-js->ns foreign-libs out-file))))))
+        (get-provides out-file)))))

 (defn js-file->namespaces [{:keys [foreign-libs output-dir] :as state} js-file-path]
   (best-try-js-ns state foreign-libs js-file-path))


Add comments.

Add comments.

--- src-cljs/kixi/hecuba/new_profile.cljs
+++ src-cljs/kixi/hecuba/new_profile.cljs
@@ -20,7 +20,9 @@
 (defn non-empty? [n] (if (coll? n) (seq n) n))

 (defn parse
-  "Remove all empty elements from the nested data structure and flatten :_value elements."
+  "Remove all empty elements from the nested data structure and flatten :_value elements.
+  Since postwalk will check elements like [:some-key], there is a check against tuples:
+ (and (coll? m) (not (keyword (first m))))."
   [cursor]
   (clojure.walk/postwalk (fn [m]
                           (cond


Added some rest tests to fix

Added some rest tests to fix

--- test/clojure_rest/integration/controllers/document_controller_test.clj
+++ test/clojure_rest/integration/controllers/document_controller_test.clj
@@ -6,7 +6,39 @@

 (deftest test-document-controller
   (database/initDatabase)
-  (testing "Testing document list route"
+
+  (testing "Testing document list route worked"
     (let [response (app (mock/request :get "/documents"))]
+      (is (= (:status response) 200))))
+
+  (testing "Testing get document by id route worked"
+    (let [response (app (mock/request :get "/documents"))]
+      (is (= (:status response) 200))))
+
+  (testing "Testing get document by id route failed with incorrect id"
+    (let [response (app (mock/request :get "/documents/1"))]
+      (is (= (:status response) 200))))
+
+  (testing "Testing document creation route worked"
+    (let [response (app (mock/request :post "/documents"))]
+      (is (= (:status response) 200))))
+
+  (testing "Testing document creation route failed"
+    (let [response (app (mock/request :post "/documents"))]
+      (is (= (:status response) 200))))
+
+  (testing "Testing document update route worked"
+    (let [response (app (mock/request :put "/documents/1"))]
+      (is (= (:status response) 200))))
+
+  (testing "Testing document update route failed"
+    (let [response (app (mock/request :put "/documents/1"))]
+      (is (= (:status response) 200))))
+
+  (testing "Testing document delete route worked"
+    (let [response (app (mock/request :delete "/documents/1"))]
+      (is (= (:status response) 200))))
+
+  (testing "Testing document delete route failed"
+    (let [response (app (mock/request :delete "/documents/1"))]
       (is (= (:status response) 200)))))
-      ;(is (= (:body response) "Not found"))))


start resolving index error with multiple items per account

--- src/clj_money/models/transactions.clj
+++ src/clj_money/models/transactions.clj
@@ -556,6 +556,8 @@
     (when-let [last-balance (:last-balance result)]
       (accounts/update storage (assoc account :balance last-balance)))))

+; At this point, there should only be one item
+; per account
 (defn- recalculate-items
   "Accepts a list of transaction items that precede a given
   transaction. Base items are items have the correct index
@@ -586,8 +588,11 @@
                                   :balance 0M
                                   :index 0M))
                    (map #(create-transaction-item* storage %)))
-        previous-items (map #(get-previous-item storage %)
-                            items)]
+        previous-items (->> items ; make sure we're only getting on item per account
+                            (group-by :account-id)
+                            (map #(update-in % [1] (partial sort-by :index)))
+                            (map (comp first second))
+                            (map #(get-previous-item storage %)))]
     (recalculate-items storage previous-items)
     (reload storage created)))


Remove redundant call to visit-pixel

Remove redundant call to visit-pixel

--- src/cljs/goya/components/drawing.cljs
+++ src/cljs/goya/components/drawing.cljs
@@ -341,7 +341,6 @@
     (let [active-pixels-since-last-event (bresenham/bresenham doc-x doc-y last-x last-y)]
       (set! (.-fillStyle preview-context) preview-color)
       (paint-pixels-for-pencil-tool (conj active-pixels-since-last-event [doc-x doc-y]) pixel-size)
-      (visit-pixel doc-index)
       (visit-pixels-for-line-segment doc-x doc-y last-x last-y doc-canvas-width)
       (reset! guistate/transient-state
               (assoc @guistate/transient-state :last-mouse-pos [doc-x doc-y]))))


receive page fix

receive page fix

--- src/cljs/salava/badge/ui/receive.cljs
+++ src/cljs/salava/badge/ui/receive.cljs
@@ -118,20 +118,19 @@

           [:div.text-center
            (if user_exists?
+             [:div [:p [:a#login-button.btn.btn-primary {:href (path-for "/user/login")} (t :user/Login)]]]
+
              [:div
-              [:p
-               [:a#login-button.btn.btn-primary {:href (path-for "/user/login")} (t :user/Login)]]
-              [:p
-               [:a {:href (path-for "/user/register")} [:i.fa.fa-user-plus] " " (t :user/Createnewaccount)]]]
-             [:p
-              [:a {:class "btn btn-primary" :href (path-for "/user/register")} [:i.fa.fa-user-plus] " " (t :user/Createnewaccount)]]
+              [:p [:a#login-button.btn.btn-primary {:href (path-for "/user/login")} (t :user/Login)]]
+              [:p [:a {:href (path-for "/user/register")} [:i.fa.fa-user-plus] " " (t :user/Createnewaccount)]]]
              )
-           [:p
-            [:a {:href (str obf_url "/c/receive/download?url=" assertion_url)} [:i.fa.fa-download] " " (t :badge/DownloadThisBadge)]]
+
            [:hr]
-           [:p
-            [:a {:href "#" :on-click (fn [] (m/modal! [reject-badge-modal id] {:size :lg}))} [:i.fa.fa-ban] " " (t :badge/IDontWantThisBadge)]]
+           [:div.col-md-12
+            [:p.pull-left [:a {:href (str obf_url "/c/receive/download?url=" assertion_url)} [:i.fa.fa-download] " " (t :badge/DownloadThisBadge)]]
+            [:p.pull-right [:a {:href "#" :on-click (fn [] (m/modal! [reject-badge-modal id] {:size :lg}))} [:i.fa.fa-ban] " " (t :badge/IDontWantThisBadge)]]]
            ]]]]]
+
       [:div#badge-info
        [m/modal-window]
        [:div.panel