Compare commits

..

7 Commits

Author SHA1 Message Date
pateljannat
7017382451 fix: removed sketch card 2021-08-11 11:40:57 +05:30
pateljannat
3e2c6b3343 fix: sketch image call 2021-08-10 17:08:32 +05:30
pateljannat
5ea744de5c fix: removed unused file 2021-08-10 16:46:48 +05:30
pateljannat
aedb3d3d45 fix: sketch cards 2021-08-10 16:39:17 +05:30
Jannat Patel
d5067a4bcd Merge pull request #169 from fossunited/username-validations
fix: Username validations
2021-08-06 15:05:36 +05:30
Jannat Patel
145b5efab0 Merge pull request #168 from fossunited/minor-issues
fix: quiz, course outline, and lesson indexing
2021-08-05 18:41:15 +05:30
pateljannat
4079ed97b9 fix: quiz, course outline, and lesson indexing 2021-08-05 18:26:41 +05:30
7 changed files with 27 additions and 21 deletions

View File

@@ -194,7 +194,13 @@ class LMSCourse(Document):
"""Returns the {chapter_index}.{lesson_index} for the lesson. """Returns the {chapter_index}.{lesson_index} for the lesson.
""" """
lesson = frappe.db.get_value("Lessons", {"lesson": lesson_name}, ["idx", "parent"], as_dict=True) lesson = frappe.db.get_value("Lessons", {"lesson": lesson_name}, ["idx", "parent"], as_dict=True)
if not lesson:
return None
chapter = frappe.db.get_value("Chapters", {"chapter": lesson.parent}, ["idx"], as_dict=True) chapter = frappe.db.get_value("Chapters", {"chapter": lesson.parent}, ["idx"], as_dict=True)
if not chapter:
return None
return f"{chapter.idx}.{lesson.idx}" return f"{chapter.idx}.{lesson.idx}"
def reindex_exercises(self): def reindex_exercises(self):

View File

@@ -27,7 +27,7 @@
{{ lesson.title }} {{ lesson.title }}
{% if membership %} {% if membership %}
<img class="lesson-progress-tick {{ course.get_progress(lesson.name) != 'Complete' and 'hide' }}" <img class="ml-1 lesson-progress-tick {{ course.get_progress(lesson.name) != 'Complete' and 'hide' }}"
src="/assets/community/icons/check.svg"> src="/assets/community/icons/check.svg">
{% endif %} {% endif %}

View File

@@ -1,16 +0,0 @@
<div class="sketch-teaser">
<div class="sketch-image">
<a href="/sketches/{{sketch.sketch_id}}">
{{ sketch.to_svg() }}
</a>
</div>
<div class="sketch-footer">
<div class="sketch-title">
<a href="sketches/{{sketch.sketch_id}}">{{sketch.title}}</a>
</div>
<div class="sketch-author">
{% set owner = sketch.get_owner() %}
by <a href="/{{owner.username}}">{{owner.full_name}}</a>
</div>
</div>
</div>

View File

@@ -780,7 +780,7 @@ input[type=checkbox] {
} }
.lesson-links { .lesson-links {
display: flex; display: block;
padding: 0 1rem; padding: 0 1rem;
margin-bottom: .25rem; margin-bottom: .25rem;
color: inherit; color: inherit;
@@ -794,6 +794,13 @@ input[type=checkbox] {
border-radius: .25rem; border-radius: .25rem;
} }
.course-content-parent .lesson-links {
padding: 0 0 0 1rem;
margin-bottom: 0.75rem;
font-size: 0.85rem;
line-height: 200%;
}
.chapter-content { .chapter-content {
margin: 0; margin: 0;
margin-left: .875rem; margin-left: .875rem;

View File

@@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.0746 3.60967C12.7814 3.31071 12.4333 3.07355 12.0501 2.91174C11.6669 2.74994 11.2562 2.66666 10.8415 2.66666C10.4267 2.66666 10.016 2.74994 9.63283 2.91174C9.24966 3.07355 8.90152 3.31071 8.60831 3.60967L7.99979 4.22983L7.39126 3.60967C6.79899 3.00607 5.9957 2.66697 5.1581 2.66697C4.32051 2.66697 3.51721 3.00607 2.92494 3.60967C2.33267 4.21327 1.99994 5.03192 1.99994 5.88554C1.99994 6.73916 2.33267 7.55782 2.92494 8.16142L3.53347 8.78158L7.99979 13.3333L12.4661 8.78158L13.0746 8.16142C13.368 7.86259 13.6007 7.5078 13.7595 7.11729C13.9182 6.72679 13.9999 6.30824 13.9999 5.88554C13.9999 5.46284 13.9182 5.04429 13.7595 4.65379C13.6007 4.26329 13.368 3.90849 13.0746 3.60967V3.60967Z" stroke="#4C5A67" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 871 B

View File

@@ -58,6 +58,7 @@ var mark_active_question = (e = undefined) => {
$(".current-question").text(`${next_index}`); $(".current-question").text(`${next_index}`);
$("#check").removeClass("hide").attr("disabled", true); $("#check").removeClass("hide").attr("disabled", true);
$("#next").addClass("hide"); $("#next").addClass("hide");
$(".explanation").addClass("hide");
} }
var mark_progress = (e) => { var mark_progress = (e) => {

View File

@@ -17,10 +17,9 @@ def get_context(context):
index_ = get_lesson_index(context.course, context.batch, frappe.session.user) or "1.1" index_ = get_lesson_index(context.course, context.batch, frappe.session.user) or "1.1"
else: else:
index_ = "1.1" index_ = "1.1"
frappe.local.flags.redirect_location = context.course.get_learn_url(index_) + context.course.query_parameter utils.redirect_to_lesson(context.course, index_)
raise frappe.Redirect
context.lesson = list(filter(lambda x: cstr(x.number) == lesson_number, context.lessons))[0] context.lesson = get_current_lesson_details(lesson_number, context)
neighbours = context.course.get_neighbours(lesson_number, context.lessons) neighbours = context.course.get_neighbours(lesson_number, context.lessons)
context.next_url = get_learn_url(neighbours["next"], context.course) context.next_url = get_learn_url(neighbours["next"], context.course)
context.prev_url = get_learn_url(neighbours["prev"], context.course) context.prev_url = get_learn_url(neighbours["prev"], context.course)
@@ -40,6 +39,12 @@ def get_context(context):
"is_member": context.membership is not None "is_member": context.membership is not None
} }
def get_current_lesson_details(lesson_number, context):
details_list = list(filter(lambda x: cstr(x.number) == lesson_number, context.lessons))
if not len(details_list):
utils.redirect_to_lesson(context.course)
return details_list[0]
def get_learn_url(lesson_number, course): def get_learn_url(lesson_number, course):
return course.get_learn_url(lesson_number) and course.get_learn_url(lesson_number) + course.query_parameter return course.get_learn_url(lesson_number) and course.get_learn_url(lesson_number) + course.query_parameter