Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/stable'
Browse files Browse the repository at this point in the history
  • Loading branch information
thelostone-mc committed Nov 29, 2021
2 parents 5714bb7 + f6eef5a commit e7c7e32
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 14 deletions.
19 changes: 9 additions & 10 deletions app/assets/v2/js/pages/quests.quest.quiz_style.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,18 @@ var advance_to_state = async function(new_state) {

var $safe_reward = $('<div />');

safe_reward.append(" <BR><BR> If you're successful in this quest, you'll earn this limited edition ");
$safe_reward.append(" <BR><BR> If you're successful in this quest, you'll earn this limited edition ");

safe_reward.append($('<strong>').text(document.kudos_reward['name']));
safe_reward.append(' Kudos: <BR> <BR> ');
safe_reward.append($('<img>").attr("style", "height: 250px;width: 220px;').attr('src', document.kudos_reward['img']));
$safe_reward.append($('<strong>').text(document.kudos_reward['name']));
$safe_reward.append(' Kudos: <BR> <BR> ');
$safe_reward.append($('<img>").attr("style", "height: 250px;width: 220px;').attr('src', document.kudos_reward['img']));

if (document.reward_tip['token']) {
safe_reward.append(" <BR><BR> If you're successful in this quest, you'll earn ");
safe_reward.append($('<strong />').text(document.reward_tip['token_amount'] + ' ' + document.reward_tip['token']));
$safe_reward.append(" <BR><BR> If you're successful in this quest, you'll earn ");
$safe_reward.append($('<strong />').text(document.reward_tip['token_amount'] + ' ' + document.reward_tip['token']));
}

$('#desc').html($('#desc').html() + safe_reward.html());
$('#desc').html($('#desc').html() + $safe_reward.html());

await $('#desc').removeClass('hidden').fadeIn();
await sleep(1000);
Expand Down Expand Up @@ -309,14 +309,13 @@ var winner = async function(prize_url) {
await toggle_character_class($('#protagonist'), [ 'heal', '' ]);
await sleep(500);
await $('#header').addClass('success').fadeIn().html('You Win');
var span = '<span style="display:block; font-weight: bold; font-size: 24px;">🏆Quest Prize🏅</span>';
var $span = '<span style="display:block; font-weight: bold; font-size: 24px;">🏆Quest Prize🏅</span>';

start_music_midi('secret-discovery');
if (document.reward_tip['token_amount']) {
$('#desc').html($('<strong />').text(document.reward_tip['token_amount'] + ' ' + document.reward_tip['token']));
} else {
$('#desc').append($span);
$('#desc').append(
$('#desc').html($span).append(
$('<img>').attr('style', 'height: 250px;width: 220px;').attr('src', document.kudos_reward['img'])
);
}
Expand Down
36 changes: 36 additions & 0 deletions app/avatar/management/commands/fix_broken_avatars.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'''
Copyright (C) 2021 Gitcoin Core
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''

from avatar.models import *
from django.core.management.base import BaseCommand

class Command(BaseCommand):

help = 'fixes avatars whose pngs have failed'


def handle(self, *args, **options):
avatars = CustomAvatar.objects.filter(png='').order_by('-pk')
for avatar in avatars:
try:
avatar.png = avatar.convert_field(avatar.svg, 'svg', 'png')
avatar.hash = BaseAvatar.calculate_hash(Image.open(BytesIO(avatar.png.read())))
avatar.save()
print(avatar.png, avatar.png.url)
except Exception as e:
print(avatar.pk, e)
2 changes: 1 addition & 1 deletion app/grants/clr.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def calculate_clr(curr_agg, trust_dict, pair_totals, v_threshold, total_pot, gra
tot = float(tot.real)

# ensure CLR match for a grant in CLR round does not exceed 2.5 of the total pot
if grant_clr_percentage_cap and tot > match_cap_per_grant:
if grant_clr_percentage_cap != 100 and tot > match_cap_per_grant:
tot = match_cap_per_grant

bigtot += tot
Expand Down
9 changes: 7 additions & 2 deletions app/quests/templates/quests/types/quiz_style.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ <h3>@{% if user and user.username %}{{ user.username }}{% else %}me{% endif %}</
</div>

</div>

{{quest_json|json_script:"quest_json"}}

<script>
document.kudos_reward = {
'name': '{{quest.kudos_reward.ui_name}}',
Expand All @@ -117,19 +120,21 @@ <h3>@{% if user and user.username %}{{ user.username }}{% else %}me{% endif %}</

document.num_questions = parseInt('{{quest.questions|length}}');
document.music = '{{quest.music}}';
document.music_enabled = true;
document.seconds_per_question = parseInt('{{seconds_per_question}}');
document.reward_tip = {
'token': '{{quest.reward_tip.tokenName}}',
'token_amount': '{{quest.reward_tip.value_true}}'
};
document.quest = {{quest_json|safe}};

// quest_json is a json_dict and needs to be parsed twice
document.quest = JSON.parse(JSON.parse(document.getElementById('quest_json').textContent));
document.quest_url = '{{quest.url}}';
document.quest_feedback_url = '{{quest.feedback_url}}';
document.attempts = {
'success_count': parseInt('{{success_count}}'),
'attempt_count': parseInt('{{attempt_count}}'),
};
document.music_enabled = true;
</script>
{% endblock %}
{% block 'scripts' %}
Expand Down
3 changes: 2 additions & 1 deletion scripts/crontab
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/us
30 */6 * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash process_pending_kudos_distributions 20 20 2 0 >> /var/log/gitcoin/process_pending_kudos_distributions.log 2>&1
0 0 * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash create_offer_if_none_exists >> /var/log/gitcoin/create_offer_if_none_exists.log 2>&1
45 10 * * * cd gitcoin/coin; bash scripts/run_management_command.bash expiration >> /var/log/gitcoin/expiration_bounty.log 2>&1
15 10 * * * cd gitcoin/coin; bash scripts/run_management_command.bash expiration_start_work >> /var/log/gitcoin/expiration_start_work.log 2>&1
15 10 * * * #cd gitcoin/coin; bash scripts/run_management_command.bash expiration_start_work >> /var/log/gitcoin/expiration_start_work.log 2>&1
15 1 * * * cd gitcoin/coin; bash scripts/run_management_command.bash sync_keywords >> /var/log/gitcoin/sync_keywords.log 2>&1
# 40 */3 * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash sync_slack >> /var/log/gitcoin/sync_slack.log 2>&1
30 1 * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash sync_github >> /var/log/gitcoin/sync_github.log 2>&1
Expand Down Expand Up @@ -136,6 +136,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/us
0 1 * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash set_user_personas >> /var/log/gitcoin/set_user_personas.log 2>&1
50 * * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash update_brightid_status >> /var/log/gitcoin/update_brightid_status.log 2>&1
* 4 * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash update_idena_status >> /var/log/gitcoin/update_idena_status.log 2>&1
*/30 * * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash fix_broken_avatars >> /var/log/gitcoin/fix_broken_avatars.log 2>&1

## FEE ADDRESS CONVERSION
## 0 * * * * cd gitcoin/coin; bash scripts/run_management_command.bash feeSwapper
Expand Down

0 comments on commit e7c7e32

Please sign in to comment.