author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
701,850
11.09.2021 20:57:16
-43,200
3c3710d24c22bf2dd8d50213f8e6ba81065241bd
Fixed the Modulo and Not block if their input is left blank. Added a default input in the modulo block and Not block so that it does not throw an error when the program is sent to Jobe server
[ { "change_type": "MODIFY", "old_path": "csunplugged/static/js/custom-blockly-blocks.js", "new_path": "csunplugged/static/js/custom-blockly-blocks.js", "diff": "@@ -1002,7 +1002,7 @@ Blockly.JavaScript['operators_not'] = function(block) {\nreturn [code, Blockly.JavaScript.ORDER_LOGICAL_NOT];\n};\nBlockly.Python['operators_not'] = function(block) {\n- var value_argument = Blockly.Python.valueToCode(block, 'argument', Blockly.Python.ORDER_LOGICAL_NOT);\n+ var value_argument = Blockly.Python.valueToCode(block, 'argument', Blockly.Python.ORDER_LOGICAL_NOT) || 'True';\nvar code = 'not ' + value_argument;\nreturn [code, Blockly.Python.ORDER_LOGICAL_NOT];\n};\n@@ -1295,14 +1295,22 @@ Blockly.Python['operators_join_string'] = function(block) {\n// Operators modulo block\nBlockly.JavaScript['operators_modulo'] = function(block) {\n- var value_a = Blockly.JavaScript.valueToCode(block, 'a', Blockly.JavaScript.ORDER_MODULUS) || '0';\n- var value_n = Blockly.JavaScript.valueToCode(block, 'n', Blockly.JavaScript.ORDER_MODULUS) || '0';\n+ var value_a = Blockly.JavaScript.valueToCode(block, 'a', Blockly.JavaScript.ORDER_MODULUS);\n+ var value_n = Blockly.JavaScript.valueToCode(block, 'n', Blockly.JavaScript.ORDER_MODULUS);\n+ if (!value_a && !value_n) {\n+ value_a = '0';\n+ value_n = '1';\n+ }\nvar code = '(' + value_a + ' % ' + value_n + ' + ' + value_n + ')' + ' % ' + value_n;\nreturn [code, Blockly.JavaScript.ORDER_ADDITION];\n};\nBlockly.Python['operators_modulo'] = function(block) {\n- var value_a = Blockly.Python.valueToCode(block, 'a', Blockly.Python.ORDER_ATOMIC) || '0';\n- var value_n = Blockly.Python.valueToCode(block, 'n', Blockly.Python.ORDER_ATOMIC) || '0';\n+ var value_a = Blockly.Python.valueToCode(block, 'a', Blockly.Python.ORDER_ATOMIC);\n+ var value_n = Blockly.Python.valueToCode(block, 'n', Blockly.Python.ORDER_ATOMIC);\n+ if (!value_a && !value_n) {\n+ value_a = '0';\n+ value_n = '1';\n+ }\nvar code = value_a + ' % ' + value_n;\nreturn [code, Blockly.Python.ORDER_NONE];\n};\n" } ]
Python
MIT License
uccser/cs-unplugged
Fixed the Modulo and Not block if their input is left blank. - Added a default input in the modulo block and Not block so that it does not throw an error when the program is sent to Jobe server
701,850
12.09.2021 16:37:18
-43,200
6ca52b21739844657f55038cb13f5a93a00bc021
Modified the zoom controls of the Block-based editor. Starting zoom level is further Disabled the wheel control to change the zoom level
[ { "change_type": "MODIFY", "old_path": "csunplugged/static/js/jobe-editor.js", "new_path": "csunplugged/static/js/jobe-editor.js", "diff": "@@ -175,8 +175,7 @@ if (programming_lang == \"python\") {\noneBasedIndex : true,\nzoom : {\ncontrols : true,\n- wheel : true,\n- startScale : 0.9,\n+ startScale : 0.7,\nmaxScale : 2,\nminScale : 0.5,\nscaleSpeed : 1.2\n" } ]
Python
MIT License
uccser/cs-unplugged
Modified the zoom controls of the Block-based editor. - Starting zoom level is further - Disabled the wheel control to change the zoom level
701,850
12.09.2021 19:03:28
-43,200
16f5c1b4555d2d4d1d303c55e188b30001a1f144
Fixed the Check button not getting disabled when clicked. Added the hover animation on the Run button.
[ { "change_type": "MODIFY", "old_path": "csunplugged/static/js/jobe-editor.js", "new_path": "csunplugged/static/js/jobe-editor.js", "diff": "@@ -213,7 +213,7 @@ function sendCodeToJobe() {\nconsole.log(\"SEND CODE TO JOBE\")\nconsole.log(code)\n- $(\"#editor_run_button\").prop(\"disabled\", true);\n+ $(\"#editor_check_button\").prop(\"disabled\", true);\n$(\".code_running_spinner\").css(\"display\", \"inline-block\");\n// Run the test_cases\n@@ -223,7 +223,7 @@ function sendCodeToJobe() {\n// Saving the users code\nsave_code(allCorrect(result) ? \"passed\" : \"failed\");\n- $(\"#editor_run_button\").prop(\"disabled\", false);\n+ $(\"#editor_check_button\").prop(\"disabled\", false);\n$(\".code_running_spinner\").css(\"display\", \"none\");\n});\n}\n" }, { "change_type": "MODIFY", "old_path": "csunplugged/static/js/plugging-it-in-walkthrough.js", "new_path": "csunplugged/static/js/plugging-it-in-walkthrough.js", "diff": "@@ -18,7 +18,7 @@ $(document).ready(function () {\nstep: 2\n},\n{\n- element: \"#editor_run_button\",\n+ element: \"#editor_check_button\",\nintro: \"Clicking the 'Check' button will run your code to see if it works correctly for our test cases.\",\nstep: 3\n},\n" }, { "change_type": "MODIFY", "old_path": "csunplugged/static/scss/programming-editor.scss", "new_path": "csunplugged/static/scss/programming-editor.scss", "diff": "$student-colour: #3044b3;\n$student-colour-light: #5a9fffff;\n-$scratch-flag-colour: #4cbf56;\n-$scratch-flag-border-colour: #4ab750;\n+$scratch-flag-colour: #6abf74;\nhtml,\nbody {\n@@ -244,6 +243,11 @@ body {\ncolor: white;\n}\n+ #blockly_editor_run_program_button:hover {\n+ background-color: #4cbf56;\n+ border: 2px solid #4ab750;\n+ }\n+\n#download_button {\nborder: 2px solid $student-colour-light;\ncolor: $student-colour-light;\n@@ -251,11 +255,11 @@ body {\n}\n#blockly_editor_run_program_button {\n- border: 2px solid $scratch-flag-border-colour;\n+ border: 2px solid $scratch-flag-colour;\nbackground-color: $scratch-flag-colour;\n}\n- #editor_run_button:disabled {\n+ #editor_check_button:disabled {\nbackground-color: #a4caffff;\nborder-color: #a4caffff;\ncursor: normal;\n" } ]
Python
MIT License
uccser/cs-unplugged
Fixed the Check button not getting disabled when clicked. Added the hover animation on the Run button.
701,850
13.09.2021 14:09:23
-43,200
64ada4ed9ed1d4a4f8c8a81d2d79eca86709e191
Added a border and made the corner of the block-based editor to be rounded.
[ { "change_type": "MODIFY", "old_path": "csunplugged/static/scss/programming-editor.scss", "new_path": "csunplugged/static/scss/programming-editor.scss", "diff": "@@ -454,6 +454,8 @@ body {\n}\n}\n-.introjs-fixParent{\n- position: absolute !important;\n+// Customise the Block-based editor to have rounded corners and have a border\n+.injectionDiv {\n+ border: 1px solid gray;\n+ border-radius: 15px;\n}\n" } ]
Python
MIT License
uccser/cs-unplugged
Added a border and made the corner of the block-based editor to be rounded.
701,850
14.09.2021 18:22:35
-43,200
4679f6cd67ebe04dd4dfcea5c4ee49ecefdca5a9
Fixed the Recommended blocks section for the 3 questions that the Block-based is currently implemented in.
[ { "change_type": "MODIFY", "old_path": "csunplugged/topics/content/en/binary-numbers/programming-challenges/binary-numbers-using-variable-operator-repeat/block-based-expected.md", "new_path": "csunplugged/topics/content/en/binary-numbers/programming-challenges/binary-numbers-using-variable-operator-repeat/block-based-expected.md", "diff": "-```scratch\n-when green flag clicked\n+{image file-path=\"img/plugging-it-in/block-based-blocks/values-number.png\" caption=\"false\" alt=\"Number block\"}\n-set [number of dots v] to [1]\n+{image file-path=\"img/plugging-it-in/block-based-blocks/looks-say.png\" caption=\"false\" alt=\"Say block\"}\n-repeat (5)\n-end\n+{image file-path=\"img/plugging-it-in/block-based-blocks/operators-multiply.png\" caption=\"false\" alt=\"Multiply block\"}\n-say (number of dots) for (1) secs\n+{image file-path=\"img/plugging-it-in/block-based-blocks/variables-custom-var.png\" caption=\"false\" alt=\"Custom variable block\"}\n-set [number of dots v] to ((number of dots) * (2))\n-```\n+{image file-path=\"img/plugging-it-in/block-based-blocks/variables-set-to.png\" caption=\"false\" alt=\"Set variable to block\"}\n+\n+{image file-path=\"img/plugging-it-in/block-based-blocks/control-repeat.png\" caption=\"false\" alt=\"Repeat block\"}\n" }, { "change_type": "MODIFY", "old_path": "csunplugged/topics/content/en/binary-numbers/programming-challenges/binary-numbers-using-variable/block-based-expected.md", "new_path": "csunplugged/topics/content/en/binary-numbers/programming-challenges/binary-numbers-using-variable/block-based-expected.md", "diff": "-```scratch\n-when flag clicked\n+{image file-path=\"img/plugging-it-in/block-based-blocks/values-string.png\" caption=\"false\" alt=\"String block\"}\n-say [1] for (1) secs\n-\n-say [2] for (1) secs\n-\n-say [4] for (1) secs\n-\n-say [8] for (1) secs\n-\n-say [16] for (1) secs\n-```\n+{image file-path=\"img/plugging-it-in/block-based-blocks/looks-say.png\" caption=\"false\" alt=\"Say block\"}\n" }, { "change_type": "MODIFY", "old_path": "csunplugged/topics/content/en/kidbots/programming-challenges/modulo-even-odd-numbers/block-based-expected.md", "new_path": "csunplugged/topics/content/en/kidbots/programming-challenges/modulo-even-odd-numbers/block-based-expected.md", "diff": "-```scratch\n-when green flag clicked\n+{image file-path=\"img/plugging-it-in/block-based-blocks/values-number.png\" caption=\"false\" alt=\"Number block\"}\n-ask [Enter a number:] and wait\n+{image file-path=\"img/plugging-it-in/block-based-blocks/values-string.png\" caption=\"false\" alt=\"String block\"}\n-set [number v] to (answer)\n+{image file-path=\"img/plugging-it-in/block-based-blocks/sensing-ask-and-wait-number.png\" caption=\"false\" alt=\"Ask and wait for number block\"}\n-say [You entered an even number!]\n+{image file-path=\"img/plugging-it-in/block-based-blocks/looks-say.png\" caption=\"false\" alt=\"Say block\"}\n-say [You entered an odd number!]\n+{image file-path=\"img/plugging-it-in/block-based-blocks/operators-mod.png\" caption=\"false\" alt=\"Mod block\"}\n-if <((number) mod (2)) = [0]> then\n-else\n-end\n-```\n\\ No newline at end of file\n+{image file-path=\"img/plugging-it-in/block-based-blocks/operators-equal.png\" caption=\"false\" alt=\"Equality block\"}\n+\n+{image file-path=\"img/plugging-it-in/block-based-blocks/variables-set-to.png\" caption=\"false\" alt=\"Set variable to block\"}\n+\n+{image file-path=\"img/plugging-it-in/block-based-blocks/variables-custom-var.png\" caption=\"false\" alt=\"Custom variable block\"}\n+\n+{image file-path=\"img/plugging-it-in/block-based-blocks/control-if-else.png\" caption=\"false\" alt=\"If else block\"}\n\\ No newline at end of file\n" } ]
Python
MIT License
uccser/cs-unplugged
Fixed the Recommended blocks section for the 3 questions that the Block-based is currently implemented in.
701,850
15.09.2021 12:22:25
-43,200
ec8d5ef99ad298d8498472191214c4c6fa078137
Modified Python code generator for the 'Ask and Wait Block for Number' block to return either a Float or a Number depending whether the user input has a '.' or not If there is a '.' then convert user input to float Else convert user input to int
[ { "change_type": "MODIFY", "old_path": "csunplugged/static/js/custom-blockly-blocks.js", "new_path": "csunplugged/static/js/custom-blockly-blocks.js", "diff": "@@ -1208,9 +1208,14 @@ Blockly.Python['sensing_ask_and_wait_number'] = function(block) {\n'text_prompt',\n['def ' + Blockly.Python.FUNCTION_NAME_PLACEHOLDER_ + '(msg):',\n' try:',\n- ' return raw_input(msg)',\n+ ' user_input = raw_input(msg)',\n' except NameError:',\n- ' return input(msg)']);\n+ ' user_input = input(msg)',\n+ ' finally:',\n+ ' if any(not c.isalnum() for c in user_input):',\n+ ' return float(user_input)',\n+ ' else:',\n+ ' return int(user_input)']);\nif (block.getField('question')) {\n// Internal message.\nvar msg = Blockly.Python.quote_(block.getFieldValue('question'));\n@@ -1219,7 +1224,7 @@ Blockly.Python['sensing_ask_and_wait_number'] = function(block) {\nvar msg = Blockly.Python.valueToCode(block, 'question', Blockly.Python.ORDER_NONE) || '\\'\\'';\n}\nmsg = '\"\"' // Replaces user input parameters to be blank so it matches the expected output\n- var code = 'float(' + functionName + '(' + msg + '))';\n+ var code = functionName + '(' + msg + ')';\nreturn [code, Blockly.Python.ORDER_FUNCTION_CALL];\n};\n" } ]
Python
MIT License
uccser/cs-unplugged
Modified Python code generator for the 'Ask and Wait Block for Number' block to return either a Float or a Number depending whether the user input has a '.' or not - If there is a '.' then convert user input to float - Else convert user input to int
701,850
15.09.2021 12:24:16
-43,200
bb0625803b796ca2bd674a951b4e36f9c3a4544e
Added back the CSS styling for introjs-fixParent, because it was accidentally deleted from a previous commit
[ { "change_type": "MODIFY", "old_path": "csunplugged/static/scss/programming-editor.scss", "new_path": "csunplugged/static/scss/programming-editor.scss", "diff": "@@ -462,6 +462,10 @@ body {\n}\n}\n+.introjs-fixParent{\n+ position: absolute !important;\n+}\n+\n// Customise the Block-based editor to have rounded corners and have a border\n.injectionDiv {\nborder: 1px solid gray;\n" } ]
Python
MIT License
uccser/cs-unplugged
Added back the CSS styling for introjs-fixParent, because it was accidentally deleted from a previous commit
701,850
15.09.2021 12:38:24
-43,200
794155117747fd770322a45c0b454315402c0cc4
Changed language name to language slug
[ { "change_type": "MODIFY", "old_path": "csunplugged/templates/plugging_it_in/lesson.html", "new_path": "csunplugged/templates/plugging_it_in/lesson.html", "diff": "{% trans \"The following challenges use Blockly, which have been adapted to look like Scratch and contains an interactive editor. To find out the differences, click here! If you like the challenges to be purely in Scratch, then go over to the Scratch tab instead.\" %}\n</div>\n{% endif %}\n- {% include \"plugging_it_in/programming-challenges-table.html\" with language=language.name %}\n+ {% include \"plugging_it_in/programming-challenges-table.html\" %}\n</div>\n{% endfor %}\n</div>\n" }, { "change_type": "MODIFY", "old_path": "csunplugged/templates/plugging_it_in/programming-challenges-table.html", "new_path": "csunplugged/templates/plugging_it_in/programming-challenges-table.html", "diff": "<tbody>\n{% for programming_challenge in programming_challenges %}\n{% for implementation in programming_challenge.implementations.all %}\n- {% if implementation.language.name == language %}\n+ {% if implementation.language.slug == language.slug %}\n<tr class=\"align-middle{% if not programming_challenge.translation_available %} table-active{% endif %}\">\n<td class=\"text-center\">\n{{ programming_challenge.challenge_set_number }}.{{ programming_challenge.challenge_number }}\n{% include \"generic/not-available-badge.html\" %}\n<br>\n{% endif %}\n- {% if language == \"Python\" %}\n+ {% if language.slug == \"python\" %}\n<a href=\"{% url 'plugging_it_in:programming_challenge' topic.slug lesson.slug programming_challenge.slug 'python' %}\">\n<strong>{{ programming_challenge.name }}</strong>\n</a>\n- {% elif language == \"Block-based\" %}\n+ {% elif language.slug == \"block-based\" %}\n<a href=\"{% url 'plugging_it_in:programming_challenge' topic.slug lesson.slug programming_challenge.slug 'block-based' %}\">\n<strong>{{ programming_challenge.name }}</strong>\n</a>\n" } ]
Python
MIT License
uccser/cs-unplugged
Changed language name to language slug
701,850
15.09.2021 15:18:41
-43,200
3b3ce65ea36b3875a445fb1f26bc6457e457f27a
Optimised the number of SQL queries getting called in the lists page
[ { "change_type": "MODIFY", "old_path": "csunplugged/plugging_it_in/views.py", "new_path": "csunplugged/plugging_it_in/views.py", "diff": "@@ -99,7 +99,7 @@ class ProgrammingChallengeListView(generic.DetailView):\n# Add in a QuerySet of all the connected programming exercises for this topic\ncontext[\"programming_challenges\"] = self.object.retrieve_related_programming_challenges(\n- ).prefetch_related('implementations')\n+ ).prefetch_related('implementations', 'implementations__language')\nreturn context\n" }, { "change_type": "MODIFY", "old_path": "csunplugged/topics/models.py", "new_path": "csunplugged/topics/models.py", "diff": "@@ -410,7 +410,7 @@ class Lesson(TranslatableModel):\n\"challenge_set_number\",\n\"challenge_number\",\n\"name\",\n- )\n+ ).select_related('difficulty')\nif language_filter != \"all\":\nprogramming_challenges = programming_challenges.filter(implementations__language__name=language_filter)\n" } ]
Python
MIT License
uccser/cs-unplugged
Optimised the number of SQL queries getting called in the lists page
701,850
15.09.2021 15:35:20
-43,200
377b35469d02d702a6432ce289d94b6501d5b139
[WIP] Added the information page displaying the differences between the new Block-based system and Scratch Will need to update the content later...
[ { "change_type": "MODIFY", "old_path": "csunplugged/plugging_it_in/urls.py", "new_path": "csunplugged/plugging_it_in/urls.py", "diff": "@@ -17,6 +17,11 @@ urlpatterns = [\nviews.AboutView.as_view(),\nname=\"about\"\n),\n+ path(\n+ 'block-based-vs-scratch/',\n+ views.BlockBasedAndScratchView.as_view(),\n+ name=\"block_based_vs_scratch\"\n+ ),\nurl(\nr\"^(?P<topic_slug>[-\\w]+)/(?P<lesson_slug>[-\\w]+)/$\",\nviews.ProgrammingChallengeListView.as_view(),\n" }, { "change_type": "MODIFY", "old_path": "csunplugged/plugging_it_in/views.py", "new_path": "csunplugged/plugging_it_in/views.py", "diff": "@@ -65,6 +65,11 @@ class AboutView(generic.TemplateView):\ntemplate_name = \"plugging_it_in/about.html\"\n+class BlockBasedAndScratchView(generic.TemplateView):\n+ \"\"\"View for the diferrences between the Block-based system and Scratch page that renders from a template.\"\"\"\n+\n+ template_name = \"plugging_it_in/block-based-vs-scratch.html\"\n+\nclass ProgrammingChallengeListView(generic.DetailView):\n\"\"\"View showing all the programming exercises for a specific lesson.\"\"\"\n" }, { "change_type": "MODIFY", "old_path": "csunplugged/templates/plugging_it_in/lesson.html", "new_path": "csunplugged/templates/plugging_it_in/lesson.html", "diff": "</div>\n{% elif language.slug == \"block-based\" %}\n<div class=\"alert alert-info my-3\" role=\"alert\">\n- {% trans \"The following challenges use Blockly, which have been adapted to look like Scratch and contains an interactive editor. To find out the differences, click here! If you like the challenges to be purely in Scratch, then go over to the Scratch tab instead.\" %}\n+ {% trans \"The following challenges use Blockly, which have been adapted to look like Scratch and contains an interactive editor. To find out the differences, \" %}<a href=\"{% url 'plugging_it_in:block_based_vs_scratch' %}\">{% trans \"click here\" %}</a>{% trans \". If you like the challenges to be purely in Scratch, then go over to the Scratch tab instead.\" %}\n</div>\n{% endif %}\n{% include \"plugging_it_in/programming-challenges-table.html\" %}\n" } ]
Python
MIT License
uccser/cs-unplugged
[WIP] Added the information page displaying the differences between the new Block-based system and Scratch - Will need to update the content later...
701,850
15.09.2021 15:36:03
-43,200
751519ea641185343d3f7bae1a1b3b04e9b52c9c
Added borders to the Results table and Console to match the colours of the Submit and Check button respectively
[ { "change_type": "MODIFY", "old_path": "csunplugged/static/scss/programming-editor.scss", "new_path": "csunplugged/static/scss/programming-editor.scss", "diff": "@@ -160,7 +160,7 @@ body {\npadding-right: 20px !important;\n.results-table {\n- border: 1px solid grey;\n+ border: 1px solid #1b7bffff;\nborder-radius: 15px;\nbackground-color: white;\nmax-height: 40%;\n@@ -177,7 +177,7 @@ body {\nflex-shrink: 1;\nmax-height: 30%;\nbackground-color: white;\n- border: 1px solid grey;\n+ border: 1px solid #4ab750;\nborder-radius: 15px;\n#block-based-console-content {\n" } ]
Python
MIT License
uccser/cs-unplugged
Added borders to the Results table and Console to match the colours of the Submit and Check button respectively
701,850
15.09.2021 15:36:38
-43,200
575b04502e02062f8539c6f3fc3f60ec3c564e2a
Fixed the programming challenge page in the topics application to display the new Block-based system
[ { "change_type": "MODIFY", "old_path": "csunplugged/templates/topics/programming-challenge.html", "new_path": "csunplugged/templates/topics/programming-challenge.html", "diff": "<!-- Case where there is more than one lesson doesn't exist and this page is going to be removed in the near future -->\n{% with lesson=lessons.first %}\n<p class=\"text-center\">\n- <a href=\"{% url 'plugging_it_in:programming_challenge' topic.slug lesson.slug programming_challenge.slug %}\" class=\"btn plugging-it-in-navigation\" target=\"_blank\" rel=\"nooperner noreferrer\">\n+ <a href=\"{% url 'plugging_it_in:programming_challenge' topic.slug lesson.slug programming_challenge.slug 'python' %}\" class=\"btn plugging-it-in-navigation\" target=\"_blank\" rel=\"nooperner noreferrer\">\n+ {% trans \"Try this challenge out in Plugging it in!\" %}\n+ </a>\n+ </p>\n+ {% endwith %}\n+ </div>\n+ {% elif implementation.language.name == 'Block-based' %}\n+ <div class=\"mt-3 pb-3\">\n+ <img id=\"plugging-it-in-logo-educators\" class=\"mx-auto d-block mb-3\" src=\"{% static 'img/cs-unplugged-logo-plugging-it-in.svg' %}\">\n+ <!-- Case where there is more than one lesson doesn't exist and this page is going to be removed in the near future -->\n+ {% with lesson=lessons.first %}\n+ <p class=\"text-center\">\n+ <a href=\"{% url 'plugging_it_in:programming_challenge' topic.slug lesson.slug programming_challenge.slug 'block-based' %}\" class=\"btn plugging-it-in-navigation\" target=\"_blank\" rel=\"nooperner noreferrer\">\n{% trans \"Try this challenge out in Plugging it in!\" %}\n</a>\n</p>\n{% endif %}\n{% endif %}\n+ {% if implementation.language.name != 'Block-based' %}\n<p class=\"text-center\">\n<a href=\"{% url 'topics:programming_challenge_solution' topic.slug programming_challenge.slug implementation.language.slug %}\">\n{% blocktrans with name=implementation.language.name %}\n</a>\n</p>\n{% endif %}\n+ {% endif %}\n</div>\n</details>\n{% endfor %}\n" } ]
Python
MIT License
uccser/cs-unplugged
Fixed the programming challenge page in the topics application to display the new Block-based system
701,850
15.09.2021 23:02:55
-43,200
6af27b30b041ebee75b5f97e39f794b2978c001f
Fixed the 'How does this page work?' button to work for the Block-based system. Also fixed failing style checks
[ { "change_type": "MODIFY", "old_path": "csunplugged/plugging_it_in/views.py", "new_path": "csunplugged/plugging_it_in/views.py", "diff": "@@ -65,6 +65,7 @@ class AboutView(generic.TemplateView):\ntemplate_name = \"plugging_it_in/about.html\"\n+\nclass BlockBasedAndScratchView(generic.TemplateView):\n\"\"\"View for the diferrences between the Block-based system and Scratch page that renders from a template.\"\"\"\n" }, { "change_type": "MODIFY", "old_path": "csunplugged/static/js/plugging-it-in-walkthrough.js", "new_path": "csunplugged/static/js/plugging-it-in-walkthrough.js", "diff": "@@ -3,6 +3,8 @@ const introJS = require('intro.js');\n$(document).ready(function () {\nvar intro = introJS();\n+\n+ if (programming_lang === 'python') {\nintro.setOptions({\nshowStepNumbers: false,\nsteps: [\n@@ -79,6 +81,90 @@ $(document).ready(function () {\nreturn style == undefined || !style.includes('display: none')\n})\n});\n+ } else {\n+ intro.setOptions({\n+ showStepNumbers: false,\n+ steps: [\n+ {\n+ element: \".programming__info-area-content\",\n+ intro: \"These are the requirements for the program you need to create - it describes what your program should do.\",\n+ step: 1,\n+ position: \"right\"\n+ },\n+ {\n+ element: \"#blocklyDiv\",\n+ intro: \"This is where you create your program to solve the challenge.\",\n+ step: 2\n+ },\n+ {\n+ element: \"#blockly_editor_run_program_button\",\n+ intro: \"Clicking the 'Run' button will run the program you have created without submitting it.\",\n+ step: 3\n+ },\n+ {\n+ element: \"#editor_check_button\",\n+ intro: \"Clicking the 'Submit' button will submit your program to see if it works correctly for our test cases.\",\n+ step: 4\n+ },\n+ {\n+ element: \"#test-case-table\",\n+ intro: \"These are the test cases that will be used to see if your program is working correctly.\",\n+ step: 5\n+ },\n+ {\n+ element: \"#test-case-table tbody tr:nth-child(1)\",\n+ intro: \"Here is the first test case.\",\n+ step: 6\n+ },\n+ {\n+ element: \"#test-case-table tbody tr:nth-child(1) td:nth-child(1)\",\n+ intro: \"This is the input that will be passed to your program for this particular test. \\\n+ If this is blank, it means no input will be passed to your program.\",\n+ step: 7\n+ },\n+ {\n+ element: \"#test-case-table tbody tr:nth-child(1) td:nth-child(2)\",\n+ intro: \"This is the output that the test expects your program to print for the given input.\",\n+ step: 8\n+ },\n+ {\n+ element: \"#test-case-table tbody tr:nth-child(1) td:nth-child(3)\",\n+ intro: \"This is where your program will print its output. This is compared against the expected output.\",\n+ step: 9\n+ },\n+ {\n+ element: \"#test-case-table tbody tr:nth-child(1) td:nth-child(4)\",\n+ intro: \"A test case will pass if the received output matches the expected output. If all test cases pass the question has been solved.\",\n+ step: 10\n+ },\n+ {\n+ element: \".block-based-console\",\n+ intro: \"This is where the output of your program will get displayed when you click the 'Run' button.\",\n+ step: 11,\n+ position: \"bottom\"\n+ },\n+ {\n+ element: \"#next_challenge_button button\",\n+ intro: \"Click this button when you are ready to move on to the next challenge.\",\n+ step: 12,\n+ position: \"top\"\n+ },\n+ {\n+ element: \"#lessons_nav_toggle\",\n+ intro: \"Click here to see the other challenges for this topic.\",\n+ step: 13\n+ },\n+ {\n+ element: \".navbar-brand\",\n+ intro: \"Click here to see the other topics available.\",\n+ step: 14\n+ },\n+ ].filter(function (obj) {\n+ style = $(obj.element).attr('style');\n+ return style == undefined || !style.includes('display: none')\n+ })\n+ });\n+ }\n$(\"#introjs-walkthrough\").click(function() {\nintro.start().onbeforechange(function() {\n" } ]
Python
MIT License
uccser/cs-unplugged
Fixed the 'How does this page work?' button to work for the Block-based system. Also fixed failing style checks
701,850
20.09.2021 15:46:33
-43,200
4fe003087b1c7baf5a64f2a1e3e098bccd83e0e8
Moved the 'How does this page work?' button underneath the Console
[ { "change_type": "MODIFY", "old_path": "csunplugged/templates/plugging_it_in/programming-challenge.html", "new_path": "csunplugged/templates/plugging_it_in/programming-challenge.html", "diff": "<div class=\"col-12 col-md-3 programming__results\">\n<p class=\"pii-block-heading d-inline\">{% trans \"Your submission results will be displayed here\" %}</p>\n{% include \"plugging_it_in/results-table.html\" %}\n- <div id=\"walkthrough-btn-container\" class=\"row\">\n- <button id=\"introjs-walkthrough\" class=\"btn btn-outline-secondary btn-sm col-6 offset-6 my-2\">{% trans \"How does this page work?\" %}</button>\n- </div>\n- <p class=\"pii-block-heading d-inline\">{% trans \"Run Output\" %}</p>\n+ <p class=\"pii-block-heading d-inline mt-3\">{% trans \"Run Output\" %}</p>\n<div class=\"block-based-console\">\n<div id=\"block-based-console-content\"></div>\n</div>\n+ <div id=\"walkthrough-btn-container\" class=\"row\">\n+ <button id=\"introjs-walkthrough\" class=\"btn btn-outline-secondary btn-sm col-6 offset-6 my-2\">{% trans \"How does this page work?\" %}</button>\n+ </div>\n</div>\n{% endif %}\n{% else %}\n" } ]
Python
MIT License
uccser/cs-unplugged
Moved the 'How does this page work?' button underneath the Console
701,850
26.09.2021 11:21:52
-43,200
89bfa0e20c4b13292d26ee65c2f10bea40f9cd7a
Fixed Python code generator for the Divide block where it returns a float number if the output is e.g., 13.0. This should return a 13 instead to match the test cases when the user's program is sent to the jobe server.
[ { "change_type": "MODIFY", "old_path": "csunplugged/static/js/custom-blockly-blocks.js", "new_path": "csunplugged/static/js/custom-blockly-blocks.js", "diff": "@@ -1365,7 +1365,11 @@ Blockly.JavaScript['operators_divide'] = function(block) {\nBlockly.Python['operators_divide'] = function(block) {\nvar value_x = Blockly.Python.valueToCode(block, 'x', Blockly.Python.ORDER_ATOMIC) || '0';\nvar value_y = Blockly.Python.valueToCode(block, 'y', Blockly.Python.ORDER_ATOMIC) || '0';\n- var code = value_x + ' / ' + value_y;\n+ var functionName = Blockly.Python.provideFunction_(\n+ 'divideNumber',\n+ ['def ' + Blockly.Python.FUNCTION_NAME_PLACEHOLDER_ + '(x, y):',\n+ ' return int(x/y) if (x/y).is_integer() else (x/y)']);\n+ var code = functionName + '(' + value_x + ', ' + value_y + ')';\nreturn [code, Blockly.Python.ORDER_NONE];\n};\n" } ]
Python
MIT License
uccser/cs-unplugged
Fixed Python code generator for the Divide block where it returns a float number if the output is e.g., 13.0. This should return a 13 instead to match the test cases when the user's program is sent to the jobe server.
701,850
26.09.2021 17:45:02
-46,800
f94b52c182086bda1ac9e0f8c7d617c5ba96da49
Made some minor UI changes Changed colour of the number when displayed in the Console Made colour of Run button greener on hover Add explanation on the How does this page work information saying that the colours displayed in the Console depends on the data types being displayed.
[ { "change_type": "MODIFY", "old_path": "csunplugged/static/js/plugging-it-in-walkthrough.js", "new_path": "csunplugged/static/js/plugging-it-in-walkthrough.js", "diff": "@@ -139,7 +139,7 @@ $(document).ready(function () {\n},\n{\nelement: \".block-based-console\",\n- intro: \"This is where the output of your program will get displayed when you click the 'Run' button.\",\n+ intro: \"This is where the output of your program will be displayed when you click the 'Run' button. Note: the console will display different colours depending on the data type that it is outputting (e.g., number = blue, boolean = purple, string = black.)\",\nstep: 11,\nposition: \"bottom\"\n},\n" }, { "change_type": "MODIFY", "old_path": "csunplugged/static/scss/programming-editor.scss", "new_path": "csunplugged/static/scss/programming-editor.scss", "diff": "@@ -245,7 +245,7 @@ body {\n}\n#blockly_editor_run_program_button:hover {\n- background-color: #4cbf56;\n+ background-color: #43b14c;\nborder: 2px solid #4ab750;\n}\n@@ -294,7 +294,7 @@ body {\n}\n.console-number {\n- color: #83c700;\n+ color: #1b7bffff;\n}\n}\n" } ]
Python
MIT License
uccser/cs-unplugged
Made some minor UI changes - Changed colour of the number when displayed in the Console - Made colour of Run button greener on hover - Add explanation on the How does this page work information saying that the colours displayed in the Console depends on the data types being displayed.
701,850
28.09.2021 13:12:17
-46,800
07cdda1a067d7c614464647cc2d7d47d70a3f7a3
Removed coloured borders of results table and the Console.
[ { "change_type": "MODIFY", "old_path": "csunplugged/static/scss/programming-editor.scss", "new_path": "csunplugged/static/scss/programming-editor.scss", "diff": "@@ -160,7 +160,7 @@ body {\npadding-right: 20px !important;\n.results-table {\n- border: 1px solid #1b7bffff;\n+ border: 1px solid gray;\nborder-radius: 15px;\nbackground-color: white;\nmax-height: 50%;\n@@ -177,7 +177,7 @@ body {\nflex-shrink: 1;\nmax-height: 50%;\nbackground-color: white;\n- border: 1px solid #4ab750;\n+ border: 1px solid gray;\nborder-radius: 15px;\nmin-height: 45px;\n" } ]
Python
MIT License
uccser/cs-unplugged
Removed coloured borders of results table and the Console.
701,850
16.10.2021 16:18:13
-46,800
05c91ebbca5a1728d297ccfcafd79b40bd2f1f63
Added an empty say block to the Looks category
[ { "change_type": "MODIFY", "old_path": "csunplugged/templates/plugging_it_in/block-based-toolbox.xml", "new_path": "csunplugged/templates/plugging_it_in/block-based-toolbox.xml", "diff": "<xml xmlns=\"https://developers.google.com/blockly/xml\" id=\"toolbox\" style=\"display: none\">\n<category name=\"Looks\" categorystyle=\"looks_category\">\n+ <block type=\"looks_say\"></block>\n<block type=\"looks_say\">\n<value name=\"value\">\n<block type=\"values_string\">\n" } ]
Python
MIT License
uccser/cs-unplugged
Added an empty say block to the Looks category
701,850
25.10.2021 23:32:51
-46,800
c7b5a364b2f333bec1db8728417da15c3b02807a
Added in-code documentation and remove print statements as well as unused code
[ { "change_type": "MODIFY", "old_path": "csunplugged/static/js/custom-blockly-blocks.js", "new_path": "csunplugged/static/js/custom-blockly-blocks.js", "diff": "-const VALUES_BLOCKS_COLOUR = '#4c97ff'\n-const LOOKS_BLOCKS_COLOUR = '#9966ff'\n-const CONTROL_BLOCKS_COLOUR = '#ffab19'\n-const SENSING_BLOCKS_COLOUR = '#5cb1d6'\n-const OPERATORS_BLOCKS_COLOUR = '#59c059'\n-\nfunction setupBlockly(Blockly) {\n-// Custom Blockly blocks to look and act like Scratch\n+// Custom block definitions that were created to look and act like Scratch blocks\nBlockly.defineBlocksWithJsonArray([\n// Values boolean block\n{\n@@ -723,24 +717,26 @@ Blockly.defineBlocksWithJsonArray([\n}\n]);\n-// Values boolean block\n+// JavaScript code generator for Values boolean block\nBlockly.JavaScript['values_boolean'] = function(block) {\nvar dropdown_value = block.getFieldValue('VALUE');\nvar code = (dropdown_value == 'TRUE') ? 'true' : 'false';\nreturn [code, Blockly.JavaScript.ORDER_ATOMIC];\n};\n+// Python code generator for Values boolean block\nBlockly.Python['values_boolean'] = function(block) {\nvar dropdown_value = block.getFieldValue('VALUE');\nvar code = (dropdown_value == 'TRUE') ? 'True' : 'False';\nreturn [code, Blockly.Python.ORDER_ATOMIC];\n};\n-// Values number block\n+// JavaScript code generator for Values number block\nBlockly.JavaScript['values_number'] = function(block) {\nvar code = Number(block.getFieldValue('NUM'));\nvar order = code >= 0 ? Blockly.JavaScript.ORDER_ATOMIC : Blockly.JavaScript.ORDER_UNARY_NEGATION;\nreturn [code, order];\n};\n+// Python code generator for Values number block\nBlockly.Python['values_number'] = function(block) {\nvar code = Number(block.getFieldValue('NUM'));\nvar order;\n@@ -757,29 +753,31 @@ Blockly.Python['values_number'] = function(block) {\nreturn [code, order];\n};\n-// Values string block\n+// JavaScript code generator for Values string block\nBlockly.JavaScript['values_string'] = function(block) {\nvar code = Blockly.JavaScript.quote_(block.getFieldValue('TEXT'));\nreturn [code, Blockly.JavaScript.ORDER_ATOMIC];\n};\n+// Python code generator for Values string block\nBlockly.Python['values_string'] = function(block) {\nvar code = Blockly.Python.quote_(block.getFieldValue('TEXT'));\nreturn [code, Blockly.Python.ORDER_ATOMIC];\n};\n-// Operators length of\n+// JavaScript code generator for Operators length of block\nBlockly.JavaScript['operators_length_of'] = function(block) {\n// String or array length.\nvar text = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_MEMBER) || '\\'\\'';\nreturn [text + '.length', Blockly.JavaScript.ORDER_MEMBER];\n};\n+// Python code generator for Operators length of block\nBlockly.Python['operators_length_of'] = function(block) {\n// Is the string null or array empty?\nvar text = Blockly.Python.valueToCode(block, 'VALUE', Blockly.Python.ORDER_NONE) || '\\'\\'';\nreturn ['len(' + text + ')', Blockly.Python.ORDER_FUNCTION_CALL];\n};\n-// Operators equality block\n+// JavaScript code generator for Operators equality block\nBlockly.JavaScript['operators_equality'] = function(block) {\nvar order = Blockly.JavaScript.ORDER_RELATIONAL;\nvar value_a = Blockly.JavaScript.valueToCode(block, 'A', order) || '0';\n@@ -791,6 +789,7 @@ Blockly.JavaScript['operators_equality'] = function(block) {\nvar code = value_a + ' == ' + value_b;\nreturn [code, order];\n};\n+// Python code generator for Operators equality block\nBlockly.Python['operators_equality'] = function(block) {\nvar order = Blockly.Python.ORDER_RELATIONAL;\nvar value_a = Blockly.Python.valueToCode(block, 'A', order) || '0';\n@@ -804,7 +803,7 @@ Blockly.Python['operators_equality'] = function(block) {\n};\n-// Operators less than block\n+// JavaScript code generator for Operators less than block\nBlockly.JavaScript['operators_less_than'] = function(block) {\nvar order = Blockly.JavaScript.ORDER_RELATIONAL;\nvar value_a = Blockly.JavaScript.valueToCode(block, 'A', order);\n@@ -816,6 +815,7 @@ Blockly.JavaScript['operators_less_than'] = function(block) {\nvar code = value_a + ' < ' + value_b;\nreturn [code, order];\n};\n+// Python code generator for Operators less than block\nBlockly.Python['operators_less_than'] = function(block) {\nvar order = Blockly.Python.ORDER_RELATIONAL;\nvar value_a = Blockly.Python.valueToCode(block, 'A', order);\n@@ -828,7 +828,7 @@ Blockly.Python['operators_less_than'] = function(block) {\nreturn [code, order];\n};\n-// Operators greater than block\n+// JavaScript code generator for Operators greater than block\nBlockly.JavaScript['operators_greater_than'] = function(block) {\nvar order = Blockly.JavaScript.ORDER_RELATIONAL;\nvar value_a = Blockly.JavaScript.valueToCode(block, 'A', order);\n@@ -840,6 +840,7 @@ Blockly.JavaScript['operators_greater_than'] = function(block) {\nvar code = value_a + ' > ' + value_b;\nreturn [code, order];\n};\n+// Python code generator for Operators greater than block\nBlockly.Python['operators_greater_than'] = function(block) {\nvar order = Blockly.Python.ORDER_RELATIONAL;\nvar value_a = Blockly.Python.valueToCode(block, 'A', order);\n@@ -852,7 +853,7 @@ Blockly.Python['operators_greater_than'] = function(block) {\nreturn [code, order];\n};\n-// Operators single operand block\n+// JavaScript code generator for Operators single operand block\nBlockly.JavaScript['operators_single'] = function(block) {\n// Math operators with single operand.\nvar operator = block.getFieldValue('OP');\n@@ -922,6 +923,7 @@ Blockly.JavaScript['operators_single'] = function(block) {\n}\nreturn [code, Blockly.JavaScript.ORDER_DIVISION];\n};\n+// Python code generator for Operators single operand block\nBlockly.Python['operators_single'] = function(block) {\n// Math operators with single operand.\nvar operator = block.getFieldValue('OP');\n@@ -995,19 +997,20 @@ Blockly.Python['operators_single'] = function(block) {\nreturn [code, Blockly.Python.ORDER_MULTIPLICATIVE];\n};\n-// Operators logical NOT block\n+// JavaScript code generator for Operators logical NOT block\nBlockly.JavaScript['operators_not'] = function(block) {\nvar value_argument = Blockly.JavaScript.valueToCode(block, 'argument', Blockly.JavaScript.ORDER_LOGICAL_NOT) || 'true';\nvar code = '!' + value_argument;\nreturn [code, Blockly.JavaScript.ORDER_LOGICAL_NOT];\n};\n+// Python code generator for Operators logical NOT block\nBlockly.Python['operators_not'] = function(block) {\nvar value_argument = Blockly.Python.valueToCode(block, 'argument', Blockly.Python.ORDER_LOGICAL_NOT) || 'True';\nvar code = 'not ' + value_argument;\nreturn [code, Blockly.Python.ORDER_LOGICAL_NOT];\n};\n-// Operators pick random int block\n+// JavaScript code generator for Operators pick random int block\nBlockly.JavaScript['operators_random_int'] = function(block) {\nvar value_a = Blockly.JavaScript.valueToCode(block, 'a', Blockly.JavaScript.ORDER_ATOMIC) || '0';\nvar value_b = Blockly.JavaScript.valueToCode(block, 'b', Blockly.JavaScript.ORDER_ATOMIC) || '0';\n@@ -1026,6 +1029,7 @@ Blockly.JavaScript['operators_random_int'] = function(block) {\nvar code = functionName + '(' + value_a + ', ' + value_b + ')';\nreturn [code, Blockly.JavaScript.ORDER_NONE];\n};\n+// Python code generator for Operators pick random int block\nBlockly.Python['operators_random_int'] = function(block) {\nBlockly.Python.definitions_['import_random'] = 'import random';\nvar value_a = Blockly.Python.valueToCode(block, 'a', Blockly.Python.ORDER_NONE) || '0';\n@@ -1034,13 +1038,14 @@ Blockly.Python['operators_random_int'] = function(block) {\nreturn [code, Blockly.Python.ORDER_FUNCTION_CALL];\n};\n-// Controls repeat until block\n+// JavaScript code generator for Controls repeat until block\nBlockly.JavaScript['controls_repeat_until'] = function(block) {\nvar value_condition = Blockly.JavaScript.valueToCode(block, 'condition', Blockly.JavaScript.ORDER_ATOMIC) || 'false';\nvar statements_body = Blockly.JavaScript.statementToCode(block, 'body');\nvar code = 'while (!' + value_condition + ') {\\n' + statements_body + '}\\n';\nreturn code;\n};\n+// Python code generator for Controls repeat until block\nBlockly.Python['controls_repeat_until'] = function(block) {\nvar value_condition = Blockly.Python.valueToCode(block, 'condition', Blockly.Python.ORDER_ATOMIC) || 'False';\nvar statements_body = Blockly.Python.statementToCode(block, 'body') || ' pass';\n@@ -1048,13 +1053,14 @@ Blockly.Python['controls_repeat_until'] = function(block) {\nreturn code;\n};\n-// Controls repeat block\n+// JavaScript code generator for Controls repeat block\nBlockly.JavaScript['controls_repeat_num_times'] = function(block) {\nvar value_num = Blockly.JavaScript.valueToCode(block, 'num', Blockly.JavaScript.ORDER_ATOMIC) || '0';\nvar statements_body = Blockly.JavaScript.statementToCode(block, 'body');\nvar code = 'for (var count = 0; count < ' + value_num + '; count++) {\\n' + statements_body + '}\\n';\nreturn code;\n};\n+// Python code generator for Controls repeat block\nBlockly.Python['controls_repeat_num_times'] = function(block) {\nvar value_num = Blockly.Python.valueToCode(block, 'num', Blockly.Python.ORDER_ATOMIC) || '0';\nvar statements_body = Blockly.Python.statementToCode(block, 'body') || ' pass';\n@@ -1063,7 +1069,7 @@ Blockly.Python['controls_repeat_num_times'] = function(block) {\nreturn code;\n};\n-// Controls, if, then, else block\n+// JavaScript code generator for Controls, if, then, else block\nBlockly.JavaScript['controls_if_then_else'] = function(block) {\nvar value_condition = Blockly.JavaScript.valueToCode(block, 'condition', Blockly.JavaScript.ORDER_ATOMIC) || 'false';\nvar statements_body_1 = Blockly.JavaScript.statementToCode(block, 'body_1');\n@@ -1071,6 +1077,7 @@ Blockly.JavaScript['controls_if_then_else'] = function(block) {\nvar code = 'if (' + value_condition + ') {\\n' + statements_body_1 + '} else {\\n' + statements_body_2 + '}\\n';\nreturn code;\n};\n+// Python code generator for Controls, if, then, else block\nBlockly.Python['controls_if_then_else'] = function(block) {\nvar value_condition = Blockly.Python.valueToCode(block, 'condition', Blockly.Python.ORDER_ATOMIC) || \"False\";\nvar statements_body_1 = Blockly.Python.statementToCode(block, 'body_1');\n@@ -1083,18 +1090,18 @@ Blockly.Python['controls_if_then_else'] = function(block) {\nstatements_body_2 = ' pass'; // 2 spaces for indentation in Python\n}\n- // TODO: Assemble Python into code variable.\nvar code = 'if ' + value_condition + ':\\n' + statements_body_1 + 'else:\\n' + statements_body_2 + '\\n';\nreturn code;\n};\n-// Controls if, then block\n+// JavaScript code generator for Controls if, then block\nBlockly.JavaScript['controls_if_then'] = function(block) {\nvar value_condition = Blockly.JavaScript.valueToCode(block, 'condition', Blockly.JavaScript.ORDER_ATOMIC) || 'false';\nvar statements_body = Blockly.JavaScript.statementToCode(block, 'body');\nvar code = 'if (' + value_condition + ') {\\n' + statements_body + '}\\n';\nreturn code;\n};\n+// Python code generator for Controls if, then block\nBlockly.Python['controls_if_then'] = function(block) {\nvar value_condition = Blockly.Python.valueToCode(block, 'condition', Blockly.Python.ORDER_ATOMIC) || \"False\";\nvar statements_body = Blockly.Python.statementToCode(block, 'body');\n@@ -1107,7 +1114,17 @@ Blockly.Python['controls_if_then'] = function(block) {\nreturn code;\n};\n-// Looks say block\n+\n+/**\n+ * JavaScript code generator for Looks say block\n+ *\n+ * This code generator was specifically created to handle how the output of the Say block is displayed\n+ * The JavaScript code returned by this function dynamically modifies the content of the console shell by\n+ * using document.querySelector() to get the console shell, and then adding the content to it.\n+ *\n+ * Therefore, if the ID of the console shell were to change,\n+ * then this function needs to be changed as well in order for it to work!\n+ */\nBlockly.JavaScript['looks_say'] = function(block) {\nvar value_value = Blockly.JavaScript.valueToCode(block, 'value', Blockly.JavaScript.ORDER_ATOMIC) || '\\'\\'';\nvar functionName = Blockly.JavaScript.provideFunction_(\n@@ -1134,31 +1151,34 @@ Blockly.JavaScript['looks_say'] = function(block) {\nvar code = get_value + get_value_type + 'document.querySelector(\"#block-based-console-content\").innerHTML += ' + innerHTML_value;\nreturn code;\n};\n+// Python code generator for Looks say block\nBlockly.Python['looks_say'] = function(block) {\nvar value_value = Blockly.Python.valueToCode(block, 'value', Blockly.Python.ORDER_ATOMIC) || '\\'\\'';\nvar code = 'print(' + value_value + ')\\n';\nreturn code;\n};\n-// Operators round up block\n+// JavaScript code generator for Operators round up block\nBlockly.JavaScript['operators_round'] = function(block) {\nvar value_a = Blockly.JavaScript.valueToCode(block, 'a', Blockly.JavaScript.ORDER_ATOMIC) || '0';\nvar code = 'Math.round(' + value_a + ')';\nreturn [code, Blockly.JavaScript.ORDER_NONE];\n};\n+// Python code generator for Operators round up block\nBlockly.Python['operators_round'] = function(block) {\nvar value_a = Blockly.Python.valueToCode(block, 'a', Blockly.Python.ORDER_ATOMIC) || '0';\nvar code = 'round(' + value_a + ')';\nreturn [code, Blockly.Python.ORDER_NONE];\n};\n-// Operators logical OR block\n+// JavaScript code generator for Operators logical OR block\nBlockly.JavaScript['operators_or'] = function(block) {\nvar value_a = Blockly.JavaScript.valueToCode(block, 'a', Blockly.JavaScript.ORDER_LOGICAL_OR) || 'false';\nvar value_b = Blockly.JavaScript.valueToCode(block, 'b', Blockly.JavaScript.ORDER_LOGICAL_OR) || 'false';\nvar code = value_a + ' || ' + value_b;\nreturn [code, Blockly.JavaScript.ORDER_LOGICAL_OR];\n};\n+// Python code generator for Operators logical OR block\nBlockly.Python['operators_or'] = function(block) {\nvar value_a = Blockly.Python.valueToCode(block, 'a', Blockly.Python.ORDER_ATOMIC) || 'False';\nvar value_b = Blockly.Python.valueToCode(block, 'b', Blockly.Python.ORDER_ATOMIC) || 'False';\n@@ -1167,13 +1187,14 @@ Blockly.Python['operators_or'] = function(block) {\n};\n-// Operators logical AND block\n+// JavaScript code generator for Operators logical AND block\nBlockly.JavaScript['operators_and'] = function(block) {\nvar value_a = Blockly.JavaScript.valueToCode(block, 'a', Blockly.JavaScript.ORDER_ATOMIC) || 'false';\nvar value_b = Blockly.JavaScript.valueToCode(block, 'b', Blockly.JavaScript.ORDER_ATOMIC) || 'false';\nvar code = value_a + ' && ' + value_b;\nreturn [code, Blockly.JavaScript.ORDER_NONE];\n};\n+// Python code generator for Operators logical AND block\nBlockly.Python['operators_and'] = function(block) {\nvar value_a = Blockly.Python.valueToCode(block, 'a', Blockly.Python.ORDER_ATOMIC) || 'False';\nvar value_b = Blockly.Python.valueToCode(block, 'b', Blockly.Python.ORDER_ATOMIC) || 'False';\n@@ -1181,17 +1202,18 @@ Blockly.Python['operators_and'] = function(block) {\nreturn [code, Blockly.Python.ORDER_NONE];\n};\n-// Controls stop block\n+// JavaScript code generator for Controls stop block\nBlockly.JavaScript['controls_stop'] = function(block) {\nvar code = 'break;\\n';\nreturn code;\n};\n+// Python code generator for Controls stop block\nBlockly.Python['controls_stop'] = function(block) {\nvar code = 'break\\n';\nreturn code;\n};\n-// Sensing ask and wait number block\n+// JavaScript code generator for Sensing ask and wait number block\nBlockly.JavaScript['sensing_ask_and_wait_number'] = function(block) {\nif (block.getField('question')) {\n// Internal message.\n@@ -1203,6 +1225,7 @@ Blockly.JavaScript['sensing_ask_and_wait_number'] = function(block) {\nvar code = 'Number(window.prompt(' + msg + '))';\nreturn [code, Blockly.JavaScript.ORDER_FUNCTION_CALL];\n};\n+// Python code generator for Sensing ask and wait number block\nBlockly.Python['sensing_ask_and_wait_number'] = function(block) {\nvar functionName = Blockly.Python.provideFunction_(\n'text_prompt',\n@@ -1228,7 +1251,7 @@ Blockly.Python['sensing_ask_and_wait_number'] = function(block) {\nreturn [code, Blockly.Python.ORDER_FUNCTION_CALL];\n};\n-// Sensing ask and wait text block\n+// JavaScript code generator for Sensing ask and wait text block\nBlockly.JavaScript['sensing_ask_and_wait_text'] = function(block) {\nif (block.getField('question')) {\n// Internal message.\n@@ -1240,6 +1263,7 @@ Blockly.JavaScript['sensing_ask_and_wait_text'] = function(block) {\nvar code = 'window.prompt(' + msg + ')';\nreturn [code, Blockly.JavaScript.ORDER_FUNCTION_CALL];\n};\n+// Python code generator for Sensing ask and wait text block\nBlockly.Python['sensing_ask_and_wait_text'] = function(block) {\nvar functionName = Blockly.Python.provideFunction_(\n'text_prompt',\n@@ -1261,13 +1285,14 @@ Blockly.Python['sensing_ask_and_wait_text'] = function(block) {\nreturn [code, Blockly.Python.ORDER_FUNCTION_CALL];\n};\n-// Operators <string> contains <substring> block\n+// JavaScript code generator for Operators <string> contains <substring> block\nBlockly.JavaScript['operators_string_contains'] = function(block) {\nvar value_word = Blockly.JavaScript.valueToCode(block, 'word', Blockly.JavaScript.ORDER_ATOMIC) || '\\'\\'';\nvar value_subword = Blockly.JavaScript.valueToCode(block, 'subword', Blockly.JavaScript.ORDER_ATOMIC) || '\\'\\'';\nvar code = value_word + \".includes(\" + value_subword + \")\";\nreturn [code, Blockly.JavaScript.ORDER_NONE];\n};\n+// Python code generator for Operators <string> contains <substring> block\nBlockly.Python['operators_string_contains'] = function(block) {\nvar value_word = Blockly.Python.valueToCode(block, 'word', Blockly.Python.ORDER_ATOMIC) || '\\'\\'';\nvar value_subword = Blockly.Python.valueToCode(block, 'subword', Blockly.Python.ORDER_ATOMIC) || '\\'\\'';\n@@ -1275,7 +1300,7 @@ Blockly.Python['operators_string_contains'] = function(block) {\nreturn [code, Blockly.Python.ORDER_NONE];\n};\n-// Operators letter <num> of <string> block\n+// JavaScript code generator for Operators letter <num> of <string> block\nBlockly.JavaScript['operators_letter_of'] = function(block) {\nvar value_index = Blockly.JavaScript.valueToCode(block, 'index', Blockly.JavaScript.ORDER_ATOMIC);\nvar value_word = Blockly.JavaScript.valueToCode(block, 'word', Blockly.JavaScript.ORDER_ATOMIC) || '\\'\\'';\n@@ -1290,6 +1315,7 @@ Blockly.JavaScript['operators_letter_of'] = function(block) {\nvar code = value_word + \".charAt(\" + value_index + \")\";\nreturn [code, Blockly.JavaScript.ORDER_NONE];\n};\n+// Python code generator for Operators letter <num> of <string> block\nBlockly.Python['operators_letter_of'] = function(block) {\nvar value_index = Blockly.Python.valueToCode(block, 'index', Blockly.Python.ORDER_ATOMIC);\nvar value_word = Blockly.Python.valueToCode(block, 'word', Blockly.Python.ORDER_ATOMIC) || '\\'\\'';\n@@ -1305,13 +1331,14 @@ Blockly.Python['operators_letter_of'] = function(block) {\nreturn [code, Blockly.Python.ORDER_NONE];\n};\n-// Operators join/concatenate string block\n+// JavaScript code generator for Operators join/concatenate string block\nBlockly.JavaScript['operators_join_string'] = function(block) {\nvar value_a = Blockly.JavaScript.valueToCode(block, 'a', Blockly.JavaScript.ORDER_ATOMIC) || '\\'\\'';\nvar value_b = Blockly.JavaScript.valueToCode(block, 'b', Blockly.JavaScript.ORDER_ATOMIC) || '\\'\\'';\nvar code = value_a + ' + ' + value_b;\nreturn [code, Blockly.JavaScript.ORDER_NONE];\n};\n+// Python code generator for Operators join/concatenate string block\nBlockly.Python['operators_join_string'] = function(block) {\nvar value_a = Blockly.Python.valueToCode(block, 'a', Blockly.Python.ORDER_ATOMIC) || '\\'\\'';\nvar value_b = Blockly.Python.valueToCode(block, 'b', Blockly.Python.ORDER_ATOMIC) || '\\'\\'';\n@@ -1319,7 +1346,7 @@ Blockly.Python['operators_join_string'] = function(block) {\nreturn [code, Blockly.Python.ORDER_NONE];\n};\n-// Operators modulo block\n+// JavaScript code generator for Operators modulo block\nBlockly.JavaScript['operators_modulo'] = function(block) {\nvar value_a = Blockly.JavaScript.valueToCode(block, 'a', Blockly.JavaScript.ORDER_MODULUS);\nvar value_n = Blockly.JavaScript.valueToCode(block, 'n', Blockly.JavaScript.ORDER_MODULUS);\n@@ -1330,6 +1357,7 @@ Blockly.JavaScript['operators_modulo'] = function(block) {\nvar code = '(' + value_a + ' % ' + value_n + ' + ' + value_n + ')' + ' % ' + value_n;\nreturn [code, Blockly.JavaScript.ORDER_ADDITION];\n};\n+// Python code generator for Operators modulo block\nBlockly.Python['operators_modulo'] = function(block) {\nvar value_a = Blockly.Python.valueToCode(block, 'a', Blockly.Python.ORDER_ATOMIC);\nvar value_n = Blockly.Python.valueToCode(block, 'n', Blockly.Python.ORDER_ATOMIC);\n@@ -1341,13 +1369,14 @@ Blockly.Python['operators_modulo'] = function(block) {\nreturn [code, Blockly.Python.ORDER_NONE];\n};\n-// Operators multiply block\n+// JavaScript code generator for Operators multiply block\nBlockly.JavaScript['operators_multiply'] = function(block) {\nvar value_x = Blockly.JavaScript.valueToCode(block, 'x', Blockly.JavaScript.ORDER_MULTIPLICATION) || '0';\nvar value_y = Blockly.JavaScript.valueToCode(block, 'y', Blockly.JavaScript.ORDER_MULTIPLICATION) || '0';\nvar code = value_x + ' * ' + value_y;\nreturn [code, Blockly.JavaScript.ORDER_NONE];\n};\n+// Python code generator for Operators multiply block\nBlockly.Python['operators_multiply'] = function(block) {\nvar value_x = Blockly.Python.valueToCode(block, 'x', Blockly.Python.ORDER_ATOMIC) || '0';\nvar value_y = Blockly.Python.valueToCode(block, 'y', Blockly.Python.ORDER_ATOMIC) || '0';\n@@ -1355,13 +1384,14 @@ Blockly.Python['operators_multiply'] = function(block) {\nreturn [code, Blockly.Python.ORDER_NONE];\n};\n-// Operators divide block\n+// JavaScript code generator for Operators divide block\nBlockly.JavaScript['operators_divide'] = function(block) {\nvar value_x = Blockly.JavaScript.valueToCode(block, 'x', Blockly.JavaScript.ORDER_ATOMIC) || '0';\nvar value_y = Blockly.JavaScript.valueToCode(block, 'y', Blockly.JavaScript.ORDER_ATOMIC) || '0';\nvar code = value_x + ' / ' + value_y;\nreturn [code, Blockly.JavaScript.ORDER_NONE];\n};\n+// Python code generator for Operators divide block\nBlockly.Python['operators_divide'] = function(block) {\nvar value_x = Blockly.Python.valueToCode(block, 'x', Blockly.Python.ORDER_ATOMIC) || '0';\nvar value_y = Blockly.Python.valueToCode(block, 'y', Blockly.Python.ORDER_ATOMIC) || '0';\n@@ -1373,13 +1403,14 @@ Blockly.Python['operators_divide'] = function(block) {\nreturn [code, Blockly.Python.ORDER_NONE];\n};\n-// Operators add block\n+// JavaScript code generator for Operators add block\nBlockly.JavaScript['operators_add'] = function(block) {\nvar value_x = Blockly.JavaScript.valueToCode(block, 'x', Blockly.JavaScript.ORDER_ATOMIC) || '0';\nvar value_y = Blockly.JavaScript.valueToCode(block, 'y', Blockly.JavaScript.ORDER_ATOMIC) || '0';\nvar code = value_x + ' + ' + value_y;\nreturn [code, Blockly.JavaScript.ORDER_NONE];\n};\n+// Python code generator for Operators add block\nBlockly.Python['operators_add'] = function(block) {\nvar value_x = Blockly.Python.valueToCode(block, 'x', Blockly.Python.ORDER_ATOMIC) || '0';\nvar value_y = Blockly.Python.valueToCode(block, 'y', Blockly.Python.ORDER_ATOMIC) || '0';\n@@ -1387,13 +1418,14 @@ Blockly.Python['operators_add'] = function(block) {\nreturn [code, Blockly.Python.ORDER_NONE];\n};\n-// Operators subtract blocks\n+// JavaScript code generator for Operators subtract blocks\nBlockly.JavaScript['operators_subtract'] = function(block) {\nvar value_x = Blockly.JavaScript.valueToCode(block, 'x', Blockly.JavaScript.ORDER_ATOMIC) || '0';\nvar value_y = Blockly.JavaScript.valueToCode(block, 'y', Blockly.JavaScript.ORDER_ATOMIC) || '0';\nvar code = value_x + ' - ' + value_y;\nreturn [code, Blockly.JavaScript.ORDER_NONE];\n};\n+// Python code generator for Operators subtract blocks\nBlockly.Python['operators_subtract'] = function(block) {\nvar value_x = Blockly.Python.valueToCode(block, 'x', Blockly.Python.ORDER_ATOMIC) || '0';\nvar value_y = Blockly.Python.valueToCode(block, 'y', Blockly.Python.ORDER_ATOMIC) || '0';\n" }, { "change_type": "MODIFY", "old_path": "csunplugged/static/js/jobe-editor.js", "new_path": "csunplugged/static/js/jobe-editor.js", "diff": "// Scripts used to manage the UI functionality for the programming challenge editor screen.\n-\nconst codeTester = require(\"./test-code.js\");\nconst editorUtils = require(\"./editor-options-menu.js\");\nconst utils = require(\"./utils.js\");\n@@ -14,11 +13,15 @@ const setupBlockly = require(\"./custom-blockly-blocks.js\");\nrequire('blockly/python');\n-// Has to be global as other functions are using these variables\n+// Has to be global as other functions use these variables\nvar myCodeMirror;\nvar workspace;\n-// Set up code mirror or blockly editor depending what programming_lang is from URL (/python or /block-based)\n+\n+// Sets up code mirror or blockly editor depending what the value of programming_lang\n+// is from the end of the URL (/python or /block-based)\n+// If the end of the URL is /python then displayed the Python editor, else display the Blockly editor\nif (programming_lang == \"python\") {\n+ // Set up Python editor\nlet myTextarea = document.getElementById(\"codemirror_editor\");\nmyCodeMirror = CodeMirror.fromTextArea(myTextarea, {\nmode: {\n@@ -41,56 +44,11 @@ if (programming_lang == \"python\") {\n});\n} else {\n- // Set up blockly editor\n+ // Set up block-based editor\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n- // Set the math_change block to contain the values_number block by default.\n- Blockly.Variables.flyoutCategoryBlocks = function(workspace) {\n- var variableModelList = workspace.getVariablesOfType('');\n-\n- var xmlList = [];\n- if (variableModelList.length > 0) {\n- // New variables are added to the end of the variableModelList.\n- var mostRecentVariable = variableModelList[variableModelList.length - 1];\n- if (Blockly.Blocks['variables_set']) {\n- var block = Blockly.utils.xml.createElement('block');\n- block.setAttribute('type', 'variables_set');\n- block.setAttribute('gap', Blockly.Blocks['math_change'] ? 8 : 24);\n- block.appendChild(\n- Blockly.Variables.generateVariableFieldDom(mostRecentVariable));\n- xmlList.push(block);\n- }\n- if (Blockly.Blocks['math_change']) {\n- var block = Blockly.utils.xml.createElement('block');\n- block.setAttribute('type', 'math_change');\n- block.setAttribute('gap', Blockly.Blocks['variables_get'] ? 20 : 8);\n- block.appendChild(\n- Blockly.Variables.generateVariableFieldDom(mostRecentVariable));\n- var value = Blockly.Xml.textToDom(\n- '<value name=\"DELTA\">' +\n- '<block type=\"values_number\">' +\n- '<field name=\"NUM\">1</field>' +\n- '</block>' +\n- '</value>');\n- block.appendChild(value);\n- xmlList.push(block);\n- }\n-\n- if (Blockly.Blocks['variables_get']) {\n- variableModelList.sort(Blockly.VariableModel.compareByName);\n- for (var i = 0, variable; (variable = variableModelList[i]); i++) {\n- var block = Blockly.utils.xml.createElement('block');\n- block.setAttribute('type', 'variables_get');\n- block.setAttribute('gap', 8);\n- block.appendChild(Blockly.Variables.generateVariableFieldDom(variable));\n- xmlList.push(block);\n- }\n- }\n- }\n- return xmlList;\n- };\n-\n- // Custom Blockly Theme\n+ // Creates the theme that will be set to the Blockly editor\n+ // The colours were chosen to make the custom blocks visually look like Scratch\nvar blocklyTheme = Blockly.Theme.defineTheme('block-based-scratch', {\n\"base\": Blockly.Theme.Classic,\n\"blockStyles\": {\n@@ -155,7 +113,8 @@ if (programming_lang == \"python\") {\nsetupBlockly(Blockly);\nvar toolbox = document.getElementById('toolbox');\n- /* Workspace configurations */\n+\n+ // Defines the configuration for the Blockly's workspace (area where blocks are dropped)\nvar options = {\ntheme: blocklyTheme,\nrenderer: 'zelos',\n@@ -181,37 +140,41 @@ if (programming_lang == \"python\") {\nscaleSpeed : 1.2\n}\n};\n- /* Injects the blockly workspace */\n+\n+ // Injects the Blockly workspace\nworkspace = Blockly.inject('blocklyDiv', options);\n- // Displays the user's previous block-based submission\n+ // If the user has previously submitted their program, then display it\nif (previous_block_based_submission) {\n- // Decodes the previous_block_based_submission which contains HTML entities. Outputs a string, and it converts it to XML\n+ // Decodes the previous_block_based_submission as it contains unwanted HTML entities\n+ // The decoded string is then converted into XML\nvar xml_node = Blockly.Xml.textToDom(utils.decodeHTMLEntities(previous_block_based_submission));\n+ // Outputs the XML to the workspace\nBlockly.Xml.domToWorkspace(xml_node, workspace);\n}\n})\n}\n/**\n- * Retrieves code from the code mirror editor, runs all the test cases then updates the results table.\n+ * Retrieves code from the code mirror and the Blockly workspace, runs all the test cases then updates the results table.\n* Disables the \"CHECK\" button and shows a loading spinner while request is being processed.\n*/\nfunction sendCodeToJobe() {\nvar code = '';\n+\n+ // If the programming_lang is Python, then get the code in the code mirror editor,\n+ // else get the block-based program in the Blockly workspace\nif (programming_lang == 'python') {\n// Replaces all user input parameters to be blank so it matches the expected output\n// Takes into consideration cases input(\"thing)\"), input('thing)'), input(thing) and int(input(thing))\ncode = myCodeMirror.getValue().replace(/(input\\(\"[^\"]+\"\\)|input\\('[^']+'\\)|input\\([^)]+\\))/mg, 'input()');\n} else {\n- // converts Blockly-code to Python\n+ // Uses the Python code generators to convert blocks into Python code\nconst lang = 'Python';\ncode = Blockly[lang].workspaceToCode(workspace);\n}\n- console.log(\"SEND CODE TO JOBE\")\n- console.log(code)\n$(\"#editor_check_button\").prop(\"disabled\", true);\n$(\".code_running_spinner\").css(\"display\", \"inline-block\");\n@@ -248,12 +211,16 @@ function allCorrect(results) {\n*/\nasync function save_code(status=\"started\") {\nvar raw_code;\n+\n+ // If the programming_lang is Python, then get the code in the code mirror editor,\n+ // else get the block-based program in the Blockly workspace\nif (programming_lang == \"python\") {\nraw_code = myCodeMirror.getValue();\n} else {\nxml_code = Blockly.Xml.workspaceToDom(Blockly.getMainWorkspace());\nraw_code = Blockly.Xml.domToText(xml_code);\n}\n+\n// Sets the saved attempt\nlet data = {\n\"challenge\": current_challenge_slug,\n@@ -282,7 +249,6 @@ async function save_code(status=\"started\") {\n*/\nfunction updateResultsTable(results) {\nfor (result of results) {\n- console.log(result)\n// Update status cell\n$(`#test-case-${result.id}-status`).text(result.status);\n@@ -340,18 +306,17 @@ function downloadCode() {\n}\n/**\n- * Retrieves the code from the blockly editor, converts it to JavaScript, runs the code.\n+ * Retrieves the code from the Blockly editor, uses the JavaScript code generator\n+ * to converts it to JavaScript and executes the code in the browser.\n*/\nfunction runCode() {\n- // Convert blockly code to JavaScript\n+ // Convert block-based program into JavaScript\nconst lang = 'JavaScript';\nconst code = Blockly[lang].workspaceToCode(workspace);\n- console.log(code);\n-\n- // Run JavaScript code\n+ // Executes JavaScript code in the browser\ntry {\n- // Refresh the Output box\n+ // Refresh the Command Shell output box\ndocument.querySelector(\"#block-based-console-content\").innerHTML = \"\"\neval(code);\n} catch (error) {\n" }, { "change_type": "MODIFY", "old_path": "csunplugged/static/js/utils.js", "new_path": "csunplugged/static/js/utils.js", "diff": "/**\n-* Takes an encoded HTML entitity and returns a decoded version of it.\n-* @param {string} str\n+* Takes an encoded HTML entitity and returns the decoded version of it.\n+* @param {string} str an encoded HTML entity\n* @returns decoded HTML entity\n*/\nfunction decodeHTMLEntities (str) {\n" }, { "change_type": "MODIFY", "old_path": "csunplugged/templates/plugging_it_in/programming-challenge.html", "new_path": "csunplugged/templates/plugging_it_in/programming-challenge.html", "diff": "<div class=\"col-12 col-md-5 programming__editor\">\n<p class='pii-block-heading'>{% trans \"Create your program in the editor below\" %}</p>\n<div id=\"blocklyDiv\" style=\"height: 100%; \"></div>\n+ <!-- Displays all the custom blocks and categories in the Blockly workspace -->\n{% include \"plugging_it_in/block-based-toolbox.xml\" %}\n<div class=\"programming__submit d-flex justify-content-between align-items-center\">\n<div class=\"programming__submit_options d-flex justify-content-start\">\n" } ]
Python
MIT License
uccser/cs-unplugged
Added in-code documentation and remove print statements as well as unused code
701,850
26.10.2021 11:22:36
-46,800
386bab929121bfa2797535aecf8f23adb28a60fb
Fixed bug when end of URL is not /python or /block-based. Now returns 404 error if language is not of the two
[ { "change_type": "MODIFY", "old_path": "csunplugged/plugging_it_in/views.py", "new_path": "csunplugged/plugging_it_in/views.py", "diff": "@@ -147,11 +147,12 @@ class ProgrammingChallengeView(generic.DetailView):\nlesson = Lesson.objects.get(slug=lesson_slug)\ncontext[\"lesson\"] = lesson\n- # Get Python challenges if language_slug == 'python' else get Block-based challanges\n- if (language_slug == \"python\"):\n- challlenges = lesson.retrieve_related_programming_challenges(\"Python\")\n+ # Get Python or block-based challenges depending on the language_slug\n+ # else raise a 404 error\n+ if (language_slug in [\"python\", \"block-based\"]):\n+ challlenges = lesson.retrieve_related_programming_challenges(language_slug.capitalize())\nelse:\n- challlenges = lesson.retrieve_related_programming_challenges(\"Block-based\")\n+ raise Http404(\"Language does not exist\")\ncontext[\"programming_challenges\"] = challlenges\ncontext[\"programming_exercises_json\"] = json.dumps(list(challlenges.values()))\n@@ -170,8 +171,10 @@ class ProgrammingChallengeView(generic.DetailView):\nlang = context[\"programming_lang\"]\nif language_slug == \"python\":\ncontext[\"previous_text_based_submission\"] = context[\"saved_attempts\"][self.object.slug][lang][\"code\"]\n- else:\n+ elif language_slug == \"block-based\":\ncontext[\"previous_block_based_submission\"] = context[\"saved_attempts\"][self.object.slug][lang][\"code\"]\n+ else:\n+ return Http404(\"Language does not exist\")\nexcept KeyError:\ncontext[\"previous_text_based_submission\"] = ''\ncontext[\"previous_block_based_submission\"] = ''\n" } ]
Python
MIT License
uccser/cs-unplugged
Fixed bug when end of URL is not /python or /block-based. Now returns 404 error if language is not of the two
701,850
26.10.2021 11:23:38
-46,800
99d841c23915feedf4612ef13c431a302e6cb166
Add tests for the new block-based system
[ { "change_type": "ADD", "old_path": null, "new_path": "csunplugged/tests/plugging_it_in/urls/test_block_based_vs_scratch.py", "diff": "+from http import HTTPStatus\n+from tests.BaseTestWithDB import BaseTestWithDB\n+from django.urls import reverse\n+\n+\n+class AboutURLTest(BaseTestWithDB):\n+\n+ def __init__(self, *args, **kwargs):\n+ super().__init__(*args, **kwargs)\n+ self.language = \"en\"\n+\n+ def test_valid_about(self):\n+ url = reverse(\"plugging_it_in:block_based_vs_scratch\")\n+ self.assertEqual(url, \"/en/plugging-it-in/block-based-vs-scratch/\")\n+\n+ response = self.client.get(url)\n+ self.assertEqual(HTTPStatus.OK, response.status_code)\n" }, { "change_type": "MODIFY", "old_path": "csunplugged/tests/plugging_it_in/urls/test_programming_challenge.py", "new_path": "csunplugged/tests/plugging_it_in/urls/test_programming_challenge.py", "diff": "@@ -8,7 +8,7 @@ class ProgrammingChallengeURLTest(BaseTestWithDB):\nsuper().__init__(*args, **kwargs)\nself.language = \"en\"\n- def test_valid_programming_challenge(self):\n+ def test_valid_python_programming_challenge(self):\nkwargs = {\n\"topic_slug\": \"binary-numbers\",\n\"lesson_slug\": \"lesson-1\",\n@@ -17,3 +17,13 @@ class ProgrammingChallengeURLTest(BaseTestWithDB):\n}\nurl = reverse(\"plugging_it_in:programming_challenge\", kwargs=kwargs)\nself.assertEqual(url, \"/en/plugging-it-in/binary-numbers/lesson-1/challenge-1/python/\")\n+\n+ def test_valid_block_based_programming_challenge(self):\n+ kwargs = {\n+ \"topic_slug\": \"binary-numbers\",\n+ \"lesson_slug\": \"lesson-1\",\n+ \"challenge_slug\": \"challenge-1\",\n+ \"language_slug\": \"block-based\"\n+ }\n+ url = reverse(\"plugging_it_in:programming_challenge\", kwargs=kwargs)\n+ self.assertEqual(url, \"/en/plugging-it-in/binary-numbers/lesson-1/challenge-1/block-based/\")\n" }, { "change_type": "RENAME", "old_path": "csunplugged/tests/plugging_it_in/urls/test_programming_challenge_list copy.py", "new_path": "csunplugged/tests/plugging_it_in/urls/test_programming_challenge_list.py", "diff": "" }, { "change_type": "ADD", "old_path": null, "new_path": "csunplugged/tests/plugging_it_in/views/test_block_based_vs_scratch_view.py", "diff": "+from tests.BaseTestWithDB import BaseTestWithDB\n+from django.urls import reverse\n+from http import HTTPStatus\n+\n+\n+class AboutViewTest(BaseTestWithDB):\n+\n+ def __init__(self, *args, **kwargs):\n+ super().__init__(*args, **kwargs)\n+ self.language = \"en\"\n+\n+ def test_about_view(self):\n+ response = self.client.get(reverse(\"plugging_it_in:block_based_vs_scratch\"))\n+ self.assertEqual(HTTPStatus.OK, response.status_code)\n+ self.assertContains(response, \"Block-based System vs Scratch\")\n" }, { "change_type": "MODIFY", "old_path": "csunplugged/tests/plugging_it_in/views/test_programming_challenge_view.py", "new_path": "csunplugged/tests/plugging_it_in/views/test_programming_challenge_view.py", "diff": "@@ -72,6 +72,18 @@ class ProgrammingChallengeViewTest(BaseTestWithDB):\nresponse = self.client.get(url)\nself.assertEqual(HTTPStatus.NOT_FOUND, response.status_code)\n+ def test_programming_challenge_view_with_invalid_language_slug(self):\n+ self.create_challenge()\n+ kwargs = {\n+ \"topic_slug\": self.topic.slug,\n+ \"lesson_slug\": self.lesson.slug,\n+ \"challenge_slug\": self.challenge.slug,\n+ \"language_slug\": \"wrong_slug\",\n+ }\n+ url = reverse(\"plugging_it_in:programming_challenge\", kwargs=kwargs)\n+ response = self.client.get(url)\n+ self.assertEqual(HTTPStatus.NOT_FOUND, response.status_code)\n+\ndef test_programming_challenge_view_with_invalid_challenge_slug(self):\nself.create_challenge()\nkwargs = {\n" }, { "change_type": "MODIFY", "old_path": "csunplugged/tests/plugging_it_in/views/test_save_attempt_view.py", "new_path": "csunplugged/tests/plugging_it_in/views/test_save_attempt_view.py", "diff": "@@ -51,7 +51,8 @@ class SaveAttemptViewTest(BaseTestWithDB):\nnew_attempt = {\n\"challenge\": \"\",\n\"attempt\": \"\",\n- \"status\": \"\"\n+ \"status\": \"\",\n+ \"programming_language\": \"python\"\n}\nurl = reverse(\"plugging_it_in:save_attempt\")\n@@ -66,7 +67,8 @@ class SaveAttemptViewTest(BaseTestWithDB):\nnew_attempt = {\n\"challenge\": \"\",\n\"attempt\": \"\",\n- \"status\": \"\"\n+ \"status\": \"\",\n+ \"programming_language\": \"python\",\n}\nurl = reverse(\"plugging_it_in:save_attempt\")\n" } ]
Python
MIT License
uccser/cs-unplugged
Add tests for the new block-based system
701,850
26.10.2021 11:41:49
-46,800
48f7461f812eaf8ebe9f0b3f5e8253db6880e66b
Added test for programming language context passed to the template
[ { "change_type": "MODIFY", "old_path": "csunplugged/tests/plugging_it_in/views/test_programming_challenge_view.py", "new_path": "csunplugged/tests/plugging_it_in/views/test_programming_challenge_view.py", "diff": "@@ -315,3 +315,18 @@ class ProgrammingChallengeViewTest(BaseTestWithDB):\nresponse.context[\"saved_attempts\"],\n{\"test_session\": \"testing\"}\n)\n+\n+ def test_programming_challenge_view_programming_lang_context(self):\n+ self.create_challenge()\n+ kwargs = {\n+ \"topic_slug\": self.topic.slug,\n+ \"lesson_slug\": self.lesson.slug,\n+ \"challenge_slug\": self.challenge.slug,\n+ \"language_slug\": \"python\",\n+ }\n+ url = reverse(\"plugging_it_in:programming_challenge\", kwargs=kwargs)\n+ response = self.client.get(url)\n+ self.assertEqual(\n+ response.context[\"programming_lang\"],\n+ \"python\"\n+ )\n" } ]
Python
MIT License
uccser/cs-unplugged
Added test for programming language context passed to the template
701,850
28.10.2021 22:33:06
-46,800
d2348188cc95883459c55809b13c6a7c758c7d11
Added missing tooltip to blocks
[ { "change_type": "MODIFY", "old_path": "csunplugged/static/js/custom-blockly-blocks.js", "new_path": "csunplugged/static/js/custom-blockly-blocks.js", "diff": "@@ -619,7 +619,7 @@ Blockly.defineBlocksWithJsonArray([\n\"previousStatement\": null,\n\"nextStatement\": null,\n\"style\": \"control_blocks\",\n- \"tooltip\": \"\",\n+ \"tooltip\": \"If value is true, then do some statements.\",\n\"helpUrl\": \"\"\n},\n// Controls, if, then, else block\n@@ -650,7 +650,7 @@ Blockly.defineBlocksWithJsonArray([\n\"previousStatement\": null,\n\"nextStatement\": null,\n\"style\": \"control_blocks\",\n- \"tooltip\": \"\",\n+ \"tooltip\": \"If value is true, then do the first set of statements, else do the second set of statements\",\n\"helpUrl\": \"\"\n},\n// Controls stop block\n" } ]
Python
MIT License
uccser/cs-unplugged
Added missing tooltip to blocks
332,109
02.01.2017 14:39:51
-19,080
5e21aefb345d77a8a0a1c88111659e605fce4f38
refs Added pagination option when fetching branches of a repository.
[ { "change_type": "MODIFY", "old_path": "app/models/commits_fetcher.rb", "new_path": "app/models/commits_fetcher.rb", "diff": "@@ -9,7 +9,7 @@ class CommitsFetcher\nend\ndef fetch(type = :daily)\n- user.gh_client.repos.branches(user: repo.owner, repo: repo.name).each do |branch|\n+ user.gh_client.repos.branches(repo.owner, repo.name, {auto_pagination: true}).each do |branch|\n# Refer to issue https://rollbar.com/JoshSoftware/CodeCuriosity/items/8/\n# This is a quick fix where we ignore branches / repos that have moved.\n# This is related to https://github.com/piotrmurach/github/pull/258 and\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
refs #236 Added pagination option when fetching branches of a repository.
332,109
16.01.2017 12:24:02
-19,080
3a8419f235095dd656891208c530951287a09c5e
Updated Commit#info Request the commit info from Github only if the commit's repo is present. We delete the repository in Jobs if the repo is not found.
[ { "change_type": "MODIFY", "old_path": "app/models/commit.rb", "new_path": "app/models/commit.rb", "diff": "@@ -41,7 +41,7 @@ class Commit\nend\ndef info\n- @info ||= user.gh_client.repos.commits.get(repository.owner, repository.name, sha) #rescue nil\n+ @info ||= repository ? user.gh_client.repos.commits.get(repository.owner, repository.name, sha) : nil\nend\ndef max_rating\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Updated Commit#info Request the commit info from Github only if the commit's repo is present. We delete the repository in Jobs if the repo is not found.
332,109
16.01.2017 12:42:02
-19,080
7f61b53751fd8f03bef41679b8b8847e7c64a3d3
Added test for Commit#info
[ { "change_type": "MODIFY", "old_path": "test/models/commit_test.rb", "new_path": "test/models/commit_test.rb", "diff": "@@ -44,6 +44,9 @@ class CommitTest < ActiveSupport::TestCase\ndef test_commit_info\ncommit = create(:commit, message: Faker::Lorem.sentences, sha: 'eb0df748bbf084ca522f5ce4ebcf508d16169b96', repository: create(:repository, owner: 'joshsoftware', name: 'code-curiosity'))\nassert_not_nil commit.info\n+\n+ commit = create(:commit, message: Faker::Lorem.sentences, sha: 'eb0df748bbf084ca522f5ce4ebcf508d16169b96', repository: nil)\n+ assert_nil commit.info\nend\ndef test_round_is_present\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Added test for Commit#info
332,099
08.02.2017 19:08:23
-19,080
2790c0eb8d35d16a23e653ab11db0a251a64a945
refs Fixed the pagination issue on users table for the filtered users as well as for the filtered ignored files
[ { "change_type": "MODIFY", "old_path": "app/controllers/admin/ignored_files_controller.rb", "new_path": "app/controllers/admin/ignored_files_controller.rb", "diff": "@@ -51,8 +51,7 @@ class Admin::IgnoredFilesController < ApplicationController\nend\n@ignored_files = FileToBeIgnored.any_of({name: /#{params[:q]}/}, {programming_language: params[:q]},\n- {count: params[:q]}).order(highest_score: :desc)\n- @ignored_files = @ignored_files.page(1)\n+ {count: params[:q]}).order(highest_score: :desc).page(params[:page])\nrender :index\nend\n" }, { "change_type": "MODIFY", "old_path": "app/controllers/admin/users_controller.rb", "new_path": "app/controllers/admin/users_controller.rb", "diff": "@@ -29,7 +29,7 @@ class Admin::UsersController < ApplicationController\n@users = User.contestants.where(github_handle: /#{params[:q]}/)\n@users = User.contestants.where(email: params[:q]) if @users.none?\n- @users = @users.page(1)\n+ @users = @users.page(params[:page])\nrender :index\nend\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
refs #248 Fixed the pagination issue on users table for the filtered users as well as for the filtered ignored files
332,099
10.02.2017 15:48:32
-19,080
f46f317c422a8e55ccf955dc82e52a90ed1f04c2
Added user's email on the admin redeem_requests page
[ { "change_type": "MODIFY", "old_path": "app/views/admin/redeem_requests/_redeem_request.html.haml", "new_path": "app/views/admin/redeem_requests/_redeem_request.html.haml", "diff": "%tr\n- %td= link_to redeem_request.user.github_handle, user_path(redeem_request.user), target: '_blank'\n+ %td= link_to redeem_request.user.email, user_path(redeem_request.user), target: '_blank'\n%td\n- if redeem_request.retailer_other?\n= link_to redeem_request.retailer.upcase, redeem_request.gift_product_url, target: '_blank'\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Added user's email on the admin redeem_requests page
332,099
13.02.2017 14:31:35
-19,080
8342557e33b39a37fd11b910dc91fa80c2ca41b9
Fixed code to avoid creation of duplicate IgnoredFiles During bugspots_scoring avoid creation of duplicate IgnoredFiles .
[ { "change_type": "MODIFY", "old_path": "app/models/scoring_engine.rb", "new_path": "app/models/scoring_engine.rb", "diff": "@@ -120,6 +120,7 @@ class ScoringEngine\n# include changes of ignored_files for this commit\ntotal_score = commit.info.files.inject(0) do |result, file|\n+\nfile_name = bugspots_scores[file.filename]\nfile_exist = FileToBeIgnored.name_exist?(file.filename)\n@@ -136,10 +137,11 @@ class ScoringEngine\nif file_exist && file_exist.programming_language.blank?\nfile_exist.set(programming_language: repo.languages.first)\nelsif bugspot_score >= config[:bugspot_scores_threshold]\n- FileToBeIgnored.create(name: file.filename, programming_language: repo.languages.first, highest_score: bugspot_score)\n+ FileToBeIgnored.create(name: file.filename, programming_language: repo.languages.first, highest_score: bugspot_score) unless file_exist\n+ file_exist.set(highest_score: bugspot_score) if (file_exist && bugspot_score > file_exist.highest_score)\nend\n- result += (bugspot_score * config[:max_score])/max_score if max_score.to_i != 0\n+ result += (bugspot_score * config[:max_score])/max_score if max_score != 0\nend\nresult\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Fixed code to avoid creation of duplicate IgnoredFiles During bugspots_scoring avoid creation of duplicate IgnoredFiles .
332,099
15.02.2017 13:41:08
-19,080
8f4da2c8af4234b97841212aa69062d977bf65c0
refs Fixed homepage and dashboard view on smartphones Also fixed the footer
[ { "change_type": "MODIFY", "old_path": "app/views/dashboard/index.html.haml", "new_path": "app/views/dashboard/index.html.haml", "diff": "= render 'celebrity_box' if current_user && current_user.celebrity\n%section.content\n.row\n- .col-lg-3.col-xs-6\n+ .col-lg-3.col-xs-4\n.small-box.bg-aqua\n.inner\n%h3= format_points(current_user.total_points)\n= link_to user_path(current_user), class: 'small-box-footer' do\nMore info\n%i.fa.fa-arrow-circle-right\n- .col-lg-3.col-xs-6\n+ .col-lg-3.col-xs-4\n.small-box.bg-green\n.inner\n%h3= current_user.commits_count\n= link_to activities_path(anchor: 'commits'), class: 'small-box-footer' do\nMore info\n%i.fa.fa-arrow-circle-right\n- .col-lg-3.col-xs-6\n+ .col-lg-3.col-xs-4\n.small-box.bg-yellow\n.inner\n%h3= current_user.activities_count\n" }, { "change_type": "MODIFY", "old_path": "app/views/home/index.html.haml", "new_path": "app/views/home/index.html.haml", "diff": "= image_tag 'logo-home.png'\n.row\n.box-header\n+ .col-xs-12\n%h4\n%span.text\n= number_with_delimiter(User.contestants.count )\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
refs #180 Fixed homepage and dashboard view on smartphones Also fixed the footer
332,099
08.02.2017 16:38:52
-19,080
8945f23c41160268fbe53f8aada20f399dace099
Fixed redemption issue As previously we were not considering 500 royalty_points redemption specific to particular round. Now we are checking for the round based on the redeem_request created_at. Added new model redemption_transaction for keeping track of redeemed_royalty_points and redeemed_round_points. Also added testcases for the same.
[ { "change_type": "MODIFY", "old_path": "app/models/redeem_request.rb", "new_path": "app/models/redeem_request.rb", "diff": "@@ -68,26 +68,25 @@ class RedeemRequest\nend\ndef redemption_points_validations\n- royalty_bonus = self.user.royalty_bonus_transaction\n+ royalty_points = total_royalty_points\n- if royalty_bonus\n- royalty_points = royalty_bonus.points\n+ if royalty_points\ntotal_points = self.user.total_points\n- #shows error if\n- #1 user's total_points is less than the points to be redeemed\n- #2 user's total_points is greater than the points to be redeemed but royalty_points redeemed for current_months\n- # are more than 500\n+ #get all transactions having transaction_type as redeem_points for the user\n+ transactions = redeem_points_transactions\n- #redeemed_royalty_points = points + royalty_points - total_points, should not be\n- #more than 500 royalty_points.\n- if total_points < points || (total_points >= points && (points + royalty_points - total_points > 500))\n- errors.add(:points, \"at most 500 royalty points can be redeemed in this month\")\n- end\n+ #get redeemed_royalty_points_for_current_month, redeemed_royalty_points, redeemed_total_royalty_points\n+ redeemed_royalty_point, total_redeemed_royalty, redeemed_round_points = get_royalty_and_round_points(transactions)\n+\n+ #threshold check is that atmost 500 royalty points can be redeemed in a month\n+ royalty_points_threshold_check(total_points, royalty_points, redeemed_royalty_point, total_redeemed_royalty)\nend\nend\ndef create_redeem_transaction\n+ total_points = self.user.total_points\n+\nself.create_transaction({\ntype: 'debit',\npoints: points,\n@@ -95,6 +94,67 @@ class RedeemRequest\ndescription: 'Redeem',\nuser_id: user_id\n})\n+\n+ #get all transactions having transaction_type as redeem_points for the user\n+ transactions = redeem_points_transactions\n+ #get redeemed_royalty_points_for_current_month, redeemed_royalty_points, redeemed_total_royalty_points\n+ redeemed_royalty_point, total_redeemed_royalty, redeemed_round_point = get_royalty_and_round_points(transactions)\n+\n+ round_points, royalty_points = set_points(total_points, redeemed_round_point, redeemed_royalty_point)\n+\n+ create_redemption_transaction(round_points, royalty_points)\n+ end\n+\n+ def set_points(total_points, redeemed_round_point, redeemed_royalty_point)\n+ if total_round_points - redeemed_round_point - points >= 0\n+ round_points = points\n+ royalty_points = 0\n+ elsif total_royalty_points && total_royalty_points - redeemed_royalty_point - points >= 0\n+ round_points = total_round_points - redeemed_round_point\n+ royalty_points = points - round_points\n+ else\n+ round_points = total_round_points\n+ royalty_points = points - round_points\n+ end\n+\n+ return [round_points, royalty_points]\n+ end\n+\n+ def royalty_points_threshold_check(total_points, royalty_points, redeemed_royalty_point, total_redeemed_royalty)\n+ royalty = 0\n+ if total_points >= points\n+ # royalty point to be redeemed if round points is less than the redeemed point\n+ royalty = points - (total_points - royalty_points + total_redeemed_royalty) if (total_points - royalty_points + total_redeemed_royalty < points)\n+ end\n+ #shows error if\n+ #1 user's total_points is less than the points to be redeemed\n+ #2 user's total_points is greater than the points to be redeemed but royalty_points redeemed for current_months\n+ # are more than 500\n+ if total_points < points || (total_points >= points && (royalty + redeemed_royalty_point > 500))\n+ errors.add(:points, \"at most 500 royalty points can be redeemed in this month\")\n+ end\n+ end\n+\n+ def create_redemption_transaction(round_points, royalty_points)\n+ self.transaction.create_redemption_transaction({\n+ round_points: round_points,\n+ royalty_points: royalty_points,\n+ round_name: Round.opened.name\n+ })\n+ end\n+\n+ def get_royalty_and_round_points(transactions)\n+ redeemed_royalty_point = total_redeemed_royalty = redeemed_round_point = 0\n+\n+ transactions.each do |transaction|\n+ if transaction.redemption_transaction\n+ redeemed_round_point += transaction.redemption_transaction.round_points\n+ redeemed_royalty_point += transaction.redemption_transaction.royalty_points if Round.opened.name.eql?(transaction.redemption_transaction.round_name)\n+ total_redeemed_royalty += transaction.redemption_transaction.royalty_points\n+ end\n+ end\n+\n+ return [redeemed_royalty_point, total_redeemed_royalty, redeemed_round_point]\nend\ndef send_notification\n@@ -104,4 +164,15 @@ class RedeemRequest\nend\nend\n+ def total_round_points\n+ self.user.transactions.where(transaction_type: 'Round').sum(:points)\n+ end\n+\n+ def total_royalty_points\n+ self.user.royalty_bonus_transaction.points if self.user.royalty_bonus_transaction\n+ end\n+\n+ def redeem_points_transactions\n+ self.user.transactions.where(transaction_type: 'redeem_points')\n+ end\nend\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "app/models/redemption_transaction.rb", "diff": "+class RedemptionTransaction\n+ include Mongoid::Document\n+\n+ field :round_points, type: Integer, default: 0\n+ field :royalty_points, type: Integer, default: 0\n+ field :goal_bonus_points, type: Integer, default: 0\n+ field :round_name, type: String\n+\n+ belongs_to :transaction\n+end\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "app/models/transaction.rb", "new_path": "app/models/transaction.rb", "diff": "@@ -12,6 +12,7 @@ class Transaction\nbelongs_to :user\nbelongs_to :subscription\nbelongs_to :redeem_request\n+ has_one :redemption_transaction\nvalidates :type, :points , presence: true\nvalidates :type, inclusion: { in: %w(credit debit) }\n" }, { "change_type": "MODIFY", "old_path": "app/models/user.rb", "new_path": "app/models/user.rb", "diff": "@@ -220,5 +220,3 @@ class User\nself.transactions.where(transaction_type: 'royalty_bonus').first\nend\nend\n\\ No newline at end of file\n-\n-\n" }, { "change_type": "MODIFY", "old_path": "test/mailers/redeem_mailer_test.rb", "new_path": "test/mailers/redeem_mailer_test.rb", "diff": "@@ -5,6 +5,7 @@ class RedeemMailerTest < ActionMailer::TestCase\ndef test_mail_is_enqueued_to_be_delivered_later\nuser = create(:user)\n+ round_1 = create :round, status: \"open\", name: Date.today.beginning_of_month.strftime(\"%b %Y\"), from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\ntransaction = create(:transaction, :type => 'credit', :points => 20, user: user)\nr = create(:redeem_request, :points => 2, user: user)\nassert_enqueued_jobs 1 do\n@@ -14,6 +15,7 @@ class RedeemMailerTest < ActionMailer::TestCase\ndef test_mail_should_be_delivered\nuser = create(:user)\n+ round_1 = create :round, status: \"open\", name: Date.today.beginning_of_month.strftime(\"%b %Y\"), from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\ntransaction = create(:transaction, :type => 'credit', :points => 20, user: user)\nr = create(:redeem_request, :points => 2, user: user)\nassert_difference 'ActionMailer::Base.deliveries.size', +1 do\n@@ -23,6 +25,7 @@ class RedeemMailerTest < ActionMailer::TestCase\ndef test_mail_is_delivered_with_expected_content\nuser = create(:user)\n+ round_1 = create :round, status: \"open\", name: Date.today.beginning_of_month.strftime(\"%b %Y\"), from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\ntransaction = create(:transaction, :type => 'credit', :points => 20, user: user)\nr = create(:redeem_request, :points => 2, user: user)\nperform_enqueued_jobs do\n" }, { "change_type": "MODIFY", "old_path": "test/models/redeem_request_test.rb", "new_path": "test/models/redeem_request_test.rb", "diff": "@@ -56,6 +56,7 @@ class RedeemRequestTest < ActiveSupport::TestCase\ntest \"user total points must be greater than or equal to redeemption points\" do\nuser = create(:user)\n+ round_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\nroyalty_transaction = create :transaction, points: 10, transaction_type: 'royalty_bonus', type: 'credit', user: user\ntransaction = create(:transaction, :points => 4, :type => 'credit', user: user)\nredeem_request = create(:redeem_request, :points => 3, :address => 'baner', :retailer => 'github', user: user)\n@@ -79,6 +80,7 @@ class RedeemRequestTest < ActiveSupport::TestCase\ntest \"points must be in multiple of hundred for redeemption\" do\nuser = create(:user)\n+ round_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\nroyalty_transaction = create :transaction, points: 20, transaction_type: 'royalty_bonus', type: 'credit', user: user\ntransaction = create(:transaction, :points => 100, :type => 'credit', user: user)\nredeem_request = create(:redeem_request, :points => 2, user: user)\n@@ -87,6 +89,7 @@ class RedeemRequestTest < ActiveSupport::TestCase\ntest \"creating redeem_request must create redeem_transaction\" do\nuser = create(:user, :points => 3)\n+ round_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\nroyalty_transaction = create :transaction, points: 10, transaction_type: 'royalty_bonus', type: 'credit', user: user\ntransaction = create(:transaction, :type => 'credit', :points => 5, user: user)\nredeem_request = create(:redeem_request, :points => 2, user: user)\n@@ -96,6 +99,7 @@ class RedeemRequestTest < ActiveSupport::TestCase\ntest \"transaction corresponding to redeem request must be destroyed when it is deleted\" do\nuser = create(:user)\n+ round_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\nassert_equal user.transactions.count, 0\nroyalty_transaction = create :transaction, points: 10, transaction_type: 'royalty_bonus', type: 'credit', user: user\ntransaction = create(:transaction, :type => 'credit', :points => 4, user: user)\n@@ -110,6 +114,7 @@ class RedeemRequestTest < ActiveSupport::TestCase\ntest \"send notification only when coupon_code or comment is changed\" do\nuser = create(:user)\n+ round_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\nassert_equal user.transactions.count, 0\nroyalty_transaction = create :transaction, points: 100, transaction_type: 'royalty_bonus', type: 'credit', user: user\ntransaction = create(:transaction, :type => 'credit', :points => 4, user: user)\n@@ -121,6 +126,7 @@ class RedeemRequestTest < ActiveSupport::TestCase\ntest \"redeem request must be updated when coupon_code or comment_changed\" do\nuser = create(:user)\n+ round_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\nassert_equal user.transactions.count, 0\nroyalty_transaction = create :transaction, points: 20, transaction_type: 'royalty_bonus', type: 'credit', user: user\ntransaction = create(:transaction, :type => 'credit', :points => 4, user: user)\n@@ -144,9 +150,10 @@ class RedeemRequestTest < ActiveSupport::TestCase\ntest \"user should be able to redeem if user total points is greater than or equal to redemption points\" do\nuser = create :user\n+ round_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\nroyalty_points = 10\nroyalty_transaction = create :transaction, points: royalty_points, transaction_type: 'royalty_bonus', type: 'credit', user: user\n- round_transaction = create :transaction, points: 300, type: 'credit', user: user\n+ round_transaction = create :transaction, points: 300, type: 'credit', transaction_type: 'Round', user: user\nassert_equal 2, user.transactions.count\nredeem_request = create :redeem_request, points: 300, user: user\nassert_equal 1, user.reload.redeem_requests.count\n@@ -158,9 +165,10 @@ class RedeemRequestTest < ActiveSupport::TestCase\ntest \"user should be able to redeem if user points is zero and user royalty_bonus is present\" do\nuser = create :user\n+ round_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\nroyalty_points = 500\nroyalty_transaction = create :transaction, points: royalty_points, transaction_type: 'royalty_bonus', type: 'credit', user: user\n- round_transaction = create :transaction, points: 0, type: 'credit', user: user\n+ round_transaction = create :transaction, points: 0, type: 'credit',transaction_type: 'Round', user: user\nassert_equal 2, user.transactions.count\nassert_equal 500, user.total_points\nredeem_request = create :redeem_request, points: 500, user: user\n@@ -172,9 +180,10 @@ class RedeemRequestTest < ActiveSupport::TestCase\ntest \"user should not be able to redeem if redemption points is greater than 500 and user points is zero\" do\nuser = create :user\n+ round_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\nroyalty_points = 1500\nroyalty_transaction = create :transaction, points: royalty_points, transaction_type: 'royalty_bonus', type: 'credit', user: user\n- round_transaction = create :transaction, points: 0, type: 'credit', user: user\n+ round_transaction = create :transaction, points: 0, type: 'credit', transaction_type: 'Round', user: user\nredeem_request = build :redeem_request, points: 1000, user: user\nredeem_request.save\nassert_not_empty redeem_request.errors[:points]\n@@ -184,9 +193,10 @@ class RedeemRequestTest < ActiveSupport::TestCase\ntest \"user should be able to redeem multiple times but overall atmost 500 royalty_points can be redeemed in a month\" do\nuser = create :user\n+ round_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\nroyalty_points = 1000\nroyalty_transaction = create :transaction, points: royalty_points, transaction_type: 'royalty_bonus', type: 'credit', user: user\n- round_transaction = create :transaction, points: 1000, type: 'credit', user: user\n+ round_transaction = create :transaction, points: 1000, type: 'credit', transaction_type: 'Round', user: user\nredeem_request = create :redeem_request, points: 1300, user: user\nassert_equal 1, user.redeem_requests.count\nassert_equal 1300, user.redeem_requests.first.points\n@@ -197,4 +207,35 @@ class RedeemRequestTest < ActiveSupport::TestCase\nuser.instance_variable_set(:@_t_p, nil)\nassert_equal 500, user.total_points\nend\n+\n+\n+ test \"user should be able to redeem atmost 500 royalty points in each and every round if redemption criteria is satisified\" do\n+ user = create :user\n+ round_1 = create :round, status: \"open\", name: Date.today.beginning_of_month.strftime(\"%b %Y\"), from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\n+ subscription = create(:subscription, user: user, round: round_1)\n+ royalty_points = 3308\n+ royalty_transaction = create :transaction, points: royalty_points, transaction_type: 'royalty_bonus', type: 'credit', user: user\n+ round_transaction = create :transaction, points: 10, type: 'credit', user: user\n+\n+ redeem_request_1 = create :redeem_request, points: 100, user: user\n+ user.instance_variable_set(:@_t_p, nil)\n+ redeem_request_2 = create :redeem_request, points: 400, user: user\n+ user.instance_variable_set(:@_t_p, nil)\n+\n+ Round.destroy_all\n+ round_2 = create :round, status: \"open\", name: Date.today.next_month.beginning_of_month.strftime(\"%b %Y\"), from_date: Date.today.next_month.beginning_of_month, end_date: Date.today.next_month.end_of_month\n+ subscription = create(:subscription, user: user, round: round_2)\n+ redeem_request_1 = create :redeem_request,points: 100, created_at: Date.today.next_month, user: user\n+ user.instance_variable_set(:@_t_p, nil)\n+ redeem_request_2 = create :redeem_request,points: 200, created_at: Date.today.next_month, user: user\n+ user.instance_variable_set(:@_t_p, nil)\n+\n+ Round.destroy_all\n+ round_3 = create :round, status: \"open\", name: (Date.today + 2.month).beginning_of_month.strftime(\"%b %Y\"), from_date: (Date.today + 2.month).beginning_of_month, end_date: (Date.today + 2.month).end_of_month\n+ subscription = create(:subscription, user: user, round: round_3)\n+ redeem_request_1 = create :redeem_request,points: 300, created_at: Date.today + 2.month, user: user\n+ user.instance_variable_set(:@_t_p, nil)\n+ redeem_request_2 = create :redeem_request,points: 200, created_at: Date.today + 2.month, user: user\n+ end\n+\nend\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/models/redemption_transaction_test.rb", "diff": "+require \"test_helper\"\n+\n+class RedemptionTransactionTest < ActiveSupport::TestCase\n+\n+ test \"user have only round points\" do\n+ user = create :user\n+ round_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\n+\n+ round_transaction = create :transaction, points: 400, type: 'credit', transaction_type: 'Round', user: user\n+\n+ redeem_request_1 = create :redeem_request, points: 100, user: user\n+ assert_equal 100, redeem_request_1.transaction.redemption_transaction.round_points\n+ assert_equal 0, redeem_request_1.transaction.redemption_transaction.royalty_points\n+ user.instance_variable_set(:@_t_p, nil)\n+\n+ redeem_request_2 = create :redeem_request, points: 100, user: user\n+ assert_equal 100, redeem_request_2.transaction.redemption_transaction.round_points\n+ assert_equal 0, redeem_request_2.transaction.redemption_transaction.royalty_points\n+ user.instance_variable_set(:@_t_p, nil)\n+\n+ assert_equal 2, RedemptionTransaction.count\n+ Round.destroy_all\n+ round_2 = create :round, status: \"open\", name: Date.today.next_month.beginning_of_month.strftime(\"%b %Y\"), from_date: Date.today.next_month.beginning_of_month, end_date: Date.today.next_month.end_of_month\n+ redeem_request_2 = create :redeem_request, points: 200, user: user\n+ end\n+\n+ test \"user have only royalty points\" do\n+ user = create :user\n+ round_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\n+ royalty_points = 200\n+\n+ royalty_transaction = create :transaction, points: royalty_points, transaction_type: 'royalty_bonus', type: 'credit', user: user\n+\n+ round_transaction = create :transaction, points: 0, type: 'credit', transaction_type: 'Round', user: user\n+\n+ redeem_request_1 = create :redeem_request, points: 100, user: user\n+ assert_equal 100, redeem_request_1.transaction.redemption_transaction.royalty_points\n+ assert_equal 0, redeem_request_1.transaction.redemption_transaction.round_points\n+ end\n+\n+ test \"user have both royalty bonus as well as round points\" do\n+ user = create :user\n+ round_1 = create :round, status: \"open\", name: Date.today.beginning_of_month.strftime(\"%b %Y\"), from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\n+ royalty_points = 200\n+ royalty_transaction = create :transaction, points: royalty_points, transaction_type: 'royalty_bonus', type: 'credit', user: user\n+\n+ round_transaction = create :transaction, points: 200, type: 'credit', transaction_type: 'Round', user: user\n+\n+ redeem_request_1 = create :redeem_request, points: 100, user: user\n+ assert_equal 100, redeem_request_1.transaction.redemption_transaction.round_points\n+ assert_equal Date.today.beginning_of_month.strftime(\"%b %Y\"), redeem_request_1.transaction.redemption_transaction.round_name\n+ user.instance_variable_set(:@_t_p, nil)\n+\n+ redeem_request_2 = create :redeem_request, points: 100, user: user\n+ assert_equal 100, redeem_request_2.transaction.redemption_transaction.round_points\n+ assert_equal 0, redeem_request_2.transaction.redemption_transaction.royalty_points\n+ user.instance_variable_set(:@_t_p, nil)\n+\n+ redeem_request_3 = create :redeem_request, points: 100, user: user\n+ assert_equal 100, redeem_request_3.transaction.redemption_transaction.royalty_points\n+ end\n+\n+ test \"user have royalty bonus as well as round points and redeems few in current month and remaining in next month\" do\n+ user = create :user\n+ round_1 = create :round, status: \"open\", name: Date.today.beginning_of_month.strftime(\"%b %Y\"), from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\n+ royalty_points = 700\n+ royalty_transaction = create :transaction, points: royalty_points, transaction_type: 'royalty_bonus', type: 'credit', user: user\n+\n+ round_transaction = create :transaction, points: 200, type: 'credit', transaction_type: 'Round', user: user\n+\n+ redeem_request_1 = create :redeem_request, points: 300, user: user\n+ assert_equal 200, redeem_request_1.transaction.redemption_transaction.round_points\n+ assert_equal 100, redeem_request_1.transaction.redemption_transaction.royalty_points\n+ assert_equal Date.today.beginning_of_month.strftime(\"%b %Y\"), redeem_request_1.transaction.redemption_transaction.round_name\n+ user.instance_variable_set(:@_t_p, nil)\n+\n+ redeem_request_2 = create :redeem_request, points: 100, user: user\n+ assert_equal 0, redeem_request_2.transaction.redemption_transaction.round_points\n+ assert_equal 100, redeem_request_2.transaction.redemption_transaction.royalty_points\n+ user.instance_variable_set(:@_t_p, nil)\n+\n+ Round.destroy_all\n+ round_2 = create :round, status: \"open\", name: Date.today.next_month.beginning_of_month.strftime(\"%b %Y\"), from_date: Date.today.next_month.beginning_of_month, end_date: Date.today.next_month.end_of_month\n+ redeem_request_1 = create :redeem_request, points: 300, user: user\n+ assert_equal 300, redeem_request_1.transaction.redemption_transaction.royalty_points\n+ assert_equal 0, redeem_request_1.transaction.redemption_transaction.round_points\n+ assert_equal Date.today.next_month.beginning_of_month.strftime(\"%b %Y\"), redeem_request_1.transaction.redemption_transaction.round_name\n+ end\n+end\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Fixed redemption issue As previously we were not considering 500 royalty_points redemption specific to particular round. Now we are checking for the round based on the redeem_request created_at. Added new model redemption_transaction for keeping track of redeemed_royalty_points and redeemed_round_points. Also added testcases for the same.
332,099
20.02.2017 15:16:20
-19,080
98217506540bf561a541b27d4f129205dcd276f4
Added ContactUs link in the footer section
[ { "change_type": "MODIFY", "old_path": "app/views/application/_footer.html.haml", "new_path": "app/views/application/_footer.html.haml", "diff": "%strong\nPowered by\n%a{:href => 'http://joshsoftware.com', target: '_blank'} JoshSoftware\n-\n+%span.contact\n+ %a{:href => \"mailto:info@codecuriosity.org?Subject=CodeCuriosity%20Feedback\", :target => \"_top\", style: \" float: right; position: relative; left: -30%; font-weight: bold;\"}\n+ %i.fa.fa-phone-square\n+ %span Contact Us\n\\ No newline at end of file\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Added ContactUs link in the footer section
332,099
20.02.2017 18:55:23
-19,080
4adb6a23fde0aa3c72a2332414b4cd2b5bd7599b
refs Fixed user profile page view on smartphone Also fixed the navigation toggle and the admin dashboard
[ { "change_type": "MODIFY", "old_path": "app/views/admin/dashboard/index.html.haml", "new_path": "app/views/admin/dashboard/index.html.haml", "diff": "= render partial: 'info_box', locals: { title: 'Total points(before redemption)', value: Transaction.total_points_before_redemption, info_box_bg: 'bg-aqua', icon: 'ion-cash' }\n= render partial: 'info_box', locals: { title: 'Total number of points redeemed.', value: Transaction.total_points_redeemed, info_box_bg: 'bg-red', icon: 'ion-beer'}\n%section.content\n+ .row\n+ .col-xs-12\n.box.box-default\n.box-header.with-border\n%h4 Note: Home page tagline demo\n" }, { "change_type": "MODIFY", "old_path": "app/views/application/_navbar.html.haml", "new_path": "app/views/application/_navbar.html.haml", "diff": "%span.logo-lg\n= image_tag 'logo_50pxh.png', height: 35\n%nav.navbar.navbar-static-top{:role => 'navigation'}\n- %a.sidebar-toggle{'data-toggle' => 'offcanvas', :href => '#', :role => 'button'}\n+ %a.sidebar-toggle{'data-toggle' => 'offcanvas', :href => '#', :role => 'button', style: \"padding-left: 11px; padding-right: 12px;\"}\n%span.sr-only Toggle navigation\n.navbar-custom-menu\n%ul.nav.navbar-nav\n" }, { "change_type": "MODIFY", "old_path": "app/views/users/show.html.haml", "new_path": "app/views/users/show.html.haml", "diff": "= render 'celebrity_box' if current_user && current_user.celebrity\n%section.content\n.row\n- .col-xs-3\n+ .col-sm-3\n.box.box-primary\n.box-body.box-profile\n= image_tag avatar_url(@user), class: 'profile-user-img img-responsive img-circle', alt: @user.name\n- else\n%span.tool-tip{\"data-placement\" => \"top\", \"data-toggle\" => \"tooltip\", :title => \"Not met the redemption criteria\"}\n%span.btn.btn-primary.btn-block{:disabled => \"disabled\"} Redeem Points!\n- .col-xs-9\n+ .col-sm-9\n.nav-tabs-custom\n%ul.nav.nav-tabs\n%li.active#rounds_tab_link\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
refs #180 Fixed user profile page view on smartphone Also fixed the navigation toggle and the admin dashboard
332,099
22.02.2017 17:15:32
-19,080
ff5e9510ca6afcba4b55ba7a2912262ac97b0bfe
Added rake task to populate user's redeemed transactions on the basis of redeemed royalty points and round points.
[ { "change_type": "MODIFY", "old_path": "lib/tasks/utils.rake", "new_path": "lib/tasks/utils.rake", "diff": "@@ -72,4 +72,29 @@ namespace :utils do\nend\nend\n+ desc \"Update user redeemed points transactions\"\n+ task update_user_redemed_points: :environment do\n+ User.contestants.each do |user|\n+ user.transactions.where(transaction_type: 'redeem_points').each do |transaction|\n+ total_points = 0\n+ points = transaction.points.abs\n+ total_points = user.transactions.where(:created_at.lt => transaction.created_at).sum(:points)\n+ royalty_points = user.royalty_bonus_transaction ? user.royalty_bonus_transaction.points : 0\n+\n+ redeemed_royalty_points = points + royalty_points - total_points\n+\n+ redeemed_royalty_points = 0 if redeemed_royalty_points <= 0\n+\n+ redeemed_royalty_points = points if redeemed_royalty_points > points\n+\n+ round_points = points - redeemed_royalty_points\n+\n+ transaction.create_redemption_transaction({\n+ round_points: round_points,\n+ royalty_points: redeemed_royalty_points,\n+ round_name: transaction.created_at.strftime(\"%b %Y\")\n+ })\n+ end\n+ end\n+ end\nend\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Added rake task to populate user's redeemed transactions on the basis of redeemed royalty points and round points.
332,099
22.02.2017 20:33:27
-19,080
77fdb851d82d33ba2dcbe366a35d733e56806580
Modified redemption transaction to consider GoalBonus During redemption points calculation considere GoalBonus points also.
[ { "change_type": "MODIFY", "old_path": "app/models/redeem_request.rb", "new_path": "app/models/redeem_request.rb", "diff": "@@ -165,7 +165,7 @@ class RedeemRequest\nend\ndef total_round_points\n- self.user.transactions.where(transaction_type: 'Round').sum(:points)\n+ self.user.transactions.where(:transaction_type.in => ['GoalBonus', 'Round']).sum(:points)\nend\ndef total_royalty_points\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Modified redemption transaction to consider GoalBonus During redemption points calculation considere GoalBonus points also.
332,099
23.02.2017 13:17:29
-19,080
11d209a119e28dfa88803468376fee59f0350fd0
refs Fixed UI search_box on the admin users and ignored files for the mobile Also fixed UI of contributions info section
[ { "change_type": "MODIFY", "old_path": "app/assets/stylesheets/style.scss", "new_path": "app/assets/stylesheets/style.scss", "diff": "@@ -142,9 +142,9 @@ td.score.commit{\n}\n.scoring-color-info{\n- margin-right: 20px !important;\n+ margin-right: 7px !important;\nborder-bottom: 1px solid #000;\n- padding: 4px 8px;\n+ padding: 4px 0px;\n.score{\npadding: 0px 6px;\n" }, { "change_type": "MODIFY", "old_path": "app/views/admin/ignored_files/index.html.haml", "new_path": "app/views/admin/ignored_files/index.html.haml", "diff": "%h3.box-title\n%span Files For Scoring:\n.box-tools\n- = form_tag(search_admin_ignored_files_path, method: :get, class: 'col-xs-4 pull-right') do\n+ = form_tag(search_admin_ignored_files_path, method: :get, class: 'col-xs-2 col-md-4 pull-right') do\n.input-group.input-group-sm\n= text_field_tag('q', params[:q], class: 'form-control pull-right', placeholder: 'filename/programming_language/file_count')\n.input-group-btn\n" }, { "change_type": "MODIFY", "old_path": "app/views/admin/users/index.html.haml", "new_path": "app/views/admin/users/index.html.haml", "diff": "%h3.box-title\n%span Users:\n.box-tools\n- = form_tag(search_admin_users_path, method: :get, class: 'col-xs-4 pull-right') do\n+ = form_tag(search_admin_users_path, method: :get, class: 'col-xs-3 col-md-4 pull-right') do\n.input-group.input-group-sm\n= text_field_tag('q', params[:q], class: 'form-control pull-right', placeholder: 'github handle/email')\n.input-group-btn\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
refs #180 Fixed UI search_box on the admin users and ignored files for the mobile Also fixed UI of contributions info section
332,099
23.02.2017 17:02:01
-19,080
b19c200ed78717ec5762615980355bd1c81e77e2
Added search box on the admin repositories page .
[ { "change_type": "MODIFY", "old_path": "app/controllers/admin/repositories_controller.rb", "new_path": "app/controllers/admin/repositories_controller.rb", "diff": "@@ -16,4 +16,15 @@ class Admin::RepositoriesController < ApplicationController\n@repo.judges = User.find(params[:judges])\n@repo.save\nend\n+\n+ def search\n+ if params[:q].blank?\n+ redirect_to admin_repositories_path\n+ return\n+ end\n+\n+ @repos = Repository.where(name: /#{params[:q]}/).asc(:name).page(params[:page])\n+\n+ render :index\n+ end\nend\n" }, { "change_type": "MODIFY", "old_path": "app/views/admin/repositories/index.html.haml", "new_path": "app/views/admin/repositories/index.html.haml", "diff": "-%section.content-header\n- %h1\n- Repositories\n%section.content\n.row\n.col-xs-12\n.box.box-primary\n+ .box-header\n+ %h3.box-title\n+ %span Repositories:\n+ .box-tools\n+ = form_tag(search_admin_repositories_path, method: :get, class: 'col-xs-2 col-md-4 pull-right') do\n+ .input-group.input-group-sm\n+ = text_field_tag('q', params[:q], class: 'form-control pull-right', placeholder: 'Repository name')\n+ .input-group-btn\n+ %button.btn.btn-default{type: 'submit'} Go\n.box-body.table-responsive\n- if @repos.any?\n= render 'repos_table'\n.pagination-container\n- = paginate @repos, params: { controller: 'admin/repositories', action: 'index'}, remote: true\n+ = paginate @repos, remote: true\n.modal.fade#assign_judge_form\n" }, { "change_type": "MODIFY", "old_path": "config/routes.rb", "new_path": "config/routes.rb", "diff": "@@ -34,6 +34,7 @@ Rails.application.routes.draw do\nnamespace :admin do\nresources :repositories, only: [:index] do\n+ get :search, on: :collection\nmember do\npatch :add_judges\nget :assign_judge\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Added search box on the admin repositories page .
332,099
02.03.2017 18:31:35
-19,080
6c0177c0df1b052208957445468063cc2b624f05
Fixed Redemption issue for 'other' type retailer For 'other' type retailer redemption request is created even though user total points is 0.
[ { "change_type": "MODIFY", "old_path": "app/models/redeem_request.rb", "new_path": "app/models/redeem_request.rb", "diff": "@@ -24,6 +24,7 @@ class RedeemRequest\nvalidate :check_sufficient_balance, unless: :retailer_other?, on: :create\nvalidate :points_validations, unless: :retailer_other?\nvalidate :redemption_points_validations, unless: :retailer_other?, on: :create\n+ validate :user_total_points, on: :create\nbefore_validation {|r| r.points = r.points.to_i }\n@@ -35,6 +36,11 @@ class RedeemRequest\nafter_save :send_notification\n+ def user_total_points\n+ if user.total_points == 0\n+ errors.add(:gift_product_url, \"insufficient balance. You have only #{user.total_points} points in your account.\") if retailer_other?\n+ end\n+ end\ndef self.total_points_redeemed\nwhere(status: true).sum(&:points)\n" }, { "change_type": "MODIFY", "old_path": "test/models/redeem_request_test.rb", "new_path": "test/models/redeem_request_test.rb", "diff": "@@ -50,7 +50,7 @@ class RedeemRequestTest < ActiveSupport::TestCase\nend\ntest \"whether retailer category is other\" do\n- redeem_request = build(:redeem_request, :points => 2, :address => 'baner', :retailer => 'other', :gift_product_url => Faker::Internet.url, :address => 'baner')\n+ redeem_request = build(:redeem_request, :points => 2, :retailer => 'other', :gift_product_url => Faker::Internet.url, :address => 'baner')\nassert redeem_request.retailer_other?\nend\n@@ -238,4 +238,13 @@ class RedeemRequestTest < ActiveSupport::TestCase\nredeem_request_2 = create :redeem_request,points: 200, created_at: Date.today + 2.month, user: user\nend\n+ test \"should not redeem for others retailer if user total points is 0\" do\n+ user = create :user\n+ round_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\n+ round_transaction = create :transaction, points: 0, type: 'credit', transaction_type: 'Round', user: user\n+ redeem_request_1 = build :redeem_request, points: 0, address: 'baner', retailer: 'other', gift_product_url: Faker::Internet.url, user: user\n+ redeem_request_1.valid?\n+ assert_not_empty redeem_request_1.errors[:gift_product_url]\n+ assert_equal redeem_request_1.errors[:gift_product_url].first, \"insufficient balance. You have only 0 points in your account.\"\n+ end\nend\n\\ No newline at end of file\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Fixed Redemption issue for 'other' type retailer For 'other' type retailer redemption request is created even though user total points is 0.
332,099
20.03.2017 14:56:40
-19,080
f8bda39fb4c7c641aef5623c3fa2226b2e7f7415
refs Fixed show more link on the activities page
[ { "change_type": "MODIFY", "old_path": "app/assets/javascripts/activities.js", "new_path": "app/assets/javascripts/activities.js", "diff": "$(document).on('page:change', function(event) {\n+ initialize_shorten();\n+});\n+var initialize_shorten = function(){\n$(\".shorten_read\").shorten({\nshowChars: 100,\nmoreText: 'show more',\nlessText: 'show less'\n});\n-\n-});\n\\ No newline at end of file\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "app/views/activities/activities.js.erb", "new_path": "app/views/activities/activities.js.erb", "diff": "$('#activities').html(\"<%=j render 'activities_table' %>\");\n+initialize_shorten();\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
refs #266 Fixed show more link on the activities page
332,108
08.04.2017 01:52:40
-19,080
7619a2542add2740f206fa686aa6100c33a20f72
minor fix: changed contact us icon
[ { "change_type": "MODIFY", "old_path": "app/views/application/_footer.html.haml", "new_path": "app/views/application/_footer.html.haml", "diff": "%a{:href => 'http://joshsoftware.com', target: '_blank'} JoshSoftware\n%span.contact\n%a{:href => \"mailto:info@codecuriosity.org?Subject=CodeCuriosity%20Feedback\", :target => \"_top\", style: \" float: right; position: relative; left: -30%; font-weight: bold;\"}\n- %i.fa.fa-phone-square\n+ %i.fa.fa-envelope-square\n%span Contact Us\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
minor fix: changed contact us icon
332,103
17.04.2017 17:03:17
-19,080
58414b0c70f55134fc7458fdc002ab6618224ec9
== already return boolean refactored code as `==` already returns bool no need to explicitly use ternary operator. Also remove extra variable as it not use more that one.
[ { "change_type": "MODIFY", "old_path": "app/controllers/admin/ignored_files_controller.rb", "new_path": "app/controllers/admin/ignored_files_controller.rb", "diff": "@@ -63,10 +63,7 @@ class Admin::IgnoredFilesController < ApplicationController\ndef update_ignore_field\n@ignored_file = FileToBeIgnored.where(id: params[:ignored_file_id]).first\n-\n- ignored_params = (params[:ignored_value] == \"true\") ? true : false\n-\n- @ignored_file.update_attributes(ignored: ignored_params)\n+ @ignored_file.update_attributes(ignored: params[:ignored_value] == \"true\")\nend\nprivate\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
== already return boolean refactored code as `==` already returns bool no need to explicitly use ternary operator. Also remove extra variable as it not use more that one.
332,092
13.06.2017 20:39:43
-19,080
4bd8e53d01a48410e9f0f16c76863f333955075c
Retries job after 5 minutes if exception is raised
[ { "change_type": "MODIFY", "old_path": "app/jobs/activity_job.rb", "new_path": "app/jobs/activity_job.rb", "diff": "@@ -22,11 +22,11 @@ class ActivityJob < ActiveJob::Base\n# Refresh the gh_client because it's using a stale auth_token.\n# Here we use the App auth_token instead of user auth_token\nuser.refresh_gh_client\n- retry\n+ retry_job wait: 5.minutes\nrescue Github::Error::Forbidden\n# Probably hit the Rate-limit, use another token\nuser.refresh_gh_client\n- retry\n+ retry_job wait: 5.minutes\nend\nend\nend\n" }, { "change_type": "MODIFY", "old_path": "app/jobs/commit_job.rb", "new_path": "app/jobs/commit_job.rb", "diff": "@@ -20,11 +20,11 @@ class CommitJob < ActiveJob::Base\n# Refresh the gh_client because it's using a stale auth_token.\nuser.refresh_gh_client\n- retry\n+ retry_job wait: 5.minutes\nrescue Github::Error::Forbidden\n# Probably hit the Rate-limit, use another token\nuser.refresh_gh_client\n- retry\n+ retry_job wait: 5.minutes\nend\nend\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Retries job after 5 minutes if exception is raised
332,092
14.06.2017 17:06:09
-19,080
4c03e73176ac29afe7e78ba7ded70a4503ea4f64
Retries the failed job for a specific no of attempts
[ { "change_type": "MODIFY", "old_path": "Gemfile.lock", "new_path": "Gemfile.lock", "diff": "@@ -439,4 +439,4 @@ RUBY VERSION\nruby 2.3.0p0\nBUNDLED WITH\n- 1.13.6\n+ 1.15.1\n" }, { "change_type": "MODIFY", "old_path": "app/jobs/activity_job.rb", "new_path": "app/jobs/activity_job.rb", "diff": "class ActivityJob < ActiveJob::Base\n+ include ActiveJobRetriesCount\nqueue_as :git\ndef perform(user, duration, round = nil)\n@@ -22,11 +23,11 @@ class ActivityJob < ActiveJob::Base\n# Refresh the gh_client because it's using a stale auth_token.\n# Here we use the App auth_token instead of user auth_token\nuser.refresh_gh_client\n- retry_job wait: 5.minutes\n+ retry_job wait: 5.minutes if retries_count < MAX_RETRY_COUNT\nrescue Github::Error::Forbidden\n# Probably hit the Rate-limit, use another token\nuser.refresh_gh_client\n- retry_job wait: 5.minutes\n+ retry_job wait: 5.minutes if retries_count < MAX_RETRY_COUNT\nend\nend\nend\n" }, { "change_type": "MODIFY", "old_path": "app/jobs/commit_job.rb", "new_path": "app/jobs/commit_job.rb", "diff": "class CommitJob < ActiveJob::Base\n+ include ActiveJobRetriesCount\nqueue_as :git\ndef fetch_commits(repo, user, round, duration)\n@@ -20,11 +21,11 @@ class CommitJob < ActiveJob::Base\n# Refresh the gh_client because it's using a stale auth_token.\nuser.refresh_gh_client\n- retry_job wait: 5.minutes\n+ retry_job wait: 5.minutes if @retries_count < MAX_RETRY_COUNT\nrescue Github::Error::Forbidden\n# Probably hit the Rate-limit, use another token\nuser.refresh_gh_client\n- retry_job wait: 5.minutes\n+ retry_job wait: 5.minutes if @retries_count < MAX_RETRY_COUNT\nend\nend\n" }, { "change_type": "ADD", "old_path": null, "new_path": "app/models/concerns/active_job_retries_count.rb", "diff": "+module ActiveJobRetriesCount\n+ extend ActiveSupport::Concern\n+ MAX_RETRY_COUNT = 5\n+\n+ included do\n+ attr_accessor :retries_count\n+ end\n+\n+ # define the activejob methods to increment the retry count during failed retries of a job\n+ def initialize(*arguments)\n+ super\n+ @retries_count ||= 0\n+ end\n+\n+ def deserialize(job_data)\n+ super\n+ @retries_count = job_data['retries_count'] || 0\n+ end\n+\n+ def serialize\n+ super.merge('retries_count' => retries_count || 0)\n+ end\n+\n+ def retry_job(options)\n+ @retries_count = (retries_count || 0) + 1\n+ super(options)\n+ end\n+end\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "config/initializers/deserialize_job.rb", "diff": "+# Overrides the deserialize method to pass retry count during subsequent retries of failed job\n+if ActiveJob::Base.method_defined?(:deserialize)\n+ fail 'This no longer needed.'\n+else\n+ module ActiveJob\n+ class Base\n+ def self.deserialize(job_data)\n+ job = job_data['job_class'].constantize.new\n+ job.deserialize(job_data)\n+ job\n+ end\n+\n+ def deserialize(job_data)\n+ self.job_id = job_data['job_id']\n+ self.queue_name = job_data['queue_name']\n+ self.serialized_arguments = job_data['arguments']\n+ end\n+ end\n+ end\n+end\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Retries the failed job for a specific no of attempts
332,092
16.06.2017 10:39:41
-19,080
54678d7d3fe0553533429c25c8c0888233d73da4
Schedules rake task to delete large repositories Runs the rake task once in 3 days to delete large repositories which are cloned into project directory.
[ { "change_type": "MODIFY", "old_path": "config/code_curiosity_config.yml", "new_path": "config/code_curiosity_config.yml", "diff": "@@ -14,6 +14,7 @@ round:\nrepository:\npopular:\nstars: 25\n+ max_size: 50\nuser:\n:royalty_points_threshold: 50_000\n@@ -46,3 +47,4 @@ redeem:\n- amazon.com\n- amazon.in\n- amazon.uk\n+\n" }, { "change_type": "MODIFY", "old_path": "config/schedule.rb", "new_path": "config/schedule.rb", "diff": "@@ -53,3 +53,7 @@ every '1 10 7 * *' do\nrake 'subscription:redeem_points'\nend\n+every 3.day, :at => '10:30am' do\n+ rake 'repo:delete_large_repositories'\n+end\n+\n" }, { "change_type": "ADD", "old_path": null, "new_path": "lib/tasks/repo.rake", "diff": "+require 'find'\n+\n+namespace :repo do\n+ desc \"Delete the cloned repositories having size greater than SIZE_LIMIT MB\"\n+ task delete_large_repositories: :environment do\n+ repos = Dir.entries(Rails.root.join(SCORING_ENGINE_CONFIG[:repositories]).to_s) - ['.','..']\n+ repos.each do |repo|\n+ total_size = 0\n+\n+ repo_path = Rails.root.join(SCORING_ENGINE_CONFIG[:repositories]+\"/\"+repo)\n+ Find.find(repo_path) do |path|\n+ begin\n+ if FileTest.directory?(path)\n+ if File.basename(path)[0] == ?.\n+ Find.prune\n+ else\n+ next\n+ end\n+ else\n+ total_size += FileTest.size(path)\n+ end\n+ rescue\n+ total_size += 0\n+ end\n+ end\n+ FileUtils.rm_r(repo_path) if (total_size/1024000.0).round > REPOSITORY_CONFIG['max_size']\n+ end\n+ end\n+\n+end\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Schedules rake task to delete large repositories Runs the rake task once in 3 days to delete large repositories which are cloned into project directory.
332,094
20.06.2017 09:27:03
-36,000
a8b477fbe7db6a28955957c0f2f9d60fd194f1d0
Use Unicode point for TM instead of ASCII Github renders using Unicode, so switch to using the Unicode codepoint for the "Trademark" symbol rather than the ASCII version that renders to the replacement character when mapped to Unicode
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "**What can be measured, can be improved!**\n-Everyone knows that running is a great exercise. However, by using a wearable like the Fitbit&#0153; to measure your activity, it has motivated people to run regularly.\n+Everyone knows that running is a great exercise. However, by using a wearable like the Fitbit&#8482; to measure your activity, it has motivated people to run regularly.\n-## CodeCuriosity aims to be the Fitbit&#0153; for open-source contributions\n+## CodeCuriosity aims to be the Fitbit&#8482; for open-source contributions\nCode Curiosity is a platform to encourage open source contribution, build a cohesive and collaborative open source community and reward open source contributors across the world. It measures open-source contributions (code commits, issues and comments) and gives points that can be redeemed against Github or Amazon Gift Cards!\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Use Unicode point for TM instead of ASCII Github renders using Unicode, so switch to using the Unicode codepoint for the "Trademark" symbol rather than the ASCII version that renders to the replacement character when mapped to Unicode
332,092
28.06.2017 11:50:16
-19,080
6c15775d7e3860c29ad6e870c8d30ff81f8c22dc
Adds sidekiq logger statements in every job
[ { "change_type": "MODIFY", "old_path": "app/jobs/activity_job.rb", "new_path": "app/jobs/activity_job.rb", "diff": "@@ -4,19 +4,23 @@ class ActivityJob < ActiveJob::Base\ndef perform(user, duration, round = nil)\nround = Round.opened unless round\n-\n+ Sidekiq.logger.info \"******************* Activity Job Logger Info ***********************\"\nif round\nduration = 'all' if user.created_at > (Time.now - 24.hours)\nbegin\n+ Sidekiq.logger.info \"Fetching activities of user #{user.github_handle}, Current Round: from #{round.from_date}, Duration: #{duration}\"\nActivitiesFetcher.new(user, round).fetch(duration.to_sym)\nrescue Github::Error::NotFound\n# This user does not exist.. ignore and complete the job.\n+ Sidekiq.logger.info \"Raised Github::Error::Notfound Exception\"\n{}\nrescue Github::Error::Unauthorized\n# Auth token issue or Access has been denied.\n# Reset the auth_token, so that it gets refereshed the next time\n# user logs in.\n+ Sidekiq.logger.info \"Raised Github::Error::Unauthorized Exception\"\n+\nuser.auth_token = nil\nuser.save\n@@ -26,6 +30,7 @@ class ActivityJob < ActiveJob::Base\nretry_job wait: 5.minutes if retries_count < MAX_RETRY_COUNT\nrescue Github::Error::Forbidden\n# Probably hit the Rate-limit, use another token\n+ Sidekiq.logger.info \"Raised Github::Error::Forbidden Exception\"\nuser.refresh_gh_client\nretry_job wait: 5.minutes if retries_count < MAX_RETRY_COUNT\nend\n" }, { "change_type": "MODIFY", "old_path": "app/jobs/commit_job.rb", "new_path": "app/jobs/commit_job.rb", "diff": "@@ -3,19 +3,25 @@ class CommitJob < ActiveJob::Base\nqueue_as :git\ndef fetch_commits(repo, user, round, duration)\n+ Sidekiq.logger.info \"************************ Commit Job Logger Info **************************\"\n+ Sidekiq.logger.info \"Fetching commits of repository: #{repo.name} and owner: #{repo.owner}, User: #{user.github_handle}, Current Round: from #{round.from_date}, Duration: #{duration}\"\n+\nbegin\nCommitsFetcher.new(repo, user, round).fetch(duration.to_sym)\nrescue Github::Error::NotFound\n# repository moved or deleted means we no longer care about this repos.\n+ Sidekiq.logger.info \"Raised Github::Error::NotFound Exception\"\nrepo.destroy\nrescue Github::Error::UnavailableForLegalReasons\n# repository permission invoked.\n+ Sidekiq.logger.info \"Raised Github::Error::UnavailableForLegalReasons Exception\"\nrepo.destroy\nrescue Github::Error::Unauthorized\n# Auth token issue or Access has been denied OR Rate limit hit.\n# Reset the auth_token, so that it gets refereshed the next time\n# user logs in.\n+ Sidekiq.logger.info \"Raised Github::Error::Unauthorized Exception\"\nuser.auth_token = nil\nuser.save\n@@ -24,6 +30,7 @@ class CommitJob < ActiveJob::Base\nretry_job wait: 5.minutes if @retries_count < MAX_RETRY_COUNT\nrescue Github::Error::Forbidden\n# Probably hit the Rate-limit, use another token\n+ Sidekiq.logger.info \"Raised Github::Error::Forbidden Exception\"\nuser.refresh_gh_client\nretry_job wait: 5.minutes if @retries_count < MAX_RETRY_COUNT\nend\n" }, { "change_type": "MODIFY", "old_path": "app/jobs/scoring_job.rb", "new_path": "app/jobs/scoring_job.rb", "diff": "@@ -2,6 +2,8 @@ class ScoringJob < ActiveJob::Base\nqueue_as :git\ndef perform(repository, round, type)\n+ Sidekiq.logger.info \"******************* Logger Info for Scoring Job **************************\"\n+ Sidekiq.logger.info \"Scoring for Repository: #{repository.name}, User: #{repository.owner}, Current Round: from #{round.from_date}, Type: #{type}\"\nif type == 'commits'\nrepository.score_commits(round)\nelsif type == 'activities'\n" }, { "change_type": "MODIFY", "old_path": "app/jobs/user_repos_job.rb", "new_path": "app/jobs/user_repos_job.rb", "diff": "@@ -12,6 +12,9 @@ class UserReposJob < ActiveJob::Base\nuser.set(last_repo_sync_at: Time.now)\n@user = user\n+ Sidekiq.logger.info \"************************* UserReposJob Logger Info ***************************\"\n+ Sidekiq.logger.info \"Syncing repositories of #{user.github_handle}\"\n+\ngh_repos = user.fetch_all_github_repos\ngh_repos.each do |gh_repo|\n@@ -23,6 +26,10 @@ class UserReposJob < ActiveJob::Base\n#check if the repository is not soft deleted and\nrepo = Repository.unscoped.where(gh_id: gh_repo.id).first\n+ Sidekiq.logger.info \"Repository name: #{gh_repo.name}, Repository owner: #{gh_repo.owner.login}, Stars: #{gh_repo.stargazers_count}, Forked: #{gh_repo.fork}\"\n+\n+ Sidekiq.logger.info \"Repository already exists\" if repo\n+\nif repo\n# Commenting the fuctionality since rails 4.2 has an issue with accessing soft deleted parent association. Refer rails issue#10643.\n=begin\n@@ -40,6 +47,7 @@ class UserReposJob < ActiveJob::Base\nrepo.set(stars: repo.info.stargazers_count)\nend\n=end\n+ Sidekiq.logger.info \"Repository does not include this user... Adding user\" unless repo.users.include?(user)\nrepo.users << user unless repo.users.include?(user)\nreturn\nend\n@@ -49,6 +57,7 @@ class UserReposJob < ActiveJob::Base\nif repo.stars >= REPOSITORY_CONFIG['popular']['stars']\nuser.repositories << repo\nuser.save\n+ Sidekiq.logger.info \"Repository #{repo.name} persisted successfully for #{user.github_handle}\"\nreturn\nend\n@@ -59,5 +68,7 @@ class UserReposJob < ActiveJob::Base\nrepo.source_gh_id = repo.info.source.id\nuser.repositories << repo\nuser.save\n+ Sidekiq.logger.info \"Persisted popular repository #{repo.name} for user #{user.github_handle\n+ }\"\nend\nend\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Adds sidekiq logger statements in every job
332,092
28.06.2017 12:10:57
-19,080
c57fd56e200412a51c55e9c07671fc3dc9eccafa
Minor fix in scoring engine
[ { "change_type": "MODIFY", "old_path": "app/models/scoring_engine.rb", "new_path": "app/models/scoring_engine.rb", "diff": "@@ -85,7 +85,7 @@ class ScoringEngine\n# get the current git branch incase the commit is not found in any of the branches.\n# remotes/origin/skip-merge-branch-commit-scoring\n- branch = git.branch(branch).name\n+ branch = get_current_git_branch(branch)\n#get the latest commits for the branch\ngit = fetch_repo(branch)\n@@ -164,4 +164,18 @@ class ScoringEngine\nreturn [score.round, config[:max_score]].min\nend\n+ # If there is error while getting current git branch retry 3 times and then delete the repo directory and clone again\n+ def get_current_git_branch(branch)\n+ tries ||= 3\n+ begin\n+ branch = git.branch(branch).name\n+ rescue\n+ retry unless (tries -= 1).zero?\n+ #delete repo directory and clone again\n+ FileUtils.rm_r(\"#{Rails.root.join(config[:repositories]).to_s}/#{repo.id}\")\n+ self.git = Git.clone(\"https://github.com/#{repo.owner}/#{repo.name}.git\", repo.id, path: Rails.root.join(config[:repositories]).to_s)\n+ branch = git.branch(branch).name\n+ end\n+ end\n+\nend\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Minor fix in scoring engine
332,092
28.06.2017 18:45:24
-19,080
86ce1db080c260f2fc6c39b0c3d8a7cb8460006a
Minor changes to fix ActiveJob DeserializationError passes the id instead of the whole object
[ { "change_type": "MODIFY", "old_path": "app/jobs/scoring_job.rb", "new_path": "app/jobs/scoring_job.rb", "diff": "class ScoringJob < ActiveJob::Base\nqueue_as :git\n- def perform(repository, round, type)\n+ def perform(repository_id, round_id, type)\n+ repository = Repository.find(repository_id)\n+ round = Round.find(round_id)\n+\nSidekiq.logger.info \"******************* Logger Info for Scoring Job **************************\"\nSidekiq.logger.info \"Scoring for Repository: #{repository.name}, User: #{repository.owner}, Current Round: from #{round.from_date}, Type: #{type}\"\n+\nif type == 'commits'\nrepository.score_commits(round)\nelsif type == 'activities'\n" }, { "change_type": "MODIFY", "old_path": "app/models/scoring_engine.rb", "new_path": "app/models/scoring_engine.rb", "diff": "@@ -16,6 +16,8 @@ class ScoringEngine\n# that repository has no master!\n# Rollbar#14\nself.git = Git.open(repo_dir)\n+ Sidekiq.logger.info \"#{self.git}\"\n+ Sidekiq.logger.info \"#{self.git.branch}\"\nself.git.fetch\n#gets the current repository branch. usually, is master.\nbranch = self.git.branches.local.first.name unless branch\n" }, { "change_type": "MODIFY", "old_path": "lib/tasks/auto_score.rake", "new_path": "lib/tasks/auto_score.rake", "diff": "@@ -4,11 +4,11 @@ task :auto_score, [:round] => :environment do |t, args|\ncommits_repo_ids = Commit.where(auto_score: nil, round: round).distinct(:repository_id)\nRepository.find(commits_repo_ids).each do |repo|\n- ScoringJob.perform_later(repo, round, 'commits')\n+ ScoringJob.perform_later(repo.id.to_s, round.id.to_s, 'commits')\nend\nactivities_repo_ids = Activity.where(auto_score: nil, round: round).distinct(:repository_id)\nRepository.find(activities_repo_ids).each do |repo|\n- ScoringJob.perform_later(repo, round, 'activities')\n+ ScoringJob.perform_later(repo.id.to_s, round.id.to_s, 'activities')\nend\nend\n" }, { "change_type": "MODIFY", "old_path": "test/jobs/scoring_job_test.rb", "new_path": "test/jobs/scoring_job_test.rb", "diff": "@@ -16,9 +16,9 @@ class ScoringJobTest < ActiveJob::TestCase\nend\ntest 'perform' do\n- ScoringJob.perform_later(@repo, @round, 'commits')\n+ ScoringJob.perform_later(@repo.id.to_s, @round.id.to_s, 'commits')\nassert_enqueued_jobs 1\n- ScoringJob.perform_later(@repo, @round, 'activities')\n+ ScoringJob.perform_later(@repo.id.to_s, @round.id.to_s, 'activities')\nassert_enqueued_jobs 2\nend\n@@ -28,7 +28,7 @@ class ScoringJobTest < ActiveJob::TestCase\ncreate :commit, user: @user, repository: @repo, message: 'random message', commit_date: Time.now, auto_score: nil\ncreate :commit, user: @user, repository: @repo, message: 'some message', commit_date: Time.now, auto_score: nil\nassert_equal 3, @repo.commits.count\n- ScoringJob.perform_now(@repo, @round, 'commits')\n+ ScoringJob.perform_now(@repo.id.to_s, @round.id.to_s, 'commits')\n@repo.reload\n@repo.commits.each do |commit|\nrefute_nil commit.auto_score\n@@ -39,7 +39,7 @@ class ScoringJobTest < ActiveJob::TestCase\nmessage = 'some title and description of the issue'\ncreate_list(:activity, 3, description: message, event_type: 'issue', event_action: 'opened', auto_score: nil, user: @user)\nassert_equal 3, @user.activities_count\n- ScoringJob.perform_now(@repo, @round, 'activities')\n+ ScoringJob.perform_now(@repo.id.to_s, @round.id.to_s, 'activities')\n@repo.activities.each do |activity|\nrefute_nil activity.auto_score\nend\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Minor changes to fix ActiveJob DeserializationError passes the id instead of the whole object
332,092
29.06.2017 17:12:14
-19,080
20856ec511e03b56fea508bf5dcaa73ab02a43a5
Passes id of instead of whole object to CommitJob minor fix to handle deserialization error while executing job
[ { "change_type": "MODIFY", "old_path": "app/controllers/repositories_controller.rb", "new_path": "app/controllers/repositories_controller.rb", "diff": "@@ -37,7 +37,7 @@ class RepositoriesController < ApplicationController\ndef sync\nunless current_user.gh_data_syncing?\n- CommitJob.perform_later(current_user, 'all', @repo)\n+ CommitJob.perform_later(current_user.id.to_s, 'all', @repo.id.to_s)\nend\nflash[:notice] = I18n.t('repositories.github_sync')\n" }, { "change_type": "MODIFY", "old_path": "app/controllers/users_controller.rb", "new_path": "app/controllers/users_controller.rb", "diff": "@@ -19,7 +19,7 @@ class UsersController < ApplicationController\ndef sync\nunless current_user.gh_data_syncing?\n- CommitJob.perform_later(current_user, 'all')\n+ CommitJob.perform_later(current_user.id.to_s, 'all')\nActivityJob.perform_later(current_user, 'all')\nend\nend\n" }, { "change_type": "MODIFY", "old_path": "app/jobs/commit_job.rb", "new_path": "app/jobs/commit_job.rb", "diff": "@@ -36,17 +36,23 @@ class CommitJob < ActiveJob::Base\nend\nend\n- def perform(user, duration, repo = nil, round = nil)\n- round = Round.opened unless round\n+ def perform(user_id, duration, repo_id = nil, round_id = nil)\n+ if round_id\n+ round = Round.find(round_id)\n+ else\n+ round = Round.opened\n+ end\n+ user = User.find(user_id)\nduration = 'all' if user.created_at > (Time.now - 24.hours)\nuser.set(last_gh_data_sync_at: Time.now)\n- if repo\n+ if repo_id\n+ repo = Repository.find(repo_id)\nfetch_commits(repo, user, round, duration)\nelse\nuser.repositories.each do |repo|\n- CommitJob.perform_later(user, duration, repo)\n+ CommitJob.perform_later(user.id.to_s, duration, repo.id.to_s)\nend\nend\nend\n" }, { "change_type": "MODIFY", "old_path": "lib/tasks/fetch_data.rake", "new_path": "lib/tasks/fetch_data.rake", "diff": "@@ -12,7 +12,7 @@ namespace :fetch_data do\n#CommitJob.perform_later(user, type)\nuser.repositories.each do |repo|\n- CommitJob.perform_later(user, type, repo)\n+ CommitJob.perform_later(user.id.to_s, type, repo.id.to_s)\nend\nActivityJob.perform_later(user, type)\n@@ -30,7 +30,7 @@ namespace :fetch_data do\nuser = User.find(subscription.user_id)\nuser.repositories.each do |repo|\n- CommitJob.perform_later(user, type, repo, round)\n+ CommitJob.perform_later(user.id.to_s, type, repo.id.to_s, round.id.to_s)\nend\nActivityJob.perform_later(user, type, round)\nend\n" }, { "change_type": "MODIFY", "old_path": "lib/tasks/utils.rake", "new_path": "lib/tasks/utils.rake", "diff": "@@ -52,7 +52,7 @@ namespace :utils do\ngroup.members.each do |user|\nUserReposJob.perform_later(user)\nuser.repositories.each do |repo|\n- CommitJob.perform_later(user, type, repo, round)\n+ CommitJob.perform_later(user.id.to_s, type, repo.id.to_s, round.id.to_s)\nend\nActivityJob.perform_later(user, type, round)\nend\n" }, { "change_type": "MODIFY", "old_path": "test/jobs/commit_job_test.rb", "new_path": "test/jobs/commit_job_test.rb", "diff": "@@ -17,17 +17,17 @@ class CommitJobTest < ActiveJob::TestCase\nend\ntest 'perform' do\n- CommitJob.perform_later(@user)\n+ CommitJob.perform_later(@user.id.to_s)\nassert_enqueued_jobs 1\n- CommitJob.perform_later(@user, 'all')\n+ CommitJob.perform_later(@user.id.to_s, 'all')\nassert_enqueued_jobs 2\n- CommitJob.perform_later(@user, 'all', @repo, @round)\n+ CommitJob.perform_later(@user.id.to_s, 'all', @repo.id.to_s, @round.id.to_s)\nassert_enqueued_jobs 3\nend\ntest 'perform with Github::Error::UnavailableForLegalReasons exception' do\nCommitsFetcher.any_instance.stubs(:fetch).with(:all).raises(Github::Error::UnavailableForLegalReasons, {})\n- CommitJob.perform_now(@user, 'all', @repo, @round)\n+ CommitJob.perform_now(@user.id.to_s, 'all', @repo.id.to_s, @round.id.to_s)\n@user.reload\nrefute_nil @user.auth_token\nassert_equal 0, @user.repositories.count\n@@ -36,7 +36,7 @@ class CommitJobTest < ActiveJob::TestCase\ntest 'perform with Github::Error::NotFound exception' do\nCommitsFetcher.any_instance.stubs(:fetch).with(:all).raises(Github::Error::NotFound, {})\n- CommitJob.perform_now(@user, 'all', @repo, @round)\n+ CommitJob.perform_now(@user.id.to_s, 'all', @repo.id.to_s, @round.id.to_s)\n@user.reload\nrefute_nil @user.auth_token\nassert_equal 0, @user.repositories.count\n@@ -47,7 +47,7 @@ class CommitJobTest < ActiveJob::TestCase\nskip 'Need to figure out how to test infinite retries'\nCommitsFetcher.any_instance.stubs(:fetch).with(:all).raises(Github::Error::Unauthorized, {})\nUser.any_instance.stubs(:refresh_gh_client).returns(true)\n- CommitJob.perform_now(@user, 'all', @repo, @round)\n+ CommitJob.perform_now(@user.id.to_s, 'all', @repo.id.to_s, @round.id.to_s)\n@user.reload\nassert_nil @user.auth_token\nend\n@@ -56,7 +56,7 @@ class CommitJobTest < ActiveJob::TestCase\nskip 'Need to figure out how to test infinite retries'\nCommitsFetcher.any_instance.stubs(:fetch).with(:all).raises(Github::Error::Forbidden, {})\nUser.any_instance.stubs(:refresh_gh_client).returns(true)\n- CommitJob.perform_now(@user, 'all', @repo, @round)\n+ CommitJob.perform_now(@user.id.to_s, 'all', @repo.id.to_s, @round.id.to_s)\n@user.reload\nrefute_nil @user.auth_token\nend\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Passes id of instead of whole object to CommitJob minor fix to handle deserialization error while executing job
332,092
29.06.2017 17:15:44
-19,080
ed68b4bf1fc28595626964b859f2a93a57bc3799
Retries the job if mongo socket error is raised
[ { "change_type": "MODIFY", "old_path": "app/jobs/commit_job.rb", "new_path": "app/jobs/commit_job.rb", "diff": "@@ -33,6 +33,8 @@ class CommitJob < ActiveJob::Base\nSidekiq.logger.info \"Raised Github::Error::Forbidden Exception\"\nuser.refresh_gh_client\nretry_job wait: 5.minutes if @retries_count < MAX_RETRY_COUNT\n+ rescue Mongo::Error::SocketError\n+ retry_job wait: 5.minutes if @retries_count < MAX_RETRY_COUNT\nend\nend\n" }, { "change_type": "MODIFY", "old_path": "app/jobs/scoring_job.rb", "new_path": "app/jobs/scoring_job.rb", "diff": "class ScoringJob < ActiveJob::Base\n+ include ActiveJobRetriesCount\n+\nqueue_as :git\ndef perform(repository_id, round_id, type)\n@@ -7,11 +9,14 @@ class ScoringJob < ActiveJob::Base\nSidekiq.logger.info \"******************* Logger Info for Scoring Job **************************\"\nSidekiq.logger.info \"Scoring for Repository: #{repository.name}, User: #{repository.owner}, Current Round: from #{round.from_date}, Type: #{type}\"\n-\n+ begin\nif type == 'commits'\nrepository.score_commits(round)\nelsif type == 'activities'\nrepository.score_activities(round)\nend\n+ rescue Mongo::Error::SocketError\n+ retry_job wait: 5.minutes if @retries_count < MAX_RETRY_COUNT\n+ end\nend\nend\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Retries the job if mongo socket error is raised
332,092
29.06.2017 17:18:13
-19,080
5ca450b3f9e35f557ee0283c37063f5dc15fe102
Minor fix in scoring engine Handles GitExecuteError when tried to checkout the branch having uncommitted changes
[ { "change_type": "MODIFY", "old_path": "app/models/scoring_engine.rb", "new_path": "app/models/scoring_engine.rb", "diff": "@@ -18,13 +18,13 @@ class ScoringEngine\nself.git = Git.open(repo_dir)\nSidekiq.logger.info \"#{self.git}\"\nSidekiq.logger.info \"#{self.git.branch}\"\n+ begin\nself.git.fetch\n#gets the current repository branch. usually, is master.\nbranch = self.git.branches.local.first.name unless branch\n#checkout to the branch. if branch hasnt changed, checkout is redundant.\nself.git.checkout(branch)\nremote = self.git.config[\"branch.#{branch}.remote\"] # usually just 'origin'\n- begin\nself.git.pull(remote, branch)\nrescue Git::GitExecuteError\n#delete the repo dir and clone again\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Minor fix in scoring engine Handles GitExecuteError when tried to checkout the branch having uncommitted changes
332,092
30.06.2017 14:29:24
-19,080
c8d333b897d5c6a531fa0c1a98d3bd1193e5a1b8
Schedules rake task to delete large repositories daily Deletes the repositories greater than 100MB every day
[ { "change_type": "MODIFY", "old_path": "config/code_curiosity_config.yml", "new_path": "config/code_curiosity_config.yml", "diff": "@@ -14,7 +14,7 @@ round:\nrepository:\npopular:\nstars: 25\n- max_size: 50\n+ max_size: 100\nuser:\n:royalty_points_threshold: 50_000\n" }, { "change_type": "MODIFY", "old_path": "config/schedule.rb", "new_path": "config/schedule.rb", "diff": "@@ -53,7 +53,7 @@ every '1 10 7 * *' do\nrake 'subscription:redeem_points'\nend\n-every 3.day, :at => '10:30am' do\n+every :day, :at => '10:30am' do\nrake 'repo:delete_large_repositories'\nend\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Schedules rake task to delete large repositories daily Deletes the repositories greater than 100MB every day
332,092
30.06.2017 14:34:02
-19,080
e1786e85ffab7894b7031bec6029f05c75447340
Passes id to every job instead of whole object
[ { "change_type": "MODIFY", "old_path": "app/controllers/github/repos_controller.rb", "new_path": "app/controllers/github/repos_controller.rb", "diff": "@@ -3,7 +3,7 @@ class Github::ReposController < ApplicationController\ndef sync\nunless current_user.repo_syncing?\n- UserReposJob.perform_later(current_user)\n+ UserReposJob.perform_later(current_user.id.to_s)\nend\nend\nend\n" }, { "change_type": "MODIFY", "old_path": "app/controllers/users_controller.rb", "new_path": "app/controllers/users_controller.rb", "diff": "@@ -20,7 +20,7 @@ class UsersController < ApplicationController\ndef sync\nunless current_user.gh_data_syncing?\nCommitJob.perform_later(current_user.id.to_s, 'all')\n- ActivityJob.perform_later(current_user, 'all')\n+ ActivityJob.perform_later(current_user.id.to_s, 'all')\nend\nend\n" }, { "change_type": "MODIFY", "old_path": "app/jobs/activity_job.rb", "new_path": "app/jobs/activity_job.rb", "diff": "@@ -2,9 +2,17 @@ class ActivityJob < ActiveJob::Base\ninclude ActiveJobRetriesCount\nqueue_as :git\n- def perform(user, duration, round = nil)\n- round = Round.opened unless round\n+ def perform(user_id, duration, round_id = nil)\n+ if round_id\n+ round = Round.find(round_id)\n+ else\n+ round = Round.opened\n+ end\n+ binding.pry\n+ user = User.find(user_id)\n+\nSidekiq.logger.info \"******************* Activity Job Logger Info ***********************\"\n+\nif round\nduration = 'all' if user.created_at > (Time.now - 24.hours)\nbegin\n" }, { "change_type": "MODIFY", "old_path": "app/jobs/user_repos_job.rb", "new_path": "app/jobs/user_repos_job.rb", "diff": "@@ -7,7 +7,10 @@ class UserReposJob < ActiveJob::Base\nuser.set(last_repo_sync_at: nil) if user\nend\n- def perform(user)\n+ def perform(user_id)\n+\n+ user = User.find(user_id)\n+\nreturn if user.repo_syncing?\nuser.set(last_repo_sync_at: Time.now)\n@user = user\n" }, { "change_type": "MODIFY", "old_path": "app/models/user.rb", "new_path": "app/models/user.rb", "diff": "@@ -111,7 +111,7 @@ class User\ndef calculate_popularity\nself.subscribe_to_round\nUser.delay_for(2.second, queue: 'git').update_total_repos_stars(self.id.to_s)\n- UserReposJob.perform_later(self)\n+ UserReposJob.perform_later(self.id.to_s)\nend\ndef create_transaction(attrs = {})\n" }, { "change_type": "MODIFY", "old_path": "lib/tasks/fetch_data.rake", "new_path": "lib/tasks/fetch_data.rake", "diff": "@@ -15,7 +15,7 @@ namespace :fetch_data do\nCommitJob.perform_later(user.id.to_s, type, repo.id.to_s)\nend\n- ActivityJob.perform_later(user, type)\n+ ActivityJob.perform_later(user.id.to_s, type)\nend\nend\nend\n@@ -32,7 +32,7 @@ namespace :fetch_data do\nuser.repositories.each do |repo|\nCommitJob.perform_later(user.id.to_s, type, repo.id.to_s, round.id.to_s)\nend\n- ActivityJob.perform_later(user, type, round)\n+ ActivityJob.perform_later(user.id.to_s, type, round.id.to_s)\nend\nend\n@@ -43,7 +43,7 @@ namespace :fetch_data do\n0.step(users.count, per_batch) do |offset|\nusers.limit(per_batch).skip(offset).each do |user|\n- UserReposJob.perform_later(user)\n+ UserReposJob.perform_later(user.id.to_s)\nend\nend\nend\n" }, { "change_type": "MODIFY", "old_path": "lib/tasks/utils.rake", "new_path": "lib/tasks/utils.rake", "diff": "@@ -50,11 +50,11 @@ namespace :utils do\ntype = \"all\"\nround = Round.opened\ngroup.members.each do |user|\n- UserReposJob.perform_later(user)\n+ UserReposJob.perform_later(user.id.to_s)\nuser.repositories.each do |repo|\nCommitJob.perform_later(user.id.to_s, type, repo.id.to_s, round.id.to_s)\nend\n- ActivityJob.perform_later(user, type, round)\n+ ActivityJob.perform_later(user.id.to_s, type, round.id.to_s)\nend\nend\nend\n" }, { "change_type": "MODIFY", "old_path": "test/jobs/activity_job_test.rb", "new_path": "test/jobs/activity_job_test.rb", "diff": "@@ -12,17 +12,17 @@ class ActivityJobTest < ActiveJob::TestCase\nend\ntest 'perform' do\n- ActivityJob.perform_later(@user)\n+ ActivityJob.perform_later(@user.id.to_s)\nassert_enqueued_jobs 1\n- ActivityJob.perform_later(@user, 'all')\n+ ActivityJob.perform_later(@user.id.to_s, 'all')\nassert_enqueued_jobs 2\n- ActivityJob.perform_later(@user, 'all', @round)\n+ ActivityJob.perform_later(@user.id.to_s, 'all', @round.id.to_s)\nassert_enqueued_jobs 3\nend\ntest 'perform with Github::Error::NotFound exception' do\nActivitiesFetcher.any_instance.stubs(:fetch).with(:all).raises(Github::Error::NotFound, {})\n- ActivityJob.perform_now(@user, 'all', @round)\n+ ActivityJob.perform_now(@user.id.to_s, 'all', @round.id.to_s)\n@user.reload\nrefute_nil @user.auth_token\nend\n@@ -31,7 +31,7 @@ class ActivityJobTest < ActiveJob::TestCase\nskip 'Need to figure out how to test infinite retries'\nUser.any_instance.stubs(:refresh_gh_client).returns(false)\nActivitiesFetcher.any_instance.stubs(:fetch).with(:all).raises(Github::Error::Unauthorized, {})\n- ActivityJob.perform_now(@user, 'all', @round)\n+ ActivityJob.perform_now(@user.id.to_s, 'all', @round.id.to_s)\n@user.reload\nassert_nil @user.auth_token\nend\n@@ -40,7 +40,7 @@ class ActivityJobTest < ActiveJob::TestCase\nskip 'Need to figure out how to test infinite retries'\nUser.any_instance.stubs(:refresh_gh_client).returns(false)\nActivitiesFetcher.any_instance.stubs(:fetch).with(:all).raises(Github::Error::Forbidden, {})\n- ActivityJob.perform_now(@user, 'all', @round)\n+ ActivityJob.perform_now(@user.id.to_s, 'all', @round.id.to_s)\n@user.reload\nrefute_nil @user.auth_token\nend\n" }, { "change_type": "MODIFY", "old_path": "test/jobs/user_repos_job_test.rb", "new_path": "test/jobs/user_repos_job_test.rb", "diff": "@@ -22,7 +22,7 @@ class UserReposJobTest < ActiveJob::TestCase\nend\ntest 'perform' do\n- UserReposJob.perform_later(@user)\n+ UserReposJob.perform_later(@user.id.to_s)\nassert_enqueued_jobs 1\nend\n@@ -30,7 +30,7 @@ class UserReposJobTest < ActiveJob::TestCase\nassert_nil @user.last_repo_sync_at\n@user.set(last_repo_sync_at: Time.now - 59.minutes)\n@user.expects(:fetch_all_github_repos).never\n- UserReposJob.perform_now(@user)\n+ UserReposJob.perform_now(@user.id.to_s)\nend\ntest \"skip if unpopular and not a fork\" do\n@@ -44,7 +44,7 @@ class UserReposJobTest < ActiveJob::TestCase\nheaders: {content_type: \"application/json; charset=utf-8\"}\n)\nassert_equal 0, Repository.count\n- UserReposJob.perform_now(@user)\n+ UserReposJob.perform_now(@user.id.to_s)\nassert_equal 0, Repository.count\nassert_equal 0, @user.repositories.count\nend\n@@ -63,7 +63,7 @@ class UserReposJobTest < ActiveJob::TestCase\nHashie::Mash.new(JSON.parse(File.read('test/fixtures/unpopular-remote.json')))\n)\nassert_equal 0, Repository.count\n- UserReposJob.perform_now(@user)\n+ UserReposJob.perform_now(@user.id.to_s)\nassert_equal 0, Repository.count\nassert_equal 0, @user.repositories.count\nend\n@@ -73,7 +73,7 @@ class UserReposJobTest < ActiveJob::TestCase\nJSON.parse(File.read('test/fixtures/user-popular-repos.json')).collect{|i| Hashie::Mash.new(i)}\n)\nassert_equal 0, Repository.count\n- UserReposJob.perform_now(@user)\n+ UserReposJob.perform_now(@user.id.to_s)\nassert_equal 1, Repository.count\nassert_equal 1, @user.repositories.count\nassert_equal 25, @user.repositories.first.stars\n@@ -84,7 +84,7 @@ class UserReposJobTest < ActiveJob::TestCase\nJSON.parse(File.read('test/fixtures/popular-repos-with-forks.json')).collect{|i| Hashie::Mash.new(i)}\n)\nassert_equal 0, Repository.count\n- UserReposJob.perform_now(@user)\n+ UserReposJob.perform_now(@user.id.to_s)\nassert_equal 1, Repository.count\nassert_equal 1, @user.repositories.count\nuser_repo = @user.repositories.first\n@@ -100,7 +100,7 @@ class UserReposJobTest < ActiveJob::TestCase\nHashie::Mash.new(JSON.parse(File.read('test/fixtures/user-fork-repo.json')))\n)\nassert_equal 0, Repository.count\n- UserReposJob.perform_now(@user)\n+ UserReposJob.perform_now(@user.id.to_s)\nassert_equal 2, Repository.count\nassert_equal 1, @user.repositories.count\nuser_repo = @user.repositories.first\n@@ -127,7 +127,7 @@ class UserReposJobTest < ActiveJob::TestCase\nassert_nil repo.deleted_at\nassert_equal 1, Repository.count\nassert_equal 26, repo.stars\n- UserReposJob.perform_now(@user)\n+ UserReposJob.perform_now(@user.id.to_s)\nrepo.reload\nrefute_nil repo.deleted_at\nassert repo.destroyed?\n@@ -154,7 +154,7 @@ class UserReposJobTest < ActiveJob::TestCase\nassert_equal 24, repo.stars\nassert_equal 0, Repository.count\nassert_equal 1, Repository.unscoped.count\n- UserReposJob.perform_now(@user)\n+ UserReposJob.perform_now(@user.id.to_s)\nrepo.reload\nrefute repo.destroyed?\nassert_nil repo.deleted_at\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Passes id to every job instead of whole object
332,092
30.06.2017 14:42:12
-19,080
4b69a861afe42a3481c6b9ed551e1bb7d2b1cdb1
Removed binding.pry statement
[ { "change_type": "MODIFY", "old_path": "app/jobs/activity_job.rb", "new_path": "app/jobs/activity_job.rb", "diff": "@@ -8,7 +8,7 @@ class ActivityJob < ActiveJob::Base\nelse\nround = Round.opened\nend\n- binding.pry\n+\nuser = User.find(user_id)\nSidekiq.logger.info \"******************* Activity Job Logger Info ***********************\"\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Removed binding.pry statement
332,092
30.06.2017 16:07:23
-19,080
72391eb226ec7a570feb6336a1ef24add0860eca
Fixes failure of UserReposJob testcases
[ { "change_type": "MODIFY", "old_path": "app/jobs/user_repos_job.rb", "new_path": "app/jobs/user_repos_job.rb", "diff": "@@ -8,7 +8,6 @@ class UserReposJob < ActiveJob::Base\nend\ndef perform(user_id)\n-\nuser = User.find(user_id)\nreturn if user.repo_syncing?\n" }, { "change_type": "MODIFY", "old_path": "test/jobs/user_repos_job_test.rb", "new_path": "test/jobs/user_repos_job_test.rb", "diff": "@@ -74,6 +74,7 @@ class UserReposJobTest < ActiveJob::TestCase\n)\nassert_equal 0, Repository.count\nUserReposJob.perform_now(@user.id.to_s)\n+ @user.reload\nassert_equal 1, Repository.count\nassert_equal 1, @user.repositories.count\nassert_equal 25, @user.repositories.first.stars\n@@ -85,6 +86,7 @@ class UserReposJobTest < ActiveJob::TestCase\n)\nassert_equal 0, Repository.count\nUserReposJob.perform_now(@user.id.to_s)\n+ @user.reload\nassert_equal 1, Repository.count\nassert_equal 1, @user.repositories.count\nuser_repo = @user.repositories.first\n@@ -101,6 +103,7 @@ class UserReposJobTest < ActiveJob::TestCase\n)\nassert_equal 0, Repository.count\nUserReposJob.perform_now(@user.id.to_s)\n+ @user.reload\nassert_equal 2, Repository.count\nassert_equal 1, @user.repositories.count\nuser_repo = @user.repositories.first\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Fixes failure of UserReposJob testcases
332,093
12.07.2017 15:14:56
-19,080
6a2b547f04c23a2dcf62a6668087ffcc7f384d12
One can download the Requests which are active and inactive A route added to redeem request with a method download in the controller to download requests in csv format.
[ { "change_type": "MODIFY", "old_path": "app/assets/stylesheets/admin/redeem_requests.scss", "new_path": "app/assets/stylesheets/admin/redeem_requests.scss", "diff": ".slide{\nfloat: right;\n}\n+\n+.btn-group{\n+ float: right;\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "app/controllers/admin/redeem_requests_controller.rb", "new_path": "app/controllers/admin/redeem_requests_controller.rb", "diff": "class Admin::RedeemRequestsController < ApplicationController\nbefore_action :authenticate_user!\nbefore_action :authenticate_admin!\n+ before_action :load_redeem_request, only: [:index, :download]\ndef index\n- #status(false) = status(Open)\n- #status(true) = status(Close)\n- @status = params[:status] ? params[:status] : false\n- @redeem_requests = RedeemRequest.where(:status => @status).desc(:created_at).page(params[:page])\n+ @redeem_requests = @redeem_requests.page(params[:page])\nif request.xhr?\nrespond_to do|format|\nformat.js\n@@ -30,10 +28,27 @@ class Admin::RedeemRequestsController < ApplicationController\nredirect_to admin_redeem_requests_path\nend\n+ def download\n+ csv_string = CSV.generate do |csv|\n+ csv << [\"user\",\"Gift Shop\", \"Store\",\"Points\",\"cost\",\"Date\",\"coupon Code\",\"Address\"]\n+ @redeem_requests.each do |redeem_request|\n+ csv << [redeem_request.user.email,redeem_request.retailer,redeem_request.store,redeem_request.points,redeem_request.points/10,redeem_request.updated_at,redeem_request.coupon_code,redeem_request.address]\n+ end\n+ end\n+ send_data csv_string,\n+ :type => 'text/csv; header=present;',\n+ :disposition => \"filename=requests.csv\"\n+ end\n+\nprivate\ndef redeem_params\nparams.fetch(:redeem_request).permit(:coupon_code, :comment, :points, :status)\nend\n+ def load_redeem_request\n+ @status = params[:status] ? params[:status] : false\n+ @redeem_requests = RedeemRequest.where(:status => @status).desc(:created_at)\n+ end\n+\nend\n" }, { "change_type": "MODIFY", "old_path": "app/views/admin/redeem_requests/_redeem_request.html.haml", "new_path": "app/views/admin/redeem_requests/_redeem_request.html.haml", "diff": "= redeem_request.retailer.upcase\n%td= redeem_request.store? ? redeem_request.store.upcase : \"NA\"\n%td= redeem_request.points\n+ %td= redeem_request.points/10\n%td= redeem_request.created_at.strftime('%D %T')\n%td= redeem_request.coupon_code\n%td= redeem_request.address\n" }, { "change_type": "MODIFY", "old_path": "app/views/admin/redeem_requests/_tagtable.html.haml", "new_path": "app/views/admin/redeem_requests/_tagtable.html.haml", "diff": "%th.col-xs-1 Gift Shop\n%th.col-xs-1 Store\n%th.col-xs-1 Points\n+ %th.col-xs-1 Cost($)\n%th.col-xs-2 Date\n%th.col-xs-2 Coupon Code\n%th.col-xs-1 Address\n" }, { "change_type": "MODIFY", "old_path": "app/views/admin/redeem_requests/index.html.haml", "new_path": "app/views/admin/redeem_requests/index.html.haml", "diff": "%label.slide\n%input.check#redeem{checked: 'checked', name: 'status', type: 'checkbox', data: {toggle: 'toggle', width: '100', height: '40', on: 'Status Open', off: 'Status Close'}}\n#console-event\n+ .btn-group\n+ %a.btn.btn-primary.glyphicon.glyphicon-download{:href => download_admin_redeem_requests_path(:status => \"false\")} Active\n+ %a.btn.btn-primary.glyphicon.glyphicon-download{:href => download_admin_redeem_requests_path(:status => \"true\") } Completed\n%section.content\n.row\n.col-xs-12\n" }, { "change_type": "MODIFY", "old_path": "config/application.rb", "new_path": "config/application.rb", "diff": "require File.expand_path('../boot', __FILE__)\n+require 'csv'\nrequire 'rails'\n# Pick the frameworks you want:\nrequire 'active_model/railtie'\n" }, { "change_type": "MODIFY", "old_path": "config/routes.rb", "new_path": "config/routes.rb", "diff": "@@ -51,7 +51,11 @@ Rails.application.routes.draw do\nget :mark_as_close\nend\n- resources :redeem_requests, only: [:index, :update, :destroy]\n+ resources :redeem_requests, only: [:index, :update, :destroy] do\n+ collection do\n+ get 'download'\n+ end\n+ end\nresources :ignored_files, except: [:show] do\nget :search, on: :collection\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
One can download the Requests which are active and inactive A route added to redeem request with a method download in the controller to download requests in csv format.
332,093
12.07.2017 16:15:53
-19,080
0b24b0aee57796c88d2bcebff75104e1d93ac02f
Display points into capital[#296] * Sum of all of Redemption Requests[#296] A helper method added to print the total capital value of redeemable points. * Sum of all Redemption Requests A helper method added to display the capital value of total redeemable points.
[ { "change_type": "MODIFY", "old_path": "app/controllers/admin/redeem_requests_controller.rb", "new_path": "app/controllers/admin/redeem_requests_controller.rb", "diff": "class Admin::RedeemRequestsController < ApplicationController\n+ include Admin::RedeemRequestsHelper\nbefore_action :authenticate_user!\nbefore_action :authenticate_admin!\n+\ndef index\n#status(false) = status(Open)\n#status(true) = status(Close)\n" }, { "change_type": "MODIFY", "old_path": "app/helpers/admin/redeem_requests_helper.rb", "new_path": "app/helpers/admin/redeem_requests_helper.rb", "diff": "module Admin::RedeemRequestsHelper\n+\n+ def total_capital_of_points\n+ RedeemRequest.where(status: false).sum(:points)/10\n+ end\n+\nend\n" }, { "change_type": "MODIFY", "old_path": "app/views/admin/redeem_requests/index.html.haml", "new_path": "app/views/admin/redeem_requests/index.html.haml", "diff": "%section.content-header\n%h1\nRedeem Requests\n+ %span.badge $ #{total_capital_of_points}\n%label.slide\n%input.check#redeem{checked: 'checked', name: 'status', type: 'checkbox', data: {toggle: 'toggle', width: '100', height: '40', on: 'Status Open', off: 'Status Close'}}\n#console-event\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Display points into capital[#296] (#300) * Sum of all of Redemption Requests[#296] A helper method added to print the total capital value of redeemable points. * Sum of all Redemption Requests [#296] A helper method added to display the capital value of total redeemable points.
332,093
12.07.2017 16:38:22
-19,080
2467b3b6587dacdce858a7815ed0abdb77648958
Data export in form of csv[#296]
[ { "change_type": "MODIFY", "old_path": "app/controllers/admin/redeem_requests_controller.rb", "new_path": "app/controllers/admin/redeem_requests_controller.rb", "diff": "@@ -32,7 +32,7 @@ class Admin::RedeemRequestsController < ApplicationController\ncsv_string = CSV.generate do |csv|\ncsv << [\"user\",\"Gift Shop\", \"Store\",\"Points\",\"cost\",\"Date\",\"coupon Code\",\"Address\"]\n@redeem_requests.each do |redeem_request|\n- csv << [redeem_request.user.email,redeem_request.retailer,redeem_request.store,redeem_request.points,redeem_request.points/10,redeem_request.updated_at,redeem_request.coupon_code,redeem_request.address]\n+ csv << [redeem_request.user.email,redeem_request.retailer,redeem_request.store,redeem_request.points,redeem_request.points/10,redeem_request.updated_at.strftime(fmt='%F %T'),redeem_request.coupon_code,redeem_request.address]\nend\nend\nsend_data csv_string,\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Data export in form of csv[#296]
332,092
13.07.2017 13:13:12
-19,080
3d39172064303cb25d400f85dbc823bd218f901f
Modifies the names of the sponsorship plans[#276]
[ { "change_type": "MODIFY", "old_path": "config/code_curiosity_config.yml", "new_path": "config/code_curiosity_config.yml", "diff": "@@ -22,12 +22,12 @@ user:\nsponsor:\nindividual:\nbasic: 10\n- intermediate: 15\n- advanced: 20\n+ silver: 15\n+ gold: 20\norganization:\nbasic: 150\n- intermediate: 200\n- advanced: 300\n+ silver: 200\n+ gold: 300\nscoring_engine:\n:repositories: 'repositories' # repositories dir\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Modifies the names of the sponsorship plans[#276]
332,093
17.07.2017 10:27:18
-19,080
d540e477f835207e8763239c3defec74c952294b
test written for redeem request helper method
[ { "change_type": "ADD", "old_path": null, "new_path": ".rake_tasks~", "diff": "+about\n+assets:clean[keep]\n+assets:clobber\n+assets:environment\n+assets:precompile\n+auto_score[round]\n+cache_digests:dependencies\n+cache_digests:nested_dependencies\n+db:drop\n+db:mongoid:create_indexes\n+db:mongoid:drop\n+db:mongoid:purge\n+db:mongoid:remove_indexes\n+db:mongoid:remove_undefined_indexes\n+db:purge\n+db:reset\n+db:seed\n+db:setup\n+doc:app\n+fetch_data:all_rounds\n+fetch_data:commits_and_activities[type]\n+fetch_data:github_user_since\n+fetch_data:sync_repos\n+log:clear\n+middleware\n+mongoid_slug:set\n+notes\n+notes:custom\n+paperclip:clean\n+paperclip:find_broken_attachments\n+paperclip:refresh\n+paperclip:refresh:metadata\n+paperclip:refresh:missing_styles\n+paperclip:refresh:thumbnails\n+rails:template\n+rails:update\n+repo:delete_large_repositories\n+rollbar:test\n+round:next\n+round:update_scores[round]\n+routes\n+secret\n+stats\n+subscription:redeem_points\n+subscription:send_email\n+subscription:send_progress_emails\n+test\n+test:all\n+test:all:db\n+test:db\n+time:zones:all\n+tmp:clear\n+tmp:create\n+utils:hackathon[group]\n+utils:remove_dublicate_repos\n+utils:restore_repositories\n+utils:update_user_redemed_points\n+utils:update_user_total_points\n" }, { "change_type": "MODIFY", "old_path": "test/helpers/admin/redeem_requests_helper_test.rb", "new_path": "test/helpers/admin/redeem_requests_helper_test.rb", "diff": "require \"test_helper\"\nclass Admin::RedeemRequestsHelperTest < ActionView::TestCase\n+\n+ test \"check worth of points\" do\n+ create_user\n+ redeem_request = create(:redeem_request,:points => 10, user: @user)\n+ assert_equal redeem_request.points/10, total_capital_of_points\n+ assert_kind_of Fixnum, total_capital_of_points, \"Must be a value\"\n+ end\n+\n+ def create_user\n+ round = create(:round, :status => 'open')\n+ role = create(:role, :name => 'Admin')\n+ @user = create(:user, goal: create(:goal))\n+ @user.roles << role\n+ transaction = create(:transaction, :type => 'credit', :points => 120, user: @user)\n+ end\n+\nend\n" }, { "change_type": "MODIFY", "old_path": "test/models/redeem_request_test.rb", "new_path": "test/models/redeem_request_test.rb", "diff": "@@ -5,6 +5,7 @@ class RedeemRequestTest < ActiveSupport::TestCase\ndef redeem_request\n@redeem_request ||= build(:redeem_request)\n+ binding.pry\nend\ntest \"validity of redeem_request\" do\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
test written for redeem request helper method
332,092
17.07.2017 13:45:21
-19,080
5717921c1d56cbdfebadfe4e0a2c79c96316b07d
Adds calculate_score for commit in begin rescue block
[ { "change_type": "MODIFY", "old_path": "app/models/repository.rb", "new_path": "app/models/repository.rb", "diff": "@@ -141,7 +141,12 @@ class Repository\nif commit.message =~ PULL_REQ_MERGE_REGX\ncommit.set(auto_score: 0)\nelse\n+ begin\n+ Sidekiq.logger.info \"Scoring for commit: #{commit.id}, Round: #{round.from_date}\"\ncommit.set(auto_score: engine.calculate_score(commit))\n+ rescue StandardError => e\n+ Sidekiq.logger.info \"Commit: #{commit.id}, Error: #{e}\"\n+ end\nend\nend\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Adds calculate_score for commit in begin rescue block
332,093
17.07.2017 18:49:32
-19,080
c138023a99b99e50e96a0c190acd30836d3c0eab
new field status is added to csv file download
[ { "change_type": "MODIFY", "old_path": "app/controllers/admin/redeem_requests_controller.rb", "new_path": "app/controllers/admin/redeem_requests_controller.rb", "diff": "@@ -32,9 +32,9 @@ class Admin::RedeemRequestsController < ApplicationController\ndef download\ncsv_string = CSV.generate do |csv|\n- csv << [\"user\",\"Gift Shop\", \"Store\",\"Points\",\"cost\",\"Date\",\"coupon Code\",\"Address\"]\n+ csv << [\"User\",\"Gift Shop\", \"Store\",\"Points\",\"Cost\",\"Date\",\"Coupon Code\",\"Address\",\"Status\"]\n@redeem_requests.each do |redeem_request|\n- csv << [redeem_request.user.email,redeem_request.retailer,redeem_request.store,redeem_request.points,redeem_request.points/10,redeem_request.updated_at.strftime(fmt='%F %T'),redeem_request.coupon_code,redeem_request.address]\n+ csv << [redeem_request.user.email,redeem_request.retailer,redeem_request.store,redeem_request.points,redeem_request.points/10,redeem_request.updated_at.strftime(fmt='%F %T'),redeem_request.coupon_code,redeem_request.address,redeem_request.status]\nend\nend\nsend_data csv_string,\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
new field status is added to csv file download
332,093
17.07.2017 18:49:45
-19,080
1b9c880d1c12ed213a02ed02f287cc209da95728
Test cases written for csv file download
[ { "change_type": "MODIFY", "old_path": "test/controllers/admin/redeem_requests_controller_test.rb", "new_path": "test/controllers/admin/redeem_requests_controller_test.rb", "diff": "@@ -81,6 +81,43 @@ class Admin::RedeemRequestsControllerTest < ActionController::TestCase\nassert_equal redeem_request.count, 3\nend\n+ test \"should generate a csv file\" do\n+ seed_data\n+ redeem_request = create(:redeem_request, :points => 100, user: @user)\n+ get :download, params: { :status => \"false\" }\n+ assert_response :success\n+ assert_equal \"text/csv; header = present;\", response.content_type\n+ get :download, params: { :status => \"true\" }\n+ assert_response :success\n+ assert_equal \"text/csv; header = present;\", response.content_type\n+ end\n+\n+ test \"check header of csv file\" do\n+ seed_data\n+ redeem_request = create(:redeem_request, :points => 100, user: @user)\n+ get :download, params: { :status => \"false\" } || { :status => \"true\" }\n+ assert_response :success\n+ attr = \"User,Gift Shop,Store,Points,Cost,Date,Coupon Code,Address,Status\".split(',')\n+ csv = CSV.parse response.body\n+ assert_equal csv[0],attr\n+ end\n+\n+ test \"check fields of csv file\" do\n+ seed_data\n+ gift_shop = [\"github\",\"amazon\",\"other\"]\n+ store = [nil,\"amazon.com\",\"amazon.in\",\"amazon.uk\"]\n+ status = [\"false\",\"true\"]\n+ redeem_request = create(:redeem_request, :points => 100, user: @user)\n+ get :download, params: { :status => \"false\" } || {:status => \"true\"}\n+ assert_response :success\n+ csv = CSV.parse response.body\n+ assert_includes gift_shop, csv[1][1]\n+ assert_includes store, csv[1][2]\n+ assert_kind_of Fixnum, csv[1][3].to_i\n+ assert_not_equal csv[1][3].to_i, csv[1][4].to_i\n+ assert_includes status, csv[1][8]\n+ end\n+\ndef seed_data\nround = create(:round, :status => 'open')\nrole = create(:role, :name => 'Admin')\n" }, { "change_type": "MODIFY", "old_path": "test/helpers/admin/redeem_requests_helper_test.rb", "new_path": "test/helpers/admin/redeem_requests_helper_test.rb", "diff": "@@ -3,13 +3,13 @@ require \"test_helper\"\nclass Admin::RedeemRequestsHelperTest < ActionView::TestCase\ntest \"check worth of points\" do\n- create_user\n- redeem_request = create(:redeem_request,:points => 10, user: @user)\n- assert_equal redeem_request.points/10, total_capital_of_points\n- assert_kind_of Fixnum, total_capital_of_points, \"Must be a value\"\n+ seed_data\n+ redeem_request = create(:redeem_request,:points => 100, user: @user)\n+ total_capital = redeem_request.points/10\n+ assert_equal total_capital, total_capital_of_points\nend\n- def create_user\n+ def seed_data\nround = create(:round, :status => 'open')\nrole = create(:role, :name => 'Admin')\n@user = create(:user, goal: create(:goal))\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Test cases written for csv file download
332,093
20.07.2017 14:30:57
-19,080
8a322069349a073015af9fe5494d30817233e143
unwanted files removed[#296]
[ { "change_type": "DELETE", "old_path": ".rake_tasks~", "new_path": null, "diff": "-about\n-assets:clean[keep]\n-assets:clobber\n-assets:environment\n-assets:precompile\n-auto_score[round]\n-cache_digests:dependencies\n-cache_digests:nested_dependencies\n-db:drop\n-db:mongoid:create_indexes\n-db:mongoid:drop\n-db:mongoid:purge\n-db:mongoid:remove_indexes\n-db:mongoid:remove_undefined_indexes\n-db:purge\n-db:reset\n-db:seed\n-db:setup\n-doc:app\n-fetch_data:all_rounds\n-fetch_data:commits_and_activities[type]\n-fetch_data:github_user_since\n-fetch_data:sync_repos\n-log:clear\n-middleware\n-mongoid_slug:set\n-notes\n-notes:custom\n-paperclip:clean\n-paperclip:find_broken_attachments\n-paperclip:refresh\n-paperclip:refresh:metadata\n-paperclip:refresh:missing_styles\n-paperclip:refresh:thumbnails\n-rails:template\n-rails:update\n-repo:delete_large_repositories\n-rollbar:test\n-round:next\n-round:update_scores[round]\n-routes\n-secret\n-stats\n-subscription:redeem_points\n-subscription:send_email\n-subscription:send_progress_emails\n-test\n-test:all\n-test:all:db\n-test:db\n-time:zones:all\n-tmp:clear\n-tmp:create\n-utils:hackathon[group]\n-utils:remove_dublicate_repos\n-utils:restore_repositories\n-utils:update_user_redemed_points\n-utils:update_user_total_points\n" }, { "change_type": "MODIFY", "old_path": "test/models/redeem_request_test.rb", "new_path": "test/models/redeem_request_test.rb", "diff": "@@ -5,7 +5,6 @@ class RedeemRequestTest < ActiveSupport::TestCase\ndef redeem_request\n@redeem_request ||= build(:redeem_request)\n- binding.pry\nend\ntest \"validity of redeem_request\" do\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
unwanted files removed[#296]
332,093
20.07.2017 14:35:14
-19,080
f70c9c6d073ec5c04fbabec1f8454020eaf7cbe4
Modifications are done as per conventional syntax and removed unwanted block of code
[ { "change_type": "MODIFY", "old_path": "app/assets/stylesheets/admin/redeem_requests.scss", "new_path": "app/assets/stylesheets/admin/redeem_requests.scss", "diff": "float: right;\n}\n-.btn-group{\n+.btn.btn-primary.glyphicon.glyphicon-download{\nfloat: right;\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "app/controllers/admin/redeem_requests_controller.rb", "new_path": "app/controllers/admin/redeem_requests_controller.rb", "diff": "@@ -37,9 +37,7 @@ class Admin::RedeemRequestsController < ApplicationController\ncsv << [redeem_request.user.email,redeem_request.retailer,redeem_request.store,redeem_request.points,redeem_request.points/10,redeem_request.updated_at.strftime(fmt='%F %T'),redeem_request.coupon_code,redeem_request.address,redeem_request.status]\nend\nend\n- send_data csv_string,\n- :type => 'text/csv; header = present;',\n- :disposition => \"filename = requests.csv\"\n+ send_data csv_string, type: 'text/csv; header = present;', disposition: \"filename = requests.csv\"\nend\nprivate\n" }, { "change_type": "ADD", "old_path": null, "new_path": "app/helpers/admin/repositories_helper.rb", "diff": "+module Admin::RepositoriesHelper\n+\n+ def check_boolean(str)\n+ str == \"true\"\n+ end\n+end\n" }, { "change_type": "MODIFY", "old_path": "app/views/admin/redeem_requests/index.html.haml", "new_path": "app/views/admin/redeem_requests/index.html.haml", "diff": "%label.slide\n%input.check#redeem{checked: 'checked', name: 'status', type: 'checkbox', data: {toggle: 'toggle', width: '100', height: '40', on: 'Status Open', off: 'Status Close'}}\n#console-event\n- .btn-group\n- %a.btn.btn-primary.glyphicon.glyphicon-download{:href => download_admin_redeem_requests_path(:status => \"false\")} Active\n- %a.btn.btn-primary.glyphicon.glyphicon-download{:href => download_admin_redeem_requests_path(:status => \"true\") } Completed\n+ = link_to download_admin_redeem_requests_path(:status => \"true\"), class: \"btn btn-primary glyphicon glyphicon-download\" do\n+ %b Completed\n+ = link_to download_admin_redeem_requests_path(:status => \"false\"), class: \"btn btn-primary glyphicon glyphicon-download\" do\n+ %b Active\n+\n%section.content\n.row\n.col-xs-12\n" }, { "change_type": "MODIFY", "old_path": "config/routes.rb", "new_path": "config/routes.rb", "diff": "@@ -62,7 +62,7 @@ Rails.application.routes.draw do\nresources :redeem_requests, only: [:index, :update, :destroy] do\ncollection do\n- get 'download'\n+ get :download\nend\nend\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/helpers/admin/repositories_helper_test.rb", "diff": "+require \"test_helper\"\n+\n+class Admin::RepositoriesHelperTest < ActionView::TestCase\n+\n+ test \"should return true of string true and vice versa\" do\n+ assert_equal check_boolean(\"true\"), true\n+ assert_equal check_boolean(\"false\"), false\n+ end\n+\n+ def test_sanity\n+ flunk \"Need real tests\"\n+ end\n+end\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Modifications are done as per conventional syntax and removed unwanted block of code
332,093
20.07.2017 19:01:39
-19,080
204c2044d668629e9a9a3004c9e12ec8fbc430c9
Updated files as per comments
[ { "change_type": "MODIFY", "old_path": "app/controllers/admin/redeem_requests_controller.rb", "new_path": "app/controllers/admin/redeem_requests_controller.rb", "diff": "@@ -34,7 +34,10 @@ class Admin::RedeemRequestsController < ApplicationController\ncsv_string = CSV.generate do |csv|\ncsv << [\"User\", \"Gift Shop\", \"Store\", \"Points\", \"Cost\", \"Date\", \"Coupon Code\", \"Address\", \"Status\"]\n@redeem_requests.each do |redeem_request|\n- csv << [redeem_request.user.email,redeem_request.retailer,redeem_request.store,redeem_request.points,redeem_request.points/10,redeem_request.updated_at.strftime(fmt='%F %T'),redeem_request.coupon_code,redeem_request.address,redeem_request.status]\n+ csv << [redeem_request.user.email, redeem_request.retailer, redeem_request.store,\n+ redeem_request.points, redeem_request.points/10,\n+ redeem_request.updated_at.strftime(fmt='%F %T'), redeem_request.coupon_code,\n+ redeem_request.address, redeem_request.status]\nend\nend\nsend_data csv_string, type: 'text/csv; header = present;', disposition: \"filename = requests.csv\"\n@@ -47,8 +50,8 @@ class Admin::RedeemRequestsController < ApplicationController\nend\ndef load_redeem_request\n- @status = params[:status] ? params[:status] : false\n- @redeem_requests = RedeemRequest.where(:status => @status).desc(:created_at)\n+ @status = params[:status] || false\n+ @redeem_requests = RedeemRequest.where(status: @status).desc(:created_at)\nend\nend\n" }, { "change_type": "DELETE", "old_path": "app/helpers/admin/repositories_helper.rb", "new_path": null, "diff": "-module Admin::RepositoriesHelper\n-\n- def check_boolean(str)\n- str == \"true\"\n- end\n-end\n" }, { "change_type": "MODIFY", "old_path": "test/controllers/admin/redeem_requests_controller_test.rb", "new_path": "test/controllers/admin/redeem_requests_controller_test.rb", "diff": "@@ -92,23 +92,49 @@ class Admin::RedeemRequestsControllerTest < ActionController::TestCase\nassert_equal \"text/csv; header = present;\", response.content_type\nend\n- test \"check header of csv file\" do\n+ test \"check header of csv file for status false\" do\nseed_data\nredeem_request = create(:redeem_request, :points => 100, user: @user)\n- get :download, params: { :status => \"false\" } || { :status => \"true\" }\n+ get :download, params: { :status => \"false\" }\nassert_response :success\nattr = \"User,Gift Shop,Store,Points,Cost,Date,Coupon Code,Address,Status\".split(',')\ncsv = CSV.parse response.body\nassert_equal csv[0],attr\nend\n- test \"check fields of csv file\" do\n+ test \"check header of csv file for status true\" do\n+ seed_data\n+ redeem_request = create(:redeem_request, :points => 100, user: @user)\n+ get :download, params: { :status => \"true\" }\n+ assert_response :success\n+ attr = \"User,Gift Shop,Store,Points,Cost,Date,Coupon Code,Address,Status\".split(',')\n+ csv = CSV.parse response.body\n+ assert_equal csv[0],attr\n+ end\n+\n+ test \"check fields of csv file for status true\" do\n+ seed_data\n+ gift_shop = [\"github\",\"amazon\",\"other\"]\n+ store = [nil,\"amazon.com\",\"amazon.in\",\"amazon.uk\"]\n+ status = [\"false\",\"true\"]\n+ redeem_request = create(:redeem_request, :points => 100, user: @user)\n+ get :download, params: { :status => \"true\" }\n+ assert_response :success\n+ csv = CSV.parse response.body\n+ assert_includes gift_shop, csv[1][1]\n+ assert_includes store, csv[1][2]\n+ assert_kind_of Fixnum, csv[1][3].to_i\n+ assert_not_equal csv[1][3].to_i, csv[1][4].to_i\n+ assert_includes status, csv[1][8]\n+ end\n+\n+ test \"check fields of csv file for status false\" do\nseed_data\ngift_shop = [\"github\",\"amazon\",\"other\"]\nstore = [nil,\"amazon.com\",\"amazon.in\",\"amazon.uk\"]\nstatus = [\"false\",\"true\"]\nredeem_request = create(:redeem_request, :points => 100, user: @user)\n- get :download, params: { :status => \"false\" } || {:status => \"true\"}\n+ get :download, params: {:status => \"false\"}\nassert_response :success\ncsv = CSV.parse response.body\nassert_includes gift_shop, csv[1][1]\n" }, { "change_type": "DELETE", "old_path": "test/helpers/admin/repositories_helper_test.rb", "new_path": null, "diff": "-require \"test_helper\"\n-\n-class Admin::RepositoriesHelperTest < ActionView::TestCase\n-\n- test \"should return true of string true and vice versa\" do\n- assert_equal check_boolean(\"true\"), true\n- assert_equal check_boolean(\"false\"), false\n- end\n-\n- def test_sanity\n- flunk \"Need real tests\"\n- end\n-end\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Updated files as per comments
332,093
24.07.2017 17:43:16
-19,080
83d81e42250a5000ad775ecc43c52bc6b7116c90
constant value replaced with initializers constant
[ { "change_type": "MODIFY", "old_path": "app/controllers/admin/redeem_requests_controller.rb", "new_path": "app/controllers/admin/redeem_requests_controller.rb", "diff": "@@ -35,7 +35,7 @@ class Admin::RedeemRequestsController < ApplicationController\ncsv << [\"User\", \"Gift Shop\", \"Store\", \"Points\", \"Cost\", \"Date\", \"Coupon Code\", \"Address\", \"Status\"]\n@redeem_requests.each do |redeem_request|\ncsv << [redeem_request.user.email, redeem_request.retailer, redeem_request.store,\n- redeem_request.points, redeem_request.points/10,\n+ redeem_request.points, redeem_request.points/REDEEM['one_dollar_to_points'],\nredeem_request.updated_at.strftime(fmt='%F %T'), redeem_request.coupon_code,\nredeem_request.address, redeem_request.status]\nend\n" }, { "change_type": "MODIFY", "old_path": "app/helpers/admin/redeem_requests_helper.rb", "new_path": "app/helpers/admin/redeem_requests_helper.rb", "diff": "module Admin::RedeemRequestsHelper\ndef total_capital_of_points\n- RedeemRequest.where(status: false).sum(:points)/10\n+ RedeemRequest.where(status: false).sum(:points)/REDEEM['one_dollar_to_points']\nend\nend\n" }, { "change_type": "MODIFY", "old_path": "config/mongoid.yml", "new_path": "config/mongoid.yml", "diff": "@@ -5,7 +5,7 @@ development:\ndefault:\n# Defines the name of the default database that Mongoid can connect to.\n# (required).\n- database: code_curiosity_development\n+ database: code_curiosity_dev\n# Provides the hosts the default client can connect to. Must be an array\n# of host:port pairs. (required)\nhosts:\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
constant value replaced with initializers constant
332,093
26.07.2017 15:06:43
-19,080
317b2495498a97e72d5c9a3858baf75cbc320ec4
rescue when Github doesn't returns commit
[ { "change_type": "MODIFY", "old_path": "app/models/scoring_engine.rb", "new_path": "app/models/scoring_engine.rb", "diff": "@@ -120,8 +120,15 @@ class ScoringEngine\n#Here total_changes specifies how many lines has been changed(added/deleted) per file, but should not\n# include changes of ignored_files for this commit\n+ begin\n+ # If Github doesn't returns commit info if commit has been moved.\n+ files = commit.info.files\n+ rescue StandardError => e\n+ Sidekiq.logger.info \"Absent commit: #{commit.id}, Error: #{e}\"\n+ files = []\n+ end\n- total_score = commit.info.files.inject(0) do |result, file|\n+ total_score = files.inject(0) do |result, file|\nfile_name = bugspots_scores[file.filename]\nfile_exist = FileToBeIgnored.name_exist?(file.filename)\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
rescue when Github doesn't returns commit
332,093
28.07.2017 10:34:20
-19,080
4247f3abb17f3a2f61fd7fe2657e345759f51fed
Admin can filter redemptions requests by stores. A dropdown menu added at the redeem request page using which admin can filter redeem requests by various stores.
[ { "change_type": "MODIFY", "old_path": "app/assets/javascripts/admin/redeem_requests.js", "new_path": "app/assets/javascripts/admin/redeem_requests.js", "diff": "@@ -35,6 +35,7 @@ $(document).on('page:change', function(event) {\n})\n-\n-\n+ $(\"a.closeDropdown\").on( \"click\", function() {\n+ $(\"#store\").dropdown(\"toggle\");\n+ })\n});\n" }, { "change_type": "MODIFY", "old_path": "app/controllers/admin/redeem_requests_controller.rb", "new_path": "app/controllers/admin/redeem_requests_controller.rb", "diff": "@@ -4,8 +4,8 @@ class Admin::RedeemRequestsController < ApplicationController\nbefore_action :authenticate_admin!\nbefore_action :load_redeem_request, only: [:index, :download]\n-\ndef index\n+ @redeem_requests = @redeem_requests.where(store: params[:store]) if REDEEM['amazon_stores'].include?(params[:store])\n@redeem_requests = @redeem_requests.page(params[:page])\nif request.xhr?\nrespond_to do|format|\n" }, { "change_type": "MODIFY", "old_path": "app/helpers/admin/redeem_requests_helper.rb", "new_path": "app/helpers/admin/redeem_requests_helper.rb", "diff": "@@ -4,4 +4,8 @@ module Admin::RedeemRequestsHelper\nRedeemRequest.where(status: false).sum(:points)/REDEEM['one_dollar_to_points']\nend\n+ def capital_by_store(store)\n+ RedeemRequest.where(status: false, store: store).sum(:points)/REDEEM['one_dollar_to_points']\n+ end\n+\nend\n" }, { "change_type": "MODIFY", "old_path": "app/views/admin/redeem_requests/index.html.haml", "new_path": "app/views/admin/redeem_requests/index.html.haml", "diff": "%h1\nRedeem Requests\n%span.badge $ #{total_capital_of_points}\n+ %span.dropdown\n+ %button.btn.btn-default.dropdown-toggle#store{\"data-toggle\" => \"dropdown\", type: \"button\"} By Store\n+ %ul.dropdown-menu\n+ - REDEEM['amazon_stores'].each do |store|\n+ %li\n+ =link_to \"#{store} $#{capital_by_store(store)}\", admin_redeem_requests_path(store: store), class: 'closeDropdown', remote: true\n+ %li\n+ =link_to \"All\", admin_redeem_requests_path, class: 'closeDropdown', remote: true\n+\n%label.slide\n%input.check#redeem{checked: 'checked', name: 'status', type: 'checkbox', data: {toggle: 'toggle', width: '100', height: '40', on: 'Status Open', off: 'Status Close'}}\n#console-event\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Admin can filter redemptions requests by stores. A dropdown menu added at the redeem request page using which admin can filter redeem requests by various stores.
332,093
28.07.2017 12:12:14
-19,080
49fd0900c8149e22743918746de1e3260a79f206
Test cases for store filter added
[ { "change_type": "MODIFY", "old_path": "test/controllers/admin/redeem_requests_controller_test.rb", "new_path": "test/controllers/admin/redeem_requests_controller_test.rb", "diff": "@@ -144,6 +144,13 @@ class Admin::RedeemRequestsControllerTest < ActionController::TestCase\nassert_includes status, csv[1][8]\nend\n+ test \"must get redeem requests with a specific store\" do\n+ seed_data\n+ redeem_request = create(:redeem_request,points: 10, store: 'amazon.in', user: @user)\n+ xhr :get, :index, parameters, format: :js, store: 'amazon.in'\n+ assert_response :success\n+ end\n+\ndef seed_data\nround = create(:round, :status => 'open')\nrole = create(:role, :name => 'Admin')\n" }, { "change_type": "MODIFY", "old_path": "test/helpers/admin/redeem_requests_helper_test.rb", "new_path": "test/helpers/admin/redeem_requests_helper_test.rb", "diff": "@@ -5,10 +5,31 @@ class Admin::RedeemRequestsHelperTest < ActionView::TestCase\ntest \"check worth of points\" do\nseed_data\nredeem_request = create(:redeem_request,:points => 100, user: @user)\n- total_capital = redeem_request.points/10\n+ total_capital = redeem_request.points/REDEEM['one_dollar_to_points']\nassert_equal total_capital, total_capital_of_points\nend\n+ test \"check value of points if store is amazon.in\" do\n+ seed_data\n+ create(:redeem_request, points: 50, user: @user, store: 'amazon.in')\n+ create(:redeem_request, points: 50, user: @user, store: 'amazon.uk')\n+ assert_equal RedeemRequest.where(store: 'amazon.in').sum(:points)/REDEEM['one_dollar_to_points'], capital_by_store('amazon.in')\n+ end\n+\n+ test \"check value of points if store is amazon.com\" do\n+ seed_data\n+ create(:redeem_request, points: 20, user: @user, store: 'amazon.in')\n+ create(:redeem_request, points: 10, user: @user, store: 'amazon.uk')\n+ assert_equal capital_by_store('amazon.com'), RedeemRequest.where(store: 'amazon.com').sum(:points)/REDEEM['one_dollar_to_points']\n+ end\n+\n+ test \"check value of points if store is amazon.uk\" do\n+ seed_data\n+ create(:redeem_request, points: 80, user: @user, store: 'amazon.in')\n+ create(:redeem_request, points: 50, user: @user, store: 'amazon.uk')\n+ assert_equal capital_by_store('amazon.uk'), RedeemRequest.where(store: 'amazon.uk').sum(:points)/REDEEM['one_dollar_to_points']\n+ end\n+\ndef seed_data\nround = create(:round, :status => 'open')\nrole = create(:role, :name => 'Admin')\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Test cases for store filter added
332,093
28.07.2017 17:04:00
-19,080
6a27d4d5a5accaf79de2a08e5881f440a24571b9
test case added for redeem request contoller index method
[ { "change_type": "MODIFY", "old_path": "test/controllers/admin/redeem_requests_controller_test.rb", "new_path": "test/controllers/admin/redeem_requests_controller_test.rb", "diff": "@@ -144,11 +144,18 @@ class Admin::RedeemRequestsControllerTest < ActionController::TestCase\nassert_includes status, csv[1][8]\nend\n- test \"must get redeem requests with a specific store\" do\n+ test \"must get redeem requests for specified store\" do\nseed_data\n- redeem_request = create(:redeem_request,points: 10, store: 'amazon.in', user: @user)\n- xhr :get, :index, parameters, format: :js, store: 'amazon.in'\n- assert_response :success\n+ redeem_request = create(:redeem_request, points: 10, status: false, store: 'amazon.in', user: @user)\n+ xhr :get, :index, format: :js, store: 'amazon.in', status: false\n+ assert_includes assigns(:redeem_requests), redeem_request\n+ end\n+\n+ test \"must not get redeem requests for unspecified store\" do\n+ seed_data\n+ redeem_request = create(:redeem_request, points: 10, status: false, store: 'amazon.in', user: @user)\n+ xhr :get, :index, format: :js, store: 'amazon.com', status: false\n+ assert_not_includes assigns(:redeem_requests), redeem_request\nend\ndef seed_data\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
test case added for redeem request contoller index method
332,109
02.08.2017 00:22:58
-19,080
8b5e6b9de57005160f84eb5193dd03b378f666d6
Added some test cases. Added he benefits details on the home page.
[ { "change_type": "MODIFY", "old_path": "app/views/home/_sponsorer_benefits.html.haml", "new_path": "app/views/home/_sponsorer_benefits.html.haml", "diff": ".box-header\n%h2 Be a Sponsorer\n.box-body\n- .col-xs-12.col-sm-6.col-md-5.col-md-offset-1\n+ - INFO['benefits'].keys.each do |key|\n+ .col-xs-12.col-sm-4.col-md-4\n%ul.false.g-green.goals\n%li\n- %big Individual\n+ %big #{key.camelize}\n%li.desc\n- Benefits\n%ul\n+ - INFO['benefits'][key].each do |stmt|\n+ %li #{stmt}\n+ - unless key == 'free'\n%li\n- %h4 Something goes here like placeholder\n- %li\n- %strong Something goes here like placeholder\n- %li Something goes here like placeholder\n- %li.redeem\n- %li\n- %h4 Something goes here like placeholder\n- %li\n- %strong Something goes here like placeholder\n- %li Something goes here like placeholder\n- %li\n- = link_to(\"Sponsor\", omniauth_authorize_path(:user, :github, user: 'Individual'), class: \"btn btn-lg btn-success\")\n- .col-xs-12.col-sm-6.col-md-5.col-md-offset-1\n- %ul.false.g-green.goals\n- %li\n- %big Organization\n- %li.desc\n- Benefits\n- %ul\n- %li Something goes here like placeholder\n- %li Something goes here like placeholder\n- %li Something goes here like placeholder\n- %li Something goes here like placeholder\n- %li.redeem\n- %li\n- = link_to(\"Sponsor\", omniauth_authorize_path(:user, :github, user: 'Organization'), class: \"btn btn-lg btn-success\")\n+ = link_to(\"Sponsor\", omniauth_authorize_path(:user, :github, user: key.camelize), class: \"btn btn-lg btn-success\")\n" }, { "change_type": "MODIFY", "old_path": "test/models/sponsorer_detail_test.rb", "new_path": "test/models/sponsorer_detail_test.rb", "diff": "@@ -69,6 +69,23 @@ class SponsorerDetailTest < ActiveSupport::TestCase\nassert user.roles.where(name: 'Sponsorer').any?\nend\n+ test 'save_payment_details should create the payment record and reset the user points' do\n+ round = create :round, :open\n+ user = create :user, github_user_since: Date.today - 6.months, created_at: Date.today - 3.months, points: 500\n+ create(:subscription, round: round, user: user)\n+ sponsorer_detail = create(:sponsorer_detail, user: user)\n+ assert_equal 0, sponsorer_detail.payments.count\n+ assert_equal 0, user.transactions.count\n+ assert_equal 500, user.reload.points\n+ plan = stripe_helper.create_plan(amount: 15000, name: 'base', id: 'base-organization', interval: 'month', currency: 'usd')\n+ sponsorer_detail.save_payment_details(plan, 10000, Time.now - 2.days)\n+ assert_equal 1, sponsorer_detail.payments.count\n+ assert_equal 2, user.transactions.count\n+ assert_equal 1, user.transactions.where(points: 500, transaction_type: 'royalty_bonus', type: 'credit').count\n+ assert_equal 1, user.transactions.where(points: -500, transaction_type: 'redeem_points', type: 'debit').count\n+ assert_equal 0, user.reload.points\n+ end\n+\ntest \"must save a new sponsorer with all params\" do\nassert_difference 'SponsorerDetail.count' do\ncreate(:sponsorer_detail)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/models/stripe_response_handler_test.rb", "diff": "+require \"test_helper\"\n+require 'stripe_mock'\n+\n+class SponsorerDetailTest < ActiveSupport::TestCase\n+ def stripe_helper\n+ StripeMock.create_test_helper\n+ end\n+\n+ def setup\n+ StripeMock.start\n+ end\n+\n+ def teardown\n+ StripeMock.stop\n+ end\n+\n+ test 'when customer subscription is created then the subscription should be marked as active'\n+\n+ test 'when invoice payment is succeeded then payment should be recorded'\n+\n+ test 'invoice payment is failed'\n+\n+ test 'customer subscription is updated'\n+\n+ test 'customer source is created'\n+\n+ test 'customer subscription is deleted'\n+\n+ def seed\n+ @round = create :round, :open\n+ @user = create :user, github_user_since: Date.today - 6.months, created_at: Date.today - 3.months, points: 500\n+ @subscription = create(:subscription, round: @round, user: @user)\n+ @sponsorer_detail = create(:sponsorer_detail, user: @user, sponsorer_type: 'INDIVIDUAL', payment_plan: 'base', publish_profile: false,\n+ subscription_status: :active)\n+ end\n+\n+ def customer_source_created\n+ {\"id\"=>\"evt_1AlymIGqILdnjs8fTuB2jZyc\", \"object\"=>\"event\", \"api_version\"=>\"2017-06-05\", \"created\"=>1501587790, \"data\"=>{\"object\"=>{\"id\"=>\"card_1AlymDGqILdnjs8f6sfzAJWG\", \"object\"=>\"card\", \"address_city\"=>nil, \"address_country\"=>nil, \"address_line1\"=>nil, \"address_line1_check\"=>nil, \"address_line2\"=>nil, \"address_state\"=>nil, \"address_zip\"=>nil, \"address_zip_check\"=>nil, \"brand\"=>\"Visa\", \"country\"=>\"US\", \"customer\"=>\"cus_B8FGyBhfnriWh4\", \"cvc_check\"=>\"pass\", \"dynamic_last4\"=>nil, \"exp_month\"=>11, \"exp_year\"=>2017, \"fingerprint\"=>\"1oChGpr7hqkTQHQd\", \"funding\"=>\"unknown\", \"last4\"=>\"1111\", \"metadata\"=>{}, \"name\"=>\"prasadsurase@gmail.com\", \"tokenization_method\"=>nil}}, \"livemode\"=>false, \"pending_webhooks\"=>1, \"request\"=>{\"id\"=>\"req_CinokJIyaPDBr4\", \"idempotency_key\"=>nil}, \"type\"=>\"customer.source.created\", \"stripe\"=>{\"id\"=>\"evt_1AlymIGqILdnjs8fTuB2jZyc\", \"object\"=>\"event\", \"api_version\"=>\"2017-06-05\", \"created\"=>1501587790, \"data\"=>{\"object\"=>{\"id\"=>\"card_1AlymDGqILdnjs8f6sfzAJWG\", \"object\"=>\"card\", \"address_city\"=>nil, \"address_country\"=>nil, \"address_line1\"=>nil, \"address_line1_check\"=>nil, \"address_line2\"=>nil, \"address_state\"=>nil, \"address_zip\"=>nil, \"address_zip_check\"=>nil, \"brand\"=>\"Visa\", \"country\"=>\"US\", \"customer\"=>\"cus_B8FGyBhfnriWh4\", \"cvc_check\"=>\"pass\", \"dynamic_last4\"=>nil, \"exp_month\"=>11, \"exp_year\"=>2017, \"fingerprint\"=>\"1oChGpr7hqkTQHQd\", \"funding\"=>\"unknown\", \"last4\"=>\"1111\", \"metadata\"=>{}, \"name\"=>\"prasadsurase@gmail.com\", \"tokenization_method\"=>nil}}, \"livemode\"=>false, \"pending_webhooks\"=>1, \"request\"=>{\"id\"=>\"req_CinokJIyaPDBr4\", \"idempotency_key\"=>nil}, \"type\"=>\"customer.source.created\"}}\n+ end\n+\n+ def customer_subscription_created\n+ {\"id\"=>\"evt_1Alz3JGqILdnjs8faluZCAAR\", \"object\"=>\"event\", \"api_version\"=>\"2017-06-05\", \"created\"=>1501588845, \"data\"=>{\"object\"=>{\"id\"=>\"sub_B8FYBs14j5V68B\", \"object\"=>\"subscription\", \"application_fee_percent\"=>nil, \"cancel_at_period_end\"=>false, \"canceled_at\"=>nil, \"created\"=>1501588845, \"current_period_end\"=>1504267245, \"current_period_start\"=>1501588845, \"customer\"=>\"cus_B8FYWV40hC3GiY\", \"discount\"=>nil, \"ended_at\"=>nil, \"items\"=>{\"object\"=>\"list\", \"data\"=>[{\"id\"=>\"si_1Alz3JGqILdnjs8fF77QHTBo\", \"object\"=>\"subscription_item\", \"created\"=>1501588845, \"metadata\"=>{}, \"plan\"=>{\"id\"=>\"base-individual\", \"object\"=>\"plan\", \"amount\"=>500, \"created\"=>1501046028, \"currency\"=>\"usd\", \"interval\"=>\"month\", \"interval_count\"=>1, \"livemode\"=>false, \"metadata\"=>{}, \"name\"=>\"Base Individual\", \"statement_descriptor\"=>nil, \"trial_period_days\"=>nil}, \"quantity\"=>1}], \"has_more\"=>false, \"total_count\"=>1, \"url\"=>\"/v1/subscription_items?subscription=sub_B8FYBs14j5V68B\"}, \"livemode\"=>false, \"metadata\"=>{}, \"plan\"=>{\"id\"=>\"base-individual\", \"object\"=>\"plan\", \"amount\"=>500, \"created\"=>1501046028, \"currency\"=>\"usd\", \"interval\"=>\"month\", \"interval_count\"=>1, \"livemode\"=>false, \"metadata\"=>{}, \"name\"=>\"Base Individual\", \"statement_descriptor\"=>nil, \"trial_period_days\"=>nil}, \"quantity\"=>1, \"start\"=>1501588845, \"status\"=>\"active\", \"tax_percent\"=>nil, \"trial_end\"=>nil, \"trial_start\"=>nil}}, \"livemode\"=>false, \"pending_webhooks\"=>1, \"request\"=>{\"id\"=>\"req_m9WdsNZaZ0GMFU\", \"idempotency_key\"=>nil}, \"type\"=>\"customer.subscription.created\", \"stripe\"=>{\"id\"=>\"evt_1Alz3JGqILdnjs8faluZCAAR\", \"object\"=>\"event\", \"api_version\"=>\"2017-06-05\", \"created\"=>1501588845, \"data\"=>{\"object\"=>{\"id\"=>\"sub_B8FYBs14j5V68B\", \"object\"=>\"subscription\", \"application_fee_percent\"=>nil, \"cancel_at_period_end\"=>false, \"canceled_at\"=>nil, \"created\"=>1501588845, \"current_period_end\"=>1504267245, \"current_period_start\"=>1501588845, \"customer\"=>\"cus_B8FYWV40hC3GiY\", \"discount\"=>nil, \"ended_at\"=>nil, \"items\"=>{\"object\"=>\"list\", \"data\"=>[{\"id\"=>\"si_1Alz3JGqILdnjs8fF77QHTBo\", \"object\"=>\"subscription_item\", \"created\"=>1501588845, \"metadata\"=>{}, \"plan\"=>{\"id\"=>\"base-individual\", \"object\"=>\"plan\", \"amount\"=>500, \"created\"=>1501046028, \"currency\"=>\"usd\", \"interval\"=>\"month\", \"interval_count\"=>1, \"livemode\"=>false, \"metadata\"=>{}, \"name\"=>\"Base Individual\", \"statement_descriptor\"=>nil, \"trial_period_days\"=>nil}, \"quantity\"=>1}], \"has_more\"=>false, \"total_count\"=>1, \"url\"=>\"/v1/subscription_items?subscription=sub_B8FYBs14j5V68B\"}, \"livemode\"=>false, \"metadata\"=>{}, \"plan\"=>{\"id\"=>\"base-individual\", \"object\"=>\"plan\", \"amount\"=>500, \"created\"=>1501046028, \"currency\"=>\"usd\", \"interval\"=>\"month\", \"interval_count\"=>1, \"livemode\"=>false, \"metadata\"=>{}, \"name\"=>\"Base Individual\", \"statement_descriptor\"=>nil, \"trial_period_days\"=>nil}, \"quantity\"=>1, \"start\"=>1501588845, \"status\"=>\"active\", \"tax_percent\"=>nil, \"trial_end\"=>nil, \"trial_start\"=>nil}}, \"livemode\"=>false, \"pending_webhooks\"=>1, \"request\"=>{\"id\"=>\"req_m9WdsNZaZ0GMFU\", \"idempotency_key\"=>nil}, \"type\"=>\"customer.subscription.created\"}}\n+ end\n+\n+ def customer_subscription_deleted\n+ {\"id\"=>\"evt_1Alx9TGqILdnjs8ftVzs8Ty8\", \"object\"=>\"event\", \"api_version\"=>\"2017-06-05\", \"created\"=>1501581539, \"data\"=>{\"object\"=>{\"id\"=>\"sub_B8DWoDWDKYe4UV\", \"object\"=>\"subscription\", \"application_fee_percent\"=>nil, \"cancel_at_period_end\"=>false, \"canceled_at\"=>1501581539, \"created\"=>1501581289, \"current_period_end\"=>1504259689, \"current_period_start\"=>1501581289, \"customer\"=>\"cus_B8DWx1uqPpBmoP\", \"discount\"=>nil, \"ended_at\"=>1501581539, \"items\"=>{\"object\"=>\"list\", \"data\"=>[{\"id\"=>\"si_1Alx5RGqILdnjs8f3TqFTLT1\", \"object\"=>\"subscription_item\", \"created\"=>1501581289, \"metadata\"=>{}, \"plan\"=>{\"id\"=>\"base-organization\", \"object\"=>\"plan\", \"amount\"=>25000, \"created\"=>1501046058, \"currency\"=>\"usd\", \"interval\"=>\"month\", \"interval_count\"=>1, \"livemode\"=>false, \"metadata\"=>{}, \"name\"=>\"Base Organization\", \"statement_descriptor\"=>nil, \"trial_period_days\"=>nil}, \"quantity\"=>1}], \"has_more\"=>false, \"total_count\"=>1, \"url\"=>\"/v1/subscription_items?subscription=sub_B8DWoDWDKYe4UV\"}, \"livemode\"=>false, \"metadata\"=>{}, \"plan\"=>{\"id\"=>\"base-organization\", \"object\"=>\"plan\", \"amount\"=>25000, \"created\"=>1501046058, \"currency\"=>\"usd\", \"interval\"=>\"month\", \"interval_count\"=>1, \"livemode\"=>false, \"metadata\"=>{}, \"name\"=>\"Base Organization\", \"statement_descriptor\"=>nil, \"trial_period_days\"=>nil}, \"quantity\"=>1, \"start\"=>1501581289, \"status\"=>\"canceled\", \"tax_percent\"=>nil, \"trial_end\"=>nil, \"trial_start\"=>nil}}, \"livemode\"=>false, \"pending_webhooks\"=>1, \"request\"=>{\"id\"=>\"req_CU1jw9nGTyYYkF\", \"idempotency_key\"=>nil}, \"type\"=>\"customer.subscription.deleted\", \"stripe\"=>{\"id\"=>\"evt_1Alx9TGqILdnjs8ftVzs8Ty8\", \"object\"=>\"event\", \"api_version\"=>\"2017-06-05\", \"created\"=>1501581539, \"data\"=>{\"object\"=>{\"id\"=>\"sub_B8DWoDWDKYe4UV\", \"object\"=>\"subscription\", \"application_fee_percent\"=>nil, \"cancel_at_period_end\"=>false, \"canceled_at\"=>1501581539, \"created\"=>1501581289, \"current_period_end\"=>1504259689, \"current_period_start\"=>1501581289, \"customer\"=>\"cus_B8DWx1uqPpBmoP\", \"discount\"=>nil, \"ended_at\"=>1501581539, \"items\"=>{\"object\"=>\"list\", \"data\"=>[{\"id\"=>\"si_1Alx5RGqILdnjs8f3TqFTLT1\", \"object\"=>\"subscription_item\", \"created\"=>1501581289, \"metadata\"=>{}, \"plan\"=>{\"id\"=>\"base-organization\", \"object\"=>\"plan\", \"amount\"=>25000, \"created\"=>1501046058, \"currency\"=>\"usd\", \"interval\"=>\"month\", \"interval_count\"=>1, \"livemode\"=>false, \"metadata\"=>{}, \"name\"=>\"Base Organization\", \"statement_descriptor\"=>nil, \"trial_period_days\"=>nil}, \"quantity\"=>1}], \"has_more\"=>false, \"total_count\"=>1, \"url\"=>\"/v1/subscription_items?subscription=sub_B8DWoDWDKYe4UV\"}, \"livemode\"=>false, \"metadata\"=>{}, \"plan\"=>{\"id\"=>\"base-organization\", \"object\"=>\"plan\", \"amount\"=>25000, \"created\"=>1501046058, \"currency\"=>\"usd\", \"interval\"=>\"month\", \"interval_count\"=>1, \"livemode\"=>false, \"metadata\"=>{}, \"name\"=>\"Base Organization\", \"statement_descriptor\"=>nil, \"trial_period_days\"=>nil}, \"quantity\"=>1, \"start\"=>1501581289, \"status\"=>\"canceled\", \"tax_percent\"=>nil, \"trial_end\"=>nil, \"trial_start\"=>nil}}, \"livemode\"=>false, \"pending_webhooks\"=>1, \"request\"=>{\"id\"=>\"req_CU1jw9nGTyYYkF\", \"idempotency_key\"=>nil}, \"type\"=>\"customer.subscription.deleted\"}}\n+ end\n+\n+ def invoice_payment_succeeded\n+ {\"id\"=>\"evt_1AlymIGqILdnjs8fPC1ukBVi\", \"object\"=>\"event\", \"api_version\"=>\"2017-06-05\", \"created\"=>1501587790, \"data\"=>{\"object\"=>{\"id\"=>\"in_1AlymIGqILdnjs8fOTcKvpMN\", \"object\"=>\"invoice\", \"amount_due\"=>500, \"application_fee\"=>nil, \"attempt_count\"=>0, \"attempted\"=>true, \"charge\"=>\"ch_1AlymIGqILdnjs8fRkehtqn0\", \"closed\"=>true, \"currency\"=>\"usd\", \"customer\"=>\"cus_B8FGyBhfnriWh4\", \"date\"=>1501587790, \"description\"=>nil, \"discount\"=>nil, \"ending_balance\"=>0, \"forgiven\"=>false, \"lines\"=>{\"object\"=>\"list\", \"data\"=>[{\"id\"=>\"sub_B8FGp7Tnl7Y0Im\", \"object\"=>\"line_item\", \"amount\"=>500, \"currency\"=>\"usd\", \"description\"=>nil, \"discountable\"=>true, \"livemode\"=>false, \"metadata\"=>{}, \"period\"=>{\"start\"=>1501587790, \"end\"=>1504266190}, \"plan\"=>{\"id\"=>\"base-individual\", \"object\"=>\"plan\", \"amount\"=>500, \"created\"=>1501046028, \"currency\"=>\"usd\", \"interval\"=>\"month\", \"interval_count\"=>1, \"livemode\"=>false, \"metadata\"=>{}, \"name\"=>\"Base Individual\", \"statement_descriptor\"=>nil, \"trial_period_days\"=>nil}, \"proration\"=>false, \"quantity\"=>1, \"subscription\"=>nil, \"subscription_item\"=>\"si_1AlymIGqILdnjs8fkHlVwhvG\", \"type\"=>\"subscription\"}], \"has_more\"=>false, \"total_count\"=>1, \"url\"=>\"/v1/invoices/in_1AlymIGqILdnjs8fOTcKvpMN/lines\"}, \"livemode\"=>false, \"metadata\"=>{}, \"next_payment_attempt\"=>nil, \"paid\"=>true, \"period_end\"=>1501587790, \"period_start\"=>1501587790, \"receipt_number\"=>nil, \"starting_balance\"=>0, \"statement_descriptor\"=>nil, \"subscription\"=>\"sub_B8FGp7Tnl7Y0Im\", \"subtotal\"=>500, \"tax\"=>nil, \"tax_percent\"=>nil, \"total\"=>500, \"webhooks_delivered_at\"=>nil}}, \"livemode\"=>false, \"pending_webhooks\"=>1, \"request\"=>{\"id\"=>\"req_CinokJIyaPDBr4\", \"idempotency_key\"=>nil}, \"type\"=>\"invoice.payment_succeeded\", \"stripe\"=>{\"id\"=>\"evt_1AlymIGqILdnjs8fPC1ukBVi\", \"object\"=>\"event\", \"api_version\"=>\"2017-06-05\", \"created\"=>1501587790, \"data\"=>{\"object\"=>{\"id\"=>\"in_1AlymIGqILdnjs8fOTcKvpMN\", \"object\"=>\"invoice\", \"amount_due\"=>500, \"application_fee\"=>nil, \"attempt_count\"=>0, \"attempted\"=>true, \"charge\"=>\"ch_1AlymIGqILdnjs8fRkehtqn0\", \"closed\"=>true, \"currency\"=>\"usd\", \"customer\"=>\"cus_B8FGyBhfnriWh4\", \"date\"=>1501587790, \"description\"=>nil, \"discount\"=>nil, \"ending_balance\"=>0, \"forgiven\"=>false, \"lines\"=>{\"object\"=>\"list\", \"data\"=>[{\"id\"=>\"sub_B8FGp7Tnl7Y0Im\", \"object\"=>\"line_item\", \"amount\"=>500, \"currency\"=>\"usd\", \"description\"=>nil, \"discountable\"=>true, \"livemode\"=>false, \"metadata\"=>{}, \"period\"=>{\"start\"=>1501587790, \"end\"=>1504266190}, \"plan\"=>{\"id\"=>\"base-individual\", \"object\"=>\"plan\", \"amount\"=>500, \"created\"=>1501046028, \"currency\"=>\"usd\", \"interval\"=>\"month\", \"interval_count\"=>1, \"livemode\"=>false, \"metadata\"=>{}, \"name\"=>\"Base Individual\", \"statement_descriptor\"=>nil, \"trial_period_days\"=>nil}, \"proration\"=>false, \"quantity\"=>1, \"subscription\"=>nil, \"subscription_item\"=>\"si_1AlymIGqILdnjs8fkHlVwhvG\", \"type\"=>\"subscription\"}], \"has_more\"=>false, \"total_count\"=>1, \"url\"=>\"/v1/invoices/in_1AlymIGqILdnjs8fOTcKvpMN/lines\"}, \"livemode\"=>false, \"metadata\"=>{}, \"next_payment_attempt\"=>nil, \"paid\"=>true, \"period_end\"=>1501587790, \"period_start\"=>1501587790, \"receipt_number\"=>nil, \"starting_balance\"=>0, \"statement_descriptor\"=>nil, \"subscription\"=>\"sub_B8FGp7Tnl7Y0Im\", \"subtotal\"=>500, \"tax\"=>nil, \"tax_percent\"=>nil, \"total\"=>500, \"webhooks_delivered_at\"=>nil}}, \"livemode\"=>false, \"pending_webhooks\"=>1, \"request\"=>{\"id\"=>\"req_CinokJIyaPDBr4\", \"idempotency_key\"=>nil}, \"type\"=>\"invoice.payment_succeeded\"}}\n+ end\n+end\n" }, { "change_type": "MODIFY", "old_path": "test/models/user_test.rb", "new_path": "test/models/user_test.rb", "diff": "@@ -3,7 +3,7 @@ require 'test_helper'\nclass UserTest < ActiveSupport::TestCase\ntest \"must save a new user with all params\" do\nassert_difference 'User.count' do\n- user = create(:user)\n+ create(:user)\nend\nend\n@@ -27,7 +27,7 @@ class UserTest < ActiveSupport::TestCase\ntest \"github_user_since should not be nil\" do\nround = create :round, :open\n- subscription = create(:subscription, round: round)\n+ create(:subscription, round: round)\nomniauthentication\nuser = User.find_by name: 'test_user'\n#assert user.github_user_since\n@@ -35,19 +35,45 @@ class UserTest < ActiveSupport::TestCase\nend\ntest \"user should not be able to redeem if user is not registered on github for atleast 6 months and on codecurisity for alteast 3 months\" do\n- round = create :round, :open\n+ create :round, :open\nuser = create :user, github_user_since: Date.today\nassert_not user.able_to_redeem?\nend\ntest \"user should be able to redeem if user is registered on github for atleast 6 months and on codecurisity for alteast 3 months\" do\n- round = create :round, :open\n+ create :round, :open\nuser = create :user, github_user_since: Date.today - 6.months, created_at: Date.today - 3.months\nassert user.able_to_redeem?\nend\n- test \"sponsor should have one sponsorer_detail\" do\n+ test \"reset_points should move points to royalty points and set points to 0\" do\n+ round = create :round, :open\n+ user = create :user, github_user_since: Date.today - 6.months, created_at: Date.today - 3.months, points: 500\n+ create(:subscription, round: round, user: user)\n+ assert_equal 0, user.transactions.count\n+ assert_equal 500, user.reload.points\n+ user.reset_points\n+ assert_equal 2, user.transactions.count\n+ assert_equal 1, user.transactions.where(points: 500, transaction_type: 'royalty_bonus', type: 'credit').count\n+ assert_equal 1, user.transactions.where(points: -500, transaction_type: 'redeem_points', type: 'debit').count\n+ assert_equal 0, user.reload.points\n+ end\n+\n+ test 'active_sponsorer_detail should return the active sponsorer detail' do\n+ round = create :round, :open\n+ user = create :user, github_user_since: Date.today - 6.months, created_at: Date.today - 3.months, points: 500\n+ create(:subscription, round: round, user: user)\n+ sponsorer_detail = create(:sponsorer_detail, user: user, subscription_status: :active)\n+ assert_equal sponsorer_detail, user.active_sponsorer_detail\n+ end\n+ test 'sponsorer_detail should return the latest sponsorer detail' do\n+ round = create :round, :open\n+ user = create :user, github_user_since: Date.today - 6.months, created_at: Date.today - 3.months, points: 500\n+ create(:subscription, round: round, user: user)\n+ create(:sponsorer_detail, user: user, subscription_status: :canceled)\n+ sponsorer_detail_2 = create(:sponsorer_detail, user: user, subscription_status: :canceled)\n+ assert_equal sponsorer_detail_2, user.sponsorer_detail\nend\ndef omniauthentication\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Added some test cases. Added he benefits details on the home page.
332,109
02.08.2017 13:32:23
-19,080
ad1cdda6dd9fae9465063724a014031d0dbf59b0
Changed production log level
[ { "change_type": "MODIFY", "old_path": "config/environments/production.rb", "new_path": "config/environments/production.rb", "diff": "@@ -46,7 +46,7 @@ Rails.application.configure do\n# Use the lowest log level to ensure availability of diagnostic information\n# when problems arise.\n- config.log_level = :error\n+ config.log_level = :log\n# Prepend all log lines with the following tags.\n# config.log_tags = [ :subdomain, :uuid ]\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Changed production log level
332,109
02.08.2017 13:40:01
-19,080
463ecfa9bfef4a989b8982ad245a981df6290145
Changed production log level to debug
[ { "change_type": "MODIFY", "old_path": "config/environments/production.rb", "new_path": "config/environments/production.rb", "diff": "@@ -46,7 +46,7 @@ Rails.application.configure do\n# Use the lowest log level to ensure availability of diagnostic information\n# when problems arise.\n- config.log_level = :log\n+ config.log_level = :debug\n# Prepend all log lines with the following tags.\n# config.log_tags = [ :subdomain, :uuid ]\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Changed production log level to debug
332,093
02.08.2017 14:54:32
-19,080
01fab48cf6fe12d547d64453c623764b2f05131d
Creating a job for scoring of each commit A job is created for every commit being scored.
[ { "change_type": "ADD", "old_path": null, "new_path": "app/jobs/score_commit_job.rb", "diff": "+class ScoreCommitJob < ActiveJob::Base\n+ include ActiveJobRetriesCount\n+ queue_as :score\n+\n+ def perform(commit_id)\n+ commit = Commit.find(commit_id)\n+ engine = ScoringEngine.new(commit.repository)\n+ begin\n+ Sidekiq.logger.info \"Scoring for commit: #{commit.id}\"\n+ commit.set(auto_score: engine.calculate_score(commit))\n+ rescue StandardError => e\n+ Sidekiq.logger.info \"Commit: #{commit.id}, Error: #{e}\"\n+ retry_job wait: 5.minutes if retries_count < MAX_RETRY_COUNT\n+ end\n+ end\n+end\n" }, { "change_type": "MODIFY", "old_path": "app/models/repository.rb", "new_path": "app/models/repository.rb", "diff": "@@ -145,7 +145,8 @@ class Repository\nelse\nbegin\nSidekiq.logger.info \"Scoring for commit: #{commit.id}, Round: #{round.from_date}\"\n- commit.set(auto_score: engine.calculate_score(commit))\n+ # commit.set(auto_score: engine.calculate_score(commit))\n+ ScoreCommitJob.perform_later(commit.id.to_s)\nrescue StandardError => e\nSidekiq.logger.info \"Commit: #{commit.id}, Error: #{e}\"\nend\n" }, { "change_type": "MODIFY", "old_path": "config/sidekiq.yml", "new_path": "config/sidekiq.yml", "diff": ":concurrency: 25\n:logfile: ./log/sidekiq.log\n:queues:\n+ - score\n- git\n- mailers\n- rollbar\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/jobs/score_commit_job_test.rb", "diff": "+require \"test_helper\"\n+\n+class ScoreCommitJobTest < ActiveJob::TestCase\n+\n+ def setup\n+ @user = create :user, github_handle: 'amitk', auth_token: 'somerandomtoken'\n+ @repo = create :repository, name: 'code-curiosity', owner: @user\n+ @round = create :round, :open\n+ @commit = create :commit, auto_score: nil, user: @user\n+ @user.repositories << @repo\n+ @repo.commits << @commit\n+ @round.commits << @commit\n+ clear_enqueued_jobs\n+ clear_performed_jobs\n+ assert_no_performed_jobs\n+ assert_no_enqueued_jobs\n+ assert @user.auth_token.present?\n+ assert_equal 1, User.count\n+ end\n+\n+ test 'perform' do\n+ ScoreCommitJob.perform_later(@commit.id.to_s)\n+ assert_enqueued_jobs 1\n+ end\n+\n+ test 'must score commit' do\n+ ScoringEngine.any_instance.stubs(:calculate_score).with(@commit).returns(2)\n+ ScoreCommitJob.perform_now(@commit.id.to_s)\n+ assert_equal 1,Commit.count\n+ assert_equal 2,@commit.reload.auto_score\n+ end\n+end\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Creating a job for scoring of each commit A job is created for every commit being scored.
332,093
02.08.2017 18:11:19
-19,080
ab1301c0d9ebf1c4e7ab864f7b1cf803dc45f53e
Home page updated New way add to be an opensource contributor.
[ { "change_type": "MODIFY", "old_path": "app/assets/stylesheets/goals.scss", "new_path": "app/assets/stylesheets/goals.scss", "diff": "-.goals{\n+.cards{\ntext-align: center;\nborder: 1px solid #f0f0f0;\ncolor: #777;\n}\n}\n+.goals{\n+ @extend .cards;\n+\n+}\n+\n+.benefits{\n+ @extend .cards;\n+\n+ li.title{\n+\n+ background-color: #13a913;\n+\n+ big{\n+ color: white;\n+ }\n+ }\n+\n+\n+ li.desc{\n+\n+ padding: 0px 13px;\n+ -webkit-padding-start: 13px;\n+\n+ li:first-child{\n+ padding: 13px;\n+ }\n+\n+ ul.point{\n+\n+ -webkit-padding-start: 0px;\n+\n+ li:nth-last-child(2), li:last-child {\n+ padding: 13px;\n+ }\n+ }\n+ }\n+\n+ li:first-child{\n+ padding: 20px 13px;\n+ }\n+}\n+\n.next-month-goal{\ntext-align: center;\ncolor: red;\n" }, { "change_type": "MODIFY", "old_path": "app/views/home/_sponsorer_benefits.html.haml", "new_path": "app/views/home/_sponsorer_benefits.html.haml", "diff": ".col-xs-12\n- .box.box-default\n.box-header\n- %h2 Be a Sponsorer\n+ %h2 Reward Opensource contributors!\n.box-body\n- INFO['benefits'].keys.each do |key|\n.col-xs-12.col-sm-4.col-md-4\n- %ul.false.g-green.goals\n- %li\n+ %ul.false.g-green.benefits\n+ %li.title\n%big #{key.camelize}\n%li.desc\n- %ul\n+ %ul.point\n- INFO['benefits'][key].each do |stmt|\n%li #{stmt}\n- unless key == 'free'\n%li\n- = link_to(\"Sponsor\", omniauth_authorize_path(:user, :github, user: key.camelize), class: \"btn btn-lg btn-success\")\n+ = link_to(\"Subscribe\", omniauth_authorize_path(:user, :github, user: key.camelize), class: \"btn btn-lg btn-success\")\n" }, { "change_type": "MODIFY", "old_path": "app/views/home/index.html.haml", "new_path": "app/views/home/index.html.haml", "diff": "%a.btn.btn-primary.btn-lg{ href: omniauth_authorize_path(:user, :github) }\n%span.fa.fa-github\nSign in with Github\n- .row.marketing\n- .col-md-12.col-lg-offset-1.col-md-offset-1\n- - INFO['home'].each_slice(2) do |data|\n- .col-lg-5.col-md-5\n- = render partial: 'info', collection: data, as: 'info'\n- .row\n- .col-md-12.col-xs-12\n- - @sponsorer_organizations.in_groups_of(4) do |group|\n- .row\n- - group.each do |company|\n- - if company\n- .col-md-3.col-xs-3\n- = image_tag company.avatar_file_name, class: 'img-responsive', alt: \"Responsive image\"\n- .row\n- .col-md-12.col-xs-12\n- - @sponsorer_users.in_groups_of(4) do |group|\n- .row\n- - group.each do |user|\n- - if user\n- .col-md-3.col-xs-3\n- = image_tag user.avatar_file_name, class: 'img-responsive', alt: \"Responsive image\"\n- .row.marketing\n+ %a.btn.btn-success.btn-lg{ href: \"#sponsor\"}\n+ %span\n+ Reward Contributors!\n+ .row.marketing#sponsor\n= render 'sponsorer_benefits'\n- if @size > 0\n.row.marketing\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Home page updated New way add to be an opensource contributor.
332,093
02.08.2017 18:24:48
-19,080
2c735cdade52806bb659c7736b9a6a20ecb7fa8f
unwanted spaces removed
[ { "change_type": "MODIFY", "old_path": "app/assets/stylesheets/goals.scss", "new_path": "app/assets/stylesheets/goals.scss", "diff": "@extend .cards;\nli.title{\n-\nbackground-color: #13a913;\n-\nbig{\ncolor: white;\n}\n}\n-\nli.desc{\n-\npadding: 0px 13px;\n-webkit-padding-start: 13px;\n-\nli:first-child{\npadding: 13px;\n}\nul.point{\n-\n-webkit-padding-start: 0px;\n-\nli:nth-last-child(2), li:last-child {\npadding: 13px;\n}\n}\n}\n-\nli:first-child{\npadding: 20px 13px;\n}\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
unwanted spaces removed
332,109
03.08.2017 00:06:20
-19,080
baff84220adccfba557f44be71290d9c4634184a
Fixed bug: Questions not displyed on the home page
[ { "change_type": "MODIFY", "old_path": "app/views/home/index.html.haml", "new_path": "app/views/home/index.html.haml", "diff": "%a.btn.btn-success.btn-lg{ href: \"#sponsor\"}\n%span\nReward Contributors!\n+ .row.marketing\n+ .col-md-12.col-lg-offset-1.col-md-offset-1\n+ - INFO['home'].each_slice(2) do |data|\n+ .col-lg-5.col-md-5\n+ = render partial: 'info', collection: data, as: 'info'\n.row.marketing#sponsor\n= render 'sponsorer_benefits'\n- if @size > 0\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Fixed bug: Questions not displyed on the home page
332,093
03.08.2017 18:38:59
-19,080
1371bf906920c6429d0ec8fe271dad2c9c82ec87
A new feature added to list all subscriptions Admin can view all subscription active as well as inactive
[ { "change_type": "ADD", "old_path": null, "new_path": "app/assets/javascripts/admin/subscriptions.coffee", "diff": "+# Place all the behaviors and hooks related to the matching controller here.\n+# All this logic will automatically be available in application.js.\n+# You can use CoffeeScript in this file: http://coffeescript.org/\n" }, { "change_type": "ADD", "old_path": null, "new_path": "app/assets/stylesheets/admin/subscriptions.scss", "diff": "+// Place all the styles related to the admin/subscriptions controller here.\n+// They will automatically be included in application.css.\n+// You can use Sass (SCSS) here: http://sass-lang.com/\n" }, { "change_type": "ADD", "old_path": null, "new_path": "app/controllers/admin/subscriptions_controller.rb", "diff": "+class Admin::SubscriptionsController < ApplicationController\n+ include Admin::SubscriptionsHelper\n+\n+ before_action :authenticate_user!\n+ before_action :authenticate_admin!\n+\n+ def index\n+ @subscriptions = SponsorerDetail.asc(:subscription_status).page(params[:page])\n+ end\n+\n+end\n" }, { "change_type": "ADD", "old_path": null, "new_path": "app/helpers/admin/subscriptions_helper.rb", "diff": "+module Admin::SubscriptionsHelper\n+\n+ def total_subscription_amount\n+ SponsorerDetail.active.map do |subscription|\n+ SPONSOR[\"#{subscription.sponsorer_type.downcase}\"][\"base\"]\n+ end.sum\n+ end\n+\n+end\n" }, { "change_type": "MODIFY", "old_path": "app/models/sponsorer_detail.rb", "new_path": "app/models/sponsorer_detail.rb", "diff": "@@ -36,6 +36,8 @@ class SponsorerDetail\nscope :organizations, -> { where(sponsorer_type: 'ORGANIZATION') }\nscope :users, -> { where(sponsorer_type: 'INDIVIDUAL') }\n+ scope :active, -> { where(subscription_status: 'active') }\n+ scope :canceled, -> { where(subscription_status: 'canceled') }\ndef save_payment_details(plan, amount, date)\npayment = self.payments.build(subscription_plan: plan, amount: amount/100, date: Time.at(date).to_datetime)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "app/views/admin/subscriptions/_subscription.html.haml", "diff": "+%tr\n+ %td= link_to subscription.user.name, user_path(subscription.user), target: '_blank'\n+ %td= subscription.user.email\n+ %td= subscription.sponsorer_type\n+ %td= subscription.subscription_status.camelize\n+ %td= SPONSOR[\"#{subscription.sponsorer_type.downcase}\"][\"base\"]\n+ %td= subscription.updated_at.strftime('%d/%m/%Y %H:%M')\n" }, { "change_type": "ADD", "old_path": null, "new_path": "app/views/admin/subscriptions/index.html.haml", "diff": "+%section.content-header\n+ %h1\n+ Subscriptions\n+ %span.badge $ #{total_subscription_amount}\n+%section.content\n+ .row\n+ .col-xs-12\n+ .box.box-primary\n+ .box-body.table-responsive\n+ %table.table.table-hover.table-bordered\n+ %thead\n+ %tr\n+ %th.col-xs-1 Name\n+ %th.col-xs-2 Email\n+ %th.col-xs-1 Subscription\n+ %th.col-xs-1 Subscription Status\n+ %th.col-xs-1 Subscription Amount\n+ %th.col-xs-1 Created At\n+\n+ %tbody#subscriptions\n+ = render partial: 'subscription', collection: @subscriptions\n+ .pagination-container\n+ = paginate @subscriptions, remote: true\n" }, { "change_type": "ADD", "old_path": null, "new_path": "app/views/admin/subscriptions/index.js.erb", "diff": "+$('#subscriptions').html(\"<%=j render(partial: 'subscription', collection: @subscriptions) %>\");\n+$(\".pagination-container\").html(\"<%=j(paginate @subscriptions, remote: true)%>\")\n" }, { "change_type": "MODIFY", "old_path": "app/views/application/_admin_sidebar.html.haml", "new_path": "app/views/application/_admin_sidebar.html.haml", "diff": "%a{href: admin_users_path}\n%i.fa.fa-circle-o\n%span Users\n+ %li\n+ %a{href: admin_subscriptions_path}\n+ %i.fa.fa-circle-o\n+ %span Subscriptions\n%li\n%a{href: admin_repositories_path}\n%i.fa.fa-circle-o\n" }, { "change_type": "MODIFY", "old_path": "config/code_curiosity_config.yml", "new_path": "config/code_curiosity_config.yml", "diff": "@@ -37,6 +37,11 @@ scoring_engine:\n:bugspot_weightage: 0.45\n:bugspot_scores_threshold: 2\n+subscriptions:\n+ free: 20\n+ individual: 10\n+ organization: 10\n+\nredeem:\nmin_points: 100\none_dollar_to_points: 10\n" }, { "change_type": "MODIFY", "old_path": "config/initializers/globals.rb", "new_path": "config/initializers/globals.rb", "diff": "@@ -11,6 +11,7 @@ YAML.load_file('config/code_curiosity_config.yml').tap do |config|\nUSER = config['user']\nREDEEM = config['redeem']\nSPONSOR = config['sponsor']\n+ SUBSCRIPTIONS = config['subscriptions']\nend\nCOMMIT_RATINGS = (0..5).to_a\n" }, { "change_type": "MODIFY", "old_path": "config/routes.rb", "new_path": "config/routes.rb", "diff": "@@ -56,6 +56,8 @@ Rails.application.routes.draw do\nget :search, on: :collection\nend\n+ resources :subscriptions, only: [:index]\n+\nresources :judges, only: [:index]\nresources :rounds, only: [:index] do\nget :mark_as_close\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/controllers/admin/subscriptions_controller_test.rb", "diff": "+require \"test_helper\"\n+\n+class Admin::SubscriptionsControllerTest < ActionController::TestCase\n+\n+ def setup\n+ @admin_role = create :role, :admin\n+ @goal = create :goal, points: 15\n+ @round = create :round, :open\n+ end\n+\n+ test 'non logged-in user should not be abeled to list subscribers' do\n+ get :index\n+ assert_response :redirect\n+ end\n+\n+ test 'should not access index if the current user is not an admin' do\n+ sign_in create :user, auth_token: 'dah123rty', goal: @goal\n+ get :index\n+ assert_response :redirect\n+ end\n+\n+ test 'should access users index only if the user is admin' do\n+ user = create :user, auth_token: 'dah123rty', goal: @goal\n+ user.roles << @admin_role\n+ sign_in user\n+ get :index\n+ assert_response :success\n+ end\n+\n+ test 'should list the subscribers' do\n+ subscribers = create_list(:user, 4, auth_token: Faker::Lorem.word, goal: @goal)\n+ subscribers.each do |user|\n+ create(:sponsorer_detail, user: user, sponsorer_type: \"INDIVIDUAL\", subscription_status: 'active')\n+ end\n+ user = create :user, auth_token: 'dah123rty', goal: @goal\n+ user.roles << @admin_role\n+ sign_in user\n+ get :index\n+ assert_equal 4, SponsorerDetail.count\n+ end\n+end\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/helpers/admin/subscriptions_helper_test.rb", "diff": "+require \"test_helper\"\n+\n+class Admin::SubscriptionsHelperTest < ActionView::TestCase\n+\n+ test 'should return total subscription value' do\n+ create(:sponsorer_detail, sponsorer_type: \"INDIVIDUAL\",subscription_status: 'active')\n+ create(:sponsorer_detail, sponsorer_type: \"INDIVIDUAL\",subscription_status: 'canceled')\n+ create(:sponsorer_detail, sponsorer_type: \"ORGANIZATION\",subscription_status: 'active')\n+ assert_equal 255, total_subscription_amount\n+ end\n+\n+end\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
A new feature added to list all subscriptions Admin can view all subscription active as well as inactive
332,093
03.08.2017 19:15:44
-19,080
817262e8f0259acd12fc8f75c128b27d384b1752
minor changes in field names
[ { "change_type": "MODIFY", "old_path": "app/views/admin/subscriptions/index.html.haml", "new_path": "app/views/admin/subscriptions/index.html.haml", "diff": "%tr\n%th.col-xs-1 Name\n%th.col-xs-2 Email\n- %th.col-xs-1 Subscription\n- %th.col-xs-1 Subscription Status\n- %th.col-xs-1 Subscription Amount\n+ %th.col-xs-1 Type\n+ %th.col-xs-1 Status\n+ %th.col-xs-1 Amount\n%th.col-xs-1 Created At\n%tbody#subscriptions\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
minor changes in field names
332,096
05.08.2017 22:14:56
-19,080
79094db97f290018847119c957e8af9c922e027b
Added Terms of Service for Subscription
[ { "change_type": "MODIFY", "old_path": "app/views/info/faq.html.haml", "new_path": "app/views/info/faq.html.haml", "diff": "%h1.faq-title Frequent Questions\n-%h4.faq-subtitle Simple answers to your most common questions\n+%h4.faq-subtitle\n+ Simple answers to your most common questions\n+ .callout-info.col-md-offset-2.col-md-8.col-sm-12.col-sm-offset-0\n+ .alert.alert-error\n+ Please review the\n+ = link_to \"Terms of Service\", \"/Terms_of_service_CodeCuriosity.pdf\"\n+ = \". Subscribe to CodeCuriosity and reward the open-source community\"\n+\n.faqs.col-md-offset-2.col-md-8.col-sm-12.col-sm-offset-0\n= render partial: 'faq', collection: INFO['faq']\n" }, { "change_type": "MODIFY", "old_path": "app/views/sponsorer_details/index.html.haml", "new_path": "app/views/sponsorer_details/index.html.haml", "diff": "- else\n= render partial: 'callout_box', locals: { type: 'success', title: 'Keep Sponsoring', message: 'No payments yet'}\n+ - if @sponsor.nil?\n+ .row.marketing#sponsor\n+ = render 'home/sponsorer_benefits'\n+\n+\n:javascript\nvar sponser_flag = \"#{session[:sponsor]}\";\nvar user_is_sponsorer = \"#{current_user.is_sponsorer}\";\n" }, { "change_type": "ADD", "old_path": "public/Terms_of_service_CodeCuriosity.pdf", "new_path": "public/Terms_of_service_CodeCuriosity.pdf", "diff": "Binary files /dev/null and b/public/Terms_of_service_CodeCuriosity.pdf differ\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Added Terms of Service for Subscription
332,096
05.08.2017 22:15:34
-19,080
667cced2adb7745e805afdf0bb3024bd877fb594
Changing the redemption mailer. To be reverted later on. This is a **VERY SPECIFIC** change. We can revert this next month onwards or tweak this a bit
[ { "change_type": "MODIFY", "old_path": "app/mailers/subscription_mailer.rb", "new_path": "app/mailers/subscription_mailer.rb", "diff": "@@ -23,7 +23,7 @@ class SubscriptionMailer < ApplicationMailer\n@user = user\n@message = message\n- mail(to: user.email, subject: \"[CODECURIOSITY] Your points for the month of #{Date.today.strftime(\"%B\")}!\")\n+ mail(to: user.email, subject: \"[CODECURIOSITY] Terms of Service has changed. Please support our dream\")\nend\nend\n" }, { "change_type": "MODIFY", "old_path": "app/views/subscription_mailer/redeem_points.html.haml", "new_path": "app/views/subscription_mailer/redeem_points.html.haml", "diff": "- content_for :signature do\n= render 'application/mail_signature'\n-%h4= \"Hello #{@user.name},\"\n%p\n- = @message\n+ = \"Hi #{@user.name},\"\n+\n+%br\n+%p\n+ In just over a year, we have more than 1000+ registrations and about $5000 in redemptions. Thank you for your involvement !\n+\n+%br\n+%p\n+ %b\n+ We have changed the\n+ = link_to \"Terms of Service\", \"/Terms_of_service_CodeCuriosity.pdf\"\n+ to make CodeCuriosity sustainable.\n+ We cannot do this without your support!\n+\n+%br\n%p\n- - if @user.points > 100\n- = \"You have #{@user.points} points! Why don't you redeem some?\"\n+ You have been subscribed to the default \"Free\" account and with effect from 1st Aug, 2017 the redemption ratio has been revised to\n+ %b 20 points to 1 USD.\n+\n+%br\n%p\n+ To continue to enjoy the earlier redemption ratio of\n+ %b 10 points to 1 USD,\n+ please upgrade your subscription to the \"Individual\" account. (5$ per month).\n+\n%table.module{:border => \"0\", :cellpadding => \"0\", :cellspacing => \"0\", \"data-attributes\" => \"%7B%22dropped%22%3Atrue%2C%22borderradius%22%3A6%2C%22buttonpadding%22%3A%2212%2C18%2C12%2C18%22%2C%22text%22%3A%22Your%20Bulletproof%20Button%22%2C%22alignment%22%3A%22center%22%2C%22fontsize%22%3A16%2C%22url%22%3A%22%22%2C%22height%22%3A%22%22%2C%22width%22%3A%22%22%2C%22containerbackground%22%3A%22%23ffffff%22%2C%22padding%22%3A%220%2C0%2C0%2C0%22%2C%22buttoncolor%22%3A%22%231188e6%22%2C%22textcolor%22%3A%22%23ffffff%22%2C%22bordercolor%22%3A%22%231288e5%22%7D\", \"data-type\" => \"button\", :role => \"module\", :style => \"table-layout: fixed;\", :width => \"100%\"}\n%tr\n%td{:align => \"center\", :bgcolor => \"#ffffff\", :style => \"padding: 10px 0px 0px 0px;\"}\n%table.wrapper-mobile{:border => \"0\", :cellpadding => \"0\", :cellspacing => \"0\"}\n%tr\n%td{:align => \"center\", :bgcolor => \"#1188e6\", :style => \"-webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; font-size: 16px;\"}\n- = link_to \"Redeem Points\", user_url(@user, anchor: \"wallet\"), class: \"bulletproof-button\", style: \"height: px; width: px; font-size: 16px; line-height: px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; padding: 12px 18px 12px 18px; text-decoration: none; color: #ffffff; text-decoration: none; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; border: 1px solid #1288e5; display: inline-block;\", target: \"_blank\"\n- - else\n- %p You have earned #{@user.points} till now. You need only #{100 - @user.points} more points to start redeeming them for rewards. Go! Go! Go!\n+ = link_to \"Subscribe for $5 plan\", sponsorer_details_url, class: \"bulletproof-button\", style: \"height: px; width: px; font-size: 16px; line-height: px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; padding: 12px 18px 12px 18px; text-decoration: none; color: #ffffff; text-decoration: none; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; border: 1px solid #1288e5; display: inline-block;\", target: \"_blank\"\n+%br\n+%p\n+ Please consider this small subscription fee as rewarding the open-source community with $5 every month.\n+ Of course, you can earn more every month by contributing 50 points each month!\n+%br\n+%p\n+ This change will help us make the system better See\n+ = link_to \"Rewarding OpenSource\", \"https://codecuriosity.org/#sponsor\"\n+ on the home page for more details about how subscription helps you and the open source community!\n+ Click on the\n+ = link_to \"Sponsor\", sponsorer_details_url\n+ link in the sidebar if you're logged in.\n+\n+%br\n%p\n- For more details on your points, check out your\n- = link_to \"CodeCuriosity profile\", user_url(@user)\n+ When you support open source, you're supporting our dream. Help us be the game-changer in\n+ %b rewarding open source!\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Changing the redemption mailer. To be reverted later on. This is a **VERY SPECIFIC** change. We can revert this next month onwards or tweak this a bit
332,096
06.08.2017 10:48:17
-19,080
aab49289dd907b2e2b103d5183f039bfcac80c8f
highlighting Sponsor menu in sidebar
[ { "change_type": "MODIFY", "old_path": "app/views/application/_sidebar.html.haml", "new_path": "app/views/application/_sidebar.html.haml", "diff": "%span Judging\n= render 'admin_sidebar' if current_user.is_admin?\n= render 'orgs_sidebar' if current_user.organizations.any?\n- %li\n+ %li.bg-green\n%a{href: sponsorer_details_path}\n%i.fa.fa-usd\n%span Sponsor\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
highlighting Sponsor menu in sidebar
332,097
07.08.2017 20:00:34
-19,080
62f6e01fe0a17e73ee9150025bb17d0f63f9b232
Added Terms of Services link
[ { "change_type": "MODIFY", "old_path": "app/views/application/_footer.html.haml", "new_path": "app/views/application/_footer.html.haml", "diff": "%strong\nPowered by\n%a{:href => 'http://joshsoftware.com', target: '_blank'} JoshSoftware\n+\n+.pull-right\n+ = link_to \"Terms of Service\", \"/Terms_of_service_CodeCuriosity.pdf\", style: \" float: right; position: relative; left: -30%; font-weight: bold;\"\n%span.contact\n%a{:href => \"mailto:info@codecuriosity.org?Subject=CodeCuriosity%20Feedback\", :target => \"_top\", style: \" float: right; position: relative; left: -30%; font-weight: bold;\"}\n%i.fa.fa-envelope-square\n" }, { "change_type": "MODIFY", "old_path": "app/views/sponsorer_details/index.html.haml", "new_path": "app/views/sponsorer_details/index.html.haml", "diff": "= link_to github_url(@user), target: '_blank' do\n%i.fa.fa-github\n= @user.github_handle\n+\n.col-sm-9\n.nav-tabs-custom\n%ul.nav.nav-tabs\n= render 'payments_table'\n- else\n= render partial: 'callout_box', locals: { type: 'success', title: 'Keep Sponsoring', message: 'No payments yet'}\n+ %b\n+ Please read the\n+ = link_to \"Terms of Service\", \"/Terms_of_service_CodeCuriosity.pdf\"\n+ carefully.\n- if @sponsor.nil?\n.row.marketing#sponsor\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Added Terms of Services link
332,093
08.08.2017 12:35:57
-19,080
085931bcac1548bfbc0a8fecc532a3bf2e82e293
Subscriber link modified on sponsor page
[ { "change_type": "MODIFY", "old_path": "app/controllers/sponsorer_details_controller.rb", "new_path": "app/controllers/sponsorer_details_controller.rb", "diff": "@@ -17,7 +17,7 @@ class SponsorerDetailsController < ApplicationController\nend\ndef new\n- session[:type] = 'Individual' unless session[:type]\n+ session[:type] = params[:type] || session[:type] || 'Individual'\n@sponsorer_detail = SponsorerDetail.new\nend\n" }, { "change_type": "MODIFY", "old_path": "app/views/home/_sponsorer_benefits.html.haml", "new_path": "app/views/home/_sponsorer_benefits.html.haml", "diff": "%li #{stmt}\n- unless key == 'free'\n%li\n+ - if user_signed_in?\n+ = link_to(\"Subscribe\", new_sponsorer_detail_path(type: key.camelize), class: \"btn btn-lg btn-success\", remote: true)\n+ - else\n= link_to(\"Subscribe\", omniauth_authorize_path(:user, :github, user: key.camelize), class: \"btn btn-lg btn-success\")\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Subscriber link modified on sponsor page
332,093
08.08.2017 16:52:32
-19,080
175c5666a1c1cbed87bcf9b015a6f43f55c902e2
Task Created to send change in Terms of service mail to all contestants Task will send mails to all the contestants who didn't received change in terms of service mail.
[ { "change_type": "MODIFY", "old_path": "app/views/subscription_mailer/redeem_points.html.haml", "new_path": "app/views/subscription_mailer/redeem_points.html.haml", "diff": "%p\n%b\nWe have changed the\n- = link_to \"Terms of Service\", \"/Terms_of_service_CodeCuriosity.pdf\"\n+ = link_to \"Terms of Service\", Rails.application.config.action_mailer.asset_host + \"/Terms_of_service_CodeCuriosity.pdf\"\nto make CodeCuriosity sustainable.\nWe cannot do this without your support!\n" }, { "change_type": "ADD", "old_path": null, "new_path": "lib/tasks/notify_all.rake", "diff": "+namespace :notify_all do\n+ desc \"Send mail to all contenstant about change of Terms of Service\"\n+ task notify_contestants: :environment do\n+ users = User.contestants.any_of({notify_monthly_points: nil}, {notify_monthly_points: true}).where(:points.gte => 85, :points.lt => 1000).pluck(:id)\n+ User.contestants.where(:id.nin => users).each do |user|\n+ SubscriptionMailer.redeem_points(user, \"Change of Terms of Service\")\n+ end\n+ end\n+end\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Task Created to send change in Terms of service mail to all contestants Task will send mails to all the contestants who didn't received change in terms of service mail.
332,093
08.08.2017 16:58:35
-19,080
9346681dc9b3a58777679845b8eb4e5d49252e93
meaning correction
[ { "change_type": "MODIFY", "old_path": "lib/tasks/notify_all.rake", "new_path": "lib/tasks/notify_all.rake", "diff": "namespace :notify_all do\n- desc \"Send mail to all contenstant about change of Terms of Service\"\n+ desc \"Send mail to all contenstants about change of Terms of Service\"\ntask notify_contestants: :environment do\nusers = User.contestants.any_of({notify_monthly_points: nil}, {notify_monthly_points: true}).where(:points.gte => 85, :points.lt => 1000).pluck(:id)\nUser.contestants.where(:id.nin => users).each do |user|\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
meaning correction
332,093
08.08.2017 18:01:26
-19,080
5dd4324edbd393515d04d67951460c5d223f768c
mail tested with letter opener
[ { "change_type": "MODIFY", "old_path": "Gemfile", "new_path": "Gemfile", "diff": "@@ -69,4 +69,5 @@ group :development do\ngem 'web-console', '~> 2.0'\ngem 'haml-rails'\ngem 'quiet_assets'\n+ gem \"letter_opener\"\nend\n" }, { "change_type": "MODIFY", "old_path": "Gemfile.lock", "new_path": "Gemfile.lock", "diff": "@@ -174,6 +174,10 @@ GEM\nactivesupport (>= 3.0.0)\nkaminari-mongoid (0.1.2)\nkaminari\n+ launchy (2.4.3)\n+ addressable (~> 2.3)\n+ letter_opener (1.4.1)\n+ launchy (~> 2.2)\nloofah (2.0.3)\nnokogiri (>= 1.5.9)\nmail (2.6.4)\n@@ -435,6 +439,7 @@ DEPENDENCIES\njquery-rails\nkaminari\nkaminari-mongoid (~> 0.1.0)\n+ letter_opener\nmina\nmina-sidekiq\nminitest\n" }, { "change_type": "MODIFY", "old_path": "app/views/subscription_mailer/redeem_points.html.haml", "new_path": "app/views/subscription_mailer/redeem_points.html.haml", "diff": "%br\n%p\nThis change will help us make the system better See\n- = link_to \"Rewarding OpenSource\", \"https://codecuriosity.org/#sponsor\"\n+ = link_to \"Rewarding OpenSource\", Rails.application.config.action_mailer.asset_host + \"#sponsor\"\non the home page for more details about how subscription helps you and the open source community!\nClick on the\n= link_to \"Sponsor\", sponsorer_details_url\n" }, { "change_type": "MODIFY", "old_path": "config/environments/development.rb", "new_path": "config/environments/development.rb", "diff": "@@ -15,10 +15,11 @@ Rails.application.configure do\n# Don't care if the mailer can't send.\nconfig.action_mailer.raise_delivery_errors = false\n+ config.action_mailer.delivery_method = :letter_opener\nconfig.action_mailer.perform_deliveries = true\n- config.action_mailer.delivery_method = :sendmail\n- config.action_mailer.sendmail_settings = { location: '/usr/sbin/sendmail' }\n+ # config.action_mailer.delivery_method = :sendmail\n+ # config.action_mailer.sendmail_settings = { location: '/usr/sbin/sendmail' }\nconfig.action_mailer.asset_host = 'http://localhost:3000'\nconfig.action_mailer.default_url_options = { host: 'localhost', port: 3000 }\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
mail tested with letter opener
332,093
08.08.2017 18:59:23
-19,080
365e087a72329103764abd58654a8d80ec5ca634
delivery scheduled
[ { "change_type": "MODIFY", "old_path": "lib/tasks/notify_all.rake", "new_path": "lib/tasks/notify_all.rake", "diff": "@@ -3,7 +3,7 @@ namespace :notify_all do\ntask notify_contestants: :environment do\nusers = User.contestants.any_of({notify_monthly_points: nil}, {notify_monthly_points: true}).where(:points.gte => 85, :points.lt => 1000).pluck(:id)\nUser.contestants.where(:id.nin => users).each do |user|\n- SubscriptionMailer.redeem_points(user, \"Change of Terms of Service\")\n+ SubscriptionMailer.redeem_points(user, \"Change of Terms of Service\").deliver_later\nend\nend\nend\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
delivery scheduled
332,093
10.08.2017 16:19:01
-19,080
0d9eccb72f4c7a05836ec879288994e9e84303a1
Display sponsors at home page Display our sponsors on home page individuals as well as organizations
[ { "change_type": "MODIFY", "old_path": "app/assets/stylesheets/home.scss", "new_path": "app/assets/stylesheets/home.scss", "diff": ".carousel-control {\ncolor: rgb(241,155,44);\n}\n+ .center-aligned{\n+ text-align:center;\n+ }\n+ .img-center{\n+ display:inline-block;\n+ margin:5px 20px;\n+ padding:5px;\n+ }\n+\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "app/helpers/home_helper.rb", "new_path": "app/helpers/home_helper.rb", "diff": "@@ -9,8 +9,24 @@ module HomeHelper\nend\ndef sponsorer_organizations\n- @sponsorer_organizations = SponsorerDetail.organizations\n- @sponsorer_users = SponsorerDetail.users\n+ @sponsorer_organizations = SponsorerDetail.organizations.active.publish\n+ @sponsorer_users = SponsorerDetail.individuals.active.publish\n+ end\n+\n+ def select_avatar(sponsorer)\n+ if sponsorer.avatar?\n+ sponsorer.avatar\n+ else\n+ avatar_url(sponsorer.user)\n+ end\n+ end\n+\n+ def redirect(sponsorer)\n+ if sponsorer.organization_url?\n+ sponsorer.organization_url\n+ else\n+ user_path(sponsorer.user.github_handle.downcase)\n+ end\nend\ndef widget_class\n" }, { "change_type": "MODIFY", "old_path": "app/models/sponsorer_detail.rb", "new_path": "app/models/sponsorer_detail.rb", "diff": "@@ -11,6 +11,7 @@ class SponsorerDetail\nfield :subscribed_at, type: DateTime\nfield :subscription_expires_at, type: DateTime\nfield :subscription_status, type: String\n+ field :organization_url, type: String\nhas_mongoid_attached_file :avatar,\npath: ':rails_root/public/system/sponsorer/:id/:style/:filename',\n@@ -35,9 +36,10 @@ class SponsorerDetail\nafter_create :update_user_as_sponsor\nscope :organizations, -> { where(sponsorer_type: 'ORGANIZATION') }\n- scope :users, -> { where(sponsorer_type: 'INDIVIDUAL') }\n+ scope :individuals, -> { where(sponsorer_type: 'INDIVIDUAL') }\nscope :active, -> { where(subscription_status: 'active') }\nscope :canceled, -> { where(subscription_status: 'canceled') }\n+ scope :publish, -> { where(publish_profile: true) }\ndef save_payment_details(plan, amount, date)\npayment = self.payments.build(subscription_plan: plan, amount: amount/100, date: Time.at(date).to_datetime)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "app/views/home/_subscribers_list.html.haml", "diff": "+.container.center-aligned\n+ .box-header\n+ %h2= header\n+ .box-body\n+ - sponsorer_group.in_groups_of(4) do |group|\n+ - group.each do |sponsorer|\n+ - if sponsorer\n+ .img-center\n+ = link_to image_tag( select_avatar(sponsorer), class: \"img-responsive img-circle\", width: 130, height: 130, alt: \"Responsive image\"), redirect(sponsorer)\n" }, { "change_type": "MODIFY", "old_path": "app/views/home/index.html.haml", "new_path": "app/views/home/index.html.haml", "diff": "- INFO['home'].each_slice(2) do |data|\n.col-lg-5.col-md-5\n= render partial: 'info', collection: data, as: 'info'\n+ .row.marketing\n+ - if @sponsorer_organizations.count >= SPONSORER_THRESHOLD['organization']\n+ = render partial: 'subscribers_list', locals: {header: \"Organization Sponsors\", sponsorer_group: @sponsorer_organizations}\n+ - if @sponsorer_users.count >= SPONSORER_THRESHOLD['individual']\n+ = render partial: 'subscribers_list', locals: {header: \"Individual Sponsors\", sponsorer_group: @sponsorer_users}\n.row.marketing#sponsor\n= render 'sponsorer_benefits'\n- if @size > 0\n" }, { "change_type": "MODIFY", "old_path": "app/views/sponsorer_details/_organization.html.haml", "new_path": "app/views/sponsorer_details/_organization.html.haml", "diff": "= f.hidden_field :payment_plan, value: SPONSOR['organization'].keys.first\n.form-group\n= f.label \"Payment plan monthly subscription: $#{SPONSOR['organization']['base']}\"\n+ .form-group\n+ = f.label \"Company URL\"\n+ %br\n+ = f.text_field :organization_url, value: nil, size: 40, placeholder: \"http://www.example.com\"\n.form-group\n= f.label :Upload_Logo\n= f.file_field :avatar, accept: 'image/png,image/jpeg,image/jpg', class: 'sponsorer_detail_avatar'\n" }, { "change_type": "MODIFY", "old_path": "config/code_curiosity_config.yml", "new_path": "config/code_curiosity_config.yml", "diff": "@@ -25,6 +25,10 @@ sponsor:\norganization:\nbase: 250\n+sponsor_display_threshold:\n+ individual: 25\n+ organization: 0\n+\nscoring_engine:\n:repositories: 'repositories' # repositories dir\n:max_score: 5\n" }, { "change_type": "MODIFY", "old_path": "config/initializers/globals.rb", "new_path": "config/initializers/globals.rb", "diff": "@@ -12,6 +12,7 @@ YAML.load_file('config/code_curiosity_config.yml').tap do |config|\nREDEEM = config['redeem']\nSPONSOR = config['sponsor']\nSUBSCRIPTIONS = config['subscriptions']\n+ SPONSORER_THRESHOLD = config['sponsor_display_threshold']\nend\nCOMMIT_RATINGS = (0..5).to_a\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Display sponsors at home page Display our sponsors on home page individuals as well as organizations
332,093
11.08.2017 10:53:26
-19,080
7275fa238b113e0888fc1c51aa1363afbd5feb25
circle effect on images removed at home page
[ { "change_type": "MODIFY", "old_path": "app/views/home/_subscribers_list.html.haml", "new_path": "app/views/home/_subscribers_list.html.haml", "diff": "- group.each do |sponsorer|\n- if sponsorer\n.img-center\n- = link_to image_tag( select_avatar(sponsorer), class: \"img-responsive img-circle\", width: 130, height: 130, alt: \"Responsive image\"), redirect(sponsorer)\n+ = link_to image_tag( select_avatar(sponsorer), class: \"img-responsive\", width: 130, height: 130, alt: \"Responsive image\"), redirect(sponsorer)\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
circle effect on images removed at home page
332,093
11.08.2017 11:12:49
-19,080
634f56ee0215338715b673b09833c8a1db7843ff
Name changed Sponsor to Subscribe Name of sponsor on sidebar and sponsor page changed to subscribe.
[ { "change_type": "MODIFY", "old_path": "app/views/application/_sidebar.html.haml", "new_path": "app/views/application/_sidebar.html.haml", "diff": "%li.bg-green\n%a{href: sponsorer_details_path}\n%i.fa.fa-usd\n- %span Sponsor\n+ %span Subscribe\n%li{class: is_active(params[:action], 'goals')}\n= link_to goals_path do\n%i.fa.fa-trophy\n" }, { "change_type": "MODIFY", "old_path": "app/views/sponsorer_details/index.html.haml", "new_path": "app/views/sponsorer_details/index.html.haml", "diff": ".tab-pane.active#subscription\n.well\n- unless current_user.active_sponsorer_detail\n- = link_to(\"Sponsor\", new_sponsorer_detail_path, class: \"btn btn-lg btn-success\", remote:true, data: { toggle: \"modal\", target: '#modal-window'})\n+ = link_to(\"Subscribe\", new_sponsorer_detail_path, class: \"btn btn-lg btn-success\", remote:true, data: { toggle: \"modal\", target: '#modal-window'})\n%br\n- if @sponsor.nil?\n- = \"You have not subscribed for any plan yet! Please subscribe by clicking on sponsor button and filling the form!\"\n+ = \"You have not subscribed for any plan yet! Please subscribe by clicking on Subscribe button and filling the form!\"\n- else\n%table.table\n%tr\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Name changed Sponsor to Subscribe Name of sponsor on sidebar and sponsor page changed to subscribe.
332,093
14.08.2017 17:53:06
-19,080
f27676b0600f7bc54130316a9534b1ed2adb4498
badge added at redeemption modal to promote subscription
[ { "change_type": "MODIFY", "old_path": "app/assets/stylesheets/application.scss", "new_path": "app/assets/stylesheets/application.scss", "diff": "@import \"goals\";\n@import \"bootstrap2-toggle\";\n@import 'activities';\n+@import 'redeem';\n.typeahead.dropdown-menu, .tt-hint, .tt-input, .tt-menu {\nwidth: 90%;\n" }, { "change_type": "MODIFY", "old_path": "app/assets/stylesheets/redeem.scss", "new_path": "app/assets/stylesheets/redeem.scss", "diff": "// Place all the styles related to the redeem controller here.\n// They will automatically be included in application.css.\n// You can use Sass (SCSS) here: http://sass-lang.com/\n+#promote{\n+ @extend .badge;\n+ background-color: #00a65a;\n+ font-size: 12px;\n+\n+ a {\n+ color: white;\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "app/models/user.rb", "new_path": "app/models/user.rb", "diff": "@@ -236,7 +236,7 @@ class User\nend\ndef active_sponsorer_detail\n- sponsorer_details.asc(:subscribed_at).where(subscription_status: :active).last\n+ sponsorer_details.asc(:subscribed_at).where(subscription_status: :active).asc(:created_at).last\nend\ndef sponsorer_detail\n" }, { "change_type": "MODIFY", "old_path": "app/views/redeem/_new_modal.html.haml", "new_path": "app/views/redeem/_new_modal.html.haml", "diff": "%h4.modal-title\nRedeem Points\n%b.pull-right.maring-right-fifty= \"$1.0 = #{redeem_request_value(current_user, REDEEM['one_dollar_to_points'])} points\"\n+ - unless current_user.active_sponsorer_detail\n+ .text-center\n+ #promote\n+ %strong\n+ = link_to \"To avail a better redemption ratio of $1.0 = 10 points, please Upgrade Your Account\", sponsorer_details_path\n.modal-body\n.nav-tabs-custom\n%ul.nav.nav-tabs\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
badge added at redeemption modal to promote subscription
332,093
16.08.2017 17:16:25
-19,080
add685d86f07b43c33dfd05f372ae8bd6307311b
Notify free user to upgrade their account while they redeem their points
[ { "change_type": "ADD", "old_path": null, "new_path": "app/assets/javascripts/redeem.js", "diff": "+$(document).on('page:change', function(){\n+ alert_user();\n+});\n+\n+var alert_user = function() {\n+ $(document).on('click', 'button.submit-redeem', function(event){\n+ event.stopPropagation();\n+ event.stopImmediatePropagation();\n+ var form = $(this).parent('form');\n+ var points = $(this).data().points;\n+ var paid = $(this).data().paid;\n+ var free = $(this).data().free;\n+ bootbox.confirm({\n+ title: 'Alert',\n+ message: \"You're on a free plan. <br> Your \" + points +\" points are worth $\" + (points/free) + \". Please upgrade your account to get $\" + (points/paid) + \" for them. <br> Are you sure you want to continue?\",\n+ buttons: {\n+ confirm: {\n+ label: 'Continue',\n+ className: 'btn-success'\n+ },\n+ cancel: {\n+ label: 'Cancel',\n+ className: 'btn-danger'\n+ }\n+ },\n+ callback: function (result) {\n+ if (result) {\n+ $(form).submit();\n+ }\n+ }\n+ });\n+ });\n+};\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "app/views/admin/redeem_requests/_redeem_request.html.haml", "new_path": "app/views/admin/redeem_requests/_redeem_request.html.haml", "diff": "%tr\n- %td= link_to redeem_request.user.email, user_path(redeem_request.user), target: '_blank'\n+ %td\n+ - if redeem_request.user.active_sponsorer_detail\n+ .badge $\n+ = link_to redeem_request.user.email, user_path(redeem_request.user), target: '_blank'\n%td\n- if redeem_request.retailer_other?\n= link_to redeem_request.retailer.upcase, redeem_request.gift_product_url, target: '_blank'\n" }, { "change_type": "MODIFY", "old_path": "app/views/redeem/_amazon.html.haml", "new_path": "app/views/redeem/_amazon.html.haml", "diff": "-= simple_form_for(@redeem || RedeemRequest.new(user: current_user), url: redeem_path, remote: true) do |f|\n+= simple_form_for(@redeem || RedeemRequest.new(user: current_user), url: redeem_path, html: { id: 'amazon_redeem_request'}, remote: true) do |f|\n.row\n.col-md-6\n= f.input :points, label: 'Points', hint: \"Info: Redemption in multiple of #{REDEEM['min_points']} points.\"\n= f.input :store, collection: REDEEM['amazon_stores'], include_blank: false, label: 'Store'\n= f.input :retailer, as: :hidden, input_html: { value: 'amazon'}\n%button.btn.btn-default{'data-dismiss' => 'modal', :type => 'button'} Cancel\n- %button.btn.btn-primary{:type => 'submit'} Redeem\n+ - if current_user.active_sponsorer_detail\n+ = f.submit \"Redeem\", class: \"btn btn-primary\"\n+ - else\n+ %button.btn.btn-primary.submit-redeem{ type: \"button\", data: { points: current_user.points, free: SUBSCRIPTIONS['free'], paid: SUBSCRIPTIONS['individual']} } Redeem\n" }, { "change_type": "MODIFY", "old_path": "app/views/redeem/_github.html.haml", "new_path": "app/views/redeem/_github.html.haml", "diff": "= f.input :points, collection: github_points_options, include_blank: false, label: 'Gift Card Amount'\n= f.input :retailer, as: :hidden, input_html: { value: 'github'}\n%button.btn.btn-default{'data-dismiss' => 'modal', :type => 'button'} Cancel\n- %button.btn.btn-primary{:type => 'submit'} Redeem\n-\n+ - if current_user.active_sponsorer_detail\n+ = f.submit \"Redeem\", class: \"btn btn-primary\"\n+ - else\n+ %button.btn.btn-primary.submit-redeem{ type: \"button\", data: { points: current_user.points, free: SUBSCRIPTIONS['free'], paid: SUBSCRIPTIONS['individual']} } Redeem\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "app/views/redeem/_new_modal.html.haml", "new_path": "app/views/redeem/_new_modal.html.haml", "diff": "%span{'aria-hidden' => 'true'} &times;\n%h4.modal-title\nRedeem Points\n- %b.pull-right.maring-right-fifty= \"$1.0 = #{redeem_request_value(current_user, REDEEM['one_dollar_to_points'])} points\"\n+ %b.pull-right.maring-right-fifty= \"$1 : #{redeem_request_value(current_user, REDEEM['one_dollar_to_points'])} points\"\n- unless current_user.active_sponsorer_detail\n- .text-center\n- #promote\n+ .text-center{style: \"font-size:14px\"}\n%strong\n- = link_to \"To avail a better redemption ratio of $1.0 = 10 points, please Upgrade Your Account\", sponsorer_details_path\n+ #promote\n+ = link_to \"Click here to upgrade to a better redemption ratio of $1 : 10 points\", sponsorer_details_path\n.modal-body\n.nav-tabs-custom\n%ul.nav.nav-tabs\n" }, { "change_type": "MODIFY", "old_path": "app/views/redeem/_other.html.haml", "new_path": "app/views/redeem/_other.html.haml", "diff": "= f.input :address, as: :text, label: 'Shipping Address', input_html: { row: 4 }\n= f.input :retailer, as: :hidden, input_html: { value: 'other'}\n%button.btn.btn-default{'data-dismiss' => 'modal', :type => 'button'} Cancel\n- %button.btn.btn-primary{:type => 'submit'} Redeem\n+ - if current_user.active_sponsorer_detail\n+ = f.submit \"Redeem\", class: \"btn btn-primary\"\n+ - else\n+ %button.btn.btn-primary.submit-redeem{ type: \"button\", data: { points: current_user.points, free: SUBSCRIPTIONS['free'], paid: SUBSCRIPTIONS['individual']} } Redeem\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "app/views/redeem/create.js.haml", "new_path": "app/views/redeem/create.js.haml", "diff": "$(\"#redeem-modal #amazon_redeem\").html(\"#{j render('redeem/amazon')}\");\n- if @redeem.retailer == 'other'\n$(\"#redeem-modal #other_redeem\").html(\"#{j render('redeem/other')}\");\n+ alert_user();\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Notify free user to upgrade their account while they redeem their points
332,093
16.08.2017 18:14:53
-19,080
6228f52e8cfcd107d977963f8bc741906d6d559b
UI fix at redeem request page
[ { "change_type": "MODIFY", "old_path": "app/views/redeem/_amazon.html.haml", "new_path": "app/views/redeem/_amazon.html.haml", "diff": ".col-md-6\n= f.input :store, collection: REDEEM['amazon_stores'], include_blank: false, label: 'Store'\n= f.input :retailer, as: :hidden, input_html: { value: 'amazon'}\n- = render 'redeem/submit_buttons'\n+ = render 'redeem/submit_buttons', f: f\n" }, { "change_type": "MODIFY", "old_path": "app/views/redeem/_github.html.haml", "new_path": "app/views/redeem/_github.html.haml", "diff": "= simple_form_for(@redeem || RedeemRequest.new(user: current_user), url: redeem_path, remote: true) do |f|\n= f.input :points, collection: github_points_options, include_blank: false, label: 'Gift Card Amount'\n= f.input :retailer, as: :hidden, input_html: { value: 'github'}\n- = render 'redeem/submit_buttons'\n\\ No newline at end of file\n+ = render 'redeem/submit_buttons', f: f\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "app/views/redeem/_other.html.haml", "new_path": "app/views/redeem/_other.html.haml", "diff": "hint: 'Info: Ensure you have enough points in your account to include shipping charges too.'\n= f.input :address, as: :text, label: 'Shipping Address', input_html: { row: 4 }\n= f.input :retailer, as: :hidden, input_html: { value: 'other'}\n- = render 'redeem/submit_buttons'\n\\ No newline at end of file\n+ = render 'redeem/submit_buttons', f: f\n\\ No newline at end of file\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
UI fix at redeem request page
332,093
17.08.2017 17:14:56
-19,080
81344ce2896c04f63eee18caeb3eb746cdf34377
Modification in rules of redeeming points
[ { "change_type": "MODIFY", "old_path": "app/models/redeem_request.rb", "new_path": "app/models/redeem_request.rb", "diff": "@@ -138,9 +138,18 @@ class RedeemRequest\n#shows error if\n#1 user's total_points is less than the points to be redeemed\n#2 user's total_points is greater than the points to be redeemed but royalty_points redeemed for current_months\n- # are more than 500\n- if total_points < points || (total_points >= points && (royalty + redeemed_royalty_point > 500))\n- errors.add(:points, \"at most 500 royalty points can be redeemed in this month\")\n+ # are more than 500 if user is sponsorer\n+ #3 if user is on free plan he can only redeem 400 royalty points per month.\n+ if self.user.is_sponsorer\n+ royalty_points_threshold_check_as_per_user(total_points, royalty_points, redeemed_royalty_point, total_redeemed_royalty, royalty, 500)\n+ else\n+ royalty_points_threshold_check_as_per_user(total_points, royalty_points, redeemed_royalty_point, total_redeemed_royalty, royalty, 400)\n+ end\n+ end\n+\n+ def royalty_points_threshold_check_as_per_user(total_points, royalty_points, redeemed_royalty_point, total_redeemed_royalty, royalty, threshold_points)\n+ if total_points < points || (total_points >= points && (royalty + redeemed_royalty_point > threshold_points))\n+ errors.add(:points, \"at most #{threshold_points} royalty points can be redeemed in this month\")\nend\nend\n" }, { "change_type": "MODIFY", "old_path": "app/views/users/show.html.haml", "new_path": "app/views/users/show.html.haml", "diff": "= render 'celebrity_box' if current_user && current_user.celebrity\n%section.content\n.row\n- .col-sm-3\n+ .col-sm-4\n.box.box-primary\n.box-body.box-profile\n= image_tag avatar_url(@user), class: 'profile-user-img img-responsive img-circle', alt: @user.name\n- else\n%span.pull-right Not set yet\n- if logged_in_user?\n- - if @user.able_to_redeem?\n+ - if @user.able_to_redeem? || @user.active_sponsorer_detail\n= link_to '#', class: \"btn btn-primary btn-block\", data: { toggle: 'modal', target: '#redeem-modal .modal' } do\n%b Redeem Points\n- else\n%span.tool-tip{\"data-placement\" => \"top\", \"data-toggle\" => \"tooltip\", :title => \"Not met the redemption criteria\"}\n- %span.btn.btn-primary.btn-block{:disabled => \"disabled\"} Redeem Points!\n- .col-sm-9\n+ %span.btn.btn-primary.btn-block{:disabled => \"disabled\"} Redeem Points\n+ %p\n+ - unless current_user.active_sponsorer_detail\n+ .text-center\n+ %strong\n+ #promote\n+ = link_to \"Please upgrade to redeem points now\", sponsorer_details_path\n+\n+ .col-sm-8\n.nav-tabs-custom\n%ul.nav.nav-tabs\n%li.active#rounds_tab_link\n- if logged_in_user?\nInfo:\n%i= t('transaction.points_credit_info')\n+ %br\n+ %br\n+ %b\n+ = t('transaction.free_plan')\n+ %i= t('transaction.free_plan_info')\n+ %p\n+ %b\n+ = t('transaction.paid_plan')\n+ %i= t('transaction.paid_plan_info')\n+\n+\n- if logged_in_user?\n#redeem-modal\n.modal.fade\n" }, { "change_type": "MODIFY", "old_path": "config/locales/en.yml", "new_path": "config/locales/en.yml", "diff": "@@ -48,7 +48,11 @@ en:\nset_as_goal_next_month: \"You had already set your goal to '%{current_goal}' for this month. Goal change to '%{name}' will be effective from next month.\"\ngoal_change_faq: 'A user can set his or her current month goal only in the first week of the month. If a goal is set after the first week it will be activated in the next month.'\ntransaction:\n- points_credit_info: Points will be credited to your account by end of the month. Please note that you have to be registered on Github for at least 6 months and on CodeCuriosity for at least 3 months before you can redeem any points. In any month, you can redeem at most 500 Royalty points.\n+ points_credit_info: Points will be credited to your account by end of the month.\n+ free_plan: On a free plan\n+ free_plan_info: you have to be registered on Github for at least 6 months and on CodeCuriosity for at least 3 months before you can redeem any points. In any month, you can redeem at most 400 Royalty points worth $20.\n+ paid_plan: On a paid plan\n+ paid_plan_info: the above restrictions do not apply. In any month, you can redeem at most 500 Royalty points worth $50.\nredeem:\nrequest_created: 'We will send you a coupon code in a couple of days.'\ngroup:\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Modification in rules of redeeming points
332,093
18.08.2017 11:26:50
-19,080
2b6a1bcb15ac402e25af5ed2ea18ad9853441399
Test cases added as per new redeemption request criteria
[ { "change_type": "MODIFY", "old_path": "test/models/redeem_request_test.rb", "new_path": "test/models/redeem_request_test.rb", "diff": "@@ -138,9 +138,9 @@ class RedeemRequestTest < ActiveSupport::TestCase\nassert_equal redeem_request.coupon_code, 'Josh12'\nend\n- test \"user should not redeem more than 500 Royalty points in a month\" do\n+ test \"paid user should not redeem more than 500 Royalty points in a month\" do\nround = create :round, :open\n- user = create :user, github_user_since: Date.today - 2.years, created_at: Date.today - 1.year\n+ user = create :user, github_user_since: Date.today - 2.years, created_at: Date.today - 1.year, is_sponsorer: true\nroyalty_points = 550\nroyalty_transaction = create :transaction, points: royalty_points, transaction_type: 'royalty_bonus', type: 'credit', user: user\nredeem_request = build :redeem_request, points: 520, user: user\n@@ -148,6 +148,16 @@ class RedeemRequestTest < ActiveSupport::TestCase\nassert_not_empty redeem_request.errors[:points]\nend\n+ test \"free user should not redeem more than 400 Royalty points in a month\" do\n+ round = create :round, :open\n+ user = create :user, github_user_since: Date.today - 2.years, created_at: Date.today - 1.year, is_sponsorer: false\n+ royalty_points = 550\n+ royalty_transaction = create :transaction, points: royalty_points, transaction_type: 'royalty_bonus', type: 'credit', user: user\n+ redeem_request = build :redeem_request, points: 420, user: user\n+ redeem_request.valid?\n+ assert_not_empty redeem_request.errors[:points]\n+ end\n+\ntest \"user should be able to redeem if user total points is greater than or equal to redemption points\" do\nuser = create :user\nround_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\n@@ -166,14 +176,14 @@ class RedeemRequestTest < ActiveSupport::TestCase\ntest \"user should be able to redeem if user points is zero and user royalty_bonus is present\" do\nuser = create :user\nround_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\n- royalty_points = 500\n+ royalty_points = 400\nroyalty_transaction = create :transaction, points: royalty_points, transaction_type: 'royalty_bonus', type: 'credit', user: user\nround_transaction = create :transaction, points: 0, type: 'credit',transaction_type: 'Round', user: user\nassert_equal 2, user.transactions.count\n- assert_equal 500, user.total_points\n- redeem_request = create :redeem_request, points: 500, user: user\n+ assert_equal 400, user.total_points\n+ redeem_request = create :redeem_request, points: 400, user: user\nassert_equal 1, user.reload.redeem_requests.count\n- assert_equal 500, user.redeem_requests.first.points\n+ assert_equal 400, user.redeem_requests.first.points\nuser.instance_variable_set(:@_t_p, nil)\nassert_equal 0, user.total_points\nend\n@@ -191,8 +201,25 @@ class RedeemRequestTest < ActiveSupport::TestCase\nassert_equal 2, user.transactions.count\nend\n- test \"user should be able to redeem multiple times but overall atmost 500 royalty_points can be redeemed in a month\" do\n- user = create :user\n+ test \"free user should be able to redeem multiple times but overall atmost 400 royalty_points can be redeemed in a month\" do\n+ user = create :user, is_sponsorer: false\n+ round_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\n+ royalty_points = 1000\n+ royalty_transaction = create :transaction, points: royalty_points, transaction_type: 'royalty_bonus', type: 'credit', user: user\n+ round_transaction = create :transaction, points: 1000, type: 'credit', transaction_type: 'Round', user: user\n+ redeem_request = create :redeem_request, points: 1300, user: user\n+ assert_equal 1, user.redeem_requests.count\n+ assert_equal 1300, user.redeem_requests.first.points\n+ user.instance_variable_set(:@_t_p, nil)\n+ assert_equal 700, user.total_points\n+ redeem_request = create :redeem_request, points: 100, user: user\n+ assert_equal 2, user.redeem_requests.count\n+ user.instance_variable_set(:@_t_p, nil)\n+ assert_equal 600, user.total_points\n+ end\n+\n+ test \"paid user should be able to redeem multiple times but overall atmost 500 royalty_points can be redeemed in a month\" do\n+ user = create :user, is_sponsorer: true\nround_1 = create :round, status: \"open\", from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\nroyalty_points = 1000\nroyalty_transaction = create :transaction, points: royalty_points, transaction_type: 'royalty_bonus', type: 'credit', user: user\n@@ -208,9 +235,45 @@ class RedeemRequestTest < ActiveSupport::TestCase\nassert_equal 500, user.total_points\nend\n+ test \"free user should be able to redeem atmost 400 royalty points in each and every round if redemption criteria is satisified\" do\n+ user = create :user, is_sponsorer: false\n+ round_1 = create :round, status: \"open\", name: Date.today.beginning_of_month.strftime(\"%b %Y\"), from_date: Date.today.beginning_of_month, end_date: Date.today.end_of_month\n+ subscription = create(:subscription, user: user, round: round_1)\n+ royalty_points = 3308\n+ royalty_transaction = create :transaction, points: royalty_points, transaction_type: 'royalty_bonus', type: 'credit', user: user\n+ round_transaction = create :transaction, points: 10, type: 'credit', user: user\n- test \"user should be able to redeem atmost 500 royalty points in each and every round if redemption criteria is satisified\" do\n- user = create :user\n+ redeem_request_1 = create :redeem_request, points: 100, user: user\n+ user.instance_variable_set(:@_t_p, nil)\n+ redeem_request_2 = create :redeem_request, points: 300, user: user\n+ user.instance_variable_set(:@_t_p, nil)\n+ assert_equal 2, user.redeem_requests.count\n+ assert_empty redeem_request.errors[:points]\n+\n+ Round.destroy_all\n+ round_2 = create :round, status: \"open\", name: Date.today.next_month.beginning_of_month.strftime(\"%b %Y\"),\n+ from_date: Date.today.next_month.beginning_of_month, end_date: Date.today.next_month.end_of_month\n+ subscription = create(:subscription, user: user, round: round_2)\n+ redeem_request_1 = create :redeem_request,points: 100, created_at: Date.today.next_month, user: user\n+ user.instance_variable_set(:@_t_p, nil)\n+ redeem_request_2 = create :redeem_request,points: 300, created_at: Date.today.next_month, user: user\n+ user.instance_variable_set(:@_t_p, nil)\n+ assert_equal 4, user.redeem_requests.count\n+ assert_empty redeem_request.errors[:points]\n+\n+\n+ Round.destroy_all\n+ round_3 = create :round, status: \"open\", name: (Date.today + 2.month).beginning_of_month.strftime(\"%b %Y\"),\n+ from_date: (Date.today + 2.month).beginning_of_month, end_date: (Date.today + 2.month).end_of_month\n+ subscription = create(:subscription, user: user, round: round_3)\n+ redeem_request_1 = create :redeem_request,points: 300, created_at: Date.today + 2.month, user: user\n+ user.instance_variable_set(:@_t_p, nil)\n+ redeem_request_2 = create :redeem_request,points: 100, created_at: Date.today + 2.month, user: user\n+ assert_equal 6,user.redeem_requests.count\n+ end\n+\n+ test \"paid user should be able to redeem atmost 500 royalty points in each and every round if redemption criteria is satisified\" do\n+ user = create :user, is_sponsorer: true\nround_1 = create :round, status: \"open\", name: Date.today.beginning_of_month.strftime(\"%b %Y\"), from_date: Date.today.beginning_of_month,\nend_date: Date.today.end_of_month\nsubscription = create(:subscription, user: user, round: round_1)\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Test cases added as per new redeemption request criteria
332,093
18.08.2017 17:21:01
-19,080
4221ddb5f77f9bada5408bb409013ec0756db4ab
Notify admin whenever a subscription is created Moved mailer from sponsorer controller to sponsorer model, sending mail to user and admin after creation of new subscription.
[ { "change_type": "MODIFY", "old_path": "Gemfile", "new_path": "Gemfile", "diff": "@@ -70,4 +70,5 @@ group :development do\ngem 'haml-rails'\ngem 'quiet_assets'\ngem \"letter_opener\"\n+ gem \"letter_opener_web\"\nend\n" }, { "change_type": "MODIFY", "old_path": "Gemfile.lock", "new_path": "Gemfile.lock", "diff": "@@ -178,6 +178,10 @@ GEM\naddressable (~> 2.3)\nletter_opener (1.4.1)\nlaunchy (~> 2.2)\n+ letter_opener_web (1.3.1)\n+ actionmailer (>= 3.2)\n+ letter_opener (~> 1.0)\n+ railties (>= 3.2)\nloofah (2.0.3)\nnokogiri (>= 1.5.9)\nmail (2.6.4)\n@@ -440,6 +444,7 @@ DEPENDENCIES\nkaminari\nkaminari-mongoid (~> 0.1.0)\nletter_opener\n+ letter_opener_web\nmina\nmina-sidekiq\nminitest\n" }, { "change_type": "MODIFY", "old_path": "app/controllers/sponsorer_details_controller.rb", "new_path": "app/controllers/sponsorer_details_controller.rb", "diff": "@@ -38,7 +38,6 @@ class SponsorerDetailsController < ApplicationController\nflash[:error] = e.message\nelse\nif @sponsorer.save\n- SponsorMailer.notify_subscription_details(@sponsorer.user_id.to_s, @sponsorer.payment_plan, SPONSOR[@sponsorer.sponsorer_type.downcase][@sponsorer.payment_plan]).deliver_later\nredirect_to sponsorer_details_path #sponsorer dashboard\nflash[:notice] = \"saved sponsorship details successfully\"\nend\n" }, { "change_type": "MODIFY", "old_path": "app/mailers/sponsor_mailer.rb", "new_path": "app/mailers/sponsor_mailer.rb", "diff": "@@ -5,10 +5,17 @@ class SponsorMailer < ApplicationMailer\nmail(to: @user.email, subject: \"Payment to CodeCuriosity failed\")\nend\n- def notify_subscription_details(user, plan, amount)\n- @user = User.find(id: user)\n+ def notify_subscriber(user_id, plan, amount)\n+ @user = User.find(id: user_id)\n@plan = plan\n@amount = amount\nmail(to: @user.email, subject: \"Details of subscription as sponsor to CodeCuriosity\")\nend\n+\n+ def notify_admin(user_id, plan, amount)\n+ @user = User.find(id: user_id)\n+ @plan = plan\n+ @amount = amount\n+ mail(to: ENV['ADMIN_EMAILS'].split(','), subject: \"New subscription for #{@user.name}\")\n+ end\nend\n" }, { "change_type": "MODIFY", "old_path": "app/models/sponsorer_detail.rb", "new_path": "app/models/sponsorer_detail.rb", "diff": "@@ -34,6 +34,7 @@ class SponsorerDetail\nvalidates_attachment_content_type :avatar, content_type: /\\Aimage\\/.*\\Z/\nafter_create :update_user_as_sponsor\n+ after_create :notify_user_and_admin\nscope :organizations, -> { where(sponsorer_type: 'ORGANIZATION') }\nscope :individuals, -> { where(sponsorer_type: 'INDIVIDUAL') }\n@@ -61,4 +62,9 @@ class SponsorerDetail\nuser.set({is_sponsorer: true})\nend\n+ def notify_user_and_admin\n+ SponsorMailer.notify_subscriber(user_id.to_s, payment_plan, SPONSOR[sponsorer_type.downcase][payment_plan]).deliver_later\n+ SponsorMailer.notify_admin(user_id.to_s, payment_plan, SPONSOR[sponsorer_type.downcase][payment_plan]).deliver_later\n+ end\n+\nend\n" }, { "change_type": "ADD", "old_path": null, "new_path": "app/views/sponsor_mailer/notify_admin.html.haml", "diff": "+%h4 Hello Admin,\n+%p\n+ We have a new subscription. The subscriber details are as below:\n+%p\n+ Name:\n+ = link_to @user.name, user_url(@user)\n+%p\n+ = \"Plan: #{@plan.camelize}\"\n+%p\n+ = \"Amount: $#{@amount} \"\n" }, { "change_type": "RENAME", "old_path": "app/views/sponsor_mailer/notify_subscription_details.html.haml", "new_path": "app/views/sponsor_mailer/notify_subscriber.html.haml", "diff": "" }, { "change_type": "MODIFY", "old_path": "config/routes.rb", "new_path": "config/routes.rb", "diff": "@@ -127,4 +127,9 @@ Rails.application.routes.draw do\nget 'faq' => 'info#faq'\nroot 'home#index'\n+\n+ if Rails.env.development?\n+ mount LetterOpenerWeb::Engine, at: \"/letter_opener\"\n+ end\n+\nend\n" }, { "change_type": "MODIFY", "old_path": "test/controllers/sponsorer_details_controller_test.rb", "new_path": "test/controllers/sponsorer_details_controller_test.rb", "diff": "@@ -116,27 +116,10 @@ class SponsorerDetailsControllerTest < ActionController::TestCase\nstripe_helper.create_plan(amount: 15000, name: 'base', id: 'base-organization', interval: 'month', currency: 'usd')\n- assert_enqueued_jobs 1 do\n+ assert_enqueued_jobs 2 do\npost :create, sponsorer_detail: { sponsorer_type: \"ORGANIZATION\", avatar: file, publish_profile: \"1\", payment_plan: \"base\" },\nstripeToken: stripe_helper.generate_card_token(last4: '4242', exp_year: Time.now.year + 1), stripeEmail: @user.email\nend\nend\n- test 'email is delivered with expected content' do\n- file = fixture_file_upload(\"#{Rails.root}/test/fixtures/rails.png\", \"image/png\")\n- sign_in(@user)\n- stripe_helper = StripeMock.create_test_helper\n-\n- stripe_helper.create_plan(amount: 15000, name: 'base', id: 'base-organization', interval: 'month', currency: 'usd')\n-\n- perform_enqueued_jobs do\n- post :create, sponsorer_detail: { sponsorer_type: \"ORGANIZATION\", avatar: file, publish_profile: \"1\", payment_plan: \"base\" },\n- stripeToken: stripe_helper.generate_card_token(last4: '4242', exp_year: Time.now.year + 1), stripeEmail: @user.email\n-\n- delivered_mail = ActionMailer::Base.deliveries.last\n- assert_equal delivered_mail.to, [@user.email]\n- assert_equal delivered_mail.subject, 'Details of subscription as sponsor to CodeCuriosity'\n- end\n- end\n-\nend\n" }, { "change_type": "MODIFY", "old_path": "test/integration/user_flow_test.rb", "new_path": "test/integration/user_flow_test.rb", "diff": "@@ -38,7 +38,7 @@ class UserFlowTest < ActionDispatch::IntegrationTest\nwithin 'section.content' do\nwithin '.box' do\n- assert page.has_content?('Redeem Points!')\n+ # assert page.has_content?('Redeem Points!')\nassert page.has_no_link?('Redeem Points')\n#page.save_and_open_screenshot\nend\n" }, { "change_type": "MODIFY", "old_path": "test/mailers/sponsor_mailer_test.rb", "new_path": "test/mailers/sponsor_mailer_test.rb", "diff": "require \"test_helper\"\nclass SponsorMailerTest < ActionMailer::TestCase\n+ test \"whenever subscription is created mailer must send mail to user and admin\" do\n+ user = create :user\n+ s = create :sponsorer_detail, payment_plan: \"base\", user: user\n+ s.send :notify_user_and_admin\n+ assert_enqueued_jobs 2\n+ end\nend\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Notify admin whenever a subscription is created Moved mailer from sponsorer controller to sponsorer model, sending mail to user and admin after creation of new subscription.
332,093
21.08.2017 14:24:10
-19,080
93d83caa5d755573a11e98606cd1796e72304a35
Subscription mail contents modified Mail contains information about various plans, a non subscribed user can switch to.
[ { "change_type": "MODIFY", "old_path": "app/views/subscription_mailer/progress.html.haml", "new_path": "app/views/subscription_mailer/progress.html.haml", "diff": "- else\nKeep going, you still have some time!\n= \"You are only #{@subscription.goal.points - @subscription.points} points away from reaching your goal!\"\n+\n+- if !@user.active_sponsorer_detail\n+ %p\n+ %br\n+ %b\n+ On a free plan\n+ you have to be registered on Github for at least 6 months and on CodeCuriosity for at least 3 months before you can redeem any points. In any month, you can redeem at most 400 Royalty points worth $20.\n+ %br\n+ %b\n+ On a paid plan\n+ the above restrictions do not apply. In any month, you can redeem at most 500 Royalty points worth $50.\n+ %br\n+ %table.module{:border => \"0\", :cellpadding => \"0\", :cellspacing => \"0\", \"data-attributes\" => \"%7B%22dropped%22%3Atrue%2C%22borderradius%22%3A6%2C%22buttonpadding%22%3A%2212%2C18%2C12%2C18%22%2C%22text%22%3A%22Your%20Bulletproof%20Button%22%2C%22alignment%22%3A%22center%22%2C%22fontsize%22%3A16%2C%22url%22%3A%22%22%2C%22height%22%3A%22%22%2C%22width%22%3A%22%22%2C%22containerbackground%22%3A%22%23ffffff%22%2C%22padding%22%3A%220%2C0%2C0%2C0%22%2C%22buttoncolor%22%3A%22%231188e6%22%2C%22textcolor%22%3A%22%23ffffff%22%2C%22bordercolor%22%3A%22%231288e5%22%7D\", \"data-type\" => \"button\", :role => \"module\", :style => \"table-layout: fixed;\", :width => \"100%\"}\n+ %tr\n+ %td{:align => \"center\", :bgcolor => \"#ffffff\", :style => \"padding: 10px 0px 0px 0px;\"}\n+ %table.wrapper-mobile{:border => \"0\", :cellpadding => \"0\", :cellspacing => \"0\"}\n+ %tr\n+ %td{:align => \"center\", :bgcolor => \"#1188e6\", :style => \"-webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; font-size: 16px;\"}\n+ = link_to \"Subscribe for $5 plan\", sponsorer_details_url, class: \"bulletproof-button\", style: \"height: px; width: px; font-size: 16px; line-height: px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; padding: 12px 18px 12px 18px; text-decoration: none; color: #ffffff; text-decoration: none; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; border: 1px solid #1288e5; display: inline-block;\", target: \"_blank\"\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Subscription mail contents modified Mail contains information about various plans, a non subscribed user can switch to.
332,093
21.08.2017 15:06:58
-19,080
adc6f9af05c4a2b986ea8349d34b0d5f24d7f29d
Redeem mail content modified User will receive an additional content, which contains information about change in subscription plans. If user is still on free subscription.
[ { "change_type": "MODIFY", "old_path": "app/views/subscription_mailer/redeem_points.html.haml", "new_path": "app/views/subscription_mailer/redeem_points.html.haml", "diff": "- content_for :signature do\n= render 'application/mail_signature'\n+%h4= \"Hello #{@user.name},\"\n%p\n- = \"Hi #{@user.name},\"\n-\n-%br\n+ = @message\n%p\n- In just over a year, we have more than 1000+ registrations and about $5000 in redemptions. Thank you for your involvement !\n+ - if @user.points > 100\n+ = \"You have #{@user.points} points! Why don't you redeem some?\"\n+ %p\n+ %table.module{:border => \"0\", :cellpadding => \"0\", :cellspacing => \"0\", \"data-attributes\" => \"%7B%22dropped%22%3Atrue%2C%22borderradius%22%3A6%2C%22buttonpadding%22%3A%2212%2C18%2C12%2C18%22%2C%22text%22%3A%22Your%20Bulletproof%20Button%22%2C%22alignment%22%3A%22center%22%2C%22fontsize%22%3A16%2C%22url%22%3A%22%22%2C%22height%22%3A%22%22%2C%22width%22%3A%22%22%2C%22containerbackground%22%3A%22%23ffffff%22%2C%22padding%22%3A%220%2C0%2C0%2C0%22%2C%22buttoncolor%22%3A%22%231188e6%22%2C%22textcolor%22%3A%22%23ffffff%22%2C%22bordercolor%22%3A%22%231288e5%22%7D\", \"data-type\" => \"button\", :role => \"module\", :style => \"table-layout: fixed;\", :width => \"100%\"}\n+ %tr\n+ %td{:align => \"center\", :bgcolor => \"#ffffff\", :style => \"padding: 10px 0px 0px 0px;\"}\n+ %table.wrapper-mobile{:border => \"0\", :cellpadding => \"0\", :cellspacing => \"0\"}\n+ %tr\n+ %td{:align => \"center\", :bgcolor => \"#1188e6\", :style => \"-webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; font-size: 16px;\"}\n+ = link_to \"Redeem Points\", user_url(@user, anchor: \"wallet\"), class: \"bulletproof-button\", style: \"height: px; width: px; font-size: 16px; line-height: px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; padding: 12px 18px 12px 18px; text-decoration: none; color: #ffffff; text-decoration: none; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; border: 1px solid #1288e5; display: inline-block;\", target: \"_blank\"\n+ - else\n+ %p You have earned #{@user.points} till now. You need only #{100 - @user.points} more points to start redeeming them for rewards. Go! Go! Go!\n+ %p\n+ For more details on your points, check out your\n+ = link_to \"CodeCuriosity profile\", user_url(@user)\n-%br\n+- if !@user.active_sponsorer_detail\n%p\n+ %br\n%b\n- We have changed the\n- = link_to \"Terms of Service\", Rails.application.config.action_mailer.asset_host + \"/Terms_of_service_CodeCuriosity.pdf\"\n- to make CodeCuriosity sustainable.\n- We cannot do this without your support!\n-\n+ On a free plan\n+ you have to be registered on Github for at least 6 months and on CodeCuriosity for at least 3 months before you can redeem any points. In any month, you can redeem at most 400 Royalty points worth $20.\n%br\n-%p\n- You have been subscribed to the default \"Free\" account and with effect from 1st Aug, 2017 the redemption ratio has been revised to\n- %b 20 points to 1 USD.\n-\n+ %b\n+ On a paid plan\n+ the above restrictions do not apply. In any month, you can redeem at most 500 Royalty points worth $50.\n%br\n-%p\n- To continue to enjoy the earlier redemption ratio of\n- %b 10 points to 1 USD,\n- please upgrade your subscription to the \"Individual\" account. (5$ per month).\n-\n%table.module{:border => \"0\", :cellpadding => \"0\", :cellspacing => \"0\", \"data-attributes\" => \"%7B%22dropped%22%3Atrue%2C%22borderradius%22%3A6%2C%22buttonpadding%22%3A%2212%2C18%2C12%2C18%22%2C%22text%22%3A%22Your%20Bulletproof%20Button%22%2C%22alignment%22%3A%22center%22%2C%22fontsize%22%3A16%2C%22url%22%3A%22%22%2C%22height%22%3A%22%22%2C%22width%22%3A%22%22%2C%22containerbackground%22%3A%22%23ffffff%22%2C%22padding%22%3A%220%2C0%2C0%2C0%22%2C%22buttoncolor%22%3A%22%231188e6%22%2C%22textcolor%22%3A%22%23ffffff%22%2C%22bordercolor%22%3A%22%231288e5%22%7D\", \"data-type\" => \"button\", :role => \"module\", :style => \"table-layout: fixed;\", :width => \"100%\"}\n%tr\n%td{:align => \"center\", :bgcolor => \"#ffffff\", :style => \"padding: 10px 0px 0px 0px;\"}\n%tr\n%td{:align => \"center\", :bgcolor => \"#1188e6\", :style => \"-webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; font-size: 16px;\"}\n= link_to \"Subscribe for $5 plan\", sponsorer_details_url, class: \"bulletproof-button\", style: \"height: px; width: px; font-size: 16px; line-height: px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; padding: 12px 18px 12px 18px; text-decoration: none; color: #ffffff; text-decoration: none; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; border: 1px solid #1288e5; display: inline-block;\", target: \"_blank\"\n\\ No newline at end of file\n-%br\n-%p\n- Please consider this small subscription fee as rewarding the open-source community with $5 every month.\n- Of course, you can earn more every month by contributing 50 points each month!\n-%br\n-%p\n- This change will help us make the system better See\n- = link_to \"Rewarding OpenSource\", Rails.application.config.action_mailer.asset_host + \"#sponsor\"\n- on the home page for more details about how subscription helps you and the open source community!\n- Click on the\n- = link_to \"Sponsor\", sponsorer_details_url\n- link in the sidebar if you're logged in.\n-\n-%br\n-%p\n- When you support open source, you're supporting our dream. Help us be the game-changer in\n- %b rewarding open source!\n" } ]
Ruby
MIT License
joshsoftware/code-curiosity
Redeem mail content modified User will receive an additional content, which contains information about change in subscription plans. If user is still on free subscription.