Moved incrementCourseAttemptCount

GetBufferQueues is called in other places leading to fake attempt counts
This commit is contained in:
Jonathan Barrow 2022-01-03 16:51:46 -05:00
parent e9adee15b0
commit 8a34bd1855
3 changed files with 14 additions and 1 deletions

View File

@ -19,7 +19,6 @@ func getBufferQueue(err error, client *nex.Client, callID uint32, param *nexprot
pBufferQueue = make([][]byte, 0)
case 3: // death data
pBufferQueue = getBufferQueueDeathData(param.DataID)
incrementCourseAttemptCount(param.DataID) // We also know this is when a user attempts a course
default:
fmt.Printf("[Warning] DataStoreSMMProtocol::GetBufferQueue Unsupported slot: %v\n", param.Slot)
}

View File

@ -1,6 +1,8 @@
package main
import (
"strconv"
nex "github.com/PretendoNetwork/nex-go"
nexproto "github.com/PretendoNetwork/nex-protocols-go"
)
@ -8,6 +10,12 @@ import (
func suggestedCourseSearchObject(err error, client *nex.Client, callID uint32, param *nexproto.DataStoreSearchParam, extraData []string) {
// TODO complete this
courseID, _ := strconv.ParseUint(extraData[0], 0, 64)
if userNotOwnCourse(courseID, client.PID()) {
incrementCourseAttemptCount(courseID) // We also know this is when a user attempts a course
}
pRankingResults := make([]*nexproto.DataStoreCustomRankingResult, 0)
courseMetadatas := getCourseMetadatasByLimit(4) // In PCAPs param.minimalRatingFrequency is 4 but is 0 here?

View File

@ -168,3 +168,9 @@ func userMiiDataToDataStoreMetaInfo(ownerID uint32, miiInfo primitive.M) *nexpro
return metaInfo
}
func userNotOwnCourse(courseID uint64, pid uint32) bool {
courseMetadata := getCourseMetadataByDataID(courseID)
return courseMetadata.OwnerPID != pid
}