Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitij01042002 committed Jul 4, 2023
2 parents ff4c16f + 1d67215 commit aebbdd2
Show file tree
Hide file tree
Showing 64 changed files with 893 additions and 211 deletions.
12 changes: 2 additions & 10 deletions .github/ISSUE_TEMPLATE/1_bug_report_form.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,8 @@ body:
label: Tips for developers
description: Please leave this section as-is.
value: |
Before tackling the bug, please use `git bisect` (see https://git-scm.com/docs/git-bisect)
to investigate which PR caused it (you only need to go back as far as
commit https://github.com/oppia/oppia/commits/9a334e9).
If you find the PR, leave a comment on this issue pointing to it, or
just say that it happened before commit 9a334e9 if you could reproduce
it there. This will help us fix the issue by reverting the faulty PR.
Before tackling the bug, please use `git bisect` (see https://git-scm.com/docs/git-bisect) to investigate which PR caused it (you only need to go back as far as commit https://github.com/oppia/oppia/commits/9a334e9). If you find the PR, leave a comment on this issue pointing to it, or just say that it happened before commit 9a334e9 if you could reproduce it there. This will help us fix the issue by reverting the faulty PR.
Also, if this is your first issue, please make sure to follow
https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#choosing-a-good-first-issue
and https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#setting-things-up
before claiming it. Thanks!
Also, if this is your first issue, please make sure to follow https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#choosing-a-good-first-issue and https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#setting-things-up before claiming it. Thanks!
validations:
required: true
6 changes: 3 additions & 3 deletions .github/PENDING_REVIEW_NOTIFICATION_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Hi {{ username }},

It looks like you haven't reviewed the following Oppia-web PRs within the expected time:
It looks like you're assigned to this PR, but haven't taken any action for at least 2 days:
{{ pr_list }}

Could you please review the pending PRs as soon as possible? Note that a full list of PRs assigned to you on Oppia-web can be found at [this link](https://github.com/oppia/oppia/pulls/assigned/{{ username }}).
Please review the pending PRs as soon as possible, and reply to this thread once all the PRs are reviewed.

Please make sure to reply to this thread once all the PRs are reviewed!
To avoid these messages in the future, please bookmark [this link](https://github.com/pulls/assigned) and check it daily. Thanks!
7 changes: 4 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ provide the videos/screenshots of developer-facing interface.
Please also include videos/screenshots of the developer tools
browser console, so that we can be sure that there are no console errors.
If the changes in your PRs are autogenerated via a script and you cannot provide proof
for the changes then please leave a comment "No proof of changes needed because {{Reason}}"
and remove all the sections below.
The above should be done for all PRs, including short ones (e.g. a single-line change).
However, if the changes in your PRs are autogenerated via a script and you cannot
provide proof for the changes then please leave a comment "No proof of changes
needed because {{Reason}}" and remove all the sections below.
-->

#### Proof of changes on desktop with slow/throttled network
Expand Down
6 changes: 5 additions & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Oppia is an online learning tool that enables anyone to easily create and share

In addition to developing the Oppia platform, the team is also developing and piloting a set of free and effective [lessons](https://www.oppia.org/fractions) on basic mathematics. These lessons are targeted at learners who lack access to educational resources.

Oppia is written using Python and AngularJS, and is built on top of Google App Engine.
Oppia is written using Python and AngularJS, and is built on top of Google App Engine. See also:

* [Oppia.org community site](https://www.oppia.org)
* [User Documentation](https://oppia.github.io/)
Expand All @@ -13,6 +13,8 @@ Oppia is written using Python and AngularJS, and is built on top of Google App E
* [Developer announcements](http://groups.google.com/group/oppia-dev)
* [File an issue](https://github.com/oppia/oppia/issues/new/choose)

You can also sign up to our [email newsletter](https://shorturl.at/CHPY6) for news and updates about the overall Oppia project.

<p align="center">
<a href="http://www.youtube.com/watch?v=Ntcw0H0hwPU" target="_blank" rel="noopener">
<img src="https://user-images.githubusercontent.com/30050862/228266651-1270bedc-658a-40d8-8ab4-16b63de4deaf.png">
Expand All @@ -31,6 +33,8 @@ You can help with Oppia's development in many ways, including art, coding, desig
* **Developers**: please see [this wiki page](https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#setting-things-up) for instructions on how to set things up and commit changes.
* **All other contributors**: please see our [general contributor guidelines](https://github.com/oppia/oppia/wiki).

If you'd like to donate to support our work, you can do so [here](https://www.oppia.org/donate).


## Support

Expand Down
1 change: 0 additions & 1 deletion assets/analytics-constants.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"CAN_SEND_ANALYTICS_EVENTS": false,
"GA_ANALYTICS_ID": "",
"UA_ANALYTICS_ID": "",
"SITE_NAME_FOR_ANALYTICS": ""
}
2 changes: 2 additions & 0 deletions assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1142,13 +1142,15 @@
"I18N_PROGRESS_REMINDER_MODAL_HEADER": "You have completed <span class=\"completion-fraction\"><[progress]></span> of",
"I18N_PROGRESS_REMINDER_RESTART_LESSON": "No, restart from the beginning",
"I18N_PROGRESS_REMINDER_RESUME_LESSON": "Yes, resume the lesson",
"I18N_QUESTION_ANSWERS_CORRECT": "Answers Correct:",
"I18N_QUESTION_PLAYER_LEARN_MORE_ABOUT_SCORE": "Score Breakdown",
"I18N_QUESTION_PLAYER_MY_DASHBOARD": "My Dashboard",
"I18N_QUESTION_PLAYER_NEW_SESSION": "Replay",
"I18N_QUESTION_PLAYER_RETRY_TEST": "Retry Test",
"I18N_QUESTION_PLAYER_RETURN_TO_STORY": "Return To Story",
"I18N_QUESTION_PLAYER_REVIEW_LOWEST_SCORED_SKILL": "Review Lowest Scored Skill",
"I18N_QUESTION_PLAYER_SCORE": "Score",
"I18N_QUESTION_PLAYER_SCORE_CALCULATION": "This score is based on the number of hints you used and incorrect answers you entered during this session.",
"I18N_QUESTION_PLAYER_SKILL_DESCRIPTIONS": "Skill Descriptions",
"I18N_QUESTION_PLAYER_TEST_FAILED": "Session failed. Please review the skills and try again",
"I18N_QUESTION_PLAYER_TEST_PASSED": "Session complete. Well done!",
Expand Down
2 changes: 2 additions & 0 deletions assets/i18n/qqq.json
Original file line number Diff line number Diff line change
Expand Up @@ -1142,13 +1142,15 @@
"I18N_PROGRESS_REMINDER_MODAL_HEADER": "Text displayed on the progress reminder modal informing the learner of their progress.",
"I18N_PROGRESS_REMINDER_RESTART_LESSON": "Text displayed on the button meant for restarting the lesson on the progress reminder modal.",
"I18N_PROGRESS_REMINDER_RESUME_LESSON": "Text displayed on the button meant for resuming the lesson on the progress reminder modal.",
"I18N_QUESTION_ANSWERS_CORRECT": "Text displayed in Review Test page. - Text that tells the the correct answers given by the user",
"I18N_QUESTION_PLAYER_LEARN_MORE_ABOUT_SCORE": "Text displayed in Practice Session and Review Test pages. - Text that is shown above the breakdown of the score that indicates users can learn more about their score below.",
"I18N_QUESTION_PLAYER_MY_DASHBOARD": "Text displayed in the Practice Session page. - Text of the button that go to the Topics Dashboard on click.",
"I18N_QUESTION_PLAYER_NEW_SESSION": "Text displayed in the Practice Session page. - Text of the button that starts a new practice session",
"I18N_QUESTION_PLAYER_RETRY_TEST": "Text displayed in Review Test page. - Text of the button that retries a review test.",
"I18N_QUESTION_PLAYER_RETURN_TO_STORY": "Text displayed in Review Test page. - Text of the button that redirects back to the Story page.",
"I18N_QUESTION_PLAYER_REVIEW_LOWEST_SCORED_SKILL": "Text displayed in Practice Session and Review Test pages. - Text of the button that opens up a modal showing a concept card of skills that the learner can improve upon.",
"I18N_QUESTION_PLAYER_SCORE": "Text displayed in Practice Session and Review Test pages. - Text that is the heading of a column with scores.",
"I18N_QUESTION_PLAYER_SCORE_CALCULATION": "Text displayed in Review Test pages. - Text that is shown after the breakdown of the score that indicates how the score is calculated.",
"I18N_QUESTION_PLAYER_SKILL_DESCRIPTIONS": "Text displayed in Practice Session and Review Test pages. - Text that is the heading of a column with skill descriptions.",
"I18N_QUESTION_PLAYER_TEST_FAILED": "Text displayed in Practice Session and Review Test pages. - Text that is shown above the score wheel when the user fails the test.",
"I18N_QUESTION_PLAYER_TEST_PASSED": "Text displayed in Practice Session and Review Test pages. - Text that is shown above the score wheel when the user passes the test.",
Expand Down
15 changes: 14 additions & 1 deletion core/controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class AdminHandlerNormalizePayloadDict(TypedDict):
commit_message: Optional[str]
new_rules: Optional[List[parameter_domain.PlatformParameterRule]]
exp_id: Optional[str]
default_value: Dict[str, parameter_domain.PlatformDataTypes]


class AdminHandler(
Expand Down Expand Up @@ -233,6 +234,15 @@ class AdminHandler(
'type': 'basestring'
},
'default_value': None
},
'default_value': {
'schema': {
'type': 'object_dict',
'validation_method': (
validation_method.
validate_new_default_value_of_platform_parameter)
},
'default_value': None
}
}
}
Expand Down Expand Up @@ -450,11 +460,14 @@ def post(self) -> None:
'The \'commit_message\' must be provided when the '
'action is update_platform_parameter_rules.'
)
default_value = self.normalized_payload.get('default_value')
assert default_value is not None

try:
registry.Registry.update_platform_parameter(
platform_param_name, self.user_id, commit_message,
new_rules
new_rules,
default_value['value']
)
except (
utils.ValidationError,
Expand Down
5 changes: 5 additions & 0 deletions core/controllers/admin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ def test_post_with_rules_changes_updates_platform_params(self) -> None:
'platform_param_name': param.name,
'new_rules': new_rule_dicts,
'commit_message': 'test update param',
'default_value': {'value': False}
}, csrf_token=csrf_token)

rule_dicts = [
Expand Down Expand Up @@ -964,6 +965,7 @@ def test_post_rules_changes_correctly_updates_params_returned_by_getter(
'platform_param_name': param.name,
'new_rules': new_rule_dicts,
'commit_message': 'test update param',
'default_value': {'value': False}
}, csrf_token=csrf_token)

response_dict = self.get_json('/adminhandler')
Expand Down Expand Up @@ -1003,6 +1005,7 @@ def test_update_parameter_rules_with_unknown_param_name_raises_error(
'platform_param_name': 'unknown_param',
'new_rules': new_rule_dicts,
'commit_message': 'test update param',
'default_value': {'value': False}
},
csrf_token=csrf_token,
expected_status_int=500
Expand Down Expand Up @@ -1042,6 +1045,7 @@ def test_update_parameter_rules_with_unknown_data_type_returns_400(
'platform_param_name': param.name,
'new_rules': new_rule_dicts,
'commit_message': 'test update param',
'default_value': {'value': False}
},
csrf_token=csrf_token,
expected_status_int=400
Expand Down Expand Up @@ -1178,6 +1182,7 @@ def test_update_param_rules_with_unexpected_exception_returns_500(
'platform_param_name': param.name,
'new_rules': new_rule_dicts,
'commit_message': 'test update param',
'default_value': {'value': False}
},
csrf_token=csrf_token,
expected_status_int=500
Expand Down
5 changes: 3 additions & 2 deletions core/controllers/diagnostic_test_player_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def setUp(self) -> None:
self.signup(self.CURRICULUM_ADMIN_EMAIL, self.CURRICULUM_ADMIN_USERNAME)
self.owner_id = self.get_user_id_from_email(self.CURRICULUM_ADMIN_EMAIL)

feature_services.update_feature_flag_rules(
feature_services.update_feature_flag(
platform_parameter_list.ParamNames.DIAGNOSTIC_TEST.value,
self.owner_id,
'test update',
Expand All @@ -52,7 +52,8 @@ def setUp(self) -> None:
}],
'value_when_matched': True
})
]
],
False
)

def test_should_access_diagnostic_test_page_in_dev_mode(self) -> None:
Expand Down
30 changes: 30 additions & 0 deletions core/controllers/domain_objects_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from core.domain import exp_domain
from core.domain import image_validation_services
from core.domain import improvements_domain
from core.domain import platform_parameter_domain
from core.domain import question_domain
from core.domain import skill_domain
from core.domain import state_domain
Expand Down Expand Up @@ -108,6 +109,35 @@ def validate_new_config_property_values(
return new_config_property


def validate_new_default_value_of_platform_parameter(
default_value: Mapping[str, platform_parameter_domain.PlatformDataTypes]
) -> Mapping[str, platform_parameter_domain.PlatformDataTypes]:
"""Validates new default value of platform parameter.
Args:
default_value: dict. Data that needs to be validated.
Returns:
dict(str, PlatformDataTypes). Returns the default value dict after
validating.
Raises:
Exception. The default_value is not of valid type.
"""

if not isinstance(default_value['value'], (bool, float, int, str)):
raise Exception('Expected type to be %s but received %s' % (
platform_parameter_domain.PlatformDataTypes,
default_value['value'])
)

# The default_value values do not represent a domain class directly
# and in the handler it is used to set the default value of the platform
# parameter. Hence conversion of dicts to domain objects is not required
# for default_value.
return default_value


def validate_change_dict_for_blog_post(
change_dict: blog_services.BlogPostChangeDict
) -> blog_services.BlogPostChangeDict:
Expand Down
29 changes: 29 additions & 0 deletions core/controllers/domain_objects_validator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,35 @@ def test_valid_object_raises_no_exception(self) -> None:
config_properties)


class ValidateNewDefaultValueForPlatformParametersTests(
test_utils.GenericTestBase
):
"""Tests to validate default value dict coming from API."""

def test_valid_object_raises_no_exception(self) -> None:
default_value = {'value': False}
(
domain_objects_validator.
validate_new_default_value_of_platform_parameter(default_value)
)

def test_invalid_type_raises_exception(self) -> None:
default_value = {'value': [10]}
with self.assertRaisesRegex(
Exception, (
'Expected type to be typing.Union\\[str, int, bool, float] '
'but received \\[10]')
):
# TODO(#13059): Here we use MyPy ignore because after we fully
# type the codebase we plan to get rid of the tests that
# intentionally test wrong inputs that we can normally catch
# by typing.
(
domain_objects_validator.
validate_new_default_value_of_platform_parameter(default_value) # type: ignore[arg-type]
)


class ValidateChangeDictForBlogPost(test_utils.GenericTestBase):
"""Tests to validate change_dict containing updated values for blog
post object coming from API."""
Expand Down
12 changes: 7 additions & 5 deletions core/controllers/platform_feature_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ def setUp(self) -> None:
],
'value_when_matched': True
})
]
],
False
)

