mirror of
https://github.com/frappe/lms.git
synced 2026-05-02 13:39:31 +03:00
Merge branch 'develop' into develop
This commit is contained in:
@@ -36,7 +36,7 @@ jobs:
|
||||
with:
|
||||
python-version: '3.14'
|
||||
- name: setup node
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: '24'
|
||||
check-latest: true
|
||||
|
||||
@@ -26,6 +26,11 @@ jobs:
|
||||
with:
|
||||
python-version: "3.14"
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 24
|
||||
|
||||
- name: Run script to update POT file
|
||||
run: |
|
||||
bash ${GITHUB_WORKSPACE}/.github/helper/update_pot_file.sh
|
||||
|
||||
@@ -16,9 +16,9 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 200
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 20
|
||||
node-version: 24
|
||||
check-latest: true
|
||||
|
||||
- name: Check commit titles
|
||||
|
||||
@@ -15,9 +15,9 @@ jobs:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 20
|
||||
node-version: 24
|
||||
- name: Setup dependencies
|
||||
run: |
|
||||
npm install @semantic-release/git @semantic-release/exec --no-save
|
||||
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 24
|
||||
check-latest: true
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<div class="mx-auto w-full max-w-4xl pt-6 pb-10">
|
||||
<div class="flex flex-col md:flex-row justify-between mb-8 px-3">
|
||||
<div class="text-xl font-semibold text-ink-gray-9 mb-4 md:mb-0">
|
||||
{{ memberCount }} {{ __('certified members') }}
|
||||
{{ memberCount }} {{ __('Certified Members') }}
|
||||
</div>
|
||||
<div
|
||||
class="flex flex-col md:flex-row md:items-center space-y-4 md:space-y-0 md:space-x-4"
|
||||
@@ -65,42 +65,43 @@
|
||||
username: participant.username,
|
||||
},
|
||||
}"
|
||||
class="flex rounded-md hover:bg-surface-gray-2 px-3"
|
||||
>
|
||||
<div
|
||||
class="flex w-full space-x-3 py-2"
|
||||
:class="{
|
||||
'border-b': index < participants.data.length - 1,
|
||||
}"
|
||||
>
|
||||
<UserAvatar :user="participant" size="2xl" />
|
||||
<div class="rounded-md hover:bg-surface-gray-2 px-3">
|
||||
<div
|
||||
class="flex items-center w-full space-x-3 py-2"
|
||||
:class="{
|
||||
'border-b': index < participants.data.length - 1,
|
||||
}"
|
||||
>
|
||||
<UserAvatar :user="participant" size="2xl" />
|
||||
|
||||
<div class="flex flex-col md:flex-row w-full">
|
||||
<div class="flex-1">
|
||||
<div class="text-base font-medium text-ink-gray-8">
|
||||
{{ participant.full_name }}
|
||||
<div class="flex flex-col md:flex-row w-full">
|
||||
<div class="flex-1">
|
||||
<div class="text-base font-medium text-ink-gray-8">
|
||||
{{ participant.full_name }}
|
||||
</div>
|
||||
<div
|
||||
v-if="participant.headline"
|
||||
class="mt-1.5 text-base text-ink-gray-5"
|
||||
>
|
||||
{{ participant.headline }}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="participant.headline"
|
||||
class="mt-1.5 text-base text-ink-gray-5"
|
||||
class="flex items-center space-x-3 md:space-x-24 text-sm md:text-base mt-1.5"
|
||||
>
|
||||
{{ participant.headline }}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex items-center space-x-3 md:space-x-24 text-sm md:text-base mt-1.5"
|
||||
>
|
||||
<div class="text-ink-gray-5">
|
||||
{{ participant.certificate_count }}
|
||||
{{
|
||||
participant.certificate_count > 1
|
||||
? __('certificates')
|
||||
: __('certificate')
|
||||
}}
|
||||
</div>
|
||||
<span class="text-ink-gray-4 md:hidden">·</span>
|
||||
<div class="text-ink-gray-5">
|
||||
{{ dayjs(participant.issue_date).format('DD MMM YYYY') }}
|
||||
<div class="text-ink-gray-5">
|
||||
{{ participant.certificate_count }}
|
||||
{{
|
||||
participant.certificate_count > 1
|
||||
? __('certificates')
|
||||
: __('certificate')
|
||||
}}
|
||||
</div>
|
||||
<span class="text-ink-gray-4 md:hidden">·</span>
|
||||
<div class="text-ink-gray-5">
|
||||
{{ dayjs(participant.issue_date).format('DD MMM YYYY') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -190,7 +191,7 @@ const updateParticipants = () => {
|
||||
|
||||
const updateFilters = () => {
|
||||
filters.value = {
|
||||
...(currentCategory.value && {
|
||||
...(currentCategory.value.trim('') && {
|
||||
category: currentCategory.value,
|
||||
}),
|
||||
...(nameFilter.value && {
|
||||
|
||||
+5629
File diff suppressed because it is too large
Load Diff
+23
-58
@@ -15,7 +15,6 @@ from frappe.integrations.frappe_providers.frappecloud_billing import (
|
||||
current_site_info,
|
||||
is_fc_site,
|
||||
)
|
||||
from frappe.query_builder import DocType
|
||||
from frappe.translate import get_all_translations
|
||||
from frappe.utils import (
|
||||
add_days,
|
||||
@@ -281,53 +280,17 @@ def get_evaluator_details(evaluator):
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def get_certified_participants(filters=None, start=0, page_length=100):
|
||||
filters, or_filters, open_to_opportunities, hiring = update_certification_filters(filters)
|
||||
|
||||
participants = frappe.db.get_all(
|
||||
"LMS Certificate",
|
||||
filters=filters,
|
||||
or_filters=or_filters,
|
||||
fields=["member", "issue_date", "batch_name", "course", "name"],
|
||||
group_by="member",
|
||||
order_by="issue_date desc",
|
||||
start=start,
|
||||
page_length=page_length,
|
||||
)
|
||||
query = get_certification_query(filters)
|
||||
query = query.orderby("issue_date", order=frappe.qb.desc).offset(start).limit(page_length)
|
||||
participants = query.run(as_dict=True)
|
||||
|
||||
for participant in participants:
|
||||
details = get_certified_participant_details(participant.member)
|
||||
participant.update(details)
|
||||
|
||||
participants = filter_by_open_to_criteria(participants, open_to_opportunities, hiring)
|
||||
|
||||
return participants
|
||||
|
||||
|
||||
def update_certification_filters(filters):
|
||||
open_to_opportunities = False
|
||||
hiring = False
|
||||
or_filters = {}
|
||||
if not filters:
|
||||
filters = {}
|
||||
filters.update({"published": 1})
|
||||
|
||||
category = filters.get("category")
|
||||
if category:
|
||||
del filters["category"]
|
||||
or_filters["course_title"] = ["like", f"%{category}%"]
|
||||
or_filters["batch_title"] = ["like", f"%{category}%"]
|
||||
|
||||
if filters.get("open_to_opportunities"):
|
||||
del filters["open_to_opportunities"]
|
||||
open_to_opportunities = True
|
||||
|
||||
if filters.get("hiring"):
|
||||
del filters["hiring"]
|
||||
hiring = True
|
||||
|
||||
return filters, or_filters, open_to_opportunities, hiring
|
||||
|
||||
|
||||
def get_certified_participant_details(member):
|
||||
count = frappe.db.count("LMS Certificate", {"member": member})
|
||||
details = frappe.db.get_value(
|
||||
@@ -340,25 +303,18 @@ def get_certified_participant_details(member):
|
||||
return details
|
||||
|
||||
|
||||
def filter_by_open_to_criteria(participants, open_to_opportunities, hiring):
|
||||
if not open_to_opportunities and not hiring:
|
||||
return participants
|
||||
|
||||
if open_to_opportunities:
|
||||
participants = [participant for participant in participants if participant.open_to == "Opportunities"]
|
||||
|
||||
if hiring:
|
||||
participants = [participant for participant in participants if participant.open_to == "Hiring"]
|
||||
|
||||
return participants
|
||||
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def get_count_of_certified_members(filters=None):
|
||||
Certificate = DocType("LMS Certificate")
|
||||
def get_certification_query(filters):
|
||||
Certificate = frappe.qb.DocType("LMS Certificate")
|
||||
User = frappe.qb.DocType("User")
|
||||
|
||||
query = (
|
||||
frappe.qb.from_(Certificate).select(Certificate.member).distinct().where(Certificate.published == 1)
|
||||
frappe.qb.from_(Certificate)
|
||||
.select(Certificate.member)
|
||||
.distinct()
|
||||
.join(User)
|
||||
.on(Certificate.member == User.name)
|
||||
.where(Certificate.published == 1)
|
||||
.where(User.enabled == 1)
|
||||
)
|
||||
|
||||
if filters:
|
||||
@@ -367,9 +323,18 @@ def get_count_of_certified_members(filters=None):
|
||||
query = query.where(
|
||||
Certificate.course_title.like(f"%{value}%") | Certificate.batch_title.like(f"%{value}%")
|
||||
)
|
||||
elif field == "member_name":
|
||||
if field == "member_name":
|
||||
query = query.where(Certificate.member_name.like(value[1]))
|
||||
if field == "open_to_opportunities":
|
||||
query = query.where(User.open_to == "Opportunities")
|
||||
if field == "hiring":
|
||||
query = query.where(User.open_to == "Hiring")
|
||||
return query
|
||||
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def get_count_of_certified_members(filters=None):
|
||||
query = get_certification_query(filters)
|
||||
result = query.run(as_dict=True)
|
||||
return len(result) or 0
|
||||
|
||||
|
||||
+213
-167
File diff suppressed because it is too large
Load Diff
@@ -64,3 +64,6 @@ ignore = [
|
||||
quote-style = "double"
|
||||
indent-style = "tab"
|
||||
docstring-code-format = true
|
||||
|
||||
[tool.bench.frappe-dependencies]
|
||||
frappe = ">=15.0.0,<17.0.0"
|
||||
Reference in New Issue
Block a user