Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Story/vspc 171 #266

Open
wants to merge 144 commits into
base: develop
Choose a base branch
from
Open

Story/vspc 171 #266

wants to merge 144 commits into from

Conversation

glend17
Copy link
Contributor

@glend17 glend17 commented Nov 12, 2021

Guidelines for Pull Requests

If you haven't yet read our code review guidelines, please do so, You can find them here.

Please confirm the following by adding an x for each item (turn [ ] into [x]).

  • I have removed all code style changes that are not necessary (e.g. changing blanks across the whole file that don’t need to be changed, adding empty lines in parts other than your own code)
  • I am not making any changes to files that don’t have any effect (e.g. imports added that don’t need to be added)
  • I do not have any sysout statements in my code or commented out code that isn’t needed anymore
  • I am not reformatting any files in the wrong format or without cause.
  • I am not changing file encoding or line endings to something else than UTF-8, LF
  • My pull request does not show an insane amount of files being changed although my ticket only requires a few files being changed
  • I have added Javadoc/documentation where appropriate
  • I have added test cases where appropriate
  • I have explained any part of my code/implementation decisions that is not be self-explanatory

Please provide a brief description of your ticket

(you can copy the ticket if it hasn't changed)

https://diging.atlassian.net/browse/VSPC-171

Anything else the reviewer needs to know?

I have added a new content block type called Space Block, which has the same properties as the content block with an additional parameter for linking to a space. I have allowed the selection of a space for the Staff User from a drop down

@diging-jenkins
Copy link

Can one of the admins verify this patch?

}

}
return selectedSpaceForSpaceBlock;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this method for? why does it retrieve space blocks again? (also if you. need to check the type of an object you should use instanceof).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this method as it was not needed


} catch (BlockDoesNotExistException e) {
logger.warn("Text Id does not exist, bad request.", e);
return new ResponseEntity<String>(HttpStatus.BAD_REQUEST);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if a block doesn't exist, there should be a 404 returned

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

List<ISpace> spaces = new ArrayList<ISpace>();
spaceRepo.findAll().forEach(s -> {
spaces.add(s);
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are the spaces added to a new list? doesn't findAll return a list?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

model.addAttribute("contentCount",slideContents.size()>0 ? slideContents.get(slideContents.size()-1).getContentOrder() : 0);
if(slideManager.getSlide(id) instanceof BranchingPoint) {
model.addAttribute("choices", ((IBranchingPoint)slide).getChoices());
}
}
System.out.println("the map is"+ selectedSpaceForSpaceBlock.get("CON000000007"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? you even checked the box saying "I do not have any sysout statements in my code or commented out code that isn’t needed anymore" ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that, have removed it now

var blockId = $(this).closest("div").attr("id");
console.log('block id is'+ blockId)
var selectedSpace = selectedSpaceForSpaceBlock[blockId]
console.log('selected space is '+selectedSpace)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all console.log

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

$(".open").css('display', 'none');
$(".open").css('overflow-y', 'scroll');
$(".open").css('height', '400px');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix indentations in above block

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation appears correctly in eclipse i am not sure why it appears like this here.
Screen Shot 2022-02-23 at 12 35 57 PM

model.addAttribute("slideContents", slideContents);
model.addAttribute("selectedSpaceForSpaceBlock", selectedSpaceForSpaceBlock);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are these needed for? each space block should have a space property with the linked space.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this, initially had included this to make the user know which is the current selected space for a space content block, but I have figured a way around this.

@jdamerow jdamerow closed this Jan 12, 2022
@glend17 glend17 reopened this Feb 23, 2022
@jdamerow
Copy link
Member

Resolve conflicts please

@jdamerow jdamerow closed this Feb 23, 2022
@glend17 glend17 reopened this Feb 23, 2022
@jdamerow
Copy link
Member

Make it so, Jenkins.

@jdamerow
Copy link
Member

current space should be selected in dropdown

@jdamerow jdamerow closed this Sep 27, 2024
@ajay3568yadav ajay3568yadav reopened this Oct 2, 2024
@jdamerow
Copy link
Member

Make it so, Jenkins.

1 similar comment
@jdamerow
Copy link
Member

Make it so, Jenkins.

@jdamerow
Copy link
Member

Some slides don't seem to work: https://diging-dev.asu.edu/vspace-dev/staff/module/MOD000000002/slide/SLI000000021

Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'name' cannot be found on null
	at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:213)
	at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:104)
	at org.springframework.expression.spel.ast.PropertyOrFieldReference.access$000(PropertyOrFieldReference.java:51)
	at org.springframework.expression.spel.ast.PropertyOrFieldReference$AccessorLValue.getValue(PropertyOrFieldReference.java:406)
	at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:92)
	at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:112)
	at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:337)
	at org.thymeleaf.spring5.expression.SPELVariableExpressionEvaluator.evaluate(SPELVariableExpressionEvaluator.java:265)
	... 130 more

