learning-credentials 0.2.0rc3__py2.py3-none-any.whl → 0.2.1__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  """A pluggable service for preparing Open edX credentials."""
2
2
 
3
- __version__ = '0.2.0rc3'
3
+ __version__ = '0.2.1'
@@ -98,7 +98,7 @@ def _write_text_on_template(template: any, font: str, username: str, context_nam
98
98
  pdf_canvas.drawString(name_x, name_y, username)
99
99
 
100
100
  # Write the learning context name.
101
- pdf_canvas.setFont(font, 28)
101
+ pdf_canvas.setFont(font, options.get('context_name_size', 28))
102
102
  context_name_color = options.get('context_name_color', '#000')
103
103
  pdf_canvas.setFillColorRGB(*hex_to_rgb(context_name_color))
104
104
 
@@ -187,6 +187,7 @@ def generate_pdf_credential(
187
187
  - context_name: Specify the custom course or Learning Path name.
188
188
  - context_name_y: The Y coordinate of the context name on the credential (vertical position on the template).
189
189
  - context_name_color: The color of the context name on the credential (hexadecimal color code).
190
+ - context_name_size: The font size of the context name on the credential. The default value is 28.
190
191
  - issue_date_y: The Y coordinate of the issue date on the credential (vertical position on the template).
191
192
  - issue_date_color: The color of the issue date on the credential (hexadecimal color code).
192
193
  """
@@ -291,7 +291,7 @@ class Credential(TimeStampedModel):
291
291
 
292
292
  def send_email(self):
293
293
  """Send a credential link to the student."""
294
- course_name = get_learning_context_name(self.learning_context_key)
294
+ learning_context_name = get_learning_context_name(self.learning_context_key)
295
295
  user = get_user_model().objects.get(id=self.user_id)
296
296
  msg = Message(
297
297
  name="certificate_generated",
@@ -300,7 +300,7 @@ class Credential(TimeStampedModel):
300
300
  language='en',
301
301
  context={
302
302
  'certificate_link': self.download_url,
303
- 'course_name': course_name,
303
+ 'course_name': learning_context_name,
304
304
  'platform_name': settings.PLATFORM_NAME,
305
305
  },
306
306
  )
@@ -68,6 +68,11 @@ def _process_learning_context(
68
68
  else:
69
69
  results &= course_results
70
70
 
71
+ # Filter out users who are not enrolled in the Learning Path.
72
+ results &= set(
73
+ learning_path.enrolled_users.filter(learningpathenrollment__is_active=True).values_list('id', flat=True),
74
+ )
75
+
71
76
  return list(results) if results else []
72
77
 
73
78
 
@@ -240,6 +245,7 @@ def _retrieve_course_completions(course_id: CourseKey, options: dict[str, Any])
240
245
  required_completion = options.get('required_completion', 0.9)
241
246
 
242
247
  url = f'/completion-aggregator/v1/course/{course_id}/'
248
+ # The API supports up to 10k results per page, but we limit it to 1k to avoid performance issues.
243
249
  query_params = {'page_size': 1000, 'page': 1}
244
250
 
245
251
  # TODO: Extract the logic of this view into an API. The current approach is very hacky.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: learning-credentials
3
- Version: 0.2.0rc3
3
+ Version: 0.2.1
4
4
  Summary: A pluggable service for preparing Open edX credentials.
5
5
  Home-page: https://github.com/open-craft/learning-credentials
6
6
  Author: OpenCraft
@@ -28,7 +28,7 @@ Requires-Dist: django_reverse_admin
28
28
  Requires-Dist: djangorestframework
29
29
  Requires-Dist: edx-opaque-keys
30
30
  Requires-Dist: edx_ace
31
- Requires-Dist: learning-paths-plugin==0.3.0rc1
31
+ Requires-Dist: learning-paths-plugin>=0.3.0
32
32
  Requires-Dist: openedx-completion-aggregator
33
33
  Requires-Dist: pypdf
34
34
  Requires-Dist: reportlab
@@ -139,7 +139,7 @@ Please do not report security issues in public. Please email security@openedx.or
139
139
  :target: https://pypi.python.org/pypi/learning-credentials/
140
140
  :alt: PyPI
141
141
 
142
- .. |ci-badge| image:: https://github.com/open-craft/learning-credentials/workflows/Python%20CI/badge.svg?branch=main
142
+ .. |ci-badge| image:: https://github.com/open-craft/learning-credentials/actions/workflows/ci.yml/badge.svg?branch=main
143
143
  :target: https://github.com/open-craft/learning-credentials/actions
144
144
  :alt: CI
145
145
 
@@ -159,7 +159,7 @@ Please do not report security issues in public. Please email security@openedx.or
159
159
  :target: https://github.com/open-craft/learning-credentials/blob/main/LICENSE.txt
160
160
  :alt: License
161
161
 
162
- .. |status-badge| image:: https://img.shields.io/badge/Status-Experimental-yellow
162
+ .. |status-badge| image:: https://img.shields.io/badge/Status-Maintained-brightgreen
163
163
  :alt: Status
164
164
 
165
165
  .. https://githubnext.com/projects/repo-visualization/
@@ -186,13 +186,21 @@ Unreleased
186
186
 
187
187
  *
188
188
 
189
- 0.2.0 – 2025-03-31
189
+ 0.2.1 – 2025-05-05
190
+ ******************
191
+
192
+ Fixed
193
+ =====
194
+
195
+ * Check enrollment status before issuing Learning Path credentials.
196
+
197
+ 0.2.0 – 2025-04-03
190
198
  ******************
191
199
 
192
200
  Added
193
201
  =====
194
202
 
195
- * Initial implementation of the certificates app.
203
+ * Learning Paths support.
196
204
 
197
205
 
198
206
  0.1.0 – 2025-01-29
@@ -1,11 +1,11 @@
1
- learning_credentials/__init__.py,sha256=mifXO5GP4OsNwqC6JvhstqUAJV8Zz8Qjbs8M-8YCzoo,88
1
+ learning_credentials/__init__.py,sha256=GbUoDfBwGtTXA8OG6YkkpZE9z7L1NFeHFFfJi8_bXs4,85
2
2
  learning_credentials/admin.py,sha256=ynK3tVJwLsIeV7Jk66t1FAVyVsU1G-KRIAdRkycVTmA,10439
3
3
  learning_credentials/apps.py,sha256=AA6JYUyqKYvNJ5POtQKw_s1g1VrUXuQI96hbea9H220,761
4
4
  learning_credentials/compat.py,sha256=3SE0CwWJHSNHlRMOm2NZd8zzIY3DKSBCRPBXi7QrWUY,4524
5
5
  learning_credentials/exceptions.py,sha256=UaqBVXFMWR2Iob7_LMb3j4NNVmWQFAgLi_MNMRUvGsI,290
6
- learning_credentials/generators.py,sha256=nktM3gDFv66BzXDJ8wjmjlIz9KWMmBPGlD93jS1WgcU,8821
7
- learning_credentials/models.py,sha256=b6_F0I4bcqKi6Z-ARtJ7efJwxBPg1wu0mkZHG3HnkMI,16037
8
- learning_credentials/processors.py,sha256=VoM7ybSSiC2kakNHep6PeZkWFE7FZeYdhdU97IOJ0vw,12466
6
+ learning_credentials/generators.py,sha256=Tzl9fLEVxrjAB1lUYhifGEpIU3JzWPcwvFHeHcVxc4M,8960
7
+ learning_credentials/models.py,sha256=WRsVDLXVTaDSTLX8KuuJg4frvLrR7H8HqRAyG7euZN8,16057
8
+ learning_credentials/processors.py,sha256=jvdH23Qxc-QM_9WU70dWIy5DtT0jWx4f0JlnoXco7UQ,12775
9
9
  learning_credentials/tasks.py,sha256=byoFEUvN_ayVaU5K5SlEiA7vu9BRPaSSmKnB9g5toec,1927
10
10
  learning_credentials/urls.py,sha256=2YLZZW738D7Afyzq6hr5ajWIl6azmX-hNDGUg_8AFpE,370
11
11
  learning_credentials/views.py,sha256=1iBgQYelVHO_QWtoUZfVeyUc0o89IxQWAIwjPjaYaBQ,12
@@ -24,14 +24,14 @@ learning_credentials/templates/learning_credentials/edx_ace/certificate_generate
24
24
  learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/from_name.txt,sha256=-n8tjPSwfwAfeOSZ1WhcCTrpOah4VswzMZ5mh63Pxow,20
25
25
  learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/head.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/subject.txt,sha256=S7Hc5T_sZSsSBXm5_H5HBNNv16Ohl0oZn0nVqqeWL0g,132
27
- learning_credentials-0.2.0rc3.dist-info/licenses/LICENSE.txt,sha256=GDpsPnW_1NKhPvZpZL9imz25P2nIpbwJPEhrlq4vPAU,34523
27
+ learning_credentials-0.2.1.dist-info/licenses/LICENSE.txt,sha256=GDpsPnW_1NKhPvZpZL9imz25P2nIpbwJPEhrlq4vPAU,34523
28
28
  openedx_certificates/__init__.py,sha256=8OoQEjyyrcDZkrdGAWZ5TcmTJf7orJNJKo83-DFQRXo,85
29
29
  openedx_certificates/apps.py,sha256=KZ27RPqxCM-DxBftfAsPrToprUh1yPVPQPBV3qgTJXo,287
30
30
  openedx_certificates/models.py,sha256=O749LzwZr7O5js_21Ca_nUGJr-y3WJs__OrjBYXnZ-I,1131
31
31
  openedx_certificates/migrations/0001_initial.py,sha256=8pN1xEEecBrXKIleuKbZ_FTlTMoOOGiC0Ibk0tDzriM,8522
32
32
  openedx_certificates/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- learning_credentials-0.2.0rc3.dist-info/METADATA,sha256=qyLILPg96zErzmjzY0LLq7kGfDS0gg1Q78ltoK39-4c,6621
34
- learning_credentials-0.2.0rc3.dist-info/WHEEL,sha256=MAQBAzGbXNI3bUmkDsiV_duv8i-gcdnLzw7cfUFwqhU,109
35
- learning_credentials-0.2.0rc3.dist-info/entry_points.txt,sha256=Ll51HUyeZ2UnWjOXHSx09FPTFs9VMIwDccq-mn2wFEc,166
36
- learning_credentials-0.2.0rc3.dist-info/top_level.txt,sha256=IC4tbU9MNfH-NkPgSUzE0UEurEMTpK3TJPHmeRf7kVQ,42
37
- learning_credentials-0.2.0rc3.dist-info/RECORD,,
33
+ learning_credentials-0.2.1.dist-info/METADATA,sha256=yDmN0yKN6u_FaRTO5aY3Z2inlbf7h4PkJeLaAyYHASQ,6720
34
+ learning_credentials-0.2.1.dist-info/WHEEL,sha256=oSJJyWjO7Z2XSScFQUpXG1HL-N0sFMqqeKVVbZTPkWc,109
35
+ learning_credentials-0.2.1.dist-info/entry_points.txt,sha256=Ll51HUyeZ2UnWjOXHSx09FPTFs9VMIwDccq-mn2wFEc,166
36
+ learning_credentials-0.2.1.dist-info/top_level.txt,sha256=IC4tbU9MNfH-NkPgSUzE0UEurEMTpK3TJPHmeRf7kVQ,42
37
+ learning_credentials-0.2.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.3.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any