User:Ndhanir: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
 
(25 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{db-multiple|U5|G11}}
{{Infobox software
{{Infobox software
| name                  =  
| name                  =  
Line 14: Line 15:




Web.py is a [https://en.wikipedia.org/wiki/Free_and_open_source free and open source] [https://en.wikipedia.org/wiki/Web_framework Web application framework] that is as simple as it is powerful.
Web.py is a [[free and open source]] [[Web application framework]] that is as simple as it is powerful.


The web.py slogan is: "Think about the ideal way to write a web app. Write the code to make it happen."[http://webpy.org/]. The goal of web.py is to build the ideal way to make web apps. Web.py allows the user to build [[HTTP]] responses instead of exposing [[Python]]] objects. Web.py allows the user to access the [[database]] easily without making the database look like an object. Also, the web.py template system tries to bring Python into [[HTML]][http://webpy.org/philosophy].
The web.py slogan is: "Think about the ideal way to write a web app. Write the code to make it happen."<ref>{{Cite web|title = web.py official website|url = http://webpy.org/|website = web.py}}</ref>. The goal of web.py is to build the ideal way to make web apps. web.py allows the user to build [[HTTP]] responses instead of exposing [[Python]] objects. In web.py, [[database]] can be accessed easily as the framework makes database look like an [[object (computer science)|object]]. Also, the template system in web.py helps the user to bring Python into [[HTML]]<ref>{{Cite web|title = web.py philosophy|url = http://webpy.org/philosophy|website = web.py philosophy}}</ref>. "It's the anti-framework framework. web.py doesn't get in your way." explained founder Steve Huffman.


Some of the [https://en.wikipedia.org/wiki/Website websites] which uses web.py are
Some of the [[websites]] which uses web.py are
* [http://frinki.com/ Frinki], a new social network in spanish.
* [http://frinki.com/ Frinki], a new social network in spanish.
* [http://www.oyster.com/ oyster.com], a website that reviews hotels uses web.py for the entire website.
* [http://www.oyster.com/ oyster.com], a website that reviews hotels uses web.py for the entire website.
Line 25: Line 26:
=='''History'''==
=='''History'''==


Web.py was originally published while Aaron swartz worked at [http://reddit.com/ reddit.com], where the site used it as it grew to become one of the top 1000 sites according to [http://www.alexa.com/topsites/global;1 Alexa] and served millions of daily page views. "It's the anti-framework framework. web.py doesn't get in your way." explained founder Steve Huffman.
web.py was originally published while [[Aaron swartz]] worked at [http://reddit.com/ reddit.com], where the site used it as it grew to become one of the top 1000 sites according to [http://www.alexa.com/topsites/global;1 Alexa] and served millions of daily page views<ref>{{Cite web|title = Aaron swartz about web.py|url = http://www.aaronsw.com/weblog/rewritingreddit}}</ref>. The site was rewritten using other tools after being acquired by Condé Nast.


=='''Python'''==
=='''Why Web.py?'''<ref>{{Cite web|title = Python development story, Why web.py?|url = http://faruk.akgul.org/blog/python-development-story-why-webpy/|website = why web.py}}</ref>==
 
Python is a [https://en.wikipedia.org/wiki/Multi-paradigm_programming_language multi-paradigm programming language]: object-oriented programming and [https://en.wikipedia.org/wiki/Structured_programming structured programming] are fully supported, and there are a number of language features which support functional programming and aspect-oriented programming (including by [https://en.wikipedia.org/wiki/Metaprogramming metaprogramming]). Python uses [https://en.wikipedia.org/wiki/Dynamic_typing dynamic typing] and a combination of reference counting and a cycle-detecting garbage collector for [https://en.wikipedia.org/wiki/Memory_management memory management]. An important feature of Python is dynamic [https://en.wikipedia.org/wiki/Name_resolution_(programming_languages) name resolution], which binds method and variable names during program execution.
 
Ruby's creator, Yukihiro Matsumoto, has said: "I wanted a scripting language that was more powerful than Perl, and more object-oriented than [https://en.wikipedia.org/wiki/Python_(programming_language) '''Python''']. That's why I decided to design my own language."
 
The world of Python web frameworks is full of choices. [[Django]], [[Flask]], [[Pyramid]], Tornado, [[Bottle]], Diesel, Pecan, Falcon, web.py, web2py and many more are competing for developer mindshare. The developer needs to cut the options down to one framework depending on the type of application.
 
=='''Why Web.py?'''==


The reasons for using web.py are
The reasons for using web.py are
Line 44: Line 37:
* A solid web framework
* A solid web framework


=='''Installation'''==
=='''Installation'''<ref>{{Cite web|title = web.py Installation|url = http://webpy.org/|website = Installation of web.py in linux}}</ref>==
To install web.py,  
To install web.py on Linux based operating system,  
* Firstly, download the following tar file:
* Firstly, download the following tar file:
  wget http://webpy.org/static/web.py-0.37.tar.gz
  wget http://webpy.org/static/web.py-0.37.tar.gz
Line 55: Line 48:
  sudo python setup.py install
  sudo python setup.py install


=='''Web.py skeleton'''==
=='''Web.py skeleton'''<ref>{{Cite web|title = web.py GitHub|url = https://github.com/webpy/webpy|website = web.py github}}</ref>==


Every web application needs a skeleton. A sample skeleton of web.py application looks as follows.
Every web application needs a skeleton. A sample skeleton of web.py application looks as follows.
Line 73: Line 66:
** public: This folder contains the minimized compiled [[CSS]], [[Javascript]], [[CoffeeScript]] files and images so the files in this folder are production ready and can't be used in development.
** public: This folder contains the minimized compiled [[CSS]], [[Javascript]], [[CoffeeScript]] files and images so the files in this folder are production ready and can't be used in development.
** static: Contains the development CSS, CoffeeScript, Javascript, and images files of the project.
** static: Contains the development CSS, CoffeeScript, Javascript, and images files of the project.
** test: As you can guess easily, these are the test files.
** test: These are the test files.
** tmp: Garbage files.
** tmp: Garbage files.
** main.py: These are the only files that are directly executed by the server.
** main.py: These are the only files that are directly executed by the server.
** main_development.py: Main executable file in development mode.
** main_development.py: Main executable file in development mode.
** settings.py: Global constants and settings of the application.
** settings.py: Global constants and settings of the application.
** urls.py: Contains URL's of the application
** urls.py: Contains [[URL]]'s of the application


=='''Features of web.py'''==
=='''Features of web.py'''==
Line 84: Line 77:
''web.py has two unique features''
''web.py has two unique features''


===Databases===
===Databases<ref>{{Cite web|title = web.py Databases|url = http://webpy.org/cookbook/select|website = web.py Database db.select}}</ref>===


The database package lets the user access different databases. Accessing different databases refers to connecting to multiple databases. However, its not an [https://en.wikipedia.org/wiki/Object-relational_mapping ORM].  
The database package lets the user access various different databases. Accessing different databases refers to connecting multiple databases. However, its not an [[ORM]]. It is similar to sqlite3 package which doesn't use ORM. This feature is missing in [[Django]] (another web framework). web.py has flexible modules which allow the user to wipe it out completely and use with another web framework.
The databases in ruby benefit the people who are good at SQL and don't like to use ORM. This feature is missing in [https://en.wikipedia.org/wiki/Django_(web_framework) Django] (another web framework based on python). [http://webpy.org/docs/0.3/tutorial]
Before creating database object, the user must install appropriate database library like psycopg2 for [[PostgreSQL]], MySQLdb for [[MySQL]] and sqlite3 for [[SQLite]]. Working with more databases is not at all difficult with web.py which is explained by the following example:
<pre>
db1 = web.database(dbn='postgres', db='dbname1', user='username1', pw='password2')
db2 = web.database(dbn='postgres', db='dbname2', user='username2', pw='password2')
</pre>


===Forms===
===Forms<ref>{{Cite web|title = web.py Forms|url = http://webpy.org/cookbook/forms|website = Usage of forms in web.py}}</ref>===


A forms package is present in web.py which let's us create forms and [https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms/Data_form_validation validators]. The form module of web.py allows the ability to generate html forms, get user input, and validate it before processing it or adding it to a database. But it doesn't have built-in protection against [https://en.wikipedia.org/wiki/Cross-site_request_forgery CSRF]. A simple login form would look as given below:
A forms package is present in web.py which let's the user create forms and [https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms/Data_form_validation validators]. The form module of web.py allows the ability to generate html forms, get user input, and validate it before processing it or adding it to a database. But it doesn't have built-in protection against [[CSRF]]. A sample login form is as follows:  
<pre>
<pre>
login = form.Form(
login = form.Form(
Line 100: Line 97:
</pre>
</pre>


Another feature about web.py is its flexibility. It has flexible modules which can be used with another framework.
Another interesting feature about web.py is its flexibility. It has flexible modules which can be used with another framework.


=='''Hello world example'''==
=='''Hello world example'''==
Line 116: Line 113:
app = web.application(urls, globals())
app = web.application(urls, globals())
app.run()
app.run()
</pre>[http://webpy.org/docs/0.3/tutorial]
</pre>


Consider the given example, the user start the application by importing the web.py module using the following command
If the above example is considered, then the user start the application by importing the web.py module using the following command
  import web
  import web


Line 129: Line 126:
</pre>
</pre>


The first part is a [https://en.wikipedia.org/wiki/Regular_expression regular expressions] that matches a URL, like /, /help/faq, /item/, etc. The parentheses say to capture that piece of the matched data for use later on. The second part is the name of a class to send the request to, like index, view, welcome, hello (which gets the hello ECE517 of the welcome module), or get_\1. \1 is replaced by the first capture of your regular expression; any remaining captures get passed to your funct just browsing around, your browser uses a language known as HTTP for communicating with the World Wide Web. The details aren't important, but the basic idea is that Web visitors ask web servers to perform certain functions (like GET or POST) on URLs (like / or /foo?f=1).
The first part is a [[regular expressions]] that matches a URL, like /, /help/faq, /item/, etc. The parentheses say to capture that piece of the matched data for use later on. The second part is the name of a class to send the request to, like index, view, welcome, hello (which gets the hello ECE517 of the welcome module), or get_\1. \1 is replaced by the first capture of the regular expression; any remaining captures get passed to function.<ref>{{Cite web|title = web.py Hello world example|url = http://webpy.org/docs/0.3/tutorial|website = Web.py example tutorial}}</ref>
 
GET is the one we're all familiar with, the one used to request the text of a web page. When you type harvard.edu into your web browser, it literally asks the Harvard web server to GET /. The second-most famous, POST, is often used when submitting certain kinds of forms, like a request to purchase something. You use POST whenever the act of submitting a request does something (like charge your credit card and process an order). This is key, because GET URLs can be passed around and indexed by search engines, which you definitely want for most of your pages but definitely don't want for things like processing orders (imagine if Google tried to buy everything on your site!).


At the top of each application, the user usually see the full URL dispatching scheme defined as a tuple.
<pre>
<pre>
class index:
urls = (
     def GET(self):
    "/tasks/?", "signin",
        return "Hello, world!"
    "/tasks/list", "listing",
    "/tasks/post", "post",
     "/tasks/act", "actions",
    "/tasks/signup", "signup"
)
</pre>
</pre>
This GET function will now get called by web.py anytime someone makes a GET request for /.
The format of this tuple is: url-path-pattern, handler-class this pattern will repeat as more url patterns are defined.
 
=='''Conclusion'''==
 
web.py is a minimalist framework whose aim is not to abstract away the details of interacting with the Web, but to make that interaction easier. It is designed in such a way that user will get started quickly with web.py and find writing [http://www.w3schools.com/tags/ref_httpmethods.asp HTTP GET] function handlers directly<ref>{{Cite web|title = comparison of frameworks|url = http://www.infoworld.com/article/2622836/application-development/pillars-of-python--six-python-web-frameworks-compared.html?page=2|website = Comparison of different python web frameworks}}</ref>. Likewise, the web.py database system does not abstract away [[SQL]] rather than hide the fact that the user is querying a database. It hides the details of working with different databases. The framework of web.py is light, photonic when compared to frameworks like [[flask (web_framework) | flask]].
 
=='''See Also'''==
[[Django]]


Now we need to create an application specifying the urls and a way to tell web.py to start serving web pages:
[[Bottle (web framework) | Bottle]]


<pre>
=='''References'''==
if __name__ == "__main__":
 
    app = web.application(urls, globals())
 
    app.run()
 
</pre>
 
First we tell web.py to create an application with the URLs we listed above, looking up the classes in the global namespace of this file. And finally we make sure that web.py serves the application we created above.
 
 
 
 
 
 
=='''Wiki write up'''==
 
About Review mapping controller
 
/* When a reviewerreport reviews, assigning reviews and quizzes to teams. It also contains methods to assign reviews to participants automatically*/ Ignore this
 
Review mapping controller contains methods related to peer reviewing strategies. It contains methods to add a reviewer, delete a reviewer, selecting a reviewer. Depending on the number of students and number of submissions, the topics to be reviewed are assigned to the students automatically. If a user wants to look for the submission team , it returns the team by comparing the submission id's with the team id's. Also, it assigns quizzes dynamically. Generation of review report, feedback report and teammate review is done.


=='''Conclusion'''==
==='''Code Improvements'''===


The philosophy of Web.py, a minimalist framework, is not to abstract away the details of interacting with the Web, but to make that interaction easier. It gives you freedom and does what you say. You will find yourself writing HTTP GET function handlers directly. Likewise, the Web.py database system does not abstract away SQL rather than hide the fact that you're querying a database. It hides the details of working with different databases. Web.py defines a template language and lets you embed arbitrary Python code in a Web page. Web.py is ideal if you're already familiar with building Web applications. You'll get started quickly with Web.py and is recommended for simple Web applications.
1. Unused variables and arguments: There are unused variables in the methods. If there are unused variables in the methods, it uses stack unnecessarily. So, it is better to remove the unused variables.


=='''See Also'''==
When both keys and values are not used, but given as arguments, then the used variables can be added "_" or replaced with "_" to represent it as unused variable but allowed in the arguments.


[https://en.wikipedia.org/wiki/Django_(web_framework) Django]
<pre>
At line 533 and line 539
Previous Code: teams_hash = unsorted_teams_hash.sort_by{|k, v| v}.to_h
After Changing the code: teams_hash = unsorted_teams_hash.sort_by{|_, v| v}.to_h
</pre>


[http://www.web2py.com/init/default/what Web2py]
2. Use sample instead of shuffle
When sample is used, the elements are chosen by using random and unique indices in the array so that the elements doesn't repeat in the array. This cannot be guaranteed in shuffle.


[https://en.wikipedia.org/wiki/Pylons_project Pyramid]
<pre>


[https://en.wikipedia.org/wiki/Flask_(web_framework) Flask]
Previous Code:
assignment_team = assignment_teams.to_a.shuffle[0] rescue nil


[https://en.wikipedia.org/wiki/Bottle_(web_framework) Bottle]
topic = assignment.candidate_topics_to_review(reviewer).to_a.shuffle[0] rescue nil


=='''References'''==
After Changing the code:
[[#References|[1]]] web.py official website: http://webpy.org/


[[#References|[2]]] python development story: http://faruk.akgul.org/blog/python-development-story-why-webpy/
assignment_team = assignment_teams.to_a.sample rescue nil


[[#References|[3]]] pillars of python-six web frameworks: http://www.infoworld.com/article/2622836/application-development/pillars-of-python--six-python-web-frameworks-compared.html?page=2
topic = assignment.candidate_topics_to_review(reviewer).to_a.sample rescue nil
</pre>


[[#References|[4]]] Django vs flash vs pyramid https://www.airpair.com/python/posts/django-flask-pyramid


[[#References|[5]]] Form Validation: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms/Data_form_validation
==='''Testing UI'''===


[[#References|[6]]] Aaron swartz about web.py http://www.aaronsw.com/weblog/rewritingreddit
'''Peer review information:'''
* Instructor Login:
        Username: Instructor6
        Password: password
* Student login:
        Username: Student6384
        Password: password


[[#References|[7]]] https://www.wikipedia.org/
'''Steps for testing UI:'''
# Login as an instructor (Using Instructor6 will help you import the participants from other assignments).
# Navigate to "Manage->Assignments".
# Click on "New Public Assignment" for creating a new assignment.
# Create a new assignment by providing assignment name, selecting a course, submission directory (Give any name) and description URL.
# Select "has teams?" and provide the team size. Click on create to create a new assignment.
## After that, click on review strategy and limit the number of reviews per submission.
## Click on "Due dates" and update date for submission and review. Adjust the review date and time in order to test the reviews.
## Click on "save". A new assignment is created and it can be viewed in "Manage->Assignments" section.
# In order to add participants, there are two methods to add students to the assignment.
## Click on "add participants" against the assignment. Enter the user login to add the student. Add atleast 6 participants so that the review mapping can be seen.
## Click on any previous assignment "add participants" and export the students list (I used wiki assignment).
## Click on your assignment "add participants" and import the students using the export file.
# Go back to "Assignments" section and click against "create teams".
## After clicking on "create teams", Click on "create teams" in the directed page.
### Teams can be formed either manually or automatically.
# Login as a student to submit the links for assignment (Valid hyperlink must be provided in the submission link). Add submission for atleast 5 students in order to check the automatic review mapping. (Password for student is password)
# After submitting the links for some students, Log in as an instructor to change the assignment phase to review phase.
## To change the review phase period, Go to assignments section and click on edit. Click on due dates and change the review due date.
# Now, login as a student and go to others work. Click on "Request a submission to review" and check whether a review is assigned automatically. If no assignments are submitted, then this cannot be tested.
# For teammate review report, author feedback report and review report, click against "review report" and all the review reports can be seen by selecting it in the drop down menu.

Latest revision as of 05:42, 1 April 2016

Template:Db-multiple Template:Infobox software


Web.py is a free and open source Web application framework that is as simple as it is powerful.

The web.py slogan is: "Think about the ideal way to write a web app. Write the code to make it happen."<ref></ref>. The goal of web.py is to build the ideal way to make web apps. web.py allows the user to build HTTP responses instead of exposing Python objects. In web.py, database can be accessed easily as the framework makes database look like an object. Also, the template system in web.py helps the user to bring Python into HTML<ref></ref>. "It's the anti-framework framework. web.py doesn't get in your way." explained founder Steve Huffman.

Some of the websites which uses web.py are

  • Frinki, a new social network in spanish.
  • oyster.com, a website that reviews hotels uses web.py for the entire website.
  • Make History, a project of the 9/11 memorial museum.

History

web.py was originally published while Aaron swartz worked at reddit.com, where the site used it as it grew to become one of the top 1000 sites according to Alexa and served millions of daily page views<ref></ref>. The site was rewritten using other tools after being acquired by Condé Nast.

Why Web.py?<ref></ref>

The reasons for using web.py are

  • Simplicity
  • Freedom
  • Writing clean code
  • Minimalism
  • A solid web framework

Installation<ref></ref>

To install web.py on Linux based operating system,

  • Firstly, download the following tar file:
wget http://webpy.org/static/web.py-0.37.tar.gz
  • Extract the downloaded tar file:
tar -zxvf web.py-0.37.tar.gz
  • Go to web.py-0.37 directory:
cd web.py-0.37/
  • Install and make it accessible to all the applications:
sudo python setup.py install

Web.py skeleton<ref></ref>

Every web application needs a skeleton. A sample skeleton of web.py application looks as follows.

  • doc: Documentation of all the files.
  • licenses: All the licenses of the project and the libraries used in the application.
  • requirements: Specifying the third party libraries.
  • sh: bash script files of the project.
  • www: The required web application itself.
    • app: contains the application modules.
      • controllers: This module contains the handler modules of controller package.
      • tools: Tools that are used for the project.
      • views]: Template files.
      • models: Database models of the application.
      • bridge: It is used to communicate with the server which is written in another language.
    • lib: The library files developed for the project. These are different from the tools mentioned in the app. Libraries can be used in other projects where as tools are limited to the project itself.
    • public: This folder contains the minimized compiled CSS, Javascript, CoffeeScript files and images so the files in this folder are production ready and can't be used in development.
    • static: Contains the development CSS, CoffeeScript, Javascript, and images files of the project.
    • test: These are the test files.
    • tmp: Garbage files.
    • main.py: These are the only files that are directly executed by the server.
    • main_development.py: Main executable file in development mode.
    • settings.py: Global constants and settings of the application.
    • urls.py: Contains URL's of the application

Features of web.py

web.py has two unique features

Databases<ref></ref>

The database package lets the user access various different databases. Accessing different databases refers to connecting multiple databases. However, its not an ORM. It is similar to sqlite3 package which doesn't use ORM. This feature is missing in Django (another web framework). web.py has flexible modules which allow the user to wipe it out completely and use with another web framework. Before creating database object, the user must install appropriate database library like psycopg2 for PostgreSQL, MySQLdb for MySQL and sqlite3 for SQLite. Working with more databases is not at all difficult with web.py which is explained by the following example:

db1 = web.database(dbn='postgres', db='dbname1', user='username1', pw='password2')
db2 = web.database(dbn='postgres', db='dbname2', user='username2', pw='password2')

Forms<ref></ref>

A forms package is present in web.py which let's the user create forms and validators. The form module of web.py allows the ability to generate html forms, get user input, and validate it before processing it or adding it to a database. But it doesn't have built-in protection against CSRF. A sample login form is as follows:

login = form.Form(
    form.Textbox('username'),
    form.Password('password'),
    form.Button('Login'),
)

Another interesting feature about web.py is its flexibility. It has flexible modules which can be used with another framework.

Hello world example

import web
urls = (
	'/', 'index'
	)

class index:
	def GET(self):
		return "Hello, ECE517!"

if __name__ == "__main__":
	app = web.application(urls, globals())
	app.run()

If the above example is considered, then the user start the application by importing the web.py module using the following command

import web

The most important part of the website is its URL structure. web.py makes it easy to make great URLs.

urls = (
  '/', 'index'
)

The first part is a regular expressions that matches a URL, like /, /help/faq, /item/, etc. The parentheses say to capture that piece of the matched data for use later on. The second part is the name of a class to send the request to, like index, view, welcome, hello (which gets the hello ECE517 of the welcome module), or get_\1. \1 is replaced by the first capture of the regular expression; any remaining captures get passed to function.<ref></ref>

At the top of each application, the user usually see the full URL dispatching scheme defined as a tuple.

urls = (
    "/tasks/?", "signin",
    "/tasks/list", "listing",
    "/tasks/post", "post",
    "/tasks/act", "actions",
    "/tasks/signup", "signup"
)

The format of this tuple is: url-path-pattern, handler-class this pattern will repeat as more url patterns are defined.

Conclusion

web.py is a minimalist framework whose aim is not to abstract away the details of interacting with the Web, but to make that interaction easier. It is designed in such a way that user will get started quickly with web.py and find writing HTTP GET function handlers directly<ref></ref>. Likewise, the web.py database system does not abstract away SQL rather than hide the fact that the user is querying a database. It hides the details of working with different databases. The framework of web.py is light, photonic when compared to frameworks like flask.

See Also

Django

Bottle

References

Wiki write up

About Review mapping controller

/* When a reviewerreport reviews, assigning reviews and quizzes to teams. It also contains methods to assign reviews to participants automatically*/ Ignore this

Review mapping controller contains methods related to peer reviewing strategies. It contains methods to add a reviewer, delete a reviewer, selecting a reviewer. Depending on the number of students and number of submissions, the topics to be reviewed are assigned to the students automatically. If a user wants to look for the submission team , it returns the team by comparing the submission id's with the team id's. Also, it assigns quizzes dynamically. Generation of review report, feedback report and teammate review is done.

Code Improvements

1. Unused variables and arguments: There are unused variables in the methods. If there are unused variables in the methods, it uses stack unnecessarily. So, it is better to remove the unused variables.

When both keys and values are not used, but given as arguments, then the used variables can be added "_" or replaced with "_" to represent it as unused variable but allowed in the arguments.

At line 533 and line 539
Previous Code: teams_hash = unsorted_teams_hash.sort_by{|k, v| v}.to_h
After Changing the code: teams_hash = unsorted_teams_hash.sort_by{|_, v| v}.to_h

2. Use sample instead of shuffle When sample is used, the elements are chosen by using random and unique indices in the array so that the elements doesn't repeat in the array. This cannot be guaranteed in shuffle.


Previous Code:
assignment_team = assignment_teams.to_a.shuffle[0] rescue nil

topic = assignment.candidate_topics_to_review(reviewer).to_a.shuffle[0] rescue nil

After Changing the code:

assignment_team = assignment_teams.to_a.sample rescue nil

topic = assignment.candidate_topics_to_review(reviewer).to_a.sample rescue nil


Testing UI

Peer review information:

  • Instructor Login:
       Username: Instructor6
       Password: password
  • Student login:
       Username: Student6384
       Password: password

Steps for testing UI:

  1. Login as an instructor (Using Instructor6 will help you import the participants from other assignments).
  2. Navigate to "Manage->Assignments".
  3. Click on "New Public Assignment" for creating a new assignment.
  4. Create a new assignment by providing assignment name, selecting a course, submission directory (Give any name) and description URL.
  5. Select "has teams?" and provide the team size. Click on create to create a new assignment.
    1. After that, click on review strategy and limit the number of reviews per submission.
    2. Click on "Due dates" and update date for submission and review. Adjust the review date and time in order to test the reviews.
    3. Click on "save". A new assignment is created and it can be viewed in "Manage->Assignments" section.
  6. In order to add participants, there are two methods to add students to the assignment.
    1. Click on "add participants" against the assignment. Enter the user login to add the student. Add atleast 6 participants so that the review mapping can be seen.
    2. Click on any previous assignment "add participants" and export the students list (I used wiki assignment).
    3. Click on your assignment "add participants" and import the students using the export file.
  7. Go back to "Assignments" section and click against "create teams".
    1. After clicking on "create teams", Click on "create teams" in the directed page.
      1. Teams can be formed either manually or automatically.
  8. Login as a student to submit the links for assignment (Valid hyperlink must be provided in the submission link). Add submission for atleast 5 students in order to check the automatic review mapping. (Password for student is password)
  9. After submitting the links for some students, Log in as an instructor to change the assignment phase to review phase.
    1. To change the review phase period, Go to assignments section and click on edit. Click on due dates and change the review due date.
  10. Now, login as a student and go to others work. Click on "Request a submission to review" and check whether a review is assigned automatically. If no assignments are submitted, then this cannot be tested.
  11. For teammate review report, author feedback report and review report, click against "review report" and all the review reports can be seen by selecting it in the drop down menu.