Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove old Python levels redirect #1745

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions game/static/game/js/level_selection.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
/* global showPopupConfirmation */

$(function() {
setupCoins();
});

function goToPythonDen() {
window.location.href = window.location.href.replace("rapidrouter", "pythonden");
}

function movedToPythonDenPopup() {
let title = "Python Den";
let text = `
<div class='popup-text'>
<p>We have migrated all Python levels to the new Python Den.</p>
<p>Click "Confirm" to continue your journey!</p>
</div>`;
let confirmHandler = "goToPythonDen()";

showPopupConfirmation(title, text, confirmHandler);
}

function setupCoins() {
for(var i = 0; i < EPISODES.length; i++) {
var episode = EPISODES[i];
Expand Down
50 changes: 2 additions & 48 deletions game/templates/game/level_selection.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@

{% block content %}
<div class="container background">
{% include "portal/partials/popup.html" %}
<div id="episodes">
<div class="panel-intro">
<h4>Blockly levels</h4>
The first set of levels use Blockly to slowly introduce you to Python. You can read more about Blockly
The first set of levels use Blockly to slowly introduce you to
core programming concepts. You can read more about Blockly
<a href="https://code-for-life.gitbook.io/rapid-router/blockly-guide" target="_blank">here</a>.
</div>
{% for episode in blocklyEpisodes %}
Expand Down Expand Up @@ -123,52 +123,6 @@ <h4>Blockly levels</h4>
</div>
{% endfor %}

<div class="panel-intro">
<h4>Python levels</h4>
The next set of levels introduce you to coding directly with Python. You can read more about Python
<a href="https://code-for-life.gitbook.io/rapid-router/python-guide" target="_blank">here</a>.
</div>
{% for episode in oldPythonEpisodes %}
<div class="panel">
<div class="panel-header bg--{{ episode.difficulty }}" id="episode-{{episode.id}}">
<p class="episode-title" data-toggle="collapse" data-target="#collapse-{{episode.id}}" aria-expanded="false" aria-controls="collapse-{{episode.id}}" data-parent="#episodes">
{{episode.name}}
<span class="episode_range_text collapsed" data-toggle="collapse" data-target="#collapse-{{episode.id}}" aria-expanded="false" aria-controls="collapse-{{episode.id}}" data-parent="#episodes">
Levels {{episode.first_level}}-{{episode.last_level}}
</span>
<img class="episode_image coin_image" value="{{episode.id}}">
</p>
</div>

<div id="collapse-{{episode.id}}" aria-labelledby="episode-{{episode.id}}" class="collapse">
<div class="panel-body">
{% for level in episode.levels %}
{% if user|is_logged_in_as_student and user.new_student.class_field in level.locked_for_class.all %}
<!-- Mark level as locked -->
<p>
<a class="disabled">{{level.name}}:
{{level.title.strip | safe}}</a>
{% if level.score != None %}
<span class="score_text disabled">{{level.score|floatformat}}/{{level.maxScore|floatformat}}</span>
<img class="level_image coin_image" value="{{level.name}}">
{% endif %}
</p>
{% else %}
<!-- Marking titles as safe to enable bold, not to be used for user-created levels -->
<p>
<a onclick="movedToPythonDenPopup()">{{level.name}}: {{level.title.strip | safe}}</a>
{% if level.score != None %}
<span class="score_text">{{level.score|floatformat}}/{{level.maxScore|floatformat}}</span>
<img class="level_image coin_image" value="{{level.name}}">
{% endif %}
</p>
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% endfor %}

{% if user|is_logged_in %}
<div class="panel-intro">
<h4>Created levels</h4>
Expand Down
13 changes: 0 additions & 13 deletions game/views/level_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,19 +233,6 @@ def levels(request, language):

context["blocklyEpisodes"] = blockly_episodes

old_python_episodes = fetch_episode_data(
app_settings.EARLY_ACCESS_FUNCTION(request), 10, 11
)

for episode in old_python_episodes:
for level in episode["levels"]:
attach_attempts_to_level(attempts, level)
level["locked_for_class"] = Level.objects.get(
id=level["id"]
).locked_for_class

context["oldPythonEpisodes"] = old_python_episodes

elif language == "python":
python_episodes = get_python_episodes(request)

Expand Down