March 6, 2022

Set Default Weight of Common Problem on Open edX

Activities, Android Developer, Ansible, Apache2, Atlassian, Ayo Belajar Linux, Bestpath Network, BLC Telkom Klaten, BSD, Caddy Server, Case Study, Cisco, Cisco Indonesia, Cloud Computing, Cockpit, Custom Weapons, Docker, E-Learning, Engenius, Error, FreeBSD, FreeBSD Indonesia, Komunitas Pengguna Linux Indonesia, KPLI Bulukumba, KPLI Klaten, Lets Encrypt, Linux, MacOS, Microsoft Azure, Microsoft SQL Server, MikroTik, MikroTik Indonesia, MySQL, Nginx, Open edX, OpenSID, Others, PHP, phpMyAdmin, PostgreSQL, Proxmox, Python, Redash, Sendy, SSH, Stories, Subnetting, TP-Link, Ubiquiti, Unix, Virtualization, Windows, X-Mosque, Faizar Septiawan, Icar, siBunglonGanteng, Orang Ganteng, siBunglonLabs, Programmer, SysAdmin, Site Reliability Engineer, Developer, Palugada, Makassar, Ganteng, Gila, Cyclist, Panglima, Setan, Panglima Setan, sibunglon, Ganteng

By default, problem weight of Blank Common Problem component (including multiple choice components, checkboxes, etc.) has not been set so that the problem weight is based on the number of problems. But this configuration can be override, for example want to set it 100 as default. Follow the steps below:

  1. Go to Open edX server console.

  2. Open and edit file /edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/capa_base.py.

  3. Find the following codes snippet:

    ...
        weight = Float(
            display_name=_("Problem Weight"),
            help=_("Defines the number of points each problem is worth. "
                   "If the value is not set, each response field in the problem is worth one point."),
            values={"min": 0, "step": .1},
            scope=Scope.settings
        )
    ...
    
  4. Then update the code, add default=100,. See the following codes snippet:

    ...
        weight = Float(
            display_name=_("Problem Weight"),
            help=_("Defines the number of points each problem is worth. "
                   "If the value is not set, each response field in the problem is worth one point."),
            values={"min": 0, "step": .1},
            default=100,
            scope=Scope.settings
        )
    ...
    
  5. Restart LMS and CMS services.