# Here we use MyPy ignore because the expected type of ALL_FEATURE_FLAGS
Expand Down Expand Up @@ -208,10 +209,10 @@ def setUp(self) -> None:
self.user_id = self.get_user_id_from_email(self.OWNER_EMAIL)

def tearDown(self) -> None:
feature_services.update_feature_flag_rules(
feature_services.update_feature_flag(
param_list.ParamNames.DUMMY_FEATURE_FLAG_FOR_E2E_TESTS.value,
self.user_id,
'clear rule', []
'clear rule', [], False
)

super().tearDown()
Expand All @@ -220,7 +221,7 @@ def _set_dummy_feature_status_for_mode(
self, is_enabled: bool, mode: param_domain.ServerMode
) -> None:
"""Enables the dummy_feature for the dev environment."""
feature_services.update_feature_flag_rules(
feature_services.update_feature_flag(
param_list.ParamNames.DUMMY_FEATURE_FLAG_FOR_E2E_TESTS.value,
self.user_id,
'update rule for testing purpose',
Expand All @@ -230,7 +231,8 @@ def _set_dummy_feature_status_for_mode(
'type': 'server_mode',
'conditions': [['=', mode.value]]
}]
})]
})],
False
)

def _mock_dummy_feature_stage(
Expand Down
Loading

0 comments on commit aebbdd2

Please sign in to comment.