mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
* possible fix for 9844 * fix typo in challengeModal file * remove lines for empty users
This commit is contained in:
committed by
Sabe Jones
parent
ae27ae0090
commit
1dc558ddba
@@ -53,8 +53,7 @@
|
||||
input(type='number', :min='minPrize', :max='maxPrize', v-model="workingChallenge.prize")
|
||||
.row.footer-wrap
|
||||
.col-12.text-center.submit-button-wrapper
|
||||
.alert.alert-warning(v-if='insufficientGemsForTavernChallenge')
|
||||
You do not have enough gems to create a Tavern challenge
|
||||
.alert.alert-warning(v-if='insufficientGemsForTavernChallenge') You do not have enough gems to create a Tavern challenge
|
||||
// @TODO if buy gems button is added, add analytics tracking to it
|
||||
// see https://github.com/HabitRPG/habitica/blob/develop/website/views/options/social/challenges.jade#L134
|
||||
button.btn.btn-primary(v-if='creating && !cloning', @click='createChallenge()', :disabled='loading') {{$t('createChallengeAddTasks')}}
|
||||
|
||||
@@ -592,13 +592,12 @@ api.exportChallengeCsv = {
|
||||
|
||||
let resArray = members.map(member => [member._id, member.profile.name]);
|
||||
|
||||
// We assume every user in the challenge as at least some data so we can say that members[0] tasks will be at tasks [0]
|
||||
let lastUserId;
|
||||
let index = -1;
|
||||
tasks.forEach(task => {
|
||||
if (task.userId !== lastUserId) {
|
||||
lastUserId = task.userId;
|
||||
while (task.userId !== lastUserId) {
|
||||
index++;
|
||||
lastUserId = resArray[index][0]; // resArray[index][0] is an user id
|
||||
}
|
||||
|
||||
const streak = task.streak || 0;
|
||||
@@ -611,8 +610,18 @@ api.exportChallengeCsv = {
|
||||
return result.concat(array);
|
||||
}, []).sort();
|
||||
resArray.unshift(['UUID', 'name']);
|
||||
|
||||
_.times(challengeTasks.length, () => resArray[0].push('Task', 'Value', 'Notes', 'Streak'));
|
||||
|
||||
// Remove lines for users without tasks info
|
||||
resArray = resArray.filter((line) => {
|
||||
if (line.length === 2) { // only user data ([id, profile name]), no task data
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
res.set({
|
||||
'Content-Type': 'text/csv',
|
||||
'Content-disposition': `attachment; filename=${challengeId}.csv`,
|
||||
|
||||
Reference in New Issue
Block a user