@jdamerow jdamerow closed this Oct 25, 2024
@ajay3568yadav ajay3568yadav reopened this Oct 30, 2024
@jdamerow
Copy link
Member

Make it so, Jenkins.

5 similar comments
@jdamerow
Copy link
Member

Make it so, Jenkins.

@jdamerow
Copy link
Member

Make it so, Jenkins.

@jdamerow
Copy link
Member

Make it so, Jenkins.

@jdamerow
Copy link
Member

Make it so, Jenkins.

@jdamerow
Copy link
Member

Make it so, Jenkins.

@jdamerow
Copy link
Member

jdamerow commented Nov 1, 2024

Make it so, Jenkins.

url: "[(@{'/staff/module/'+${module.id}+'/slide/'+${slide.id}+'/space/'})]" + blockId,
type: 'GET',
success: function(result) {
if (result != null && result.space != null && result.space.name != null){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think result.space.name != null is needed here? If the space name is null, it shouldn't prevent the space block from being created. However, if there is no title, there should be some dummy text (in the space selection list as well as when displaying the block/link), e.g. ""

currentSpaceName = result.space.name;
$("#selectedSpace").text(currentSpaceName);
$("#editSpaceBlock").text(result.title);
currentSpaceId = result.space.id;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put this line together with line 162

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and honestly, not sure if you even need extra variables here. You can just use result.space.name and result.space.id everywhere.

}

}
async function spaceBlockDoubleClick(e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this async?

$("#editSpaceName").append(newOption).trigger('change');
} else {
$("#editSpaceName").val(currentSpaceId).trigger('change');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm so confused, what is this if block for?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if block checks whether a specific option (with a value equal to currentSpaceId) already exists in the #editSpaceName dropdown menu. If the option is missing, a new one is created with currentSpaceName as the display text and currentSpaceId as the value.

$("#confirmDeleteTextAlert").find('input').remove();
$("#confirmDeleteImageAlert").find('input').remove();
$("#confirmDeleteChoiceBlockAlert").find('input').remove();
$("#confirmDeleteSpaceAlert").hide();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

@@ -991,6 +1181,107 @@
});
});

function getSpaceById(spaceId, callback) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get space by id should use an api call that actually gets the space by its id, not search all and then iterate over all!

let spaceName = null;
for (let i = 0; i < result.length; i++) {
const space = result[i];
if (space.id === spaceId) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is spaceId defined?

});
}

function getCurrentSpace(blockId) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this getting blockId but is called getCurrentSpace and what's the difference to getSpaceById?

var spaceId = selectedSpace.options[selectedSpace.selectedIndex].value;
formData.append('title', title);
formData.append('spaceId', spaceId);
getSpaceById(spaceId, function(spaceName){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for what does this need to be a callback?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, why does getSpaceById to be called here? The space block should only need the space and a title, which you have after selecting a space, don't you?

var addVideoClk=0;
var editVideoClk=0;
var currentBlockId;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm am fairly certain both currentSpaceId and currentBlockId do not need to be global variables.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without currentBlockId as a global variable close Space Block does not work as it is not able to get the id of the block, if you have any other suggestion then lmk.

@jdamerow jdamerow closed this Nov 1, 2024
@ajay3568yadav ajay3568yadav reopened this Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants