General developer forum

assignment_id in URL doesn't match with database??

 
Picture of Jülide Dursun
assignment_id in URL doesn't match with database??
 

Hi everyone,


I am sending grades from an excel-sheet to moodle via web services. I'm calling the user_id, grade_value, a comment and the assignment_id. It is really strange, but the assignment_id in the URL does not match with the assignment_id in the database. When I use the assignment_id of the URL, the grades are not sent from excel sheet to moodle. So I always have to check the assignment_id in the database, which is awkward.

What do I have to do to make assignment_id in URL and database same??

Can anyone help please?

 
Average of ratings: -
Picture of Elias Nord
Re: assignment_id in URL doesn't match with database??
 

you have to check whenever id in the url matches the id in the database.

 
Average of ratings: -
Picture of Jülide Dursun
Re: assignment_id in URL doesn't match with database??
 

But the assignment id in the url does never match the id in the database. The course id is in the url and in the database the same, but there is a problem wirth the assignment id. 

For example:

The assignment id for a assignment has the id=6 in the url, but in the database the id=4. So I have to enter the id=4 in my excel sheet for getting the grade uploaded to moodle. But I do not want to check everytime my database for every task and do not understand why the id in the url does not match the id in the database. 

 
Average of ratings: -
Davo
Re: assignment_id in URL doesn't match with database??
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

The id in the assignment view URL is the course module id, not the id of the assignment record. If you want to get the ID of the assignment record, then you need to look in the mdl_modules database table, to find the instance from the id of the record.

See https://docs.moodle.org/dev/Course_module for more details.

 
Average of ratings: -
Picture of Christopher Molnar
Re: assignment_id in URL doesn't match with database??
 

Is there a web service that will return this information for a course?

 
Average of ratings: -
Picture of Paul Holden
Re: assignment_id in URL doesn't match with database??
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Looks like calling get_course_contents specifying $options['modname'] would be the place to start

 
Average of ratings: -