-
Notifications
You must be signed in to change notification settings - Fork 39
Allow participants to self-assess and share their competencies #271
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
Merged
stefdworschak
merged 9 commits into
Code-Institute-Community:master
from
stefdworschak:competencies
Aug 9, 2022
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bf7a24c
Adding competency app for participants to self-assess
stefdworschak d544463
Finishing assessment view
stefdworschak 0aa9ee1
Adding team view and link from team page
stefdworschak dbf5059
Only retrieve assessement rating if visible
stefdworschak 7490b1e
change label
stefdworschak 178e75e
Fixing some linting
stefdworschak c917cf8
Changing header
stefdworschak ade70b6
Fixing linting
stefdworschak 487bf7e
Removing bootstrap icons, adding permissions to new views and fixing …
stefdworschak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| from django.contrib import admin | ||
|
|
||
| from competencies.models import ( | ||
| Competency, CompetencyDifficulty, | ||
| CompetencyAssessment, CompetencyAssessmentRating) | ||
|
|
||
| admin.site.register(CompetencyDifficulty) | ||
| admin.site.register(Competency) | ||
| admin.site.register(CompetencyAssessment) | ||
| admin.site.register(CompetencyAssessmentRating) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| from django.apps import AppConfig | ||
|
|
||
|
|
||
| class CompetenciesConfig(AppConfig): | ||
| name = 'competencies' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,221 @@ | ||
| [ | ||
| { | ||
| "model": "competencies.competencydifficulty", | ||
| "pk": 1, | ||
| "fields": { | ||
| "created": "2022-08-05T11:37:54.601Z", | ||
| "updated": "2022-08-05T11:37:54.601Z", | ||
| "created_by": 1, | ||
| "display_name": "Easy", | ||
| "numeric_difficulty": 1.0 | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competencydifficulty", | ||
| "pk": 2, | ||
| "fields": { | ||
| "created": "2022-08-05T11:40:28.237Z", | ||
| "updated": "2022-08-05T11:40:28.237Z", | ||
| "created_by": 1, | ||
| "display_name": "Intermediate", | ||
| "numeric_difficulty": 2.0 | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competencydifficulty", | ||
| "pk": 3, | ||
| "fields": { | ||
| "created": "2022-08-05T11:43:34.855Z", | ||
| "updated": "2022-08-05T11:43:34.855Z", | ||
| "created_by": 1, | ||
| "display_name": "Hard", | ||
| "numeric_difficulty": 4.0 | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competencydifficulty", | ||
| "pk": 4, | ||
| "fields": { | ||
| "created": "2022-08-05T13:57:47.318Z", | ||
| "updated": "2022-08-05T13:57:47.318Z", | ||
| "created_by": 1, | ||
| "display_name": "Very Hard", | ||
| "numeric_difficulty": 5.0 | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competencydifficulty", | ||
| "pk": 5, | ||
| "fields": { | ||
| "created": "2022-08-05T13:59:26.450Z", | ||
| "updated": "2022-08-05T13:59:26.451Z", | ||
| "created_by": 1, | ||
| "display_name": "Technical", | ||
| "numeric_difficulty": 1.2 | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competencydifficulty", | ||
| "pk": 6, | ||
| "fields": { | ||
| "created": "2022-08-05T13:59:45.617Z", | ||
| "updated": "2022-08-05T13:59:45.617Z", | ||
| "created_by": 1, | ||
| "display_name": "Normal", | ||
| "numeric_difficulty": 2.5 | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competencydifficulty", | ||
| "pk": 7, | ||
| "fields": { | ||
| "created": "2022-08-05T14:02:05.685Z", | ||
| "updated": "2022-08-05T14:02:05.685Z", | ||
| "created_by": 1, | ||
| "display_name": "Noob", | ||
| "numeric_difficulty": 0.5 | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competencydifficulty", | ||
| "pk": 8, | ||
| "fields": { | ||
| "created": "2022-08-05T14:02:32.024Z", | ||
| "updated": "2022-08-05T14:02:32.024Z", | ||
| "created_by": 1, | ||
| "display_name": "Noobs", | ||
| "numeric_difficulty": 0.6 | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competencydifficulty", | ||
| "pk": 9, | ||
| "fields": { | ||
| "created": "2022-08-05T14:02:56.550Z", | ||
| "updated": "2022-08-05T14:02:56.550Z", | ||
| "created_by": 1, | ||
| "display_name": "Nooobs!", | ||
| "numeric_difficulty": 0.7 | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competency", | ||
| "pk": 1, | ||
| "fields": { | ||
| "created": "2022-08-05T14:17:38.220Z", | ||
| "updated": "2022-08-05T14:17:38.220Z", | ||
| "created_by": 1, | ||
| "display_name": "HTML", | ||
| "perceived_difficulty": 1, | ||
| "is_visible": true | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competency", | ||
| "pk": 2, | ||
| "fields": { | ||
| "created": "2022-08-05T14:23:41.673Z", | ||
| "updated": "2022-08-05T14:56:13.462Z", | ||
| "created_by": 1, | ||
| "display_name": "CSS", | ||
| "perceived_difficulty": 1, | ||
| "is_visible": true | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competency", | ||
| "pk": 3, | ||
| "fields": { | ||
| "created": "2022-08-05T14:23:49.767Z", | ||
| "updated": "2022-08-05T14:23:49.767Z", | ||
| "created_by": 1, | ||
| "display_name": "JavaScript", | ||
| "perceived_difficulty": 2, | ||
| "is_visible": true | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competency", | ||
| "pk": 4, | ||
| "fields": { | ||
| "created": "2022-08-05T14:24:11.521Z", | ||
| "updated": "2022-08-05T14:24:11.521Z", | ||
| "created_by": 1, | ||
| "display_name": "Python", | ||
| "perceived_difficulty": 3, | ||
| "is_visible": true | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competency", | ||
| "pk": 5, | ||
| "fields": { | ||
| "created": "2022-08-05T14:24:17.102Z", | ||
| "updated": "2022-08-05T14:24:17.102Z", | ||
| "created_by": 1, | ||
| "display_name": "Django", | ||
| "perceived_difficulty": 4, | ||
| "is_visible": true | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competency", | ||
| "pk": 6, | ||
| "fields": { | ||
| "created": "2022-08-05T14:24:23.195Z", | ||
| "updated": "2022-08-05T14:24:23.195Z", | ||
| "created_by": 1, | ||
| "display_name": "Kanban", | ||
| "perceived_difficulty": 1, | ||
| "is_visible": true | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competency", | ||
| "pk": 7, | ||
| "fields": { | ||
| "created": "2022-08-05T14:24:29.380Z", | ||
| "updated": "2022-08-05T14:24:29.380Z", | ||
| "created_by": 1, | ||
| "display_name": "Readme", | ||
| "perceived_difficulty": 1, | ||
| "is_visible": true | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competency", | ||
| "pk": 8, | ||
| "fields": { | ||
| "created": "2022-08-05T14:24:35.502Z", | ||
| "updated": "2022-08-05T14:24:35.502Z", | ||
| "created_by": 1, | ||
| "display_name": "Wireframes", | ||
| "perceived_difficulty": 1, | ||
| "is_visible": true | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competency", | ||
| "pk": 9, | ||
| "fields": { | ||
| "created": "2022-08-05T14:24:42.333Z", | ||
| "updated": "2022-08-05T14:24:42.333Z", | ||
| "created_by": 1, | ||
| "display_name": "SCRUM", | ||
| "perceived_difficulty": 2, | ||
| "is_visible": true | ||
| } | ||
| }, | ||
| { | ||
| "model": "competencies.competency", | ||
| "pk": 10, | ||
| "fields": { | ||
| "created": "2022-08-05T14:24:48.822Z", | ||
| "updated": "2022-08-05T14:24:48.822Z", | ||
| "created_by": 1, | ||
| "display_name": "Presenting", | ||
| "perceived_difficulty": 1, | ||
| "is_visible": true | ||
| } | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| from django import forms | ||
| from django.forms import BaseModelFormSet | ||
|
|
||
| from competencies.models import ( | ||
| Competency, CompetencyDifficulty, | ||
| CompetencyAssessment, CompetencyAssessmentRating) | ||
|
|
||
|
|
||
| class RequiredModelFormSet(BaseModelFormSet): | ||
| def __init__(self, *args, **kwargs): | ||
| super(RequiredModelFormSet, self).__init__(*args, **kwargs) | ||
| for form in self.forms: | ||
| form.empty_permitted = False | ||
| form.use_required_attribute = True | ||
|
|
||
|
|
||
| class CompetencyForm(forms.ModelForm): | ||
| perceived_difficulty = forms.ModelChoiceField( | ||
| queryset=CompetencyDifficulty.objects.all(), | ||
| widget=forms.Select(attrs={ | ||
| 'class': 'form-control' | ||
| })) | ||
|
|
||
| class Meta: | ||
| model = Competency | ||
| fields = ['display_name', 'perceived_difficulty'] | ||
|
|
||
|
|
||
| class CompetencyDifficultyForm(forms.ModelForm): | ||
| class Meta: | ||
| model = CompetencyDifficulty | ||
| fields = ['display_name', 'numeric_difficulty'] | ||
|
|
||
|
|
||
| class CompetencyAssessmentForm(forms.ModelForm): | ||
| is_visible = forms.BooleanField( | ||
| required=False, | ||
| label="Make my assessment visible to my teams and facilitators") | ||
|
|
||
| class Meta: | ||
| model = CompetencyAssessment | ||
| fields = ['user', 'is_visible'] | ||
|
|
||
|
|
||
| class CompetencyAssessmentRatingForm(forms.ModelForm): | ||
| competency = forms.ModelChoiceField( | ||
| queryset=Competency.objects.all(), | ||
| widget=forms.Select(attrs={ | ||
| 'class': 'form-control disabled-select', | ||
| })) | ||
|
|
||
| class Meta: | ||
| model = CompetencyAssessmentRating | ||
| fields = ['id', 'user_assessment', 'competency', 'rating'] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| from django.core.exceptions import ObjectDoesNotExist | ||
|
|
||
| from competencies.forms import CompetencyAssessmentForm | ||
| from competencies.models import CompetencyAssessment | ||
|
|
||
|
|
||
| def get_or_create_competency_assessment(data): | ||
| try: | ||
| existing_assessment = CompetencyAssessment.objects.get( | ||
| user=data.get('user')) | ||
| existing_assessment.is_visible = data.get('is_visible') == 'on' | ||
| existing_assessment.save() | ||
| return existing_assessment | ||
| except ObjectDoesNotExist: | ||
| # If no assessment exists, just continue | ||
| pass | ||
|
|
||
| form = CompetencyAssessmentForm(data) | ||
| if form.is_valid(): | ||
| return form.save() | ||
| return | ||
|
|
||
|
|
||
| def populate_competency_assessment_for_formset(competency_assessment, data): | ||
| keys = [key for key in data.keys() | ||
| if key.endswith('-competency')] | ||
|
|
||
| for key in keys: | ||
| assessment_key = key.replace('-competency', '-user_assessment') | ||
| data[assessment_key] = competency_assessment.id |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.